- djm@cvs.openbsd.org 2008/06/14 18:33:43
[session.c] suppress the warning message from chdir(homedir) failures when chrooted (bz#1461); ok dtucker
This commit is contained in:
parent
6ca16c63c2
commit
6051c94a0a
|
@ -7,6 +7,10 @@
|
|||
- dtucker@cvs.openbsd.org 2008/06/14 17:07:11
|
||||
[sshd.c]
|
||||
ensure default umask disallows at least group and world write; ok djm@
|
||||
- djm@cvs.openbsd.org 2008/06/14 18:33:43
|
||||
[session.c]
|
||||
suppress the warning message from chdir(homedir) failures
|
||||
when chrooted (bz#1461); ok dtucker
|
||||
|
||||
20080614
|
||||
- (djm) [openbsd-compat/sigact.c] Avoid NULL derefs in ancient sigaction
|
||||
|
@ -4379,4 +4383,4 @@
|
|||
OpenServer 6 and add osr5bigcrypt support so when someone migrates
|
||||
passwords between UnixWare and OpenServer they will still work. OK dtucker@
|
||||
|
||||
$Id: ChangeLog,v 1.5014 2008/06/15 21:50:58 djm Exp $
|
||||
$Id: ChangeLog,v 1.5015 2008/06/15 21:53:16 djm Exp $
|
||||
|
|
15
session.c
15
session.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: session.c,v 1.238 2008/05/09 16:16:06 markus Exp $ */
|
||||
/* $OpenBSD: session.c,v 1.239 2008/06/14 18:33:43 djm Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||
* All rights reserved
|
||||
|
@ -1647,6 +1647,7 @@ do_child(Session *s, const char *command)
|
|||
char *argv[ARGV_MAX];
|
||||
const char *shell, *shell0, *hostname = NULL;
|
||||
struct passwd *pw = s->pw;
|
||||
int r = 0;
|
||||
|
||||
/* remove hostkey from the child's memory */
|
||||
destroy_sensitive_data();
|
||||
|
@ -1762,12 +1763,16 @@ do_child(Session *s, const char *command)
|
|||
|
||||
/* Change current directory to the user's home directory. */
|
||||
if (chdir(pw->pw_dir) < 0) {
|
||||
fprintf(stderr, "Could not chdir to home directory %s: %s\n",
|
||||
pw->pw_dir, strerror(errno));
|
||||
/* Suppress missing homedir warning for chroot case */
|
||||
#ifdef HAVE_LOGIN_CAP
|
||||
if (login_getcapbool(lc, "requirehome", 0))
|
||||
exit(1);
|
||||
r = login_getcapbool(lc, "requirehome", 0);
|
||||
#endif
|
||||
if (r || options.chroot_directory == NULL)
|
||||
fprintf(stderr, "Could not chdir to home "
|
||||
"directory %s: %s\n", pw->pw_dir,
|
||||
strerror(errno));
|
||||
if (r)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
closefrom(STDERR_FILENO + 1);
|
||||
|
|
Loading…
Reference in New Issue