From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/60155 Path: news.gmane.org!not-for-mail From: =?utf-8?Q?Arne_J=C3=B8rgensen?= Newsgroups: gmane.emacs.gnus.general Subject: Re: Ldap certificate retrieval in XEmacs Date: Thu, 14 Apr 2005 13:41:08 +0200 Organization: Arne Joergensen -- http://arnested.dk/ Message-ID: <8764ypziuj.fsf@seamus.arnested.dk> References: <878y50zdcl.fsf@seamus.arnested.dk> <874qeaj16v.fsf_-_@seamus.arnested.dk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1113478875 22253 80.91.229.2 (14 Apr 2005 11:41:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 14 Apr 2005 11:41:15 +0000 (UTC) Original-X-From: ding-owner+M8682@lists.math.uh.edu Thu Apr 14 13:41:12 2005 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DM2hg-000292-I1 for ding-account@gmane.org; Thu, 14 Apr 2005 13:40:13 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1DM2kG-0006bs-00; Thu, 14 Apr 2005 06:42:52 -0500 Original-Received: from util2.math.uh.edu ([129.7.128.23]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1DM2k7-0006bm-00 for ding@lists.math.uh.edu; Thu, 14 Apr 2005 06:42:43 -0500 Original-Received: from quimby.gnus.org ([80.91.224.244]) by util2.math.uh.edu with esmtp (Exim 4.30) id 1DM2k6-00041y-3u for ding@lists.math.uh.edu; Thu, 14 Apr 2005 06:42:42 -0500 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1DM2k5-000347-00 for ; Thu, 14 Apr 2005 13:42:41 +0200 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1DM2g0-0001th-5u for ding@gnus.org; Thu, 14 Apr 2005 13:38:28 +0200 Original-Received: from 213.237.94.152 ([213.237.94.152]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 14 Apr 2005 13:38:28 +0200 Original-Received: from arne by 213.237.94.152 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 14 Apr 2005 13:38:28 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: ding@gnus.org Original-Lines: 140 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 213.237.94.152 X-Face: 5t,7/Y$&<1A_t.$vC2{pWZ{m@3_06;kcm]no{hgEL/}Uz(>XV6cl4}xO\v?-h3%>znNaZtq `~rf,GY1T%r=a.zH`hOb(-]'x)nI088Z&|e;V^h;/TShou User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:Rk/36kfz3sjuZR6J6D0064g40vI= X-Spam-Score: -4.9 (----) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: news.gmane.org gmane.emacs.gnus.general:60155 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:60155 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Arne Jørgensen writes: > It actually seems quite simpel to fix. That is if the attached patch > works (I don't have a working XEmacs/Gnus combination). I managed to get a working XEmacs/Gnus and the patch didn't work. Emacs' ldap-search and Xemacs' ldap-search-entries gives diffrent results although they have identical parameters. An adjusted patch is attach. I have tested it and it works in Emacs 21.3.1, CVS Emacs and Xemacs 21.4.17. So it should be safe to apply it. Kind regards, -- Arne Jørgensen --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=smime-ldap.patch Content-Transfer-Encoding: 8bit Index: lisp/smime.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/smime.el,v retrieving revision 7.10 diff -u -p -r7.10 smime.el --- lisp/smime.el 31 Mar 2005 20:09:53 -0000 7.10 +++ lisp/smime.el 14 Apr 2005 11:37:51 -0000 @@ -577,9 +577,9 @@ A string or a list of strings is returne host '("userCertificate") nil)) (retbuf (generate-new-buffer (format "*certificate for %s*" mail))) cert) - (if (> (length ldapresult) 1) + (if (>= (length ldapresult) 1) (with-current-buffer retbuf - (setq cert (base64-encode-string (nth 1 (car (nth 1 ldapresult))) t)) + (setq cert (base64-encode-string (cadaar ldapresult) t)) (insert "-----BEGIN CERTIFICATE-----\n") (let ((i 0) (len (length cert))) (while (> (- len 64) i) Index: lisp/smime-ldap.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/smime-ldap.el,v retrieving revision 7.3 diff -u -p -r7.3 smime-ldap.el --- lisp/smime-ldap.el 15 Feb 2005 01:58:42 -0000 7.3 +++ lisp/smime-ldap.el 14 Apr 2005 11:37:51 -0000 @@ -31,14 +31,7 @@ ;; made to achieve compatibility with OpenLDAP v2 and to make it ;; possible to retrieve LDAP attributes that are tagged ie ";binary". -;; When Gnus drops support for Emacs 21.x this file can be removed and -;; smime.el changed to - -;; - (require 'smime-ldap) => (require 'ldap) -;; - (smime-ldap-search ...) => (ldap-search ...) - -;; If we are running in Emacs 22 or newer it just uses the build-in -;; version of ldap-search. +;; The file also adds a compatibility layer for Emacs and XEmacs. ;;; Code: @@ -57,26 +50,31 @@ its distinguished name WITHDN. Additional search parameters can be specified through `ldap-host-parameters-alist', which see." (interactive "sFilter:") - (if (>= emacs-major-version 22) - (ldap-search filter host attributes attrsonly) - (or host - (setq host ldap-default-host) - (error "No LDAP host specified")) - (let ((host-plist (cdr (assoc host ldap-host-parameters-alist))) - result) - (setq result (smime-ldap-search-internal - (append host-plist - (list 'host host - 'filter filter - 'attributes attributes - 'attrsonly attrsonly - 'withdn withdn)))) - (if ldap-ignore-attribute-codings - result - (mapcar (function - (lambda (record) - (mapcar 'ldap-decode-attribute record))) - result))))) + ;; for XEmacs + (if (fboundp 'ldap-search-entries) + (ldap-search-entries filter host attributes attrsonly) + ;; for Emacs 22 + (if (>= emacs-major-version 22) + (cdr (ldap-search filter host attributes attrsonly)) + ;; for Emacs 21.x + (or host + (setq host ldap-default-host) + (error "No LDAP host specified")) + (let ((host-plist (cdr (assoc host ldap-host-parameters-alist))) + result) + (setq result (smime-ldap-search-internal + (append host-plist + (list 'host host + 'filter filter + 'attributes attributes + 'attrsonly attrsonly + 'withdn withdn)))) + (cdr (if ldap-ignore-attribute-codings + result + (mapcar (function + (lambda (record) + (mapcar 'ldap-decode-attribute record))) + result))))))) (defun smime-ldap-search-internal (search-plist) "Perform a search on a LDAP server. Index: lisp/ChangeLog =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/ChangeLog,v retrieving revision 7.678 diff -u -p -r7.678 ChangeLog --- lisp/ChangeLog 13 Apr 2005 06:41:12 -0000 7.678 +++ lisp/ChangeLog 14 Apr 2005 11:37:54 -0000 @@ -1,3 +1,9 @@ +2005-04-14 Arne J,Ax(Brgensen + + * smime-ldap.el (smime-ldap-search): Add compatibility for XEmacs. + + * smime.el (smime-cert-by-ldap-1): Adjust for the above. + 2005-04-13 Katsumi Yamaoka * lpath.el: Fbind display-time-event-handler; don't fbind --=-=-=--