Index: aliases.c =================================================================== RCS file: /cvs/src/usr.sbin/smtpd/aliases.c,v retrieving revision 1.22 diff -N -u aliases.c --- aliases.c 12 Oct 2009 23:57:44 -0000 1.22 +++ aliases.c 14 Oct 2009 13:16:31 -0000 @@ -30,7 +30,11 @@ #include #include #include -#include +#if defined(__FreeBSD__) +# include +#else +# include +#endif #include "smtpd.h" Index: makemap.c =================================================================== RCS file: /cvs/src/usr.sbin/smtpd/makemap.c,v retrieving revision 1.21 diff -N -u makemap.c --- makemap.c 12 Oct 2009 18:19:46 -0000 1.21 +++ makemap.c 14 Oct 2009 13:16:31 -0000 @@ -34,7 +34,11 @@ #include #include #include -#include +#if defined(__FreeBSD__) +# include +#else +# include +#endif #include "smtpd.h" Index: smtpd.c =================================================================== RCS file: /cvs/src/usr.sbin/smtpd/smtpd.c,v retrieving revision 1.86 diff -N -u smtpd.c --- smtpd.c 7 Oct 2009 18:19:39 -0000 1.86 +++ smtpd.c 14 Oct 2009 13:16:32 -0000 @@ -1365,8 +1365,12 @@ if (chdir(pw->pw_dir) == -1 && chdir("/") == -1) fatal("chdir"); +#if defined(__FreeBSD__) + closefrom(STDERR_FILENO + 1); +#else if (closefrom(STDERR_FILENO + 1) == -1) fatal("closefrom"); +#endif /* avoid hangs by setting a 5m timeout */ alarm(300); @@ -1448,10 +1452,17 @@ bzero(&args, sizeof(args)); +#if defined(__FreeBSD__) + closefrom(STDERR_FILENO + 1); if (setgroups(1, &pw->pw_gid) || setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) || + setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid)) { +#else + if (setgroups(1, &pw->pw_gid) || + setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) || setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) || closefrom(STDERR_FILENO + 1) == -1) { +#endif unlink(path); _exit(1); } Index: makemap/Makefile =================================================================== RCS file: /cvs/src/usr.sbin/smtpd/makemap/Makefile,v retrieving revision 1.7 diff -N -u makemap/Makefile --- makemap/Makefile 23 Mar 2009 15:14:54 -0000 1.7 +++ makemap/Makefile 14 Oct 2009 13:16:32 -0000 @@ -14,7 +14,7 @@ CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes CFLAGS+= -Wmissing-declarations CFLAGS+= -Wshadow -Wpointer-arith -Wcast-qual -CFLAGS+= -Wsign-compare -Wbounded +CFLAGS+= -Wsign-compare SRCS= parse.y makemap.c aliases.c map.c log.c util.c DPADD+= ${LIBUTIL} Index: smtpctl/Makefile =================================================================== RCS file: /cvs/src/usr.sbin/smtpd/smtpctl/Makefile,v retrieving revision 1.10 diff -N -u smtpctl/Makefile --- smtpctl/Makefile 15 Sep 2009 16:50:07 -0000 1.10 +++ smtpctl/Makefile 14 Oct 2009 13:16:32 -0000 @@ -14,7 +14,7 @@ CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes CFLAGS+= -Wmissing-declarations CFLAGS+= -Wshadow -Wpointer-arith -Wcast-qual -CFLAGS+= -Wsign-compare -Wbounded +CFLAGS+= -Wsign-compare CFLAGS+= -DCLIENT_NO_SSL SRCS= smtpctl.c parser.c buffer.c imsg.c log.c enqueue.c \ Index: smtpd/Makefile =================================================================== RCS file: /cvs/src/usr.sbin/smtpd/smtpd/Makefile,v retrieving revision 1.13 diff -N -u smtpd/Makefile --- smtpd/Makefile 4 Sep 2009 11:49:23 -0000 1.13 +++ smtpd/Makefile 14 Oct 2009 13:16:32 -0000 @@ -16,7 +16,7 @@ CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes CFLAGS+= -Wmissing-declarations CFLAGS+= -Wshadow -Wpointer-arith -Wcast-qual -CFLAGS+= -Wsign-compare -Wbounded +CFLAGS+= -Wsign-compare #CFLAGS+= -Werror # during development phase (breaks some archs) YFLAGS=