Index: head/security/l0pht-watch/Makefile =================================================================== --- head/security/l0pht-watch/Makefile (revision 550182) +++ head/security/l0pht-watch/Makefile (revision 550183) @@ -1,21 +1,22 @@ # Created by: Dom Mitchell # $FreeBSD$ PORTNAME= l0pht-watch PORTVERSION= 1.1 +PORTREVISION= 1 CATEGORIES= security MASTER_SITES= LOCAL/vs DISTNAME= ${PORTNAME} MAINTAINER= ports@FreeBSD.org COMMENT= Program to report on what goes on in /tmp PLIST_FILES= bin/temp-watch WRKSRC= ${WRKDIR}/temp-watch ALL_TARGET= OpenBSD do-install: ${INSTALL_PROGRAM} ${WRKSRC}/temp-watch ${STAGEDIR}${PREFIX}/bin .include Index: head/security/l0pht-watch/files/patch-Makefile =================================================================== --- head/security/l0pht-watch/files/patch-Makefile (revision 550182) +++ head/security/l0pht-watch/files/patch-Makefile (revision 550183) @@ -1,28 +1,28 @@ ---- Makefile.orig Thu Sep 23 10:18:18 1999 -+++ Makefile Tue Apr 25 00:30:11 2000 +--- Makefile.orig 1999-09-23 17:18:18 UTC ++++ Makefile @@ -9,12 +9,13 @@ # debugging # DFLAGS = -DTEST -DDEBUG DFLAGS = -DREGEX -CFLAGS =-O -Wall +CFLAGS ?=-O -Wall XFLAGS = # xtra cflags, set by systype targets XLIBS = # xtra libs if necessary? # -Bstatic for sunos, -static for gcc, etc. You want this, trust me. STATIC = -CC = cc $(CFLAGS) +CC ?= cc +CC += $(CFLAGS) LD = $(CC) -s # linker; defaults to stripped executables o = o # object extension CKTEMP_OBJS=check_tmp.o daemon.o list_utils.o usage.o -@@ -60,7 +61,8 @@ +@@ -60,7 +61,8 @@ solaris25: OpenBSD: make -e $(ALL) $(MFLAGS) \ - XFLAGS='-DBSD -DREGEX -DREGCOMP_3C' CC="gcc $(CFLAGS)" STATIC=-static + XFLAGS='-DREGEX -DREGCOMP_3C' CC="$(CC) $(CFLAGS)" \ + STATIC=-static generic: make -e $(ALL) $(MFLAGS) \ Index: head/security/l0pht-watch/files/patch-check_tmp.c =================================================================== --- head/security/l0pht-watch/files/patch-check_tmp.c (revision 550182) +++ head/security/l0pht-watch/files/patch-check_tmp.c (revision 550183) @@ -1,74 +1,92 @@ ---- check_tmp.c.orig Fri Sep 24 15:33:35 1999 -+++ check_tmp.c Tue Jul 18 16:18:59 2000 -@@ -37,7 +37,13 @@ +--- check_tmp.c.orig 1999-09-24 20:33:35 UTC ++++ check_tmp.c +@@ -2,6 +2,8 @@ + directories. Ostensibly to start hammering on how bad people are on + tmp droppings following links, etc. etc. .mudge 8.20.98 */ + ++#include ++ + #include "check_tmp.h" + + void usage(char *progname); +@@ -14,6 +16,7 @@ int checkdir(char *); + void walklist(struct listStruct *); + #endif + int become_daemon(void); ++int syslogflag; + + int main(int argc, char **argv){ + +@@ -37,8 +40,14 @@ int main(int argc, char **argv){ char error_buffer[256]; #endif #endif - -+ + +#if (__FreeBSD_version >= 500011) || (__FreeBSD_version >= 410000 && __FreeBSD_version < 500000) + struct kevent ev; + int fd; + struct timespec ts = { 0, 0 }; + int kq = -1; +#endif - ++ struct listStruct *list = NULL; -@@ -178,6 +184,21 @@ + syslogflag=0; /* initialize */ +@@ -178,6 +187,21 @@ int main(int argc, char **argv){ exit(1); } +#if (__FreeBSD_version >= 500011) || (__FreeBSD_version >= 410000 && __FreeBSD_version < 500000) + /* Set up the KQ on the target directory */ + fd = dirfd(dirp); + + kq = kqueue(); + if (kq < 0) + err(1, "kqueue"); + + ev.ident = fd; + ev.filter = EVFILT_VNODE; + ev.flags = EV_ADD | EV_ENABLE | EV_CLEAR; + ev.fflags = NOTE_WRITE; + kevent(kq, &ev, 1, NULL, 0, &ts); +#endif + /* steup the first element of the list */ while ((dp = readdir(dirp)) != NULL){ if (!list) /* first time */ -@@ -266,6 +287,10 @@ +@@ -266,6 +290,10 @@ int main(int argc, char **argv){ rewinddir(dirp); while (1){ + +#if (__FreeBSD_version >= 500011) || (__FreeBSD_version >= 410000 && __FreeBSD_version < 500000) + if (ev.fflags & NOTE_WRITE) { +#endif while ((dp = readdir(dirp)) != NULL){ if (!(checknode(list, watchdir, dp->d_name))){ if (replacewatchflag){ -@@ -352,11 +377,22 @@ +@@ -352,11 +380,22 @@ int main(int argc, char **argv){ /* closedir(dirp); */ } } -#ifdef 0 +#if 0 walklist(list); #endif list = prunelist(list); rewinddir(dirp); + +#if (__FreeBSD_version >= 500011) || (__FreeBSD_version >= 410000 && __FreeBSD_version < 500000) + /* Reset event so we don't trigger on the rewinddir */ + kevent(kq, &ev, 1, NULL, 0, &ts); + + /* Block until the directory changes */ + if (kevent(kq, NULL, 0, &ev, 1, NULL) < 0) + err(1, "kevent"); + + } +#endif } /* closedir(dirp); */ Index: head/security/l0pht-watch/files/patch-check_tmp.h =================================================================== --- head/security/l0pht-watch/files/patch-check_tmp.h (revision 550182) +++ head/security/l0pht-watch/files/patch-check_tmp.h (revision 550183) @@ -1,31 +1,40 @@ ---- check_tmp.h.orig Thu Dec 24 10:40:13 1998 -+++ check_tmp.h Sun Aug 13 23:54:21 2000 +--- check_tmp.h.orig 1998-12-24 15:40:13 UTC ++++ check_tmp.h @@ -1,16 +1,23 @@ #ifndef __CHECK_TMP_H #define __CHECK_TMP_H -#include -#include #include +#include #include +#include +#include #include -#include -#include #include -#include +#include +#include +#include +#include #include +#if (__FreeBSD_version >= 500001) || (__FreeBSD_version >= 400019 && __FreeBSD_version < 500000) +#include +#include +#include +#endif #if defined (REGEXPR_3G) #include +@@ -34,7 +41,7 @@ struct listStruct { + struct listStruct *next; + }; + +-int syslogflag; /* grody after thought */ ++extern int syslogflag; /* grody after thought */ + + /* things to shut lint up */ + char *strrchr(const char *s, int c); Index: head/security/l0pht-watch/files/patch-list_utils.c =================================================================== --- head/security/l0pht-watch/files/patch-list_utils.c (revision 550182) +++ head/security/l0pht-watch/files/patch-list_utils.c (revision 550183) @@ -1,42 +1,48 @@ ---- list_utils.c.orig Thu Dec 24 00:00:44 1998 -+++ list_utils.c Sun Aug 13 23:55:23 2000 -@@ -102,9 +102,11 @@ +--- list_utils.c.orig 1998-12-24 05:00:44 UTC ++++ list_utils.c +@@ -1,3 +1,5 @@ ++#include ++ + #include "check_tmp.h" + + static void printnode(struct listStruct *, int); +@@ -102,9 +104,11 @@ printnode(struct listStruct *list, int action){ char filemodes[11]; char outputStr[(MAXNAMLEN * 2) + 256]; char linkbuf[MAXNAMLEN + 1]; + struct winsize winsize; struct passwd *pwent; struct group *groupent; int ret; + unsigned short width; switch(action){ case ADDITION: -@@ -143,11 +145,16 @@ +@@ -143,11 +147,16 @@ printnode(struct listStruct *list, int action){ getfilemodes(&list->statbuf, filemodes); + if (ioctl(1, TIOCGWINSZ, &winsize) == 0) + width = winsize.ws_col; + else + width = 80; + sprintf(outputStr,"%.2s %-11.20s %-2d %-8.20s %-8.20s %-6ld %-10.20s " - "%.20s", + "%.*s", (action == ADDITION) ? "+ " : "- ", filemodes, (int)list->statbuf.st_nlink, username, groupname, - (long)list->statbuf.st_size, timehold, list->filename); + (long)list->statbuf.st_size, timehold, width - 60, list->filename); if (S_ISLNK(list->statbuf.st_mode) ){ ret = readlink(list->filename, linkbuf, sizeof(linkbuf)); -@@ -168,7 +175,7 @@ +@@ -168,7 +177,7 @@ printnode(struct listStruct *list, int action){ -#ifdef 0 +#if 0 printf("%-11s %-2d %-8s %-8s %-6ld %-10s %-10s\n", filemodes, (int)list->statbuf.st_nlink, username, groupname, list->statbuf.st_size, timehold, list->filename);