From 91d0a913574f77fcb49d6ce950e497bd6b41014e Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 5 Oct 2011 23:50:12 +0200 Subject: [PATCH] login: use DEFAULT_HOME from login.defs Signed-off-by: Karel Zak --- login-utils/login.1 | 8 ++++++++ login-utils/login.c | 3 +++ 2 files changed, 11 insertions(+) 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 = "/"; -- 2.47.3