summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen <larsi@gnus.org>2010-10-04 00:37:37 +0200
committerLars Magne Ingebrigtsen <larsi@gnus.org>2010-10-04 00:37:37 +0200
commitc1ae068bbb12dfadbe5f7198fa6584e9c4d7d054 (patch)
tree7a2bcf8d2422a6bbfdb6214ae14aebb81e626bb9 /lisp
parent5589b70e5789a355d1aa88b469acdaac423ccbbb (diff)
downloademacs-c1ae068bbb12dfadbe5f7198fa6584e9c4d7d054.tar.gz
Rework the gnutls boot interface.
From Teodor Zlatanov.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/net/gnutls.el38
2 files changed, 27 insertions, 18 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e220416a4af..8bafd2b7713 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2010-10-03 Teodor Zlatanov <tzz@lifelogs.com>
+
+ * net/gnutls.el (starttls-negotiate): Use the plist interface to
+ `gnutls-boot'. Make TYPE the only required parameter. Allow
+ TRUSTFILES and KEYFILES to be lists.
+ (open-ssl-stream): Use it.
+
2010-10-03 Glenn Morris <rgm@gnu.org>
* subr.el (directory-sep-char): Remove obsolete variable.
diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el
index 27d44d32bd3..3baaad63056 100644
--- a/lisp/net/gnutls.el
+++ b/lisp/net/gnutls.el
@@ -57,34 +57,36 @@ Third arg is name of the host to connect to, or its IP address.
Fourth arg SERVICE is name of the service desired, or an integer
specifying a port number to connect to."
(let ((proc (open-network-stream name buffer host service)))
- (starttls-negotiate proc nil 'gnutls-x509pki)))
+ (starttls-negotiate proc 'gnutls-x509pki)))
;; (open-ssl-stream "tls" "tls-buffer" "yourserver.com" "https")
-(defun starttls-negotiate (proc &optional priority-string
- credentials credentials-file)
+;; (open-ssl-stream "tls" "tls-buffer" "imap.gmail.com" "imaps")
+(defun starttls-negotiate (proc type &optional priority-string
+ trustfiles keyfiles)
"Negotiate a SSL or TLS connection.
-PROC is the process returned by `starttls-open-stream'.
-PRIORITY-STRING is as per the GnuTLS docs.
-CREDENTIALS is `gnutls-x509pki' or `gnutls-anon'.
-CREDENTIALS-FILE is a filename with meaning dependent on CREDENTIALS."
- (let* ((credentials (or credentials 'gnutls-x509pki))
- (credentials-file (or credentials-file
- "/etc/ssl/certs/ca-certificates.crt"
- ;"/etc/ssl/certs/ca.pem"
- ))
-
+TYPE is `gnutls-x509pki' (default) or `gnutls-anon'. Use nil for the default.
+PROC is a process returned by `open-network-stream'.
+PRIORITY-STRING is as per the GnuTLS docs, default is \"NORMAL\".
+TRUSTFILES is a list of CA bundles.
+KEYFILES is a list of client keys."
+ (let* ((type (or type 'gnutls-x509pki))
+ (trusfiles (or trustfiles
+ '("/etc/ssl/certs/ca-certificates.crt")))
(priority-string (or priority-string
(cond
- ((eq credentials 'gnutls-anon)
+ ((eq type 'gnutls-anon)
"NORMAL:+ANON-DH:!ARCFOUR-128")
- ((eq credentials 'gnutls-x509pki)
+ ((eq type 'gnutls-x509pki)
"NORMAL"))))
+ (params `(:priority ,priority-string
+ :loglevel ,gnutls-log-level
+ :trustfiles ,trustfiles
+ :keyfiles ,keyfiles
+ :callbacks nil))
ret)
(gnutls-message-maybe
- (setq ret (gnutls-boot proc priority-string
- credentials credentials-file
- nil nil gnutls-log-level))
+ (setq ret (gnutls-boot proc type params))
"boot: %s")
proc))