diff options
author | foobar <sniper@php.net> | 2000-08-10 21:13:08 +0000 |
---|---|---|
committer | foobar <sniper@php.net> | 2000-08-10 21:13:08 +0000 |
commit | d6f2f2c3965c0ba87d02e09f9d43b17204eeaa98 (patch) | |
tree | 0ff995d6506c64af326f624cefc9690206ef4129 /ext | |
parent | b283eec42a1737d9caa360dd267e013d731decf2 (diff) | |
download | php-git-d6f2f2c3965c0ba87d02e09f9d43b17204eeaa98.tar.gz |
@- Fixed FTP module to accept multiline server replies (Jani)
# This fixed bug #4546.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/ftp/ftp.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 6664fd587b..45b01e799d 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -790,26 +790,29 @@ ftp_readline(ftpbuf_t *ftp) int ftp_getresp(ftpbuf_t *ftp) { - char *buf; + char *buf; - if (ftp == NULL) - return 0; + if (ftp == NULL) return 0; buf = ftp->inbuf; ftp->resp = 0; - while (1) { - if (!ftp_readline(ftp)) - return 0; - if (ftp->inbuf[3] == '-') - continue; - else if (ftp->inbuf[3] != ' ') + + if (!ftp_readline(ftp)) { return 0; - break; + } + + /* Break out when the end-tag is found */ + if (isdigit(ftp->inbuf[0]) && + isdigit(ftp->inbuf[1]) && + isdigit(ftp->inbuf[2]) && + ftp->inbuf[3] == ' ') { + break; + } } /* translate the tag */ - if ( !isdigit(ftp->inbuf[0]) || + if (!isdigit(ftp->inbuf[0]) || !isdigit(ftp->inbuf[1]) || !isdigit(ftp->inbuf[2])) { |