win32-security 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,23 +1,23 @@
1
- ########################################################################
2
- # test_security.rb
3
- #
4
- # Test suite for the Win32::Security base class. You should run these
5
- # tests via the rake test tasks.
6
- ########################################################################
7
- require 'test-unit'
8
- require 'win32/security'
9
-
10
- class TC_Win32_Security < Test::Unit::TestCase
11
- test "version constant is set to expected value" do
12
- assert_equal('0.3.1', Win32::Security::VERSION)
13
- end
14
-
15
- test "elevated security basic functionality" do
16
- assert_respond_to(Win32::Security, :elevated_security?)
17
- assert_boolean(Win32::Security.elevated_security?)
18
- end
19
-
20
- test "ffi functions are private" do
21
- assert_not_respond_to(Win32::Security, :CloseHandle)
22
- end
23
- end
1
+ ########################################################################
2
+ # test_security.rb
3
+ #
4
+ # Test suite for the Win32::Security base class. You should run these
5
+ # tests via the rake test tasks.
6
+ ########################################################################
7
+ require 'test-unit'
8
+ require 'win32/security'
9
+
10
+ class TC_Win32_Security < Test::Unit::TestCase
11
+ test "version constant is set to expected value" do
12
+ assert_equal('0.3.2', Win32::Security::VERSION)
13
+ end
14
+
15
+ test "elevated security basic functionality" do
16
+ assert_respond_to(Win32::Security, :elevated_security?)
17
+ assert_boolean(Win32::Security.elevated_security?)
18
+ end
19
+
20
+ test "ffi functions are private" do
21
+ assert_not_respond_to(Win32::Security, :CloseHandle)
22
+ end
23
+ end
@@ -1,142 +1,142 @@
1
- ########################################################################
2
- # test_sid.rb
3
- #
4
- # Test suite for the Win32::Security::SID class. You should run these
5
- # tests via the 'rake test' task.
6
- ########################################################################
7
- require 'etc'
8
- require 'test-unit'
9
- require 'win32/security'
10
- include Win32
11
-
12
- class TC_Win32_Security_Sid < Test::Unit::TestCase
13
- def self.startup
14
- @@host = Socket.gethostname
15
- @@name = Etc.getlogin
16
- end
17
-
18
- def setup
19
- @sid = Security::SID.new(@@name)
20
- end
21
-
22
- test "version is set to expected value" do
23
- assert_equal('0.2.1', Security::SID::VERSION)
24
- end
25
-
26
- test "sid method basic functionality" do
27
- assert_respond_to(@sid, :sid)
28
- assert_kind_of(String, @sid.sid)
29
- end
30
-
31
- test "account method basic functionality" do
32
- assert_respond_to(@sid, :account)
33
- assert_kind_of(String, @sid.account)
34
- end
35
-
36
- test "account_type method basic functionality" do
37
- assert_respond_to(@sid, :account_type)
38
- assert_kind_of(String, @sid.account_type)
39
- end
40
-
41
- test "domain method basic functionality" do
42
- assert_respond_to(@sid, :domain)
43
- assert_kind_of(String, @sid.domain)
44
- end
45
-
46
- test "host method basic functionality" do
47
- assert_respond_to(@sid, :host)
48
- assert_kind_of(String, @sid.host)
49
- end
50
-
51
- test "sid_to_string works as expected" do
52
- assert_respond_to(Security::SID, :sid_to_string)
53
- assert_kind_of(String, Security::SID.sid_to_string(@sid.sid))
54
- assert_not_nil(Security::SID.sid_to_string(@sid.sid) =~ /\w+\-\w+/)
55
- end
56
-
57
- test "string_to_sid works as expected" do
58
- assert_respond_to(Security::SID, :string_to_sid)
59
- assert_kind_of(String, Security::SID.string_to_sid(@sid.to_s))
60
- end
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
-
67
- test "to_s works as expected" do
68
- assert_respond_to(@sid, :to_s)
69
- assert_kind_of(String, @sid.to_s)
70
- assert_true(@sid.to_s.include?('-'))
71
- end
72
-
73
- test "to_str is an alias for to_s" do
74
- assert_respond_to(@sid, :to_str)
75
- assert_alias_method(@sid, :to_str, :to_s)
76
- end
77
-
78
- test "equality works as expected" do
79
- assert_respond_to(@sid, :==)
80
- assert_true(@sid == @sid)
81
- end
82
-
83
- test "valid? method works as expected" do
84
- assert_respond_to(@sid, :valid?)
85
- assert_true(@sid.valid?)
86
- end
87
-
88
- test "length method works as expected" do
89
- assert_respond_to(@sid, :length)
90
- assert_true(@sid.length > 0)
91
- end
92
-
93
- test "create method works as expected" do
94
- assert_respond_to(Security::SID, :create)
95
- assert_nothing_raised{
96
- Security::SID.create(
97
- Security::SID::SECURITY_WORLD_SID_AUTHORITY,
98
- Security::SID::SECURITY_WORLD_RID
99
- )
100
- }
101
- end
102
-
103
- test "constructor defaults to current account" do
104
- assert_nothing_raised{ @sid = Security::SID.new }
105
- assert_equal(Etc.getlogin, @sid.account)
106
- end
107
-
108
- test "constructor accepts an account argument" do
109
- assert_nothing_raised{ Security::SID.new(@@name) }
110
- end
111
-
112
- test "constructor accepts a host argument" do
113
- assert_nothing_raised{ Security::SID.new(@@name, @@host) }
114
- end
115
-
116
- test "constructor accepts a maximum of two arguments" do
117
- assert_raise(ArgumentError){ Security::SID.new(@@name, @@host, @@host) }
118
- end
119
-
120
- test "constructor raises an error if an invalid account is passed" do
121
- assert_raise(SystemCallError){ Security::SID.new('bogus') }
122
- end
123
-
124
- test "well known sid constants are defined" do
125
- assert_equal('S-1-0', Security::SID::Null)
126
- assert_equal('S-1-0-0', Security::SID::Nobody)
127
- assert_equal('S-1-1', Security::SID::World)
128
- assert_equal('S-1-1-0', Security::SID::Everyone)
129
- assert_equal('S-1-5-32-544', Security::SID::BuiltinAdministrators)
130
- assert_equal('S-1-5-32-545', Security::SID::BuiltinUsers)
131
- assert_equal('S-1-5-32-546', Security::SID::Guests)
132
- end
133
-
134
- def teardown
135
- @sid = nil
136
- end
137
-
138
- def self.shutdown
139
- @@host = nil
140
- @@name = nil
141
- end
142
- end
1
+ ########################################################################
2
+ # test_sid.rb
3
+ #
4
+ # Test suite for the Win32::Security::SID class. You should run these
5
+ # tests via the 'rake test' task.
6
+ ########################################################################
7
+ require 'etc'
8
+ require 'test-unit'
9
+ require 'win32/security'
10
+ include Win32
11
+
12
+ class TC_Win32_Security_Sid < Test::Unit::TestCase
13
+ def self.startup
14
+ @@host = Socket.gethostname
15
+ @@name = Etc.getlogin
16
+ end
17
+
18
+ def setup
19
+ @sid = Security::SID.new(@@name)
20
+ end
21
+
22
+ test "version is set to expected value" do
23
+ assert_equal('0.2.2', Security::SID::VERSION)
24
+ end
25
+
26
+ test "sid method basic functionality" do
27
+ assert_respond_to(@sid, :sid)
28
+ assert_kind_of(String, @sid.sid)
29
+ end
30
+
31
+ test "account method basic functionality" do
32
+ assert_respond_to(@sid, :account)
33
+ assert_kind_of(String, @sid.account)
34
+ end
35
+
36
+ test "account_type method basic functionality" do
37
+ assert_respond_to(@sid, :account_type)
38
+ assert_kind_of(String, @sid.account_type)
39
+ end
40
+
41
+ test "domain method basic functionality" do
42
+ assert_respond_to(@sid, :domain)
43
+ assert_kind_of(String, @sid.domain)
44
+ end
45
+
46
+ test "host method basic functionality" do
47
+ assert_respond_to(@sid, :host)
48
+ assert_kind_of(String, @sid.host)
49
+ end
50
+
51
+ test "sid_to_string works as expected" do
52
+ assert_respond_to(Security::SID, :sid_to_string)
53
+ assert_kind_of(String, Security::SID.sid_to_string(@sid.sid))
54
+ assert_not_nil(Security::SID.sid_to_string(@sid.sid) =~ /\w+\-\w+/)
55
+ end
56
+
57
+ test "string_to_sid works as expected" do
58
+ assert_respond_to(Security::SID, :string_to_sid)
59
+ assert_kind_of(String, Security::SID.string_to_sid(@sid.to_s))
60
+ end
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
+
67
+ test "to_s works as expected" do
68
+ assert_respond_to(@sid, :to_s)
69
+ assert_kind_of(String, @sid.to_s)
70
+ assert_true(@sid.to_s.include?('-'))
71
+ end
72
+
73
+ test "to_str is an alias for to_s" do
74
+ assert_respond_to(@sid, :to_str)
75
+ assert_alias_method(@sid, :to_str, :to_s)
76
+ end
77
+
78
+ test "equality works as expected" do
79
+ assert_respond_to(@sid, :==)
80
+ assert_true(@sid == @sid)
81
+ end
82
+
83
+ test "valid? method works as expected" do
84
+ assert_respond_to(@sid, :valid?)
85
+ assert_true(@sid.valid?)
86
+ end
87
+
88
+ test "length method works as expected" do
89
+ assert_respond_to(@sid, :length)
90
+ assert_true(@sid.length > 0)
91
+ end
92
+
93
+ test "create method works as expected" do
94
+ assert_respond_to(Security::SID, :create)
95
+ assert_nothing_raised{
96
+ Security::SID.create(
97
+ Security::SID::SECURITY_WORLD_SID_AUTHORITY,
98
+ Security::SID::SECURITY_WORLD_RID
99
+ )
100
+ }
101
+ end
102
+
103
+ test "constructor defaults to current account" do
104
+ assert_nothing_raised{ @sid = Security::SID.new }
105
+ assert_equal(Etc.getlogin, @sid.account)
106
+ end
107
+
108
+ test "constructor accepts an account argument" do
109
+ assert_nothing_raised{ Security::SID.new(@@name) }
110
+ end
111
+
112
+ test "constructor accepts a host argument" do
113
+ assert_nothing_raised{ Security::SID.new(@@name, @@host) }
114
+ end
115
+
116
+ test "constructor accepts a maximum of two arguments" do
117
+ assert_raise(ArgumentError){ Security::SID.new(@@name, @@host, @@host) }
118
+ end
119
+
120
+ test "constructor raises an error if an invalid account is passed" do
121
+ assert_raise(SystemCallError){ Security::SID.new('bogus') }
122
+ end
123
+
124
+ test "well known sid constants are defined" do
125
+ assert_equal('S-1-0', Security::SID::Null)
126
+ assert_equal('S-1-0-0', Security::SID::Nobody)
127
+ assert_equal('S-1-1', Security::SID::World)
128
+ assert_equal('S-1-1-0', Security::SID::Everyone)
129
+ assert_equal('S-1-5-32-544', Security::SID::BuiltinAdministrators)
130
+ assert_equal('S-1-5-32-545', Security::SID::BuiltinUsers)
131
+ assert_equal('S-1-5-32-546', Security::SID::Guests)
132
+ end
133
+
134
+ def teardown
135
+ @sid = nil
136
+ end
137
+
138
+ def self.shutdown
139
+ @@host = nil
140
+ @@name = nil
141
+ end
142
+ end
@@ -1,27 +1,28 @@
1
- require 'rubygems'
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = 'win32-security'
5
- spec.version = '0.3.1'
6
- spec.authors = ['Daniel J. Berger', 'Park Heesob']
7
- spec.license = 'Artistic 2.0'
8
- spec.email = 'djberg96@gmail.com'
9
- spec.homepage = 'https://github.com/djberg96/win32-security'
10
- spec.summary = 'A library for dealing with aspects of Windows security.'
11
- spec.test_files = Dir['test/*.rb']
12
- spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
13
-
14
- spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
15
-
16
- spec.add_dependency('ffi')
17
-
18
- spec.add_development_dependency('rake')
19
- spec.add_development_dependency('test-unit', '>= 2.5.0')
20
- spec.add_development_dependency('sys-admin', '>= 1.6.0')
21
-
22
- spec.description = <<-EOF
23
- The win32-security library provides an interface for dealing with
24
- security related aspects of MS Windows, such as SID's, ACL's and
25
- ACE's.
26
- EOF
27
- end
1
+ require 'rubygems'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'win32-security'
5
+ spec.version = '0.3.2'
6
+ spec.authors = ['Daniel J. Berger', 'Park Heesob']
7
+ spec.license = 'Artistic 2.0'
8
+ spec.email = 'djberg96@gmail.com'
9
+ spec.homepage = 'https://github.com/djberg96/win32-security'
10
+ spec.summary = 'A library for dealing with aspects of Windows security.'
11
+ spec.test_files = Dir['test/*.rb']
12
+ spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
13
+ spec.cert_chain = Dir['certs/*']
14
+
15
+ spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
16
+
17
+ spec.add_dependency('ffi')
18
+
19
+ spec.add_development_dependency('rake')
20
+ spec.add_development_dependency('test-unit', '>= 2.5.0')
21
+ spec.add_development_dependency('sys-admin', '>= 1.6.0')
22
+
23
+ spec.description = <<-EOF
24
+ The win32-security library provides an interface for dealing with
25
+ security related aspects of MS Windows, such as SID's, ACL's and
26
+ ACE's.
27
+ EOF
28
+ end
metadata CHANGED
@@ -1,70 +1,92 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32-security
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
8
8
  - Park Heesob
