[openssh-commits] [openssh] 01/02: upstream: Move user/group name lookup to correct place; coverity

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Jun 30 09:10:33 AEST 2026


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit b9d2162e4a919168bbd983fa68663f813b534034
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Mon Jun 29 22:56:44 2026 +0000

    upstream: Move user/group name lookup to correct place; coverity
    
    CID 910530 via dtucker@
    
    OpenBSD-Commit-ID: 03ba9f8c720eea38436e4fef4c40814eae1b1fe3
---
 sftp.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sftp.c b/sftp.c
index bd4d91965..838f9b862 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.253 2026/06/29 08:48:22 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.254 2026/06/29 22:56:44 djm Exp $ */
 /*
  * Copyright (c) 2001-2004 Damien Miller <djm at openbsd.org>
  *
@@ -26,6 +26,7 @@
 
 #include <ctype.h>
 #include <errno.h>
+#include <fcntl.h>
 #include <glob.h>
 #include <paths.h>
 #include <libgen.h>
@@ -326,7 +327,6 @@ local_do_shell(const char *args)
 		fatal("Couldn't fork: %s", strerror(errno));
 
 	if (pid == 0) {
-		/* XXX: child has pipe fds to ssh subproc open - issue? */
 		if (args) {
 			debug3("Executing %s -c \"%s\"", shell, args);
 			execl(shell, shell, "-c", args, (char *)NULL);
@@ -901,12 +901,12 @@ do_ls_dir(struct sftp_conn *conn, const char *path,
 				struct stat sb;
 				const char *user = NULL, *group = NULL;
 
+				memset(&sb, 0, sizeof(sb));
+				attrib_to_stat(&d[n]->a, &sb);
 				if ((lflag & LS_NUMERIC_VIEW) == 0) {
 					user = ruser_name(sb.st_uid);
 					group = rgroup_name(sb.st_gid);
 				}
-				memset(&sb, 0, sizeof(sb));
-				attrib_to_stat(&d[n]->a, &sb);
 				lname = ls_file(fname, &sb, 1,
 				    (lflag & LS_SI_UNITS), user, group);
 				mprintf("%s\n", lname);
@@ -2403,6 +2403,8 @@ connect_to_server(char *path, char **args, int *in, int *out)
 	*in = *out = inout[0];
 	c_in = c_out = inout[1];
 #endif /* USE_PIPES */
+	FD_CLOSEONEXEC(*in);
+	FD_CLOSEONEXEC(*out);
 
 	if ((sshpid = fork()) == -1)
 		fatal("fork: %s", strerror(errno));

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list