Do login cap calls _before_ descriptors are hardly closed because close may
invalidate login cap descriptor. Reviewed by: des
This commit is contained in:
parent
ea4c8f8ca1
commit
bccd761645
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=101385
@ -1288,6 +1288,9 @@ do_child(Session *s, const char *command)
|
||||
const char *shell, *shell0, *hostname = NULL;
|
||||
struct passwd *pw = s->pw;
|
||||
u_int i;
|
||||
#ifdef HAVE_LOGIN_CAP
|
||||
int lc_requirehome;
|
||||
#endif
|
||||
|
||||
/* remove hostkey from the child's memory */
|
||||
destroy_sensitive_data();
|
||||
@ -1346,6 +1349,10 @@ do_child(Session *s, const char *command)
|
||||
/* XXX better use close-on-exec? -markus */
|
||||
channel_close_all();
|
||||
|
||||
#ifdef HAVE_LOGIN_CAP
|
||||
lc_requirehome = login_getcapbool(lc, "requirehome", 0);
|
||||
login_close(lc);
|
||||
#endif
|
||||
/*
|
||||
* Close any extra file descriptors. Note that there may still be
|
||||
* descriptors left by system functions. They will be closed later.
|
||||
@ -1384,7 +1391,7 @@ do_child(Session *s, const char *command)
|
||||
fprintf(stderr, "Could not chdir to home directory %s: %s\n",
|
||||
pw->pw_dir, strerror(errno));
|
||||
#ifdef HAVE_LOGIN_CAP
|
||||
if (login_getcapbool(lc, "requirehome", 0))
|
||||
if (lc_requirehome)
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user