annotate lisp/net/sasl-cram.el @ 91472:93fcec3a4fd7

(charprop-CMD): Chdir in Emacs rather than in Makefile.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 02 Feb 2008 17:55:39 +0000
parents b9e8ab94c460
children 1e3a407766b9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
86994
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1 ;;; sasl-cram.el --- CRAM-MD5 module for the SASL client framework
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2
87665
b9e8ab94c460 Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 86994
diff changeset
3 ;; Copyright (C) 2000, 2007, 2008 Free Software Foundation, Inc.
86994
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
4
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
5 ;; Author: Daiki Ueno <ueno@unixuser.org>
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
6 ;; Kenichi OKADA <okada@opaopa.org>
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
7 ;; Keywords: SASL, CRAM-MD5
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
8
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
10
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 3, or (at your option)
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
14 ;; any later version.
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
15
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
20
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
24 ;; Boston, MA 02110-1301, USA.
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
25
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
26 ;;; Commentary:
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
27
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
28 (require 'sasl)
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
29 (require 'hmac-md5)
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
30
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
31 (defconst sasl-cram-md5-steps
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
32 '(ignore ;no initial response
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
33 sasl-cram-md5-response))
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
34
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
35 (defun sasl-cram-md5-response (client step)
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
36 (let ((passphrase
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
37 (sasl-read-passphrase
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
38 (format "CRAM-MD5 passphrase for %s: "
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
39 (sasl-client-name client)))))
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
40 (unwind-protect
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
41 (concat (sasl-client-name client) " "
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
42 (encode-hex-string
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
43 (hmac-md5 (sasl-step-data step) passphrase)))
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
44 (fillarray passphrase 0))))
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
45
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
46 (put 'sasl-cram 'sasl-mechanism
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
47 (sasl-make-mechanism "CRAM-MD5" sasl-cram-md5-steps))
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
48
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
49 (provide 'sasl-cram)
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
50
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
51 ;;; arch-tag: 46cb281b-975a-4fe0-a39f-3018691b1b05
09dace156f42 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
52 ;;; sasl-cram.el ends here