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

Resolves: #861113
This commit is contained in:
Jan Synacek 2012-10-03 09:18:37 +02:00
parent 578bc30861
commit c75973b948
2 changed files with 44 additions and 1 deletions

View File

@ -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@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@redhat.com> - 0.17-60
- Plug leaks in "put", "send", "append"
- Add listening timeout

View File

@ -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;