Commit 7775bad2 authored by Stewart Brodie's avatar Stewart Brodie
Browse files

When authenticated logins fail, the module now regenerates the 401 HTTP...

When authenticated logins fail, the module now regenerates the 401 HTTP response to request valid login credentials instead of throwing its own error which leads applications to believe that the credentials were OK and that some other kind of error had occurred (and consequently led them to cache those failed credentials)

Version 0.30. Tagged as 'FTP-0_30'
parent 20383c77
/* (0.29)
/* (0.30)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 0.29
#define Module_MajorVersion_CMHG 0.30
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 07 Jul 1998
#define Module_Date_CMHG 31 Jul 1998
#define Module_MajorVersion "0.29"
#define Module_Version 29
#define Module_MajorVersion "0.30"
#define Module_Version 30
#define Module_MinorVersion ""
#define Module_Date "07 Jul 1998"
#define Module_Date "31 Jul 1998"
......@@ -1025,9 +1025,15 @@ static _kernel_oserror *ftp_got_mkdir_response(Session *s, _kernel_swi_regs *r)
s->server_code = s->response_code;
if (ftp_class(s->response_code) == ftp_OK) {
char *dir;
_kernel_oserror *e;
ftp_process_pwd_response(s, &dir);
e = ftp_start_client_pump_va(s, FTP_STATUS_ENDED, FTP_FORCE_DIR_HEADER,
dir, FTP_RENAME_2, NULL);
free(dir);
return e;
#if 0
return ftp_start_client_pump(s, FTP_STATUS_ENDED, FTP_OK_HEADER, "MD01");
#endif
}
return gen_error(s, s->response.data);
}
......@@ -1322,6 +1328,11 @@ static _kernel_oserror *ftp_got_pass_response(Session *s, _kernel_swi_regs *r)
(void) r;
switch (ftp_class(s->response_code)) {
default:
if (s->user != NULL) {
s->cacheable = 0;
return ftp_start_client_pump_va(s, FTP_STATUS_ENDED, FTP_AUTH_REQUIRED,
s->user, FTP_AUTH_REQD_2, s->user, FTP_AUTH_REQD_3, NULL);
}
return gen_error(s, s->response.data);
case ftp_PENDING:
return vcommands_send(s, FTP_ACCT_RESP_RECEIVED, "ACCT", s->acct ? s->acct : "FTPUser@");
......
......@@ -32,10 +32,13 @@
#define FTP_AUTH_REQUIRED "HTTP/1.0 401 Need FTP authentication\r\n" \
"WWW-Authenticate: basic realm=\""
#define FTP_AUTH_REQD_2 "\"\r\nContent-Type: text/html\r\n\r\n<html><title>Authentication</title>"\
#define FTP_AUTH_REQD_2 "\"\r\n" \
"Content-Type: text/html\r\n\r\n" \
"<html><title>FTP Authentication</title>" \
"<body>You need to supply a password in order to login as \""
#define FTP_AUTH_REQD_3 "\"to this machine.</body>"
#define FTP_RENAME_2 "\r\nContent-type: text/plain\r\n\r\nDirectory created OK"
#define DOC_TYPE_DECLARATION "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment