Mercurial > hg > xemacs-beta
comparison lisp/ldap.el @ 276:6330739388db r21-0b36
Import from CVS: tag r21-0b36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:30:37 +0200 |
parents | 405dd6d1825b |
children | 7df0dd720c89 |
comparison
equal
deleted
inserted
replaced
275:a68ae4439f57 | 276:6330739388db |
---|---|
3 ;; Copyright (C) 1997 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1997 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Oscar Figueiredo <Oscar.Figueiredo@di.epfl.ch> | 5 ;; Author: Oscar Figueiredo <Oscar.Figueiredo@di.epfl.ch> |
6 ;; Maintainer: Oscar Figueiredo <Oscar.Figueiredo@di.epfl.ch> | 6 ;; Maintainer: Oscar Figueiredo <Oscar.Figueiredo@di.epfl.ch> |
7 ;; Created: Jan 1998 | 7 ;; Created: Jan 1998 |
8 ;; Version: $Revision: 1.2 $ | 8 ;; Version: $Revision: 1.3 $ |
9 ;; Keywords: help comm | 9 ;; Keywords: help comm |
10 | 10 |
11 ;; This file is part of XEmacs | 11 ;; This file is part of XEmacs |
12 | 12 |
13 ;; XEmacs is free software; you can redistribute it and/or modify it | 13 ;; XEmacs is free software; you can redistribute it and/or modify it |
34 | 34 |
35 | 35 |
36 ;;; Code: | 36 ;;; Code: |
37 | 37 |
38 (eval-when '(load eval) | 38 (eval-when '(load eval) |
39 (require 'ldap-internal)) | 39 (require 'ldap)) |
40 | |
41 (defvar ldap-default-host nil | |
42 "*Default LDAP server.") | |
40 | 43 |
41 (defvar ldap-host-parameters-alist nil | 44 (defvar ldap-host-parameters-alist nil |
42 "An alist describing per host options to use for LDAP transactions | 45 "*An alist describing per host options to use for LDAP transactions |
43 The list has the form ((HOST OPTION OPTION ...) (HOST OPTION OPTION ...)) | 46 The list has the form ((HOST OPTION OPTION ...) (HOST OPTION OPTION ...)) |
44 HOST is the name of an LDAP server. OPTIONs are cons cells describing | 47 HOST is the name of an LDAP server. OPTIONs are cons cells describing |
45 parameters for the server. Valid options are: | 48 parameters for the server. Valid options are: |
46 (binddn . BINDDN) | 49 (binddn . BINDDN) |
47 (passwd . PASSWD) | 50 (passwd . PASSWD) |
71 ATTRSONLY if non nil retrieves the attributes only without | 74 ATTRSONLY if non nil retrieves the attributes only without |
72 the associated values. | 75 the associated values. |
73 Additional search parameters can be specified through | 76 Additional search parameters can be specified through |
74 `ldap-host-parameters-alist' which see." | 77 `ldap-host-parameters-alist' which see." |
75 (interactive "sFilter:") | 78 (interactive "sFilter:") |
76 (let (host-alist) | 79 (let (host-alist res ldap) |
77 (if (null host) | 80 (if (null host) |
78 (setq host ldap-default-host)) | 81 (setq host ldap-default-host)) |
79 (if (null host) | 82 (if (null host) |
80 (error "No LDAP host specified")) | 83 (error "No LDAP host specified")) |
81 (setq host-alist | 84 (setq host-alist |
82 (assoc host ldap-host-parameters-alist)) | 85 (assoc host ldap-host-parameters-alist)) |
83 (ldap-search-internal (append | 86 (message "Opening LDAP connection to %s..." host) |
84 (list 'host host | 87 (setq ldap (ldap-open host (alist-to-plist host-alist))) |
85 'filter filter | 88 (message "Searching with LDAP on %s..." host) |
86 'attributes attributes | 89 (setq res (ldap-search-internal ldap filter |
87 'attrsonly attrsonly) | 90 (cdr (assq 'base host-alist)) |
88 (alist-to-plist host-alist))) | 91 (cdr (assq 'scope host-alist)) |
89 )) | 92 attributes attrsonly)) |
93 (ldap-close ldap) | |
94 res)) | |
90 | 95 |
91 | 96 |
92 | 97 |
93 (provide 'ldap) | 98 (provide 'ldap) |
94 | 99 |