From 2a4486f71c9892480fdd04a187841b1b1243c1de Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Fri, 30 May 1997 02:21:04 +0000 Subject: [PATCH] (start_login): Set `ut_id' if we're using utmpx git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1785 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/telnet/telnetd/sys_term.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/appl/telnet/telnetd/sys_term.c b/appl/telnet/telnetd/sys_term.c index e73348615..57fa633f8 100644 --- a/appl/telnet/telnetd/sys_term.c +++ b/appl/telnet/telnetd/sys_term.c @@ -1083,6 +1083,22 @@ clean_ttyname (char *tty) return res; } +/* + * Generate a name usable as an `ut_id', typically without `tty'. + */ + +static char * +make_id (char *tty) +{ + char *res = tty; + + if (strncmp (res, "pts/", 4) == 0) + res += 4; + if (strncmp (res, "tty", 3) == 0) + res += 3; + return res; +} + /* * startslave(host) * @@ -1244,6 +1260,9 @@ void start_login(char *host, int autologin, char *name) strncpy(utmpx.ut_user, ".telnet", sizeof(utmpx.ut_user)); strncpy(utmpx.ut_line, clean_ttyname(line), sizeof(utmpx.ut_line)); +#ifdef HAVE_UT_ID + strncpy(utmpx.ut_id, make_id(utmpx.ut_line), sizeof(utmpx.ut_id)); +#endif utmpx.ut_pid = pid; utmpx.ut_type = LOGIN_PROCESS;