Date: Sun, 10 Jan 2010 15:18:16 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r202004 - in user/ed/utmpx: contrib/telnet/telnetd libexec/rlogind libexec/telnetd Message-ID: <201001101518.o0AFIGYb062637@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ed Date: Sun Jan 10 15:18:16 2010 New Revision: 202004 URL: http://svn.freebsd.org/changeset/base/202004 Log: Massively simplify the shutdown code of telnetd/rlogind. ulog_logout() has no effect here, since we now use ut_id as identifiers instead of ut_lines. If phantom records really turn out to be a problem, we should just use getutxline() and call pututxline() for each entry returned. There is also no need to chown/chmod the pseudo-terminal devices, because they are garbage-collected automatically. Modified: user/ed/utmpx/contrib/telnet/telnetd/sys_term.c user/ed/utmpx/libexec/rlogind/Makefile user/ed/utmpx/libexec/rlogind/rlogind.c user/ed/utmpx/libexec/telnetd/Makefile Modified: user/ed/utmpx/contrib/telnet/telnetd/sys_term.c ============================================================================== --- user/ed/utmpx/contrib/telnet/telnetd/sys_term.c Sun Jan 10 15:12:15 2010 (r202003) +++ user/ed/utmpx/contrib/telnet/telnetd/sys_term.c Sun Jan 10 15:18:16 2010 (r202004) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include <sys/tty.h> #include <libutil.h> #include <stdlib.h> -#include <ulog.h> #include "telnetd.h" #include "pathnames.h" @@ -1304,23 +1303,7 @@ scrub_env(void) void cleanup(int sig __unused) { - char *p; - sigset_t mask; - p = line + sizeof(_PATH_DEV) - 1; - /* - * Block all signals before clearing the utmp entry. We don't want to - * be called again after calling logout() and then not add the wtmp - * entry because of not finding the corresponding entry in utmp. - */ - sigfillset(&mask); - sigprocmask(SIG_SETMASK, &mask, NULL); - ulog_logout(p); - (void)chmod(line, 0666); - (void)chown(line, 0, 0); - *p = 'p'; - (void)chmod(line, 0666); - (void)chown(line, 0, 0); - (void) shutdown(net, 2); + (void) shutdown(net, SHUT_RDWR); _exit(1); } Modified: user/ed/utmpx/libexec/rlogind/Makefile ============================================================================== --- user/ed/utmpx/libexec/rlogind/Makefile Sun Jan 10 15:12:15 2010 (r202003) +++ user/ed/utmpx/libexec/rlogind/Makefile Sun Jan 10 15:18:16 2010 (r202004) @@ -5,8 +5,8 @@ PROG= rlogind MAN= rlogind.8 -DPADD= ${LIBULOG} ${LIBUTIL} -LDADD= -lulog -lutil +DPADD= ${LIBUTIL} +LDADD= -lutil WARNS?= 2 .if ${MK_INET6_SUPPORT} != "no" Modified: user/ed/utmpx/libexec/rlogind/rlogind.c ============================================================================== --- user/ed/utmpx/libexec/rlogind/rlogind.c Sun Jan 10 15:12:15 2010 (r202003) +++ user/ed/utmpx/libexec/rlogind/rlogind.c Sun Jan 10 15:18:16 2010 (r202004) @@ -85,7 +85,6 @@ __FBSDID("$FreeBSD$"); #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ulog.h> #include <unistd.h> @@ -480,17 +479,7 @@ protocol(int f, int p) void cleanup(int signo) { - char *p; - p = line + sizeof(_PATH_DEV) - 1; - ulog_logout(p); - (void)chflags(line, 0); - (void)chmod(line, 0666); - (void)chown(line, 0, 0); - *p = 'p'; - (void)chflags(line, 0); - (void)chmod(line, 0666); - (void)chown(line, 0, 0); shutdown(netf, SHUT_RDWR); exit(1); } Modified: user/ed/utmpx/libexec/telnetd/Makefile ============================================================================== --- user/ed/utmpx/libexec/telnetd/Makefile Sun Jan 10 15:12:15 2010 (r202003) +++ user/ed/utmpx/libexec/telnetd/Makefile Sun Jan 10 15:18:16 2010 (r202004) @@ -28,8 +28,8 @@ CFLAGS+= -I${TELNETDIR} LIBTELNET= ${.OBJDIR}/../../lib/libtelnet/libtelnet.a -DPADD= ${LIBULOG} ${LIBUTIL} ${LIBTERMCAP} ${LIBTELNET} -LDADD= -lulog -lutil -ltermcap ${LIBTELNET} +DPADD= ${LIBUTIL} ${LIBTERMCAP} ${LIBTELNET} +LDADD= -lutil -ltermcap ${LIBTELNET} # XXX for src/release/picobsd .if !defined(RELEASE_CRUNCH)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001101518.o0AFIGYb062637>