Index: Makefile =================================================================== RCS file: /home/pcvs/ports/security/chkrootkit/Makefile,v retrieving revision 1.32 diff -u -r1.32 Makefile --- Makefile 20 Mar 2010 14:06:20 -0000 1.32 +++ Makefile 5 Nov 2010 12:47:09 -0000 @@ -43,7 +43,7 @@ .include .if ${OSVERSION} > 900007 -BROKEN= fails to build with new utmpx +EXTRA_PATCHES= ${FILESDIR}/extra-patch-utmpx .endif post-patch: Index: files/extra-patch-utmpx =================================================================== RCS file: files/extra-patch-utmpx diff -N files/extra-patch-utmpx --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/extra-patch-utmpx 5 Nov 2010 12:47:09 -0000 @@ -0,0 +1,124 @@ +--- chklastlog.c.orig 2010-11-05 10:37:48.000000000 -0200 ++++ chklastlog.c 2010-11-05 10:38:50.000000000 -0200 +@@ -43,7 +43,7 @@ + #include + #include + #include +-#include ++#include + #if (HAVE_LASTLOG_H) + #include + #endif +@@ -82,7 +82,7 @@ + }; + + #ifndef SOLARIS2 +-int nonuser(struct utmp utmp_ent); ++int nonuser(struct utmpx utmpx_ent); + #endif + struct s_localpwd *read_pwd(); + void free_results(struct s_localpwd *); +@@ -94,8 +94,7 @@ + int main(int argc, char*argv[]) { + int fh_wtmp; + int fh_lastlog; +- struct lastlog lastlog_ent; +- struct utmp utmp_ent; ++ struct utmpx utmpx_ent; + long userid[MAX_ID]; + long i, slot; + int status = 0; +@@ -151,15 +150,15 @@ + + localpwd = read_pwd(); + +- while ((wtmp_bytes_read = read (fh_wtmp, &utmp_ent, sizeof (struct utmp))) >0) { +- if (wtmp_bytes_read < sizeof(struct utmp)) ++ while ((wtmp_bytes_read = read (fh_wtmp, &utmpx_ent, sizeof (struct utmpx))) >0) { ++ if (wtmp_bytes_read < sizeof(struct utmpx)) + { + fprintf(stderr, "wtmp entry may be corrupted"); + break; + } + total_wtmp_bytes_read+=wtmp_bytes_read; +- if ( !nonuser(utmp_ent) && strncmp(utmp_ent.ut_line, "ftp", 3) && +- (uid=localgetpwnam(localpwd,utmp_ent.ut_name)) != NULL ) ++ if ( !nonuser(utmpx_ent) && strncmp(utmpx_ent.ut_line, "ftp", 3) && ++ (uid=localgetpwnam(localpwd,utmpx_ent.ut_user)) != NULL ) + { + if (*uid > MAX_ID) + { +@@ -169,15 +168,15 @@ + } + if (!userid[*uid]) + { +- lseek(fh_lastlog, (long)*uid * sizeof (struct lastlog), 0); +- if ((wtmp_bytes_read = read(fh_lastlog, &lastlog_ent, sizeof (struct lastlog))) > 0) ++ lseek(fh_lastlog, (long)*uid * sizeof (struct timeval), 0); ++ if ((wtmp_bytes_read = read(fh_lastlog, &utmpx_ent.ut_tv, sizeof (struct timeval))) > 0) + { +- if (wtmp_bytes_read < sizeof(struct lastlog)) ++ if (wtmp_bytes_read < sizeof(struct timeval)) + { + fprintf(stderr, "lastlog entry may be corrupted"); + break; + } +- if (lastlog_ent.ll_time == 0) ++ if (utmpx_ent.ut_tv.tv_sec == 0) + { + if (-1 != (slot = getslot(localpwd, *uid))) + printf("user %s deleted or never logged from lastlog!\n", +@@ -203,9 +202,9 @@ + + #ifndef SOLARIS2 + /* minimal funcionality of nonuser() */ +-int nonuser(struct utmp utmp_ent) ++int nonuser(struct utmpx utmpx_ent) + { +- return (!memcmp(utmp_ent.ut_name, "shutdown", sizeof ("shutdown"))); ++ return (!memcmp(utmpx_ent.ut_user, "shutdown", sizeof ("shutdown"))); + } + #endif + +--- chkwtmp.c.orig 2010-11-05 10:40:14.000000000 -0200 ++++ chkwtmp.c 2010-11-05 10:40:26.000000000 -0200 +@@ -23,7 +23,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +@@ -54,7 +54,7 @@ + + int main(int argc, char*argv[]) { + int filehandle; +- struct utmp utmp_ent; ++ struct utmpx utmpx_ent; + struct timeval mytime; + struct timezone dummy; + long start_time, act_time; +@@ -76,17 +76,17 @@ + return(2); + } + +- while (read (filehandle, (char *) &utmp_ent, sizeof (struct utmp)) > 0) { +- if (utmp_ent.ut_time == 0) ++ while (read (filehandle, (char *) &utmpx_ent, sizeof (struct utmpx)) > 0) { ++ if (utmpx_ent.ut_tv.tv_sec == 0) + del_counter++; + else { + if (del_counter) { + printit(del_counter, start_time, +- utmp_ent.ut_time); ++ utmpx_ent.ut_tv.tv_sec); + t_del++; + del_counter=0; + } +- start_time=utmp_ent.ut_time; ++ start_time=utmpx_ent.ut_tv.tv_sec; + } + } + close(filehandle);