[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>
This commit is contained in:
Fumitoshi UKAI
2002-02-19 15:50:17 +00:00
parent 8ebc9bc1fb
commit afbe346d3c
7 changed files with 77 additions and 27 deletions

19
etc.c
View File

@@ -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;