259
|
1 /* LDAP client interface for XEmacs.
|
265
|
2 Copyright (C) 1998 Free Software Foundation, Inc.
|
259
|
3
|
|
4 This file is part of XEmacs.
|
|
5
|
|
6 XEmacs is free software; you can redistribute it and/or modify it
|
|
7 under the terms of the GNU General Public License as published by the
|
|
8 Free Software Foundation; either version 2, or (at your option) any
|
|
9 later version.
|
|
10
|
|
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with XEmacs; see the file COPYING. If not, write to
|
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
19 Boston, MA 02111-1307, USA. */
|
|
20
|
|
21 /* Synched up with: Not in FSF. */
|
|
22
|
282
|
23 /* Author: Oscar Figueiredo with lots of support from Hrvoje Niksic */
|
259
|
24
|
|
25 /* This file provides lisp primitives for access to an LDAP library
|
|
26 conforming to the API defined in RFC 1823.
|
|
27 It has been tested with:
|
|
28 - UMich LDAP 3.3 (http://www.umich.edu/~dirsvcs/ldap/)
|
384
|
29 - OpenLDAP 1.0.3 (http://www.openldap.org/)
|
388
|
30 - Netscape's LDAP SDK 1.0 (http://developer.netscape.com/) */
|
259
|
31
|
|
32
|
|
33 #include <config.h>
|
|
34 #include "lisp.h"
|
278
|
35 #include "opaque.h"
|
286
|
36 #include "sysdep.h"
|
384
|
37 #include "buffer.h"
|
259
|
38
|
265
|
39 #include <errno.h>
|
259
|
40
|
276
|
41 #include "eldap.h"
|
|
42
|
371
|
43 #ifdef HAVE_NS_LDAP
|
|
44 # define HAVE_LDAP_SET_OPTION 1
|
|
45 # define HAVE_LDAP_GET_ERRNO 1
|
|
46 #else
|
|
47 # undef HAVE_LDAP_SET_OPTION
|
|
48 # undef HAVE_LDAP_GET_ERRNO
|
|
49 #endif
|
|
50
|
276
|
51 static int ldap_default_port;
|
|
52 static Lisp_Object Vldap_default_base;
|
|
53
|
282
|
54 /* Needed by the lrecord definition */
|
|
55 Lisp_Object Qldapp;
|
|
56
|
276
|
57 /* ldap-open plist keywords */
|
280
|
58 extern Lisp_Object Qport, Qauth, Qbinddn, Qpasswd, Qderef, Qtimelimit,
|
276
|
59 Qsizelimit;
|
259
|
60 /* Search scope limits */
|
280
|
61 extern Lisp_Object Qbase, Qonelevel, Qsubtree;
|
259
|
62 /* Authentication methods */
|
282
|
63 extern Lisp_Object Qkrbv41, Qkrbv42;
|
259
|
64 /* Deref policy */
|
280
|
65 extern Lisp_Object Qnever, Qalways, Qfind;
|
276
|
66
|
|
67 /************************************************************************/
|
|
68 /* Utility Functions */
|
|
69 /************************************************************************/
|
|
70
|
|
71 static void
|
371
|
72 signal_ldap_error (LDAP *ld)
|
276
|
73 {
|
371
|
74 #ifdef HAVE_LDAP_GET_ERRNO
|
|
75 signal_simple_error
|
|
76 ("LDAP error",
|
|
77 build_string (ldap_err2string (ldap_get_lderrno (ld, NULL, NULL))));
|
276
|
78 #else
|
371
|
79 signal_simple_error ("LDAP error",
|
|
80 build_string (ldap_err2string (ld->ld_errno)));
|
361
|
81 #endif
|
276
|
82 }
|
|
83
|
|
84
|
|
85 /************************************************************************/
|
286
|
86 /* ldap lrecord basic functions */
|
276
|
87 /************************************************************************/
|
|
88
|
282
|
89 static Lisp_Object
|
|
90 make_ldap (struct Lisp_LDAP *ldap)
|
|
91 {
|
|
92 Lisp_Object lisp_ldap;
|
|
93 XSETLDAP (lisp_ldap, ldap);
|
|
94 return lisp_ldap;
|
|
95 }
|
276
|
96
|
|
97 static Lisp_Object
|
|
98 mark_ldap (Lisp_Object obj, void (*markobj) (Lisp_Object))
|
|
99 {
|
282
|
100 return XLDAP (obj)->host;
|
276
|
101 }
|
|
102
|
|
103 static void
|
|
104 print_ldap (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
|
|
105 {
|
282
|
106 char buf[32];
|
276
|
107
|
|
108 struct Lisp_LDAP *ldap = XLDAP (obj);
|
|
109
|
|
110 if (print_readably)
|
|
111 error ("printing unreadable object #<ldap %s>",
|
|
112 XSTRING_DATA (ldap->host));
|
|
113
|
278
|
114 write_c_string ("#<ldap ", printcharfun);
|
|
115 print_internal (ldap->host, printcharfun, 1);
|
371
|
116 if (!ldap->livep)
|
282
|
117 write_c_string ("(dead) ",printcharfun);
|
286
|
118 sprintf (buf, " 0x%x>", (unsigned int)ldap);
|
278
|
119 write_c_string (buf, printcharfun);
|
276
|
120 }
|
|
121
|
|
122 static struct Lisp_LDAP *
|
|
123 allocate_ldap (void)
|
|
124 {
|
|
125 struct Lisp_LDAP *ldap =
|
|
126 alloc_lcrecord_type (struct Lisp_LDAP, lrecord_ldap);
|
|
127
|
282
|
128 ldap->ld = NULL;
|
276
|
129 ldap->host = Qnil;
|
371
|
130 ldap->livep = 0;
|
276
|
131 return ldap;
|
|
132 }
|
|
133
|
280
|
134 static void
|
|
135 finalize_ldap (void *header, int for_disksave)
|
|
136 {
|
|
137 struct Lisp_LDAP *ldap = (struct Lisp_LDAP *) header;
|
|
138
|
|
139 if (for_disksave)
|
282
|
140 signal_simple_error ("Can't dump an emacs containing LDAP objects",
|
|
141 make_ldap (ldap));
|
|
142
|
371
|
143 if (ldap->livep)
|
280
|
144 ldap_unbind (ldap->ld);
|
|
145 }
|
|
146
|
276
|
147 DEFINE_LRECORD_IMPLEMENTATION ("ldap", ldap,
|
280
|
148 mark_ldap, print_ldap, finalize_ldap,
|
276
|
149 NULL, NULL, struct Lisp_LDAP);
|
|
150
|
|
151
|
|
152
|
|
153
|
|
154 /************************************************************************/
|
|
155 /* Basic ldap accessors */
|
|
156 /************************************************************************/
|
|
157
|
|
158 DEFUN ("ldapp", Fldapp, 1, 1, 0, /*
|
|
159 Return t if OBJECT is a LDAP connection.
|
|
160 */
|
|
161 (object))
|
|
162 {
|
|
163 return LDAPP (object) ? Qt : Qnil;
|
|
164 }
|
|
165
|
|
166 DEFUN ("ldap-host", Fldap_host, 1, 1, 0, /*
|
|
167 Return the server host of the connection LDAP, as a string.
|
|
168 */
|
|
169 (ldap))
|
|
170 {
|
|
171 CHECK_LDAP (ldap);
|
|
172 return (XLDAP (ldap))->host;
|
|
173 }
|
|
174
|
282
|
175 DEFUN ("ldap-live-p", Fldap_status, 1, 1, 0, /*
|
|
176 Return t if LDAP is an active LDAP connection.
|
276
|
177 */
|
|
178 (ldap))
|
|
179 {
|
|
180 CHECK_LDAP (ldap);
|
371
|
181 return (XLDAP (ldap))->livep ? Qt : Qnil;
|
276
|
182 }
|
|
183
|
|
184 /************************************************************************/
|
|
185 /* Opening/Closing a LDAP connection */
|
|
186 /************************************************************************/
|
|
187
|
|
188
|
|
189 DEFUN ("ldap-open", Fldap_open, 1, 2, 0, /*
|
|
190 Open a LDAP connection to HOST.
|
|
191 PLIST is a plist containing additional parameters for the connection.
|
259
|
192 Valid keys in that list are:
|
276
|
193 `port' the TCP port to use for the connection if different from
|
|
194 `ldap-default-port'.
|
259
|
195 `auth' is the authentication method to use, possible values depend on
|
|
196 the LDAP library XEmacs was compiled with: `simple', `krbv41' and `krbv42'.
|
|
197 `binddn' is the distinguished name of the user to bind as (in RFC 1779 syntax).
|
|
198 `passwd' is the password to use for simple authentication.
|
|
199 `deref' is one of the symbols `never', `always', `search' or `find'.
|
|
200 `timelimit' is the timeout limit for the connection in seconds.
|
|
201 `sizelimit' is the maximum number of matches to return.
|
|
202 */
|
276
|
203 (host, plist))
|
259
|
204 {
|
282
|
205 /* This function can GC */
|
|
206 struct Lisp_LDAP *ldap;
|
259
|
207 LDAP *ld;
|
278
|
208 int ldap_port = 0;
|
259
|
209 int ldap_auth = LDAP_AUTH_SIMPLE;
|
|
210 char *ldap_binddn = NULL;
|
|
211 char *ldap_passwd = NULL;
|
|
212 int ldap_deref = LDAP_DEREF_NEVER;
|
|
213 int ldap_timelimit = 0;
|
|
214 int ldap_sizelimit = 0;
|
278
|
215 int err;
|
259
|
216
|
282
|
217 Lisp_Object list, keyword, value;
|
259
|
218
|
276
|
219 CHECK_STRING (host);
|
|
220
|
282
|
221 EXTERNAL_PROPERTY_LIST_LOOP (list, keyword, value, plist)
|
276
|
222 {
|
|
223 /* TCP Port */
|
|
224 if (EQ (keyword, Qport))
|
259
|
225 {
|
276
|
226 CHECK_INT (value);
|
|
227 ldap_port = XINT (value);
|
259
|
228 }
|
|
229 /* Authentication method */
|
276
|
230 if (EQ (keyword, Qauth))
|
259
|
231 {
|
|
232 if (EQ (value, Qsimple))
|
|
233 ldap_auth = LDAP_AUTH_SIMPLE;
|
|
234 #ifdef LDAP_AUTH_KRBV41
|
|
235 else if (EQ (value, Qkrbv41))
|
|
236 ldap_auth = LDAP_AUTH_KRBV41;
|
|
237 #endif
|
|
238 #ifdef LDAP_AUTH_KRBV42
|
|
239 else if (EQ (value, Qkrbv42))
|
|
240 ldap_auth = LDAP_AUTH_KRBV42;
|
|
241 #endif
|
|
242 else
|
|
243 signal_simple_error ("Invalid authentication method", value);
|
|
244 }
|
|
245 /* Bind DN */
|
|
246 else if (EQ (keyword, Qbinddn))
|
|
247 {
|
276
|
248 CHECK_STRING (value);
|
384
|
249 GET_C_STRING_OS_DATA_ALLOCA (value, ldap_binddn);
|
259
|
250 }
|
|
251 /* Password */
|
|
252 else if (EQ (keyword, Qpasswd))
|
|
253 {
|
276
|
254 CHECK_STRING (value);
|
384
|
255 GET_C_STRING_OS_DATA_ALLOCA (value, ldap_passwd);
|
259
|
256 }
|
|
257 /* Deref */
|
|
258 else if (EQ (keyword, Qderef))
|
|
259 {
|
|
260 if (EQ (value, Qnever))
|
|
261 ldap_deref = LDAP_DEREF_NEVER;
|
|
262 else if (EQ (value, Qsearch))
|
|
263 ldap_deref = LDAP_DEREF_SEARCHING;
|
|
264 else if (EQ (value, Qfind))
|
|
265 ldap_deref = LDAP_DEREF_FINDING;
|
|
266 else if (EQ (value, Qalways))
|
|
267 ldap_deref = LDAP_DEREF_ALWAYS;
|
|
268 else
|
|
269 signal_simple_error ("Invalid deref value", value);
|
|
270 }
|
|
271 /* Timelimit */
|
|
272 else if (EQ (keyword, Qtimelimit))
|
|
273 {
|
276
|
274 CHECK_INT (value);
|
|
275 ldap_timelimit = XINT (value);
|
259
|
276 }
|
|
277 /* Sizelimit */
|
|
278 else if (EQ (keyword, Qsizelimit))
|
|
279 {
|
276
|
280 CHECK_INT (value);
|
|
281 ldap_sizelimit = XINT (value);
|
259
|
282 }
|
|
283 }
|
|
284
|
276
|
285 if (ldap_port == 0)
|
259
|
286 {
|
276
|
287 ldap_port = ldap_default_port;
|
259
|
288 }
|
|
289
|
276
|
290 /* Connect to the server and bind */
|
388
|
291 slow_down_interrupts ();
|
276
|
292 ld = ldap_open ((char *)XSTRING_DATA (host), ldap_port);
|
388
|
293 speed_up_interrupts ();
|
|
294
|
276
|
295 if (ld == NULL )
|
|
296 signal_simple_error_2 ("Failed connecting to host",
|
|
297 host,
|
|
298 lisp_strerror (errno));
|
259
|
299
|
|
300
|
280
|
301 #ifdef HAVE_LDAP_SET_OPTION
|
371
|
302 if (ldap_set_option (ld, LDAP_OPT_DEREF, (void *)&ldap_deref) != LDAP_SUCCESS)
|
|
303 signal_ldap_error (ld);
|
|
304 if (ldap_set_option (ld, LDAP_OPT_TIMELIMIT,
|
|
305 (void *)&ldap_timelimit) != LDAP_SUCCESS)
|
|
306 signal_ldap_error (ld);
|
|
307 if (ldap_set_option (ld, LDAP_OPT_SIZELIMIT,
|
|
308 (void *)&ldap_sizelimit) != LDAP_SUCCESS)
|
|
309 signal_ldap_error (ld);
|
|
310 if (ldap_set_option (ld, LDAP_OPT_REFERRALS, LDAP_OPT_ON) != LDAP_SUCCESS)
|
|
311 signal_ldap_error (ld);
|
280
|
312 #else /* not HAVE_LDAP_SET_OPTION */
|
259
|
313 ld->ld_deref = ldap_deref;
|
|
314 ld->ld_timelimit = ldap_timelimit;
|
|
315 ld->ld_sizelimit = ldap_sizelimit;
|
|
316 #ifdef LDAP_REFERRALS
|
|
317 ld->ld_options = LDAP_OPT_REFERRALS;
|
280
|
318 #else /* not LDAP_REFERRALS */
|
259
|
319 ld->ld_options = 0;
|
280
|
320 #endif /* not LDAP_REFERRALS */
|
|
321 #endif /* not HAVE_LDAP_SET_OPTION */
|
259
|
322
|
371
|
323 /* ldap_bind_s calls select and may be wedged by SIGIO. */
|
|
324 slow_down_interrupts ();
|
276
|
325 err = ldap_bind_s (ld, ldap_binddn, ldap_passwd, ldap_auth);
|
371
|
326 speed_up_interrupts ();
|
276
|
327 if (err != LDAP_SUCCESS)
|
259
|
328 signal_simple_error ("Failed binding to the server",
|
|
329 build_string (ldap_err2string (err)));
|
|
330
|
282
|
331 ldap = allocate_ldap ();
|
|
332 ldap->ld = ld;
|
|
333 ldap->host = host;
|
371
|
334 ldap->livep = 1;
|
276
|
335
|
282
|
336 return make_ldap (ldap);
|
276
|
337 }
|
|
338
|
|
339
|
|
340
|
|
341 DEFUN ("ldap-close", Fldap_close, 1, 1, 0, /*
|
|
342 Close an LDAP connection.
|
|
343 */
|
|
344 (ldap))
|
|
345 {
|
280
|
346 struct Lisp_LDAP *lldap;
|
|
347 CHECK_LIVE_LDAP (ldap);
|
|
348 lldap = XLDAP (ldap);
|
|
349 ldap_unbind (lldap->ld);
|
371
|
350 lldap->livep = 0;
|
276
|
351 return Qnil;
|
|
352 }
|
|
353
|
|
354
|
|
355
|
|
356 /************************************************************************/
|
|
357 /* Working on a LDAP connection */
|
|
358 /************************************************************************/
|
278
|
359 struct ldap_unwind_struct
|
|
360 {
|
|
361 LDAPMessage *res;
|
371
|
362 char **vals;
|
278
|
363 };
|
|
364
|
371
|
365
|
278
|
366 static Lisp_Object
|
|
367 ldap_search_unwind (Lisp_Object unwind_obj)
|
|
368 {
|
|
369 struct ldap_unwind_struct *unwind =
|
|
370 (struct ldap_unwind_struct *) get_opaque_ptr (unwind_obj);
|
282
|
371 if (unwind->res)
|
278
|
372 ldap_msgfree (unwind->res);
|
282
|
373 if (unwind->vals)
|
371
|
374 ldap_value_free (unwind->vals);
|
286
|
375 return Qnil;
|
278
|
376 }
|
276
|
377
|
|
378 DEFUN ("ldap-search-internal", Fldap_search_internal, 2, 6, 0, /*
|
|
379 Perform a search on an open LDAP connection.
|
|
380 LDAP is an LDAP connection object created with `ldap-open'.
|
298
|
381 FILTER is a filter string for the search as described in RFC 1558.
|
|
382 BASE is the distinguished name at which to start the search.
|
|
383 SCOPE is one of the symbols `base', `onelevel' or `subtree' indicating
|
|
384 the scope of the search.
|
276
|
385 ATTRS is a list of strings indicating which attributes to retrieve
|
|
386 for each matching entry. If nil return all available attributes.
|
|
387 If ATTRSONLY is non-nil then only the attributes are retrieved, not
|
298
|
388 the associated values.
|
276
|
389 The function returns a list of matching entries. Each entry is itself
|
|
390 an alist of attribute/values.
|
|
391 */
|
|
392 (ldap, filter, base, scope, attrs, attrsonly))
|
|
393 {
|
282
|
394 /* This function can GC */
|
276
|
395
|
|
396 /* Vars for query */
|
|
397 LDAP *ld;
|
278
|
398 LDAPMessage *e;
|
276
|
399 BerElement *ptr;
|
|
400 char *a;
|
371
|
401 int i, rc;
|
276
|
402 int matches;
|
278
|
403 struct ldap_unwind_struct unwind;
|
276
|
404
|
|
405 int ldap_scope = LDAP_SCOPE_SUBTREE;
|
|
406 char **ldap_attributes = NULL;
|
|
407
|
278
|
408 int speccount = specpdl_depth ();
|
|
409
|
276
|
410 Lisp_Object list, entry, result;
|
|
411 struct gcpro gcpro1, gcpro2, gcpro3;
|
|
412
|
|
413 list = entry = result = Qnil;
|
282
|
414 GCPRO3 (list, entry, result);
|
276
|
415
|
282
|
416 unwind.res = NULL;
|
|
417 unwind.vals = NULL;
|
278
|
418
|
276
|
419 /* Do all the parameter checking */
|
|
420 CHECK_LIVE_LDAP (ldap);
|
282
|
421 ld = XLDAP (ldap)->ld;
|
276
|
422
|
|
423 /* Filter */
|
|
424 CHECK_STRING (filter);
|
|
425
|
|
426 /* Search base */
|
|
427 if (NILP (base))
|
|
428 {
|
|
429 base = Vldap_default_base;
|
|
430 }
|
|
431 if (!NILP (base))
|
|
432 {
|
304
|
433 CHECK_STRING (base);
|
276
|
434 }
|
|
435
|
|
436 /* Search scope */
|
|
437 if (!NILP (scope))
|
|
438 {
|
|
439 if (EQ (scope, Qbase))
|
|
440 ldap_scope = LDAP_SCOPE_BASE;
|
|
441 else if (EQ (scope, Qonelevel))
|
|
442 ldap_scope = LDAP_SCOPE_ONELEVEL;
|
|
443 else if (EQ (scope, Qsubtree))
|
|
444 ldap_scope = LDAP_SCOPE_SUBTREE;
|
|
445 else
|
|
446 signal_simple_error ("Invalid scope", scope);
|
|
447 }
|
|
448
|
|
449 /* Attributes to search */
|
|
450 if (!NILP (attrs))
|
|
451 {
|
|
452 CHECK_CONS (attrs);
|
278
|
453 ldap_attributes = alloca_array (char *, 1 + XINT (Flength (attrs)));
|
276
|
454
|
278
|
455 i = 0;
|
|
456 EXTERNAL_LIST_LOOP (attrs, attrs)
|
|
457 {
|
|
458 Lisp_Object current = XCAR (attrs);
|
|
459 CHECK_STRING (current);
|
384
|
460 GET_C_STRING_OS_DATA_ALLOCA (current, ldap_attributes[i]);
|
278
|
461 ++i;
|
|
462 }
|
276
|
463 ldap_attributes[i] = NULL;
|
|
464 }
|
|
465
|
|
466 /* Attributes only ? */
|
|
467 CHECK_SYMBOL (attrsonly);
|
|
468
|
|
469 /* Perform the search */
|
|
470 if (ldap_search (ld,
|
|
471 NILP (base) ? "" : (char *) XSTRING_DATA (base),
|
|
472 ldap_scope,
|
|
473 NILP (filter) ? "" : (char *) XSTRING_DATA (filter),
|
|
474 ldap_attributes,
|
|
475 NILP (attrsonly) ? 0 : 1)
|
371
|
476 == -1)
|
276
|
477 {
|
371
|
478 signal_ldap_error (ld);
|
259
|
479 }
|
|
480
|
278
|
481 /* Ensure we don't exit without cleaning up */
|
|
482 record_unwind_protect (ldap_search_unwind,
|
|
483 make_opaque_ptr (&unwind));
|
|
484
|
259
|
485 /* Build the results list */
|
|
486 matches = 0;
|
|
487
|
371
|
488 /* ldap_result calls select() and can get wedged by EINTR signals */
|
|
489 slow_down_interrupts ();
|
282
|
490 rc = ldap_result (ld, LDAP_RES_ANY, 0, NULL, &unwind.res);
|
371
|
491 speed_up_interrupts ();
|
282
|
492 while (rc == LDAP_RES_SEARCH_ENTRY)
|
259
|
493 {
|
278
|
494 QUIT;
|
259
|
495 matches ++;
|
278
|
496 e = ldap_first_entry (ld, unwind.res);
|
282
|
497 /* #### This call to message() is pretty fascist, because it
|
|
498 destroys the current echo area contents, even when invoked
|
|
499 from Lisp. It should use echo_area_message() instead, and
|
|
500 restore the old echo area contents later. */
|
|
501 message ("Parsing ldap results... %d", matches);
|
259
|
502 entry = Qnil;
|
|
503 for (a= ldap_first_attribute (ld, e, &ptr);
|
|
504 a != NULL;
|
371
|
505 a= ldap_next_attribute (ld, e, ptr) )
|
259
|
506 {
|
292
|
507 list = Fcons (build_ext_string (a, FORMAT_OS), Qnil);
|
371
|
508 unwind.vals = ldap_get_values (ld, e, a);
|
278
|
509 if (unwind.vals != NULL)
|
259
|
510 {
|
282
|
511 for (i = 0; unwind.vals[i] != NULL; i++)
|
259
|
512 {
|
371
|
513 list = Fcons (build_ext_string (unwind.vals[i], FORMAT_OS),
|
259
|
514 list);
|
|
515 }
|
|
516 }
|
|
517 entry = Fcons (Fnreverse (list),
|
|
518 entry);
|
371
|
519 ldap_value_free (unwind.vals);
|
282
|
520 unwind.vals = NULL;
|
259
|
521 }
|
|
522 result = Fcons (Fnreverse (entry),
|
|
523 result);
|
278
|
524 ldap_msgfree (unwind.res);
|
282
|
525 unwind.res = NULL;
|
276
|
526
|
371
|
527 slow_down_interrupts ();
|
278
|
528 rc = ldap_result (ld, LDAP_RES_ANY, 0, NULL, &(unwind.res));
|
371
|
529 speed_up_interrupts ();
|
259
|
530 }
|
|
531
|
|
532 if (rc == -1)
|
371
|
533 {
|
|
534 signal_ldap_error (ld);
|
|
535 }
|
280
|
536 rc = ldap_result2error (ld, unwind.res, 0);
|
371
|
537 if ((rc != LDAP_SUCCESS) &&
|
|
538 (rc != LDAP_SIZELIMIT_EXCEEDED))
|
|
539 {
|
|
540 signal_ldap_error (ld);
|
|
541 }
|
259
|
542
|
278
|
543 ldap_msgfree (unwind.res);
|
|
544 unwind.res = (LDAPMessage *)NULL;
|
282
|
545 /* #### See above for calling message(). */
|
|
546 message ("Parsing ldap results... done");
|
259
|
547
|
278
|
548 unbind_to (speccount, Qnil);
|
259
|
549 UNGCPRO;
|
282
|
550 return Fnreverse (result);
|
259
|
551 }
|
|
552
|
|
553
|
|
554 void
|
|
555 syms_of_eldap (void)
|
|
556 {
|
276
|
557 defsymbol (&Qldapp, "ldapp");
|
|
558 DEFSUBR (Fldapp);
|
|
559 DEFSUBR (Fldap_host);
|
|
560 DEFSUBR (Fldap_status);
|
|
561 DEFSUBR (Fldap_open);
|
|
562 DEFSUBR (Fldap_close);
|
|
563 DEFSUBR (Fldap_search_internal);
|
259
|
564 }
|
|
565
|
|
566 void
|
|
567 vars_of_eldap (void)
|
|
568 {
|
|
569
|
276
|
570 ldap_default_port = LDAP_PORT;
|
|
571 Vldap_default_base = Qnil;
|
|
572
|
|
573 DEFVAR_INT ("ldap-default-port", &ldap_default_port /*
|
|
574 Default TCP port for LDAP connections.
|
|
575 Initialized from the LDAP library. Default value is 389.
|
259
|
576 */ );
|
|
577
|
|
578 DEFVAR_LISP ("ldap-default-base", &Vldap_default_base /*
|
|
579 Default base for LDAP searches.
|
|
580 This is a string using the syntax of RFC 1779.
|
|
581 For instance, "o=ACME, c=US" limits the search to the
|
|
582 Acme organization in the United States.
|
|
583 */ );
|
|
584
|
|
585 }
|
276
|
586
|
|
587
|