From 82c76939c1b5010bf28fb251c15853712e94cb40 Mon Sep 17 00:00:00 2001 From: David Greenman Date: Mon, 22 May 1995 09:53:02 +0000 Subject: [PATCH] Set "HOME" so that tilde expands correctly. It previously was always root's directory /root. --- libexec/ftpd/ftpd.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 81c02c3648d2..79c20f163fe7 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -552,6 +552,7 @@ pass(passwd) { char *salt, *xpasswd; FILE *fd; + static char homedir[MAXPATHLEN]; if (logged_in || askpasswd == 0) { reply(503, "Login with USER first."); @@ -627,6 +628,12 @@ pass(passwd) reply(550, "Can't set uid."); goto bad; } + + /* + * Set home directory so that use of ~ (tilde) works correctly. + */ + setenv("HOME", getcwd(homedir, MAXPATHLEN), 1); + /* * Display a login message, if it exists. * N.B. reply(230,) must follow the message.