annotate lisp/ldap.el @ 400:a86b2b5e0111 r21-2-30

Import from CVS: tag r21-2-30
author cvs
date Mon, 13 Aug 2007 11:14:34 +0200
parents 74fd4e045ea6
children 697ef44129c6
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.el --- LDAP support for Emacs
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
2
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
4
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
5 ;; Author: Oscar Figueiredo <Oscar.Figueiredo@di.epfl.ch>
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
6 ;; Maintainer: Oscar Figueiredo <Oscar.Figueiredo@di.epfl.ch>
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
7 ;; Created: Jan 1998
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
8 ;; Version: $Revision: 1.7.2.7 $
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
9 ;; Keywords: help comm
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
10
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
11 ;; This file is part of XEmacs
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
12
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
13 ;; XEmacs is free software; you can redistribute it and/or modify it
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
14 ;; under the terms of the GNU General Public License as published by
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
16 ;; any later version.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
17
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
18 ;; XEmacs is distributed in the hope that it will be useful, but
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
21 ;; General Public License for more details.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
22
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
24 ;; along with XEmacs; see the file COPYING. If not, write to
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
25 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
26 ;; Boston, MA 02111-1307, USA.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
27
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
28 ;;; Commentary:
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
29 ;; This file provides mid-level and user-level functions to access directory
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
30 ;; servers using the LDAP protocol (RFC 1777).
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
31
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
32 ;;; Installation:
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
33 ;; LDAP support must have been built into XEmacs.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
34
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
35
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
36 ;;; Code:
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
37
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
38 (eval-when '(load)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
39 (if (not (fboundp 'ldap-open))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
40 (error "No LDAP support compiled in this XEmacs")))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
41
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
42 (defgroup ldap nil
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
43 "Lightweight Directory Access Protocol"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
44 :group 'comm)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
45
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
46 (defcustom ldap-default-host nil
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
47 "*Default LDAP server hostname.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
48 A TCP port number can be appended to that name using a colon as
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
49 a separator."
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
50 :type '(choice (string :tag "Host name")
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
51 (const :tag "Use library default" nil))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
52 :group 'ldap)
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
53
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
54 (defcustom ldap-default-port nil
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
55 "*Default TCP port for LDAP connections.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
56 Initialized from the LDAP library at build time. Default value is 389."
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
57 :type '(choice (const :tag "Use library default" nil)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
58 (integer :tag "Port number"))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
59 :group 'ldap)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
60
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
61 (defcustom ldap-default-base nil
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
62 "*Default base for LDAP searches.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
63 This is a string using the syntax of RFC 1779.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
64 For instance, \"o=ACME, c=US\" limits the search to the
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
65 Acme organization in the United States."
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
66 :type '(choice (const :tag "Use library default" nil)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
67 (string :tag "Search base"))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
68 :group 'ldap)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
69
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
70
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
71 (defcustom ldap-host-parameters-alist nil
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
72 "*Alist of host-specific options for LDAP transactions.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
73 The format of each list element is:
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
74 \(HOST PROP1 VAL1 PROP2 VAL2 ...)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
75 HOST is the hostname of an LDAP server (with an optional TCP port number
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
76 appended to it using a colon as a separator).
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
77 PROPn and VALn are property/value pairs describing parameters for the server.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
78 Valid properties include:
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
79 `binddn' is the distinguished name of the user to bind as
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
80 (in RFC 1779 syntax).
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
81 `passwd' is the password to use for simple authentication.
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
82 `auth' is the authentication method to use.
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
83 Possible values are: `simple', `krbv41' and `krbv42'.
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
84 `base' is the base for the search as described in RFC 1779.
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
85 `scope' is one of the three symbols `subtree', `base' or `onelevel'.
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
86 `deref' is one of the symbols `never', `always', `search' or `find'.
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
87 `timelimit' is the timeout limit for the connection in seconds.
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
88 `sizelimit' is the maximum number of matches to return."
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
89 :type '(repeat :menu-tag "Host parameters"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
90 :tag "Host parameters"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
91 (list :menu-tag "Host parameters"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
92 :tag "Host parameters"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
93 :value nil
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
94 (string :tag "Host name")
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
95 (checklist :inline t
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
96 :greedy t
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
97 (list
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
98 :tag "Search Base"
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
99 :inline t
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
100 (const :tag "Search Base" base)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
101 string)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
102 (list
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
103 :tag "Binding DN"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
104 :inline t
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
105 (const :tag "Binding DN" binddn)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
106 string)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
107 (list
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
108 :tag "Password"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
109 :inline t
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
110 (const :tag "Password" passwd)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
111 string)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
112 (list
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
113 :tag "Authentication Method"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
114 :inline t
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
115 (const :tag "Authentication Method" auth)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
116 (choice
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
117 (const :menu-tag "None" :tag "None" nil)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
118 (const :menu-tag "Simple" :tag "Simple" simple)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
119 (const :menu-tag "Kerberos 4.1" :tag "Kerberos 4.1" krbv41)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
120 (const :menu-tag "Kerberos 4.2" :tag "Kerberos 4.2" krbv42)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
121 (list
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
122 :tag "Search Scope"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
123 :inline t
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
124 (const :tag "Search Scope" scope)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
125 (choice
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
126 (const :menu-tag "Default" :tag "Default" nil)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
127 (const :menu-tag "Subtree" :tag "Subtree" subtree)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
128 (const :menu-tag "Base" :tag "Base" base)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
129 (const :menu-tag "One Level" :tag "One Level" onelevel)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
130 (list
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
131 :tag "Dereferencing"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
132 :inline t
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
133 (const :tag "Dereferencing" deref)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
134 (choice
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
135 (const :menu-tag "Default" :tag "Default" nil)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
136 (const :menu-tag "Never" :tag "Never" never)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
137 (const :menu-tag "Always" :tag "Always" always)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
138 (const :menu-tag "When searching" :tag "When searching" search)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
139 (const :menu-tag "When locating base" :tag "When locating base" find)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
140 (list
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
141 :tag "Time Limit"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
142 :inline t
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
143 (const :tag "Time Limit" timelimit)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
144 (integer :tag "(in seconds)"))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
145 (list
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
146 :tag "Size Limit"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
147 :inline t
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
148 (const :tag "Size Limit" sizelimit)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
149 (integer :tag "(number of records)")))))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
150 :group 'ldap)
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 361
diff changeset
151
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
152 (defcustom ldap-verbose nil
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
153 "*If non-nil, LDAP operations echo progress messages."
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
154 :type 'boolean
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
155 :group 'ldap)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
156
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
157 (defcustom ldap-ignore-attribute-codings nil
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
158 "*If non-nil, do not perform any encoding/decoding on LDAP attribute values."
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
159 :type 'boolean
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
160 :group 'ldap)
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
161
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
162 (defcustom ldap-default-attribute-decoder nil
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
163 "*Decoder function to use for attributes whose syntax is unknown."
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
164 :type 'symbol
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
165 :group 'ldap)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
166
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
167 (defcustom ldap-coding-system nil
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
168 "*Coding system of LDAP string values.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
169 LDAP v3 specifies the coding system of strings to be UTF-8.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
170 Mule support is needed for this."
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
171 :type 'symbol
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
172 :group 'ldap)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
173
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
174 (defvar ldap-attribute-syntax-encoders
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
175 [nil ; 1 ACI Item N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
176 nil ; 2 Access Point Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
177 nil ; 3 Attribute Type Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
178 nil ; 4 Audio N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
179 nil ; 5 Binary N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
180 nil ; 6 Bit String Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
181 ldap-encode-boolean ; 7 Boolean Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
182 nil ; 8 Certificate N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
183 nil ; 9 Certificate List N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
184 nil ; 10 Certificate Pair N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
185 ldap-encode-country-string ; 11 Country String Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
186 ldap-encode-string ; 12 DN Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
187 nil ; 13 Data Quality Syntax Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
188 nil ; 14 Delivery Method Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
189 ldap-encode-string ; 15 Directory String Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
190 nil ; 16 DIT Content Rule Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
191 nil ; 17 DIT Structure Rule Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
192 nil ; 18 DL Submit Permission Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
193 nil ; 19 DSA Quality Syntax Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
194 nil ; 20 DSE Type Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
195 nil ; 21 Enhanced Guide Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
196 nil ; 22 Facsimile Telephone Number Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
197 nil ; 23 Fax N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
198 nil ; 24 Generalized Time Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
199 nil ; 25 Guide Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
200 nil ; 26 IA5 String Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
201 number-to-string ; 27 INTEGER Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
202 nil ; 28 JPEG N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
203 nil ; 29 Master And Shadow Access Points Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
204 nil ; 30 Matching Rule Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
205 nil ; 31 Matching Rule Use Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
206 nil ; 32 Mail Preference Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
207 nil ; 33 MHS OR Address Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
208 nil ; 34 Name And Optional UID Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
209 nil ; 35 Name Form Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
210 nil ; 36 Numeric String Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
211 nil ; 37 Object Class Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
212 nil ; 38 OID Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
213 nil ; 39 Other Mailbox Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
214 nil ; 40 Octet String Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
215 ldap-encode-address ; 41 Postal Address Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
216 nil ; 42 Protocol Information Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
217 nil ; 43 Presentation Address Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
218 ldap-encode-string ; 44 Printable String Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
219 nil ; 45 Subtree Specification Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
220 nil ; 46 Supplier Information Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
221 nil ; 47 Supplier Or Consumer Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
222 nil ; 48 Supplier And Consumer Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
223 nil ; 49 Supported Algorithm N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
224 nil ; 50 Telephone Number Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
225 nil ; 51 Teletex Terminal Identifier Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
226 nil ; 52 Telex Number Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
227 nil ; 53 UTC Time Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
228 nil ; 54 LDAP Syntax Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
229 nil ; 55 Modify Rights Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
230 nil ; 56 LDAP Schema Definition Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
231 nil ; 57 LDAP Schema Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
232 nil ; 58 Substring Assertion Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
233 ]
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
234 "A vector of functions used to encode LDAP attribute values.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
235 The sequence of functions corresponds to the sequence of LDAP attribute syntax
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
236 object identifiers of the form 1.3.6.1.4.1.1466.1115.121.1.* as defined in
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
237 RFC2252 section 4.3.2")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
238
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
239 (defvar ldap-attribute-syntax-decoders
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
240 [nil ; 1 ACI Item N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
241 nil ; 2 Access Point Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
242 nil ; 3 Attribute Type Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
243 nil ; 4 Audio N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
244 nil ; 5 Binary N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
245 nil ; 6 Bit String Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
246 ldap-decode-boolean ; 7 Boolean Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
247 nil ; 8 Certificate N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
248 nil ; 9 Certificate List N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
249 nil ; 10 Certificate Pair N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
250 ldap-decode-string ; 11 Country String Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
251 ldap-decode-string ; 12 DN Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
252 nil ; 13 Data Quality Syntax Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
253 nil ; 14 Delivery Method Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
254 ldap-decode-string ; 15 Directory String Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
255 nil ; 16 DIT Content Rule Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
256 nil ; 17 DIT Structure Rule Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
257 nil ; 18 DL Submit Permission Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
258 nil ; 19 DSA Quality Syntax Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
259 nil ; 20 DSE Type Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
260 nil ; 21 Enhanced Guide Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
261 nil ; 22 Facsimile Telephone Number Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
262 nil ; 23 Fax N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
263 nil ; 24 Generalized Time Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
264 nil ; 25 Guide Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
265 nil ; 26 IA5 String Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
266 string-to-number ; 27 INTEGER Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
267 nil ; 28 JPEG N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
268 nil ; 29 Master And Shadow Access Points Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
269 nil ; 30 Matching Rule Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
270 nil ; 31 Matching Rule Use Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
271 nil ; 32 Mail Preference Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
272 nil ; 33 MHS OR Address Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
273 nil ; 34 Name And Optional UID Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
274 nil ; 35 Name Form Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
275 nil ; 36 Numeric String Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
276 nil ; 37 Object Class Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
277 nil ; 38 OID Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
278 nil ; 39 Other Mailbox Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
279 nil ; 40 Octet String Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
280 ldap-decode-address ; 41 Postal Address Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
281 nil ; 42 Protocol Information Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
282 nil ; 43 Presentation Address Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
283 ldap-decode-string ; 44 Printable String Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
284 nil ; 45 Subtree Specification Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
285 nil ; 46 Supplier Information Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
286 nil ; 47 Supplier Or Consumer Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
287 nil ; 48 Supplier And Consumer Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
288 nil ; 49 Supported Algorithm N
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
289 nil ; 50 Telephone Number Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
290 nil ; 51 Teletex Terminal Identifier Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
291 nil ; 52 Telex Number Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
292 nil ; 53 UTC Time Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
293 nil ; 54 LDAP Syntax Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
294 nil ; 55 Modify Rights Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
295 nil ; 56 LDAP Schema Definition Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
296 nil ; 57 LDAP Schema Description Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
297 nil ; 58 Substring Assertion Y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
298 ]
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
299 "A vector of functions used to decode LDAP attribute values.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
300 The sequence of functions corresponds to the sequence of LDAP attribute syntax
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
301 object identifiers of the form 1.3.6.1.4.1.1466.1115.121.1.* as defined in
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
302 RFC2252 section 4.3.2")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
303
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
304
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
305 (defvar ldap-attribute-syntaxes-alist
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
306 '((createtimestamp . 24)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
307 (modifytimestamp . 24)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
308 (creatorsname . 12)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
309 (modifiersname . 12)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
310 (subschemasubentry . 12)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
311 (attributetypes . 3)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
312 (objectclasses . 37)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
313 (matchingrules . 30)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
314 (matchingruleuse . 31)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
315 (namingcontexts . 12)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
316 (altserver . 26)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
317 (supportedextension . 38)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
318 (supportedcontrol . 38)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
319 (supportedsaslmechanisms . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
320 (supportedldapversion . 27)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
321 (ldapsyntaxes . 16)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
322 (ditstructurerules . 17)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
323 (nameforms . 35)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
324 (ditcontentrules . 16)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
325 (objectclass . 38)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
326 (aliasedobjectname . 12)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
327 (cn . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
328 (sn . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
329 (serialnumber . 44)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
330 (c . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
331 (l . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
332 (st . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
333 (street . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
334 (o . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
335 (ou . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
336 (title . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
337 (description . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
338 (searchguide . 25)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
339 (businesscategory . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
340 (postaladdress . 41)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
341 (postalcode . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
342 (postofficebox . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
343 (physicaldeliveryofficename . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
344 (telephonenumber . 50)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
345 (telexnumber . 52)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
346 (telexterminalidentifier . 51)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
347 (facsimiletelephonenumber . 22)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
348 (x121address . 36)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
349 (internationalisdnnumber . 36)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
350 (registeredaddress . 41)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
351 (destinationindicator . 44)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
352 (preferreddeliverymethod . 14)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
353 (presentationaddress . 43)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
354 (supportedapplicationcontext . 38)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
355 (member . 12)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
356 (owner . 12)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
357 (roleoccupant . 12)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
358 (seealso . 12)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
359 (userpassword . 40)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
360 (usercertificate . 8)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
361 (cacertificate . 8)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
362 (authorityrevocationlist . 9)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
363 (certificaterevocationlist . 9)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
364 (crosscertificatepair . 10)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
365 (name . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
366 (givenname . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
367 (initials . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
368 (generationqualifier . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
369 (x500uniqueidentifier . 6)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
370 (dnqualifier . 44)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
371 (enhancedsearchguide . 21)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
372 (protocolinformation . 42)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
373 (distinguishedname . 12)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
374 (uniquemember . 34)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
375 (houseidentifier . 15)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
376 (supportedalgorithms . 49)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
377 (deltarevocationlist . 9)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
378 (dmdname . 15))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
379 "A map of LDAP attribute names to their type object id minor number.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
380 This table is built from RFC2252 Section 5 and RFC2256 Section 5")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
381
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
382
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
383 ;; Coding/decoding functions
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
384
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
385 (defun ldap-encode-boolean (bool)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
386 (if bool
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
387 "TRUE"
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
388 "FALSE"))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
389
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
390 (defun ldap-decode-boolean (str)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
391 (cond
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
392 ((string-equal str "TRUE")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
393 t)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
394 ((string-equal str "FALSE")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
395 nil)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
396 (t
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
397 (error "Wrong LDAP boolean string: %s" str))))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
399 (defun ldap-encode-country-string (str)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
400 ;; We should do something useful here...
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
401 (if (not (= 2 (length str)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
402 (error "Invalid country string: %s" str)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
403
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
404 (defun ldap-decode-string (str)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
405 (if (fboundp 'decode-coding-string)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
406 (decode-coding-string str ldap-coding-system)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
407
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
408 (defun ldap-encode-string (str)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
409 (if (fboundp 'encode-coding-string)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
410 (encode-coding-string str ldap-coding-system)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
411
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
412 (defun ldap-decode-address (str)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
413 (mapconcat 'ldap-decode-string
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
414 (split-string str "\\$")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
415 "\n"))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
416
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
417 (defun ldap-encode-address (str)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
418 (mapconcat 'ldap-encode-string
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
419 (split-string str "\n")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
420 "$"))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
421
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
422
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
423 ;; LDAP protocol functions
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
424
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
425 (defun ldap-get-host-parameter (host parameter)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
426 "Get the value of PARAMETER for HOST in `ldap-host-parameters-alist'."
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
427 (plist-get (cdr (assoc host ldap-host-parameters-alist))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
428 parameter))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
429
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
430 (defun ldap-decode-attribute (attr)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
431 "Decode the attribute/value pair ATTR according to LDAP rules.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
432 The attribute name is looked up in `ldap-attribute-syntaxes-alist'
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
433 and the corresponding decoder is then retrieved from
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
434 `ldap-attribute-syntax-decoders' and applied on the value(s)."
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
435 (let* ((name (car attr))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
436 (values (cdr attr))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
437 (syntax-id (cdr (assq (intern (downcase name))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
438 ldap-attribute-syntaxes-alist)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
439 decoder)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
440 (if syntax-id
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
441 (setq decoder (aref ldap-attribute-syntax-decoders
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
442 (1- syntax-id)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
443 (setq decoder ldap-default-attribute-decoder))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
444 (if decoder
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
445 (cons name (mapcar decoder values))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
446 attr)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
447
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
448 (defun ldap-search (arg1 &rest args)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
449 "Perform an LDAP search."
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
450 (apply (if (ldapp arg1)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
451 'ldap-search-basic
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
452 'ldap-search-entries) arg1 args))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
453
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
454 (make-obsolete 'ldap-search
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
455 "Use `ldap-search-entries' instead or
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
456 `ldap-search-basic' for the low-level search API.")
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
457
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
458 (defun ldap-search-entries (filter &optional host attributes attrsonly withdn)
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
459 "Perform an LDAP search.
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
460 FILTER is the search filter in RFC1558 syntax, i.e., something that
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
461 looks like \"(cn=John Smith)\".
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
462 HOST is the LDAP host on which to perform the search.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
463 ATTRIBUTES is a list of attributes to retrieve; nil means retrieve all.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
464 If ATTRSONLY is non nil, the attributes will be retrieved without
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
465 the associated values.
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
466 If WITHDN is non-nil each entry in the result will be prepennded with
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
467 its distinguished name DN.
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
468 Additional search parameters can be specified through
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
469 `ldap-host-parameters-alist' which see.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
470 The function returns a list of matching entries. Each entry is itself
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
471 an alist of attribute/value pairs optionally preceded by the DN of the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
472 entry according to the value of WITHDN."
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
473 (interactive "sFilter:")
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
474 (or host
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
475 (setq host ldap-default-host)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
476 (error "No LDAP host specified"))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 371
diff changeset
477 (let ((host-plist (cdr (assoc host ldap-host-parameters-alist)))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
478 ldap
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
479 result)
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
480 (if ldap-verbose
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
481 (message "Opening LDAP connection to %s..." host))
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
482 (setq ldap (ldap-open host host-plist))
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
483 (if ldap-verbose
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
484 (message "Searching with LDAP on %s..." host))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
485 (setq result (ldap-search ldap filter
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
486 (plist-get host-plist 'base)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
487 (plist-get host-plist 'scope)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
488 attributes attrsonly withdn
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
489 ldap-verbose))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
490 (ldap-close ldap)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
491 (if ldap-ignore-attribute-codings
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
492 result
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
493 (mapcar (function
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
494 (lambda (record)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
495 (mapcar 'ldap-decode-attribute record)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
496 result))))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
497
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
498 (defun ldap-add-entries (entries &optional host binddn passwd)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
499 "Add entries to an LDAP directory.
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
500 ENTRIES is a list of entry specifications of
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
501 the form (DN (ATTR . VALUE) (ATTR . VALUE) ...) where
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
502 DN is the distinguished name of an entry to add, the following
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
503 are cons cells containing attribute/value string pairs.
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
504 HOST is the LDAP host, defaulting to `ldap-default-host'
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
505 BINDDN is the DN to bind as to the server
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
506 PASSWD is the corresponding password"
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
507 (or host
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
508 (setq host ldap-default-host)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
509 (error "No LDAP host specified"))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
510 (let ((host-plist (cdr (assoc host ldap-host-parameters-alist)))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
511 ldap
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
512 (i 1))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
513 (if (or binddn passwd)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
514 (setq host-plist (copy-seq host-plist)))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
515 (if binddn
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
516 (setq host-plist (plist-put host-plist 'binddn binddn)))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
517 (if passwd
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
518 (setq host-plist (plist-put host-plist 'passwd passwd)))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
519 (if ldap-verbose
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
520 (message "Opening LDAP connection to %s..." host))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
521 (setq ldap (ldap-open host host-plist))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
522 (if ldap-verbose
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
523 (message "Adding LDAP entries..."))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
524 (mapcar (function
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
525 (lambda (thisentry)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
526 (ldap-add ldap (car thisentry) (cdr thisentry))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
527 (if ldap-verbose
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
528 (message "%d added" i))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
529 (setq i (1+ i))))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
530 entries)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
531 (ldap-close ldap)))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
532
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
533
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
534 (defun ldap-modify-entries (entry-mods &optional host binddn passwd)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
535 "Modify entries of an LDAP directory.
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
536 ENTRY_MODS is a list of entry modifications of the form
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
537 (DN MOD-SPEC1 MOD-SPEC2 ...) where DN is the distinguished name of
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
538 the entry to modify, the following are modification specifications.
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
539 A modification specification is itself a list of the form
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
540 (MOD-OP ATTR VALUE1 VALUE2 ...) MOD-OP and ATTR are mandatory,
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
541 VALUEs are optional depending on MOD-OP.
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
542 MOD-OP is the type of modification, one of the symbols `add', `delete'
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
543 or `replace'. ATTR is the LDAP attribute type to modify.
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
544 HOST is the LDAP host, defaulting to `ldap-default-host'
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
545 BINDDN is the DN to bind as to the server
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
546 PASSWD is the corresponding password"
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
547 (or host
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
548 (setq host ldap-default-host)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
549 (error "No LDAP host specified"))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
550 (let ((host-plist (cdr (assoc host ldap-host-parameters-alist)))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
551 ldap
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
552 (i 1))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
553 (if (or binddn passwd)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
554 (setq host-plist (copy-seq host-plist)))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
555 (if binddn
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
556 (setq host-plist (plist-put host-plist 'binddn binddn)))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
557 (if passwd
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
558 (setq host-plist (plist-put host-plist 'passwd passwd)))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
559 (if ldap-verbose
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
560 (message "Opening LDAP connection to %s..." host))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
561 (setq ldap (ldap-open host host-plist))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
562 (if ldap-verbose
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
563 (message "Modifying LDAP entries..."))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
564 (mapcar (function
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
565 (lambda (thisentry)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
566 (ldap-modify ldap (car thisentry) (cdr thisentry))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
567 (if ldap-verbose
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
568 (message "%d modified" i))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
569 (setq i (1+ i))))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
570 entry-mods)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
571 (ldap-close ldap)))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
572
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
573
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
574 (defun ldap-delete-entries (dn &optional host binddn passwd)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
575 "Delete an entry from an LDAP directory.
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
576 DN is the distinguished name of an entry to delete or
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
577 a list of those.
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
578 HOST is the LDAP host, defaulting to `ldap-default-host'
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
579 BINDDN is the DN to bind as to the server
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
580 PASSWD is the corresponding password."
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
581 (or host
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
582 (setq host ldap-default-host)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
583 (error "No LDAP host specified"))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
584 (let ((host-plist (cdr (assoc host ldap-host-parameters-alist)))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
585 ldap)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
586 (if (or binddn passwd)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
587 (setq host-plist (copy-seq host-plist)))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
588 (if binddn
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
589 (setq host-plist (plist-put host-plist 'binddn binddn)))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
590 (if passwd
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
591 (setq host-plist (plist-put host-plist 'passwd passwd)))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
592 (if ldap-verbose
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
593 (message "Opening LDAP connection to %s..." host))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
594 (setq ldap (ldap-open host host-plist))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
595 (if (consp dn)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
596 (let ((i 1))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
597 (if ldap-verbose
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
598 (message "Deleting LDAP entries..."))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
599 (mapcar (function
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
600 (lambda (thisdn)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
601 (ldap-delete ldap thisdn)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
602 (if ldap-verbose
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
603 (message "%d deleted" i))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
604 (setq i (1+ i))))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
605 dn))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
606 (if ldap-verbose
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
607 (message "Deleting LDAP entry..."))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
608 (ldap-delete ldap dn))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
609 (ldap-close ldap)))
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
610
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
611
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
612 (provide 'ldap)
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 361
diff changeset
613
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
614 ;;; ldap.el ends here