[gnus git] branch master updated: m0-11-174-g833868e =1= Fix SCRAM-SHA-1 SASL mechanism

Katsumi <[email protected]> Mon, 23 Feb 2015 10:42:32 +0100
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  833868ef19ead4fb04728fda3c9071e182ac5f24 (commit)
      from  6b6ee186d3d0fa05d39ba49fe1276ecb5aa3f5d2 (commit)


- Log -----------------------------------------------------------------
commit 833868ef19ead4fb04728fda3c9071e182ac5f24
Author: Magnus Henoch <[email protected]>
Date:   Mon Feb 23 09:42:10 2015 +0000

    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.
    
    * 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.
    
    * 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.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1a0a736..3123c89 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -4,6 +4,16 @@
 	Tools: https://github.com/politza/pdf-tools) for viewing PDF
 	attachments in emacs.
 
+2015-02-23  Magnus Henoch  <[email protected]>
+
+	* 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.
+
+	* 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  Katsumi Yamaoka  <[email protected]>
 
 	* gnus-art.el (gnus-mime-display-single): Avoid "End of buffer" error.
diff --git a/lisp/sasl-scram-rfc.el b/lisp/sasl-scram-rfc.el
index af571c8..193c4e6 100644
--- a/lisp/sasl-scram-rfc.el
+++ b/lisp/sasl-scram-rfc.el
@@ -40,31 +40,9 @@
 (ignore-errors (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)
@@ -238,5 +216,30 @@ to case differences."
    (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/sasl.el b/lisp/sasl.el
index e59ed5d..9321efd 100644
--- a/lisp/sasl.el
+++ b/lisp/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)
 

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog         |   10 ++++++++++
 lisp/sasl-scram-rfc.el |   47 +++++++++++++++++++++++++----------------------
 lisp/sasl.el           |    2 +-
 3 files changed, 36 insertions(+), 23 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project