diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-02-04 18:49:31 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-02-04 18:49:31 +0100 |
commit | daa643205f76da5cb3e899aba2a047fc2c6f1994 (patch) | |
tree | 8cb91a4c36f95151eac681da949dc5e9d7dc7044 /networking/ftpgetput.c | |
parent | 565af2322271984edf6eb533f90789e52e311848 (diff) | |
download | busybox-w32-daa643205f76da5cb3e899aba2a047fc2c6f1994.tar.gz busybox-w32-daa643205f76da5cb3e899aba2a047fc2c6f1994.tar.bz2 busybox-w32-daa643205f76da5cb3e899aba2a047fc2c6f1994.zip |
ftpgetput: preparations for ESPV support, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/ftpgetput.c')
-rw-r--r-- | networking/ftpgetput.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index e866a7754..3f98e07f3 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c | |||
@@ -174,24 +174,25 @@ For example, vsftp happily answers | |||
174 | 174 | ||
175 | TODO2: need to stop ignoring IP address in PASV response. | 175 | TODO2: need to stop ignoring IP address in PASV response. |
176 | */ | 176 | */ |
177 | //if (ftpcmd("EPSV", NULL) != 229) { | ||
178 | if (ftpcmd("PASV", NULL) != 227) { | ||
179 | ftp_die("PASV"); | ||
180 | } | ||
177 | 181 | ||
178 | if (ftpcmd("PASV", NULL) != 227) { | 182 | /* Response is "NNN garbageN1,N2,N3,N4,P1,P2[)garbage] |
179 | ftp_die("PASV"); | 183 | * Server's IP is N1.N2.N3.N4 (we ignore it) |
180 | } | 184 | * Server's port for data connection is P1*256+P2 */ |
181 | 185 | buf_ptr = strrchr(buf, ')'); | |
182 | /* Response is "NNN garbageN1,N2,N3,N4,P1,P2[)garbage] | 186 | if (buf_ptr) *buf_ptr = '\0'; |
183 | * Server's IP is N1.N2.N3.N4 (we ignore it) | ||
184 | * Server's port for data connection is P1*256+P2 */ | ||
185 | buf_ptr = strrchr(buf, ')'); | ||
186 | if (buf_ptr) *buf_ptr = '\0'; | ||
187 | 187 | ||
188 | buf_ptr = strrchr(buf, ','); | 188 | buf_ptr = strrchr(buf, ','); |
189 | *buf_ptr = '\0'; | 189 | *buf_ptr = '\0'; |
190 | port_num = xatoul_range(buf_ptr + 1, 0, 255); | 190 | port_num = xatoul_range(buf_ptr + 1, 0, 255); |
191 | 191 | ||
192 | buf_ptr = strrchr(buf, ','); | 192 | buf_ptr = strrchr(buf, ','); |
193 | *buf_ptr = '\0'; | 193 | *buf_ptr = '\0'; |
194 | port_num += xatoul_range(buf_ptr + 1, 0, 255) * 256; | 194 | port_num += xatoul_range(buf_ptr + 1, 0, 255) * 256; |
195 | //} | ||
195 | 196 | ||
196 | set_nport(&lsa->u.sa, htons(port_num)); | 197 | set_nport(&lsa->u.sa, htons(port_num)); |
197 | return xconnect_stream(lsa); | 198 | return xconnect_stream(lsa); |