[prev in list] [next in list] [prev in thread] [next in thread]
List: sysklogd
Subject: Minor fixes to syslogd.c to make it compile on non-Linux systems
From: "John Hughes" <john () calva ! com>
Date: 2001-10-25 12:33:24
[Download RAW message or body]
C'est un message de format MIME en plusieurs parties.
This lets me play with syslogd on UnixWare 7.1.1 (among others)
1. declare LOG_MAKEPRI, LOG_FAC, LOG_PRI if they're not there.
2. LOG_AUTHPRIV is not always defined
3. make use of SO_BSDCOMPAT optional
4. What is CODE? What are "facilitynames", "prioritynames"?
use struct code, FacNames and PriNames.
["syslogd-patch.txt" (text/plain)]
--- sysklogd-1.4.1/syslogd.c Sun Mar 11 20:40:10 2001
+++ sysklogd-1.4.1-new/syslogd.c Thu Oct 25 14:29:34 2001
@@ -487,7 +487,6 @@
#include <netinet/in.h>
#include <netdb.h>
-#include <syscall.h>
#include <arpa/nameser.h>
#include <arpa/inet.h>
#include <resolv.h>
@@ -577,6 +576,16 @@
#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */
#define TABLE_NOPRI 0 /* Value to indicate no priority in f_pmask */
#define TABLE_ALLPRI 0xFF /* Value to indicate all priorities in f_pmask */
+#ifndef LOG_MAKEPRI
+#define LOG_MAKEPRI(f,p) (((f) << 3) + (p))
+#endif
+#ifndef LOG_FAC
+#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
+#endif
+#ifndef LOG_PRI
+#define LOG_PRI(p) ((p) & LOG_PRIMASK)
+#endif
+
#define LOG_MARK LOG_MAKEPRI(LOG_NFACILITIES, 0) /* mark "facility" */
/*
@@ -694,7 +703,9 @@
struct code FacNames[] = {
{"auth", LOG_AUTH},
+#ifdef LOG_AUTHPRIV
{"authpriv", LOG_AUTHPRIV},
+#endif
{"cron", LOG_CRON},
{"daemon", LOG_DAEMON},
{"kern", LOG_KERN},
@@ -1235,12 +1246,14 @@
/* We need to enable BSD compatibility. Otherwise an attacker
* could flood our log files by sending us tons of ICMP errors.
*/
+#ifdef SO_BSDCOMPAT
if (setsockopt(fd, SOL_SOCKET, SO_BSDCOMPAT, \
(char *) &on, sizeof(on)) < 0) {
logerror("setsockopt(BSDCOMPAT), suspending inet");
close(fd);
return -1;
}
+#endif
if (bind(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0) {
logerror("bind, suspending inet");
close(fd);
@@ -1512,10 +1525,10 @@
int pri;
{
static char res[20];
- CODE *c_pri, *c_fac;
+ struct code *c_pri, *c_fac;
- for (c_fac = facilitynames; c_fac->c_name && !(c_fac->c_val == LOG_FAC(pri)<<3); c_fac++);
- for (c_pri = prioritynames; c_pri->c_name && !(c_pri->c_val == LOG_PRI(pri)); c_pri++);
+ for (c_fac = FacNames; c_fac->c_name && !(c_fac->c_val == LOG_FAC(pri)<<3); c_fac++);
+ for (c_pri = PriNames; c_pri->c_name && !(c_pri->c_val == LOG_PRI(pri)); c_pri++);
snprintf (res, sizeof(res), "%s.%s<%d>", c_fac->c_name, c_pri->c_name, pri);
--
To UNSUBSCRIBE, send an email to sysklogd-request@lists.infodrom.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.infodrom.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic