From owner-freebsd-bugs Sun Mar 19 18:20:02 1995 Return-Path: bugs-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id SAA07664 for bugs-outgoing; Sun, 19 Mar 1995 18:20:02 -0800 Received: (from gnats@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id SAA07656; Sun, 19 Mar 1995 18:20:01 -0800 Date: Sun, 19 Mar 1995 18:20:01 -0800 Message-Id: <199503200220.SAA07656@freefall.cdrom.com> From: "Gil Kloepfer Jr." Reply-To: "Gil Kloepfer Jr." To: freebsd-bugs Subject: bin/257: wtmp not properly updated in uucpd In-Reply-To: Your message of Sun, 19 Mar 1995 20:18:20 -0600 <199503200218.UAA00511@limbic.ssdl.com> Sender: bugs-owner@FreeBSD.org Precedence: bulk >Number: 257 >Category: bin >Synopsis: uucpd does not properly update wtmp on logout >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs (FreeBSD bugs mailing list) >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Mar 19 18:20:00 1995 >Originator: Gil Kloepfer Jr. >Organization: >Release: FreeBSD current-950319 i386 >Environment: uucpd on FreeBSD 2.1-development (current) >Description: 0. uucpd on FreeBSD 2.0R does not function properly at all (which is OK since 2.1-current mostly works) on 2.1-development (current) 1. uucpd does not update the wtmp entry upon logout 2. There is some code to update the utmp file, but it is not executing. This brings up a question as to whether or not it should (discussion below) >How-To-Repeat: Will happen any time a remote system executes uucico via uucpd (UUCP over TCP/IP). >Fix: for #2- I thought about this, and came to the conclusion that although it was convenient, uucpd should not create a login entry in utmp. The reason for this is that no other daemon (such as ftpd) does this, and there is really no reason to make uucpd a special case. The other reason is that the way uucpd was implemented to do this prior to 2.0-RELEASE had the capability of expanding the size of the utmp file each time a different ut_line was used (which, in the case of uucpd, was every time). For #1: The following is a context diff run against the uucpd.c in FreeBSD 2.1-development as of last nights snapshot: (note this also removes the code that does not effectively do anything to utmp) *** /current/libexec/uucpd/uucpd.c Thu Nov 24 20:27:08 1994 --- uucpd.c Sun Mar 19 16:30:06 1995 *************** *** 71,77 **** #define SCPYN(a, b) strncpy(a, b, sizeof (a)) - struct utmp utmp; struct sockaddr_in hisctladdr; int hisaddrlen = sizeof hisctladdr; struct sockaddr_in myctladdr; --- 71,76 ---- *************** *** 85,91 **** }; extern char **environ; extern void logwtmp(char *line, char *name, char *host); - extern void login(struct utmp *ut); void doit(struct sockaddr_in *sinp); void dologout(void); --- 84,89 ---- *************** *** 174,182 **** alarm(0); sprintf(Username, "USER=%s", pw->pw_name); sprintf(Logname, "LOGNAME=%s", pw->pw_name); ! if ((s = fork()) < 0) syslog(LOG_ERR, "fork: %m"); ! else if (s == 0) { dologin(pw, sinp); setgid(pw->pw_gid); initgroups(pw->pw_name, pw->pw_gid); --- 172,181 ---- alarm(0); sprintf(Username, "USER=%s", pw->pw_name); sprintf(Logname, "LOGNAME=%s", pw->pw_name); ! if ((s = fork()) < 0) { syslog(LOG_ERR, "fork: %m"); ! _exit(1); ! } else if (s == 0) { dologin(pw, sinp); setgid(pw->pw_gid); initgroups(pw->pw_name, pw->pw_gid); *************** *** 184,191 **** setuid(pw->pw_uid); execl(pw->pw_shell, "uucico", NULL); syslog(LOG_ERR, "execl: %m"); } - _exit(1); } int readline(char start[], int num, int passw) --- 183,190 ---- setuid(pw->pw_uid); execl(pw->pw_shell, "uucico", NULL); syslog(LOG_ERR, "execl: %m"); + _exit(1); } } int readline(char start[], int num, int passw) *************** *** 259,267 **** (void) write(f, (char *) &ll, sizeof ll); (void) close(f); } ! utmp.ut_time = cur_time; ! SCPYN(utmp.ut_line, line); ! SCPYN(utmp.ut_name, pw->pw_name); ! SCPYN(utmp.ut_host, remotehost); ! login(&utmp); } --- 258,262 ---- (void) write(f, (char *) &ll, sizeof ll); (void) close(f); } ! logwtmp(line, pw->pw_name, remotehost); } >Audit-Trail: >Unformatted: