[openssh-commits] [openssh] branch master updated: upstream: fix home-directory extension implementation, it always

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Apr 30 16:24:37 AEST 2024


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

djm pushed a commit to branch master
in repository openssh.

The following commit(s) were added to refs/heads/master by this push:
     new 385ecb31 upstream: fix home-directory extension implementation, it always
385ecb31 is described below

commit 385ecb31e147dfea59c1c488a1d2011d3867e60e
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Tue Apr 30 06:23:51 2024 +0000

    upstream: fix home-directory extension implementation, it always
    
    returned the current user's home directory contrary to the spec.
    
    Patch from Jakub Jelen via GHPR477
    
    OpenBSD-Commit-ID: 5afd775eab7f9cbe222d7fbae4c793de6c3b3d28
---
 sftp-server.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sftp-server.c b/sftp-server.c
index 0466a0f7..a4abb9f7 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-server.c,v 1.147 2023/04/12 08:53:54 jsg Exp $ */
+/* $OpenBSD: sftp-server.c,v 1.148 2024/04/30 06:23:51 djm Exp $ */
 /*
  * Copyright (c) 2000-2004 Markus Friedl.  All rights reserved.
  *
@@ -1706,14 +1706,16 @@ process_extended_home_directory(u_int32_t id)
 		fatal_fr(r, "parse");
 
 	debug3("request %u: home-directory \"%s\"", id, username);
-	if ((user_pw = getpwnam(username)) == NULL) {
+	if (username[0] == '\0') {
+		user_pw = pw;
+	} else if ((user_pw = getpwnam(username)) == NULL) {
 		send_status(id, SSH2_FX_FAILURE);
 		goto out;
 	}
 
-	verbose("home-directory \"%s\"", pw->pw_dir);
+	verbose("home-directory \"%s\"", user_pw->pw_dir);
 	attrib_clear(&s.attrib);
-	s.name = s.long_name = pw->pw_dir;
+	s.name = s.long_name = user_pw->pw_dir;
 	send_names(id, 1, &s);
  out:
 	free(username);

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


More information about the openssh-commits mailing list