activesambaldap 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS.en +9 -0
- data/NEWS.ja +10 -0
- data/README.en +310 -0
- data/README.ja +307 -0
- data/Rakefile +95 -0
- data/bin/asl-groupadd +70 -0
- data/bin/asl-groupdel +58 -0
- data/bin/asl-groupmod +133 -0
- data/bin/asl-groupshow +31 -0
- data/bin/asl-passwd +99 -0
- data/bin/asl-populate +96 -0
- data/bin/asl-purge +24 -0
- data/bin/asl-samba-computeradd +94 -0
- data/bin/asl-samba-groupadd +55 -0
- data/bin/asl-samba-groupdel +53 -0
- data/bin/asl-samba-groupmod +98 -0
- data/bin/asl-samba-useradd +98 -0
- data/bin/asl-samba-userdel +47 -0
- data/bin/asl-samba-usermod +92 -0
- data/bin/asl-useradd +263 -0
- data/bin/asl-userdel +75 -0
- data/bin/asl-usermod +335 -0
- data/bin/asl-usershow +31 -0
- data/lib/active_samba_ldap/account.rb +199 -0
- data/lib/active_samba_ldap/base.rb +126 -0
- data/lib/active_samba_ldap/command.rb +94 -0
- data/lib/active_samba_ldap/computer.rb +13 -0
- data/lib/active_samba_ldap/computer_account.rb +34 -0
- data/lib/active_samba_ldap/configuration.rb +322 -0
- data/lib/active_samba_ldap/dc.rb +17 -0
- data/lib/active_samba_ldap/entry.rb +80 -0
- data/lib/active_samba_ldap/group.rb +182 -0
- data/lib/active_samba_ldap/idmap.rb +17 -0
- data/lib/active_samba_ldap/ou.rb +18 -0
- data/lib/active_samba_ldap/populate.rb +254 -0
- data/lib/active_samba_ldap/samba_account.rb +200 -0
- data/lib/active_samba_ldap/samba_computer.rb +20 -0
- data/lib/active_samba_ldap/samba_group.rb +126 -0
- data/lib/active_samba_ldap/samba_user.rb +39 -0
- data/lib/active_samba_ldap/unix_id_pool.rb +41 -0
- data/lib/active_samba_ldap/user.rb +14 -0
- data/lib/active_samba_ldap/user_account.rb +30 -0
- data/lib/active_samba_ldap/version.rb +3 -0
- data/lib/active_samba_ldap.rb +29 -0
- data/lib/samba/encrypt.rb +86 -0
- data/misc/rd2html.rb +42 -0
- data/rails/plugin/active_samba_ldap/README +30 -0
- data/rails/plugin/active_samba_ldap/generators/scaffold_asl/scaffold_asl_generator.rb +28 -0
- data/rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/computer.rb +3 -0
- data/rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/dc.rb +3 -0
- data/rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/group.rb +3 -0
- data/rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/idmap.rb +3 -0
- data/rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/ldap.yml +24 -0
- data/rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/ou.rb +3 -0
- data/rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/samba_controller.rb +12 -0
- data/rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/samba_helper.rb +2 -0
- data/rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/samba_index.rhtml +17 -0
- data/rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/samba_populate.rhtml +15 -0
- data/rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/samba_purge.rhtml +10 -0
- data/rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/unix_id_pool.rb +3 -0
- data/rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/user.rb +3 -0
- data/rails/plugin/active_samba_ldap/init.rb +6 -0
- data/test/asl-test-utils.rb +276 -0
- data/test/command.rb +64 -0
- data/test/config.yaml.sample +17 -0
- data/test/run-test.rb +18 -0
- data/test/test-unit-ext/always-show-result.rb +28 -0
- data/test/test-unit-ext/priority.rb +159 -0
- data/test/test-unit-ext.rb +2 -0
- data/test/test_asl_groupadd.rb +69 -0
- data/test/test_asl_groupdel.rb +88 -0
- data/test/test_asl_groupmod.rb +256 -0
- data/test/test_asl_groupshow.rb +21 -0
- data/test/test_asl_passwd.rb +125 -0
- data/test/test_asl_populate.rb +92 -0
- data/test/test_asl_purge.rb +21 -0
- data/test/test_asl_useradd.rb +710 -0
- data/test/test_asl_userdel.rb +73 -0
- data/test/test_asl_usermod.rb +541 -0
- data/test/test_asl_usershow.rb +27 -0
- data/test/test_group.rb +21 -0
- data/test/test_password.rb +51 -0
- data/test/test_samba_encrypt.rb +36 -0
- data/test/test_user_home_directory.rb +43 -0
- metadata +177 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'asl-test-utils'
|
2
|
+
|
3
|
+
class PasswordTest < Test::Unit::TestCase
|
4
|
+
include AslTestUtils
|
5
|
+
|
6
|
+
priority :must
|
7
|
+
def test_password_hash_type
|
8
|
+
%w(crypt md5 smd5 sha ssha).each do |type|
|
9
|
+
assert_valid_password_hash_type(type) do |klass, normalized_type|
|
10
|
+
user = klass.new("XXX")
|
11
|
+
user.change_password("password")
|
12
|
+
assert_match(/^\{#{Regexp.escape(normalized_type.to_s.upcase)}\}/,
|
13
|
+
user.user_password)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_validate_password_hash_type
|
19
|
+
%w(crypt md5 smd5 sha ssha).each do |type|
|
20
|
+
assert_valid_password_hash_type(type)
|
21
|
+
assert_valid_password_hash_type(type.to_sym)
|
22
|
+
assert_valid_password_hash_type(type.upcase)
|
23
|
+
assert_valid_password_hash_type(type.capitalize)
|
24
|
+
end
|
25
|
+
|
26
|
+
assert_invalid_password_hash_type("XXX")
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
def assert_valid_password_hash_type(type)
|
31
|
+
klass = Class.new(@user_class)
|
32
|
+
assert_nothing_raised do
|
33
|
+
configuration = reference_configuration.merge(:password_hash_type => type)
|
34
|
+
klass.establish_connection(configuration)
|
35
|
+
klass.ldap_mapping
|
36
|
+
end
|
37
|
+
yield(klass, klass.configuration[:password_hash_type]) if block_given?
|
38
|
+
ensure
|
39
|
+
klass.remove_connection
|
40
|
+
end
|
41
|
+
|
42
|
+
def assert_invalid_password_hash_type(type)
|
43
|
+
klass = Class.new(@user_class)
|
44
|
+
assert_raises(ActiveSambaLdap::InvalidConfigurationValueError) do
|
45
|
+
configuration = reference_configuration.merge(:password_hash_type => type)
|
46
|
+
klass.establish_connection(configuration)
|
47
|
+
end
|
48
|
+
ensure
|
49
|
+
klass.remove_connection
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'test-unit-ext'
|
3
|
+
|
4
|
+
require 'stringio'
|
5
|
+
|
6
|
+
require 'samba/encrypt'
|
7
|
+
|
8
|
+
class SambaEncryptTest < Test::Unit::TestCase
|
9
|
+
def test_lm_hash
|
10
|
+
assert_equal("E52CAC67419A9A224A3B108F3FA6CB6D",
|
11
|
+
Samba::Encrypt.lm_hash("password"))
|
12
|
+
assert_equal("E52CAC67419A9A224A3B108F3FA6CB6D",
|
13
|
+
Samba::Encrypt.lm_hash("paSSWOrd"))
|
14
|
+
assert_equal("E0C510199CC66ABDE0C510199CC66ABD",
|
15
|
+
Samba::Encrypt.lm_hash("abcdefgabcdefg"))
|
16
|
+
assert_equal("FF3750BCC2B22412C2265B23734E0DAC",
|
17
|
+
Samba::Encrypt.lm_hash("SecREt01"))
|
18
|
+
begin
|
19
|
+
stderr = $stderr
|
20
|
+
$stderr = StringIO.new
|
21
|
+
assert_equal("E0C510199CC66ABDE0C510199CC66ABD",
|
22
|
+
Samba::Encrypt.lm_hash("abcdefgabcdefg" + "X"))
|
23
|
+
assert_equal("E0C510199CC66ABDE0C510199CC66ABD",
|
24
|
+
Samba::Encrypt.lm_hash("abcdefgabcdefg" + "X" * 100))
|
25
|
+
assert_equal("password is truncated to 14 characters\n" * 2,
|
26
|
+
$stderr.string)
|
27
|
+
ensure
|
28
|
+
$stderr = stderr
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_ntlm_hash
|
33
|
+
assert_equal("8846F7EAEE8FB117AD06BDD830B7586C",
|
34
|
+
Samba::Encrypt.ntlm_hash("password"))
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'asl-test-utils'
|
2
|
+
|
3
|
+
class UserHomeDirectoryTest < Test::Unit::TestCase
|
4
|
+
include AslTestUtils
|
5
|
+
|
6
|
+
priority :must
|
7
|
+
def test_validate_user_home_directory_mode
|
8
|
+
assert_valid_user_home_directory_mode(0700) do |klass, mode|
|
9
|
+
assert_equal(0700, mode)
|
10
|
+
end
|
11
|
+
assert_valid_user_home_directory_mode("0750") do |klass, mode|
|
12
|
+
assert_equal(0750, mode)
|
13
|
+
end
|
14
|
+
assert_valid_user_home_directory_mode(nil) do |klass, mode|
|
15
|
+
assert_equal(0755, mode)
|
16
|
+
end
|
17
|
+
|
18
|
+
assert_invalid_user_home_directory_mode("XXX")
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
def assert_valid_user_home_directory_mode(type)
|
23
|
+
klass = Class.new(@user_class)
|
24
|
+
assert_nothing_raised do
|
25
|
+
config = reference_configuration.merge(:user_home_directory_mode => type)
|
26
|
+
klass.establish_connection(config)
|
27
|
+
klass.ldap_mapping
|
28
|
+
end
|
29
|
+
yield(klass, klass.configuration[:user_home_directory_mode]) if block_given?
|
30
|
+
ensure
|
31
|
+
klass.remove_connection
|
32
|
+
end
|
33
|
+
|
34
|
+
def assert_invalid_user_home_directory_mode(type)
|
35
|
+
klass = Class.new(@user_class)
|
36
|
+
assert_raises(ActiveSambaLdap::InvalidConfigurationValueError) do
|
37
|
+
config = reference_configuration.merge(:user_home_directory_mode => type)
|
38
|
+
klass.establish_connection(config)
|
39
|
+
end
|
40
|
+
ensure
|
41
|
+
klass.remove_connection
|
42
|
+
end
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.0
|
3
|
+
specification_version: 1
|
4
|
+
name: activesambaldap
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.0.1
|
7
|
+
date: 2006-11-18 00:00:00 +09:00
|
8
|
+
summary: ActiveSambaLdap is a library and a management tool for Samba + LDAP environment.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: kou@cozmixng.org
|
12
|
+
homepage: http://asl.rubyforge.org/
|
13
|
+
rubyforge_project: asl
|
14
|
+
description: ActiveSambaLdap provides object-oriented API to manipulate LDAP entry for Samba. ActiveSambaLdap also provides command-line tools to replace smbldap-tools written by Perl.
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- Kouhei Sutou
|
31
|
+
files:
|
32
|
+
- NEWS.en
|
33
|
+
- NEWS.ja
|
34
|
+
- README.en
|
35
|
+
- README.ja
|
36
|
+
- Rakefile
|
37
|
+
- bin/asl-groupadd
|
38
|
+
- bin/asl-groupdel
|
39
|
+
- bin/asl-groupmod
|
40
|
+
- bin/asl-groupshow
|
41
|
+
- bin/asl-passwd
|
42
|
+
- bin/asl-populate
|
43
|
+
- bin/asl-purge
|
44
|
+
- bin/asl-samba-computeradd
|
45
|
+
- bin/asl-samba-groupadd
|
46
|
+
- bin/asl-samba-groupdel
|
47
|
+
- bin/asl-samba-groupmod
|
48
|
+
- bin/asl-samba-useradd
|
49
|
+
- bin/asl-samba-userdel
|
50
|
+
- bin/asl-samba-usermod
|
51
|
+
- bin/asl-useradd
|
52
|
+
- bin/asl-userdel
|
53
|
+
- bin/asl-usermod
|
54
|
+
- bin/asl-usershow
|
55
|
+
- lib/active_samba_ldap.rb
|
56
|
+
- lib/active_samba_ldap/account.rb
|
57
|
+
- lib/active_samba_ldap/base.rb
|
58
|
+
- lib/active_samba_ldap/command.rb
|
59
|
+
- lib/active_samba_ldap/computer.rb
|
60
|
+
- lib/active_samba_ldap/computer_account.rb
|
61
|
+
- lib/active_samba_ldap/configuration.rb
|
62
|
+
- lib/active_samba_ldap/dc.rb
|
63
|
+
- lib/active_samba_ldap/entry.rb
|
64
|
+
- lib/active_samba_ldap/group.rb
|
65
|
+
- lib/active_samba_ldap/idmap.rb
|
66
|
+
- lib/active_samba_ldap/ou.rb
|
67
|
+
- lib/active_samba_ldap/populate.rb
|
68
|
+
- lib/active_samba_ldap/samba_account.rb
|
69
|
+
- lib/active_samba_ldap/samba_computer.rb
|
70
|
+
- lib/active_samba_ldap/samba_group.rb
|
71
|
+
- lib/active_samba_ldap/samba_user.rb
|
72
|
+
- lib/active_samba_ldap/unix_id_pool.rb
|
73
|
+
- lib/active_samba_ldap/user.rb
|
74
|
+
- lib/active_samba_ldap/user_account.rb
|
75
|
+
- lib/active_samba_ldap/version.rb
|
76
|
+
- lib/samba/encrypt.rb
|
77
|
+
- misc/rd2html.rb
|
78
|
+
- rails/plugin/active_samba_ldap/README
|
79
|
+
- rails/plugin/active_samba_ldap/generators/scaffold_asl/scaffold_asl_generator.rb
|
80
|
+
- rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/computer.rb
|
81
|
+
- rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/dc.rb
|
82
|
+
- rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/group.rb
|
83
|
+
- rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/idmap.rb
|
84
|
+
- rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/ldap.yml
|
85
|
+
- rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/ou.rb
|
86
|
+
- rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/samba_controller.rb
|
87
|
+
- rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/samba_helper.rb
|
88
|
+
- rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/samba_index.rhtml
|
89
|
+
- rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/samba_populate.rhtml
|
90
|
+
- rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/samba_purge.rhtml
|
91
|
+
- rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/unix_id_pool.rb
|
92
|
+
- rails/plugin/active_samba_ldap/generators/scaffold_asl/templates/user.rb
|
93
|
+
- rails/plugin/active_samba_ldap/init.rb
|
94
|
+
- test/asl-test-utils.rb
|
95
|
+
- test/command.rb
|
96
|
+
- test/config.yaml.sample
|
97
|
+
- test/run-test.rb
|
98
|
+
- test/test-unit-ext.rb
|
99
|
+
- test/test-unit-ext/always-show-result.rb
|
100
|
+
- test/test-unit-ext/priority.rb
|
101
|
+
- test/test_asl_groupadd.rb
|
102
|
+
- test/test_asl_groupdel.rb
|
103
|
+
- test/test_asl_groupmod.rb
|
104
|
+
- test/test_asl_groupshow.rb
|
105
|
+
- test/test_asl_passwd.rb
|
106
|
+
- test/test_asl_populate.rb
|
107
|
+
- test/test_asl_purge.rb
|
108
|
+
- test/test_asl_useradd.rb
|
109
|
+
- test/test_asl_userdel.rb
|
110
|
+
- test/test_asl_usermod.rb
|
111
|
+
- test/test_asl_usershow.rb
|
112
|
+
- test/test_group.rb
|
113
|
+
- test/test_password.rb
|
114
|
+
- test/test_samba_encrypt.rb
|
115
|
+
- test/test_user_home_directory.rb
|
116
|
+
test_files:
|
117
|
+
- test/test_asl_usershow.rb
|
118
|
+
- test/test_asl_groupdel.rb
|
119
|
+
- test/test_asl_useradd.rb
|
120
|
+
- test/test_samba_encrypt.rb
|
121
|
+
- test/test_asl_populate.rb
|
122
|
+
- test/test_asl_groupmod.rb
|
123
|
+
- test/test_asl_groupshow.rb
|
124
|
+
- test/test_asl_purge.rb
|
125
|
+
- test/test_asl_passwd.rb
|
126
|
+
- test/test_asl_userdel.rb
|
127
|
+
- test/test_asl_groupadd.rb
|
128
|
+
- test/test_asl_usermod.rb
|
129
|
+
- test/test_group.rb
|
130
|
+
- test/test_password.rb
|
131
|
+
- test/test_user_home_directory.rb
|
132
|
+
rdoc_options: []
|
133
|
+
|
134
|
+
extra_rdoc_files: []
|
135
|
+
|
136
|
+
executables:
|
137
|
+
- asl-groupadd
|
138
|
+
- asl-groupdel
|
139
|
+
- asl-groupmod
|
140
|
+
- asl-groupshow
|
141
|
+
- asl-passwd
|
142
|
+
- asl-populate
|
143
|
+
- asl-purge
|
144
|
+
- asl-samba-computeradd
|
145
|
+
- asl-samba-groupadd
|
146
|
+
- asl-samba-groupdel
|
147
|
+
- asl-samba-groupmod
|
148
|
+
- asl-samba-useradd
|
149
|
+
- asl-samba-userdel
|
150
|
+
- asl-samba-usermod
|
151
|
+
- asl-useradd
|
152
|
+
- asl-userdel
|
153
|
+
- asl-usermod
|
154
|
+
- asl-usershow
|
155
|
+
extensions: []
|
156
|
+
|
157
|
+
requirements: []
|
158
|
+
|
159
|
+
dependencies:
|
160
|
+
- !ruby/object:Gem::Dependency
|
161
|
+
name: hoe
|
162
|
+
version_requirement:
|
163
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: 1.1.4
|
168
|
+
version:
|
169
|
+
- !ruby/object:Gem::Dependency
|
170
|
+
name: activeldap
|
171
|
+
version_requirement:
|
172
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
173
|
+
requirements:
|
174
|
+
- - ">="
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: 0.8.0
|
177
|
+
version:
|