summaryrefslogtreecommitdiff
path: root/libexec/ftp-proxy/ftp-proxy.c
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2001-12-14 18:12:42 +0000
committerBob Beck <beck@cvs.openbsd.org>2001-12-14 18:12:42 +0000
commitfea42bb0b4cb067cafb04a874c76531607f3db71 (patch)
treec3b7fda711413fade1ddf3337e874fd357faf0cf /libexec/ftp-proxy/ftp-proxy.c
parent6e8c39caf1fd62f9d6bdaeb5c2bc996118dce21d (diff)
RFC 959 wasn't clear about what happens around a PASV reply, and in
fact RFC 1123 does say that it may not contain parenthesis, and you just have to look at the end of the line. Tholo managed to find a TOPS20 ftp server (toad.xkl.com) that doesn't put parens around the reply - This fixes it so it will handle either case.
Diffstat (limited to 'libexec/ftp-proxy/ftp-proxy.c')
-rw-r--r--libexec/ftp-proxy/ftp-proxy.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libexec/ftp-proxy/ftp-proxy.c b/libexec/ftp-proxy/ftp-proxy.c
index b603163016d..90e83b5886c 100644
--- a/libexec/ftp-proxy/ftp-proxy.c
+++ b/libexec/ftp-proxy/ftp-proxy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftp-proxy.c,v 1.17 2001/10/10 15:32:39 beck Exp $ */
+/* $OpenBSD: ftp-proxy.c,v 1.18 2001/12/14 18:12:41 beck Exp $ */
/*
* Copyright (c) 1996-2001
@@ -889,15 +889,18 @@ do_server_reply(struct csiob *server, struct csiob *client)
tailptr = strchr((char *)server->line_buffer, '(');
if (tailptr == NULL) {
- syslog(LOG_NOTICE, "malformed 227 reply");
- exit(EX_DATAERR);
+ tailptr = strrchr((char *)server->line_buffer, ' ');
+ if (tailptr == NULL) {
+ syslog(LOG_NOTICE, "malformed 227 reply");
+ exit(EX_DATAERR);
+ }
}
+ tailptr++; /* skip past space or ( */
byte_number = 0;
values[0] = 0;
-
- i = sscanf(tailptr, "(%u,%u,%u,%u,%u,%u)", &values[0],
+ i = sscanf(tailptr, "%u,%u,%u,%u,%u,%u", &values[0],
&values[1], &values[2], &values[3], &values[4],
&values[5]);
if (i != 6) {