9
9
  autorequire:
10
10
  bindir: bin
11
- cert_chain: []
12
- date: 2014-12-09 00:00:00.000000000 Z
11
+ cert_chain:
12
+ - |
13
+ -----BEGIN CERTIFICATE-----
14
+ MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
15
+ cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
16
+ MB4XDTE1MDkwMjIwNDkxOFoXDTE2MDkwMTIwNDkxOFowPzERMA8GA1UEAwwIZGpi
17
+ ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
18
+ bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMyTkvXqRp6hLs9eoJOS
19
+ Hmi8kRYbq9Vkf15/hMxJpotYMgJVHHWrmDcC5Dye2PbnXjTkKf266Zw0PtT9h+lI
20
+ S3ts9HO+vaCFSMwFFZmnWJSpQ3CNw2RcHxjWkk9yF7imEM8Kz9ojhiDXzBetdV6M
21
+ gr0lV/alUr7TNVBDngbXEfTWscyXh1qd7xZ4EcOdsDktCe5G45N/o3662tPQvJsi
22
+ FOF0CM/KuBsa/HL1/eoEmF4B3EKIRfTHrQ3hu20Kv3RJ88QM4ec2+0dd97uX693O
23
+ zv6981fyEg+aXLkxrkViM/tz2qR2ZE0jPhHTREPYeMEgptRkTmWSKAuLVWrJEfgl
24
+ DtkCAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFEwe
25
+ nn6bfJADmuIDiMSOzedOrL+xMB0GA1UdEQQWMBSBEmRqYmVyZzk2QGdtYWlsLmNv
26
+ bTAdBgNVHRIEFjAUgRJkamJlcmc5NkBnbWFpbC5jb20wDQYJKoZIhvcNAQEFBQAD
27
+ ggEBAHmNOCWoDVD75zHFueY0viwGDVP1BNGFC+yXcb7u2GlK+nEMCORqzURbYPf7
28
+ tL+/hzmePIRz7i30UM//64GI1NLv9jl7nIwjhPpXpf7/lu2I9hOTsvwSumb5UiKC
29
+ /sqBxI3sfj9pr79Wpv4MuikX1XPik7Ncb7NPsJPw06Lvyc3Hkg5X2XpPtLtS+Gr2
30
+ wKJnmzb5rIPS1cmsqv0M9LPWflzfwoZ/SpnmhagP+g05p8bRNKjZSA2iImM/GyYZ
31
+ EJYzxdPOrx2n6NYR3Hk+vHP0U7UBSveI6+qx+ndQYaeyCn+GRX2PKS9h66YF/Q1V
32
+ tGSHgAmcLlkdGgan182qsE/4kKM=
33
+ -----END CERTIFICATE-----
34
+ date: 2015-12-04 00:00:00.000000000 Z
13
35
  dependencies:
