diff options
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: session.c,v 1.238 2008/05/09 16:16:06 markus Exp $ */ | 1 | /* $OpenBSD: session.c,v 1.239 2008/06/14 18:33:43 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
4 | * All rights reserved | 4 | * All rights reserved |
@@ -1647,6 +1647,7 @@ do_child(Session *s, const char *command) | |||
1647 | char *argv[ARGV_MAX]; | 1647 | char *argv[ARGV_MAX]; |
1648 | const char *shell, *shell0, *hostname = NULL; | 1648 | const char *shell, *shell0, *hostname = NULL; |
1649 | struct passwd *pw = s->pw; | 1649 | struct passwd *pw = s->pw; |
1650 | int r = 0; | ||
1650 | 1651 | ||
1651 | /* remove hostkey from the child's memory */ | 1652 | /* remove hostkey from the child's memory */ |
1652 | destroy_sensitive_data(); | 1653 | destroy_sensitive_data(); |
@@ -1762,12 +1763,16 @@ do_child(Session *s, const char *command) | |||
1762 | 1763 | ||
1763 | /* Change current directory to the user's home directory. */ | 1764 | /* Change current directory to the user's home directory. */ |
1764 | if (chdir(pw->pw_dir) < 0) { | 1765 | if (chdir(pw->pw_dir) < 0) { |
1765 | fprintf(stderr, "Could not chdir to home directory %s: %s\n", | 1766 | /* Suppress missing homedir warning for chroot case */ |
1766 | pw->pw_dir, strerror(errno)); | ||
1767 | #ifdef HAVE_LOGIN_CAP | 1767 | #ifdef HAVE_LOGIN_CAP |
1768 | if (login_getcapbool(lc, "requirehome", 0)) | 1768 | r = login_getcapbool(lc, "requirehome", 0); |
1769 | exit(1); | ||
1770 | #endif | 1769 | #endif |
1770 | if (r || options.chroot_directory == NULL) | ||
1771 | fprintf(stderr, "Could not chdir to home " | ||
1772 | "directory %s: %s\n", pw->pw_dir, | ||
1773 | strerror(errno)); | ||
1774 | if (r) | ||
1775 | exit(1); | ||
1771 | } | 1776 | } |
1772 | 1777 | ||
1773 | closefrom(STDERR_FILENO + 1); | 1778 | closefrom(STDERR_FILENO + 1); |