[kbd] [Enhancement] Add hostname to message on locked screen
Vladimir Lomov <[email protected]> Thu, 1 Jun 2017 22:54:47 +0800
| Newsgroups | dev.linux.lists.kbd |
|---|---|
| Message-ID | <[email protected]> |
Hello, I'd like to propose small enhancement: to add to the message on locked screen information about current host. May be it is worth to store the same information in syslog, I don't have any opinion. I attached small patch that works (basically) on my system (Archlinux x86_64). --- WBR, Vladimir Lomov -- I can give you my word, but I know what it's worth and you don't. -- Nero Wolfe, "Over My Dead Body"
kbd-vlock.patch
(text/x-diff, 829 B)
diff --git a/src/vlock/auth.c b/src/vlock/auth.c
index 25efb5e..f0200eb 100644
--- a/src/vlock/auth.c
+++ b/src/vlock/auth.c
@@ -60,6 +60,7 @@ do_account_password_management(pam_handle_t *pamh)
int get_password(pam_handle_t *pamh, const char *username, const char *tty)
{
uid_t uid = getuid();
+ char *hostname = getenv("HOSTNAME");
for (;;) {
int rc;
@@ -83,8 +84,8 @@ int get_password(pam_handle_t *pamh, const char *username, const char *tty)
printf(_("The entire console display is now completely locked by %s.\n"),
username);
} else {
- printf(_("The %s is now locked by %s.\n"), tty,
- username);
+ printf(_("The %s is now locked by %s on %s.\n"), tty,
+ username, hostname);
if (is_vt)
puts(_("Use Alt-function keys to switch to other virtual consoles."));
}