1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
|
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">
<erlref>
<header>
<copyright>
<year>2012</year><year>2013</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
The contents of this file are subject to the Erlang Public License,
Version 1.1, (the "License"); you may not use this file except in
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
</legalnotice>
<title>eldap</title>
<prepared>Peter Högfeldt</prepared>
<docno></docno>
<date>2000-06-20</date>
<rev>B</rev>
</header>
<module>eldap</module>
<modulesummary>Eldap Functions</modulesummary>
<description>
<p>This module provides a client api to the Lightweight Directory Access Protocol (LDAP).
</p>
<p>References:</p>
<list type="bulleted">
<item> <p>RFC 4510 - RFC 4519</p> </item>
<item> <p>RFC 2830</p> </item>
</list>
<p>The above publications can be found at <url href="http://www.ietf.org">IETF</url>.
</p>
<p><em>Types</em></p>
<pre>
handle() Connection handle
attribute() {Type = string(), Values=[string()]}
modify_op() See mod_add/2, mod_delete/2, mod_replace/2
scope() See baseObject/0, singleLevel/0, wholeSubtree/0
dereference() See neverDerefAliases/0, derefInSearching/0, derefFindingBaseObj/0, derefAlways/0
filter() See present/1, substrings/2,
equalityMatch/2, greaterOrEqual/2, lessOrEqual/2,
approxMatch/2,
'and'/1, 'or'/1, 'not'/1.
</pre>
<p></p>
</description>
<funcs>
<func>
<name>open([Host]) -> {ok, Handle} | {error, Reason}</name>
<fsummary>Open a connection to an LDAP server.</fsummary>
<type>
<v>Handle = handle()</v>
</type>
<desc>
<p>Setup a connection to an LDAP server, the <c>HOST</c>'s are tried in order. </p>
</desc>
</func>
<func>
<name>open([Host], [Option]) -> {ok, Handle} | {error, Reason}</name>
<fsummary>Open a connection to an LDAP server.</fsummary>
<type>
<v>Handle = handle()</v>
<v>Option = {port, integer()} | {log, function()} | {timeout, integer()} | {ssl, boolean()} | {sslopts, list()} | {tcpopts, list()}</v>
</type>
<desc>
<p>Setup a connection to an LDAP server, the <c>HOST</c>'s are tried in order.</p>
<p>The log function takes three arguments, <c>fun(Level, FormatString, [FormatArg]) end</c>.</p>
<p>Timeout set the maximum time in milliseconds that each server request may take.</p>
<p>All TCP socket options are accepted except
<c>active</c>, <c>binary</c>, <c>deliver</c>, <c>list</c>, <c>mode</c> and <c>packet</c>
</p>
</desc>
</func>
<func>
<name>close(Handle) -> ok</name>
<fsummary>Shutdown the connection.</fsummary>
<type>
<v>Handle = handle()</v>
</type>
<desc>
<p>Shutdown the connection.</p>
</desc>
</func>
<func>
<name>start_tls(Handle, Options) -> ok | {error,Error}</name>
<fsummary>Upgrade a connection to TLS.</fsummary>
<desc>
<p>Same as start_tls(Handle, Options, infinity)</p>
</desc>
</func>
<func>
<name>start_tls(Handle, Options, Timeout) -> ok | {error,Error}</name>
<fsummary>Upgrade a connection to TLS.</fsummary>
<type>
<v>Handle = handle()</v>
<v>Options = ssl:ssl_options()</v>
<v>Timeout = inifinity | positive_integer()</v>
</type>
<desc>
<p>Upgrade the connection associated with <c>Handle</c> to a tls connection if possible.</p>
<p>The upgrade is done in two phases: first the server is asked for permission to upgrade. Second, if the request is acknowledged, the upgrade is performed.</p>
<p>Error responese from phase one will not affect the current encryption state of the connection. Those responses are:</p>
<taglist>
<tag><c>tls_already_started</c></tag>
<item>The connection is already encrypted. The connection is not affected.</item>
<tag><c>{response,ResponseFromServer}</c></tag>
<item>The upgrade was refused by the LDAP server. The <c>ResponseFromServer</c> is an atom delivered byt the LDAP server explained in section 2.3 of rfc 2830. The connection is not affected, so it is still un-encrypted.</item>
</taglist>
<p>Errors in the seconde phase will however end the connection:</p>
<taglist>
<tag><c>Error</c></tag>
<item>Any error responded from ssl:connect/3</item>
</taglist>
</desc>
</func>
<func>
<name>simple_bind(Handle, Dn, Password) -> ok | {error, Reason}</name>
<fsummary>Authenticate the connection.</fsummary>
<type>
<v>Handle = handle()</v>
<v>Dn = string()</v>
<v>Password = string()</v>
</type>
<desc>
<p>Authenticate the connection using simple authentication.</p>
</desc>
</func>
<func>
<name>add(Handle, Dn, [Attribute]) -> ok | {error, Reason}</name>
<fsummary>Add an entry.</fsummary>
<type>
<v>Handle = handle()</v>
<v>Dn = string()</v>
<v>Attribute = attribute()</v>
</type>
<desc>
<p> Add an entry. The entry must not exist.</p>
<pre>
add(Handle,
"cn=Bill Valentine, ou=people, o=Example Org, dc=example, dc=com",
[{"objectclass", ["person"]},
{"cn", ["Bill Valentine"]},
{"sn", ["Valentine"]},
{"telephoneNumber", ["545 555 00"]}]
)
</pre>
</desc>
</func>
<func>
<name>delete(Handle, Dn) -> ok | {error, Reason}</name>
<fsummary>Delete an entry.</fsummary>
<type>
<v>Dn = string()</v>
</type>
<desc>
<p> Delete an entry.</p>
<pre>
delete(Handle, "cn=Bill Valentine, ou=people, o=Example Org, dc=example, dc=com")
</pre>
</desc>
</func>
<func>
<name>mod_add(Type, [Value]) -> modify_op()</name>
<fsummary>Create a modification operation.</fsummary>
<type>
<v>Type = string()</v>
<v>Value = string()</v>
</type>
<desc> <p> Create an add modification operation.</p> </desc>
</func>
<func>
<name>mod_delete(Type, [Value]) -> modify_op()</name>
<fsummary>Create a modification operation.</fsummary>
<type>
<v>Type = string()</v>
<v>Value = string()</v>
</type>
<desc> <p> Create a delete modification operation.</p> </desc>
</func>
<func>
<name>mod_replace(Type, [Value]) -> modify_op()</name>
<fsummary>Create a modification operation.</fsummary>
<type>
<v>Type = string()</v>
<v>Value = string()</v>
</type>
<desc> <p> Create a replace modification operation.</p> </desc>
</func>
<func>
<name>modify(Handle, Dn, [ModifyOp]) -> ok | {error, Reason}</name>
<fsummary>Modify an entry.</fsummary>
<type>
<v>Dn = string()</v>
<v>ModifyOp = modify_op()</v>
</type>
<desc>
<p> Modify an entry.</p>
<pre>
modify(Handle, "cn=Bill Valentine, ou=people, o=Example Org, dc=example, dc=com",
[eldap:mod_replace("telephoneNumber", ["555 555 00"]),
eldap:mod_add("description", ["LDAP Hacker"]) ])
</pre>
</desc>
</func>
<func>
<name>modify_password(Handle, Dn, NewPasswd) -> ok | {ok, GenPasswd} | {error, Reason}</name>
<fsummary>Modify the password of a user.</fsummary>
<type>
<v>Dn = string()</v>
<v>NewPasswd = string()</v>
</type>
<desc>
<p>Modify the password of a user. See <seealso marker="#modify_password/4">modify_password/4</seealso>.</p>
</desc>
</func>
<func>
<name>modify_password(Handle, Dn, NewPasswd, OldPasswd) -> ok | {ok, GenPasswd} | {error, Reason}</name>
<fsummary>Modify the password of a user.</fsummary>
<type>
<v>Dn = string()</v>
<v>NewPasswd = string()</v>
<v>OldPasswd = string()</v>
<v>GenPasswd = string()</v>
</type>
<desc>
<p>Modify the password of a user.</p>
<list type="bulleted">
<item>
<p><c>Dn</c>. The user to modify. Should be "" if the
modify request is for the user of the LDAP session.</p>
</item>
<item>
<p><c>NewPasswd</c>. The new password to set. Should be ""
if the server is to generate the password. In this case,
the result will be <c>{ok, GenPasswd}</c>.</p>
</item>
<item>
<p><c>OldPasswd</c>. Sometimes required by server policy
for a user to change their password. If not required, use
<seealso marker="#modify_password/3">modify_password/3</seealso>.</p>
</item>
</list>
</desc>
</func>
<func>
<name>modify_dn(Handle, Dn, NewRDN, DeleteOldRDN, NewSupDN) -> ok | {error, Reason}</name>
<fsummary>Modify the DN of an entry.</fsummary>
<type>
<v>Dn = string()</v>
<v>NewRDN = string()</v>
<v>DeleteOldRDN = boolean()</v>
<v>NewSupDN = string()</v>
</type>
<desc>
<p> Modify the DN of an entry. <c>DeleteOldRDN</c> indicates
whether the current RDN should be removed after operation.
<c>NewSupDN</c> should be "" if the RDN should not be moved or the new parent which
the RDN will be moved to.</p>
<pre>
modify_dn(Handle, "cn=Bill Valentine, ou=people, o=Example Org, dc=example, dc=com ",
"cn=Bill Jr Valentine", true, "")
</pre>
</desc>
</func>
<func>
<name>search(Handle, SearchOptions) -> {ok, #eldap_search_result{}} | {error, Reason}</name>
<fsummary>Search the Directory</fsummary>
<type>
<v>SearchOptions = #eldap_search{} | [SearchOption]</v>
<v>SearchOption = {base, string()} | {filter, filter()} | {scope, scope()}
| {attributes, [string()]} | {deref, dereference()} |
| {types_only, boolean()} | {timeout, integer()}
</v>
</type>
<desc>
<p>Search the directory with the supplied the SearchOptions.
The base and filter options must be supplied.
Default values: scope is <c>wholeSubtree()</c>, deref is <c>derefAlways()</c>,
types_only is <c>false</c> and timeout is <c>0</c> (meaning infinity).
</p>
<pre>
Filter = eldap:substrings("cn", [{any,"V"}]),
search(Handle, [{base, "dc=example, dc=com"}, {filter, Filter}, {attributes, ["cn"]}]),
</pre>
</desc>
</func>
<func>
<name>baseObject() -> scope()</name>
<fsummary>Create search scope.</fsummary>
<desc> <p> Search baseobject only.</p> </desc>
</func>
<func>
<name>singleLevel() -> scope()</name>
<fsummary>Create search scope.</fsummary>
<desc> <p> Search the specified level only, i.e. do not recurse.</p> </desc>
</func>
<func>
<name>wholeSubtree() -> scope()</name>
<fsummary>Create search scope.</fsummary>
<desc> <p> Search the entire subtree.</p> </desc>
</func>
<func>
<name>neverDerefAliases() -> dereference()</name>
<fsummary>Create search option.</fsummary>
<desc> <p>Never derefrence aliases, treat aliases as entries.</p> </desc>
</func>
<func>
<name>derefAlways() -> dereference()</name>
<fsummary>Create search option.</fsummary>
<desc> <p>Always derefrence aliases.</p> </desc>
</func>
<func>
<name>derefInSearching() -> dereference()</name>
<fsummary>Create search option.</fsummary>
<desc> <p>Derefrence aliases only when searching.</p> </desc>
</func>
<func>
<name>derefFindingBaseObj() -> dereference()</name>
<fsummary>Create search option.</fsummary>
<desc> <p>Derefrence aliases only in finding the base.</p> </desc>
</func>
<func>
<name>present(Type) -> filter()</name>
<fsummary>Create search filter option.</fsummary>
<type>
<v>Type = string()</v>
</type>
<desc> <p>Create a filter which filters on attribute type presence.</p> </desc>
</func>
<func>
<name>substrings(Type, [SubString]) -> filter()</name>
<fsummary>Create search filter option.</fsummary>
<type>
<v>Type = string()</v>
<v>SubString = {StringPart, string()}</v>
<v>StringPart = initial | any | final</v>
</type>
<desc> <p>Create a filter which filters on substrings.</p> </desc>
</func>
<func>
<name>equalityMatch(Type, Value) -> filter()</name>
<fsummary>Create search filter option.</fsummary>
<type>
<v>Type = string()</v>
<v>Value = string()</v>
</type>
<desc> <p>Create a equality filter.</p> </desc>
</func>
<func>
<name>greaterOrEqual(Type, Value) -> filter()</name>
<fsummary>Create search filter option.</fsummary>
<type>
<v>Type = string()</v>
<v>Value = string()</v>
</type>
<desc> <p>Create a greater or equal filter.</p> </desc>
</func>
<func>
<name>lessOrEqual(Type, Value) -> filter()</name>
<fsummary>Create search filter option.</fsummary>
<type>
<v>Type = string()</v>
<v>Value = string()</v>
</type>
<desc> <p>Create a less or equal filter.</p> </desc>
</func>
<func>
<name>approxMatch(Type, Value) -> filter()</name>
<fsummary>Create search filter option.</fsummary>
<type>
<v>Type = string()</v>
<v>Value = string()</v>
</type>
<desc> <p>Create a approximation match filter.</p> </desc>
</func>
<func>
<name>'and'([Filter]) -> filter()</name>
<fsummary>Create search filter option.</fsummary>
<type>
<v>Filter = filter()</v>
</type>
<desc> <p>Creates a filter where all <c>Filter</c> must be true.</p> </desc>
</func>
<func>
<name>'or'([Filter]) -> filter()</name>
<fsummary>Create search filter option.</fsummary>
<type>
<v>Filter = filter()</v>
</type>
<desc> <p>Create a filter where at least one of the <c>Filter</c> must be true.</p> </desc>
</func>
<func>
<name>'not'(Filter) -> filter()</name>
<fsummary>Create search filter option.</fsummary>
<type>
<v>Filter = filter()</v>
</type>
<desc> <p>Negate a filter.</p> </desc>
</func>
</funcs>
</erlref>
|