Gnus development mailing list
 help / color / mirror / Atom feed
From: "Arne Jørgensen" <arne@arnested.dk>
Subject: Re: Ldap certificate retrieval in XEmacs
Date: Thu, 14 Apr 2005 13:41:08 +0200	[thread overview]
Message-ID: <8764ypziuj.fsf@seamus.arnested.dk> (raw)
In-Reply-To: <874qeaj16v.fsf_-_@seamus.arnested.dk>

[-- Attachment #1: Type: text/plain, Size: 554 bytes --]

Arne Jørgensen <arne@arnested.dk> 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 <http://arnested.dk/>


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: smime-ldap.patch --]
[-- Type: text/x-patch, Size: 3971 bytes --]

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  <arne@arnested.dk>
+
+	* 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  <yamaoka@jpl.org>
 
 	* lpath.el: Fbind display-time-event-handler; don't fbind

  parent reply	other threads:[~2005-04-14 11:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-01 16:29 #secure smime signencrypt not working to myself David S. Goldberg
2005-03-06 21:14 ` Arne Jørgensen
2005-04-13 12:44   ` Ldap certificate retrieval in XEmacs (was: #secure smime signencrypt not working to myself) Arne Jørgensen
2005-04-14 11:27     ` Ldap certificate retrieval in XEmacs Arne Jørgensen
2005-04-14 11:41     ` Arne Jørgensen [this message]
2005-04-26 12:07       ` Arne Jørgensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8764ypziuj.fsf@seamus.arnested.dk \
    --to=arne@arnested.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).