From owner-freebsd-ports@FreeBSD.ORG Tue Jan 26 20:05:39 2010 Return-Path: Delivered-To: ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11D1B106566C for ; Tue, 26 Jan 2010 20:05:39 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 57EA88FC20 for ; Tue, 26 Jan 2010 20:05:38 +0000 (UTC) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 6E0781CC73; Tue, 26 Jan 2010 21:05:37 +0100 (CET) Date: Tue, 26 Jan 2010 21:05:37 +0100 From: Ed Schouten To: dirk.meyer@dinoex.sub.org Message-ID: <20100126200537.GJ77705@hoeg.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wJeYCwfJgfFvSPOo" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Cc: ports@FreeBSD.org Subject: Re: HEADS UP: gone. All welcome . X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jan 2010 20:05:39 -0000 --wJeYCwfJgfFvSPOo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Dirk, * Dirk Meyer wrote: > 1. POLA >=20 > http://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/rule= s.html >=20 > $ man utmp > does not mention that this interafce is deprectaed (see 11.4) First of all, utmp(5) should no longer exist. Second of all, you clearly seem to misread section 11.4, which says "whenever possible." Instead of just screaming POLA, could you please explain how I could have introduced utmpx into FreeBSD without causing any breakage or confusion among our users. As someone else already quoted earlier, our old utmp interface was a landmine we buried ourselves. > 2. there is now new manpage? > $ man -k utmp > login(3) - log a new login record to the utmp and wtmp fi= les > logout(3) - remove an entry from the utmp file > utempter_add_record(3), utempter_remove_added_record(3), utempter_remove_= record(3), addToUtmp(3), removeFromUtmp(3), removeLineFromUtmp(3) - utempte= r compatibility interface > utmp(5), wtmp(5), lastlog(5) - login records > wtmpcvt(1) - convert wtmp files to the utmpx format getutxent(3). There is no category 5 manpage, because I really don't feel like explaining the on-disk format, just like we don't explain how /etc/spwd.db works. People should not need to know this, because we now have utility functions. > 2. radiusd-cistron >=20 > http://pointyhat.freebsd.org/errorlogs/i386-9-latest/radiusd-cistron-1.6.= 8.log >=20 > Has support for sysv utmpx, > but this differs with the freebsd implementaion. Could you mind explaining me what this code is supposed to do? > 3. vsftpd >=20 > http://pointyhat.freebsd.org/errorlogs/i386-9-latest/vsftpd-2.2.2.log >=20 > this needs updwtmpx which is not avialible. > this seemms to differ from other implementations. Well, we'd better just remove the updwtmpx() calls then, right? --- sysdeputil.c +++ sysdeputil.c @@ -1213,7 +1213,6 @@ setutxent(); (void) pututxline(&s_utent); endutxent(); - updwtmpx(WTMPX_FILE, &s_utent); } =20 void @@ -1232,7 +1231,6 @@ (void) pututxline(&s_utent); endutxent(); s_utent.ut_tv.tv_sec =3D vsf_sysutil_get_time_sec(); - updwtmpx(WTMPX_FILE, &s_utent); } =20 #endif /* !VSF_SYSDEP_HAVE_UTMPX */ > 4. freebsd-uucp >=20 > http://pointyhat.freebsd.org/errorlogs/i386-9-latest/freebsd-uucp-1.07.3_= 1.log >=20 > use of UT_NAMELEN can be fixed. >=20 > What is the replacement of "_PATH_LASTLOG" ? >=20 > What is the replacement of "logwtmp()" ? All handled by pututxline(). --- uucpd/uucpd.c +++ uucpd/uucpd.c @@ -73,7 +73,7 @@ #include #include #include -#include +#include #include =20 #include "pathnames.h" @@ -196,7 +196,7 @@ } while (user[0] =3D=3D '\0'); =20 /* truncate username to LOGNAMESIZE characters */ - user[LOGNAMESIZE] =3D '\0'; + user[sizeof user - 1] =3D '\0'; =20 /* always ask for passwords to deter account guessing */ printf("Password: "); fflush(stdout); @@ -468,11 +468,15 @@ { int status; pid_t pid; - char line[32]; + struct utmpx ut; =20 while ((pid=3Dwait((int *)&status)) > 0) { - sprintf(line, "uucp%ld", (long)pid); - logwtmp(line, "", ""); + memset(&ut, 0, sizeof ut); + ut.ut_type =3D DEAD_PROCESS; + gettimeofday(&ut.ut_tv, NULL); + ut.ut_pid =3D pid; + snprintf(ut.ut_id, sizeof ut.ut_id, "%xuucp", pid); + pututxline(&ut); } } =20 @@ -481,26 +485,14 @@ */ void dologin(struct passwd *pw, struct sockaddr *sin) { - char line[32]; - char remotehost[UT_HOSTSIZE + 1]; - int f; - time_t cur_time; + struct utmpx ut; =20 - realhostname_sa(remotehost, sizeof(remotehost) - 1, sin, sin->sa_len); - remotehost[sizeof remotehost - 1] =3D '\0'; - - /* hack, but must be unique and no tty line */ - sprintf(line, "uucp%ld", (long)getpid()); - time(&cur_time); - if ((f =3D open(_PATH_LASTLOG, O_RDWR)) >=3D 0) { - struct lastlog ll; - - ll.ll_time =3D cur_time; - lseek(f, (off_t)pw->pw_uid * sizeof(struct lastlog), L_SET); - SCPYN(ll.ll_line, line); - SCPYN(ll.ll_host, remotehost); - (void) write(f, (char *) &ll, sizeof ll); - (void) close(f); - } - logwtmp(line, pw->pw_name, remotehost); + memset(&ut, 0, sizeof ut); + ut.ut_type =3D USER_PROCESS; + gettimeofday(&ut.ut_tv, NULL); + ut.ut_pid =3D getpid(); + snprintf(ut.ut_id, sizeof ut.ut_id, "%xuucp", ut.ut_pid); + SCPYN(ut.ut_user, pw->pw_name); + realhostname_sa(ut.ut_host, sizeof ut.ut_host, sin, sin->sa_len); + pututxline(&ut); } > 5. hylafax >=20 > http://pointyhat.freebsd.org/errorlogs/i386-9-latest/hylafax-6.0.4.log >=20 > ... configure use of (extended utmp interface) > but fails. >=20 > Even forcing it to use the SysV interface fails: > GettySysV.c++: In member function 'void SysVGetty::writeWtmp(utmpx*)': > GettySysV.c++:177: error: '_PATH_WTMPX' was not declared in this scope > GettySysV.c++:177: error: 'updwtmpx' was not declared in this scope > GettySysV.c++: In member function 'void SysVGetty::loginAccount()': > GettySysV.c++:200: error: 'struct utmpx' has no member named 'ut_xtime' > GettySysV.c++: In member function 'virtual void SysVGetty::hangup()': > GettySysV.c++:243: error: 'struct utmpx' has no member named 'ut_xtime' > *** Error code 1 No need to call updwtmpx(). ut_xtime should be called ut_tv.tv_sec. --- faxd/GettySysV.c++ +++ faxd/GettySysV.c++ @@ -44,13 +44,7 @@ =20 #define utmp utmpx #undef ut_time -#ifdef __linux__ -#ifdef __GLIBC__ #define ut_time ut_tv.tv_sec -#endif -#else -#define ut_time ut_xtime -#endif =20 #define getutent getutxent #define getutid getutxid @@ -172,16 +166,6 @@ void SysVGetty::writeWtmp(utmp* ut) { - // append record of login to wtmp file -#if HAS_UTMPX - updwtmpx(_PATH_WTMPX, ut); -#else - int fd =3D Sys::open(_PATH_WTMP, O_WRONLY|O_APPEND); - if (fd >=3D 0) { - Sys::write(fd, (char *)ut, sizeof (*ut)); - Sys::close(fd); - } -#endif } =20 /* > 6. manpage >=20 > $ man getutxent >=20 > Please proivide some example here. Well, the other get*ent(3) manpages don't provide examples either, but if you can think of something you consider to be useful to be provided as an example, be sure to send ideas, patches, etc. --=20 Ed Schouten WWW: http://80386.nl/ --wJeYCwfJgfFvSPOo Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAktfSxEACgkQ52SDGA2eCwWipQCdE433UdduuezmwuEcZhcXrlAL dq0AnRclAzMyl3nGk3BpQRnTeqI1G255 =BNJo -----END PGP SIGNATURE----- --wJeYCwfJgfFvSPOo--