[w3m-dev 04064] authentication

closes: Bug#:244029: w3m: HTTP basic authentication annoyance
* fm.h (auth_cookie): deleted
* proto.h (find_auth_cookie): deleted
	(add_auth_cookie): deleted
	(add_auth_user_passwd): added
	(invalidate_auth_user_passwd): added
* etc.c (auth_pass): add bad flag
		delete file
	(dir_under): deleted
	(add_auth_pass_entry): add override flag
		no need to check file
	(find_auth_pass_entry): delete file
		check bad flag
		check uname
	(find_auth_user_passwd): find by pu->user
	(add_auth_user_passwd): added
	(invalidate_auth_user_passwd): added
	(parsePasswd): add no override
		ignore file
	(find_auth): deleted
	(find_auth_cookie): deleted
	(dump_auth_cookie): deleted
	(add_auth_cookie): deleted
* file.c (getAuthCookie): add *uname, *pwd
		rewrite
	(loadGeneralFile): delete ss, add uname, pwd
		use add_auth_user_passwd instead of add_auth_cookie
* url.c (HTTPrequest): don't authorization here
		it should be done in getAuthCookie in loadGeneralFile
		through extra_header
* ftp.c (openFTPStream): add uname
		use find_auth_user_passwd instead of find_auth_cookie
		use add_auth_user_passwd instead of add_auth_cookie
This commit is contained in:
Fumitoshi UKAI
2004-04-16 18:47:18 +00:00
parent e4e1dd26a2
commit d02cc0c7de
7 changed files with 193 additions and 219 deletions

9
ftp.c
View File

@@ -1,4 +1,4 @@
/* $Id: ftp.c,v 1.34 2003/10/22 18:44:31 ukai Exp $ */
/* $Id: ftp.c,v 1.35 2004/04/16 18:47:19 ukai Exp $ */
#include <stdio.h>
#include <pwd.h>
#include <Str.h>
@@ -320,6 +320,7 @@ openFTPStream(ParsedURL *pu, URLFile *uf)
int status;
char *user = NULL;
char *pass = NULL;
Str uname = NULL;
Str pwd = NULL;
int add_auth_cookie_flag = FALSE;
char *realpathname = NULL;
@@ -328,7 +329,6 @@ openFTPStream(ParsedURL *pu, URLFile *uf)
return NULL;
if (pu->user == NULL && pu->pass == NULL) {
Str uname, pwd;
if (find_auth_user_passwd(pu, NULL, &uname, &pwd, 0)) {
if (uname)
user = uname->ptr;
@@ -361,7 +361,8 @@ openFTPStream(ParsedURL *pu, URLFile *uf)
else if (pu->pass)
pass = pu->pass;
else if (pu->user) {
pwd = find_auth_cookie(pu->host, pu->port, pu->file, pu->user);
pwd = NULL;
find_auth_user_passwd(pu, NULL, &uname, &pwd, 0);
if (pwd == NULL) {
if (fmInitialized) {
term_raw();
@@ -394,7 +395,7 @@ openFTPStream(ParsedURL *pu, URLFile *uf)
return NULL;
}
if (add_auth_cookie_flag)
add_auth_cookie(pu->host, pu->port, pu->file, pu->user, pwd);
add_auth_user_passwd(pu, NULL, uname, pwd, 0);
ftp_read:
ftp_command(&current_ftp, "TYPE", "I", &status);