diff -urN ftpproxy-1.1.6/src/ftp.c ftpproxy-1.1.6+multi-line/src/ftp.c --- ftpproxy-1.1.6/src/ftp.c Wed Apr 24 12:14:06 2002 +++ ftpproxy-1.1.6+multi-line/src/ftp.c Sun Aug 11 12:14:07 2002 @@ -552,6 +552,7 @@ { int rc; char *p, buffer[300]; + int echo = 1; if (command != NULL && *command != 0) { if (parameter != NULL && *parameter != 0) @@ -570,9 +571,21 @@ } rc = strtol(line, &p, 10); + switch (rc) + { + case 331: + /* Don't send multi-line 331 password required + * response to the client. They will just confuse + * it when it immediately followed by 230 login + * successful response. + */ + echo = 0; + break; + } p = skip_ws(p); if (*p == '-') { - cfputs(x, line); + if (echo) + cfputs(x, line); while (1) { if (sfgets(x, line, size) == NULL) { if (debug != 2) @@ -591,7 +604,8 @@ break; } - cfputs(x, line); + if (echo) + cfputs(x, line); } } @@ -1387,7 +1401,8 @@ sfgets(x, line, sizeof(line)); - while (line[3] != ' ' && line[3] != 0) { + while (! isdigit(line[0]) || ! isdigit(line[1]) || + ! isdigit(line[2]) || line[3] != ' ' ) { if (sfgets(x, line, sizeof(line)) == NULL) { syslog(LOG_NOTICE, "-ERR: lost server while reading client greeting: ", x->server.name); exit (1);