]> granicus.if.org Git - php/commitdiff
@- Fixed FTP module to accept multiline server replies (Jani)
authorfoobar <sniper@php.net>
Thu, 10 Aug 2000 21:13:08 +0000 (21:13 +0000)
committerfoobar <sniper@php.net>
Thu, 10 Aug 2000 21:13:08 +0000 (21:13 +0000)
# This fixed bug #4546.

ext/ftp/ftp.c

index 6664fd587b3b913eabb9bb8acf7c36bc51e1f24b..45b01e799d1c3322f1d5687569cd7f94ec23147b 100644 (file)
@@ -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]))
        {