diff --git a/docs/INSTALL b/docs/INSTALL index c7a0ad9..90279dd 100644 --- a/docs/INSTALL +++ b/docs/INSTALL @@ -7,24 +7,13 @@ Compilation has been tested with versions 2.5.8, 2.6.3 and 2.7.0 of the gcc compiler and libc versions 4.5.26 and 4.6.27. -3.) The FSSTND makes suggestions as to appropriate locations for - system binaries. Since not everyone agrees with standards it is - up to the system administrator installing the utilities to choose - the most appropriate locations for the binaries and their - configuration files. By default the package will compile and - install following the FSSTND recommendations. If a decision is - made to change this behavior consult the makefile and the sources. - The FSSTND define controls selection of values which may be - influenced by the choice of conformance with the FSSTND or site - preferences. - -4.) For proper functioning both of these utilities are best run as root. +3.) For proper functioning both of these utilities are best run as root. This is probably not much of a problem since they will probably be started either by init or as part of the rc.* startup process. There may be security concerns with running syslogd as root. Please repeat step 1 if you are unsure of why this may be the case. -5.) If kernel address to symbol translation is desired there is the +4.) If kernel address to symbol translation is desired there is the possibility that a new kernel will need to be compiled. The patches to delimit kernel addresses requiring translation were added to kernel 1.3.43. If this kernel or a newer kernel is used there is diff --git a/src/Makefile.am b/src/Makefile.am index 7b5c55c..1bc51f0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -25,19 +25,17 @@ AM_CFLAGS += -Wno-unused-result -Wno-unused-parameter AM_CFLAGS += -fomit-frame-pointer -fno-strength-reduce syslogd_SOURCES = syslogd.c pidfile.c pidfile.h -syslogd_CPPFLAGS = -DSYSV -DFSSTND -DSYSLOG_INET -DINET6 -DNO_SCCS -DSYSLOG_UNIXAF \ - -D_BSD_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE +syslogd_CPPFLAGS = -DSYSV -DINET6 -D_BSD_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE klogd_SOURCES = klogd.c klogd.h syslog.c pidfile.c pidfile.h \ ksym.c ksyms.h ksym_mod.c module.h -klogd_CPPFLAGS = -DSYSV -DFSSTND -DALLOW_KERNEL_LOGGING \ +klogd_CPPFLAGS = -DSYSV -DALLOW_KERNEL_LOGGING \ -D_BSD_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE logger_SOURCES = logger.c syslog.c logger_CPPFLAGS = -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_GNU_SOURCE -D_DEFAULT_SOURCE tsyslogd_SOURCES = syslogd.c pidfile.c pidfile.h -tsyslogd_CPPFLAGS = -DSYSV -DFSSTND -DSYSLOG_INET -DINET6 -DNO_SCCS -DSYSLOG_UNIXAF \ - -D_BSD_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE -DTESTING +tsyslogd_CPPFLAGS = -DSYSV -DINET6 -D_BSD_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE -DTESTING syslog_tst_SOURCES = syslog_tst.c diff --git a/src/Makefile.old b/src/Makefile.old index 48368dd..5224132 100644 --- a/src/Makefile.old +++ b/src/Makefile.old @@ -49,10 +49,6 @@ MANDIR = $(prefix)/usr/share/man # useful if klogd is started simultaneously or in close-proximity to syslogd. # KLOGD_START_DELAY = -DKLOGD_DELAY=5 -# The following define determines whether the package adheres to the -# file system standard. -FSSTND = -DFSSTND - # The following define establishes ownership for the man pages. # Avery tells me that there is a difference between Debian and # Slackware. Rather than choose sides I am leaving it up to the user. @@ -67,10 +63,9 @@ MAN_PERMS = 644 # ballot below. SYSLOGD_PIDNAME = -DSYSLOGD_PIDNAME=\"syslogd.pid\" -SYSLOGD_FLAGS= -DSYSLOG_INET -DSYSLOG_UNIXAF -DINET6 -DNO_SCCS ${FSSTND} \ - ${SYSLOGD_PIDNAME} +SYSLOGD_FLAGS= -DINET6 ${SYSLOGD_PIDNAME} SYSLOG_FLAGS= -DALLOW_KERNEL_LOGGING -KLOGD_FLAGS = ${FSSTND} ${KLOGD_START_DELAY} +KLOGD_FLAGS = ${KLOGD_START_DELAY} DEB = all: syslogd klogd diff --git a/src/klogd.c b/src/klogd.c index 28fd18c..8950fdb 100644 --- a/src/klogd.c +++ b/src/klogd.c @@ -284,11 +284,7 @@ #define LOG_LINE_LENGTH 1000 #ifndef TESTING -#if defined(FSSTND) static char *PidFile = _PATH_VARRUN "klogd.pid"; -#else -static char *PidFile = "/etc/klogd.pid"; -#endif #endif static int kmsg; diff --git a/src/syslogd.c b/src/syslogd.c index c71d3eb..7739e2c 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -570,10 +570,7 @@ static char sccsid[] __attribute__((unused)) = #include "pidfile.h" #endif #include "config.h" - -#if defined(__linux__) #include -#endif #ifndef UTMP_FILE #ifdef UTMP_FILENAME @@ -593,18 +590,10 @@ static char sccsid[] __attribute__((unused)) = #if defined(SYSLOGD_PIDNAME) #undef _PATH_LOGPID -#if defined(FSSTND) #define _PATH_LOGPID _PATH_VARRUN SYSLOGD_PIDNAME #else -#define _PATH_LOGPID "/etc/" SYSLOGD_PIDNAME -#endif -#else #ifndef _PATH_LOGPID -#if defined(FSSTND) #define _PATH_LOGPID _PATH_VARRUN "syslogd.pid" -#else -#define _PATH_LOGPID "/etc/syslogd.pid" -#endif #endif #endif @@ -734,12 +723,10 @@ int repeatinterval[] = { 30, 60 }; /* # of secs before flush */ if (++(f)->f_repeatcount > MAXREPEAT) \ (f)->f_repeatcount = MAXREPEAT; \ } -#ifdef SYSLOG_INET #ifndef INET_SUSPEND_TIME #define INET_SUSPEND_TIME 180 /* equal to 3 minutes */ #endif #define INET_RETRY_MAX 10 /* maximum of retries for getaddrinfo() */ -#endif #define LIST_DELIMITER ':' /* delimiter between two hosts */ @@ -868,13 +855,9 @@ int decode(char *name, struct code *codetab); static void logit(char *, ...); static void allocate_log(void); void sighup_handler(int); - -#ifdef SYSLOG_UNIXAF -static int create_unix_socket(const char *path); -#endif -#ifdef SYSLOG_INET +static int create_unix_socket(const char *path); static int *create_inet_sockets(); -#endif + int main(int argc, char *argv[]) { @@ -907,9 +890,7 @@ int main(int argc, char *argv[]) #ifndef TESTING int fd; -#ifdef SYSLOG_INET struct sockaddr_storage frominet; -#endif pid_t ppid = getpid(); #endif int ch; @@ -1052,11 +1033,10 @@ int main(int argc, char *argv[]) } } else #endif + { debugging_on = 1; -#ifndef SYSV - else setlinebuf(stdout); -#endif + } #ifndef TESTING /* tuck my process id away */ @@ -1131,7 +1111,7 @@ int main(int argc, char *argv[]) errno = 0; FD_ZERO(&readfds); maxfds = 0; -#ifdef SYSLOG_UNIXAF + #ifndef TESTING /* * Add the Unix Domain Sockets to the list of read @@ -1146,8 +1126,7 @@ int main(int argc, char *argv[]) } } #endif -#endif -#ifdef SYSLOG_INET + #ifndef TESTING /* * Add the Internet Domain Socket to the list of read @@ -1163,7 +1142,6 @@ int main(int argc, char *argv[]) logit("Listening on syslog UDP port.\n"); } #endif -#endif #ifdef TESTING FD_SET(fileno(stdin), &readfds); if (fileno(stdin) > maxfds) @@ -1218,7 +1196,6 @@ int main(int argc, char *argv[]) } #ifndef TESTING -#ifdef SYSLOG_UNIXAF for (i = 0; i < nfunix; i++) { if ((fd = funix[i]) != -1 && FD_ISSET(fd, &readfds)) { memset(line, 0, sizeof(line)); @@ -1233,9 +1210,7 @@ int main(int argc, char *argv[]) } } } -#endif -#ifdef SYSLOG_INET if (InetInuse && AcceptRemote && finet) { for (i = 0; i < *finet; i++) { if (finet[i + 1] != -1 && FD_ISSET(finet[i + 1], &readfds)) { @@ -1266,7 +1241,6 @@ int main(int argc, char *argv[]) } } } -#endif #else if (FD_ISSET(fileno(stdin), &readfds)) { logit("Message from stdin.\n"); @@ -1337,7 +1311,6 @@ static void increase_rcvbuf(int fd) } } -#ifdef SYSLOG_UNIXAF static int create_unix_socket(const char *path) { struct sockaddr_un sunx; @@ -1359,9 +1332,6 @@ static int create_unix_socket(const char *path) logerror(line); logit("cannot create %s (%d).\n", path, errno); close(fd); -#ifndef SYSV - die(0); -#endif return -1; } @@ -1369,9 +1339,7 @@ static int create_unix_socket(const char *path) return fd; } -#endif -#ifdef SYSLOG_INET static int *create_inet_sockets(void) { struct addrinfo hints, *res, *r; @@ -1459,7 +1427,6 @@ static int *create_inet_sockets(void) } return socks; } -#endif char **crunch_list(list) char *list; { @@ -1519,26 +1486,11 @@ char **crunch_list(list) char *list; } void untty(void) -#ifdef SYSV { if (!Debug) { setsid(); } - return; } -#else -{ - int i; - - if (!Debug) { - i = open(_PATH_TTY, O_RDWR); - if (i >= 0) { - (void)ioctl(i, (int)TIOCNOTTY, NULL); - (void)close(i); - } - } -} -#endif /* * Parse the line to make sure that the msg is not a composite of more @@ -1717,28 +1669,16 @@ time_t now; void logmsg(int pri, char *msg, const char *from, int flags) { struct filed *f; -#ifdef __gnu_linux__ sigset_t mask; -#else -#ifndef SYSV - sigset_t omask; -#endif -#endif char *timestamp; int fac, prilev, lognum, msglen; logit("logmsg: %s, flags %x, from %s, msg %s\n", textpri(pri), flags, from, msg); -#ifdef __gnu_linux__ sigemptyset(&mask); sigaddset(&mask, SIGHUP); sigaddset(&mask, SIGALRM); sigprocmask(SIG_BLOCK, &mask, NULL); -#else -#ifndef SYSV - omask = sigblock(sigmask(SIGHUP) | sigmask(SIGALRM)); -#endif -#endif /* * Check to see if msg looks non-standard. @@ -1776,15 +1716,11 @@ void logmsg(int pri, char *msg, const char *from, int flags) (void)close(f->f_file); f->f_file = -1; } -#ifdef __gnu_linux__ + sigprocmask(SIG_UNBLOCK, &mask, NULL); -#else -#ifndef SYSV - (void)sigsetmask(omask); -#endif -#endif return; } + #ifdef SYSV for (lognum = 0; lognum <= nlogs; lognum++) { f = &Files[lognum]; @@ -1867,13 +1803,8 @@ void logmsg(int pri, char *msg, const char *from, int flags) } } } -#ifdef __gnu_linux__ + sigprocmask(SIG_UNBLOCK, &mask, NULL); -#else -#ifndef SYSV - (void)sigsetmask(omask); -#endif -#endif } #if FALSE } /* balance parentheses for emacs */ @@ -2041,12 +1972,10 @@ void fprintlog(struct filed *f, char *from, int flags, char *msg) struct iovec iov[6]; struct iovec *v = iov; char repbuf[80]; -#ifdef SYSLOG_INET struct addrinfo hints, *ai; time_t fwd_suspend; char line[MAXLINE + 1]; int l, err; -#endif logit("Called fprintlog, "); @@ -2084,7 +2013,6 @@ void fprintlog(struct filed *f, char *from, int flags, char *msg) logit("\n"); break; -#ifdef SYSLOG_INET case F_FORW_SUSP: fwd_suspend = time(NULL) - f->f_time; if (fwd_suspend >= INET_SUSPEND_TIME) { @@ -2183,7 +2111,6 @@ void fprintlog(struct filed *f, char *from, int flags, char *msg) } } break; -#endif case F_CONSOLE: f->f_time = now; @@ -2787,7 +2714,6 @@ void init(void) /* close the configuration file */ (void)fclose(cf); -#ifdef SYSLOG_UNIXAF for (i = 0; i < nfunix; i++) { if (funix[i] != -1) /* Don't close the socket, preserve it instead @@ -2797,9 +2723,7 @@ void init(void) if ((funix[i] = create_unix_socket(funixn[i])) != -1) logit("Opened UNIX socket `%s'.\n", funixn[i]); } -#endif -#ifdef SYSLOG_INET if (Forwarding || AcceptRemote) { if (!finet) { finet = create_inet_sockets(); @@ -2818,7 +2742,6 @@ void init(void) } InetInuse = 0; } -#endif Initialized = 1; @@ -2913,9 +2836,7 @@ static int strtobytes(char *arg) */ void cfline(char *line, struct filed *f) { -#ifdef SYSLOG_INET struct addrinfo hints, *ai; -#endif char buf[MAXLINE]; char xbuf[MAXLINE + 24]; char *p, *q, *bp; @@ -3067,7 +2988,6 @@ void cfline(char *line, struct filed *f) logit("leading char in action: %c\n", *p); switch (*p) { case '@': -#ifdef SYSLOG_INET bp = p; while ((q = strchr(bp, ';'))) { *q++ = 0; @@ -3098,7 +3018,6 @@ void cfline(char *line, struct filed *f) f->f_type = F_FORW; f->f_un.f_forw.f_addr = ai; } -#endif break; case '|':