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
This commit is contained in:
parent
f95cbe2cb5
commit
e6fa0d4308
@ -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
|
||||
|
||||
@ -1054,12 +1055,6 @@ skip:
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user