net-ldap 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of net-ldap might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +7 -0
- data/.travis.yml +19 -1
- data/CONTRIBUTING.md +54 -0
- data/Hacking.rdoc +2 -4
- data/History.rdoc +37 -0
- data/Manifest.txt +0 -4
- data/README.rdoc +8 -0
- data/Rakefile +1 -3
- data/lib/net/ber/core_ext.rb +5 -5
- data/lib/net/ber/core_ext/string.rb +7 -7
- data/lib/net/ber/core_ext/true_class.rb +2 -3
- data/lib/net/ldap.rb +134 -620
- data/lib/net/ldap/connection.rb +692 -0
- data/lib/net/ldap/dataset.rb +18 -4
- data/lib/net/ldap/entry.rb +1 -1
- data/lib/net/ldap/filter.rb +7 -7
- data/lib/net/ldap/password.rb +11 -11
- data/lib/net/ldap/pdu.rb +28 -4
- data/lib/net/ldap/version.rb +1 -1
- data/lib/net/snmp.rb +235 -241
- data/net-ldap.gemspec +7 -33
- data/script/install-openldap +47 -0
- data/script/package +7 -0
- data/script/release +16 -0
- data/test/ber/core_ext/test_array.rb +22 -0
- data/test/ber/core_ext/test_string.rb +25 -0
- data/test/ber/test_ber.rb +126 -0
- data/test/fixtures/openldap/memberof.ldif +33 -0
- data/test/fixtures/openldap/retcode.ldif +76 -0
- data/test/fixtures/openldap/slapd.conf.ldif +67 -0
- data/test/fixtures/seed.ldif +374 -0
- data/test/integration/test_add.rb +28 -0
- data/test/integration/test_ber.rb +30 -0
- data/test/integration/test_bind.rb +22 -0
- data/test/integration/test_delete.rb +31 -0
- data/test/integration/test_open.rb +88 -0
- data/test/integration/test_return_codes.rb +38 -0
- data/test/integration/test_search.rb +77 -0
- data/test/support/vm/openldap/.gitignore +1 -0
- data/test/support/vm/openldap/README.md +32 -0
- data/test/support/vm/openldap/Vagrantfile +33 -0
- data/test/test_dn.rb +44 -0
- data/test/test_entry.rb +62 -56
- data/test/test_filter.rb +98 -2
- data/test/test_filter_parser.rb +16 -0
- data/test/test_helper.rb +54 -0
- data/test/test_ldap.rb +60 -0
- data/test/test_ldap_connection.rb +382 -2
- data/test/test_ldif.rb +26 -1
- data/test/test_password.rb +3 -10
- data/test/test_rename.rb +2 -2
- data/test/test_search.rb +39 -0
- data/test/test_snmp.rb +1 -1
- data/test/test_ssl_ber.rb +40 -0
- metadata +70 -75
- data/.autotest +0 -11
- data/.gemtest +0 -0
- data/.rspec +0 -2
- data/autotest/discover.rb +0 -1
- data/spec/integration/ssl_ber_spec.rb +0 -39
- data/spec/spec.opts +0 -2
- data/spec/spec_helper.rb +0 -28
- data/spec/unit/ber/ber_spec.rb +0 -141
- data/spec/unit/ber/core_ext/array_spec.rb +0 -24
- data/spec/unit/ber/core_ext/string_spec.rb +0 -51
- data/spec/unit/ldap/dn_spec.rb +0 -80
- data/spec/unit/ldap/entry_spec.rb +0 -51
- data/spec/unit/ldap/filter_parser_spec.rb +0 -26
- data/spec/unit/ldap/filter_spec.rb +0 -115
- data/spec/unit/ldap/search_spec.rb +0 -49
- data/spec/unit/ldap_spec.rb +0 -223
- data/test/common.rb +0 -3
@@ -0,0 +1,374 @@
|
|
1
|
+
dn: ou=People,dc=rubyldap,dc=com
|
2
|
+
objectClass: top
|
3
|
+
objectClass: organizationalUnit
|
4
|
+
ou: People
|
5
|
+
|
6
|
+
dn: ou=Groups,dc=rubyldap,dc=com
|
7
|
+
objectClass: top
|
8
|
+
objectClass: organizationalUnit
|
9
|
+
ou: Groups
|
10
|
+
|
11
|
+
# Directory Superuser
|
12
|
+
dn: uid=admin,dc=rubyldap,dc=com
|
13
|
+
uid: admin
|
14
|
+
cn: system administrator
|
15
|
+
sn: administrator
|
16
|
+
objectClass: top
|
17
|
+
objectClass: person
|
18
|
+
objectClass: organizationalPerson
|
19
|
+
objectClass: inetOrgPerson
|
20
|
+
displayName: Directory Superuser
|
21
|
+
userPassword: passworD1
|
22
|
+
|
23
|
+
# Users 1-10
|
24
|
+
|
25
|
+
dn: uid=user1,ou=People,dc=rubyldap,dc=com
|
26
|
+
uid: user1
|
27
|
+
cn: user1
|
28
|
+
sn: user1
|
29
|
+
objectClass: top
|
30
|
+
objectClass: person
|
31
|
+
objectClass: organizationalPerson
|
32
|
+
objectClass: inetOrgPerson
|
33
|
+
userPassword: passworD1
|
34
|
+
mail: user1@rubyldap.com
|
35
|
+
|
36
|
+
dn: uid=user2,ou=People,dc=rubyldap,dc=com
|
37
|
+
uid: user2
|
38
|
+
cn: user2
|
39
|
+
sn: user2
|
40
|
+
objectClass: top
|
41
|
+
objectClass: person
|
42
|
+
objectClass: organizationalPerson
|
43
|
+
objectClass: inetOrgPerson
|
44
|
+
userPassword: passworD1
|
45
|
+
mail: user2@rubyldap.com
|
46
|
+
|
47
|
+
dn: uid=user3,ou=People,dc=rubyldap,dc=com
|
48
|
+
uid: user3
|
49
|
+
cn: user3
|
50
|
+
sn: user3
|
51
|
+
objectClass: top
|
52
|
+
objectClass: person
|
53
|
+
objectClass: organizationalPerson
|
54
|
+
objectClass: inetOrgPerson
|
55
|
+
userPassword: passworD1
|
56
|
+
mail: user3@rubyldap.com
|
57
|
+
|
58
|
+
dn: uid=user4,ou=People,dc=rubyldap,dc=com
|
59
|
+
uid: user4
|
60
|
+
cn: user4
|
61
|
+
sn: user4
|
62
|
+
objectClass: top
|
63
|
+
objectClass: person
|
64
|
+
objectClass: organizationalPerson
|
65
|
+
objectClass: inetOrgPerson
|
66
|
+
userPassword: passworD1
|
67
|
+
mail: user4@rubyldap.com
|
68
|
+
|
69
|
+
dn: uid=user5,ou=People,dc=rubyldap,dc=com
|
70
|
+
uid: user5
|
71
|
+
cn: user5
|
72
|
+
sn: user5
|
73
|
+
objectClass: top
|
74
|
+
objectClass: person
|
75
|
+
objectClass: organizationalPerson
|
76
|
+
objectClass: inetOrgPerson
|
77
|
+
userPassword: passworD1
|
78
|
+
mail: user5@rubyldap.com
|
79
|
+
|
80
|
+
dn: uid=user6,ou=People,dc=rubyldap,dc=com
|
81
|
+
uid: user6
|
82
|
+
cn: user6
|
83
|
+
sn: user6
|
84
|
+
objectClass: top
|
85
|
+
objectClass: person
|
86
|
+
objectClass: organizationalPerson
|
87
|
+
objectClass: inetOrgPerson
|
88
|
+
userPassword: passworD1
|
89
|
+
mail: user6@rubyldap.com
|
90
|
+
|
91
|
+
dn: uid=user7,ou=People,dc=rubyldap,dc=com
|
92
|
+
uid: user7
|
93
|
+
cn: user7
|
94
|
+
sn: user7
|
95
|
+
objectClass: top
|
96
|
+
objectClass: person
|
97
|
+
objectClass: organizationalPerson
|
98
|
+
objectClass: inetOrgPerson
|
99
|
+
userPassword: passworD1
|
100
|
+
mail: user7@rubyldap.com
|
101
|
+
|
102
|
+
dn: uid=user8,ou=People,dc=rubyldap,dc=com
|
103
|
+
uid: user8
|
104
|
+
cn: user8
|
105
|
+
sn: user8
|
106
|
+
objectClass: top
|
107
|
+
objectClass: person
|
108
|
+
objectClass: organizationalPerson
|
109
|
+
objectClass: inetOrgPerson
|
110
|
+
userPassword: passworD1
|
111
|
+
mail: user8@rubyldap.com
|
112
|
+
|
113
|
+
dn: uid=user9,ou=People,dc=rubyldap,dc=com
|
114
|
+
uid: user9
|
115
|
+
cn: user9
|
116
|
+
sn: user9
|
117
|
+
objectClass: top
|
118
|
+
objectClass: person
|
119
|
+
objectClass: organizationalPerson
|
120
|
+
objectClass: inetOrgPerson
|
121
|
+
userPassword: passworD1
|
122
|
+
mail: user9@rubyldap.com
|
123
|
+
|
124
|
+
dn: uid=user10,ou=People,dc=rubyldap,dc=com
|
125
|
+
uid: user10
|
126
|
+
cn: user10
|
127
|
+
sn: user10
|
128
|
+
objectClass: top
|
129
|
+
objectClass: person
|
130
|
+
objectClass: organizationalPerson
|
131
|
+
objectClass: inetOrgPerson
|
132
|
+
userPassword: passworD1
|
133
|
+
mail: user10@rubyldap.com
|
134
|
+
|
135
|
+
# Emailless User
|
136
|
+
|
137
|
+
dn: uid=emailless-user1,ou=People,dc=rubyldap,dc=com
|
138
|
+
uid: emailless-user1
|
139
|
+
cn: emailless-user1
|
140
|
+
sn: emailless-user1
|
141
|
+
objectClass: top
|
142
|
+
objectClass: person
|
143
|
+
objectClass: organizationalPerson
|
144
|
+
objectClass: inetOrgPerson
|
145
|
+
userPassword: passworD1
|
146
|
+
|
147
|
+
# Groupless User
|
148
|
+
|
149
|
+
dn: uid=groupless-user1,ou=People,dc=rubyldap,dc=com
|
150
|
+
uid: groupless-user1
|
151
|
+
cn: groupless-user1
|
152
|
+
sn: groupless-user1
|
153
|
+
objectClass: top
|
154
|
+
objectClass: person
|
155
|
+
objectClass: organizationalPerson
|
156
|
+
objectClass: inetOrgPerson
|
157
|
+
userPassword: passworD1
|
158
|
+
|
159
|
+
# Admin User
|
160
|
+
|
161
|
+
dn: uid=admin1,ou=People,dc=rubyldap,dc=com
|
162
|
+
uid: admin1
|
163
|
+
cn: admin1
|
164
|
+
sn: admin1
|
165
|
+
objectClass: top
|
166
|
+
objectClass: person
|
167
|
+
objectClass: organizationalPerson
|
168
|
+
objectClass: inetOrgPerson
|
169
|
+
userPassword: passworD1
|
170
|
+
mail: admin1@rubyldap.com
|
171
|
+
|
172
|
+
# Groups
|
173
|
+
|
174
|
+
dn: cn=ghe-users,ou=Groups,dc=rubyldap,dc=com
|
175
|
+
cn: ghe-users
|
176
|
+
objectClass: groupOfNames
|
177
|
+
member: uid=user1,ou=People,dc=rubyldap,dc=com
|
178
|
+
member: uid=emailless-user1,ou=People,dc=rubyldap,dc=com
|
179
|
+
|
180
|
+
dn: cn=all-users,ou=Groups,dc=rubyldap,dc=com
|
181
|
+
cn: all-users
|
182
|
+
objectClass: groupOfNames
|
183
|
+
member: cn=ghe-users,ou=Groups,dc=rubyldap,dc=com
|
184
|
+
member: uid=user1,ou=People,dc=rubyldap,dc=com
|
185
|
+
member: uid=user2,ou=People,dc=rubyldap,dc=com
|
186
|
+
member: uid=user3,ou=People,dc=rubyldap,dc=com
|
187
|
+
member: uid=user4,ou=People,dc=rubyldap,dc=com
|
188
|
+
member: uid=user5,ou=People,dc=rubyldap,dc=com
|
189
|
+
member: uid=user6,ou=People,dc=rubyldap,dc=com
|
190
|
+
member: uid=user7,ou=People,dc=rubyldap,dc=com
|
191
|
+
member: uid=user8,ou=People,dc=rubyldap,dc=com
|
192
|
+
member: uid=user9,ou=People,dc=rubyldap,dc=com
|
193
|
+
member: uid=user10,ou=People,dc=rubyldap,dc=com
|
194
|
+
member: uid=emailless-user1,ou=People,dc=rubyldap,dc=com
|
195
|
+
|
196
|
+
dn: cn=ghe-admins,ou=Groups,dc=rubyldap,dc=com
|
197
|
+
cn: ghe-admins
|
198
|
+
objectClass: groupOfNames
|
199
|
+
member: uid=admin1,ou=People,dc=rubyldap,dc=com
|
200
|
+
|
201
|
+
dn: cn=all-admins,ou=Groups,dc=rubyldap,dc=com
|
202
|
+
cn: all-admins
|
203
|
+
objectClass: groupOfNames
|
204
|
+
member: cn=ghe-admins,ou=Groups,dc=rubyldap,dc=com
|
205
|
+
member: uid=admin1,ou=People,dc=rubyldap,dc=com
|
206
|
+
|
207
|
+
dn: cn=n-member-group10,ou=Groups,dc=rubyldap,dc=com
|
208
|
+
cn: n-member-group10
|
209
|
+
objectClass: groupOfNames
|
210
|
+
member: uid=user1,ou=People,dc=rubyldap,dc=com
|
211
|
+
member: uid=user2,ou=People,dc=rubyldap,dc=com
|
212
|
+
member: uid=user3,ou=People,dc=rubyldap,dc=com
|
213
|
+
member: uid=user4,ou=People,dc=rubyldap,dc=com
|
214
|
+
member: uid=user5,ou=People,dc=rubyldap,dc=com
|
215
|
+
member: uid=user6,ou=People,dc=rubyldap,dc=com
|
216
|
+
member: uid=user7,ou=People,dc=rubyldap,dc=com
|
217
|
+
member: uid=user8,ou=People,dc=rubyldap,dc=com
|
218
|
+
member: uid=user9,ou=People,dc=rubyldap,dc=com
|
219
|
+
member: uid=user10,ou=People,dc=rubyldap,dc=com
|
220
|
+
|
221
|
+
dn: cn=nested-group1,ou=Groups,dc=rubyldap,dc=com
|
222
|
+
cn: nested-group1
|
223
|
+
objectClass: groupOfNames
|
224
|
+
member: uid=user1,ou=People,dc=rubyldap,dc=com
|
225
|
+
member: uid=user2,ou=People,dc=rubyldap,dc=com
|
226
|
+
member: uid=user3,ou=People,dc=rubyldap,dc=com
|
227
|
+
member: uid=user4,ou=People,dc=rubyldap,dc=com
|
228
|
+
member: uid=user5,ou=People,dc=rubyldap,dc=com
|
229
|
+
|
230
|
+
dn: cn=nested-group2,ou=Groups,dc=rubyldap,dc=com
|
231
|
+
cn: nested-group2
|
232
|
+
objectClass: groupOfNames
|
233
|
+
member: uid=user6,ou=People,dc=rubyldap,dc=com
|
234
|
+
member: uid=user7,ou=People,dc=rubyldap,dc=com
|
235
|
+
member: uid=user8,ou=People,dc=rubyldap,dc=com
|
236
|
+
member: uid=user9,ou=People,dc=rubyldap,dc=com
|
237
|
+
member: uid=user10,ou=People,dc=rubyldap,dc=com
|
238
|
+
|
239
|
+
dn: cn=nested-groups,ou=Groups,dc=rubyldap,dc=com
|
240
|
+
cn: nested-groups
|
241
|
+
objectClass: groupOfNames
|
242
|
+
member: cn=nested-group1,ou=Groups,dc=rubyldap,dc=com
|
243
|
+
member: cn=nested-group2,ou=Groups,dc=rubyldap,dc=com
|
244
|
+
|
245
|
+
dn: cn=n-member-nested-group1,ou=Groups,dc=rubyldap,dc=com
|
246
|
+
cn: n-member-nested-group1
|
247
|
+
objectClass: groupOfNames
|
248
|
+
member: cn=nested-group1,ou=Groups,dc=rubyldap,dc=com
|
249
|
+
|
250
|
+
dn: cn=deeply-nested-group0.0.0,ou=Groups,dc=rubyldap,dc=com
|
251
|
+
cn: deeply-nested-group0.0.0
|
252
|
+
objectClass: groupOfNames
|
253
|
+
member: uid=user1,ou=People,dc=rubyldap,dc=com
|
254
|
+
member: uid=user2,ou=People,dc=rubyldap,dc=com
|
255
|
+
member: uid=user3,ou=People,dc=rubyldap,dc=com
|
256
|
+
member: uid=user4,ou=People,dc=rubyldap,dc=com
|
257
|
+
member: uid=user5,ou=People,dc=rubyldap,dc=com
|
258
|
+
|
259
|
+
dn: cn=deeply-nested-group0.0.1,ou=Groups,dc=rubyldap,dc=com
|
260
|
+
cn: deeply-nested-group0.0.1
|
261
|
+
objectClass: groupOfNames
|
262
|
+
member: uid=user6,ou=People,dc=rubyldap,dc=com
|
263
|
+
member: uid=user7,ou=People,dc=rubyldap,dc=com
|
264
|
+
member: uid=user8,ou=People,dc=rubyldap,dc=com
|
265
|
+
member: uid=user9,ou=People,dc=rubyldap,dc=com
|
266
|
+
member: uid=user10,ou=People,dc=rubyldap,dc=com
|
267
|
+
|
268
|
+
dn: cn=deeply-nested-group0.0,ou=Groups,dc=rubyldap,dc=com
|
269
|
+
cn: deeply-nested-group0.0
|
270
|
+
objectClass: groupOfNames
|
271
|
+
member: cn=deeply-nested-group0.0.0,ou=Groups,dc=rubyldap,dc=com
|
272
|
+
member: cn=deeply-nested-group0.0.1,ou=Groups,dc=rubyldap,dc=com
|
273
|
+
|
274
|
+
dn: cn=deeply-nested-group0,ou=Groups,dc=rubyldap,dc=com
|
275
|
+
cn: deeply-nested-group0
|
276
|
+
objectClass: groupOfNames
|
277
|
+
member: cn=deeply-nested-group0.0,ou=Groups,dc=rubyldap,dc=com
|
278
|
+
|
279
|
+
dn: cn=deeply-nested-groups,ou=Groups,dc=rubyldap,dc=com
|
280
|
+
cn: deeply-nested-groups
|
281
|
+
objectClass: groupOfNames
|
282
|
+
member: cn=deeply-nested-group0,ou=Groups,dc=rubyldap,dc=com
|
283
|
+
|
284
|
+
dn: cn=n-depth-nested-group1,ou=Groups,dc=rubyldap,dc=com
|
285
|
+
cn: n-depth-nested-group1
|
286
|
+
objectClass: groupOfNames
|
287
|
+
member: cn=nested-group1,ou=Groups,dc=rubyldap,dc=com
|
288
|
+
|
289
|
+
dn: cn=n-depth-nested-group2,ou=Groups,dc=rubyldap,dc=com
|
290
|
+
cn: n-depth-nested-group2
|
291
|
+
objectClass: groupOfNames
|
292
|
+
member: cn=n-depth-nested-group1,ou=Groups,dc=rubyldap,dc=com
|
293
|
+
|
294
|
+
dn: cn=n-depth-nested-group3,ou=Groups,dc=rubyldap,dc=com
|
295
|
+
cn: n-depth-nested-group3
|
296
|
+
objectClass: groupOfNames
|
297
|
+
member: cn=n-depth-nested-group2,ou=Groups,dc=rubyldap,dc=com
|
298
|
+
|
299
|
+
dn: cn=n-depth-nested-group4,ou=Groups,dc=rubyldap,dc=com
|
300
|
+
cn: n-depth-nested-group4
|
301
|
+
objectClass: groupOfNames
|
302
|
+
member: cn=n-depth-nested-group3,ou=Groups,dc=rubyldap,dc=com
|
303
|
+
|
304
|
+
dn: cn=n-depth-nested-group5,ou=Groups,dc=rubyldap,dc=com
|
305
|
+
cn: n-depth-nested-group5
|
306
|
+
objectClass: groupOfNames
|
307
|
+
member: cn=n-depth-nested-group4,ou=Groups,dc=rubyldap,dc=com
|
308
|
+
|
309
|
+
dn: cn=n-depth-nested-group6,ou=Groups,dc=rubyldap,dc=com
|
310
|
+
cn: n-depth-nested-group6
|
311
|
+
objectClass: groupOfNames
|
312
|
+
member: cn=n-depth-nested-group5,ou=Groups,dc=rubyldap,dc=com
|
313
|
+
|
314
|
+
dn: cn=n-depth-nested-group7,ou=Groups,dc=rubyldap,dc=com
|
315
|
+
cn: n-depth-nested-group7
|
316
|
+
objectClass: groupOfNames
|
317
|
+
member: cn=n-depth-nested-group6,ou=Groups,dc=rubyldap,dc=com
|
318
|
+
|
319
|
+
dn: cn=n-depth-nested-group8,ou=Groups,dc=rubyldap,dc=com
|
320
|
+
cn: n-depth-nested-group8
|
321
|
+
objectClass: groupOfNames
|
322
|
+
member: cn=n-depth-nested-group7,ou=Groups,dc=rubyldap,dc=com
|
323
|
+
|
324
|
+
dn: cn=n-depth-nested-group9,ou=Groups,dc=rubyldap,dc=com
|
325
|
+
cn: n-depth-nested-group9
|
326
|
+
objectClass: groupOfNames
|
327
|
+
member: cn=n-depth-nested-group8,ou=Groups,dc=rubyldap,dc=com
|
328
|
+
|
329
|
+
dn: cn=head-group,ou=Groups,dc=rubyldap,dc=com
|
330
|
+
cn: head-group
|
331
|
+
objectClass: groupOfNames
|
332
|
+
member: cn=tail-group,ou=Groups,dc=rubyldap,dc=com
|
333
|
+
member: uid=user1,ou=People,dc=rubyldap,dc=com
|
334
|
+
member: uid=user2,ou=People,dc=rubyldap,dc=com
|
335
|
+
member: uid=user3,ou=People,dc=rubyldap,dc=com
|
336
|
+
member: uid=user4,ou=People,dc=rubyldap,dc=com
|
337
|
+
member: uid=user5,ou=People,dc=rubyldap,dc=com
|
338
|
+
|
339
|
+
dn: cn=tail-group,ou=Groups,dc=rubyldap,dc=com
|
340
|
+
cn: tail-group
|
341
|
+
objectClass: groupOfNames
|
342
|
+
member: cn=head-group,ou=Groups,dc=rubyldap,dc=com
|
343
|
+
member: uid=user6,ou=People,dc=rubyldap,dc=com
|
344
|
+
member: uid=user7,ou=People,dc=rubyldap,dc=com
|
345
|
+
member: uid=user8,ou=People,dc=rubyldap,dc=com
|
346
|
+
member: uid=user9,ou=People,dc=rubyldap,dc=com
|
347
|
+
member: uid=user10,ou=People,dc=rubyldap,dc=com
|
348
|
+
|
349
|
+
dn: cn=recursively-nested-groups,ou=Groups,dc=rubyldap,dc=com
|
350
|
+
cn: recursively-nested-groups
|
351
|
+
objectClass: groupOfNames
|
352
|
+
member: cn=head-group,ou=Groups,dc=rubyldap,dc=com
|
353
|
+
member: cn=tail-group,ou=Groups,dc=rubyldap,dc=com
|
354
|
+
|
355
|
+
# posixGroup
|
356
|
+
|
357
|
+
dn: cn=posix-group1,ou=Groups,dc=rubyldap,dc=com
|
358
|
+
cn: posix-group1
|
359
|
+
objectClass: posixGroup
|
360
|
+
gidNumber: 1001
|
361
|
+
memberUid: user1
|
362
|
+
memberUid: user2
|
363
|
+
memberUid: user3
|
364
|
+
memberUid: user4
|
365
|
+
memberUid: user5
|
366
|
+
|
367
|
+
# missing members
|
368
|
+
|
369
|
+
dn: cn=missing-users,ou=Groups,dc=rubyldap,dc=com
|
370
|
+
cn: missing-users
|
371
|
+
objectClass: groupOfNames
|
372
|
+
member: uid=user1,ou=People,dc=rubyldap,dc=com
|
373
|
+
member: uid=user2,ou=People,dc=rubyldap,dc=com
|
374
|
+
member: uid=nonexistent-user,ou=People,dc=rubyldap,dc=com
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
|
3
|
+
class TestAddIntegration < LDAPIntegrationTestCase
|
4
|
+
def setup
|
5
|
+
super
|
6
|
+
@ldap.authenticate "cn=admin,dc=rubyldap,dc=com", "passworD1"
|
7
|
+
|
8
|
+
@dn = "uid=added-user1,ou=People,dc=rubyldap,dc=com"
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_add
|
12
|
+
attrs = {
|
13
|
+
objectclass: %w(top inetOrgPerson organizationalPerson person),
|
14
|
+
uid: "added-user1",
|
15
|
+
cn: "added-user1",
|
16
|
+
sn: "added-user1",
|
17
|
+
mail: "added-user1@rubyldap.com"
|
18
|
+
}
|
19
|
+
|
20
|
+
assert @ldap.add(dn: @dn, attributes: attrs), @ldap.get_operation_result.inspect
|
21
|
+
|
22
|
+
assert result = @ldap.search(base: @dn, scope: Net::LDAP::SearchScope_BaseObject).first
|
23
|
+
end
|
24
|
+
|
25
|
+
def teardown
|
26
|
+
@ldap.delete dn: @dn
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
|
3
|
+
class TestBERIntegration < LDAPIntegrationTestCase
|
4
|
+
# Test whether the TRUE boolean value is encoded correctly by performing a
|
5
|
+
# search operation.
|
6
|
+
def test_true_ber_encoding
|
7
|
+
# request these attrs to simplify test; use symbols to match Entry#attribute_names
|
8
|
+
attrs = [:dn, :uid, :cn, :mail]
|
9
|
+
|
10
|
+
assert types_entry = @ldap.search(
|
11
|
+
base: "dc=rubyldap,dc=com",
|
12
|
+
filter: "(uid=user1)",
|
13
|
+
size: 1,
|
14
|
+
attributes: attrs,
|
15
|
+
attributes_only: true
|
16
|
+
).first
|
17
|
+
|
18
|
+
# matches attributes we requested
|
19
|
+
assert_equal attrs, types_entry.attribute_names
|
20
|
+
|
21
|
+
# assert values are empty
|
22
|
+
types_entry.each do |name, values|
|
23
|
+
next if name == :dn
|
24
|
+
assert values.empty?
|
25
|
+
end
|
26
|
+
|
27
|
+
assert_includes Net::LDAP::ResultCodesSearchSuccess,
|
28
|
+
@ldap.get_operation_result.code, "should be a successful search operation"
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
|
3
|
+
class TestBindIntegration < LDAPIntegrationTestCase
|
4
|
+
def test_bind_success
|
5
|
+
assert @ldap.bind(method: :simple, username: "uid=user1,ou=People,dc=rubyldap,dc=com", password: "passworD1"), @ldap.get_operation_result.inspect
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_bind_anonymous_fail
|
9
|
+
refute @ldap.bind(method: :simple, username: "uid=user1,ou=People,dc=rubyldap,dc=com", password: ""), @ldap.get_operation_result.inspect
|
10
|
+
|
11
|
+
result = @ldap.get_operation_result
|
12
|
+
assert_equal Net::LDAP::ResultCodeUnwillingToPerform, result.code
|
13
|
+
assert_equal Net::LDAP::ResultStrings[Net::LDAP::ResultCodeUnwillingToPerform], result.message
|
14
|
+
assert_equal "unauthenticated bind (DN with no password) disallowed",
|
15
|
+
result.error_message
|
16
|
+
assert_equal "", result.matched_dn
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_bind_fail
|
20
|
+
refute @ldap.bind(method: :simple, username: "uid=user1,ou=People,dc=rubyldap,dc=com", password: "not my password"), @ldap.get_operation_result.inspect
|
21
|
+
end
|
22
|
+
end
|