[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 50656c4 07/32: url-http-ntlm.el: Reindent whole file
From: |
Thomas Fitzsimmons |
Subject: |
[elpa] master 50656c4 07/32: url-http-ntlm.el: Reindent whole file |
Date: |
Thu, 18 Feb 2016 03:27:10 +0000 |
branch: master
commit 50656c471b1c20bd72e7998216f9167619de7b4d
Author: Thomas Fitzsimmons <address@hidden>
Commit: Thomas Fitzsimmons <address@hidden>
url-http-ntlm.el: Reindent whole file
---
packages/url-http-ntlm/url-http-ntlm.el | 140 ++++++++++++++++---------------
1 files changed, 71 insertions(+), 69 deletions(-)
diff --git a/packages/url-http-ntlm/url-http-ntlm.el
b/packages/url-http-ntlm/url-http-ntlm.el
index a98f462..87f7521 100644
--- a/packages/url-http-ntlm/url-http-ntlm.el
+++ b/packages/url-http-ntlm/url-http-ntlm.el
@@ -76,31 +76,33 @@ the server's last response. These are used by
;; NTLM Type 1 message: the request
(:request
(destructuring-bind (&optional server user hash)
- (url-http-ntlm-authorisation url)
- (when server
- (url-http-ntlm-string (ntlm-build-auth-request user server)))))
+ (url-http-ntlm-authorisation url)
+ (when server
+ (url-http-ntlm-string
+ (ntlm-build-auth-request user server)))))
;; NTLM Type 3 message: the response
(:response
(let ((challenge (url-http-ntlm-get-challenge)))
- (destructuring-bind (server user hash)
- (url-http-ntlm-authorisation url)
- (url-http-ntlm-string (ntlm-build-auth-response challenge
- user
- hash)))))
+ (destructuring-bind (server user hash)
+ (url-http-ntlm-authorisation url)
+ (url-http-ntlm-string
+ (ntlm-build-auth-response challenge
+ user
+ hash)))))
(:error
(url-http-ntlm-authorisation url :clear)))))
(defun url-ntlm-ensure-keepalive ()
"Report an error if `url-http-attempt-keepalives' is not set."
(assert url-http-attempt-keepalives
- nil
- (concat "NTLM authentication won't work unless"
- " `url-http-attempt-keepalives' is set!")))
+ nil
+ (concat "NTLM authentication won't work unless"
+ " `url-http-attempt-keepalives' is set!")))
(defun url-ntlm-clean-headers ()
"Remove Authorization element from `url-http-extra-headers' alist."
(setq url-http-extra-headers
- (url-http-ntlm-rmssoc "Authorization" url-http-extra-headers)))
+ (url-http-ntlm-rmssoc "Authorization" url-http-extra-headers)))
(defvar url-ntlm-last-args nil
"Stores the last ARGS argument to `url-ntlm-get-stage' and the return value.
@@ -119,29 +121,29 @@ nil), and then twice for every stage of the handshake:
the first
time PROMPT is nil, the second, t; ARGS contains the server
response's \"WWW-Authenticate\" header, munged by
`url-parse-args'."
- (let* ((response-rxp "^NTLM TlRMTVNTUAADAAA")
- (challenge-rxp "^TLRMTVNTUAACAAA")
- (auth-header (assoc "Authorization" url-http-extra-headers))
- (case-fold-search t)
- stage)
+ (let* ((response-rxp "^NTLM TlRMTVNTUAADAAA")
+ (challenge-rxp "^TLRMTVNTUAACAAA")
+ (auth-header (assoc "Authorization" url-http-extra-headers))
+ (case-fold-search t)
+ stage)
(if (eq args (car url-ntlm-last-args))
- ;; multiple calls, return the same argument we returned last time
- (cdr url-ntlm-last-args)
- (let ((stage
- (cond ((and auth-header (string-match response-rxp
- (cdr auth-header)))
- :error)
- ((and (= (length args) 2)
- (destructuring-bind (challenge ntlm) args
- (and (string-equal "ntlm" (car ntlm))
- (string-match challenge-rxp
- (car challenge)))))
- :response)
- (t
- :request))))
- (url-ntlm-clean-headers)
- (setq url-ntlm-last-args (cons args stage))
- stage))))
+ ;; multiple calls, return the same argument we returned last time
+ (cdr url-ntlm-last-args)
+ (let ((stage
+ (cond ((and auth-header (string-match response-rxp
+ (cdr auth-header)))
+ :error)
+ ((and (= (length args) 2)
+ (destructuring-bind (challenge ntlm) args
+ (and (string-equal "ntlm" (car ntlm))
+ (string-match challenge-rxp
+ (car challenge)))))
+ :response)
+ (t
+ :request))))
+ (url-ntlm-clean-headers)
+ (setq url-ntlm-last-args (cons args stage))
+ stage))))
(defun url-http-ntlm-authorisation (url &optional clear)
"Get or clear NTLM authentication details for URL.
@@ -154,40 +156,40 @@ stored credentials are not affected.
Note that for any server, only one user and password is ever
stored."
- (let* ((href (if (stringp url)
- (url-generic-parse-url url)
- url))
- (server (url-host href))
- (user (url-user href))
- (pass (url-password href))
- (stored (assoc server url-http-ntlm-auth-storage))
- (both (and user pass)))
+ (let* ((href (if (stringp url)
+ (url-generic-parse-url url)
+ url))
+ (server (url-host href))
+ (user (url-user href))
+ (pass (url-password href))
+ (stored (assoc server url-http-ntlm-auth-storage))
+ (both (and user pass)))
(if clear
- ;; clear
- (unless both
- (setq url-http-ntlm-auth-storage
- (url-http-ntlm-rmssoc server url-http-ntlm-auth-storage))
- nil)
- ;; get
- (if (or both
- (and stored user (not (equal user (second stored))))
- (not stored))
- (let* ((user* (if both
- user
- (read-string (url-auth-user-prompt url realm)
- (or user (user-real-login-name)))))
- (pass* (if both
- pass
- (read-passwd "Password: ")))
- (entry `(,server . (,user*
- ,(ntlm-get-password-hashes pass*)))))
- (unless both
- (setq url-http-ntlm-auth-storage
- (cons entry
- (url-http-ntlm-rmssoc server
-
url-http-ntlm-auth-storage))))
- entry)
- stored))))
+ ;; clear
+ (unless both
+ (setq url-http-ntlm-auth-storage
+ (url-http-ntlm-rmssoc server url-http-ntlm-auth-storage))
+ nil)
+ ;; get
+ (if (or both
+ (and stored user (not (equal user (second stored))))
+ (not stored))
+ (let* ((user* (if both
+ user
+ (read-string (url-auth-user-prompt url realm)
+ (or user (user-real-login-name)))))
+ (pass* (if both
+ pass
+ (read-passwd "Password: ")))
+ (entry `(,server . (,user*
+ ,(ntlm-get-password-hashes pass*)))))
+ (unless both
+ (setq url-http-ntlm-auth-storage
+ (cons entry
+ (url-http-ntlm-rmssoc server
+ url-http-ntlm-auth-storage))))
+ entry)
+ stored))))
(defun url-http-ntlm-get-challenge ()
"Return the NTLM Type-2 message in the WWW-Authenticate header, if present."
@@ -195,8 +197,8 @@ stored."
(mail-narrow-to-head)
(let ((www-authenticate (mail-fetch-field "www-authenticate")))
(when (string-match "NTLM\\s-+\\(\\S-+\\)"
- www-authenticate)
- (base64-decode-string (match-string 1 www-authenticate))))))
+ www-authenticate)
+ (base64-decode-string (match-string 1 www-authenticate))))))
(defun url-http-ntlm-rmssoc (key alist)
"Remove all elements whose `car' match KEY from ALIST."
- [elpa] master updated (1fc71ba -> 6682a04), Thomas Fitzsimmons, 2016/02/17
- [elpa] master ecee87e 01/32: url-http-ntlm: New package, Thomas Fitzsimmons, 2016/02/17
- [elpa] master 087d353 02/32: url-http-ntlm: Remove trailing whitespace, Thomas Fitzsimmons, 2016/02/17
- [elpa] master 0bbbe59 03/32: url-http-ntlm.el: Adjust blank lines, Thomas Fitzsimmons, 2016/02/17
- [elpa] master 9e52a39 04/32: url-http-ntlm: Wrap lines at column 80, Thomas Fitzsimmons, 2016/02/17
- [elpa] master 0799c67 05/32: url-http-ntlm: Fix checkdoc errors, Thomas Fitzsimmons, 2016/02/17
- [elpa] master 8482b90 06/32: url-http-ntlm: Remove blank comment lines, Thomas Fitzsimmons, 2016/02/17
- [elpa] master 50656c4 07/32: url-http-ntlm.el: Reindent whole file,
Thomas Fitzsimmons <=
- [elpa] master cec4982 08/32: url-http-ntlm.el: Update copyright owner and years, Thomas Fitzsimmons, 2016/02/17
- [elpa] master 2d39d5d 09/32: url-http-ntlm.el: Add maintainer header, Thomas Fitzsimmons, 2016/02/17
- [elpa] master 3033c48 10/32: url-http-ntlm.el: Update installation instructions, Thomas Fitzsimmons, 2016/02/17
- [elpa] master 19e93aa 11/32: url-http-ntlm.el: Update author's email address, Thomas Fitzsimmons, 2016/02/17
- [elpa] master 6fb3a70 12/32: url-http-ntlm: Use url-http-ntlm namespace consistently, Thomas Fitzsimmons, 2016/02/17
- [elpa] master 4128f4f 13/32: url-http-ntlm.el (url-ntlm-auth): Move defun near end of file, Thomas Fitzsimmons, 2016/02/17
- [elpa] master 55e7f42 14/32: url-http-ntlm.el (url-http-ntlm-last-args): Group defvar with others, Thomas Fitzsimmons, 2016/02/17
- [elpa] master d251ed3 15/32: url-http-ntlm: Use double dash naming convention for private symbols, Thomas Fitzsimmons, 2016/02/17
- [elpa] master 47e1c41 16/32: url-http-ntlm.el: Add comment headings, Thomas Fitzsimmons, 2016/02/17
- [elpa] master 8ce1ae7 17/32: url-http-ntlm: Port to cl-lib, Thomas Fitzsimmons, 2016/02/17