win32-security 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +4 -0
- data/README +4 -3
- data/lib/win32/security.rb +3 -3
- data/lib/win32/security/sid.rb +7 -5
- data/lib/win32/security/windows/functions.rb +1 -0
- data/test/test_security.rb +1 -1
- data/test/test_sid.rb +6 -1
- data/win32-security.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55e26f7dee9565c7f2bbcb65430d048ee8fde06e
|
4
|
+
data.tar.gz: f56540e1e2536ad249d493f772b12ff132797cec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c2956d92cbcce0951f7b67150bdd324754e42c8faac2d5e2068e25d2bada7d12588c44775bb1c6d427415f0965f8792473a7c98c0ff57925b1f2861e0b2b605
|
7
|
+
data.tar.gz: e9676d488e07a8648b5e19227e5a396bb815b1377740044ac68e479bfc2489019a5fcf818ece2f63f70a4afd03788b820973c4d292d65975f83c8ff9a03ab193
|
data/CHANGES
CHANGED
data/README
CHANGED
@@ -20,8 +20,9 @@
|
|
20
20
|
repo if you're interested in taking a look.
|
21
21
|
|
22
22
|
== Known Issues
|
23
|
-
None that I'm aware of. Please file any bug reports on the project page
|
24
|
-
|
23
|
+
None that I'm aware of. Please file any bug reports on the project page at:
|
24
|
+
|
25
|
+
https://github.com/djberg96/win32-security
|
25
26
|
|
26
27
|
== Contributions
|
27
28
|
Although this library is free, please consider having your company
|
@@ -33,7 +34,7 @@
|
|
33
34
|
Artistic 2.0
|
34
35
|
|
35
36
|
== Copyright
|
36
|
-
(C) 2003-
|
37
|
+
(C) 2003-2014 Daniel J. Berger
|
37
38
|
All Rights Reserved
|
38
39
|
|
39
40
|
== Authors
|
data/lib/win32/security.rb
CHANGED
@@ -20,7 +20,7 @@ module Win32
|
|
20
20
|
extend Windows::Security::Functions
|
21
21
|
|
22
22
|
# The version of the win32-security library
|
23
|
-
VERSION = '0.2.
|
23
|
+
VERSION = '0.2.5'
|
24
24
|
|
25
25
|
# Used by OpenProcessToken
|
26
26
|
TOKEN_QUERY = 8
|
@@ -60,14 +60,14 @@ module Win32
|
|
60
60
|
|
61
61
|
pbool.read_long != 0
|
62
62
|
else
|
63
|
-
token = FFI::MemoryPointer.new(:
|
63
|
+
token = FFI::MemoryPointer.new(:uintptr_t)
|
64
64
|
|
65
65
|
unless OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, token)
|
66
66
|
raise SystemCallError.new("OpenProcessToken", FFI.errno)
|
67
67
|
end
|
68
68
|
|
69
69
|
begin
|
70
|
-
token = token.
|
70
|
+
token = token.read_pointer.to_i
|
71
71
|
|
72
72
|
# Since the TokenElevation struct only has 1 member, we use a pointer.
|
73
73
|
te = FFI::MemoryPointer.new(:ulong)
|
data/lib/win32/security/sid.rb
CHANGED
@@ -17,7 +17,7 @@ module Win32
|
|
17
17
|
extend Windows::Security::Functions
|
18
18
|
|
19
19
|
# The version of the Win32::Security::SID class.
|
20
|
-
VERSION = '0.2.
|
20
|
+
VERSION = '0.2.1'
|
21
21
|
|
22
22
|
# Some constant SID's for your convenience, in string format.
|
23
23
|
# See http://support.microsoft.com/kb/243330 for details.
|
@@ -96,7 +96,9 @@ module Win32
|
|
96
96
|
raise SystemCallError.new("ConvertStringSidToSid", FFI.errno)
|
97
97
|
end
|
98
98
|
|
99
|
-
sid.read_pointer
|
99
|
+
ptr = sid.read_pointer
|
100
|
+
|
101
|
+
ptr.read_bytes(GetLengthSid(ptr))
|
100
102
|
end
|
101
103
|
|
102
104
|
# Creates a new SID with +authority+ and up to 8 +subauthorities+,
|
@@ -172,7 +174,7 @@ module Win32
|
|
172
174
|
def initialize(account=nil, host=Socket.gethostname)
|
173
175
|
if account.nil?
|
174
176
|
begin
|
175
|
-
ptoken = FFI::MemoryPointer.new(:
|
177
|
+
ptoken = FFI::MemoryPointer.new(:uintptr_t)
|
176
178
|
|
177
179
|
# Try the thread token first, default to the process token.
|
178
180
|
bool = OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, true, ptoken)
|
@@ -180,13 +182,13 @@ module Win32
|
|
180
182
|
if !bool && FFI.errno != ERROR_NO_TOKEN
|
181
183
|
raise SystemCallError.new("OpenThreadToken", FFI.errno)
|
182
184
|
else
|
183
|
-
ptoken = FFI::MemoryPointer.new(:
|
185
|
+
ptoken = FFI::MemoryPointer.new(:uintptr_t)
|
184
186
|
unless OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, ptoken)
|
185
187
|
raise SystemCallError.new("OpenProcessToken", FFI.errno)
|
186
188
|
end
|
187
189
|
end
|
188
190
|
|
189
|
-
token = ptoken.
|
191
|
+
token = ptoken.read_pointer.to_i
|
190
192
|
pinfo = FFI::MemoryPointer.new(:pointer)
|
191
193
|
plength = FFI::MemoryPointer.new(:ulong)
|
192
194
|
|
data/test/test_security.rb
CHANGED
@@ -9,7 +9,7 @@ require 'win32/security'
|
|
9
9
|
|
10
10
|
class TC_Win32_Security < Test::Unit::TestCase
|
11
11
|
test "version constant is set to expected value" do
|
12
|
-
assert_equal('0.2.
|
12
|
+
assert_equal('0.2.5', Win32::Security::VERSION)
|
13
13
|
end
|
14
14
|
|
15
15
|
test "elevated security basic functionality" do
|
data/test/test_sid.rb
CHANGED
@@ -20,7 +20,7 @@ class TC_Win32_Security_Sid < Test::Unit::TestCase
|
|
20
20
|
end
|
21
21
|
|
22
22
|
test "version is set to expected value" do
|
23
|
-
assert_equal('0.2.
|
23
|
+
assert_equal('0.2.1', Security::SID::VERSION)
|
24
24
|
end
|
25
25
|
|
26
26
|
test "sid method basic functionality" do
|
@@ -59,6 +59,11 @@ class TC_Win32_Security_Sid < Test::Unit::TestCase
|
|
59
59
|
assert_kind_of(String, Security::SID.string_to_sid(@sid.to_s))
|
60
60
|
end
|
61
61
|
|
62
|
+
test "we can convert back and forth between a sid and a string" do
|
63
|
+
str = Security::SID.sid_to_string(@sid.sid)
|
64
|
+
assert_equal(@sid.sid, Security::SID.string_to_sid(str))
|
65
|
+
end
|
66
|
+
|
62
67
|
test "to_s works as expected" do
|
63
68
|
assert_respond_to(@sid, :to_s)
|
64
69
|
assert_kind_of(String, @sid.to_s)
|
data/win32-security.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win32-security
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-02-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|