ftpd: stop using -g flag for /bin/ls

In 3bfbb521 the behaviour of ls was changed such that -g was no longer
a noop for compatibility with BSD 4.3, but instead changed the output
of long mode to exclude the owner of the file and display only the
group.

Update how FTPd invokes ls to restore the previous behaviour

Reported-by:	Andrew Fengler <andrew.fengler@scaleengine.com>
Reviewed-by:	jrtc27, des, imp
Approved by:	re (cperciva)
MFC after:	3 days
Sponsored-by:	ScaleEngine Inc.
Fixes:		3bfbb521fe ("ls: Improve POSIX compatibility for -g and -n.")

(cherry picked from commit 5af3225e0448be6af7f0312e10d2a1dfbe150c25)
(cherry picked from commit e5fadc41b4)
This commit is contained in:
Allan Jude 2024-05-21 22:58:21 +00:00
parent 0b367134dd
commit 207e8cef0b
3 changed files with 4 additions and 4 deletions

View File

@ -460,12 +460,12 @@ cmd
| LIST check_login CRLF
{
if ($2)
retrieve(_PATH_LS " -lgA", "");
retrieve(_PATH_LS " -lA", "");
}
| LIST check_login SP pathstring CRLF
{
if ($2)
retrieve(_PATH_LS " -lgA %s", $4);
retrieve(_PATH_LS " -lA %s", $4);
free($4);
}
| STAT check_login SP pathname CRLF

View File

@ -278,7 +278,7 @@ is specified.
.It EPSV Ta "prepare for server-to-server transfer, multiprotocol"
.It FEAT Ta "give information on extended features of server"
.It HELP Ta "give help information"
.It LIST Ta "give list files in a directory" Pq Dq Li "ls -lgA"
.It LIST Ta "give list files in a directory" Pq Dq Li "ls -lA"
.It LPRT Ta "specify data connection port, multiprotocol"
.It LPSV Ta "prepare for server-to-server transfer, multiprotocol"
.It MDTM Ta "show last modification time of file"

View File

@ -2336,7 +2336,7 @@ statfilecmd(char *filename)
struct stat st;
code = lstat(filename, &st) == 0 && S_ISDIR(st.st_mode) ? 212 : 213;
(void)snprintf(line, sizeof(line), _PATH_LS " -lgA %s", filename);
(void)snprintf(line, sizeof(line), _PATH_LS " -lA %s", filename);
fin = ftpd_popen(line, "r");
if (fin == NULL) {
perror_reply(551, filename);