Function: canlock-verify
canlock-verify is an autoloaded, interactive and byte-compiled
function defined in canlock.el.gz.
Signature
(canlock-verify &optional BUFFER)
Documentation
Verify Cancel-Lock or Cancel-Key in BUFFER.
If BUFFER is nil, the current buffer is assumed. Signal an error if it fails.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/canlock.el.gz
;;;###autoload
(defun canlock-verify (&optional buffer)
"Verify Cancel-Lock or Cancel-Key in BUFFER.
If BUFFER is nil, the current buffer is assumed. Signal an error if
it fails."
(interactive)
(let (keys locks errmsg id-for-key id-for-lock password
key-for-key key-for-lock match)
(save-excursion
(when buffer
(set-buffer buffer))
(save-restriction
(widen)
(canlock-narrow-to-header)
(setq keys (canlock-fetch-fields 'key)
locks (canlock-fetch-fields))
(if (not (or keys locks))
(setq errmsg
"There are neither Cancel-Lock nor Cancel-Key headers")
(setq id-for-key (canlock-fetch-id-for-key)
id-for-lock (mail-fetch-field "Message-ID"))
(or id-for-key id-for-lock
(setq errmsg "There are no Message-ID(s)")))))
(if errmsg
(error "%s" errmsg)
(setq password (or canlock-password-for-verify
(read-passwd "Password for Canlock: ")))
(if (or (not (stringp password)) (zerop (length password)))
(error "Password for Canlock is bad")
(when keys
(when id-for-key
(setq key-for-key (canlock-make-cancel-key id-for-key password))
(while (and keys (not match))
(setq match (string-equal key-for-key (pop keys)))))
(setq keys (if match "good" "bad")))
(setq match nil)
(when locks
(when id-for-lock
(setq key-for-lock
(base64-encode-string
(canlock-sha1 (canlock-make-cancel-key id-for-lock
password))))
(when (and locks (not match))
(setq match (string-equal key-for-lock (pop locks)))))
(setq locks (if match "good" "bad")))
(prog1
(when (member "bad" (list keys locks))
"bad")
(cond ((and keys locks)
(message "Cancel-Key is %s, Cancel-Lock is %s" keys locks))
(locks
(message "Cancel-Lock is %s" locks))
(keys
(message "Cancel-Key is %s" keys))))))))