commit 9130f93fa6e81226d6ef41c664eac83e2a766af1
parent b65fff28e784ae331e3b5fb8a4c4a85bd5c9b311
Author: ukai <ukai>
Date: Tue, 25 Dec 2001 18:14:59 +0000
[w3m-dev 02732] fix Debian Bug#126381 - Passwords entered for HTTPS are used for HTTP
From: Kiyokazu SUTO <suto@ks-and-ks.ne.jp>
Diffstat:
6 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,18 @@
+2001-12-26 Kiyokazu SUTO <suto@ks-and-ks.ne.jp>
+
+ * [w3m-dev 02732] fix Debian Bug#126381
+ - Passwords entered for HTTPS are used for HTTP
+ * etc.c (find_auth): add port arg
+ * etc.c (find_auth_cookie): add port arg
+ * etc.c (add_auth_cookie): add port arg
+ * file.c (getAuthCookie): find_auth_cookie(host, port, realm)
+ * file.c (loadGeneralFile): add_auth_cookie(host, port, realm, ss)
+ * fm.h (struct auth_cookie): add port
+ * ftp.c (openFTP): find_auth_cookie(host, port, user)
+ * ftp.c (openFTP): add_auth_cookie(host, port, user, pwd)
+ * proto.h (find_auth_cookie): add port
+ * proto.h (add_auth_cookie): add port
+
2001-12-26 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 02729]
diff --git a/etc.c b/etc.c
@@ -888,39 +888,40 @@ correct_irrtag(int status)
/* authentication */
struct auth_cookie *
-find_auth(char *host, char *realm)
+find_auth(char *host, int port, char *realm)
{
struct auth_cookie *p;
for (p = Auth_cookie; p != NULL; p = p->next) {
if (!Strcasecmp_charp(p->host, host) &&
- !Strcasecmp_charp(p->realm, realm))
+ p->port == port && !Strcasecmp_charp(p->realm, realm))
return p;
}
return NULL;
}
Str
-find_auth_cookie(char *host, char *realm)
+find_auth_cookie(char *host, int port, char *realm)
{
- struct auth_cookie *p = find_auth(host, realm);
+ struct auth_cookie *p = find_auth(host, port, realm);
if (p)
return p->cookie;
return NULL;
}
void
-add_auth_cookie(char *host, char *realm, Str cookie)
+add_auth_cookie(char *host, int port, char *realm, Str cookie)
{
struct auth_cookie *p;
- p = find_auth(host, realm);
+ p = find_auth(host, port, realm);
if (p) {
p->cookie = cookie;
return;
}
p = New(struct auth_cookie);
p->host = Strnew_charp(host);
+ p->port = port;
p->realm = Strnew_charp(realm);
p->cookie = cookie;
p->next = Auth_cookie;
diff --git a/file.c b/file.c
@@ -901,7 +901,7 @@ getAuthCookie(char *realm, char *auth_header, TextList *extra_header,
* extra_header */
}
else
- ss = find_auth_cookie(pu->host, realm);
+ ss = find_auth_cookie(pu->host, pu->port, realm);
if (ss == NULL) {
/* input username and password */
sleep(2);
@@ -1203,7 +1203,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
}
if (add_auth_cookie_flag)
/* If authorization is required and passed */
- add_auth_cookie(pu.host, realm->ptr, ss);
+ add_auth_cookie(pu.host, pu.port, realm->ptr, ss);
if (status == HTST_CONNECT) {
of = &f;
goto load_doc;
diff --git a/fm.h b/fm.h
@@ -537,6 +537,7 @@ struct html_feed_environ {
struct auth_cookie {
Str host;
+ int port;
Str realm;
Str cookie;
struct auth_cookie *next;
diff --git a/ftp.c b/ftp.c
@@ -420,7 +420,7 @@ openFTP(ParsedURL *pu)
if (pu->pass)
pass = pu->pass;
else if (pu->user) {
- pwd = find_auth_cookie(pu->host, pu->user);
+ pwd = find_auth_cookie(pu->host, pu->port, pu->user);
if (pwd == NULL) {
if (fmInitialized) {
term_raw();
@@ -450,7 +450,7 @@ openFTP(ParsedURL *pu)
if (FtpError(s))
return NULL;
if (add_auth_cookie_flag)
- add_auth_cookie(pu->host, pu->user, pwd);
+ add_auth_cookie(pu->host, pu->port, pu->user, pwd);
if (pu->file == NULL || *pu->file == '\0')
goto ftp_dir;
else
diff --git a/proto.h b/proto.h
@@ -470,8 +470,8 @@ extern Buffer *dirBuffer(char *dirname);
extern void set_environ(char *var, char *value);
extern FILE *localcgi_post(char *, char *, FormList *, char *);
extern FILE *localcgi_get(char *, char *, char *);
-extern Str find_auth_cookie(char *host, char *realm);
-extern void add_auth_cookie(char *host, char *realm, Str cookie);
+extern Str find_auth_cookie(char *host, int port, char *realm);
+extern void add_auth_cookie(char *host, int port, char *realm, Str cookie);
extern char *last_modified(Buffer *buf);
extern Str romanNumeral(int n);
extern Str romanAlphabet(int n);