annotate lisp/net/ldap.el @ 81291:7edf1ae10375

Merge from emacs--rel--22 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-790
author Miles Bader <miles@gnu.org>
date Sat, 09 Jun 2007 03:19:04 +0000
parents e3694f1cb928
children 84cf1e2214c5 95d0cdf160ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 33930
diff changeset
1 ;;; ldap.el --- client interface to LDAP for Emacs
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2
74509
f7702c5f335d Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 72752
diff changeset
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
75347
e3694f1cb928 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 74509
diff changeset
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5
42607
033986c328d5 New maintainer. New e-mail address of the author.
Pavel Janík <Pavel@Janik.cz>
parents: 42579
diff changeset
6 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
59941
654691f40a53 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 59935
diff changeset
7 ;; Maintainer: FSF
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8 ;; Created: April 1998
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9 ;; Keywords: comm
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16 ;; any later version.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21 ;; GNU General Public License for more details.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62437
diff changeset
25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62437
diff changeset
26 ;; Boston, MA 02110-1301, USA.
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28 ;;; Commentary:
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30 ;; This package provides basic functionality to perform searches on LDAP
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
31 ;; servers. It requires a command line utility generally named
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
32 ;; `ldapsearch' to actually perform the searches. That program can be
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33 ;; found in all LDAP developer kits such as:
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34 ;; - UM-LDAP 3.3 (http://www.umich.edu/~dirsvcs/ldap/)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35 ;; - OpenLDAP (http://www.openldap.org/)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37 ;;; Code:
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39 (require 'custom)
54805
37581abcf761 (ldap-search): Use list*.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54359
diff changeset
40 (eval-when-compile (require 'cl))
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
42 (defgroup ldap nil
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
43 "Lightweight Directory Access Protocol."
33930
283bc01938a1 (ldap) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 27313
diff changeset
44 :version "21.1"
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
45 :group 'comm)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47 (defcustom ldap-default-host nil
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
48 "*Default LDAP server.
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
49 A TCP port number can be appended to that name using a colon as
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 a separator."
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51 :type '(choice (string :tag "Host name")
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 (const :tag "Use library default" nil))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 :group 'ldap)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 (defcustom ldap-default-port nil
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56 "*Default TCP port for LDAP connections.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57 Initialized from the LDAP library at build time. Default value is 389."
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
58 :type '(choice (const :tag "Use library default" nil)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
59 (integer :tag "Port number"))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
60 :group 'ldap)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
62 (defcustom ldap-default-base nil
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63 "*Default base for LDAP searches.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 This is a string using the syntax of RFC 1779.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65 For instance, \"o=ACME, c=US\" limits the search to the
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66 Acme organization in the United States."
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67 :type '(choice (const :tag "Use library default" nil)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68 (string :tag "Search base"))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 :group 'ldap)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 (defcustom ldap-host-parameters-alist nil
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73 "*Alist of host-specific options for LDAP transactions.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 The format of each list element is (HOST PROP1 VAL1 PROP2 VAL2 ...).
42573
7e5a4351cc3c Fix typo.
Pavel Janík <Pavel@Janik.cz>
parents: 42551
diff changeset
75 HOST is the hostname of an LDAP server (with an optional TCP port number
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
76 appended to it using a colon as a separator).
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 PROPn and VALn are property/value pairs describing parameters for the server.
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
78 Valid properties include:
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
79 `binddn' is the distinguished name of the user to bind as
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80 (in RFC 1779 syntax).
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81 `passwd' is the password to use for simple authentication.
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
82 `auth' is the authentication method to use.
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 Possible values are: `simple', `krbv41' and `krbv42'.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84 `base' is the base for the search as described in RFC 1779.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 `scope' is one of the three symbols `subtree', `base' or `onelevel'.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86 `deref' is one of the symbols `never', `always', `search' or `find'.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87 `timelimit' is the timeout limit for the connection in seconds.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
88 `sizelimit' is the maximum number of matches to return."
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89 :type '(repeat :menu-tag "Host parameters"
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 :tag "Host parameters"
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91 (list :menu-tag "Host parameters"
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
92 :tag "Host parameters"
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93 :value nil
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
94 (string :tag "Host name")
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
95 (checklist :inline t
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96 :greedy t
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
97 (list
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
98 :tag "Search Base"
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 :inline t
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 (const :tag "Search Base" base)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101 string)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102 (list
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 :tag "Binding DN"
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104 :inline t
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 (const :tag "Binding DN" binddn)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
106 string)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
107 (list
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
108 :tag "Password"
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109 :inline t
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
110 (const :tag "Password" passwd)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 string)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112 (list
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 :tag "Authentication Method"
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114 :inline t
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
115 (const :tag "Authentication Method" auth)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
116 (choice
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
117 (const :menu-tag "None" :tag "None" nil)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
118 (const :menu-tag "Simple" :tag "Simple" simple)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
119 (const :menu-tag "Kerberos 4.1" :tag "Kerberos 4.1" krbv41)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
120 (const :menu-tag "Kerberos 4.2" :tag "Kerberos 4.2" krbv42)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
121 (list
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
122 :tag "Search Scope"
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123 :inline t
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
124 (const :tag "Search Scope" scope)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
125 (choice
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
126 (const :menu-tag "Default" :tag "Default" nil)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 (const :menu-tag "Subtree" :tag "Subtree" subtree)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
128 (const :menu-tag "Base" :tag "Base" base)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
129 (const :menu-tag "One Level" :tag "One Level" onelevel)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
130 (list
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
131 :tag "Dereferencing"
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
132 :inline t
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 (const :tag "Dereferencing" deref)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
134 (choice
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
135 (const :menu-tag "Default" :tag "Default" nil)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
136 (const :menu-tag "Never" :tag "Never" never)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
137 (const :menu-tag "Always" :tag "Always" always)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
138 (const :menu-tag "When searching" :tag "When searching" search)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
139 (const :menu-tag "When locating base" :tag "When locating base" find)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
140 (list
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
141 :tag "Time Limit"
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
142 :inline t
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
143 (const :tag "Time Limit" timelimit)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
144 (integer :tag "(in seconds)"))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
145 (list
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
146 :tag "Size Limit"
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
147 :inline t
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
148 (const :tag "Size Limit" sizelimit)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
149 (integer :tag "(number of records)")))))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
150 :group 'ldap)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
151
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
152 (defcustom ldap-ldapsearch-prog "ldapsearch"
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
153 "*The name of the ldapsearch command line program."
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
154 :type '(string :tag "`ldapsearch' Program")
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
155 :group 'ldap)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
156
71331
f4495654b2ad 2006-06-13 Martin J. Reed <mjreed@essex.ac.uk> (tiny change)
Chong Yidong <cyd@stupidchicken.com>
parents: 68648
diff changeset
157 (defcustom ldap-ldapsearch-args '("-LL" "-tt")
42783
c1bb3d3c9621 (ldap-ldapsearch-prog): Default to OpenLDAP version 2 ldapsearch.
Pavel Janík <Pavel@Janik.cz>
parents: 42607
diff changeset
158 "*A list of additional arguments to pass to `ldapsearch'."
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
159 :type '(repeat :tag "`ldapsearch' Arguments"
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
160 (string :tag "Argument"))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
161 :group 'ldap)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
162
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
163 (defcustom ldap-ignore-attribute-codings nil
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
164 "*If non-nil, do not encode/decode LDAP attribute values."
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
165 :type 'boolean
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
166 :group 'ldap)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
167
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
168 (defcustom ldap-default-attribute-decoder nil
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
169 "*Decoder function to use for attributes whose syntax is unknown."
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
170 :type 'symbol
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
171 :group 'ldap)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
172
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
173 (defcustom ldap-coding-system 'utf-8
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
174 "*Coding system of LDAP string values.
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
175 LDAP v3 specifies the coding system of strings to be UTF-8."
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
176 :type 'symbol
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
177 :group 'ldap)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
178
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
179 (defvar ldap-attribute-syntax-encoders
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
180 [nil ; 1 ACI Item N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
181 nil ; 2 Access Point Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
182 nil ; 3 Attribute Type Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
183 nil ; 4 Audio N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
184 nil ; 5 Binary N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
185 nil ; 6 Bit String Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
186 ldap-encode-boolean ; 7 Boolean Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
187 nil ; 8 Certificate N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
188 nil ; 9 Certificate List N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
189 nil ; 10 Certificate Pair N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
190 ldap-encode-country-string ; 11 Country String Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
191 ldap-encode-string ; 12 DN Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
192 nil ; 13 Data Quality Syntax Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
193 nil ; 14 Delivery Method Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
194 ldap-encode-string ; 15 Directory String Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
195 nil ; 16 DIT Content Rule Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
196 nil ; 17 DIT Structure Rule Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
197 nil ; 18 DL Submit Permission Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
198 nil ; 19 DSA Quality Syntax Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
199 nil ; 20 DSE Type Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
200 nil ; 21 Enhanced Guide Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
201 nil ; 22 Facsimile Telephone Number Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
202 nil ; 23 Fax N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
203 nil ; 24 Generalized Time Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
204 nil ; 25 Guide Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
205 nil ; 26 IA5 String Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
206 number-to-string ; 27 INTEGER Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
207 nil ; 28 JPEG N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
208 nil ; 29 Master And Shadow Access Points Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
209 nil ; 30 Matching Rule Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
210 nil ; 31 Matching Rule Use Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
211 nil ; 32 Mail Preference Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
212 nil ; 33 MHS OR Address Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
213 nil ; 34 Name And Optional UID Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
214 nil ; 35 Name Form Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
215 nil ; 36 Numeric String Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
216 nil ; 37 Object Class Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
217 nil ; 38 OID Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
218 nil ; 39 Other Mailbox Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
219 nil ; 40 Octet String Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
220 ldap-encode-address ; 41 Postal Address Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
221 nil ; 42 Protocol Information Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
222 nil ; 43 Presentation Address Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
223 ldap-encode-string ; 44 Printable String Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
224 nil ; 45 Subtree Specification Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
225 nil ; 46 Supplier Information Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
226 nil ; 47 Supplier Or Consumer Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
227 nil ; 48 Supplier And Consumer Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
228 nil ; 49 Supported Algorithm N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
229 nil ; 50 Telephone Number Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
230 nil ; 51 Teletex Terminal Identifier Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
231 nil ; 52 Telex Number Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
232 nil ; 53 UTC Time Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
233 nil ; 54 LDAP Syntax Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
234 nil ; 55 Modify Rights Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
235 nil ; 56 LDAP Schema Definition Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
236 nil ; 57 LDAP Schema Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
237 nil ; 58 Substring Assertion Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
238 ]
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
239 "A vector of functions used to encode LDAP attribute values.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
240 The sequence of functions corresponds to the sequence of LDAP attribute syntax
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
241 object identifiers of the form 1.3.6.1.4.1.1466.1115.121.1.* as defined in
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
242 RFC2252 section 4.3.2")
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
243
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
244 (defvar ldap-attribute-syntax-decoders
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
245 [nil ; 1 ACI Item N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
246 nil ; 2 Access Point Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
247 nil ; 3 Attribute Type Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
248 nil ; 4 Audio N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
249 nil ; 5 Binary N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
250 nil ; 6 Bit String Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
251 ldap-decode-boolean ; 7 Boolean Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
252 nil ; 8 Certificate N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
253 nil ; 9 Certificate List N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
254 nil ; 10 Certificate Pair N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
255 ldap-decode-string ; 11 Country String Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
256 ldap-decode-string ; 12 DN Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
257 nil ; 13 Data Quality Syntax Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
258 nil ; 14 Delivery Method Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
259 ldap-decode-string ; 15 Directory String Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
260 nil ; 16 DIT Content Rule Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
261 nil ; 17 DIT Structure Rule Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
262 nil ; 18 DL Submit Permission Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
263 nil ; 19 DSA Quality Syntax Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
264 nil ; 20 DSE Type Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
265 nil ; 21 Enhanced Guide Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
266 nil ; 22 Facsimile Telephone Number Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
267 nil ; 23 Fax N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
268 nil ; 24 Generalized Time Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
269 nil ; 25 Guide Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
270 nil ; 26 IA5 String Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
271 string-to-number ; 27 INTEGER Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
272 nil ; 28 JPEG N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
273 nil ; 29 Master And Shadow Access Points Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
274 nil ; 30 Matching Rule Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
275 nil ; 31 Matching Rule Use Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
276 nil ; 32 Mail Preference Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
277 nil ; 33 MHS OR Address Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
278 nil ; 34 Name And Optional UID Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
279 nil ; 35 Name Form Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
280 nil ; 36 Numeric String Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
281 nil ; 37 Object Class Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
282 nil ; 38 OID Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
283 nil ; 39 Other Mailbox Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
284 nil ; 40 Octet String Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
285 ldap-decode-address ; 41 Postal Address Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
286 nil ; 42 Protocol Information Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
287 nil ; 43 Presentation Address Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
288 ldap-decode-string ; 44 Printable String Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
289 nil ; 45 Subtree Specification Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
290 nil ; 46 Supplier Information Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
291 nil ; 47 Supplier Or Consumer Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
292 nil ; 48 Supplier And Consumer Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
293 nil ; 49 Supported Algorithm N
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
294 nil ; 50 Telephone Number Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
295 nil ; 51 Teletex Terminal Identifier Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
296 nil ; 52 Telex Number Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
297 nil ; 53 UTC Time Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
298 nil ; 54 LDAP Syntax Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
299 nil ; 55 Modify Rights Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
300 nil ; 56 LDAP Schema Definition Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
301 nil ; 57 LDAP Schema Description Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
302 nil ; 58 Substring Assertion Y
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
303 ]
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
304 "A vector of functions used to decode LDAP attribute values.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
305 The sequence of functions corresponds to the sequence of LDAP attribute syntax
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
306 object identifiers of the form 1.3.6.1.4.1.1466.1115.121.1.* as defined in
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
307 RFC2252 section 4.3.2")
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
308
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
309
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
310 (defvar ldap-attribute-syntaxes-alist
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
311 '((createtimestamp . 24)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
312 (modifytimestamp . 24)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
313 (creatorsname . 12)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
314 (modifiersname . 12)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
315 (subschemasubentry . 12)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
316 (attributetypes . 3)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
317 (objectclasses . 37)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
318 (matchingrules . 30)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
319 (matchingruleuse . 31)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
320 (namingcontexts . 12)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
321 (altserver . 26)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
322 (supportedextension . 38)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
323 (supportedcontrol . 38)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
324 (supportedsaslmechanisms . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
325 (supportedldapversion . 27)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
326 (ldapsyntaxes . 16)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
327 (ditstructurerules . 17)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
328 (nameforms . 35)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
329 (ditcontentrules . 16)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
330 (objectclass . 38)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
331 (aliasedobjectname . 12)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
332 (cn . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
333 (sn . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
334 (serialnumber . 44)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
335 (c . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
336 (l . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
337 (st . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
338 (street . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
339 (o . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
340 (ou . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
341 (title . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
342 (description . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
343 (searchguide . 25)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
344 (businesscategory . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
345 (postaladdress . 41)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
346 (postalcode . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
347 (postofficebox . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
348 (physicaldeliveryofficename . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
349 (telephonenumber . 50)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
350 (telexnumber . 52)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
351 (telexterminalidentifier . 51)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
352 (facsimiletelephonenumber . 22)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
353 (x121address . 36)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
354 (internationalisdnnumber . 36)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
355 (registeredaddress . 41)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
356 (destinationindicator . 44)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
357 (preferreddeliverymethod . 14)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
358 (presentationaddress . 43)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
359 (supportedapplicationcontext . 38)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
360 (member . 12)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
361 (owner . 12)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
362 (roleoccupant . 12)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
363 (seealso . 12)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
364 (userpassword . 40)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
365 (usercertificate . 8)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
366 (cacertificate . 8)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
367 (authorityrevocationlist . 9)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
368 (certificaterevocationlist . 9)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
369 (crosscertificatepair . 10)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
370 (name . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
371 (givenname . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
372 (initials . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
373 (generationqualifier . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
374 (x500uniqueidentifier . 6)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
375 (dnqualifier . 44)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
376 (enhancedsearchguide . 21)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
377 (protocolinformation . 42)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
378 (distinguishedname . 12)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
379 (uniquemember . 34)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
380 (houseidentifier . 15)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
381 (supportedalgorithms . 49)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
382 (deltarevocationlist . 9)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
383 (dmdname . 15))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
384 "A map of LDAP attribute names to their type object id minor number.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
385 This table is built from RFC2252 Section 5 and RFC2256 Section 5")
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
386
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
387
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
388 ;; Coding/decoding functions
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
389
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
390 (defun ldap-encode-boolean (bool)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
391 (if bool
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
392 "TRUE"
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
393 "FALSE"))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
394
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
395 (defun ldap-decode-boolean (str)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
396 (cond
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
397 ((string-equal str "TRUE")
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
398 t)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
399 ((string-equal str "FALSE")
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
400 nil)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
401 (t
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
402 (error "Wrong LDAP boolean string: %s" str))))
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
403
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
404 (defun ldap-encode-country-string (str)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
405 ;; We should do something useful here...
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
406 (if (not (= 2 (length str)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
407 (error "Invalid country string: %s" str)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
408
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
409 (defun ldap-decode-string (str)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
410 (decode-coding-string str ldap-coding-system))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
411
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
412 (defun ldap-encode-string (str)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
413 (encode-coding-string str ldap-coding-system))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
414
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
415 (defun ldap-decode-address (str)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
416 (mapconcat 'ldap-decode-string
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
417 (split-string str "\\$")
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
418 "\n"))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
419
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
420 (defun ldap-encode-address (str)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
421 (mapconcat 'ldap-encode-string
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
422 (split-string str "\n")
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
423 "$"))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
424
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
425
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
426 ;; LDAP protocol functions
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
427
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
428 (defun ldap-get-host-parameter (host parameter)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
429 "Get the value of PARAMETER for HOST in `ldap-host-parameters-alist'."
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
430 (plist-get (cdr (assoc host ldap-host-parameters-alist))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
431 parameter))
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
432
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
433 (defun ldap-decode-attribute (attr)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
434 "Decode the attribute/value pair ATTR according to LDAP rules.
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
435 The attribute name is looked up in `ldap-attribute-syntaxes-alist'
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
436 and the corresponding decoder is then retrieved from
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
437 `ldap-attribute-syntax-decoders' and applied on the value(s)."
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
438 (let* ((name (car attr))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
439 (values (cdr attr))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
440 (syntax-id (cdr (assq (intern (downcase name))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
441 ldap-attribute-syntaxes-alist)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
442 decoder)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
443 (if syntax-id
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
444 (setq decoder (aref ldap-attribute-syntax-decoders
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
445 (1- syntax-id)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
446 (setq decoder ldap-default-attribute-decoder))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
447 (if decoder
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
448 (cons name (mapcar decoder values))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
449 attr)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
450
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
451 (defun ldap-search (filter &optional host attributes attrsonly withdn)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
452 "Perform an LDAP search.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
453 FILTER is the search filter in RFC1558 syntax.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
454 HOST is the LDAP host on which to perform the search.
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
455 ATTRIBUTES are the specific attributes to retrieve, nil means
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
456 retrieve all.
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
457 ATTRSONLY, if non-nil, retrieves the attributes only, without
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
458 the associated values.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
459 If WITHDN is non-nil, each entry in the result will be prepended with
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
460 its distinguished name WITHDN.
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
461 Additional search parameters can be specified through
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
462 `ldap-host-parameters-alist', which see."
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
463 (interactive "sFilter:")
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
464 (or host
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
465 (setq host ldap-default-host)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
466 (error "No LDAP host specified"))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
467 (let ((host-plist (cdr (assoc host ldap-host-parameters-alist)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
468 result)
54805
37581abcf761 (ldap-search): Use list*.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54359
diff changeset
469 (setq result (ldap-search-internal (list* 'host host
37581abcf761 (ldap-search): Use list*.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54359
diff changeset
470 'filter filter
37581abcf761 (ldap-search): Use list*.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54359
diff changeset
471 'attributes attributes
37581abcf761 (ldap-search): Use list*.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54359
diff changeset
472 'attrsonly attrsonly
37581abcf761 (ldap-search): Use list*.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54359
diff changeset
473 'withdn withdn
37581abcf761 (ldap-search): Use list*.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54359
diff changeset
474 host-plist)))
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
475 (if ldap-ignore-attribute-codings
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
476 result
54805
37581abcf761 (ldap-search): Use list*.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54359
diff changeset
477 (mapcar (lambda (record)
37581abcf761 (ldap-search): Use list*.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54359
diff changeset
478 (mapcar 'ldap-decode-attribute record))
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
479 result))))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
480
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
481
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
482 (defun ldap-search-internal (search-plist)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
483 "Perform a search on a LDAP server.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
484 SEARCH-PLIST is a property list describing the search request.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
485 Valid keys in that list are:
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
486 `host' is a string naming one or more (blank-separated) LDAP servers to
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
487 to try to connect to. Each host name may optionally be of the form HOST:PORT.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
488 `filter' is a filter string for the search as described in RFC 1558.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
489 `attributes' is a list of strings indicating which attributes to retrieve
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
490 for each matching entry. If nil, return all available attributes.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
491 `attrsonly', if non-nil, indicates that only attributes are retrieved,
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
492 not their associated values.
72701
891321627212 * net/ldap.el (ldap-search-internal): Handle `auth' key.
Chong Yidong <cyd@stupidchicken.com>
parents: 71331
diff changeset
493 `auth' is one of the symbols `simple', `krbv41' or `krbv42'.
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
494 `base' is the base for the search as described in RFC 1779.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
495 `scope' is one of the three symbols `sub', `base' or `one'.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
496 `binddn' is the distinguished name of the user to bind as (in RFC 1779 syntax).
72752
f9449f64d4b8 (ldap-search-internal): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 72701
diff changeset
497 `auth' is one of the symbols `simple', `krbv41' or `krbv42'
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
498 `passwd' is the password to use for simple authentication.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
499 `deref' is one of the symbols `never', `always', `search' or `find'.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
500 `timelimit' is the timeout limit for the connection in seconds.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
501 `sizelimit' is the maximum number of matches to return.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
502 `withdn' if non-nil each entry in the result will be prepended with
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
503 its distinguished name DN.
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
504 The function returns a list of matching entries. Each entry is itself
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
505 an alist of attribute/value pairs."
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
506 (let ((buf (get-buffer-create " *ldap-search*"))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
507 (bufval (get-buffer-create " *ldap-value*"))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
508 (host (or (plist-get search-plist 'host)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
509 ldap-default-host))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
510 (filter (plist-get search-plist 'filter))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
511 (attributes (plist-get search-plist 'attributes))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
512 (attrsonly (plist-get search-plist 'attrsonly))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
513 (base (or (plist-get search-plist 'base)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
514 ldap-default-base))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
515 (scope (plist-get search-plist 'scope))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
516 (binddn (plist-get search-plist 'binddn))
72701
891321627212 * net/ldap.el (ldap-search-internal): Handle `auth' key.
Chong Yidong <cyd@stupidchicken.com>
parents: 71331
diff changeset
517 (auth (plist-get search-plist 'auth))
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
518 (passwd (plist-get search-plist 'passwd))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
519 (deref (plist-get search-plist 'deref))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
520 (timelimit (plist-get search-plist 'timelimit))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
521 (sizelimit (plist-get search-plist 'sizelimit))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
522 (withdn (plist-get search-plist 'withdn))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
523 (numres 0)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
524 arglist dn name value record result)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
525 (if (or (null filter)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
526 (equal "" filter))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
527 (error "No search filter"))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
528 (setq filter (cons filter attributes))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
529 (save-excursion
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
530 (set-buffer buf)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
531 (erase-buffer)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
532 (if (and host
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
533 (not (equal "" host)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
534 (setq arglist (nconc arglist (list (format "-h%s" host)))))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
535 (if (and attrsonly
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
536 (not (equal "" attrsonly)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
537 (setq arglist (nconc arglist (list "-A"))))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
538 (if (and base
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
539 (not (equal "" base)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
540 (setq arglist (nconc arglist (list (format "-b%s" base)))))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
541 (if (and scope
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
542 (not (equal "" scope)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
543 (setq arglist (nconc arglist (list (format "-s%s" scope)))))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
544 (if (and binddn
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
545 (not (equal "" binddn)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
546 (setq arglist (nconc arglist (list (format "-D%s" binddn)))))
72701
891321627212 * net/ldap.el (ldap-search-internal): Handle `auth' key.
Chong Yidong <cyd@stupidchicken.com>
parents: 71331
diff changeset
547 (if (and auth
891321627212 * net/ldap.el (ldap-search-internal): Handle `auth' key.
Chong Yidong <cyd@stupidchicken.com>
parents: 71331
diff changeset
548 (equal 'simple auth))
891321627212 * net/ldap.el (ldap-search-internal): Handle `auth' key.
Chong Yidong <cyd@stupidchicken.com>
parents: 71331
diff changeset
549 (setq arglist (nconc arglist (list "-x"))))
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
550 (if (and passwd
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
551 (not (equal "" passwd)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
552 (setq arglist (nconc arglist (list (format "-w%s" passwd)))))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
553 (if (and deref
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
554 (not (equal "" deref)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
555 (setq arglist (nconc arglist (list (format "-a%s" deref)))))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
556 (if (and timelimit
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
557 (not (equal "" timelimit)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
558 (setq arglist (nconc arglist (list (format "-l%s" timelimit)))))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
559 (if (and sizelimit
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
560 (not (equal "" sizelimit)))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
561 (setq arglist (nconc arglist (list (format "-z%s" sizelimit)))))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
562 (eval `(call-process ldap-ldapsearch-prog
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
563 nil
71331
f4495654b2ad 2006-06-13 Martin J. Reed <mjreed@essex.ac.uk> (tiny change)
Chong Yidong <cyd@stupidchicken.com>
parents: 68648
diff changeset
564 buf
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
565 nil
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
566 ,@arglist
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
567 ,@ldap-ldapsearch-args
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
568 ,@filter))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
569 (insert "\n")
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
570 (goto-char (point-min))
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
571
45247
6baa96917e56 (ldap-search-internal): Unfold folded lines before parsing.
Pavel Janík <Pavel@Janik.cz>
parents: 42783
diff changeset
572 (while (re-search-forward "[\t\n\f]+ " nil t)
6baa96917e56 (ldap-search-internal): Unfold folded lines before parsing.
Pavel Janík <Pavel@Janik.cz>
parents: 42783
diff changeset
573 (replace-match "" nil nil))
6baa96917e56 (ldap-search-internal): Unfold folded lines before parsing.
Pavel Janík <Pavel@Janik.cz>
parents: 42783
diff changeset
574 (goto-char (point-min))
6baa96917e56 (ldap-search-internal): Unfold folded lines before parsing.
Pavel Janík <Pavel@Janik.cz>
parents: 42783
diff changeset
575
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
576 (if (looking-at "usage")
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
577 (error "Incorrect ldapsearch invocation")
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
578 (message "Parsing results... ")
42579
c914fba3811b (ldap-search-internal): Skip error message from ldapsearch. Allow listing
Pavel Janík <Pavel@Janik.cz>
parents: 42573
diff changeset
579 ;; Skip error message when retrieving attribute list
c914fba3811b (ldap-search-internal): Skip error message from ldapsearch. Allow listing
Pavel Janík <Pavel@Janik.cz>
parents: 42573
diff changeset
580 (if (looking-at "Size limit exceeded")
c914fba3811b (ldap-search-internal): Skip error message from ldapsearch. Allow listing
Pavel Janík <Pavel@Janik.cz>
parents: 42573
diff changeset
581 (forward-line 1))
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
582 (while (progn
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
583 (skip-chars-forward " \t\n")
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
584 (not (eobp)))
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
585 (setq dn (buffer-substring (point) (save-excursion
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
586 (end-of-line)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
587 (point))))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
588 (forward-line 1)
71331
f4495654b2ad 2006-06-13 Martin J. Reed <mjreed@essex.ac.uk> (tiny change)
Chong Yidong <cyd@stupidchicken.com>
parents: 68648
diff changeset
589 (while (looking-at "^\\(\\w*\\)\\(;\\w*\\)?[=:\t ]+\\(<[\t ]*file://\\)\\(.*\\)$")
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
590 (setq name (match-string 1)
59935
ccb26cb917af (ldap-search-internal): Support attributes with
Eli Zaretskii <eliz@gnu.org>
parents: 55698
diff changeset
591 value (match-string 4))
54359
e63d620f8988 (ldap-search-internal): Handle file URLs with drive
Jason Rumney <jasonr@gnu.org>
parents: 52401
diff changeset
592 ;; Need to handle file:///D:/... as generated by OpenLDAP
e63d620f8988 (ldap-search-internal): Handle file URLs with drive
Jason Rumney <jasonr@gnu.org>
parents: 52401
diff changeset
593 ;; on DOS/Windows as local files.
e63d620f8988 (ldap-search-internal): Handle file URLs with drive
Jason Rumney <jasonr@gnu.org>
parents: 52401
diff changeset
594 (if (and (memq system-type '(windows-nt ms-dos))
e63d620f8988 (ldap-search-internal): Handle file URLs with drive
Jason Rumney <jasonr@gnu.org>
parents: 52401
diff changeset
595 (eq (string-match "/\\(.:.*\\)$" value) 0))
e63d620f8988 (ldap-search-internal): Handle file URLs with drive
Jason Rumney <jasonr@gnu.org>
parents: 52401
diff changeset
596 (setq value (match-string 1 value)))
42579
c914fba3811b (ldap-search-internal): Skip error message from ldapsearch. Allow listing
Pavel Janík <Pavel@Janik.cz>
parents: 42573
diff changeset
597 ;; Do not try to open non-existent files
c914fba3811b (ldap-search-internal): Skip error message from ldapsearch. Allow listing
Pavel Janík <Pavel@Janik.cz>
parents: 42573
diff changeset
598 (if (equal value "")
c914fba3811b (ldap-search-internal): Skip error message from ldapsearch. Allow listing
Pavel Janík <Pavel@Janik.cz>
parents: 42573
diff changeset
599 (setq value " ")
c914fba3811b (ldap-search-internal): Skip error message from ldapsearch. Allow listing
Pavel Janík <Pavel@Janik.cz>
parents: 42573
diff changeset
600 (save-excursion
c914fba3811b (ldap-search-internal): Skip error message from ldapsearch. Allow listing
Pavel Janík <Pavel@Janik.cz>
parents: 42573
diff changeset
601 (set-buffer bufval)
c914fba3811b (ldap-search-internal): Skip error message from ldapsearch. Allow listing
Pavel Janík <Pavel@Janik.cz>
parents: 42573
diff changeset
602 (erase-buffer)
c914fba3811b (ldap-search-internal): Skip error message from ldapsearch. Allow listing
Pavel Janík <Pavel@Janik.cz>
parents: 42573
diff changeset
603 (set-buffer-multibyte nil)
c914fba3811b (ldap-search-internal): Skip error message from ldapsearch. Allow listing
Pavel Janík <Pavel@Janik.cz>
parents: 42573
diff changeset
604 (insert-file-contents-literally value)
c914fba3811b (ldap-search-internal): Skip error message from ldapsearch. Allow listing
Pavel Janík <Pavel@Janik.cz>
parents: 42573
diff changeset
605 (delete-file value)
c914fba3811b (ldap-search-internal): Skip error message from ldapsearch. Allow listing
Pavel Janík <Pavel@Janik.cz>
parents: 42573
diff changeset
606 (setq value (buffer-string))))
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
607 (setq record (cons (list name value)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
608 record))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
609 (forward-line 1))
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
610 (setq result (cons (if withdn
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
611 (cons dn (nreverse record))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
612 (nreverse record)) result))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
613 (setq record nil)
42517
400e6bda5a0d (ldap-host-parameters-alist): Remove duplicated entry.
Pavel Janík <Pavel@Janik.cz>
parents: 42368
diff changeset
614 (skip-chars-forward " \t\n")
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
615 (message "Parsing results... %d" numres)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
616 (1+ numres))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
617 (message "Parsing results... done")
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
618 (nreverse result)))))
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
619
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
620 (provide 'ldap)
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
621
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 45247
diff changeset
622 ;;; arch-tag: 47913a76-6155-42e6-ac58-6d28b5d50eb0
27313
babfd92e24bf *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
623 ;;; ldap.el ends here