From 2c0439307794d3722afd4f04030c04777c4f6fe8 Mon Sep 17 00:00:00 2001 From: ume Date: Sun, 17 Sep 2000 16:44:51 +0000 Subject: [PATCH] cope with the following reply on PASV (without paren). need more tests. 227 Entering Passive Mode x,x,x,x,x,x,x Obtained from: KAME (1.8->1.9) --- usr.sbin/faithd/ftp.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/usr.sbin/faithd/ftp.c b/usr.sbin/faithd/ftp.c index 53f94f120382..e4838eb6b9e2 100644 --- a/usr.sbin/faithd/ftp.c +++ b/usr.sbin/faithd/ftp.c @@ -449,7 +449,10 @@ ftp_copyresult(int src, int dst, enum state state) #endif case LPSV: case EPSV: - /* expecting "227 Entering Passive Mode (x,x,x,x,x,x,x)" */ + /* + * expecting "227 Entering Passive Mode (x,x,x,x,x,x,x)" + * (in some cases result comes without paren) + */ if (code != 227) { passivefail0: close(wport6); @@ -469,11 +472,12 @@ ftp_copyresult(int src, int dst, enum state state) * PASV result -> LPSV/EPSV result */ p = param; - while (*p && *p != '(') + while (*p && *p != '(' && !isdigit(*p)) /*)*/ p++; if (!*p) goto passivefail0; /*XXX*/ - p++; + if (*p == '(') /*)*/ + p++; n = sscanf(p, "%u,%u,%u,%u,%u,%u", &ho[0], &ho[1], &ho[2], &ho[3], &po[0], &po[1]); if (n != 6) @@ -595,7 +599,7 @@ ftp_copyresult(int src, int dst, enum state state) * EPSV result -> PORT result */ p = param; - while (*p && *p != '(') + while (*p && *p != '(') /*)*/ p++; if (!*p) goto passivefail1; /*XXX*/