diff --git a/src/ftp.c b/src/ftp.c index a2c71a2..a9d97d7 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -36,7 +36,7 @@ int ftplogin(struct clientparam *param, char *nbuf, int *innbuf) { if(i < 3) return 706; buf[i] = 0; if(atoi(buf)/100 != 2) { - *innbuf = i; + if(innbuf)*innbuf = i; return 702; } sprintf(buf, "USER %.128s\r\n", param->extusername?param->extusername:(unsigned char *)"anonymous"); @@ -75,6 +75,9 @@ int ftplogin(struct clientparam *param, char *nbuf, int *innbuf) { return 701; } } + /* USER answered at once, logged in (230) or refused: that answer is + the client's, waiting for one to its PASS */ + else if(innbuf)*innbuf = i; if(res != 2) { return 700; }