diff options
author | Karel Zak | 2011-10-05 23:39:14 +0200 |
---|---|---|
committer | Karel Zak | 2011-10-26 23:17:17 +0200 |
commit | 84d3c9ffb3df124a078555d35fa7c8acd73dad01 (patch) | |
tree | 294f224fe937b2ee3e1ce5682f8f2271d5abff1b /login-utils/login.c | |
parent | login: use TTYGROUP from login.defs (diff) | |
download | kernel-qcow2-util-linux-84d3c9ffb3df124a078555d35fa7c8acd73dad01.tar.gz kernel-qcow2-util-linux-84d3c9ffb3df124a078555d35fa7c8acd73dad01.tar.xz kernel-qcow2-util-linux-84d3c9ffb3df124a078555d35fa7c8acd73dad01.zip |
login: use HUSHLOGIN_FILE from login.defs
Note that Suse login(1) does not use any default for HUSHLOGIN_FILE.
We use /etc/hushlogins and ~/.hushlogin as default.
The another difference is that *empty* global (e.g. /etc/hushlogins)
means that hushed mode will be enabled for all accounts.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils/login.c')
-rw-r--r-- | login-utils/login.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/login-utils/login.c b/login-utils/login.c index 17a313710..1c6707726 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -845,6 +845,8 @@ static int effective_access(const char *path, int mode) * * The ~/.hushlogin is ignored if the global hush file exists. * + * The HUSHLOGIN_FILE login.def variable overwrites the default hush filename. + * * Note that shadow-utils login(1) does not support "a1)". The "a1)" is * necessary if you want to use PAM for "Last login" message. * @@ -862,13 +864,24 @@ static int effective_access(const char *path, int mode) static int get_hushlogin_status(struct passwd *pwd) { const char *files[] = { _PATH_HUSHLOGINS, _PATH_HUSHLOGIN, NULL }; + const char *file; char buf[BUFSIZ]; int i; + file = getlogindefs_str("HUSHLOGIN_FILE", NULL); + if (file) { + if (!*file) + return 0; /* empty HUSHLOGIN_FILE defined */ + + files[0] = file; + files[1] = NULL; + } + for (i = 0; files[i]; i++) { - const char *file = files[i]; int ok = 0; + file = files[i]; + /* Global hush-file*/ if (*file == '/') { struct stat st; |