From:             [EMAIL PROTECTED]
Operating system: Linux and W2K
PHP version:      4.0.6
PHP Bug Type:     FTP related
Bug description:  nlist and rawlist don`t work with ftp-daemon of Suse

Hello,

I tried to user ftp_nlist to get an directory-listing of an Suse7.1 
ftp-Server, but the function returns nothing.

I tried the same code to connect to an ftp-server on an Windows-System.

To analyse the problem I made some printentries in the file ftp.c. I edited

the file in the array of line 1195. I think that here is one problem: 
the code expect "\r" and "\n", but only retrieves "\n".

Here is the code:


        while ((ch = getc(tmpfp)) != EOF) {
                printf("%d ",ch);
/*
                if (ch == '\n' && lastch == '\r') {
*/
                if (ch == '\n' ) {
                        *(text - 1) = 0;
                        printf("\nText:%s\n\n", text);
                        *++entry = text;
                }
                else {
                        *text++ = ch;
                }
                lastch = ch;
        }
        *entry = NULL;

        if (ferror(tmpfp))
                goto bail;

        fclose(tmpfp);

        if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
                free(ret);
                return NULL;
        }
        printf("ret[0]:%s\n", ret[0]);
        printf("ret[1]:%s\n\n", ret[1]);
        return ret;


And here is the output from my PHP-Script:

X-Powered-By: PHP/4.0.6
Content-type: text/html

45 114 119 45 114 45 45 114 45 45 32 32 49 32 114 111 111 116 32 32 32 114
111 111 116 32 32 32 49 54 51 57 32 68 101 99 32 50 49 32 50 51 58 51 48 32
105 99 97 112 46 112 104 112 10 
Text:icap.php
-rw-r-----  1 bernd  users  1717 Dec 21 23:29 kal.php


45 114 119 45 114 45 45 45 45 45 32 32 49 32 98 101 114 110 100 32 32 117
115 101 114 115 32 32 49 55 49 55 32 68 101 99 32 50 49 32 50 51 58 50 57
32 107 97 108 46 112 104 112 10 
Text:9 kal.php


ret[0]::¶
ret[1]:-rw-r-----  1 bernd  users  1717 Dec 21 23:29 kal.ph

array(2) {
  [0]=>
  string(4) ":¶"
  [1]=>
  string(52) "-rw-r-----  1 bernd  users  1717 Dec 21 23:29 kal.ph"
}


Thanks
Bernd
-- 
Edit bug report at: http://bugs.php.net/?id=14861&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to