From owner-freebsd-current Fri Jun 28 8:37:58 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 39A2837B400; Fri, 28 Jun 2002 08:37:46 -0700 (PDT) Received: from espresso.q9media.com (espresso.q9media.com [216.254.138.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8FD2743E06; Fri, 28 Jun 2002 08:37:45 -0700 (PDT) (envelope-from mike@espresso.q9media.com) Received: by espresso.q9media.com (Postfix, from userid 1002) id EB27F9C13; Fri, 28 Jun 2002 11:34:54 -0400 (EDT) Date: Fri, 28 Jun 2002 11:34:54 -0400 From: Mike Barcroft To: Robert Drehmel Cc: current@FreeBSD.org, robert@FreeBSD.org Subject: Re: changing 'struct utmp' Message-ID: <20020628113454.B34516@espresso.q9media.com> References: <20020628110244.A34627@bsd.develop.ferrari.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020628110244.A34627@bsd.develop.ferrari.local>; from robert@zoot.drehmel.com on Fri, Jun 28, 2002 at 11:02:44AM +0200 Organization: The FreeBSD Project Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Robert Drehmel writes: > While trying to fix the bug described in a problem report about > 'w -n', and finding out that it is somewhat broken*, I came to > the conclusion that our 'struct utmp' is too limiting. > > I would like to modernize it as follows: > > #define UT_USERSIZE 16 > #define UT_LINESIZE 8 > #define UT_HOSTSIZE 18 /* increase by two bytes */ I think it might be a wise idea to make UT_HOSTSIZE much larger. Currently, it isn't even large enough to hold an IPv6 address. > struct utmp { > char ut_user[UT_USERSIZE]; > char ut_line[UT_LINESIZE]; > char ut_host[UT_HOSTSIZE]; > uint8_t ut_type; /* new field */ > uint8_t ut_flags; /* new field */ > uint32_t ut_time; > struct sockaddr ut_saddr; /* new field */ > }; Have you considered starting with the standardized utmpx struct? It is defined as requiring at least these members: char ut_user[]; /* User login name. */ char ut_id[]; /* Unspecified initialization process identifier. */ char ut_line[]; /* Device name. */ pid_t ut_pid; /* Process ID. */ short ut_type; /* Type of entry. */ struct timeval ut_tv; /* Time entry was made. */ > leaving us with a 64 byte structure. I also have a patch for a > new function similiar to our login(3): utmp_login(), which takes > the user, line, host, type and sockaddr arguments, puts them into > a struct utmp and proceeds as in login(3). > > With the addition of ut_saddr we could store the plain raw network > address in daemons like sshd or telnetd and use the same field in > programs that use the 'struct utmp' to do the Right Thing. > > I know we have a pam_lastlog module that cares about utmp and > friends, but to my knowledge there is no simple way to transfer > the raw address data into the pam module; calling utmp_login() > in the daemons directly is straight forward. Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message