From 9f613df67eca0f2a09deb8d90152562748353a40 Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Mon, 24 Jun 1996 04:14:18 +0000 Subject: [PATCH] Drop support for -u because it allows us to remove dependencies from utmp.h and it didn't work anyway. This fixes some Hpux compile problems as well. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@8542 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/telnet/telnetd/ChangeLog | 11 ++ src/appl/telnet/telnetd/sys_term.c | 220 ----------------------------- src/appl/telnet/telnetd/telnetd.8 | 16 --- src/appl/telnet/telnetd/telnetd.c | 9 +- 4 files changed, 13 insertions(+), 243 deletions(-) diff --git a/src/appl/telnet/telnetd/ChangeLog b/src/appl/telnet/telnetd/ChangeLog index 2026d5a95..0729c1e17 100644 --- a/src/appl/telnet/telnetd/ChangeLog +++ b/src/appl/telnet/telnetd/ChangeLog @@ -1,3 +1,14 @@ +Thu Jun 13 17:05:17 1996 Sam Hartman + + * telnetd.8: Remove documentation of desupported -u options. + + * sys_term.c: Remove last fragments of PARENT_DOES_UTMP, and + remove dependence on utmp.h and utmpx.h + + * telnetd.c: Remove support for -u option as that type of utmp + mucking is below the libpty abstraction and I do not see it as + useful enough to export outside libpty. + Tue Jun 4 00:27:09 1996 Tom Yu * configure.in: Ezra's changes to allow compiling w/o krb4 diff --git a/src/appl/telnet/telnetd/sys_term.c b/src/appl/telnet/telnetd/sys_term.c index 829260b55..a7c7ee526 100644 --- a/src/appl/telnet/telnetd/sys_term.c +++ b/src/appl/telnet/telnetd/sys_term.c @@ -52,29 +52,13 @@ char *login_program = LOGIN_PROGRAM; -#if defined(CRAY) || defined(__hpux) -# define PARENT_DOES_UTMP -#endif - #ifdef NEWINIT #include int utmp_len = MAXHOSTNAMELEN; /* sizeof(init_request.host) */ #else /* NEWINIT*/ -# ifdef UTMPX -# include -struct utmpx wtmp; -# else -#include -struct utmp wtmp; -#endif /*UTMPX*/ -int utmp_len = sizeof(wtmp.ut_host); -# ifndef PARENT_DOES_UTMP char wtmpf[] = "/usr/adm/wtmp"; char utmpf[] = "/etc/utmp"; -# else /* PARENT_DOES_UTMP */ -char wtmpf[] = "/etc/wtmp"; -# endif /* PARENT_DOES_UTMP */ # ifdef CRAY #include @@ -896,30 +880,8 @@ tty_isnewmap() } #endif -#ifdef PARENT_DOES_UTMP -# ifndef NEWINIT -extern struct utmp wtmp; -extern char wtmpf[]; -# else /* NEWINIT */ -int gotalarm; - - /* ARGSUSED */ - void -nologinproc(sig) - int sig; -{ - gotalarm++; -} -# endif /* NEWINIT */ -#endif /* PARENT_DOES_UTMP */ #ifndef NEWINIT -# ifdef PARENT_DOES_UTMP -extern void utmp_sig_init P((void)); -extern void utmp_sig_reset P((void)); -extern void utmp_sig_wait P((void)); -extern void utmp_sig_notify P((int)); -# endif /* PARENT_DOES_UTMP */ #endif /* @@ -1478,189 +1440,7 @@ cleanup(sig) exit(1); } -#if defined(PARENT_DOES_UTMP) && !defined(NEWINIT) -/* - * _utmp_sig_rcv - * utmp_sig_init - * utmp_sig_wait - * These three functions are used to coordinate the handling of - * the utmp file between the server and the soon-to-be-login shell. - * The server actually creates the utmp structure, the child calls - * utmp_sig_wait(), until the server calls utmp_sig_notify() and - * signals the future-login shell to proceed. - */ -static int caught=0; /* NZ when signal intercepted */ -static void (*func)(); /* address of previous handler */ - - void -_utmp_sig_rcv(sig) - int sig; -{ - caught = 1; - (void) signal(SIGUSR1, func); -} - - void -utmp_sig_init() -{ - /* - * register signal handler for UTMP creation - */ - if ((int)(func = signal(SIGUSR1, _utmp_sig_rcv)) == -1) - fatalperror(net, "telnetd/signal"); -} - - void -utmp_sig_reset() -{ - (void) signal(SIGUSR1, func); /* reset handler to default */ -} - -# ifdef __hpux -# define sigoff() /* do nothing */ -# define sigon() /* do nothing */ -# endif - - void -utmp_sig_wait() -{ - /* - * Wait for parent to write our utmp entry. - */ - sigoff(); - while (caught == 0) { - pause(); /* wait until we get a signal (sigon) */ - sigoff(); /* turn off signals while we check caught */ - } - sigon(); /* turn on signals again */ -} - - void -utmp_sig_notify(pid) -{ - kill(pid, SIGUSR1); -} - -# ifdef CRAY -static int gotsigjob = 0; - - /*ARGSUSED*/ - void -sigjob(sig) - int sig; -{ - register int jid; - register struct jobtemp *jp; - - while ((jid = waitjob(NULL)) != -1) { - if (jid == 0) { - return; - } - gotsigjob++; - jobend(jid, NULL, NULL); - } -} - -/* - * Clean up the TMPDIR that login created. - * The first time this is called we pick up the info - * from the utmp. If the job has already gone away, - * then we'll clean up and be done. If not, then - * when this is called the second time it will wait - * for the signal that the job is done. - */ - int -cleantmp(wtp) - register struct utmp *wtp; -{ - struct utmp *utp; - static int first = 1; - register int mask, omask, ret; - extern struct utmp *getutid P((const struct utmp *_Id)); - - - mask = sigmask(WJSIGNAL); - - if (first == 0) { - omask = sigblock(mask); - while (gotsigjob == 0) - sigpause(omask); - return(1); - } - first = 0; - setutent(); /* just to make sure */ - - utp = getutid(wtp); - if (utp == 0) { - syslog(LOG_ERR, "Can't get /etc/utmp entry to clean TMPDIR"); - return(-1); - } - /* - * Nothing to clean up if the user shell was never started. - */ - if (utp->ut_type != USER_PROCESS || utp->ut_jid == 0) - return(1); - - /* - * Block the WJSIGNAL while we are in jobend(). - */ - omask = sigblock(mask); - ret = jobend(utp->ut_jid, utp->ut_tpath, utp->ut_user); - sigsetmask(omask); - return(ret); -} - int -jobend(jid, path, user) - register int jid; - register char *path; - register char *user; -{ - static int saved_jid = 0; - static char saved_path[sizeof(wtmp.ut_tpath)+1]; - static char saved_user[sizeof(wtmp.ut_user)+1]; - - if (path) { - strncpy(saved_path, path, sizeof(wtmp.ut_tpath)); - strncpy(saved_user, user, sizeof(wtmp.ut_user)); - saved_path[sizeof(saved_path)] = '\0'; - saved_user[sizeof(saved_user)] = '\0'; - } - if (saved_jid == 0) { - saved_jid = jid; - return(0); - } - cleantmpdir(jid, saved_path, saved_user); - return(1); -} -/* - * Fork a child process to clean up the TMPDIR - */ -cleantmpdir(jid, tpath, user) - register int jid; - register char *tpath; - register char *user; -{ - switch(fork()) { - case -1: - syslog(LOG_ERR, "TMPDIR cleanup(%s): fork() failed: %m", - tpath); - break; - case 0: - execl(CLEANTMPCMD, CLEANTMPCMD, user, tpath, 0); - syslog(LOG_ERR, "TMPDIR cleanup(%s): execl(%s) failed: %m", - tpath, CLEANTMPCMD); - exit(1); - default: - /* - * Forget about child. We will exit, and - * /etc/init will pick it up. - */ - break; - } -} -# endif /* CRAY */ -#endif /* defined(PARENT_DOES_UTMP) && !defined(NEWINIT) */ diff --git a/src/appl/telnet/telnetd/telnetd.8 b/src/appl/telnet/telnetd/telnetd.8 index 7465bf1de..6407d3655 100644 --- a/src/appl/telnet/telnetd/telnetd.8 +++ b/src/appl/telnet/telnetd/telnetd.8 @@ -299,22 +299,6 @@ validated logins are allowed, and is usually useful for controlling remote logins from outside of a firewall. .It Fl S Ar tos -.It Fl u Ar len -This option is used to specify the size of the field -in the -.Dv utmp -structure that holds the remote host name. -If the resolved host name is longer than -.Ar len , -the dotted decimal value will be used instead. -This allows hosts with very long host names that -overflow this field to still be uniquely identified. -Specifying -.Fl u0 -indicates that only dotted decimal addresses -should be put into the -.Pa utmp -file. .It Fl U This option causes .Nm telnetd diff --git a/src/appl/telnet/telnetd/telnetd.c b/src/appl/telnet/telnetd/telnetd.c index c3660d2c2..ff2a63a84 100644 --- a/src/appl/telnet/telnetd/telnetd.c +++ b/src/appl/telnet/telnetd/telnetd.c @@ -87,7 +87,6 @@ struct socket_security ss; #include #endif -extern int utmp_len; int registerd_host_only = 0; #ifdef STREAMSPTY @@ -149,7 +148,7 @@ extern void usage P((void)); * passed off to getopt(). */ char valid_opts[] = { - 'd', ':', 'h', 'k', 'L', ':', 'n', 'S', ':', 'u', ':', 'U', + 'd', ':', 'h', 'k', 'L', ':', 'n', 'S', ':', 'U', #ifdef AUTHENTICATION 'a', ':', 'X', ':', #endif @@ -397,9 +396,6 @@ main(argc, argv) } #endif /* KRB5 */ - case 'u': - utmp_len = atoi(optarg); - break; case 'U': registerd_host_only = 1; @@ -911,8 +907,7 @@ pty_init(); if (hp == NULL && registerd_host_only) { fatal(net, "Couldn't resolve your address into a host name.\r\n\ Please contact your net administrator"); - } else if (hp && - (strlen(hp->h_name) <= ((utmp_len < 0) ? -utmp_len : utmp_len))) { + } else if (hp ) { host = hp->h_name; } else { host = inet_ntoa(who->sin_addr); -- 2.26.2