From owner-svn-src-user@FreeBSD.ORG Sun Jan 10 15:18:17 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32A041065676; Sun, 10 Jan 2010 15:18:17 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 212508FC17; Sun, 10 Jan 2010 15:18:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0AFIHE4062642; Sun, 10 Jan 2010 15:18:17 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0AFIGYb062637; Sun, 10 Jan 2010 15:18:16 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201001101518.o0AFIGYb062637@svn.freebsd.org> From: Ed Schouten Date: Sun, 10 Jan 2010 15:18:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202004 - in user/ed/utmpx: contrib/telnet/telnetd libexec/rlogind libexec/telnetd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2010 15:18:17 -0000 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 #include #include -#include #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 #include #include -#include #include @@ -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)