Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 May 2024 17:18:46 GMT
From:      Allan Jude <allanjude@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 207e8cef0b36 - releng/14.1 - ftpd: stop using -g flag for /bin/ls
Message-ID:  <202405221718.44MHIkdU092885@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch releng/14.1 has been updated by allanjude:

URL: https://cgit.FreeBSD.org/src/commit/?id=207e8cef0b363603d68a226bb03f0ff421d30dd2

commit 207e8cef0b363603d68a226bb03f0ff421d30dd2
Author:     Allan Jude <allanjude@FreeBSD.org>
AuthorDate: 2024-05-21 22:58:21 +0000
Commit:     Allan Jude <allanjude@FreeBSD.org>
CommitDate: 2024-05-22 17:18:07 +0000

    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:          3bfbb521fef5 ("ls: Improve POSIX compatibility for -g and -n.")
    
    (cherry picked from commit 5af3225e0448be6af7f0312e10d2a1dfbe150c25)
    (cherry picked from commit e5fadc41b48045d8978993d6c4ac72c64542b470)
---
 libexec/ftpd/ftpcmd.y | 4 ++--
 libexec/ftpd/ftpd.8   | 2 +-
 libexec/ftpd/ftpd.c   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y
index 9d57017e2f19..827ceda03272 100644
--- a/libexec/ftpd/ftpcmd.y
+++ b/libexec/ftpd/ftpcmd.y
@@ -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
diff --git a/libexec/ftpd/ftpd.8 b/libexec/ftpd/ftpd.8
index ec4ce0c65100..44f8a2e00835 100644
--- a/libexec/ftpd/ftpd.8
+++ b/libexec/ftpd/ftpd.8
@@ -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"
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index a41a23ab1184..11811da35cb5 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202405221718.44MHIkdU092885>