annotate src/eldap.c @ 388:aabb7f5b1c81 r21-2-9

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