[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GSSFTP client doesn't follow RFC.
I was a bit off in my last message... I just kind of skimmed through
the relevant material, since I was so excited to see that it wasn't
my bug. :-) The problem only comes up when parsing a 63? response,
since otherwise the 'isdigit()' check above would weed these out...
With the secure responses, though, the reply code gets changed from
underneath that check, and things fall apart.
I've attached a better patch that should actually make you more
rfc959 compliant, in addition to fixing the rfc2228 bug.
--aidan
--- ftp.c Sun Oct 8 09:15:33 2000
+++ ftp.c Sat Nov 24 23:48:00 2001
@@ -312,6 +312,7 @@
int c;
struct sigaction sa, osa;
char buf[1024];
+ int reply_code;
sigemptyset (&sa.sa_mask);
sa.sa_flags = 0;
@@ -320,6 +321,7 @@
p = buf;
+ reply_code = 0;
while (1) {
c = getc (cin);
switch (c) {
@@ -349,14 +351,17 @@
if(isdigit(buf[0])){
sscanf(buf, "%d", &code);
if(code == 631){
+ code = 0;
sec_read_msg(buf, prot_safe);
sscanf(buf, "%d", &code);
lead_string = "S:";
} else if(code == 632){
+ code = 0;
sec_read_msg(buf, prot_private);
sscanf(buf, "%d", &code);
lead_string = "P:";
}else if(code == 633){
+ code = 0;
sec_read_msg(buf, prot_confidential);
sscanf(buf, "%d", &code);
lead_string = "C:";
@@ -364,9 +369,11 @@
lead_string = "!!";
else
lead_string = "";
+ if (code != 0 && reply_code == 0)
+ reply_code = code;
if (verbose > 0 || (verbose > -1 && code > 499))
fprintf (stdout, "%s%s\n", lead_string, buf);
- if (buf[3] == ' ') {
+ if (code == reply_code && buf[3] == ' ') {
strcpy (reply_string, buf);
if (code >= 200)
cpend = 0;