From 4871b974c01779406660c67d76fdb1df4c632b1f Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Mon, 26 Oct 2026 17:39:59 +0300 Subject: [PATCH] ftppr: the server's answer to USER reaches the client (#1284) A server which logs in on USER alone (230, anonymous FTP often does) or refuses it had its answer read but not handed back: ftplogin() gave the length of what it read only for the answer to PASS. The client, told 331 by ftppr and waiting for the answer to its PASS, waited until the time out. The answer to USER is the client's now when there is no PASS. Co-Authored-By: Claude Opus 5.5 --- src/ftp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; }