14
36
  - !ruby/object:Gem::Dependency
15
37
  name: ffi
16
38
  requirement: !ruby/object:Gem::Requirement
17
39
  requirements:
18
- - - '>='
40
+ - - ">="
19
41
  - !ruby/object:Gem::Version
20
42
  version: '0'
21
43
  type: :runtime
22
44
  prerelease: false
23
45
  version_requirements: !ruby/object:Gem::Requirement
24
46
  requirements:
25
- - - '>='
47
+ - - ">="
26
48
  - !ruby/object:Gem::Version
27
49
  version: '0'
28
50
  - !ruby/object:Gem::Dependency
29
51
  name: rake
30
52
  requirement: !ruby/object:Gem::Requirement
31
53
  requirements:
32
- - - '>='
54
+ - - ">="
33
55
  - !ruby/object:Gem::Version
34
56
  version: '0'
35
57
  type: :development
36
58
  prerelease: false
37
59
  version_requirements: !ruby/object:Gem::Requirement
38
60
  requirements:
39
- - - '>='
61
+ - - ">="
40
62
  - !ruby/object:Gem::Version
41
63
  version: '0'
42
64
  - !ruby/object:Gem::Dependency
43
65
  name: test-unit
44
66
  requirement: !ruby/object:Gem::Requirement
