diff options
author | cy <cy@FreeBSD.org> | 2010-11-19 04:44:32 +0800 |
---|---|---|
committer | cy <cy@FreeBSD.org> | 2010-11-19 04:44:32 +0800 |
commit | a253ac8967c178fb0dea83c571333c1460e0fcc7 (patch) | |
tree | 36f6083b50ad286346ff228e205aa887452103d7 /sysutils/screen | |
parent | ce946eb9858279cf828ebe4e2f8c00a34adbb3a3 (diff) | |
download | freebsd-ports-gnome-a253ac8967c178fb0dea83c571333c1460e0fcc7.tar.gz freebsd-ports-gnome-a253ac8967c178fb0dea83c571333c1460e0fcc7.tar.zst freebsd-ports-gnome-a253ac8967c178fb0dea83c571333c1460e0fcc7.zip |
Bjorn Zeeb discovered that screen(1) was mangling ut_host by performing
strange translations. For example, foo.bar.com gets translated to foo:S.0.
Unfortunately, this means that it also truncates IPv6 addresses,
e.g. 2001:7b8:310::1 -> 2001:S.0. Wouldn't it be better to just use the
hostname unmodified? ut_host is supposed to contain a hostname, not some
arbitrary string.
Submitted by: ed (Ed Schouten)
Discovered by: Bjorn Zeeb
Diffstat (limited to 'sysutils/screen')
-rw-r--r-- | sysutils/screen/Makefile | 2 | ||||
-rw-r--r-- | sysutils/screen/files/patch-utmp.c | 71 |
2 files changed, 70 insertions, 3 deletions
diff --git a/sysutils/screen/Makefile b/sysutils/screen/Makefile index f85d85ee60cf..7ed65e470593 100644 --- a/sysutils/screen/Makefile +++ b/sysutils/screen/Makefile @@ -7,7 +7,7 @@ PORTNAME= screen PORTVERSION= 4.0.3 -PORTREVISION= 8 +PORTREVISION= 9 CATEGORIES= sysutils MASTER_SITES= ftp://ftp.uni-erlangen.de/pub/utilities/screen/ \ http://komquats.com/distfiles/ \ diff --git a/sysutils/screen/files/patch-utmp.c b/sysutils/screen/files/patch-utmp.c index 44d8d613334c..496c53bc2831 100644 --- a/sysutils/screen/files/patch-utmp.c +++ b/sysutils/screen/files/patch-utmp.c @@ -1,6 +1,73 @@ --- utmp.c +++ utmp.c -@@ -589,7 +589,7 @@ +@@ -404,12 +404,6 @@ + register slot_t slot; + struct utmp u; + int saved_ut; +-#ifdef UTHOST +- char *p; +- char host[sizeof(D_loginhost) + 15]; +-#else +- char *host = 0; +-#endif /* UTHOST */ + + wi->w_slot = (slot_t)0; + if (!utmpok || wi->w_type != W_TYPE_PTY) +@@ -430,51 +424,12 @@ + makeuser(&u, stripdev(wi->w_tty), LoginName, wi->w_pid); + + #ifdef UTHOST +- host[sizeof(host) - 15] = '\0'; +- if (display) +- { +- strncpy(host, D_loginhost, sizeof(host) - 15); +- if (D_loginslot != (slot_t)0 && D_loginslot != (slot_t)-1 && host[0] != '\0') +- { +- /* +- * we want to set our ut_host field to something like +- * ":ttyhf:s.0" or +- * "faui45:s.0" or +- * "132.199.81.4:s.0" (even this may hurt..), but not +- * "faui45.informati"......:s.0 +- * HPUX uses host:0.0, so chop at "." and ":" (Eric Backus) +- */ +- for (p = host; *p; p++) +- if ((*p < '0' || *p > '9') && (*p != '.')) +- break; +- if (*p) +- { +- for (p = host; *p; p++) +- if (*p == '.' || (*p == ':' && p != host)) +- { +- *p = '\0'; +- break; +- } +- } +- } +- else +- { +- strncpy(host + 1, stripdev(D_usertty), sizeof(host) - 15 - 1); +- host[0] = ':'; +- } +- } +- else +- strncpy(host, "local", sizeof(host) - 15); +- +- sprintf(host + strlen(host), ":S.%d", wi->w_number); +- debug1("rlogin hostname: '%s'\n", host); +- + # if !defined(_SEQUENT_) && !defined(sequent) +- strncpy(u.ut_host, host, sizeof(u.ut_host)); ++ strncpy(u.ut_host, D_loginhost, sizeof(u.ut_host)); + # endif + #endif /* UTHOST */ + +- if (pututslot(slot, &u, host, wi) == 0) ++ if (pututslot(slot, &u, D_loginhost, wi) == 0) + { + Msg(errno,"Could not write %s", UtmpName); + UT_CLOSE; +@@ -589,7 +544,7 @@ struct utmp *u; { u->ut_type = DEAD_PROCESS; @@ -9,7 +76,7 @@ u->ut_exit.e_termination = 0; u->ut_exit.e_exit = 0; #endif -@@ -728,7 +728,7 @@ +@@ -728,7 +683,7 @@ { strncpy(u->ut_line, line, sizeof(u->ut_line)); strncpy(u->ut_name, user, sizeof(u->ut_name)); |