diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-02-19 15:50:17 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-02-19 15:50:17 +0000 |
commit | afbe346d3ca5179817c1fc7573b15ea89695bab2 (patch) | |
tree | 4992af52f916ace73af961633ad07c64ac52ddd9 /etc.c | |
parent | [w3m-dev 03058] mailer (diff) | |
download | w3m-afbe346d3ca5179817c1fc7573b15ea89695bab2.tar.gz w3m-afbe346d3ca5179817c1fc7573b15ea89695bab2.zip |
[w3m-dev 03057] Re: Bug#134350: w3m: Forgets (http auth) login information upon reload (or almost anything else)
* etc.c (find_auth): add `file'
check file as well
* etc.c (find_auth_cookie): add `file'
* etc.c (add_auth_cookie): add `file'
* file.c (AuthBasicCred): add "Basic "
* file.c (AuthDigestCred): add "Digest "
* file.c (getAuthCookie): if h_auth == NULL, get recorded cookie
* file.c (get_auth_cookie): get recorded cookie
* file.c (loadGeneralFile): don't clear add_auth_cookie_flag
by redirection
add_auth_cookie if authorization is required and passed
* fm.h (auth_cookie): add file
* ftp.c (openFTP): follow change auth_cookie
* proto.h (get_auth_cookie): added
* proto.h (find_auth_cookie): add `file'
* proto.h (add_auth_cookie): add `file'
* url.c (openURL): get_auth_cookie
From: Fumitoshi UKAI <ukai@debian.or.jp>
Diffstat (limited to 'etc.c')
-rw-r--r-- | etc.c | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -1,4 +1,4 @@ -/* $Id: etc.c,v 1.18 2002/01/31 17:54:50 ukai Exp $ */ +/* $Id: etc.c,v 1.19 2002/02/19 15:50:18 ukai Exp $ */ #include "fm.h" #include <pwd.h> #include "myctype.h" @@ -888,40 +888,45 @@ correct_irrtag(int status) /* authentication */ struct auth_cookie * -find_auth(char *host, int port, char *realm) +find_auth(char *host, int port, char *file, char *realm) { struct auth_cookie *p; for (p = Auth_cookie; p != NULL; p = p->next) { if (!Strcasecmp_charp(p->host, host) && - p->port == port && !Strcasecmp_charp(p->realm, realm)) + p->port == port && + ((realm && !Strcasecmp_charp(p->realm, realm)) || + (p->file && file && !Strcasecmp_charp(p->file, file)))) return p; } return NULL; } Str -find_auth_cookie(char *host, int port, char *realm) +find_auth_cookie(char *host, int port, char *file, char *realm) { - struct auth_cookie *p = find_auth(host, port, realm); + struct auth_cookie *p = find_auth(host, port, file, realm); if (p) return p->cookie; return NULL; } void -add_auth_cookie(char *host, int port, char *realm, Str cookie) +add_auth_cookie(char *host, int port, char *file, char *realm, Str cookie) { struct auth_cookie *p; - p = find_auth(host, port, realm); + p = find_auth(host, port, file, realm); if (p) { + if (realm && p->realm == NULL) + p->realm = Strnew_charp(realm); p->cookie = cookie; return; } p = New(struct auth_cookie); p->host = Strnew_charp(host); p->port = port; + p->file = file ? Strnew_charp(file) : NULL; p->realm = Strnew_charp(realm); p->cookie = cookie; p->next = Auth_cookie; |