summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>1998-10-13 20:42:01 +0000
committerdes <des@FreeBSD.org>1998-10-13 20:42:01 +0000
commite1957bff3971e4a7f88f6fd03e1002a01335661d (patch)
tree345c8c93648810602a68ae18db5c291425112198
parent9a83e473e2d79b503444c2b316e7498f259d9263 (diff)
downloadFreeBSD-src-e1957bff3971e4a7f88f6fd03e1002a01335661d.zip
FreeBSD-src-e1957bff3971e4a7f88f6fd03e1002a01335661d.tar.gz
Set the user context correctly so that cd ~ does the right thing.
PR: bin/7943 bin/8293 Submitted by: Bill Fenner <fenner@parc.xerox.com> Approved by: jkh
-rw-r--r--libexec/ftpd/ftpd.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index d9b2e28..e844fe9 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -44,7 +44,7 @@ static char copyright[] =
static char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94";
#endif
static const char rcsid[] =
- "$Id: ftpd.c,v 1.50 1998/05/25 03:45:35 steve Exp $";
+ "$Id: ftpd.c,v 1.51 1998/06/03 11:33:44 jb Exp $";
#endif /* not lint */
/*
@@ -925,7 +925,6 @@ pass(passwd)
#ifdef LOGIN_CAP
login_cap_t *lc = NULL;
#endif
- static char homedir[MAXPATHLEN];
if (logged_in || askpasswd == 0) {
reply(503, "Login with USER first.");
@@ -1004,8 +1003,10 @@ skip:
}
}
setusercontext(lc, pw, (uid_t)0,
- LOGIN_SETGROUP|LOGIN_SETPRIORITY|LOGIN_SETRESOURCES|LOGIN_SETUMASK);
+ LOGIN_SETLOGIN|LOGIN_SETGROUP|LOGIN_SETPRIORITY|
+ LOGIN_SETRESOURCES|LOGIN_SETUMASK);
#else
+ setlogin(pw->pw_name);
(void) initgroups(pw->pw_name, pw->pw_gid);
#endif
@@ -1055,12 +1056,6 @@ skip:
}
/*
- * Set home directory so that use of ~ (tilde) works correctly.
- */
- if (getcwd(homedir, MAXPATHLEN) != NULL)
- setenv("HOME", homedir, 1);
-
- /*
* Display a login message, if it exists.
* N.B. reply(230,) must follow the message.
*/
OpenPOWER on IntegriCloud