summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1995-05-22 09:53:02 +0000
committerdg <dg@FreeBSD.org>1995-05-22 09:53:02 +0000
commitd860120023b66d0f3e3da63e89b177fc0651cc3d (patch)
tree9829baefc51f82731c802b407c7328719a6515c6 /libexec
parent3fd9f800d0152faa9197eaec06cbc2c27989c955 (diff)
downloadFreeBSD-src-d860120023b66d0f3e3da63e89b177fc0651cc3d.zip
FreeBSD-src-d860120023b66d0f3e3da63e89b177fc0651cc3d.tar.gz
Set "HOME" so that tilde expands correctly. It previously was always root's
directory /root.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ftpd/ftpd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 81c02c3..79c20f1 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.
OpenPOWER on IntegriCloud