annotate lisp/net/sasl-ntlm.el @ 112442:76fa839f455e

* Makefile.in (MAKEINFO): Now controlled by `configure'. (MAKEINFO_OPTS): New variable. Use it where appropriate. (ENVADD): New variable to control texi2dvi and texi2pdf.
author Werner Lemberg <wl@gnu.org>
date Sun, 23 Jan 2011 11:22:21 +0100
parents 417b1e4d63cd
children
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
112218
376148b31b5e Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
3 ;; Copyright (C) 2000, 2007, 2008, 2009, 2010, 2011 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
110015
280c8ae2476d Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
9 ;; Package: sasl
86996
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
10
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
12
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
86996
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
15 ;; the Free Software Foundation, either version 3 of the License, or
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
16 ;; (at your option) any later version.
86996
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
17
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
18 ;; 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
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
21 ;; GNU General Public License for more details.
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
22
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
86996
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
25
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
26 ;;; Commentary:
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
27
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
28 ;; This is a SASL interface layer for NTLM authentication message
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
29 ;; generation by ntlm.el
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
30
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
31 ;;; Code:
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
32
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
33 (require 'sasl)
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
34 (require 'ntlm)
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
35
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
36 (defconst sasl-ntlm-steps
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
37 '(ignore ;nothing to do before making
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
38 sasl-ntlm-request ;authentication request
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
39 sasl-ntlm-response) ;response to challenge
96406
ce3cca778d10 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 94677
diff changeset
40 "A list of functions to be called in sequence for the NTLM
ce3cca778d10 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 94677
diff changeset
41 authentication steps. They are called by `sasl-next-step'.")
86996
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
42
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
43 (defun sasl-ntlm-request (client step)
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
44 "SASL step function to generate a NTLM authentication request to the server.
96406
ce3cca778d10 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 94677
diff changeset
45 Called from `sasl-next-step'.
86996
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
46 CLIENT is a vector [mechanism user service server sasl-client-properties]
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
47 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
48 (let ((user (sasl-client-name client)))
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
49 (ntlm-build-auth-request user)))
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
50
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
51 (defun sasl-ntlm-response (client step)
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
52 "SASL step function to generate a NTLM response against the server
96406
ce3cca778d10 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 94677
diff changeset
53 challenge stored in the 2nd element of STEP. Called from `sasl-next-step'."
86996
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
54 (let* ((user (sasl-client-name client))
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
55 (passphrase
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
56 (sasl-read-passphrase (format "NTLM passphrase for %s: " user)))
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
57 (challenge (sasl-step-data step)))
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
58 (ntlm-build-auth-response challenge user
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
59 (ntlm-get-password-hashes passphrase))))
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
60
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
61 (put 'sasl-ntlm 'sasl-mechanism
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
62 (sasl-make-mechanism "NTLM" sasl-ntlm-steps))
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
63
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
64 (provide 'sasl-ntlm)
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
65
ccfc70c9b588 Move here from ../gnus.
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
66 ;;; sasl-ntlm.el ends here