Mercurial > emacs
comparison lisp/net/ldap.el @ 89909:68c22ea6027c
Sync to HEAD
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 16 Apr 2004 12:51:06 +0000 |
parents | 375f2633d815 |
children | 4c90ffeb71c5 |
comparison
equal
deleted
inserted
replaced
89908:ee1402f7b568 | 89909:68c22ea6027c |
---|---|
1 ;;; ldap.el --- client interface to LDAP for Emacs | 1 ;;; ldap.el --- client interface to LDAP for Emacs |
2 | 2 |
3 ;; Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1998, 1999, 2000, 02, 2004 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Oscar Figueiredo <oscar@cpe.fr> | 5 ;; Author: Oscar Figueiredo <oscar@cpe.fr> |
6 ;; Maintainer: Pavel Janík <Pavel@Janik.cz> | 6 ;; Maintainer: Pavel Janík <Pavel@Janik.cz> |
7 ;; Created: April 1998 | 7 ;; Created: April 1998 |
8 ;; Keywords: comm | 8 ;; Keywords: comm |
34 ;; - OpenLDAP (http://www.openldap.org/) | 34 ;; - OpenLDAP (http://www.openldap.org/) |
35 | 35 |
36 ;;; Code: | 36 ;;; Code: |
37 | 37 |
38 (require 'custom) | 38 (require 'custom) |
39 (eval-when-compile (require 'cl)) | |
39 | 40 |
40 (defgroup ldap nil | 41 (defgroup ldap nil |
41 "Lightweight Directory Access Protocol." | 42 "Lightweight Directory Access Protocol." |
42 :version "21.1" | 43 :version "21.1" |
43 :group 'comm) | 44 :group 'comm) |
462 (or host | 463 (or host |
463 (setq host ldap-default-host) | 464 (setq host ldap-default-host) |
464 (error "No LDAP host specified")) | 465 (error "No LDAP host specified")) |
465 (let ((host-plist (cdr (assoc host ldap-host-parameters-alist))) | 466 (let ((host-plist (cdr (assoc host ldap-host-parameters-alist))) |
466 result) | 467 result) |
467 (setq result (ldap-search-internal (append host-plist | 468 (setq result (ldap-search-internal (list* 'host host |
468 (list 'host host | 469 'filter filter |
469 'filter filter | 470 'attributes attributes |
470 'attributes attributes | 471 'attrsonly attrsonly |
471 'attrsonly attrsonly | 472 'withdn withdn |
472 'withdn withdn)))) | 473 host-plist))) |
473 (if ldap-ignore-attribute-codings | 474 (if ldap-ignore-attribute-codings |
474 result | 475 result |
475 (mapcar (function | 476 (mapcar (lambda (record) |
476 (lambda (record) | 477 (mapcar 'ldap-decode-attribute record)) |
477 (mapcar 'ldap-decode-attribute record))) | |
478 result)))) | 478 result)))) |
479 | 479 |
480 | 480 |
481 (defun ldap-search-internal (search-plist) | 481 (defun ldap-search-internal (search-plist) |
482 "Perform a search on a LDAP server. | 482 "Perform a search on a LDAP server. |
580 (point)))) | 580 (point)))) |
581 (forward-line 1) | 581 (forward-line 1) |
582 (while (looking-at "^\\(\\w*\\)[=:\t ]+\\(<[\t ]*file://\\)?\\(.*\\)$") | 582 (while (looking-at "^\\(\\w*\\)[=:\t ]+\\(<[\t ]*file://\\)?\\(.*\\)$") |
583 (setq name (match-string 1) | 583 (setq name (match-string 1) |
584 value (match-string 3)) | 584 value (match-string 3)) |
585 ;; Need to handle file:///D:/... as generated by OpenLDAP | |
586 ;; on DOS/Windows as local files. | |
587 (if (and (memq system-type '(windows-nt ms-dos)) | |
588 (eq (string-match "/\\(.:.*\\)$" value) 0)) | |
589 (setq value (match-string 1 value))) | |
585 ;; Do not try to open non-existent files | 590 ;; Do not try to open non-existent files |
586 (if (equal value "") | 591 (if (equal value "") |
587 (setq value " ") | 592 (setq value " ") |
588 (save-excursion | 593 (save-excursion |
589 (set-buffer bufval) | 594 (set-buffer bufval) |
605 (message "Parsing results... done") | 610 (message "Parsing results... done") |
606 (nreverse result))))) | 611 (nreverse result))))) |
607 | 612 |
608 (provide 'ldap) | 613 (provide 'ldap) |
609 | 614 |
615 ;;; arch-tag: 47913a76-6155-42e6-ac58-6d28b5d50eb0 | |
610 ;;; ldap.el ends here | 616 ;;; ldap.el ends here |