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