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