From: Karel Zak Date: Wed, 5 Oct 2011 21:50:12 +0000 (+0200) Subject: login: use DEFAULT_HOME from login.defs X-Git-Tag: v2.21-rc1~280 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=91d0a913574f77fcb49d6ce950e497bd6b41014e;p=thirdparty%2Futil-linux.git login: use DEFAULT_HOME from login.defs Signed-off-by: Karel Zak --- diff --git a/login-utils/login.1 b/login-utils/login.1 index c72fcfa967..ca7c4b3a46 100644 --- a/login-utils/login.1 +++ b/login-utils/login.1 @@ -175,6 +175,14 @@ The default is to check "/etc/hushlogins" and if does not exist then If the \fBHUSHLOGIN_FILE\fR item is empty then all checks are disabled. .RE +.PP +\fBDEFAULT_HOME\fR (boolean) +.RS 4 +Indicate if login is allowed if we can\'t cd to the home directory. If set to +\fIyes\fR, the user will login in the root (/) directory if it is not possible +to cd to her home directory. The default value is 'yes'. +.RE + .SH FILES .nf .I /var/run/utmp diff --git a/login-utils/login.c b/login-utils/login.c index 1c6707726e..c9ae19f632 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -1313,6 +1313,9 @@ int main(int argc, char **argv) /* wait until here to change directory! */ if (chdir(pwd->pw_dir) < 0) { warn(_("%s: change directory failed"), pwd->pw_dir); + + if (!getlogindefs_bool("DEFAULT_HOME", 1)) + exit(0); if (chdir("/")) exit(EXIT_FAILURE); pwd->pw_dir = "/";