45
67
  requirements:
46
- - - '>='
68
+ - - ">="
47
69
  - !ruby/object:Gem::Version
48
70
  version: 2.5.0
49
71
  type: :development
50
72
  prerelease: false
51
73
  version_requirements: !ruby/object:Gem::Requirement
52
74
  requirements:
53
- - - '>='
75
+ - - ">="
54
76
  - !ruby/object:Gem::Version
55
77
  version: 2.5.0
56
78
  - !ruby/object:Gem::Dependency
57
79
  name: sys-admin
58
80
  requirement: !ruby/object:Gem::Requirement
59
81
  requirements:
60
- - - '>='
82
+ - - ">="
61
83
  - !ruby/object:Gem::Version
62
84
  version: 1.6.0
63
85
  type: :development
64
86
  prerelease: false
65
87
  version_requirements: !ruby/object:Gem::Requirement
66
88
  requirements:
67
- - - '>='
89
+ - - ">="
68
90
  - !ruby/object:Gem::Version
69
91
  version: 1.6.0
70
92
  description: |2
@@ -79,17 +101,25 @@ extra_rdoc_files:
79
101
  - CHANGES
80
102
  - MANIFEST
81
103
  files:
104
+ - certs
105
+ - certs/djberg96_pub.pem
82
106
  - CHANGES
