X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fntlm.el;h=517e97efe6cc7e8db27603231eeb41f96b3855ed;hb=0007de6d40db139c025a8b2cba9ef04ee4837608;hp=656d090a3d1c7fdf6cd95641ce494e9c1ffd39bf;hpb=099b95de1712551a867c9a895d42cdafbd3d5506;p=gnus diff --git a/lisp/ntlm.el b/lisp/ntlm.el index 656d090a3..517e97efe 100644 --- a/lisp/ntlm.el +++ b/lisp/ntlm.el @@ -1,34 +1,35 @@ ;;; ntlm.el --- NTLM (NT LanManager) authentication support -;; Copyright (C) 2001 Taro Kawagishi +;; Copyright (C) 2001, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + ;; Author: Taro Kawagishi ;; Keywords: NTLM, SASL ;; Version: 1.00 ;; Created: February 2001 -;; This program is free software; you can redistribute it and/or modify +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. -;; -;; This program is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. -;; + ;; You should have received a copy of the GNU General Public License -;; along with this program; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. +;; along with GNU Emacs. If not, see . ;;; Commentary: ;; This library is a direct translation of the Samba release 2.2.0 ;; implementation of Windows NT and LanManager compatible password ;; encryption. -;; +;; ;; Interface functions: -;; +;; ;; ntlm-build-auth-request ;; This will return a binary string, which should be used in the ;; base64 encoded form and it is the caller's responsibility to encode @@ -39,7 +40,7 @@ ;; (which will be a binary string) as the first argument and to ;; encode the returned string with base64. The second argument user ;; should be given in user@domain format. -;; +;; ;; ntlm-get-password-hashes ;; ;; @@ -105,13 +106,19 @@ is not given." domain ;bufer field ))) +(eval-when-compile + (defmacro ntlm-string-as-unibyte (string) + (if (fboundp 'string-as-unibyte) + `(string-as-unibyte ,string) + string))) + (defun ntlm-build-auth-response (challenge user password-hashes) "Return the response string to a challenge string CHALLENGE given by the NTLM based server for the user USER and the password hash list PASSWORD-HASHES. NTLM uses two hash values which are represented by PASSWORD-HASHES. PASSWORD-HASHES should be a return value of (list (ntlm-smb-passwd-hash password) (ntlm-md4hash password))" - (let* ((rchallenge (string-as-unibyte challenge)) + (let* ((rchallenge (ntlm-string-as-unibyte challenge)) ;; get fields within challenge struct ;;(ident (substring rchallenge 0 8)) ;ident, 8 bytes ;;(msgType (substring rchallenge 8 12)) ;msgType, 4 bytes