From owner-svn-src-user@FreeBSD.ORG Tue Jan 5 15:15:16 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 09795106566B; Tue, 5 Jan 2010 15:15:16 +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 DFB188FC0A; Tue, 5 Jan 2010 15:15:15 +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 o05FFFDD033796; Tue, 5 Jan 2010 15:15:15 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o05FFFtd033766; Tue, 5 Jan 2010 15:15:15 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201001051515.o05FFFtd033766@svn.freebsd.org> From: Ed Schouten Date: Tue, 5 Jan 2010 15:15:15 +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: r201590 - in user/ed/utmpx: . bin/csh bin/date bin/pax contrib/opie/libopie contrib/tcsh contrib/telnet/telnetd crypto/openssh include lib/libc/gen lib/libopie lib/libutil libexec/comsa... 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: Tue, 05 Jan 2010 15:15:16 -0000 Author: ed Date: Tue Jan 5 15:15:15 2010 New Revision: 201590 URL: http://svn.freebsd.org/changeset/base/201590 Log: Add a stub implementation and remove . The functions in libc are just empty, so right now logging is actually broken. The tree should build, but I had to disable some apps that I haven't ported to yet. TODO. Also remove login(3), logout(3) and logwtmp(3). libutil doesn't use symbol versioning, so I am considering bumping the major number. Added: user/ed/utmpx/include/utmpx.h (contents, props changed) user/ed/utmpx/lib/libc/gen/getutxent.c (contents, props changed) Deleted: user/ed/utmpx/lib/libutil/login.3 user/ed/utmpx/lib/libutil/login.c user/ed/utmpx/lib/libutil/logout.3 user/ed/utmpx/lib/libutil/logout.c user/ed/utmpx/lib/libutil/logwtmp.3 user/ed/utmpx/lib/libutil/logwtmp.c Modified: user/ed/utmpx/ObsoleteFiles.inc user/ed/utmpx/bin/csh/config.h user/ed/utmpx/bin/date/Makefile user/ed/utmpx/bin/date/date.c user/ed/utmpx/bin/pax/gen_subs.c user/ed/utmpx/contrib/opie/libopie/getutmpentry.c user/ed/utmpx/contrib/opie/libopie/insecure.c user/ed/utmpx/contrib/tcsh/tc.who.c user/ed/utmpx/contrib/telnet/telnetd/sys_term.c user/ed/utmpx/contrib/telnet/telnetd/telnetd.c user/ed/utmpx/crypto/openssh/config.h user/ed/utmpx/crypto/openssh/sshd.c user/ed/utmpx/include/Makefile user/ed/utmpx/include/utmp.h user/ed/utmpx/lib/libc/gen/Makefile.inc user/ed/utmpx/lib/libc/gen/Symbol.map user/ed/utmpx/lib/libopie/Makefile user/ed/utmpx/lib/libopie/config.h user/ed/utmpx/lib/libutil/Makefile user/ed/utmpx/lib/libutil/libutil.h user/ed/utmpx/libexec/comsat/comsat.c user/ed/utmpx/libexec/ftpd/logwtmp.c user/ed/utmpx/libexec/rlogind/Makefile user/ed/utmpx/libexec/rlogind/rlogind.c user/ed/utmpx/libexec/rpc.rusersd/Makefile user/ed/utmpx/libexec/rpc.rusersd/rusers_proc.c user/ed/utmpx/libexec/talkd/Makefile user/ed/utmpx/libexec/talkd/process.c user/ed/utmpx/libexec/telnetd/Makefile user/ed/utmpx/sbin/init/init.c user/ed/utmpx/sbin/reboot/Makefile user/ed/utmpx/sbin/reboot/reboot.c user/ed/utmpx/usr.bin/Makefile user/ed/utmpx/usr.bin/systat/Makefile user/ed/utmpx/usr.bin/systat/vmstat.c user/ed/utmpx/usr.bin/users/Makefile user/ed/utmpx/usr.bin/users/users.c user/ed/utmpx/usr.bin/w/Makefile user/ed/utmpx/usr.bin/w/w.c user/ed/utmpx/usr.bin/wall/Makefile user/ed/utmpx/usr.bin/wall/wall.c user/ed/utmpx/usr.bin/who/Makefile user/ed/utmpx/usr.bin/who/who.c user/ed/utmpx/usr.bin/write/Makefile user/ed/utmpx/usr.bin/write/write.c user/ed/utmpx/usr.sbin/Makefile user/ed/utmpx/usr.sbin/ac/Makefile user/ed/utmpx/usr.sbin/ac/ac.c user/ed/utmpx/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile user/ed/utmpx/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c user/ed/utmpx/usr.sbin/rwhod/Makefile user/ed/utmpx/usr.sbin/rwhod/rwhod.c user/ed/utmpx/usr.sbin/syslogd/Makefile user/ed/utmpx/usr.sbin/syslogd/syslogd.c user/ed/utmpx/usr.sbin/timed/timed/master.c user/ed/utmpx/usr.sbin/timed/timed/slave.c Modified: user/ed/utmpx/ObsoleteFiles.inc ============================================================================== --- user/ed/utmpx/ObsoleteFiles.inc Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/ObsoleteFiles.inc Tue Jan 5 15:15:15 2010 (r201590) @@ -14,6 +14,10 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20100104: login(3), logout(3) and logwtmp(3) removed +OLD_FILES+=usr/share/man/man3/login.3.gz +OLD_FILES+=usr/share/man/man3/logout.3.gz +OLD_FILES+=usr/share/man/man3/logwtmp.3.gz # 20100103: ntptrace(8) removed OLD_FILES+=usr/sbin/ntptrace OLD_FILES+=usr/share/man/man8/ntptrace.8.gz Modified: user/ed/utmpx/bin/csh/config.h ============================================================================== --- user/ed/utmpx/bin/csh/config.h Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/bin/csh/config.h Tue Jan 5 15:15:15 2010 (r201590) @@ -130,10 +130,10 @@ #define HAVE_STRUCT_UTMP_UT_HOST 1 /* Define to 1 if `ut_tv' is member of `struct utmp'. */ -/* #undef HAVE_STRUCT_UTMP_UT_TV */ +#define HAVE_STRUCT_UTMP_UT_TV 1 /* Define to 1 if `ut_user' is member of `struct utmp'. */ -/* #undef HAVE_STRUCT_UTMP_UT_USER */ +#define HAVE_STRUCT_UTMP_UT_USER 1 /* Define to 1 if `ut_xtime' is member of `struct utmp'. */ /* #undef HAVE_STRUCT_UTMP_UT_XTIME */ @@ -159,10 +159,10 @@ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the header file. */ -/* #undef HAVE_UTMPX_H */ +#define HAVE_UTMPX_H 1 /* Define to 1 if you have the header file. */ -#define HAVE_UTMP_H 1 +/* #undef HAVE_UTMP_H */ /* Define to 1 if you have the header file. */ #define HAVE_WCHAR_H 1 Modified: user/ed/utmpx/bin/date/Makefile ============================================================================== --- user/ed/utmpx/bin/date/Makefile Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/bin/date/Makefile Tue Jan 5 15:15:15 2010 (r201590) @@ -3,7 +3,5 @@ PROG= date SRCS= date.c netdate.c vary.c -DPADD= ${LIBULOG} -LDADD= -lulog .include Modified: user/ed/utmpx/bin/date/date.c ============================================================================== --- user/ed/utmpx/bin/date/date.c Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/bin/date/date.c Tue Jan 5 15:15:15 2010 (r201590) @@ -52,9 +52,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _ULOG_POSIX_NAMES -#include #include +#include #include "extern.h" #include "vary.h" Modified: user/ed/utmpx/bin/pax/gen_subs.c ============================================================================== --- user/ed/utmpx/bin/pax/gen_subs.c Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/bin/pax/gen_subs.c Tue Jan 5 15:15:15 2010 (r201590) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -66,10 +65,6 @@ __FBSDID("$FreeBSD$"); #define OLDFRMTM "%b %e %Y" #define CURFRMTD "%e %b %H:%M" #define OLDFRMTD "%e %b %Y" -#ifndef UT_NAMESIZE -#define UT_NAMESIZE 8 -#endif -#define UT_GRPSIZE 6 static int d_first = -1; @@ -116,9 +111,8 @@ ls_list(ARCHD *arcn, time_t now, FILE *f */ if (strftime(f_date,DATELEN,timefrmt,localtime(&(sbp->st_mtime))) == 0) f_date[0] = '\0'; - (void)fprintf(fp, "%s%2u %-*s %-*s ", f_mode, sbp->st_nlink, - UT_NAMESIZE, name_uid(sbp->st_uid, 1), UT_GRPSIZE, - name_gid(sbp->st_gid, 1)); + (void)fprintf(fp, "%s%2u %-12s %-12s ", f_mode, sbp->st_nlink, + name_uid(sbp->st_uid, 1), name_gid(sbp->st_gid, 1)); /* * print device id's for devices, or sizes for other nodes Modified: user/ed/utmpx/contrib/opie/libopie/getutmpentry.c ============================================================================== --- user/ed/utmpx/contrib/opie/libopie/getutmpentry.c Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/contrib/opie/libopie/getutmpentry.c Tue Jan 5 15:15:15 2010 (r201590) @@ -15,13 +15,14 @@ you didn't get a copy, you may request o #include "opie_cfg.h" #include #include -#include #if DOUTMPX #include #define setutent setutxent #define getutline(x) getutxline(x) #define utmp utmpx +#else +#include #endif /* DOUTMPX */ #if HAVE_STRING_H Modified: user/ed/utmpx/contrib/opie/libopie/insecure.c ============================================================================== --- user/ed/utmpx/contrib/opie/libopie/insecure.c Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/contrib/opie/libopie/insecure.c Tue Jan 5 15:15:15 2010 (r201590) @@ -39,11 +39,12 @@ $FreeBSD$ #include #include -#include #if DOUTMPX #include #define utmp utmpx #define endutent endutxent +#else +#include #endif /* DOUTMPX */ #if HAVE_SYS_UTSNAME_H Modified: user/ed/utmpx/contrib/tcsh/tc.who.c ============================================================================== --- user/ed/utmpx/contrib/tcsh/tc.who.c Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/contrib/tcsh/tc.who.c Tue Jan 5 15:15:15 2010 (r201590) @@ -55,6 +55,8 @@ RCSID("$tcsh: tc.who.c,v 3.51 2006/03/03 # define TCSH_PATH_UTMP _PATH_UTMPX # elif defined(UTMPX_FILE) # define TCSH_PATH_UTMP UTMPX_FILE +# else +# define TCSH_PATH_UTMP "/nonexistent" # endif /* __UTMPX_FILE && !UTMPX_FILE */ # ifdef TCSH_PATH_UTMP # define utmp utmpx Modified: user/ed/utmpx/contrib/telnet/telnetd/sys_term.c ============================================================================== --- user/ed/utmpx/contrib/telnet/telnetd/sys_term.c Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/contrib/telnet/telnetd/sys_term.c Tue Jan 5 15:15:15 2010 (r201590) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "telnetd.h" #include "pathnames.h" @@ -1314,8 +1315,7 @@ cleanup(int sig __unused) */ sigfillset(&mask); sigprocmask(SIG_SETMASK, &mask, NULL); - if (logout(p)) - logwtmp(p, "", ""); + ulog_logout(p); (void)chmod(line, 0666); (void)chown(line, 0, 0); *p = 'p'; Modified: user/ed/utmpx/contrib/telnet/telnetd/telnetd.c ============================================================================== --- user/ed/utmpx/contrib/telnet/telnetd/telnetd.c Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/contrib/telnet/telnetd/telnetd.c Tue Jan 5 15:15:15 2010 (r201590) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include @@ -61,7 +60,6 @@ int auth_level = 0; #include char remote_hostname[MAXHOSTNAMELEN]; -size_t utmp_len = sizeof(remote_hostname) - 1; int registerd_host_only = 0; @@ -286,12 +284,6 @@ main(int argc, char *argv[]) #endif break; - case 'u': - utmp_len = (size_t)atoi(optarg); - if (utmp_len >= sizeof(remote_hostname)) - utmp_len = sizeof(remote_hostname) - 1; - break; - case 'U': registerd_host_only = 1; break; @@ -661,7 +653,6 @@ terminaltypeok(char *s) void doit(struct sockaddr *who) { - int err_; /* XXX */ int ptynum; /* @@ -693,13 +684,6 @@ doit(struct sockaddr *who) Please contact your net administrator"); remote_hostname[sizeof(remote_hostname) - 1] = '\0'; - trimdomain(remote_hostname, UT_HOSTSIZE); - if (!isdigit(remote_hostname[0]) && strlen(remote_hostname) > utmp_len) - err_ = getnameinfo(who, who->sa_len, remote_hostname, - sizeof(remote_hostname), NULL, 0, - NI_NUMERICHOST); - /* XXX: do 'err_' check */ - (void) gethostname(host_name, sizeof(host_name) - 1); host_name[sizeof(host_name) - 1] = '\0'; hostname = host_name; Modified: user/ed/utmpx/crypto/openssh/config.h ============================================================================== --- user/ed/utmpx/crypto/openssh/config.h Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/crypto/openssh/config.h Tue Jan 5 15:15:15 2010 (r201590) @@ -85,13 +85,13 @@ /* #undef CONF_UTMPX_FILE */ /* Define if you want to specify the path to your utmp file */ -#define CONF_UTMP_FILE "/var/run/utmp" +/* #undef CONF_UTMP_FILE */ /* Define if you want to specify the path to your wtmpx file */ /* #undef CONF_WTMPX_FILE */ /* Define if you want to specify the path to your wtmp file */ -#define CONF_WTMP_FILE "/var/log/wtmp" +/* #undef CONF_WTMP_FILE */ /* Define if your platform needs to skip post auth file descriptor passing */ /* #undef DISABLE_FD_PASSING */ @@ -112,13 +112,13 @@ /* #undef DISABLE_SHADOW */ /* Define if you don't want to use utmp */ -/* #undef DISABLE_UTMP */ +#define DISABLE_UTMP 1 /* Define if you don't want to use utmpx */ -#define DISABLE_UTMPX 1 +/* #undef DISABLE_UTMPX */ /* Define if you don't want to use wtmp */ -/* #undef DISABLE_WTMP */ +#define DISABLE_WTMP 1 /* Define if you don't want to use wtmpx */ #define DISABLE_WTMPX 1 @@ -319,7 +319,7 @@ /* #undef HAVE_ENDUTENT */ /* Define to 1 if you have the `endutxent' function. */ -/* #undef HAVE_ENDUTXENT */ +#define HAVE_ENDUTXENT 1 /* Define if your system has /etc/default/login */ /* #undef HAVE_ETC_DEFAULT_LOGIN */ @@ -445,13 +445,13 @@ /* #undef HAVE_GETUTLINE */ /* Define to 1 if you have the `getutxent' function. */ -/* #undef HAVE_GETUTXENT */ +#define HAVE_GETUTXENT 1 /* Define to 1 if you have the `getutxid' function. */ /* #undef HAVE_GETUTXID */ /* Define to 1 if you have the `getutxline' function. */ -/* #undef HAVE_GETUTXLINE */ +#define HAVE_GETUTXLINE 1 /* Define to 1 if you have the `get_default_context_with_level' function. */ /* #undef HAVE_GET_DEFAULT_CONTEXT_WITH_LEVEL */ @@ -487,7 +487,7 @@ #define HAVE_HOST_IN_UTMP 1 /* Define if you have ut_host in utmpx.h */ -/* #undef HAVE_HOST_IN_UTMPX */ +#define HAVE_HOST_IN_UTMPX 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_IAF_H */ @@ -499,7 +499,7 @@ /* #undef HAVE_ID_IN_UTMP */ /* Define if you have ut_id in utmpx.h */ -/* #undef HAVE_ID_IN_UTMPX */ +#define HAVE_ID_IN_UTMPX 1 /* Define to 1 if you have the `inet_aton' function. */ #define HAVE_INET_ATON 1 @@ -574,7 +574,7 @@ /* #undef HAVE_LINUX_IF_TUN_H */ /* Define if your libraries define login() */ -#define HAVE_LOGIN 1 +/* #undef HAVE_LOGIN */ /* Define to 1 if you have the header file. */ #define HAVE_LOGIN_CAP_H 1 @@ -704,7 +704,7 @@ /* #undef HAVE_PUTUTLINE */ /* Define to 1 if you have the `pututxline' function. */ -/* #undef HAVE_PUTUTXLINE */ +#define HAVE_PUTUTXLINE 1 /* Define if your password has a pw_change field */ #define HAVE_PW_CHANGE_IN_PASSWD 1 @@ -800,7 +800,7 @@ /* #undef HAVE_SETUTENT */ /* Define to 1 if you have the `setutxent' function. */ -/* #undef HAVE_SETUTXENT */ +#define HAVE_SETUTXENT 1 /* Define to 1 if you have the `setvbuf' function. */ #define HAVE_SETVBUF 1 @@ -1043,7 +1043,7 @@ /* #undef HAVE_TV_IN_UTMP */ /* Define if you have ut_tv in utmpx.h */ -/* #undef HAVE_TV_IN_UTMPX */ +#define HAVE_TV_IN_UTMPX 1 /* Define if you have ut_type in utmp.h */ /* #undef HAVE_TYPE_IN_UTMP */ @@ -1091,10 +1091,10 @@ /* #undef HAVE_UTMPXNAME */ /* Define to 1 if you have the header file. */ -/* #undef HAVE_UTMPX_H */ +#define HAVE_UTMPX_H 1 /* Define to 1 if you have the header file. */ -#define HAVE_UTMP_H 1 +/* #undef HAVE_UTMP_H */ /* define if you have u_char data type */ #define HAVE_U_CHAR 1 @@ -1175,7 +1175,7 @@ /* #undef KRB5 */ /* Define if pututxline updates lastlog too */ -/* #undef LASTLOG_WRITE_PUTUTXLINE */ +#define LASTLOG_WRITE_PUTUTXLINE 1 /* Define if you want TCP Wrappers support */ #define LIBWRAP 1 Modified: user/ed/utmpx/crypto/openssh/sshd.c ============================================================================== --- user/ed/utmpx/crypto/openssh/sshd.c Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/crypto/openssh/sshd.c Tue Jan 5 15:15:15 2010 (r201590) @@ -73,7 +73,6 @@ __RCSID("$FreeBSD$"); #include #include #include -#include #include #include @@ -240,7 +239,7 @@ u_char *session_id2 = NULL; u_int session_id2_len = 0; /* record remote hostname or ip */ -u_int utmp_len = UT_HOSTSIZE; +u_int utmp_len = MAXHOSTNAMELEN; /* options.max_startup sized array of fd ints */ int *startup_pipes = NULL; Modified: user/ed/utmpx/include/Makefile ============================================================================== --- user/ed/utmpx/include/Makefile Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/include/Makefile Tue Jan 5 15:15:15 2010 (r201590) @@ -23,8 +23,8 @@ INCS= a.out.h ar.h assert.h bitstring.h stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \ strings.h sysexits.h tar.h termios.h tgmath.h \ time.h timeconv.h timers.h ttyent.h \ - ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \ - wctype.h wordexp.h + ulimit.h unistd.h utime.h utmp.h utmpx.h uuid.h varargs.h vis.h \ + wchar.h wctype.h wordexp.h MHDRS= float.h floatingpoint.h stdarg.h Modified: user/ed/utmpx/include/utmp.h ============================================================================== --- user/ed/utmpx/include/utmp.h Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/include/utmp.h Tue Jan 5 15:15:15 2010 (r201590) @@ -1,73 +1,2 @@ -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)utmp.h 8.2 (Berkeley) 1/21/94 - * $FreeBSD$ - */ - -#ifndef _UTMP_H_ -#define _UTMP_H_ - -#define _PATH_UTMP "/var/run/utmp" -#define _PATH_WTMP "/var/log/wtmp" -#define _PATH_LASTLOG "/var/log/lastlog" - -/* - * XXX: These values are too low, but cannot be changed without breaking - * the file format. Right now pts(4) is limited to 1000 instances, - * because /dev/pts/1000 would require UT_LINESIZE to be bigger. - * UT_HOSTSIZE is also too small to hold most common hostnames or IPv6 - * addresses. - */ -#define UT_NAMESIZE 16 /* see MAXLOGNAME in */ -#define UT_LINESIZE 8 -#define UT_HOSTSIZE 16 - -struct lastlog { - int32_t ll_time; - char ll_line[UT_LINESIZE]; - char ll_host[UT_HOSTSIZE]; -}; - -struct utmp { - char ut_line[UT_LINESIZE]; - char ut_name[UT_NAMESIZE]; - char ut_host[UT_HOSTSIZE]; - int32_t ut_time; -}; - -#endif /* !_UTMP_H_ */ +/* $FreeBSD$ */ +#error " has been replaced by " Added: user/ed/utmpx/include/utmpx.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ed/utmpx/include/utmpx.h Tue Jan 5 15:15:15 2010 (r201590) @@ -0,0 +1,71 @@ +/*- + * Copyright (c) 2010 Ed Schouten + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _UTMPX_H_ +#define _UTMPX_H_ + +#include +#include +#include + +#ifndef _PID_T_DECLARED +typedef __pid_t pid_t; +#define _PID_T_DECLARED +#endif + +struct utmpx { + char ut_user[32]; + char ut_id[8]; + char ut_line[32]; + char ut_host[256]; + pid_t ut_pid; + short ut_type; +#define EMPTY 0 +#define BOOT_TIME 1 +#define OLD_TIME 2 +#define NEW_TIME 3 +#define USER_PROCESS 4 +#define INIT_PROCESS 5 +#define LOGIN_PROCESS 6 +#define DEAD_PROCESS 7 +#if __BSD_VISIBLE +#define SHUTDOWN_TIME 8 +#endif + struct timeval ut_tv; +}; + +__BEGIN_DECLS +void endutxent(void); +struct utmpx *getutxent(void); +struct utmpx *getutxid(const struct utmpx *); +struct utmpx *getutxline(const struct utmpx *); +struct utmpx *pututxline(const struct utmpx *); +void setutxent(void); +__END_DECLS + +#endif /* !_UTMPX_H_ */ Modified: user/ed/utmpx/lib/libc/gen/Makefile.inc ============================================================================== --- user/ed/utmpx/lib/libc/gen/Makefile.inc Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/lib/libc/gen/Makefile.inc Tue Jan 5 15:15:15 2010 (r201590) @@ -18,7 +18,7 @@ SRCS+= __getosreldate.c __xuname.c \ gethostname.c getloadavg.c getlogin.c getmntinfo.c getnetgrent.c \ getosreldate.c getpagesize.c getpagesizes.c \ getpeereid.c getprogname.c getpwent.c getttyent.c \ - getusershell.c getvfsbyname.c glob.c \ + getutxent.c getusershell.c getvfsbyname.c glob.c \ initgroups.c isatty.c isinf.c isnan.c jrand48.c lcong48.c \ lockf.c lrand48.c mrand48.c nftw.c nice.c \ nlist.c nrand48.c opendir.c \ Modified: user/ed/utmpx/lib/libc/gen/Symbol.map ============================================================================== --- user/ed/utmpx/lib/libc/gen/Symbol.map Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/lib/libc/gen/Symbol.map Tue Jan 5 15:15:15 2010 (r201590) @@ -367,7 +367,13 @@ FBSD_1.1 { FBSD_1.2 { basename_r; + endutxent; getpagesizes; + getutxent; + getutxid; + getutxline; + pututxline; + setutxent; }; FBSDprivate_1.0 { Added: user/ed/utmpx/lib/libc/gen/getutxent.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ed/utmpx/lib/libc/gen/getutxent.c Tue Jan 5 15:15:15 2010 (r201590) @@ -0,0 +1,71 @@ +/*- + * Copyright (c) 2010 Ed Schouten + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +void +endutxent(void) +{ +} + +struct utmpx * +getutxent(void) +{ + + return (NULL); +} + +struct utmpx * +getutxid(const struct utmpx *id) +{ + + return (NULL); +} + +struct utmpx * +getutxline(const struct utmpx *line) +{ + + return (NULL); +} + +struct utmpx * +pututxline(const struct utmpx *utmpx) +{ + + return (NULL); +} + +void +setutxent(void) +{ +} Modified: user/ed/utmpx/lib/libopie/Makefile ============================================================================== --- user/ed/utmpx/lib/libopie/Makefile Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/lib/libopie/Makefile Tue Jan 5 15:15:15 2010 (r201590) @@ -8,15 +8,14 @@ SHLIB_MAJOR= 6 KEYFILE?= \"/etc/opiekeys\" -.PATH: ${DIST_DIR} ${OPIE_DIST}/libmissing +.PATH: ${DIST_DIR} LIB= opie SRCS= atob8.c btoa8.c btoh.c challenge.c getsequence.c hash.c hashlen.c \ keycrunch.c lock.c lookup.c newseed.c parsechallenge.c passcheck.c \ passwd.c randomchallenge.c readpass.c unlock.c verify.c version.c \ btoe.c accessfile.c generator.c insecure.c getutmpentry.c \ - readrec.c writerec.c open.c \ - getutline.c pututline.c endutent.c setutent.c # from libmissing + readrec.c writerec.c open.c SRCS+= opieextra.c INCS= ${OPIE_DIST}/opie.h Modified: user/ed/utmpx/lib/libopie/config.h ============================================================================== --- user/ed/utmpx/lib/libopie/config.h Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/lib/libopie/config.h Tue Jan 5 15:15:15 2010 (r201590) @@ -216,7 +216,7 @@ #define HAVE_GETUSERSHELL 1 /* Define if you have the getutxline function. */ -/* #undef HAVE_GETUTXLINE */ +#define HAVE_GETUTXLINE 1 /* Define if you have the getwd function. */ /* #undef HAVE_GETWD */ @@ -231,7 +231,7 @@ /* #undef HAVE_ON_EXIT */ /* Define if you have the pututxline function. */ -/* #undef HAVE_PUTUTXLINE */ +#define HAVE_PUTUTXLINE 1 /* Define if you have the rindex function. */ /* #undef HAVE_RINDEX */ @@ -366,7 +366,7 @@ #define HAVE_UNISTD_H 1 /* Define if you have the header file. */ -/* #undef HAVE_UTMPX_H */ +#define HAVE_UTMPX_H 1 /* Define if you have the crypt library (-lcrypt). */ #define HAVE_LIBCRYPT 1 Modified: user/ed/utmpx/lib/libutil/Makefile ============================================================================== --- user/ed/utmpx/lib/libutil/Makefile Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/lib/libutil/Makefile Tue Jan 5 15:15:15 2010 (r201590) @@ -10,9 +10,9 @@ SHLIB_MAJOR= 8 SRCS= _secure_path.c auth.c expand_number.c flopen.c fparseln.c gr_util.c \ hexdump.c humanize_number.c kinfo_getfile.c kinfo_getvmmap.c kld.c \ - login.c login_auth.c login_cap.c \ + login_auth.c login_cap.c \ login_class.c login_crypt.c login_ok.c login_times.c login_tty.c \ - logout.c logwtmp.c pidfile.c property.c pty.c pw_util.c realhostname.c \ + pidfile.c property.c pty.c pw_util.c realhostname.c \ stub.c trimdomain.c uucplock.c INCS= libutil.h login_cap.h @@ -24,7 +24,7 @@ CFLAGS+= -DINET6 CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../libc/gen/ -MAN+= kld.3 login.3 login_auth.3 login_tty.3 logout.3 logwtmp.3 pty.3 \ +MAN+= kld.3 login_auth.3 login_tty.3 pty.3 \ login_cap.3 login_class.3 login_times.3 login_ok.3 \ _secure_path.3 uucplock.3 property.3 auth.3 realhostname.3 \ realhostname_sa.3 trimdomain.3 fparseln.3 humanize_number.3 \ Modified: user/ed/utmpx/lib/libutil/libutil.h ============================================================================== --- user/ed/utmpx/lib/libutil/libutil.h Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/lib/libutil/libutil.h Tue Jan 5 15:15:15 2010 (r201590) @@ -90,7 +90,6 @@ struct pidfh { /* Avoid pulling in all the include files for no need */ struct termios; struct winsize; -struct utmp; struct in_addr; struct kinfo_file; struct kinfo_vmentry; @@ -102,10 +101,7 @@ int extattr_namespace_to_string(int _att int extattr_string_to_namespace(const char *_string, int *_attrnamespace); int flopen(const char *_path, int _flags, ...); void hexdump(const void *ptr, int length, const char *hdr, int flags); -void login(struct utmp *_ut); int login_tty(int _fd); -int logout(const char *_line); -void logwtmp(const char *_line, const char *_name, const char *_host); void trimdomain(char *_fullhost, int _hostsize); int openpty(int *_amaster, int *_aslave, char *_name, struct termios *_termp, struct winsize *_winp); Modified: user/ed/utmpx/libexec/comsat/comsat.c ============================================================================== --- user/ed/utmpx/libexec/comsat/comsat.c Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/libexec/comsat/comsat.c Tue Jan 5 15:15:15 2010 (r201590) @@ -66,7 +66,7 @@ static const char rcsid[] = #include #include #include -#include +#include int debug = 0; #define dsyslog if (debug) syslog @@ -74,14 +74,10 @@ int debug = 0; #define MAXIDLE 120 char hostname[MAXHOSTNAMELEN]; -struct utmp *utmp = NULL; -time_t lastmsgtime; -int nutmp, uf; void jkfprintf(FILE *, char[], char[], off_t); void mailfor(char *); -void notify(struct utmp *, char[], off_t, int); -void onalrm(int); +void notify(struct utmpx *, char[], off_t, int); void reapchildren(int); int @@ -102,15 +98,7 @@ main(int argc __unused, char *argv[] __u (void) recv(0, msgbuf, sizeof(msgbuf) - 1, 0); exit(1); } - if ((uf = open(_PATH_UTMP, O_RDONLY, 0)) < 0) { - syslog(LOG_ERR, "open: %s: %m", _PATH_UTMP); - (void) recv(0, msgbuf, sizeof(msgbuf) - 1, 0); - exit(1); - } - (void)time(&lastmsgtime); (void)gethostname(hostname, sizeof(hostname)); - onalrm(0); - (void)signal(SIGALRM, onalrm); (void)signal(SIGTTOU, SIG_IGN); (void)signal(SIGCHLD, reapchildren); for (;;) { @@ -121,11 +109,7 @@ main(int argc __unused, char *argv[] __u errno = 0; continue; } - if (!nutmp) /* no one has logged in yet */ - continue; - sigblock(sigmask(SIGALRM)); msgbuf[cc] = '\0'; - (void)time(&lastmsgtime); mailfor(msgbuf); sigsetmask(0L); } @@ -138,40 +122,15 @@ reapchildren(int signo __unused) } void -onalrm(int signo __unused) -{ - static off_t utmpsize; /* last malloced size for utmp */ - static time_t utmpmtime; /* last modification time for utmp */ - struct stat statbf; - - if (time(NULL) - lastmsgtime >= MAXIDLE) - exit(0); - (void)alarm((u_int)15); - (void)fstat(uf, &statbf); - if (statbf.st_mtime > utmpmtime) { - utmpmtime = statbf.st_mtime; - if (statbf.st_size > utmpsize) { - utmpsize = statbf.st_size + 10 * sizeof(struct utmp); - if ((utmp = realloc(utmp, utmpsize)) == NULL) { - syslog(LOG_ERR, "%s", strerror(errno)); - exit(1); - } - } - (void)lseek(uf, (off_t)0, SEEK_SET); - nutmp = read(uf, utmp, (size_t)statbf.st_size)/sizeof(struct utmp); - } -} - -void mailfor(char *name) { - struct utmp *utp = &utmp[nutmp]; + struct utmpx *utp; char *cp; char *file; off_t offset; int folder; - char buf[sizeof(_PATH_MAILDIR) + sizeof(utmp[0].ut_name) + 1]; - char buf2[sizeof(_PATH_MAILDIR) + sizeof(utmp[0].ut_name) + 1]; + char buf[sizeof(_PATH_MAILDIR) + sizeof(utp->ut_user) + 1]; + char buf2[sizeof(_PATH_MAILDIR) + sizeof(utp->ut_user) + 1]; if (!(cp = strchr(name, '@'))) return; @@ -181,33 +140,35 @@ mailfor(char *name) file = name; else file = cp + 1; - sprintf(buf, "%s/%.*s", _PATH_MAILDIR, (int)sizeof(utmp[0].ut_name), + sprintf(buf, "%s/%.*s", _PATH_MAILDIR, (int)sizeof(utp->ut_user), name); if (*file != '/') { sprintf(buf2, "%s/%.*s", _PATH_MAILDIR, - (int)sizeof(utmp[0].ut_name), file); + (int)sizeof(utp->ut_user), file); file = buf2; } folder = strcmp(buf, file); - while (--utp >= utmp) - if (!strncmp(utp->ut_name, name, sizeof(utmp[0].ut_name))) + setutxent(); + while ((utp = getutxent()) != NULL) + if (utp->ut_type == USER_PROCESS && !strcmp(utp->ut_user, name)) notify(utp, file, offset, folder); + endutxent(); } static const char *cr; void -notify(struct utmp *utp, char file[], off_t offset, int folder) +notify(struct utmpx *utp, char file[], off_t offset, int folder) { FILE *tp; struct stat stb; struct termios tio; - char tty[20], name[sizeof(utmp[0].ut_name) + 1]; - const char *line = utp->ut_line; + char tty[20]; + const char *s = utp->ut_line; - if (strncmp(line, "pts/", 4) == 0) - line += 4; - if (strchr(line, '/')) { + if (strncmp(s, "pts/", 4) == 0) + s += 4; + if (strchr(s, '/')) { /* A slash is an attempt to break security... */ syslog(LOG_AUTH | LOG_NOTICE, "Unexpected `/' in `%s'", utp->ut_line); @@ -216,10 +177,10 @@ notify(struct utmp *utp, char file[], of (void)snprintf(tty, sizeof(tty), "%s%.*s", _PATH_DEV, (int)sizeof(utp->ut_line), utp->ut_line); if (stat(tty, &stb) == -1 || !(stb.st_mode & (S_IXUSR | S_IXGRP))) { - dsyslog(LOG_DEBUG, "%s: wrong mode on %s", utp->ut_name, tty); + dsyslog(LOG_DEBUG, "%s: wrong mode on %s", utp->ut_user, tty); return; } - dsyslog(LOG_DEBUG, "notify %s on %s\n", utp->ut_name, tty); + dsyslog(LOG_DEBUG, "notify %s on %s\n", utp->ut_user, tty); switch (fork()) { case -1: syslog(LOG_NOTICE, "fork failed (%m)"); @@ -229,25 +190,21 @@ notify(struct utmp *utp, char file[], of default: return; } - (void)signal(SIGALRM, SIG_DFL); - (void)alarm((u_int)30); if ((tp = fopen(tty, "w")) == NULL) { dsyslog(LOG_ERR, "%s: %s", tty, strerror(errno)); _exit(1); } (void)tcgetattr(fileno(tp), &tio); cr = ((tio.c_oflag & (OPOST|ONLCR)) == (OPOST|ONLCR)) ? "\n" : "\n\r"; - (void)strncpy(name, utp->ut_name, sizeof(utp->ut_name)); - name[sizeof(name) - 1] = '\0'; switch (stb.st_mode & (S_IXUSR | S_IXGRP)) { case S_IXUSR: case (S_IXUSR | S_IXGRP): (void)fprintf(tp, "%s\007New mail for %s@%.*s\007 has arrived%s%s%s:%s----%s", - cr, name, (int)sizeof(hostname), hostname, + cr, utp->ut_user, (int)sizeof(hostname), hostname, folder ? cr : "", folder ? "to " : "", folder ? file : "", cr, cr); - jkfprintf(tp, name, file, offset); + jkfprintf(tp, utp->ut_user, file, offset); break; case S_IXGRP: (void)fprintf(tp, "\007"); Modified: user/ed/utmpx/libexec/ftpd/logwtmp.c ============================================================================== --- user/ed/utmpx/libexec/ftpd/logwtmp.c Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/libexec/ftpd/logwtmp.c Tue Jan 5 15:15:15 2010 (r201590) @@ -50,14 +50,18 @@ __FBSDID("$FreeBSD$"); #include #include #include +#if 0 #include +#endif #include #include #include #include #include "extern.h" +#if 0 static int fd = -1; +#endif /* * Modified version of logwtmp that holds wtmp file open @@ -69,6 +73,7 @@ ftpd_logwtmp(line, name, addr) char *line, *name; struct sockaddr *addr; { +#if 0 struct utmp ut; struct stat buf; char host[UT_HOSTSIZE]; @@ -89,4 +94,5 @@ ftpd_logwtmp(line, name, addr) sizeof(struct utmp)) (void)ftruncate(fd, buf.st_size); } +#endif } Modified: user/ed/utmpx/libexec/rlogind/Makefile ============================================================================== --- user/ed/utmpx/libexec/rlogind/Makefile Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/libexec/rlogind/Makefile Tue Jan 5 15:15:15 2010 (r201590) @@ -5,8 +5,8 @@ PROG= rlogind MAN= rlogind.8 -DPADD= ${LIBUTIL} -LDADD= -lutil +DPADD= ${LIBULOG} ${LIBUTIL} +LDADD= -lulog -lutil WARNS?= 2 .if ${MK_INET6_SUPPORT} != "no" Modified: user/ed/utmpx/libexec/rlogind/rlogind.c ============================================================================== --- user/ed/utmpx/libexec/rlogind/rlogind.c Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/libexec/rlogind/rlogind.c Tue Jan 5 15:15:15 2010 (r201590) @@ -85,6 +85,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -482,8 +483,7 @@ cleanup(int signo) char *p; p = line + sizeof(_PATH_DEV) - 1; - if (logout(p)) - logwtmp(p, "", ""); + ulog_logout(p); (void)chflags(line, 0); (void)chmod(line, 0666); (void)chown(line, 0, 0); Modified: user/ed/utmpx/libexec/rpc.rusersd/Makefile ============================================================================== --- user/ed/utmpx/libexec/rpc.rusersd/Makefile Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/libexec/rpc.rusersd/Makefile Tue Jan 5 15:15:15 2010 (r201590) @@ -4,8 +4,8 @@ PROG = rpc.rusersd SRCS = rusersd.c rusers_proc.c MAN = rpc.rusersd.8 -DPADD= ${LIBRPCSVC} ${LIBULOG} ${LIBUTIL} -LDADD= -lrpcsvc -lulog -lutil +DPADD= ${LIBRPCSVC} ${LIBUTIL} +LDADD= -lrpcsvc -lutil #.if exists(/usr/X11R6/include/X11/extensions/xidle.h) #CFLAGS+= -DXIDLE Modified: user/ed/utmpx/libexec/rpc.rusersd/rusers_proc.c ============================================================================== --- user/ed/utmpx/libexec/rpc.rusersd/rusers_proc.c Tue Jan 5 15:04:08 2010 (r201589) +++ user/ed/utmpx/libexec/rpc.rusersd/rusers_proc.c Tue Jan 5 15:15:15 2010 (r201590) @@ -45,8 +45,7 @@ static const char rcsid[] = #include *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***