annotate man/lispref/ldap.texi @ 440:8de8e3f6228a r21-2-28

Import from CVS: tag r21-2-28
author cvs
date Mon, 13 Aug 2007 11:33:38 +0200
parents 3ecd8885ac67
children abe6d1db359e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 @c -*-texinfo-*-
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 @c This is part of the XEmacs Lisp Reference Manual.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 @c Copyright (C) 1998 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 @c See the file lispref.texi for copying conditions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 @setfilename ../../info/ldap.info
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 @node LDAP Support, Internationalization, ToolTalk Support, top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 @chapter LDAP Support
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 @cindex LDAP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 XEmacs can be linked with a LDAP client library to provide Elisp primitives
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 to access directory servers using the Lightweight Directory Access Protocol.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 @menu
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 * Building XEmacs with LDAP support:: How to add LDAP support to XEmacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 * XEmacs LDAP API:: Lisp access to LDAP functions
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 * Syntax of Search Filters:: A brief summary of RFC 1558
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 @end menu
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 @node Building XEmacs with LDAP support, XEmacs LDAP API, LDAP Support, LDAP Support
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 @comment node-name, next, previous, up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 @section Building XEmacs with LDAP support
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 LDAP support must be added to XEmacs at build time since it requires
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 linking to an external LDAP client library. As of 21.2, XEmacs has been
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 successfully built and tested with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 @itemize @bullet
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 @item OpenLDAP 1.0.3 (@url{http://www.openldap.org/})
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 @item University of Michigan's LDAP 3.3 (@url{http://www.umich.edu/~dirsvcs/ldap/})
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 @item LDAP SDK 1.0 from Netscape Corp. (@url{http://developer.netscape.com/})
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 @end itemize
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 Other libraries conforming to RFC 1823 will probably work also but may
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 require some minor tweaking at C level.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 The standard XEmacs configure script autodetects an installed LDAP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 library provided the library itself and the corresponding header files
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 can be found in the library and include paths. A successful detection
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 will be signalled in the final output of the configure script.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 @node XEmacs LDAP API, Syntax of Search Filters, Building XEmacs with LDAP support, LDAP Support
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 @comment node-name, next, previous, up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 @section XEmacs LDAP API
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 XEmacs LDAP API consists of two layers: a low-level layer which tries
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 to stay as close as possible to the C API (where practical) and a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 higher-level layer which provides more convenient primitives to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 effectively use LDAP.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 As of XEmacs 21.0, only interfaces to basic LDAP search functions are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 provided, broader support is planned in future versions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 @menu
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 * LDAP Variables:: Lisp variables related to LDAP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 * The High-Level LDAP API:: High-level LDAP lisp functions
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 * The Low-Level LDAP API:: Low-level LDAP lisp primitives
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 @end menu
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 @node LDAP Variables, The High-Level LDAP API, XEmacs LDAP API, XEmacs LDAP API
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 @comment node-name, next, previous, up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 @subsection LDAP Variables
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 @defvar ldap-default-host
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 The default LDAP server hostname.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 A TCP port number can be appended to that name using a colon as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 a separator.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 @end defvar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 @defvar ldap-default-port
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 Default TCP port for LDAP connections.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 Initialized from the LDAP library. Default value is 389.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 @end defvar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 @defvar ldap-default-base
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 Default base for LDAP searches.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 This is a string using the syntax of RFC 1779.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 For instance, "o¬ME, cÿ" limits the search to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 Acme organization in the United States.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 @end defvar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 @defvar ldap-host-parameters-alist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 An alist of per host options for LDAP transactions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 The list elements look like @code{(HOST PROP1 VAL1 PROP2 VAL2 ...)}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 @var{host} is the name of an LDAP server. A TCP port number can be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 appended to that name using a colon as a separator.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 @var{propn} and @var{valn} are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 property/value pairs describing parameters for the server. Valid
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 properties:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 @table @code
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 @item binddn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 The distinguished name of the user to bind as. This may look like
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 @samp{cÿ, o¬me, cnÿnny Bugs}, see RFC 1779 for details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 @item passwd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 The password to use for authentication.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 @item auth
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 The authentication method to use, possible values depend on the LDAP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 library XEmacs was compiled with, they may include @code{simple},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 @code{krbv41} and @code{krbv42}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 @item base
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 The base for the search. This may look like @samp{cÿ, o¬me}, see
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 RFC 1779 for syntax details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 @item scope
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 One of the symbols @code{base}, @code{onelevel} or @code{subtree}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 indicating the scope of the search limited to a base
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 object, to a single level or to the whole subtree.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 @item deref
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 The dereference policy is one of the symbols @code{never},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 @code{always}, @code{search} or @code{find} and defines how aliases are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 dereferenced.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 @table @code
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 @item never
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 Aliases are never dereferenced
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 @item always
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 Aliases are always dereferenced
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 @item search
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 Aliases are dereferenced when searching
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 @item find
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 Aliases are dereferenced when locating the base object for the search
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 @item timelimit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 The timeout limit for the connection in seconds.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 @item sizelimit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 The maximum number of matches to return for searches performed on this connection.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 @end defvar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 @node The High-Level LDAP API, The Low-Level LDAP API, LDAP Variables, XEmacs LDAP API
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 @comment node-name, next, previous, up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 @subsection The High-Level LDAP API
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 As of this writing the high-level Lisp LDAP API only provides for LDAP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 searches. Further support is planned in the future.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 The @code{ldap-search} function provides the most convenient interface
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 to perform LDAP searches. It opens a connection to a host, performs the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 query and cleanly closes the connection thus insulating the user from
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 all the details of the low-level interface such as LDAP Lisp objects
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 @pxref{The Low-Level LDAP API}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 @defun ldap-search filter &optional host attributes attrsonly
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 Perform an LDAP search.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 @var{filter} is the search filter @pxref{Syntax of Search Filters}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 @var{host} is the LDAP host on which to perform the search
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 @var{attributes} is the specific attributes to retrieve, @code{nil} means
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 retrieve all
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 @var{attrsonly} if non-@code{nil} retrieves the attributes only without
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 their associated values.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 Additional search parameters can be specified through
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 @code{ldap-host-parameters-alist}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 @end defun
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 @node The Low-Level LDAP API, , The High-Level LDAP API, XEmacs LDAP API
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 @comment node-name, next, previous, up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 @subsection The Low-Level LDAP API
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 @menu
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 * The LDAP Lisp Object::
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 * Opening and Closing a LDAP Connection::
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 * Searching on a LDAP Server (Low-level)::
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 @end menu
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 @node The LDAP Lisp Object, Opening and Closing a LDAP Connection, The Low-Level LDAP API, The Low-Level LDAP API
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 @comment node-name, next, previous, up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 @subsubsection The LDAP Lisp Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 An internal built-in @code{ldap} lisp object represents a LDAP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 connection.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 @defun ldapp object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 This function returns non-@code{nil} if @var{object} is a @code{ldap} object.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 @end defun
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 @defun ldap-host ldap
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 Return the server host of the connection represented by @var{ldap}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 @end defun
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 @defun ldap-live-p ldap
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 Return non-@code{nil} if @var{ldap} is an active LDAP connection
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 @end defun
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 @node Opening and Closing a LDAP Connection, Searching on a LDAP Server (Low-level), The LDAP Lisp Object, The Low-Level LDAP API
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 @comment node-name, next, previous, up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 @subsubsection Opening and Closing a LDAP Connection
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 @defun ldap-open host &optional plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 Open a LDAP connection to @var{host}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 @var{plist} is a property list containing additional parameters for the connection.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 Valid keys in that list are:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 @table @code
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 @item port
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 The TCP port to use for the connection if different from
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 @code{ldap-default-port} or the library builtin value
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 @item auth
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 The authentication method to use, possible values depend on the LDAP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 library XEmacs was compiled with, they may include @code{simple},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 @code{krbv41} and @code{krbv42}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 @item binddn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 The distinguished name of the user to bind as. This may look like
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 @samp{cÿ, o¬me, cnÿnny Bugs}, see RFC 1779 for details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 @item passwd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 The password to use for authentication.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 @item deref
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 The dereference policy is one of the symbols @code{never},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 @code{always}, @code{search} or @code{find} and defines how aliases are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 dereferenced.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 @table @code
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 @item never
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 Aliases are never dereferenced
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 @item always
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 Aliases are always dereferenced
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 @item search
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 Aliases are dereferenced when searching
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 @item find
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 Aliases are dereferenced when locating the base object for the search
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 The default is @code{never}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 @item timelimit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 The timeout limit for the connection in seconds.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 @item sizelimit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 The maximum number of matches to return for searches performed on this connection.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 @end defun
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 @defun ldap-close ldap
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 Close the connection represented by @var{ldap}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 @end defun
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 @node Searching on a LDAP Server (Low-level), , Opening and Closing a LDAP Connection, The Low-Level LDAP API
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 @comment node-name, next, previous, up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 @subsubsection Searching on a LDAP Server (Low-level)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 @code{ldap-search-internal} is the low-level primitive to perform a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 search on a LDAP server. It works directly on an open LDAP connection
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 thus requiring a preliminary call to @code{ldap-open}. Multiple
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 searches can be made on the same connection, then the session must be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 closed with @code{ldap-close}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 @defun ldap-search-internal ldap filter base scope attrs attrsonly
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 Perform a search on an open connection @var{ldap} created with @code{ldap-open}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 @var{filter} is a filter string for the search @pxref{Syntax of Search Filters}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 @var{base} is the distinguished name at which to start the search.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 @var{scope} is one of the symbols @code{base}, @code{onelevel} or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 @code{subtree} indicating the scope of the search limited to a base
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 object, to a single level or to the whole subtree. The default is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 @code{subtree}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 @code{attrs} is a list of strings indicating which attributes to retrieve
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 for each matching entry. If @code{nil} all available attributes are returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 If @code{attrsonly} is non-@code{nil} then only the attributes are retrieved, not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 their associated values
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 The function returns a list of matching entries. Each entry being itself
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 an alist of attribute/values.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 @end defun
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 @node Syntax of Search Filters, , XEmacs LDAP API, LDAP Support
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 @comment node-name, next, previous, up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 @section Syntax of Search Filters
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 LDAP search functions use RFC1558 syntax to describe the search filter.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 In that syntax simple filters have the form:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 @example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 (<attr> <filtertype> <value>)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 @end example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 @code{<attr>} is an attribute name such as @code{cn} for Common Name,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 @code{o} for Organization, etc...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 @code{<value>} is the corresponding value. This is generally an exact
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 string but may also contain @code{*} characters as wildcards
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 @code{filtertype} is one @code{=} @code{~=}, @code{<=}, @code{>=} which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 respectively describe equality, approximate equality, inferiority and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 superiority.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 Thus @code{(cn=John Smith)} matches all records having a canonical name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 equal to John Smith.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 A special case is the presence filter @code{(<attr>=*} which matches
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 records containing a particular attribute. For instance @code{(mail=*)}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 matches all records containing a @code{mail} attribute.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 Simple filters can be connected together with the logical operators
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 @code{&}, @code{|} and @code{!} which stand for the usual and, or and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 not operators.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 @code{(&(objectClass=Person)(mail=*)(|(sn=Smith)(givenname=John)))}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 matches records of class @code{Person} containing a @code{mail}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 attribute and corresponding to people whose last name is @code{Smith} or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 whose first name is @code{John}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304