83
- - MANIFEST
84
- - README
85
- - Rakefile
86
- - lib/win32/security.rb
107
+ - lib
108
+ - lib/win32
109
+ - lib/win32/security
87
110
  - lib/win32/security/ace.rb
88
111
  - lib/win32/security/acl.rb
89
112
  - lib/win32/security/sid.rb
113
+ - lib/win32/security/windows
90
114
  - lib/win32/security/windows/constants.rb
91
115
  - lib/win32/security/windows/functions.rb
92
116
  - lib/win32/security/windows/structs.rb
117
+ - lib/win32/security.rb
118
+ - lib/win32-security.rb
119
+ - MANIFEST
120
+ - Rakefile
121
+ - README
122
+ - test
93
123
  - test/test_ace.rb
94
124
  - test/test_acl.rb
95
125
  - test/test_security.rb
@@ -105,17 +135,17 @@ require_paths:
105
135
  - lib
106
136
  required_ruby_version: !ruby/object:Gem::Requirement
107
137
  requirements:
108
- - - '>='
138
+ - - ">="
109
139
  - !ruby/object:Gem::Version
110
140
  version: '0'
111
141
  required_rubygems_version: !ruby/object:Gem::Requirement
112
142
  requirements:
113
- - - '>='
143
+ - - ">="
114
144
  - !ruby/object:Gem::Version
115
145
  version: '0'
116
146
  requirements: []
117
147
  rubyforge_project:
118
- rubygems_version: 2.4.2
148
+ rubygems_version: 2.4.8
119
149
  signing_key:
120
150
  specification_version: 4
121
151
  summary: A library for dealing with aspects of Windows security.