summaryrefslogtreecommitdiff
path: root/lisp/gnus/smime.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/gnus/smime.el')
-rw-r--r--lisp/gnus/smime.el54
1 files changed, 10 insertions, 44 deletions
diff --git a/lisp/gnus/smime.el b/lisp/gnus/smime.el
index d1077a96fc9..9bec58a46f2 100644
--- a/lisp/gnus/smime.el
+++ b/lisp/gnus/smime.el
@@ -120,25 +120,10 @@
(require 'dig)
-(if (locate-library "password-cache")
- (require 'password-cache)
- (require 'password))
+(require 'password-cache)
(eval-when-compile (require 'cl))
-(eval-and-compile
- (cond
- ((fboundp 'replace-in-string)
- (defalias 'smime-replace-in-string 'replace-in-string))
- ((fboundp 'replace-regexp-in-string)
- (defun smime-replace-in-string (string regexp newtext &optional literal)
- "Replace all matches for REGEXP with NEWTEXT in STRING.
-If LITERAL is non-nil, insert NEWTEXT literally. Return a new
-string containing the replacements.
-
-This is a compatibility function for different Emacsen."
- (replace-regexp-in-string regexp newtext string nil literal)))))
-
(defgroup smime nil
"S/MIME configuration."
:group 'mime)
@@ -244,21 +229,6 @@ must be set in `ldap-host-parameters-alist'."
(defvar smime-details-buffer "*OpenSSL output*")
-;; Use mm-util?
-(eval-and-compile
- (defalias 'smime-make-temp-file
- (if (fboundp 'make-temp-file)
- 'make-temp-file
- (lambda (prefix &optional dir-flag) ;; Simple implementation
- (expand-file-name
- (make-temp-name prefix)
- (if (fboundp 'temp-directory)
- (temp-directory)
- temporary-file-directory))))))
-
-;; Password dialog function
-(declare-function password-read-and-add "password-cache" (prompt &optional key))
-
(defun smime-ask-passphrase (&optional cache-key)
"Asks the passphrase to unlock the secret key.
If `cache-key' and `password-cache' is non-nil then cache the
@@ -301,7 +271,7 @@ key and certificate itself."
(keyfile (or (car-safe keyfile) keyfile))
(buffer (generate-new-buffer " *smime*"))
(passphrase (smime-ask-passphrase (expand-file-name keyfile)))
- (tmpfile (smime-make-temp-file "smime")))
+ (tmpfile (make-temp-file "smime")))
(if passphrase
(setenv "GNUS_SMIME_PASSPHRASE" passphrase))
(prog1
@@ -335,7 +305,7 @@ have proper MIME tags. CERTFILES is a list of filenames, each file
is expected to contain of a PEM encoded certificate."
(smime-new-details-buffer)
(let ((buffer (generate-new-buffer " *smime*"))
- (tmpfile (smime-make-temp-file "smime")))
+ (tmpfile (make-temp-file "smime")))
(prog1
(when (prog1
(apply 'smime-call-openssl-region b e (list buffer tmpfile)
@@ -431,7 +401,7 @@ in the buffer specified by `smime-details-buffer'."
(smime-new-details-buffer)
(let ((buffer (generate-new-buffer " *smime*"))
CAs (passphrase (smime-ask-passphrase (expand-file-name keyfile)))
- (tmpfile (smime-make-temp-file "smime")))
+ (tmpfile (make-temp-file "smime")))
(if passphrase
(setenv "GNUS_SMIME_PASSPHRASE" passphrase))
(if (prog1
@@ -588,13 +558,9 @@ A string or a list of strings is returned."
"Get certificate for MAIL from the ldap server at HOST."
(let ((ldapresult
(funcall
- (if (featurep 'xemacs)
- (progn
- (require 'smime-ldap)
- 'smime-ldap-search)
- (progn
- (require 'ldap)
- 'ldap-search))
+ (progn
+ (require 'ldap)
+ 'ldap-search)
(concat "mail=" mail)
host '("userCertificate") nil))
(retbuf (generate-new-buffer (format "*certificate for %s*" mail)))
@@ -611,11 +577,11 @@ A string or a list of strings is returned."
(string= (substring (cadaar ldapresult) 0 3)
"MII"))
(setq cert
- (smime-replace-in-string
- (cadaar ldapresult)
+ (replace-regexp-in-string
(concat "\\(\n\\|\r\\|-----BEGIN CERTIFICATE-----\\|"
"-----END CERTIFICATE-----\\)")
- "" t))
+ ""
+ (cadaar ldapresult) nil t))
(setq cert (base64-encode-string (cadaar ldapresult) t)))
(insert "-----BEGIN CERTIFICATE-----\n")
(let ((i 0) (len (length cert)))