[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

syslogd.c patch



Here's a *really* simple patch that makes syslogd not bind a udp socket 
if -u isn't specified.
Tested on i386 and sparc64 though when looking at it it seems pretty 
clear it will work everywhere.
--- syslogd.c.orig	Mon Mar  7 14:29:19 2005
+++ syslogd.c	Mon Mar  7 14:47:35 2005
@@ -355,6 +355,7 @@
 		pfd[i].events = 0;
 	}
 
+	if (!SecureMode) {
 		if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) != -1) {
 			struct servent *sp;
 
@@ -369,7 +370,8 @@
 		s_in.sin_len = sizeof(s_in);
 		s_in.sin_family = AF_INET;
 		s_in.sin_port = LogPort = sp->s_port;
-		if (bind(fd, (struct sockaddr *)&s_in, sizeof(s_in)) < 0) {
+			if (bind(fd, (struct sockaddr *)&s_in, 
+				sizeof(s_in)) < 0) {
 				logerror("bind");
 				if (!Debug)
 					die(0);
@@ -378,6 +380,7 @@
 				double_rbuf(fd);
 				pfd[PFD_INET].fd = fd;
 				pfd[PFD_INET].events = POLLIN;
+			}
 		}
 	}



Visit your host, monkey.org