annotate lisp/ldap.el @ 259:11cf20601dec r20-5b28

Import from CVS: tag r20-5b28
author cvs
date Mon, 13 Aug 2007 10:23:02 +0200
parents
children 405dd6d1825b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
1 ;;; ldap.el --- LDAP support for Emacs
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
2
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
4
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
5 ;; Author: Oscar Figueiredo <Oscar.Figueiredo@di.epfl.ch>
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
6 ;; Maintainer: Oscar Figueiredo <Oscar.Figueiredo@di.epfl.ch>
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
7 ;; Created: Jan 1998
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
8 ;; Version: $Revision: 1.1 $
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
9 ;; Keywords: help comm
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
10
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
11 ;; This file is part of XEmacs
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
12
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
13 ;; XEmacs is free software; you can redistribute it and/or modify it
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
14 ;; under the terms of the GNU General Public License as published by
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
16 ;; any later version.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
17
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
18 ;; XEmacs is distributed in the hope that it will be useful, but
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
21 ;; General Public License for more details.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
22
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
24 ;; along with XEmacs; see the file COPYING. If not, write to
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
25 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
26 ;; Boston, MA 02111-1307, USA.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
27
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
28 ;;; Commentary:
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
29 ;; This file provides mid-level and user-level functions to access directory
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
30 ;; servers using the LDAP protocol (RFC 1777).
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
31
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
32 ;;; Installation:
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
33 ;; LDAP support must have been built into XEmacs.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
34
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
35
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
36 ;;; Code:
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
37
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
38 (require 'ldap-internal)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
39
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
40 (defvar ldap-host-parameters-alist nil
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
41 "An alist describing per host options to use for LDAP transactions
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
42 The list has the form ((HOST OPTION OPTION ...) (HOST OPTION OPTION ...))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
43 HOST is the name of an LDAP server. OPTIONs are cons cells describing
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
44 parameters for the server. Valid options are:
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
45 (binddn . BINDDN)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
46 (passwd . PASSWD)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
47 (auth . AUTH)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
48 (base . BASE)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
49 (scope . SCOPE)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
50 (deref . DEREF)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
51 (timelimit . TL)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
52 (sizelimit . SL))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
53 BINDDN is the distinguished name of the user to bind as (in RFC 1779 syntax).
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
54 PASSWD is the password to use for simple authentication.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
55 AUTH is the authentication method to use, possible values are:
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
56 `simple', `krbv41' and `krbv42'.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
57 BASE is the base for the search as described in RFC 1779.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
58 SCOPE is one of the three symbols `subtree', `base' or `onelevel'.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
59 DEREF is one of the symbols `never', `always', `search' or `find'.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
60 TL is the timeout limit for the connection in seconds.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
61 SL is the maximum number of matches to return." )
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
62
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
63
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
64 (defun ldap-search (filter &optional host attributes attrsonly)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
65 "Perform an LDAP search.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
66 FILTER is the search filter in RFC1558 syntax
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
67 HOST is the LDAP host on which to perform the search
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
68 ATTRIBUTES is the specific attributes to retrieve, nil means
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
69 retrieve all
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
70 ATTRSONLY if non nil retrieves the attributes only without
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
71 the associated values.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
72 Additional search parameters can be specified through
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
73 `ldap-host-parameters-alist' which see."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
74 (interactive "sFilter:")
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
75 (let (host-alist)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
76 (if (null host)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
77 (setq host ldap-default-host))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
78 (if (null host)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
79 (error "No LDAP host specified"))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
80 (setq host-alist
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
81 (assoc host ldap-host-parameters-alist))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
82 (ldap-search-internal (append
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
83 (list 'host host
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
84 'filter filter
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
85 'attributes attributes
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
86 'attrsonly attrsonly)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
87 (alist-to-plist host-alist)))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
88 ))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
89
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
90
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
91
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
92 (provide 'ldap)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
93
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
94 ;;; ldap.el ends here