diff options
| author | Magnus Henoch <magnus.henoch@gmail.com> | 2015-02-23 09:09:46 +0000 |
|---|---|---|
| committer | Magnus Henoch <magnus.henoch@gmail.com> | 2015-02-23 09:09:46 +0000 |
| commit | 80e50144d82e271dccd7716703c2f4390463a753 (patch) | |
| tree | 7f0a938f5210df9cba0f8b494b0008535dd5040c /lisp | |
| parent | 34871865de0452cd251e92d76ab12c2ac237e783 (diff) | |
| download | emacs-80e50144d82e271dccd7716703c2f4390463a753.tar.gz | |
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.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/net/sasl-scram-rfc.el | 47 | ||||
| -rw-r--r-- | lisp/net/sasl.el | 2 |
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 @@ +2015-02-23 Magnus Henoch <magnus.henoch@gmail.com> + + * 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. + 2015-02-23 Paul Eggert <eggert@cs.ucla.edu> 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 @@ (require 'cl-lib) (require 'sasl) - -;;; SCRAM-SHA-1 - (require 'hex-util) (require 'rfc2104) -(defconst sasl-scram-sha-1-steps - '(sasl-scram-client-first-message - sasl-scram-sha-1-client-final-message - sasl-scram-sha-1-authenticate-server)) - -(defun sasl-scram-sha-1-client-final-message (client step) - (sasl-scram--client-final-message - ;; HMAC-SHA1 uses block length 64 and hash length 20; see RFC 2104. - 'sha1 64 20 client step)) - -(defun sasl-scram-sha-1-authenticate-server (client step) - (sasl-scram--authenticate-server - 'sha1 64 20 client step)) - -(put 'sasl-scram-sha-1 'sasl-mechanism - (sasl-make-mechanism "SCRAM-SHA-1" sasl-scram-sha-1-steps)) - -(provide 'sasl-scram-sha-1) - ;;; Generic for SCRAM-* (defun sasl-scram-client-first-message (client _step) @@ -156,5 +134,30 @@ (t (sasl-error "Invalid response from server")))) +;;; SCRAM-SHA-1 + +(defconst sasl-scram-sha-1-steps + '(sasl-scram-client-first-message + sasl-scram-sha-1-client-final-message + sasl-scram-sha-1-authenticate-server)) + +(defun sasl-scram-sha-1-client-final-message (client step) + (sasl-scram--client-final-message + ;; HMAC-SHA1 uses block length 64 and hash length 20; see RFC 2104. + 'sha1 64 20 client step)) + +(defun sasl-scram-sha-1-authenticate-server (client step) + (sasl-scram--authenticate-server + 'sha1 64 20 client step)) + +;; This needs to be at the end, because of how `sasl-make-mechanism' +;; handles step function names. +(put 'sasl-scram-sha-1 'sasl-mechanism + (sasl-make-mechanism "SCRAM-SHA-1" sasl-scram-sha-1-steps)) + +(put 'sasl-scram-rfc 'sasl-mechanism (get 'sasl-scram-sha-1 'sasl-mechanism)) + +(provide 'sasl-scram-sha-1) + (provide 'sasl-scram-rfc) ;;; 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 @@ ("LOGIN" sasl-login) ("ANONYMOUS" sasl-anonymous) ("NTLM" sasl-ntlm) - ("SCRAM-SHA-1" sasl-scram-sha-1))) + ("SCRAM-SHA-1" sasl-scram-rfc))) (defvar sasl-unique-id-function #'sasl-unique-id-function) |
