]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
login: use DEFAULT_HOME from login.defs
authorKarel Zak <kzak@redhat.com>
Wed, 5 Oct 2011 21:50:12 +0000 (23:50 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 26 Oct 2011 21:17:17 +0000 (23:17 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/login.1
login-utils/login.c

index c72fcfa9677127639e49f50679314152aa662ced..ca7c4b3a46a1207302c44ee2207bc79f62070b91 100644 (file)
@@ -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
index 1c6707726ecfe7c3364dcd004722b81a2ee772ab..c9ae19f63252f31ec264443934b08a2396860616 100644 (file)
@@ -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 = "/";