* SLIM-VERSION: Fix.
[elisp/flim.git] / sasl.el
diff --git a/sasl.el b/sasl.el
index 9709927..db86609 100644 (file)
--- a/sasl.el
+++ b/sasl.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
 
 ;; Author: Kenichi OKADA <okada@opaopa.org>
-;; Keywords: SMTP, SASL
+;; Keywords: SMTP, SASL, RFC2222
 
 ;; This file is part of FLIM (Faithful Library about Internet Message).
 
 ;;; Code:
 
 (require 'hmac-md5)
-(require 'hmac-util)
-
-(defun sasl-cram-md5 (user passphrase response)
-  (concat user " "
-         (hmac-hex-string
-          (hmac-md5 response passphrase))))
 
+(defun sasl-cram-md5 (username passphrase challenge)
+  (let ((secure-word (copy-sequence passphrase)))
+    (setq secure-word (unwind-protect
+                         (hmac-md5 challenge secure-word)
+                       (fillarray secure-word 0))
+         secure-word (unwind-protect
+                         (encode-hex-string secure-word)
+                       (fillarray secure-word 0))
+         secure-word (unwind-protect
+                         (concat username " " secure-word)
+                       (fillarray secure-word 0)))))
+               
 (defun sasl-plain (authorid authenid passphrase)
   (concat authorid "\0" authenid "\0" passphrase))
 
 (provide 'sasl)
 
-;;; smtp.el ends here
+;;; sasl.el ends here