[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/url-http-ntlm 94b495c 07/42: url-http-ntlm.el: Reindent
From: |
Stefan Monnier |
Subject: |
[elpa] externals/url-http-ntlm 94b495c 07/42: url-http-ntlm.el: Reindent whole file |
Date: |
Sat, 28 Nov 2020 17:19:43 -0500 (EST) |
branch: externals/url-http-ntlm
commit 94b495cfed72674fcbaa28b30d12c7792244be1c
Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Commit: Thomas Fitzsimmons <fitzsim@fitzsim.org>
url-http-ntlm.el: Reindent whole file
---
url-http-ntlm.el | 140 ++++++++++++++++++++++++++++---------------------------
1 file changed, 71 insertions(+), 69 deletions(-)
diff --git a/url-http-ntlm.el b/url-http-ntlm.el
index a98f462..87f7521 100644
--- a/url-http-ntlm.el
+++ b/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] branch externals/url-http-ntlm created (now f5276f1), Stefan Monnier, 2020/11/28
- [elpa] externals/url-http-ntlm c780a2b 03/42: url-http-ntlm.el: Adjust blank lines, Stefan Monnier, 2020/11/28
- [elpa] externals/url-http-ntlm 94b495c 07/42: url-http-ntlm.el: Reindent whole file,
Stefan Monnier <=
- [elpa] externals/url-http-ntlm 33a3941 09/42: url-http-ntlm.el: Add maintainer header, Stefan Monnier, 2020/11/28
- [elpa] externals/url-http-ntlm aeddc9e 10/42: url-http-ntlm.el: Update installation instructions, Stefan Monnier, 2020/11/28
- [elpa] externals/url-http-ntlm f69bb6b 06/42: url-http-ntlm: Remove blank comment lines, Stefan Monnier, 2020/11/28
- [elpa] externals/url-http-ntlm 8cefb06 11/42: url-http-ntlm.el: Update author's email address, Stefan Monnier, 2020/11/28
- [elpa] externals/url-http-ntlm 21b0f82 17/42: url-http-ntlm: Port to cl-lib, Stefan Monnier, 2020/11/28
- [elpa] externals/url-http-ntlm 516cd35 24/42: url-http-ntlm.el: Add home page header, Stefan Monnier, 2020/11/28
- [elpa] externals/url-http-ntlm a2cc6c2 23/42: url-http-ntlm: Add auth-source support, Stefan Monnier, 2020/11/28
- [elpa] externals/url-http-ntlm 8efb977 26/42: url-http-ntlm.el: Require ntlm 2.0.0, Stefan Monnier, 2020/11/28
- [elpa] externals/url-http-ntlm 4c8edce 20/42: url-http-ntlm: Remove limit of one username and password per server, Stefan Monnier, 2020/11/28
- [elpa] externals/url-http-ntlm de4cfea 18/42: url-http-ntlm: Override url-http-parse-headers redirect handling, Stefan Monnier, 2020/11/28