aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagnus Henoch2015-02-23 09:09:46 +0000
committerMagnus Henoch2015-02-23 09:09:46 +0000
commit80e50144d82e271dccd7716703c2f4390463a753 (patch)
tree7f0a938f5210df9cba0f8b494b0008535dd5040c
parent34871865de0452cd251e92d76ab12c2ac237e783 (diff)
downloademacs-80e50144d82e271dccd7716703c2f4390463a753.tar.gz
emacs-80e50144d82e271dccd7716703c2f4390463a753.zip
Fix SCRAM-SHA-1 SASL mechanism
The symbol used in sasl-mechanism-alist needs to match the name that can be required. Move sasl-make-mechanism call to end of file, to ensure that it can refer to the specified step functions. * net/sasl.el (sasl-mechanism-alist): Refer to sasl-scram-rfc instead of sasl-scram-sha-1, as the former is the name that can be required. * net/sasl-scram-rfc.el (sasl-scram-sha-1-steps) (sasl-scram-sha-1-client-final-message) (sasl-scram-sha-1-authenticate-server): Move to end of file.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/net/sasl-scram-rfc.el47
-rw-r--r--lisp/net/sasl.el2
3 files changed, 36 insertions, 23 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c1fb8697707..af8845bfb45 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12015-02-23 Magnus Henoch <magnus.henoch@gmail.com>
2
3 * net/sasl.el (sasl-mechanism-alist): Refer to sasl-scram-rfc
4 instead of sasl-scram-sha-1, as the former is the name that can be
5 required.
6
7 * net/sasl-scram-rfc.el (sasl-scram-sha-1-steps)
8 (sasl-scram-sha-1-client-final-message)
9 (sasl-scram-sha-1-authenticate-server): Move to end of file.
10
12015-02-23 Paul Eggert <eggert@cs.ucla.edu> 112015-02-23 Paul Eggert <eggert@cs.ucla.edu>
2 12
3 Fix the desired binding for comment-line 13 Fix the desired binding for comment-line
diff --git a/lisp/net/sasl-scram-rfc.el b/lisp/net/sasl-scram-rfc.el
index 6c8c00959b1..18d7a6bfa18 100644
--- a/lisp/net/sasl-scram-rfc.el
+++ b/lisp/net/sasl-scram-rfc.el
@@ -39,31 +39,9 @@
39 39
40(require 'cl-lib) 40(require 'cl-lib)
41(require 'sasl) 41(require 'sasl)
42
43;;; SCRAM-SHA-1
44
45(require 'hex-util) 42(require 'hex-util)
46(require 'rfc2104) 43(require 'rfc2104)
47 44
48(defconst sasl-scram-sha-1-steps
49 '(sasl-scram-client-first-message
50 sasl-scram-sha-1-client-final-message
51 sasl-scram-sha-1-authenticate-server))
52
53(defun sasl-scram-sha-1-client-final-message (client step)
54 (sasl-scram--client-final-message
55 ;; HMAC-SHA1 uses block length 64 and hash length 20; see RFC 2104.
56 'sha1 64 20 client step))
57
58(defun sasl-scram-sha-1-authenticate-server (client step)
59 (sasl-scram--authenticate-server
60 'sha1 64 20 client step))
61
62(put 'sasl-scram-sha-1 'sasl-mechanism
63 (sasl-make-mechanism "SCRAM-SHA-1" sasl-scram-sha-1-steps))
64
65(provide 'sasl-scram-sha-1)
66
67;;; Generic for SCRAM-* 45;;; Generic for SCRAM-*
68 46
69(defun sasl-scram-client-first-message (client _step) 47(defun sasl-scram-client-first-message (client _step)
@@ -156,5 +134,30 @@
156 (t 134 (t
157 (sasl-error "Invalid response from server")))) 135 (sasl-error "Invalid response from server"))))
158 136
137;;; SCRAM-SHA-1
138
139(defconst sasl-scram-sha-1-steps
140 '(sasl-scram-client-first-message
141 sasl-scram-sha-1-client-final-message
142 sasl-scram-sha-1-authenticate-server))
143
144(defun sasl-scram-sha-1-client-final-message (client step)
145 (sasl-scram--client-final-message
146 ;; HMAC-SHA1 uses block length 64 and hash length 20; see RFC 2104.
147 'sha1 64 20 client step))
148
149(defun sasl-scram-sha-1-authenticate-server (client step)
150 (sasl-scram--authenticate-server
151 'sha1 64 20 client step))
152
153;; This needs to be at the end, because of how `sasl-make-mechanism'
154;; handles step function names.
155(put 'sasl-scram-sha-1 'sasl-mechanism
156 (sasl-make-mechanism "SCRAM-SHA-1" sasl-scram-sha-1-steps))
157
158(put 'sasl-scram-rfc 'sasl-mechanism (get 'sasl-scram-sha-1 'sasl-mechanism))
159
160(provide 'sasl-scram-sha-1)
161
159(provide 'sasl-scram-rfc) 162(provide 'sasl-scram-rfc)
160;;; sasl-scram-rfc.el ends here 163;;; sasl-scram-rfc.el ends here
diff --git a/lisp/net/sasl.el b/lisp/net/sasl.el
index e59ed5d43aa..9321efdfda8 100644
--- a/lisp/net/sasl.el
+++ b/lisp/net/sasl.el
@@ -45,7 +45,7 @@
45 ("LOGIN" sasl-login) 45 ("LOGIN" sasl-login)
46 ("ANONYMOUS" sasl-anonymous) 46 ("ANONYMOUS" sasl-anonymous)
47 ("NTLM" sasl-ntlm) 47 ("NTLM" sasl-ntlm)
48 ("SCRAM-SHA-1" sasl-scram-sha-1))) 48 ("SCRAM-SHA-1" sasl-scram-rfc)))
49 49
50(defvar sasl-unique-id-function #'sasl-unique-id-function) 50(defvar sasl-unique-id-function #'sasl-unique-id-function)
51 51