php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14247 Can't list directories in symlink using ftp_nlist and ftp_rawlist
Submitted: 2001-11-27 01:32 UTC Modified: 2002-07-10 23:16 UTC
From: amiroot at yahoo dot com Assigned:
Status: Closed Package: FTP related
PHP Version: 4.0.6 OS: RedHat 7.1
Private report: No CVE-ID: None
 [2001-11-27 01:32 UTC] amiroot at yahoo dot com
hihi all,

I'm using RedHat 7.1, kernel 2.9.6 with apache 1.3.19, php4.0.6 and wu-ftpd-2.6.1-18. I did using ftp_nlist and ftp_rawlist to list a symlink directories in my programme. For ftp_nlist, it can only list the files in the directorise. For ftp_rawlist, it only shows the direcctories itself (not . but the name of itself). I tested with the following simple script and the problem still exists.

<?php
$conn = ftp_connect("localhost");
if (!conn) exit();
if (!ftp_login($conn, 'mylogin', 'password')) exit();
ftp_pasv($conn, TRUE);
$ls = ftp_nlist($conn, 'public');
$rls = ftp_rawlist($conn, 'public');
var_dump($ls);
var_dump($rls);
?>

The result of my programme is that: for $ls, it shows all files execpt directories; for $rls it shows only the directories with it's information.

For the normally directories and the symlink files, it is OK!!

In my original programme, however, even thorugh I can't see any directories, I can still mkdir and it return success. However, I can't see the new directory. I'd also tried this test programme in FreeBSD4.4 and php4.0.6, connecting to the same FTP server, getting the same result.

Here is some additional information for your reference:

make a link:
ln -s ./public_html ./public

test programme result (2 directories missed) :

array(5) { [0]=> string(18) "public/db_test.php" [1]=> string(15) "public/ftp2.php" [2]=> string(18) "public/ftptest.php" [3]=> string(14) "public/md5.exe" [4]=> string(15) "public/test.php" }
array(1) { [0]=> string(76) "lrwxrwxrwx 1 root root 11 Nov 26 11:01 public -> public_html" }

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-27 01:45 UTC] amiroot at yahoo dot com
Some addition information missed in the last mail.

In my original programme, I'd tried to chdir and then list teh directories. The chdir can successfully ran but the is failed nomatter how I change the code.

The files in my test directories.

# cd public
# ls -l

total 92
-rw-r--r--    1 mylogin  webadmin     1145 Oct  5 17:32 db_test.php
-rw-r--r--    1 mylogin  webadmin    19978 Nov 27 11:36 ftp2.php
-rw-r--r--    1 mylogin  webadmin    11503 Nov 27 11:32 ftptest.php
-rw-r--r--    1 mylogin  webadmin    42496 Nov 27 10:49 md5.exe
drwxr-xr-x    2 mylogin  webadmin     4096 Oct  5 17:32 midi
drwxr-xr-x    2 mylogin  webadmin     4096 Nov 27 10:33 test
-rw-r--r--    1 mylogin  webadmin      276 Nov 27 11:51 test.php

Thx a lot!!
 [2002-07-10 23:16 UTC] sniper@php.net
I can not reproduce this with this snapshot and same ftpd:

http://snaps.php.net/php4-latest.tar.gz


 [2022-01-30 00:53 UTC] m8roon at gmail dot com
https://down-plus.com/
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 13:01:32 2024 UTC