--- dnsreflector.c.orig Sun Apr 27 15:22:13 2003 +++ dnsreflector.c Wed Apr 30 09:58:49 2003 @@ -25,6 +25,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define _BSD_SOURCE + #include #include #include @@ -87,7 +89,7 @@ #define MAXQUERY (PACKETSZ - sizeof(ADDITIONAL) - sizeof(AUTHORITY) - sizeof(ANSWER_AAAA)) -static struct syslog_data sdata = SYSLOG_DATA_INIT; +static int daemonize = 0; static void logit(int level, const char *fmt, ...) @@ -97,8 +99,8 @@ va_start(ap, fmt); - if (sdata.opened) { - vsyslog_r(level, &sdata, fmt, ap); + if (daemonize) { + syslog(level, fmt, ap); } else { fprintf(stderr, "%s: ", __progname); vfprintf(stderr, fmt, ap); @@ -148,7 +150,6 @@ /* Options and their defaults */ char *address = NULL; - int daemonize = 0; int port = 53000; /* Process commandline arguments */ @@ -186,8 +187,7 @@ /* Use syslog if daemonized */ if (daemonize) { tzset(); - openlog_r("dnsreflector", LOG_PID | LOG_NDELAY, LOG_DAEMON, - &sdata); + openlog("dnsreflector", LOG_PID | LOG_NDELAY, LOG_DAEMON); } /* Daemonize if requested */ @@ -207,10 +207,7 @@ /* Drop privileges */ if (pw) { - if ((setgroups(1, &pw->pw_gid) == -1) || - (setegid(pw->pw_gid) == -1) || - (setgid(pw->pw_gid) == -1) || - (seteuid(pw->pw_uid) == -1) || + if ((setgid(pw->pw_gid) == -1) || (setuid(pw->pw_uid) == -1)) { logit(LOG_ERR, "cannot drop privileges"); exit(1);