]>
Commit | Line | Data |
---|---|---|
2db63d67 AM |
1 | diff -urN pure-ftpd-1.0.20.org/src/ls.c pure-ftpd-1.0.20/src/ls.c |
2 | --- pure-ftpd-1.0.20.org/src/ls.c 2004-02-29 22:49:27.000000000 +0100 | |
3 | +++ pure-ftpd-1.0.20/src/ls.c 2005-02-18 00:42:08.000000000 +0100 | |
4 | @@ -245,6 +245,20 @@ | |
5 | st.st_mode &= ~S_IFLNK; | |
6 | st.st_mode |= S_IFDIR; | |
7 | } /* Hack to please some Windows client that dislike ../ -> ../ */ | |
8 | + if (S_ISLNK(st.st_mode)) { | |
9 | + char ms[MAXPATHLEN + 1U]; | |
10 | + struct stat sts; | |
11 | + int sx; | |
12 | + | |
13 | + if ((sx = readlink(name, ms, sizeof ms - 1U)) > 0) | |
14 | + if (stat(name, &sts) == 0) { | |
15 | + if (!S_ISLNK(sts.st_mode)) | |
16 | + st.st_mode = sts.st_mode; | |
17 | + /* don't show if owner mismatch */ | |
18 | + if (geteuid() != sts.st_uid) | |
19 | + return 0; | |
20 | + } | |
21 | + } /* Hack to show symlinks as files/directories */ | |
22 | #endif | |
23 | #ifdef DISPLAY_FILES_IN_UTC_TIME | |
24 | t = gmtime((time_t *) &st.st_mtime); |