[ftp] Fix: FTP client does not expand home directory correctly after sudo or su

jsynacek jsynacek at fedoraproject.org
Wed Oct 3 07:28:41 UTC 2012


commit c75973b948f9a1e77b90a243a4e2a06f6ebf2dca
Author: Jan Synacek <jsynacek at redhat.com>
Date:   Wed Oct 3 09:18:37 2012 +0200

    Fix: FTP client does not expand home directory correctly after sudo or su
    
    Resolves: #861113

 ftp.spec                       |    8 +++++++-
 netkit-ftp-0.17-getlogin.patch |   37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletions(-)
---
diff --git a/ftp.spec b/ftp.spec
index ca4b64c..63cacd7 100644
--- a/ftp.spec
+++ b/ftp.spec
@@ -1,7 +1,7 @@
 Summary: The standard UNIX FTP (File Transfer Protocol) client
 Name: ftp
 Version: 0.17
-Release: 60%{?dist}
+Release: 61%{?dist}
 License: BSD with advertising
 Group: Applications/Internet
 Source0: ftp://ftp.linux.org.uk/pub/linux/Networking/netkit/netkit-ftp-%{version}.tar.gz
@@ -38,6 +38,7 @@ Patch29: netkit-ftp-0.17-linelen.patch
 Patch30: netkit-ftp-0.17-active-mode-option.patch
 Patch31: netkit-ftp-0.17-commands-leaks.patch
 Patch32: netkit-ftp-0.17-lsn-timeout.patch
+Patch33: netkit-ftp-0.17-getlogin.patch
 
 BuildRequires: glibc-devel, readline-devel, ncurses-devel
 
@@ -83,6 +84,7 @@ file transfers.
 %patch30 -p1 -b .activemode
 %patch31 -p1 -b .cmds-leaks
 %patch32 -p1 -b .lsn-timeout
+%patch33 -p1 -b .getlogin
 
 %build
 sh configure --with-c-compiler=gcc --enable-ipv6
@@ -111,6 +113,10 @@ make INSTALLROOT=${RPM_BUILD_ROOT} install
 %{_mandir}/man5/netrc.*
 
 %changelog
+* Wed Oct 03 2012 Jan Synáček <jsynacek at redhat.com> - 0.17-61
+- Fix: FTP client does not expand home directory correctly after sudo or su
+- Resolves: #861113
+
 * Tue Sep 25 2012 Jan Synáček <jsynacek at redhat.com> - 0.17-60
 - Plug leaks in "put", "send", "append"
 - Add listening timeout
diff --git a/netkit-ftp-0.17-getlogin.patch b/netkit-ftp-0.17-getlogin.patch
new file mode 100644
index 0000000..9feb315
--- /dev/null
+++ b/netkit-ftp-0.17-getlogin.patch
@@ -0,0 +1,37 @@
+--- netkit-ftp-0.17-dist/ftp/ftp.c	2012-10-02 14:44:06.328343277 +0200
++++ netkit-ftp-0.17-new/ftp/ftp.c	2012-10-03 09:07:47.381868330 +0200
+@@ -328,14 +328,12 @@ dologin(const char *host)
+ 		return(0);
+ 	}
+ 	while (luser == NULL) {
+-		char *myname = getlogin();
++		char *myname = NULL;
+ 
+-		if (myname == NULL) {
+-			struct passwd *pp = getpwuid(getuid());
++		struct passwd *pp = getpwuid(getuid());
+ 
+-			if (pp != NULL)
+-				myname = pp->pw_name;
+-		}
++		if (pp != NULL)
++			myname = pp->pw_name;
+ 		if (myname)
+ 			printf("Name (%s:%s): ", host, myname);
+ 		else
+--- netkit-ftp-0.17-dist/ftp/main.c	2012-10-02 14:44:06.330343274 +0200
++++ netkit-ftp-0.17-new/ftp/main.c	2012-10-03 09:07:36.849862227 +0200
+@@ -204,12 +204,7 @@ main(volatile int argc, char **volatile
+ 	/*
+ 	 * Set up the home directory in case we're globbing.
+ 	 */
+-	cp = getlogin();
+-	if (cp != NULL) {
+-		pw = getpwnam(cp);
+-	}
+-	if (pw == NULL)
+-		pw = getpwuid(getuid());
++	pw = getpwuid(getuid());
+ 	if (pw != NULL) {
+ 		strncpy(homedir, pw->pw_dir, sizeof(homedir));
+ 		homedir[sizeof(homedir)-1] = 0;


More information about the scm-commits mailing list