diff options
| author | Chong Yidong | 2008-02-25 16:19:08 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-02-25 16:19:08 +0000 |
| commit | 4992c1db16fba951175fa072ba696d04f072b8b9 (patch) | |
| tree | 4fb065a93e2279806324bb0ca8933787feb7196f | |
| parent | d5cc801fe5ed50d688e111391ee2d04ef468f509 (diff) | |
| download | emacs-4992c1db16fba951175fa072ba696d04f072b8b9.tar.gz emacs-4992c1db16fba951175fa072ba696d04f072b8b9.zip | |
(url-digest-auth): Don't show prompt if authentication succeeded on
the previous pass. Don't pass "opaque" value if none is presented by
the server.
| -rw-r--r-- | lisp/url/url-auth.el | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/lisp/url/url-auth.el b/lisp/url/url-auth.el index 10b968a68d8..adf1a5fabcb 100644 --- a/lisp/url/url-auth.el +++ b/lisp/url/url-auth.el | |||
| @@ -158,7 +158,7 @@ instead of hostname:portnum." | |||
| 158 | (setq file (cond | 158 | (setq file (cond |
| 159 | (realm realm) | 159 | (realm realm) |
| 160 | ((string-match "/$" file) file) | 160 | ((string-match "/$" file) file) |
| 161 | (t (url-file-directory file))) | 161 | (t (url-basepath file))) |
| 162 | server (format "%s:%d" server port) | 162 | server (format "%s:%d" server port) |
| 163 | byserv (cdr-safe (assoc server url-digest-auth-storage))) | 163 | byserv (cdr-safe (assoc server url-digest-auth-storage))) |
| 164 | (cond | 164 | (cond |
| @@ -188,31 +188,40 @@ instead of hostname:portnum." | |||
| 188 | (string= data (substring file 0 (length data))))) | 188 | (string= data (substring file 0 (length data))))) |
| 189 | (setq retval (cdr (car byserv)))) | 189 | (setq retval (cdr (car byserv)))) |
| 190 | (setq byserv (cdr byserv)))) | 190 | (setq byserv (cdr byserv)))) |
| 191 | (if (or (and (not retval) prompt) overwrite) | 191 | (if overwrite |
| 192 | (progn | 192 | (if (and (not retval) prompt) |
| 193 | (setq user (read-string (url-auth-user-prompt url realm) | 193 | (setq user (read-string (url-auth-user-prompt url realm) |
| 194 | (user-real-login-name)) | 194 | (user-real-login-name)) |
| 195 | pass (read-passwd "Password: ") | 195 | pass (read-passwd "Password: ") |
| 196 | retval (setq retval | 196 | retval (setq retval |
| 197 | (cons user | 197 | (cons user |
| 198 | (url-digest-auth-create-key | 198 | (url-digest-auth-create-key |
| 199 | user pass realm | 199 | user pass realm |
| 200 | (or url-request-method "GET") | 200 | (or url-request-method "GET") |
| 201 | url))) | 201 | url))) |
| 202 | byserv (assoc server url-digest-auth-storage)) | 202 | byserv (assoc server url-digest-auth-storage)) |
| 203 | (setcdr byserv | 203 | (setcdr byserv |
| 204 | (cons (cons file retval) (cdr byserv)))))) | 204 | (cons (cons file retval) (cdr byserv)))))) |
| 205 | (t (setq retval nil))) | 205 | (t (setq retval nil))) |
| 206 | (if retval | 206 | (if retval |
| 207 | (let ((nonce (or (cdr-safe (assoc "nonce" args)) "nonegiven")) | 207 | (if (cdr-safe (assoc "opaque" args)) |
| 208 | (opaque (or (cdr-safe (assoc "opaque" args)) "nonegiven"))) | 208 | (let ((nonce (or (cdr-safe (assoc "nonce" args)) "nonegiven")) |
| 209 | (format | 209 | (opaque (cdr-safe (assoc "opaque" args)))) |
| 210 | (concat "Digest username=\"%s\", realm=\"%s\"," | 210 | (format |
| 211 | "nonce=\"%s\", uri=\"%s\"," | 211 | (concat "Digest username=\"%s\", realm=\"%s\"," |
| 212 | "response=\"%s\", opaque=\"%s\"") | 212 | "nonce=\"%s\", uri=\"%s\"," |
| 213 | (nth 0 retval) realm nonce (url-filename href) | 213 | "response=\"%s\", opaque=\"%s\"") |
| 214 | (md5 (concat (nth 1 retval) ":" nonce ":" | 214 | (nth 0 retval) realm nonce (url-filename href) |
| 215 | (nth 2 retval))) opaque)))))) | 215 | (md5 (concat (nth 1 retval) ":" nonce ":" |
| 216 | (nth 2 retval))) opaque)) | ||
| 217 | (let ((nonce (or (cdr-safe (assoc "nonce" args)) "nonegiven"))) | ||
| 218 | (format | ||
| 219 | (concat "Digest username=\"%s\", realm=\"%s\"," | ||
| 220 | "nonce=\"%s\", uri=\"%s\"," | ||
| 221 | "response=\"%s\"") | ||
| 222 | (nth 0 retval) realm nonce (url-filename href) | ||
| 223 | (md5 (concat (nth 1 retval) ":" nonce ":" | ||
| 224 | (nth 2 retval)))))))))) | ||
| 216 | 225 | ||
| 217 | (defvar url-registered-auth-schemes nil | 226 | (defvar url-registered-auth-schemes nil |
| 218 | "A list of the registered authorization schemes and various and sundry | 227 | "A list of the registered authorization schemes and various and sundry |