|
|
304038 |
From a8427f41c91ac12f0b208fe7eaf4e535b8a56464 Mon Sep 17 00:00:00 2001
|
|
|
304038 |
From: Karel Zak <kzak@redhat.com>
|
|
|
304038 |
Date: Mon, 4 Dec 2017 12:31:29 +0100
|
|
|
304038 |
Subject: [PATCH 145/146] login: add LOGIN_PLAIN_PROMPT to login.defs
|
|
|
304038 |
|
|
|
304038 |
We have command line option -H to disable hostname in login prompt.
|
|
|
304038 |
Unfortunately, in same cases (e.g. telnetd) it's impossible to specify
|
|
|
304038 |
login(1) command line options due to hardcoded execl()...
|
|
|
304038 |
|
|
|
304038 |
This patch introduces LOGIN_PLAIN_PROMPT boolean for /etc/login.defs
|
|
|
304038 |
to suppress hostname in the prompt.
|
|
|
304038 |
|
|
|
304038 |
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1520906
|
|
|
304038 |
Upstream: http://github.com/karelzak/util-linux/commit/e6b32e7d1adf2a0c09743d71dfdbe2742c5884ac
|
|
|
304038 |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
304038 |
---
|
|
|
304038 |
login-utils/login.1 | 12 ++++++++++++
|
|
|
304038 |
login-utils/login.c | 12 +++++++++---
|
|
|
304038 |
2 files changed, 21 insertions(+), 3 deletions(-)
|
|
|
304038 |
|
|
|
304038 |
diff --git a/login-utils/login.1 b/login-utils/login.1
|
|
|
304038 |
index 216645ebe..ec636fd74 100644
|
|
|
304038 |
--- a/login-utils/login.1
|
|
|
304038 |
+++ b/login-utils/login.1
|
|
|
304038 |
@@ -130,6 +130,9 @@ Used by other servers (i.e.,
|
|
|
304038 |
to tell
|
|
|
304038 |
.B login
|
|
|
304038 |
that printing the hostname should be suppressed in the login: prompt.
|
|
|
304038 |
+See also LOGIN_PLAIN_PROMPT below if your server does not allow to configure
|
|
|
304038 |
+.B login
|
|
|
304038 |
+command line.
|
|
|
304038 |
.TP
|
|
|
304038 |
.B \-V
|
|
|
304038 |
Print version and exit.
|
|
|
304038 |
@@ -157,6 +160,15 @@ by
|
|
|
304038 |
PAM module.
|
|
|
304038 |
.RE
|
|
|
304038 |
.PP
|
|
|
304038 |
+.B LOGIN_PLAIN_PROMPT
|
|
|
304038 |
+(boolean)
|
|
|
304038 |
+.RS 4
|
|
|
304038 |
+Tell login that printing the hostname should be suppressed in the login:
|
|
|
304038 |
+prompt. This is alternative to the \fB\-H\fR command line option. The default
|
|
|
304038 |
+value is
|
|
|
304038 |
+.IR no .
|
|
|
304038 |
+.RE
|
|
|
304038 |
+.PP
|
|
|
304038 |
.B LOGIN_TIMEOUT
|
|
|
304038 |
(number)
|
|
|
304038 |
.RS 4
|
|
|
304038 |
diff --git a/login-utils/login.c b/login-utils/login.c
|
|
|
304038 |
index 5c36953ef..eee3f7bd1 100644
|
|
|
304038 |
--- a/login-utils/login.c
|
|
|
304038 |
+++ b/login-utils/login.c
|
|
|
304038 |
@@ -709,7 +709,8 @@ static void loginpam_err(pam_handle_t *pamh, int retcode)
|
|
|
304038 |
}
|
|
|
304038 |
|
|
|
304038 |
/*
|
|
|
304038 |
- * Composes "<host> login: " string; or returns "login: " is -H is given
|
|
|
304038 |
+ * Composes "<host> login: " string; or returns "login: " if -H is given or
|
|
|
304038 |
+ * LOGIN_PLAIN_PROMPT=yes configured.
|
|
|
304038 |
*/
|
|
|
304038 |
static const char *loginpam_get_prompt(struct login_context *cxt)
|
|
|
304038 |
{
|
|
|
304038 |
@@ -717,11 +718,16 @@ static const char *loginpam_get_prompt(struct login_context *cxt)
|
|
|
304038 |
char *prompt, *dflt_prompt = _("login: ");
|
|
|
304038 |
size_t sz;
|
|
|
304038 |
|
|
|
304038 |
- if (cxt->nohost || !(host = get_thishost(cxt, NULL)))
|
|
|
304038 |
+ if (cxt->nohost)
|
|
|
304038 |
+ return dflt_prompt; /* -H on command line */
|
|
|
304038 |
+
|
|
|
304038 |
+ if (getlogindefs_bool("LOGIN_PLAIN_PROMPT", 0) == 1)
|
|
|
304038 |
return dflt_prompt;
|
|
|
304038 |
|
|
|
304038 |
- sz = strlen(host) + 1 + strlen(dflt_prompt) + 1;
|
|
|
304038 |
+ if (!(host = get_thishost(cxt, NULL)))
|
|
|
304038 |
+ return dflt_prompt;
|
|
|
304038 |
|
|
|
304038 |
+ sz = strlen(host) + 1 + strlen(dflt_prompt) + 1;
|
|
|
304038 |
prompt = xmalloc(sz);
|
|
|
304038 |
snprintf(prompt, sz, "%s %s", host, dflt_prompt);
|
|
|
304038 |
|
|
|
304038 |
--
|
|
|
304038 |
2.13.6
|
|
|
304038 |
|