summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2008-06-14 18:33:43 +0000
committerdjm <djm@openbsd.org>2008-06-14 18:33:43 +0000
commit582dabed9aecf2c5bc6aa6e10db98cd56919eb0c (patch)
treef2970fe81d3abeb1a1e23f7e213270958228069e
parentMask the upper 56 bits of the rx ports when reading them, pckbd_input() will (diff)
downloadwireguard-openbsd-582dabed9aecf2c5bc6aa6e10db98cd56919eb0c.tar.xz
wireguard-openbsd-582dabed9aecf2c5bc6aa6e10db98cd56919eb0c.zip
suppress the warning message from chdir(homedir) failures
when chrooted (bz#1461); ok dtucker
-rw-r--r--usr.bin/ssh/session.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/ssh/session.c b/usr.bin/ssh/session.c
index 4f5c486e70d..8fb7e5124d5 100644
--- a/usr.bin/ssh/session.c
+++ b/usr.bin/ssh/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
@@ -1276,6 +1276,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();
@@ -1362,9 +1363,13 @@ 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));
- if (login_getcapbool(lc, "requirehome", 0))
+ /* Suppress missing homedir warning for chroot case */
+ r = login_getcapbool(lc, "requirehome", 0);
+ 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);
}