diff options
| author | Pavel Janík | 2002-01-04 07:18:10 +0000 |
|---|---|---|
| committer | Pavel Janík | 2002-01-04 07:18:10 +0000 |
| commit | c69b943f41240a0720f0bae6ff975555acf93e2f (patch) | |
| tree | 6bfe3f5f4f1bd65fd0c0834037a43d2afd3b735a | |
| parent | 2cce20c04d59166f9bc60d82daa385cc446ec08a (diff) | |
| download | emacs-c69b943f41240a0720f0bae6ff975555acf93e2f.tar.gz emacs-c69b943f41240a0720f0bae6ff975555acf93e2f.zip | |
(ldap-host-parameters-alist): Remove duplicated entry.
(ldap-ignore-attribute-codings): Change the default value to allow
encoding/decoding of attributes.
(ldap-coding-system): Use UTF-8 as the coding-system. Doc fix.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/net/ldap.el | 304 |
2 files changed, 156 insertions, 156 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 566edbe38c9..80fa54e42fc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2002-01-04 Pavel Jan,Bm(Bk <Pavel@Janik.cz> | ||
| 2 | |||
| 3 | * net/ldap.el (ldap-host-parameters-alist): Remove duplicated | ||
| 4 | entry. | ||
| 5 | (ldap-ignore-attribute-codings): Change the default value to allow | ||
| 6 | encoding/decoding of attributes. | ||
| 7 | (ldap-coding-system): Use UTF-8 as the coding-system. Doc fix. | ||
| 8 | |||
| 1 | 2002-01-03 Richard M. Stallman <rms@gnu.org> | 9 | 2002-01-03 Richard M. Stallman <rms@gnu.org> |
| 2 | 10 | ||
| 3 | * files.el (basic-save-buffer): Undo previous change. | 11 | * files.el (basic-save-buffer): Undo previous change. |
diff --git a/lisp/net/ldap.el b/lisp/net/ldap.el index ee8b3ba4577..4b16622d751 100644 --- a/lisp/net/ldap.el +++ b/lisp/net/ldap.el | |||
| @@ -27,8 +27,8 @@ | |||
| 27 | ;;; Commentary: | 27 | ;;; Commentary: |
| 28 | 28 | ||
| 29 | ;; This package provides basic functionality to perform searches on LDAP | 29 | ;; This package provides basic functionality to perform searches on LDAP |
| 30 | ;; servers. It requires a command line utility generally named | 30 | ;; servers. It requires a command line utility generally named |
| 31 | ;; `ldapsearch' to actually perform the searches. That program can be | 31 | ;; `ldapsearch' to actually perform the searches. That program can be |
| 32 | ;; found in all LDAP developer kits such as: | 32 | ;; found in all LDAP developer kits such as: |
| 33 | ;; - UM-LDAP 3.3 (http://www.umich.edu/~dirsvcs/ldap/) | 33 | ;; - UM-LDAP 3.3 (http://www.umich.edu/~dirsvcs/ldap/) |
| 34 | ;; - OpenLDAP (http://www.openldap.org/) | 34 | ;; - OpenLDAP (http://www.openldap.org/) |
| @@ -44,7 +44,7 @@ | |||
| 44 | 44 | ||
| 45 | (defcustom ldap-default-host nil | 45 | (defcustom ldap-default-host nil |
| 46 | "*Default LDAP server. | 46 | "*Default LDAP server. |
| 47 | A TCP port number can be appended to that name using a colon as | 47 | A TCP port number can be appended to that name using a colon as |
| 48 | a separator." | 48 | a separator." |
| 49 | :type '(choice (string :tag "Host name") | 49 | :type '(choice (string :tag "Host name") |
| 50 | (const :tag "Use library default" nil)) | 50 | (const :tag "Use library default" nil)) |
| @@ -71,13 +71,13 @@ Acme organization in the United States." | |||
| 71 | "*Alist of host-specific options for LDAP transactions. | 71 | "*Alist of host-specific options for LDAP transactions. |
| 72 | The format of each list element is (HOST PROP1 VAL1 PROP2 VAL2 ...). | 72 | The format of each list element is (HOST PROP1 VAL1 PROP2 VAL2 ...). |
| 73 | HOST is the hostname of an LDAP server(with an optional TCP port number | 73 | HOST is the hostname of an LDAP server(with an optional TCP port number |
| 74 | appended to it using a colon as a separator). | 74 | appended to it using a colon as a separator). |
| 75 | PROPn and VALn are property/value pairs describing parameters for the server. | 75 | PROPn and VALn are property/value pairs describing parameters for the server. |
| 76 | Valid properties include: | 76 | Valid properties include: |
| 77 | `binddn' is the distinguished name of the user to bind as | 77 | `binddn' is the distinguished name of the user to bind as |
| 78 | (in RFC 1779 syntax). | 78 | (in RFC 1779 syntax). |
| 79 | `passwd' is the password to use for simple authentication. | 79 | `passwd' is the password to use for simple authentication. |
| 80 | `auth' is the authentication method to use. | 80 | `auth' is the authentication method to use. |
| 81 | Possible values are: `simple', `krbv41' and `krbv42'. | 81 | Possible values are: `simple', `krbv41' and `krbv42'. |
| 82 | `base' is the base for the search as described in RFC 1779. | 82 | `base' is the base for the search as described in RFC 1779. |
| 83 | `scope' is one of the three symbols `subtree', `base' or `onelevel'. | 83 | `scope' is one of the three symbols `subtree', `base' or `onelevel'. |
| @@ -93,7 +93,7 @@ Valid properties include: | |||
| 93 | (checklist :inline t | 93 | (checklist :inline t |
| 94 | :greedy t | 94 | :greedy t |
| 95 | (list | 95 | (list |
| 96 | :tag "Search Base" | 96 | :tag "Search Base" |
| 97 | :inline t | 97 | :inline t |
| 98 | (const :tag "Search Base" base) | 98 | (const :tag "Search Base" base) |
| 99 | string) | 99 | string) |
| @@ -117,12 +117,7 @@ Valid properties include: | |||
| 117 | (const :menu-tag "Kerberos 4.1" :tag "Kerberos 4.1" krbv41) | 117 | (const :menu-tag "Kerberos 4.1" :tag "Kerberos 4.1" krbv41) |
| 118 | (const :menu-tag "Kerberos 4.2" :tag "Kerberos 4.2" krbv42))) | 118 | (const :menu-tag "Kerberos 4.2" :tag "Kerberos 4.2" krbv42))) |
| 119 | (list | 119 | (list |
| 120 | :tag "Search Base" | 120 | :tag "Search Scope" |
| 121 | :inline t | ||
| 122 | (const :tag "Search Base" base) | ||
| 123 | string) | ||
| 124 | (list | ||
| 125 | :tag "Search Scope" | ||
| 126 | :inline t | 121 | :inline t |
| 127 | (const :tag "Search Scope" scope) | 122 | (const :tag "Search Scope" scope) |
| 128 | (choice | 123 | (choice |
| @@ -161,13 +156,13 @@ Valid properties include: | |||
| 161 | "*A list of additional arguments to pass to `ldapsearch'. | 156 | "*A list of additional arguments to pass to `ldapsearch'. |
| 162 | It is recommended to use the `-T' switch with Netscape's | 157 | It is recommended to use the `-T' switch with Netscape's |
| 163 | implementation to avoid line wrapping. | 158 | implementation to avoid line wrapping. |
| 164 | The `-B' switch should be used to enable the retrieval of | 159 | The `-B' switch should be used to enable the retrieval of |
| 165 | binary values." | 160 | binary values." |
| 166 | :type '(repeat :tag "`ldapsearch' Arguments" | 161 | :type '(repeat :tag "`ldapsearch' Arguments" |
| 167 | (string :tag "Argument")) | 162 | (string :tag "Argument")) |
| 168 | :group 'ldap) | 163 | :group 'ldap) |
| 169 | 164 | ||
| 170 | (defcustom ldap-ignore-attribute-codings t | 165 | (defcustom ldap-ignore-attribute-codings nil |
| 171 | "*If non-nil, do not encode/decode LDAP attribute values." | 166 | "*If non-nil, do not encode/decode LDAP attribute values." |
| 172 | :type 'boolean | 167 | :type 'boolean |
| 173 | :group 'ldap) | 168 | :group 'ldap) |
| @@ -177,141 +172,140 @@ binary values." | |||
| 177 | :type 'symbol | 172 | :type 'symbol |
| 178 | :group 'ldap) | 173 | :group 'ldap) |
| 179 | 174 | ||
| 180 | (defcustom ldap-coding-system nil | 175 | (defcustom ldap-coding-system 'utf-8 |
| 181 | "*Coding system of LDAP string values. | 176 | "*Coding system of LDAP string values. |
| 182 | LDAP v3 specifies the coding system of strings to be UTF-8 but | 177 | LDAP v3 specifies the coding system of strings to be UTF-8." |
| 183 | Emacs still does not have reasonable support for that." | ||
| 184 | :type 'symbol | 178 | :type 'symbol |
| 185 | :group 'ldap) | 179 | :group 'ldap) |
| 186 | 180 | ||
| 187 | (defvar ldap-attribute-syntax-encoders | 181 | (defvar ldap-attribute-syntax-encoders |
| 188 | [nil ; 1 ACI Item N | 182 | [nil ; 1 ACI Item N |
| 189 | nil ; 2 Access Point Y | 183 | nil ; 2 Access Point Y |
| 190 | nil ; 3 Attribute Type Description Y | 184 | nil ; 3 Attribute Type Description Y |
| 191 | nil ; 4 Audio N | 185 | nil ; 4 Audio N |
| 192 | nil ; 5 Binary N | 186 | nil ; 5 Binary N |
| 193 | nil ; 6 Bit String Y | 187 | nil ; 6 Bit String Y |
| 194 | ldap-encode-boolean ; 7 Boolean Y | 188 | ldap-encode-boolean ; 7 Boolean Y |
| 195 | nil ; 8 Certificate N | 189 | nil ; 8 Certificate N |
| 196 | nil ; 9 Certificate List N | 190 | nil ; 9 Certificate List N |
| 197 | nil ; 10 Certificate Pair N | 191 | nil ; 10 Certificate Pair N |
| 198 | ldap-encode-country-string ; 11 Country String Y | 192 | ldap-encode-country-string ; 11 Country String Y |
| 199 | ldap-encode-string ; 12 DN Y | 193 | ldap-encode-string ; 12 DN Y |
| 200 | nil ; 13 Data Quality Syntax Y | 194 | nil ; 13 Data Quality Syntax Y |
| 201 | nil ; 14 Delivery Method Y | 195 | nil ; 14 Delivery Method Y |
| 202 | ldap-encode-string ; 15 Directory String Y | 196 | ldap-encode-string ; 15 Directory String Y |
| 203 | nil ; 16 DIT Content Rule Description Y | 197 | nil ; 16 DIT Content Rule Description Y |
| 204 | nil ; 17 DIT Structure Rule Description Y | 198 | nil ; 17 DIT Structure Rule Description Y |
| 205 | nil ; 18 DL Submit Permission Y | 199 | nil ; 18 DL Submit Permission Y |
| 206 | nil ; 19 DSA Quality Syntax Y | 200 | nil ; 19 DSA Quality Syntax Y |
| 207 | nil ; 20 DSE Type Y | 201 | nil ; 20 DSE Type Y |
| 208 | nil ; 21 Enhanced Guide Y | 202 | nil ; 21 Enhanced Guide Y |
| 209 | nil ; 22 Facsimile Telephone Number Y | 203 | nil ; 22 Facsimile Telephone Number Y |
| 210 | nil ; 23 Fax N | 204 | nil ; 23 Fax N |
| 211 | nil ; 24 Generalized Time Y | 205 | nil ; 24 Generalized Time Y |
| 212 | nil ; 25 Guide Y | 206 | nil ; 25 Guide Y |
| 213 | nil ; 26 IA5 String Y | 207 | nil ; 26 IA5 String Y |
| 214 | number-to-string ; 27 INTEGER Y | 208 | number-to-string ; 27 INTEGER Y |
| 215 | nil ; 28 JPEG N | 209 | nil ; 28 JPEG N |
| 216 | nil ; 29 Master And Shadow Access Points Y | 210 | nil ; 29 Master And Shadow Access Points Y |
| 217 | nil ; 30 Matching Rule Description Y | 211 | nil ; 30 Matching Rule Description Y |
| 218 | nil ; 31 Matching Rule Use Description Y | 212 | nil ; 31 Matching Rule Use Description Y |
| 219 | nil ; 32 Mail Preference Y | 213 | nil ; 32 Mail Preference Y |
| 220 | nil ; 33 MHS OR Address Y | 214 | nil ; 33 MHS OR Address Y |
| 221 | nil ; 34 Name And Optional UID Y | 215 | nil ; 34 Name And Optional UID Y |
| 222 | nil ; 35 Name Form Description Y | 216 | nil ; 35 Name Form Description Y |
| 223 | nil ; 36 Numeric String Y | 217 | nil ; 36 Numeric String Y |
| 224 | nil ; 37 Object Class Description Y | 218 | nil ; 37 Object Class Description Y |
| 225 | nil ; 38 OID Y | 219 | nil ; 38 OID Y |
| 226 | nil ; 39 Other Mailbox Y | 220 | nil ; 39 Other Mailbox Y |
| 227 | nil ; 40 Octet String Y | 221 | nil ; 40 Octet String Y |
| 228 | ldap-encode-address ; 41 Postal Address Y | 222 | ldap-encode-address ; 41 Postal Address Y |
| 229 | nil ; 42 Protocol Information Y | 223 | nil ; 42 Protocol Information Y |
| 230 | nil ; 43 Presentation Address Y | 224 | nil ; 43 Presentation Address Y |
| 231 | ldap-encode-string ; 44 Printable String Y | 225 | ldap-encode-string ; 44 Printable String Y |
| 232 | nil ; 45 Subtree Specification Y | 226 | nil ; 45 Subtree Specification Y |
| 233 | nil ; 46 Supplier Information Y | 227 | nil ; 46 Supplier Information Y |
| 234 | nil ; 47 Supplier Or Consumer Y | 228 | nil ; 47 Supplier Or Consumer Y |
| 235 | nil ; 48 Supplier And Consumer Y | 229 | nil ; 48 Supplier And Consumer Y |
| 236 | nil ; 49 Supported Algorithm N | 230 | nil ; 49 Supported Algorithm N |
| 237 | nil ; 50 Telephone Number Y | 231 | nil ; 50 Telephone Number Y |
| 238 | nil ; 51 Teletex Terminal Identifier Y | 232 | nil ; 51 Teletex Terminal Identifier Y |
| 239 | nil ; 52 Telex Number Y | 233 | nil ; 52 Telex Number Y |
| 240 | nil ; 53 UTC Time Y | 234 | nil ; 53 UTC Time Y |
| 241 | nil ; 54 LDAP Syntax Description Y | 235 | nil ; 54 LDAP Syntax Description Y |
| 242 | nil ; 55 Modify Rights Y | 236 | nil ; 55 Modify Rights Y |
| 243 | nil ; 56 LDAP Schema Definition Y | 237 | nil ; 56 LDAP Schema Definition Y |
| 244 | nil ; 57 LDAP Schema Description Y | 238 | nil ; 57 LDAP Schema Description Y |
| 245 | nil ; 58 Substring Assertion Y | 239 | nil ; 58 Substring Assertion Y |
| 246 | ] | 240 | ] |
| 247 | "A vector of functions used to encode LDAP attribute values. | 241 | "A vector of functions used to encode LDAP attribute values. |
| 248 | The sequence of functions corresponds to the sequence of LDAP attribute syntax | 242 | The sequence of functions corresponds to the sequence of LDAP attribute syntax |
| 249 | object identifiers of the form 1.3.6.1.4.1.1466.1115.121.1.* as defined in | 243 | object identifiers of the form 1.3.6.1.4.1.1466.1115.121.1.* as defined in |
| 250 | RFC2252 section 4.3.2") | 244 | RFC2252 section 4.3.2") |
| 251 | 245 | ||
| 252 | (defvar ldap-attribute-syntax-decoders | 246 | (defvar ldap-attribute-syntax-decoders |
| 253 | [nil ; 1 ACI Item N | 247 | [nil ; 1 ACI Item N |
| 254 | nil ; 2 Access Point Y | 248 | nil ; 2 Access Point Y |
| 255 | nil ; 3 Attribute Type Description Y | 249 | nil ; 3 Attribute Type Description Y |
| 256 | nil ; 4 Audio N | 250 | nil ; 4 Audio N |
| 257 | nil ; 5 Binary N | 251 | nil ; 5 Binary N |
| 258 | nil ; 6 Bit String Y | 252 | nil ; 6 Bit String Y |
| 259 | ldap-decode-boolean ; 7 Boolean Y | 253 | ldap-decode-boolean ; 7 Boolean Y |
| 260 | nil ; 8 Certificate N | 254 | nil ; 8 Certificate N |
| 261 | nil ; 9 Certificate List N | 255 | nil ; 9 Certificate List N |
| 262 | nil ; 10 Certificate Pair N | 256 | nil ; 10 Certificate Pair N |
| 263 | ldap-decode-string ; 11 Country String Y | 257 | ldap-decode-string ; 11 Country String Y |
| 264 | ldap-decode-string ; 12 DN Y | 258 | ldap-decode-string ; 12 DN Y |
| 265 | nil ; 13 Data Quality Syntax Y | 259 | nil ; 13 Data Quality Syntax Y |
| 266 | nil ; 14 Delivery Method Y | 260 | nil ; 14 Delivery Method Y |
| 267 | ldap-decode-string ; 15 Directory String Y | 261 | ldap-decode-string ; 15 Directory String Y |
| 268 | nil ; 16 DIT Content Rule Description Y | 262 | nil ; 16 DIT Content Rule Description Y |
| 269 | nil ; 17 DIT Structure Rule Description Y | 263 | nil ; 17 DIT Structure Rule Description Y |
| 270 | nil ; 18 DL Submit Permission Y | 264 | nil ; 18 DL Submit Permission Y |
| 271 | nil ; 19 DSA Quality Syntax Y | 265 | nil ; 19 DSA Quality Syntax Y |
| 272 | nil ; 20 DSE Type Y | 266 | nil ; 20 DSE Type Y |
| 273 | nil ; 21 Enhanced Guide Y | 267 | nil ; 21 Enhanced Guide Y |
| 274 | nil ; 22 Facsimile Telephone Number Y | 268 | nil ; 22 Facsimile Telephone Number Y |
| 275 | nil ; 23 Fax N | 269 | nil ; 23 Fax N |
| 276 | nil ; 24 Generalized Time Y | 270 | nil ; 24 Generalized Time Y |
| 277 | nil ; 25 Guide Y | 271 | nil ; 25 Guide Y |
| 278 | nil ; 26 IA5 String Y | 272 | nil ; 26 IA5 String Y |
| 279 | string-to-number ; 27 INTEGER Y | 273 | string-to-number ; 27 INTEGER Y |
| 280 | nil ; 28 JPEG N | 274 | nil ; 28 JPEG N |
| 281 | nil ; 29 Master And Shadow Access Points Y | 275 | nil ; 29 Master And Shadow Access Points Y |
| 282 | nil ; 30 Matching Rule Description Y | 276 | nil ; 30 Matching Rule Description Y |
| 283 | nil ; 31 Matching Rule Use Description Y | 277 | nil ; 31 Matching Rule Use Description Y |
| 284 | nil ; 32 Mail Preference Y | 278 | nil ; 32 Mail Preference Y |
| 285 | nil ; 33 MHS OR Address Y | 279 | nil ; 33 MHS OR Address Y |
| 286 | nil ; 34 Name And Optional UID Y | 280 | nil ; 34 Name And Optional UID Y |
| 287 | nil ; 35 Name Form Description Y | 281 | nil ; 35 Name Form Description Y |
| 288 | nil ; 36 Numeric String Y | 282 | nil ; 36 Numeric String Y |
| 289 | nil ; 37 Object Class Description Y | 283 | nil ; 37 Object Class Description Y |
| 290 | nil ; 38 OID Y | 284 | nil ; 38 OID Y |
| 291 | nil ; 39 Other Mailbox Y | 285 | nil ; 39 Other Mailbox Y |
| 292 | nil ; 40 Octet String Y | 286 | nil ; 40 Octet String Y |
| 293 | ldap-decode-address ; 41 Postal Address Y | 287 | ldap-decode-address ; 41 Postal Address Y |
| 294 | nil ; 42 Protocol Information Y | 288 | nil ; 42 Protocol Information Y |
| 295 | nil ; 43 Presentation Address Y | 289 | nil ; 43 Presentation Address Y |
| 296 | ldap-decode-string ; 44 Printable String Y | 290 | ldap-decode-string ; 44 Printable String Y |
| 297 | nil ; 45 Subtree Specification Y | 291 | nil ; 45 Subtree Specification Y |
| 298 | nil ; 46 Supplier Information Y | 292 | nil ; 46 Supplier Information Y |
| 299 | nil ; 47 Supplier Or Consumer Y | 293 | nil ; 47 Supplier Or Consumer Y |
| 300 | nil ; 48 Supplier And Consumer Y | 294 | nil ; 48 Supplier And Consumer Y |
| 301 | nil ; 49 Supported Algorithm N | 295 | nil ; 49 Supported Algorithm N |
| 302 | nil ; 50 Telephone Number Y | 296 | nil ; 50 Telephone Number Y |
| 303 | nil ; 51 Teletex Terminal Identifier Y | 297 | nil ; 51 Teletex Terminal Identifier Y |
| 304 | nil ; 52 Telex Number Y | 298 | nil ; 52 Telex Number Y |
| 305 | nil ; 53 UTC Time Y | 299 | nil ; 53 UTC Time Y |
| 306 | nil ; 54 LDAP Syntax Description Y | 300 | nil ; 54 LDAP Syntax Description Y |
| 307 | nil ; 55 Modify Rights Y | 301 | nil ; 55 Modify Rights Y |
| 308 | nil ; 56 LDAP Schema Definition Y | 302 | nil ; 56 LDAP Schema Definition Y |
| 309 | nil ; 57 LDAP Schema Description Y | 303 | nil ; 57 LDAP Schema Description Y |
| 310 | nil ; 58 Substring Assertion Y | 304 | nil ; 58 Substring Assertion Y |
| 311 | ] | 305 | ] |
| 312 | "A vector of functions used to decode LDAP attribute values. | 306 | "A vector of functions used to decode LDAP attribute values. |
| 313 | The sequence of functions corresponds to the sequence of LDAP attribute syntax | 307 | The sequence of functions corresponds to the sequence of LDAP attribute syntax |
| 314 | object identifiers of the form 1.3.6.1.4.1.1466.1115.121.1.* as defined in | 308 | object identifiers of the form 1.3.6.1.4.1.1466.1115.121.1.* as defined in |
| 315 | RFC2252 section 4.3.2") | 309 | RFC2252 section 4.3.2") |
| 316 | 310 | ||
| 317 | 311 | ||
| @@ -408,7 +402,7 @@ This table is built from RFC2252 Section 5 and RFC2256 Section 5") | |||
| 408 | nil) | 402 | nil) |
| 409 | (t | 403 | (t |
| 410 | (error "Wrong LDAP boolean string: %s" str)))) | 404 | (error "Wrong LDAP boolean string: %s" str)))) |
| 411 | 405 | ||
| 412 | (defun ldap-encode-country-string (str) | 406 | (defun ldap-encode-country-string (str) |
| 413 | ;; We should do something useful here... | 407 | ;; We should do something useful here... |
| 414 | (if (not (= 2 (length str))) | 408 | (if (not (= 2 (length str))) |
| @@ -432,16 +426,16 @@ This table is built from RFC2252 Section 5 and RFC2256 Section 5") | |||
| 432 | 426 | ||
| 433 | 427 | ||
| 434 | ;; LDAP protocol functions | 428 | ;; LDAP protocol functions |
| 435 | 429 | ||
| 436 | (defun ldap-get-host-parameter (host parameter) | 430 | (defun ldap-get-host-parameter (host parameter) |
| 437 | "Get the value of PARAMETER for HOST in `ldap-host-parameters-alist'." | 431 | "Get the value of PARAMETER for HOST in `ldap-host-parameters-alist'." |
| 438 | (plist-get (cdr (assoc host ldap-host-parameters-alist)) | 432 | (plist-get (cdr (assoc host ldap-host-parameters-alist)) |
| 439 | parameter)) | 433 | parameter)) |
| 440 | 434 | ||
| 441 | (defun ldap-decode-attribute (attr) | 435 | (defun ldap-decode-attribute (attr) |
| 442 | "Decode the attribute/value pair ATTR according to LDAP rules. | 436 | "Decode the attribute/value pair ATTR according to LDAP rules. |
| 443 | The attribute name is looked up in `ldap-attribute-syntaxes-alist' | 437 | The attribute name is looked up in `ldap-attribute-syntaxes-alist' |
| 444 | and the corresponding decoder is then retrieved from | 438 | and the corresponding decoder is then retrieved from |
| 445 | `ldap-attribute-syntax-decoders' and applied on the value(s)." | 439 | `ldap-attribute-syntax-decoders' and applied on the value(s)." |
| 446 | (let* ((name (car attr)) | 440 | (let* ((name (car attr)) |
| 447 | (values (cdr attr)) | 441 | (values (cdr attr)) |
| @@ -455,19 +449,18 @@ and the corresponding decoder is then retrieved from | |||
| 455 | (if decoder | 449 | (if decoder |
| 456 | (cons name (mapcar decoder values)) | 450 | (cons name (mapcar decoder values)) |
| 457 | attr))) | 451 | attr))) |
| 458 | |||
| 459 | 452 | ||
| 460 | (defun ldap-search (filter &optional host attributes attrsonly withdn) | 453 | (defun ldap-search (filter &optional host attributes attrsonly withdn) |
| 461 | "Perform an LDAP search. | 454 | "Perform an LDAP search. |
| 462 | FILTER is the search filter in RFC1558 syntax. | 455 | FILTER is the search filter in RFC1558 syntax. |
| 463 | HOST is the LDAP host on which to perform the search. | 456 | HOST is the LDAP host on which to perform the search. |
| 464 | ATTRIBUTES are the specific attributes to retrieve, nil means | 457 | ATTRIBUTES are the specific attributes to retrieve, nil means |
| 465 | retrieve all. | 458 | retrieve all. |
| 466 | ATTRSONLY, if non-nil, retrieves the attributes only, without | 459 | ATTRSONLY, if non-nil, retrieves the attributes only, without |
| 467 | the associated values. | 460 | the associated values. |
| 468 | If WITHDN is non-nil, each entry in the result will be prepended with | 461 | If WITHDN is non-nil, each entry in the result will be prepended with |
| 469 | its distinguished name WITHDN. | 462 | its distinguished name WITHDN. |
| 470 | Additional search parameters can be specified through | 463 | Additional search parameters can be specified through |
| 471 | `ldap-host-parameters-alist', which see." | 464 | `ldap-host-parameters-alist', which see." |
| 472 | (interactive "sFilter:") | 465 | (interactive "sFilter:") |
| 473 | (or host | 466 | (or host |
| @@ -478,7 +471,7 @@ Additional search parameters can be specified through | |||
| 478 | (setq result (ldap-search-internal (append host-plist | 471 | (setq result (ldap-search-internal (append host-plist |
| 479 | (list 'host host | 472 | (list 'host host |
| 480 | 'filter filter | 473 | 'filter filter |
| 481 | 'attributes attributes | 474 | 'attributes attributes |
| 482 | 'attrsonly attrsonly | 475 | 'attrsonly attrsonly |
| 483 | 'withdn withdn)))) | 476 | 'withdn withdn)))) |
| 484 | (if ldap-ignore-attribute-codings | 477 | (if ldap-ignore-attribute-codings |
| @@ -566,21 +559,21 @@ an alist of attribute/value pairs." | |||
| 566 | (eval `(call-process ldap-ldapsearch-prog | 559 | (eval `(call-process ldap-ldapsearch-prog |
| 567 | nil | 560 | nil |
| 568 | buf | 561 | buf |
| 569 | nil | 562 | nil |
| 570 | ,@arglist | 563 | ,@arglist |
| 571 | "-t" ; Write values to temp files | 564 | "-t" ; Write values to temp files |
| 572 | ,@ldap-ldapsearch-args | 565 | ,@ldap-ldapsearch-args |
| 573 | ,@filter)) | 566 | ,@filter)) |
| 574 | (insert "\n") | 567 | (insert "\n") |
| 575 | (goto-char (point-min)) | 568 | (goto-char (point-min)) |
| 576 | 569 | ||
| 577 | (if (looking-at "usage") | 570 | (if (looking-at "usage") |
| 578 | (error "Incorrect ldapsearch invocation") | 571 | (error "Incorrect ldapsearch invocation") |
| 579 | (message "Parsing results... ") | 572 | (message "Parsing results... ") |
| 580 | (while (progn | 573 | (while (progn |
| 581 | (skip-chars-forward " \t\n") | 574 | (skip-chars-forward " \t\n") |
| 582 | (not (eobp))) | 575 | (not (eobp))) |
| 583 | (setq dn (buffer-substring (point) (save-excursion | 576 | (setq dn (buffer-substring (point) (save-excursion |
| 584 | (end-of-line) | 577 | (end-of-line) |
| 585 | (point)))) | 578 | (point)))) |
| 586 | (forward-line 1) | 579 | (forward-line 1) |
| @@ -596,17 +589,16 @@ an alist of attribute/value pairs." | |||
| 596 | (setq record (cons (list name value) | 589 | (setq record (cons (list name value) |
| 597 | record)) | 590 | record)) |
| 598 | (forward-line 1)) | 591 | (forward-line 1)) |
| 599 | (setq result (cons (if withdn | 592 | (setq result (cons (if withdn |
| 600 | (cons dn (nreverse record)) | 593 | (cons dn (nreverse record)) |
| 601 | (nreverse record)) result)) | 594 | (nreverse record)) result)) |
| 602 | (setq record nil) | 595 | (setq record nil) |
| 603 | (skip-chars-forward " \t\n") | 596 | (skip-chars-forward " \t\n") |
| 604 | (message "Parsing results... %d" numres) | 597 | (message "Parsing results... %d" numres) |
| 605 | (1+ numres)) | 598 | (1+ numres)) |
| 606 | (message "Parsing results... done") | 599 | (message "Parsing results... done") |
| 607 | (nreverse result))))) | 600 | (nreverse result))))) |
| 608 | 601 | ||
| 609 | |||
| 610 | (provide 'ldap) | 602 | (provide 'ldap) |
| 611 | 603 | ||
| 612 | ;;; ldap.el ends here | 604 | ;;; ldap.el ends here |