annotate src/eldap.c @ 371:cc15677e0335 r21-2b1

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