Package: screen
Version: 4.0.3-11
Severity: wishlist
Tags: patch

Hi,

currently, only fullname and login are displayed when a screen is
locked, which makes it a bit difficult to figure out which password has
to be typed when you've ssh-ed to several boxes. Please find attached a
very quick and very dirty patch which did the trick. You could be using
HOST_NAME_MAX instead of 255+1, but IIRC that will trigger an FTBFS on
hurd, where you'd have to use xgethostname (by Neal Walfield) or
similar, which uses a dynamic memory allocation instead of a
macro-defined static limit (that POSIX doesn't require to exist IIRC).

Thanks for considering.

Mraw,
KiBi.

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: powerpc (ppc)

Kernel: Linux 2.6.27-rc7-powerpc
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages screen depends on:
ii  libc6                     2.7-13         GNU C Library: Shared libraries
ii  libncursesw5              5.6+20080830-1 shared libraries for terminal hand
ii  libpam0g                  1.0.1-4        Pluggable Authentication Modules l

screen recommends no packages.

screen suggests no packages.

-- debconf information:
  screen/old_upgrade_prompt: false
--- a/attacher.c
+++ b/attacher.c
@@ -803,6 +803,7 @@
 screen_builtin_lck()
 {
   char fullname[100], *cp1, message[100 + 100];
+  char hostname[256]; /* 255+1, according to gethostname(2) */
 #ifdef USE_PAM
   pam_handle_t *pamh = 0;
   int pam_error;
@@ -859,8 +860,13 @@
 	*cp1 -= 'a' - 'A';
     }
 
-  sprintf(message, "Screen used by %s <%s>.\nPassword:\007",
-          fullname, ppp->pw_name);
+  if (gethostname(hostname, 256)!=0) {
+    printf("Couldn't retrieve the current hostname.\n");
+    hostname[0]=0;
+  }
+
+  sprintf(message, "Screen used by %s <%s> on %s.\nPassword:\007",
+          fullname, ppp->pw_name, hostname);
 
   /* loop here to wait for correct password */
   for (;;)

Reply via email to