From 2c8409f1a35cdc3914aa3d4bb4fa8675e97d02b5 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Wed, 9 Jan 2002 12:45:54 +0000 Subject: [PATCH] * canlock.el (canlock-string-as-unibyte): New macro. (canlock-sha1-with-openssl): Return a unibyte string. (canlock-make-cancel-key): Treat Message-ID as a unibyte string. --- ChangeLog | 6 ++++++ lisp/canlock.el | 24 +++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 63c978d..fca4dbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-01-09 Katsumi Yamaoka + + * lisp/canlock.el (canlock-string-as-unibyte): New macro. + (canlock-sha1-with-openssl): Return a unibyte string. + (canlock-make-cancel-key): Treat Message-ID as a unibyte string. + 2002-01-09 Katsumi Yamaoka * lisp/nnheader.el (std11-fold-region): New function copied from diff --git a/lisp/canlock.el b/lisp/canlock.el index 9b8dfb6..845095f 100644 --- a/lisp/canlock.el +++ b/lisp/canlock.el @@ -1,5 +1,6 @@ ;;; canlock.el --- functions for Cancel-Lock feature -;; Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. + +;; Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc. ;; Author: Katsumi Yamaoka ;; Keywords: news, cancel-lock, hmac, sha1, rfc2104 @@ -95,6 +96,13 @@ buffer does not look like a news message." :type 'boolean :group 'canlock) +(eval-when-compile + (defmacro canlock-string-as-unibyte (string) + "Return a unibyte string with the same individual bytes as STRING." + (if (fboundp 'string-as-unibyte) + (list 'string-as-unibyte string) + string))) + (defun canlock-sha1-with-openssl (message) "Make a SHA-1 digest of MESSAGE using OpenSSL." (let (default-enable-multibyte-characters) @@ -112,7 +120,7 @@ buffer does not look like a news message." (replace-match (concat "\\\\x" (match-string 0)))) (insert "\"") (goto-char (point-min)) - (read (current-buffer)))))) + (canlock-string-as-unibyte (read (current-buffer))))))) (defvar canlock-read-passwd nil) (defun canlock-read-passwd (prompt &rest args) @@ -145,11 +153,13 @@ If ARGS, PROMPT is used as an argument to `format'." (opad (mapconcat (lambda (char) (char-to-string (logxor 92 char))) password ""))) - (base64-encode-string (funcall canlock-sha1-function - (concat - opad - (funcall canlock-sha1-function - (concat ipad message-id))))))) + (base64-encode-string + (funcall canlock-sha1-function + (concat + opad + (funcall canlock-sha1-function + (concat ipad + (canlock-string-as-unibyte message-id)))))))) (defun canlock-narrow-to-header () "Narrow the buffer to the head of the message." -- 1.7.10.4