win32-security 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES +3 -0
- data/README +2 -5
- data/lib/win32/security.rb +9 -6
- data/lib/win32/security/sid.rb +7 -1
- data/lib/win32/security/windows/functions.rb +7 -1
- data/test/test_security.rb +1 -1
- data/win32-security.gemspec +1 -1
- metadata +12 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eb48272d87182c9d2f834a8756446177ce280d24
|
|
4
|
+
data.tar.gz: 272c29b8ba86646bd85e4fd00e5300ee52dcdba2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2158ce7793c2e4261c6664235451905ed0f74720588d48dbe8c34316d4c4b8dbbfc45b65648f7b38975c94faff89c59b84ecbb8cb3c47b6d30485d8d18c97dcf
|
|
7
|
+
data.tar.gz: ef88d6ee47441bced718e6c981acbeb663739d2b6427511418dcd1b0b8d359e2fa1862f5a58bb2fdabe08cc09b6d793e6efa3df3606c335a663a2ee0df093b57
|
data/CHANGES
CHANGED
data/README
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
= Description
|
|
2
2
|
A security library for MS Windows that allows you to open existing or
|
|
3
3
|
create new security identifiers (SID's), as well as create access
|
|
4
|
-
control lists (ACL's).
|
|
4
|
+
control lists (ACL's) and access control entries (ACE's).
|
|
5
5
|
|
|
6
6
|
= Synopsis
|
|
7
7
|
require 'win32/security'
|
|
@@ -24,10 +24,7 @@
|
|
|
24
24
|
acl.valid? # => true
|
|
25
25
|
|
|
26
26
|
== Future Plans
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
There is an unfinished versions of the ACE class in the repo if you're
|
|
30
|
-
interested in taking a look.
|
|
27
|
+
None at the moment. Suggestions welcome.
|
|
31
28
|
|
|
32
29
|
== Known Issues
|
|
33
30
|
There appears to be an issue with 64-bit versions of JRuby. I believe this
|
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.3.
|
|
23
|
+
VERSION = '0.3.1'
|
|
24
24
|
|
|
25
25
|
# Used by OpenProcessToken
|
|
26
26
|
TOKEN_QUERY = 8
|
|
@@ -28,14 +28,17 @@ module Win32
|
|
|
28
28
|
# Returns whether or not the owner of the current process is running
|
|
29
29
|
# with elevated security privileges.
|
|
30
30
|
#
|
|
31
|
-
# On Windows XP an earlier this method is actually just checking to
|
|
32
|
-
# see if the caller's process is a member of the local Administrator's
|
|
33
|
-
# group.
|
|
34
|
-
#
|
|
35
31
|
def self.elevated_security?
|
|
36
32
|
result = false
|
|
37
33
|
|
|
38
|
-
|
|
34
|
+
# Work around a 64-bit JRuby bug
|
|
35
|
+
if RUBY_PLATFORM == 'java' && ENV_JAVA['sun.arch.data.model'] == '64'
|
|
36
|
+
ptr_type = :ulong_long
|
|
37
|
+
else
|
|
38
|
+
ptr_type = :uintptr_t
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
FFI::MemoryPointer.new(ptr_type) do |token|
|
|
39
42
|
unless OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, token)
|
|
40
43
|
raise SystemCallError.new("OpenProcessToken", FFI.errno)
|
|
41
44
|
end
|
data/lib/win32/security/sid.rb
CHANGED
|
@@ -183,7 +183,13 @@ module Win32
|
|
|
183
183
|
def initialize(account=nil, host=Socket.gethostname)
|
|
184
184
|
if account.nil?
|
|
185
185
|
begin
|
|
186
|
-
|
|
186
|
+
if RUBY_PLATFORM == 'java' && ENV_JAVA['sun.arch.data.model'] == '64'
|
|
187
|
+
ptr_type = :ulong_long
|
|
188
|
+
else
|
|
189
|
+
ptr_type = :uintptr_t
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
ptoken = FFI::MemoryPointer.new(ptr_type)
|
|
187
193
|
|
|
188
194
|
# Try the thread token first, default to the process token.
|
|
189
195
|
bool = OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, true, ptoken)
|
|
@@ -14,9 +14,15 @@ module Windows
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
typedef :ulong, :dword
|
|
17
|
-
typedef :uintptr_t, :handle
|
|
18
17
|
typedef :pointer, :ptr
|
|
19
18
|
|
|
19
|
+
# Work around a bug in 64-bit JRuby
|
|
20
|
+
if RUBY_PLATFORM == 'java' && ENV_JAVA['sun.arch.data.model'] == '64'
|
|
21
|
+
typedef :ulong_long, :handle
|
|
22
|
+
else
|
|
23
|
+
typedef :uintptr_t, :handle
|
|
24
|
+
end
|
|
25
|
+
|
|
20
26
|
ffi_lib :kernel32
|
|
21
27
|
ffi_convention :stdcall
|
|
22
28
|
|
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.3.
|
|
12
|
+
assert_equal('0.3.1', Win32::Security::VERSION)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
test "elevated security basic functionality" do
|
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.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel J. Berger
|
|
@@ -9,62 +9,62 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2014-
|
|
12
|
+
date: 2014-12-09 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: ffi
|
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
|
17
17
|
requirements:
|
|
18
|
-
- -
|
|
18
|
+
- - '>='
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
20
|
version: '0'
|
|
21
21
|
type: :runtime
|
|
22
22
|
prerelease: false
|
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
24
|
requirements:
|
|
25
|
-
- -
|
|
25
|
+
- - '>='
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
27
|
version: '0'
|
|
28
28
|
- !ruby/object:Gem::Dependency
|
|
29
29
|
name: rake
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
|
31
31
|
requirements:
|
|
32
|
-
- -
|
|
32
|
+
- - '>='
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
34
|
version: '0'
|
|
35
35
|
type: :development
|
|
36
36
|
prerelease: false
|
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
|
38
38
|
requirements:
|
|
39
|
-
- -
|
|
39
|
+
- - '>='
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
41
|
version: '0'
|
|
42
42
|
- !ruby/object:Gem::Dependency
|
|
43
43
|
name: test-unit
|
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
|
45
45
|
requirements:
|
|
46
|
-
- -
|
|
46
|
+
- - '>='
|
|
47
47
|
- !ruby/object:Gem::Version
|
|
48
48
|
version: 2.5.0
|
|
49
49
|
type: :development
|
|
50
50
|
prerelease: false
|
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
|
52
52
|
requirements:
|
|
53
|
-
- -
|
|
53
|
+
- - '>='
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
55
|
version: 2.5.0
|
|
56
56
|
- !ruby/object:Gem::Dependency
|
|
57
57
|
name: sys-admin
|
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
|
59
59
|
requirements:
|
|
60
|
-
- -
|
|
60
|
+
- - '>='
|
|
61
61
|
- !ruby/object:Gem::Version
|
|
62
62
|
version: 1.6.0
|
|
63
63
|
type: :development
|
|
64
64
|
prerelease: false
|
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
|
66
66
|
requirements:
|
|
67
|
-
- -
|
|
67
|
+
- - '>='
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
69
|
version: 1.6.0
|
|
70
70
|
description: |2
|
|
@@ -105,12 +105,12 @@ require_paths:
|
|
|
105
105
|
- lib
|
|
106
106
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
|
-
- -
|
|
108
|
+
- - '>='
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '0'
|
|
111
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
requirements:
|
|
113
|
-
- -
|
|
113
|
+
- - '>='
|
|
114
114
|
- !ruby/object:Gem::Version
|
|
115
115
|
version: '0'
|
|
116
116
|
requirements: []
|