annotate lisp/net/sasl-ntlm.el @ 92606:f49e5129551f

(persian-calendar-month-name-array, persian-calendar-epoch): Make constants. (persian-prompt-for-date): Use zerop.
author Glenn Morris <rgm@gnu.org>
date Sat, 08 Mar 2008 04:18:57 +0000
parents b9e8ab94c460
children 1e3a407766b9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
86996
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1 ;;; sasl-ntlm.el --- NTLM (NT Lan Manager) module for the SASL client framework
ccfc70c9b588 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: 86996
diff changeset
3 ;; Copyright (C) 2000, 2007, 2008 Free Software Foundation, Inc.
86996
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
4
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
5 ;; Author: Taro Kawagishi <tarok@transpulse.org>
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
6 ;; Keywords: SASL, NTLM
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
7 ;; Version: 1.00
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
8 ;; Created: February 2001
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
9
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
11
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
14 ;; the Free Software Foundation; either version 3, or (at your option)
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
15 ;; any later version.
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
16
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
21
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
25 ;; Boston, MA 02110-1301, USA.
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
26
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
27 ;;; Commentary:
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
28
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
29 ;; This is a SASL interface layer for NTLM authentication message
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
30 ;; generation by ntlm.el
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
31
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
32 ;;; Code:
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
33
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
34 (require 'sasl)
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
35 (require 'ntlm)
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
36
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
37 (defconst sasl-ntlm-steps
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
38 '(ignore ;nothing to do before making
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
39 sasl-ntlm-request ;authentication request
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
40 sasl-ntlm-response) ;response to challenge
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
41 "A list of functions to be called in sequnece for the NTLM
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
42 authentication steps. Ther are called by 'sasl-next-step.")
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
43
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
44 (defun sasl-ntlm-request (client step)
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
45 "SASL step function to generate a NTLM authentication request to the server.
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
46 Called from 'sasl-next-step.
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
47 CLIENT is a vector [mechanism user service server sasl-client-properties]
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
48 STEP is a vector [<previous step function> <result of previous step function>]"
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
49 (let ((user (sasl-client-name client)))
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
50 (ntlm-build-auth-request user)))
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
51
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
52 (defun sasl-ntlm-response (client step)
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
53 "SASL step function to generate a NTLM response against the server
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
54 challenge stored in the 2nd element of STEP. Called from 'sasl-next-step."
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
55 (let* ((user (sasl-client-name client))
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
56 (passphrase
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
57 (sasl-read-passphrase (format "NTLM passphrase for %s: " user)))
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
58 (challenge (sasl-step-data step)))
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
59 (ntlm-build-auth-response challenge user
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
60 (ntlm-get-password-hashes passphrase))))
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
61
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
62 (put 'sasl-ntlm 'sasl-mechanism
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
63 (sasl-make-mechanism "NTLM" sasl-ntlm-steps))
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
64
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
65 (provide 'sasl-ntlm)
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
66
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
67 ;;; arch-tag: 1d9164c1-1df0-418f-b7ab-360157fd05dc
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
68 ;;; sasl-ntlm.el ends here