This commit is contained in:
parent
6ed077a11a
commit
1cf353ba33
277
sysklogd-1.4.1-clearing.patch
Normal file
277
sysklogd-1.4.1-clearing.patch
Normal file
@ -0,0 +1,277 @@
|
|||||||
|
!
|
||||||
|
! Be able to write errors on creating of pid file on
|
||||||
|
! the current terminal (bug #394787)
|
||||||
|
!
|
||||||
|
--- klogd.c
|
||||||
|
+++ klogd.c 2008-05-28 12:01:46.000000000 +0200
|
||||||
|
@@ -1098,6 +1098,10 @@ int main(argc, argv)
|
||||||
|
auto int fl;
|
||||||
|
int num_fds = getdtablesize();
|
||||||
|
|
||||||
|
+ /* tuck my process id away */
|
||||||
|
+ if (!write_pid(PidFile))
|
||||||
|
+ Terminate();
|
||||||
|
+
|
||||||
|
/* This is the child closing its file descriptors. */
|
||||||
|
for (fl= 0; fl <= num_fds; ++fl)
|
||||||
|
{
|
||||||
|
@@ -1117,19 +1121,18 @@ int main(argc, argv)
|
||||||
|
fputs("klogd: Already running.\n", stderr);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
-
|
||||||
|
- /* tuck my process id away */
|
||||||
|
- if (!check_pid(PidFile))
|
||||||
|
- {
|
||||||
|
- if (!write_pid(PidFile))
|
||||||
|
+ } else {
|
||||||
|
+ /* tuck my process id away */
|
||||||
|
+ if (!check_pid(PidFile))
|
||||||
|
+ {
|
||||||
|
+ if (!write_pid(PidFile))
|
||||||
|
+ Terminate();
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ fputs("klogd: Already running.\n", stderr);
|
||||||
|
Terminate();
|
||||||
|
- }
|
||||||
|
- else
|
||||||
|
- {
|
||||||
|
- fputs("klogd: Already running.\n", stderr);
|
||||||
|
- Terminate();
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
--- pidfile.c
|
||||||
|
+++ pidfile.c 2008-05-29 23:43:35.280028303 +0200
|
||||||
|
@@ -23,6 +23,7 @@
|
||||||
|
* Sat Aug 19 13:24:33 MET DST 1995: Martin Schulze
|
||||||
|
* First version (v0.2) released
|
||||||
|
*/
|
||||||
|
+#define USE_FCNTL 1
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
@@ -31,6 +32,10 @@
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <signal.h>
|
||||||
|
+#if defined(USE_FCNTL) && (USE_FCNTL != 0)
|
||||||
|
+# include <unistd.h>
|
||||||
|
+# include <fcntl.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
/* read_pid
|
||||||
|
*
|
||||||
|
@@ -86,6 +91,9 @@ int write_pid (char *pidfile)
|
||||||
|
FILE *f;
|
||||||
|
int fd;
|
||||||
|
int pid;
|
||||||
|
+#if defined(USE_FCNTL) && (USE_FCNTL != 0)
|
||||||
|
+ struct flock lck;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
if ( ((fd = open(pidfile, O_RDWR|O_CREAT, 0644)) == -1)
|
||||||
|
|| ((f = fdopen(fd, "r+")) == NULL) ) {
|
||||||
|
@@ -93,23 +101,46 @@ int write_pid (char *pidfile)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+#if defined(USE_FCNTL) && (USE_FCNTL != 0)
|
||||||
|
+ memset(&lck, 0, sizeof (struct flock));
|
||||||
|
+ lck.l_type = F_WRLCK;
|
||||||
|
+ lck.l_whence = SEEK_SET;
|
||||||
|
+
|
||||||
|
+ if (fcntl(fd, F_SETLK, &lck) == -1) {
|
||||||
|
+ fclose(f);
|
||||||
|
+ memset(&lck, 0, sizeof (struct flock));
|
||||||
|
+ fcntl(fd, F_GETLK, &lck);
|
||||||
|
+ fprintf(stderr, "Can't lock, lock is held by pid %d.\n", lck.l_pid);
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+#else
|
||||||
|
if (flock(fd, LOCK_EX|LOCK_NB) == -1) {
|
||||||
|
fscanf(f, "%d", &pid);
|
||||||
|
fclose(f);
|
||||||
|
- printf("Can't lock, lock is held by pid %d.\n", pid);
|
||||||
|
+ fprintf(stderr, "Can't lock, lock is held by pid %d.\n", pid);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
pid = getpid();
|
||||||
|
if (!fprintf(f,"%d\n", pid)) {
|
||||||
|
- printf("Can't write pid , %s.\n", strerror(errno));
|
||||||
|
+ fprintf(stderr, "Can't write pid , %s.\n", strerror(errno));
|
||||||
|
close(fd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
fflush(f);
|
||||||
|
|
||||||
|
- if (flock(fd, LOCK_UN) == -1) {
|
||||||
|
- printf("Can't unlock pidfile %s, %s.\n", pidfile, strerror(errno));
|
||||||
|
+#if defined(USE_FCNTL) && (USE_FCNTL != 0)
|
||||||
|
+ memset(&lck, 0, sizeof (struct flock));
|
||||||
|
+ lck.l_type = F_UNLCK;
|
||||||
|
+ lck.l_whence = SEEK_SET;
|
||||||
|
+
|
||||||
|
+ if (fcntl(fd, F_SETLK, &lck) == -1)
|
||||||
|
+#else
|
||||||
|
+ if (flock(fd, LOCK_UN) == -1)
|
||||||
|
+#endif
|
||||||
|
+ {
|
||||||
|
+ fprintf(stderr,"Can't unlock pidfile %s, %s.\n", pidfile, strerror(errno));
|
||||||
|
close(fd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
--- syslogd.c
|
||||||
|
+++ syslogd.c 2008-05-28 12:12:25.000000000 +0200
|
||||||
|
@@ -22,7 +22,7 @@ char copyright2[] =
|
||||||
|
#endif /* not lint */
|
||||||
|
|
||||||
|
#if !defined(lint) && !defined(NO_SCCS)
|
||||||
|
-static char sccsid[] = "@(#)syslogd.c 5.27 (Berkeley) 10/10/88";
|
||||||
|
+static char sccsid[] __attribute__ ((unused)) = "@(#)syslogd.c 5.27 (Berkeley) 10/10/88";
|
||||||
|
#endif /* not lint */
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -821,8 +821,10 @@ int main(argc, argv)
|
||||||
|
int len, num_fds;
|
||||||
|
#else /* __GLIBC__ */
|
||||||
|
#ifndef TESTING
|
||||||
|
+#ifdef SYSLOG_INET
|
||||||
|
size_t len;
|
||||||
|
#endif
|
||||||
|
+#endif
|
||||||
|
int num_fds;
|
||||||
|
#endif /* __GLIBC__ */
|
||||||
|
/*
|
||||||
|
@@ -841,7 +843,9 @@ int main(argc, argv)
|
||||||
|
fd_set readfds;
|
||||||
|
|
||||||
|
#ifndef TESTING
|
||||||
|
+#ifdef SYSLOG_UNIXAF
|
||||||
|
int fd;
|
||||||
|
+#endif
|
||||||
|
#ifdef SYSLOG_INET
|
||||||
|
#ifdef INET6
|
||||||
|
struct sockaddr_storage frominet;
|
||||||
|
@@ -856,7 +860,9 @@ int main(argc, argv)
|
||||||
|
int ch;
|
||||||
|
struct hostent *hent;
|
||||||
|
|
||||||
|
+#if defined(SYSLOG_UNIXAF) || defined(TESTING)
|
||||||
|
char line[MAXLINE +1];
|
||||||
|
+#endif
|
||||||
|
extern int optind;
|
||||||
|
extern char *optarg;
|
||||||
|
int maxfds;
|
||||||
|
@@ -975,10 +981,19 @@ int main(argc, argv)
|
||||||
|
case 0:
|
||||||
|
signal (SIGTERM, SIG_DFL);
|
||||||
|
|
||||||
|
+ /* tuck my process id away */
|
||||||
|
+ dprintf("Writing pidfile.\n");
|
||||||
|
+ if (!write_pid(PidFile))
|
||||||
|
+ {
|
||||||
|
+ dprintf("Can't write pid.\n");
|
||||||
|
+ exit(1);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
num_fds = getdtablesize();
|
||||||
|
for (i = 0; i < num_fds; i++)
|
||||||
|
(void) close(i);
|
||||||
|
untty();
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
@@ -988,32 +1003,32 @@ int main(argc, argv)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
+ {
|
||||||
|
#endif
|
||||||
|
debugging_on = 1;
|
||||||
|
#ifndef SYSV
|
||||||
|
- else
|
||||||
|
setlinebuf(stdout);
|
||||||
|
#endif
|
||||||
|
-
|
||||||
|
#ifndef TESTING
|
||||||
|
- /* tuck my process id away */
|
||||||
|
- if ( !Debug )
|
||||||
|
- {
|
||||||
|
- dprintf("Writing pidfile.\n");
|
||||||
|
- if (!check_pid(PidFile))
|
||||||
|
+ /* tuck my process id away */
|
||||||
|
+ if ( !Debug )
|
||||||
|
{
|
||||||
|
- if (!write_pid(PidFile))
|
||||||
|
+ dprintf("Writing pidfile.\n");
|
||||||
|
+ if (!check_pid(PidFile))
|
||||||
|
{
|
||||||
|
- dprintf("Can't write pid.\n");
|
||||||
|
+ if (!write_pid(PidFile))
|
||||||
|
+ {
|
||||||
|
+ dprintf("Can't write pid.\n");
|
||||||
|
+ exit(1);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ dprintf("Pidfile (and pid) already exist.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
- }
|
||||||
|
- else
|
||||||
|
- {
|
||||||
|
- dprintf("Pidfile (and pid) already exist.\n");
|
||||||
|
- exit(1);
|
||||||
|
- }
|
||||||
|
- } /* if ( !Debug ) */
|
||||||
|
+ } /* if ( !Debug ) */
|
||||||
|
+ }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
consfile.f_type = F_CONSOLE;
|
||||||
|
@@ -1659,8 +1674,13 @@ void logmsg(pri, msg, from, flags)
|
||||||
|
int flags;
|
||||||
|
{
|
||||||
|
register struct filed *f;
|
||||||
|
- int fac, prilev, lognum;
|
||||||
|
+ int fac, prilev;
|
||||||
|
int msglen;
|
||||||
|
+#ifndef SYSV
|
||||||
|
+ int omask;
|
||||||
|
+#else
|
||||||
|
+ int lognum;
|
||||||
|
+#endif
|
||||||
|
char *timestamp;
|
||||||
|
|
||||||
|
dprintf("logmsg: %s, flags %x, from %s, msg %s\n", textpri(pri), flags, from, msg);
|
||||||
|
@@ -2402,11 +2422,9 @@ void init()
|
||||||
|
register int i, lognum;
|
||||||
|
register FILE *cf;
|
||||||
|
register struct filed *f;
|
||||||
|
-#ifndef TESTING
|
||||||
|
#ifndef SYSV
|
||||||
|
register struct filed **nextp = (struct filed **) 0;
|
||||||
|
#endif
|
||||||
|
-#endif
|
||||||
|
register char *p;
|
||||||
|
register unsigned int Forwarding = 0;
|
||||||
|
#ifdef CONT_LINE
|
||||||
|
@@ -2487,7 +2505,7 @@ void init()
|
||||||
|
#else
|
||||||
|
*nextp = (struct filed *)calloc(1, sizeof(*f));
|
||||||
|
cfline("*.ERR\t" _PATH_CONSOLE, *nextp);
|
||||||
|
- (*nextp)->f_next = (struct filed *)calloc(1, sizeof(*f)) /* ASP */
|
||||||
|
+ (*nextp)->f_next = (struct filed *)calloc(1, sizeof(*f)); /* ASP */
|
||||||
|
cfline("*.PANIC\t*", (*nextp)->f_next);
|
||||||
|
#endif
|
||||||
|
Initialized = 1;
|
42
sysklogd-1.4.1-nofortify.patch
Normal file
42
sysklogd-1.4.1-nofortify.patch
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
--- fortify.h
|
||||||
|
+++ fortify.h 2008-05-30 12:18:14.874490898 +0200
|
||||||
|
@@ -0,0 +1,17 @@
|
||||||
|
+#if defined(__USE_FORTIFY_LEVEL)
|
||||||
|
+# undef syslog
|
||||||
|
+# undef vsyslog
|
||||||
|
+# undef openlog
|
||||||
|
+# undef closelog
|
||||||
|
+# undef setlogmask
|
||||||
|
+extern void priv_syslog(int, const char *, ...);
|
||||||
|
+extern void priv_vsyslog(int, const char *, va_list);
|
||||||
|
+extern void priv_openlog(const char *, int, int);
|
||||||
|
+extern void priv_closelog(void);
|
||||||
|
+extern int priv_setlogmask(int);
|
||||||
|
+# define syslog priv_syslog
|
||||||
|
+# define vsyslog priv_vsyslog
|
||||||
|
+# define openlog priv_openlog
|
||||||
|
+# define closelog priv_closelog
|
||||||
|
+# define setlogmask priv_setlogmask
|
||||||
|
+#endif
|
||||||
|
--- klogd.c
|
||||||
|
+++ klogd.c 2008-05-30 12:19:59.501151202 +0200
|
||||||
|
@@ -286,6 +286,8 @@ static char *PidFile = "/etc/klogd.pid";
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#include "fortify.h"
|
||||||
|
+
|
||||||
|
static int kmsg,
|
||||||
|
change_state = 0,
|
||||||
|
terminate = 0,
|
||||||
|
--- syslog.c
|
||||||
|
+++ syslog.c 2008-05-30 12:20:24.799728870 +0200
|
||||||
|
@@ -72,6 +72,8 @@ static char sccsid[] = "@(#)syslog.c 5.2
|
||||||
|
|
||||||
|
#define _PATH_LOGNAME "/dev/log"
|
||||||
|
|
||||||
|
+#include "fortify.h"
|
||||||
|
+
|
||||||
|
static int LogFile = -1; /* fd for log */
|
||||||
|
static int connected; /* have done connect */
|
||||||
|
static int LogStat = 0; /* status bits, set by openlog() */
|
@ -1,6 +1,6 @@
|
|||||||
--- .pkgextract
|
--- .pkgextract
|
||||||
+++ .pkgextract 2006-02-08 17:29:50.000000000 +0100
|
+++ .pkgextract 2006-02-08 17:29:50.000000000 +0100
|
||||||
@@ -0,0 +1,19 @@
|
@@ -0,0 +1,20 @@
|
||||||
+patch -p0 -b --suffix=.dgram -s < ../sysklogd-1.4.1-dgram.patch
|
+patch -p0 -b --suffix=.dgram -s < ../sysklogd-1.4.1-dgram.patch
|
||||||
+patch -p0 -b --suffix=.sparc -s < ../sysklogd-1.4.1-sparc.patch
|
+patch -p0 -b --suffix=.sparc -s < ../sysklogd-1.4.1-sparc.patch
|
||||||
+patch -p0 -b --suffix=.forw -s < ../sysklogd-1.4.1-forw.patch
|
+patch -p0 -b --suffix=.forw -s < ../sysklogd-1.4.1-forw.patch
|
||||||
@ -20,6 +20,7 @@
|
|||||||
+patch -p1 -b --suffix=.ksym -s < ../sysklogd-1.4.1-ksym.patch
|
+patch -p1 -b --suffix=.ksym -s < ../sysklogd-1.4.1-ksym.patch
|
||||||
+patch -p1 -b --suffix=.sleep -s < ../sysklogd-1.4.1-dontsleep.patch
|
+patch -p1 -b --suffix=.sleep -s < ../sysklogd-1.4.1-dontsleep.patch
|
||||||
+patch -p0 -b --suffix=.signal -s < ../sysklogd-1.4.1-signal.dif
|
+patch -p0 -b --suffix=.signal -s < ../sysklogd-1.4.1-signal.dif
|
||||||
|
+patch -p0 -b --suffix=.clear -s < ../sysklogd-1.4.1-clearing.patch
|
||||||
--- Makefile
|
--- Makefile
|
||||||
+++ Makefile 2006-02-08 17:29:50.000000000 +0100
|
+++ Makefile 2006-02-08 17:29:50.000000000 +0100
|
||||||
@@ -1,14 +1,17 @@
|
@@ -1,14 +1,17 @@
|
||||||
@ -44,7 +45,7 @@
|
|||||||
MANDIR = /usr/man
|
MANDIR = /usr/man
|
||||||
|
|
||||||
# There is one report that under an all ELF system there may be a need to
|
# There is one report that under an all ELF system there may be a need to
|
||||||
@@ -25,7 +28,7 @@
|
@@ -25,7 +28,7 @@ MANDIR = /usr/man
|
||||||
|
|
||||||
# Define the following to impart start-up delay in klogd. This is
|
# Define the following to impart start-up delay in klogd. This is
|
||||||
# useful if klogd is started simultaneously or in close-proximity to syslogd.
|
# useful if klogd is started simultaneously or in close-proximity to syslogd.
|
||||||
@ -53,7 +54,7 @@
|
|||||||
|
|
||||||
# The following define determines whether the package adheres to the
|
# The following define determines whether the package adheres to the
|
||||||
# file system standard.
|
# file system standard.
|
||||||
@@ -112,11 +115,12 @@
|
@@ -112,11 +115,12 @@ clobber: clean
|
||||||
rm -f syslogd klogd ksym syslog_tst oops_test TAGS tsyslogd tklogd
|
rm -f syslogd klogd ksym syslog_tst oops_test TAGS tsyslogd tklogd
|
||||||
|
|
||||||
install_exec: syslogd klogd
|
install_exec: syslogd klogd
|
||||||
@ -73,8 +74,8 @@
|
|||||||
+ ${INSTALL} -m 644 syslog.conf.5 ${DESTDIR}${MANDIR}/man5/syslog.conf.5
|
+ ${INSTALL} -m 644 syslog.conf.5 ${DESTDIR}${MANDIR}/man5/syslog.conf.5
|
||||||
+ ${INSTALL} -m 644 klogd.8 ${DESTDIR}${MANDIR}/man8/klogd.8
|
+ ${INSTALL} -m 644 klogd.8 ${DESTDIR}${MANDIR}/man8/klogd.8
|
||||||
--- klogd.c
|
--- klogd.c
|
||||||
+++ klogd.c 2006-02-08 17:38:21.000000000 +0100
|
+++ klogd.c 2008-05-30 12:23:07.616318420 +0200
|
||||||
@@ -275,15 +275,29 @@
|
@@ -275,15 +275,21 @@ _syscall3(int,ksyslog,int, type, char *,
|
||||||
#define ksyslog klogctl
|
#define ksyslog klogctl
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -95,19 +96,12 @@
|
|||||||
-#else
|
-#else
|
||||||
+# else
|
+# else
|
||||||
static char *PidFile = "/etc/klogd.pid";
|
static char *PidFile = "/etc/klogd.pid";
|
||||||
|
-#endif
|
||||||
+# endif
|
+# endif
|
||||||
#endif
|
#endif
|
||||||
+
|
|
||||||
+#if defined(__USE_FORTIFY_LEVEL)
|
|
||||||
+# undef syslog
|
|
||||||
+# undef vsyslog
|
|
||||||
+# undef openlog
|
|
||||||
+# undef closelog
|
|
||||||
+# undef setlogmask
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int kmsg,
|
#include "fortify.h"
|
||||||
@@ -295,6 +309,8 @@
|
@@ -297,6 +303,8 @@ static int kmsg,
|
||||||
|
|
||||||
static int use_syscall = 0,
|
static int use_syscall = 0,
|
||||||
one_shot = 0,
|
one_shot = 0,
|
||||||
@ -116,7 +110,7 @@
|
|||||||
symbol_lookup = 1,
|
symbol_lookup = 1,
|
||||||
no_fork = 0; /* don't fork - don't run in daemon mode */
|
no_fork = 0; /* don't fork - don't run in daemon mode */
|
||||||
|
|
||||||
@@ -868,8 +884,7 @@
|
@@ -872,8 +880,7 @@ static void LogLine(char *ptr, int len)
|
||||||
value = strtoul(sym_start+1, (char **) 0, 16);
|
value = strtoul(sym_start+1, (char **) 0, 16);
|
||||||
*(line-1) = '>'; /* put back delim */
|
*(line-1) = '>'; /* put back delim */
|
||||||
|
|
||||||
@ -126,7 +120,7 @@
|
|||||||
{
|
{
|
||||||
parse_state = PARSING_TEXT;
|
parse_state = PARSING_TEXT;
|
||||||
break;
|
break;
|
||||||
@@ -910,7 +925,7 @@
|
@@ -914,7 +921,7 @@ static void LogLine(char *ptr, int len)
|
||||||
static void LogKernelLine(void)
|
static void LogKernelLine(void)
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -135,7 +129,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Zero-fill the log buffer. This should cure a multitude of
|
* Zero-fill the log buffer. This should cure a multitude of
|
||||||
@@ -919,6 +934,11 @@
|
@@ -923,6 +930,11 @@ static void LogKernelLine(void)
|
||||||
* messages into this fresh buffer.
|
* messages into this fresh buffer.
|
||||||
*/
|
*/
|
||||||
memset(log_buffer, '\0', log_buf_size);
|
memset(log_buffer, '\0', log_buf_size);
|
||||||
@ -147,7 +141,7 @@
|
|||||||
if ( (rdcnt = ksyslog(2, log_buffer, log_buf_size-1)) < 0 )
|
if ( (rdcnt = ksyslog(2, log_buffer, log_buf_size-1)) < 0 )
|
||||||
{
|
{
|
||||||
if ( errno == EINTR )
|
if ( errno == EINTR )
|
||||||
@@ -1010,10 +1030,15 @@
|
@@ -1014,10 +1026,15 @@ int main(argc, argv)
|
||||||
*output = (char *) 0;
|
*output = (char *) 0;
|
||||||
|
|
||||||
#ifndef TESTING
|
#ifndef TESTING
|
||||||
@ -165,7 +159,7 @@
|
|||||||
switch((char)ch)
|
switch((char)ch)
|
||||||
{
|
{
|
||||||
case '2': /* Print lines with symbols twice. */
|
case '2': /* Print lines with symbols twice. */
|
||||||
@@ -1044,6 +1069,14 @@
|
@@ -1048,6 +1065,14 @@ int main(argc, argv)
|
||||||
case 'o': /* One-shot mode. */
|
case 'o': /* One-shot mode. */
|
||||||
one_shot = 1;
|
one_shot = 1;
|
||||||
break;
|
break;
|
||||||
@ -180,7 +174,7 @@
|
|||||||
case 'p':
|
case 'p':
|
||||||
SetParanoiaLevel(1); /* Load symbols on oops. */
|
SetParanoiaLevel(1); /* Load symbols on oops. */
|
||||||
break;
|
break;
|
||||||
@@ -1164,8 +1197,11 @@
|
@@ -1171,8 +1196,11 @@ int main(argc, argv)
|
||||||
if ( one_shot )
|
if ( one_shot )
|
||||||
{
|
{
|
||||||
if (symbol_lookup) {
|
if (symbol_lookup) {
|
||||||
@ -194,7 +188,7 @@
|
|||||||
}
|
}
|
||||||
if ( (logsrc = GetKernelLogSrc()) == kernel )
|
if ( (logsrc = GetKernelLogSrc()) == kernel )
|
||||||
LogKernelLine();
|
LogKernelLine();
|
||||||
@@ -1180,8 +1216,11 @@
|
@@ -1187,8 +1215,11 @@ int main(argc, argv)
|
||||||
#endif
|
#endif
|
||||||
logsrc = GetKernelLogSrc();
|
logsrc = GetKernelLogSrc();
|
||||||
if (symbol_lookup) {
|
if (symbol_lookup) {
|
||||||
@ -209,8 +203,8 @@
|
|||||||
|
|
||||||
/* The main loop. */
|
/* The main loop. */
|
||||||
--- pidfile.c
|
--- pidfile.c
|
||||||
+++ pidfile.c 2006-02-08 17:29:50.000000000 +0100
|
+++ pidfile.c 2008-05-30 00:04:24.000000000 +0200
|
||||||
@@ -41,11 +41,11 @@
|
@@ -46,11 +46,11 @@
|
||||||
int read_pid (char *pidfile)
|
int read_pid (char *pidfile)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
@ -224,24 +218,32 @@
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@
|
@@ -90,7 +90,7 @@ int write_pid (char *pidfile)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int fd;
|
int fd;
|
||||||
- int pid;
|
- int pid;
|
||||||
+ int pid = 0;
|
+ int pid = 0;
|
||||||
|
#if defined(USE_FCNTL) && (USE_FCNTL != 0)
|
||||||
if ( ((fd = open(pidfile, O_RDWR|O_CREAT, 0644)) == -1)
|
struct flock lck;
|
||||||
|| ((f = fdopen(fd, "r+")) == NULL) ) {
|
#endif
|
||||||
@@ -94,7 +94,7 @@
|
@@ -115,14 +115,14 @@ int write_pid (char *pidfile)
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
if (flock(fd, LOCK_EX|LOCK_NB) == -1) {
|
if (flock(fd, LOCK_EX|LOCK_NB) == -1) {
|
||||||
- fscanf(f, "%d", &pid);
|
- fscanf(f, "%d", &pid);
|
||||||
+ (void)fscanf(f, "%d", &pid);
|
+ (void)fscanf(f, "%d", &pid);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
printf("Can't lock, lock is held by pid %d.\n", pid);
|
fprintf(stderr, "Can't lock, lock is held by pid %d.\n", pid);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
- pid = getpid();
|
||||||
|
+ pid = (int)getpid();
|
||||||
|
if (!fprintf(f,"%d\n", pid)) {
|
||||||
|
fprintf(stderr, "Can't write pid , %s.\n", strerror(errno));
|
||||||
|
close(fd);
|
||||||
--- resolve.c
|
--- resolve.c
|
||||||
+++ resolve.c 2006-02-08 17:29:50.000000000 +0100
|
+++ resolve.c 2006-02-08 17:29:50.000000000 +0100
|
||||||
@@ -13,6 +13,7 @@
|
@@ -13,6 +13,7 @@
|
||||||
@ -252,7 +254,7 @@
|
|||||||
|
|
||||||
#if defined(__GLIBC__)
|
#if defined(__GLIBC__)
|
||||||
#define dprintf mydprintf
|
#define dprintf mydprintf
|
||||||
@@ -208,7 +209,7 @@
|
@@ -208,7 +209,7 @@ do_query(int fd, int family, const char
|
||||||
{
|
{
|
||||||
struct sockaddr_storage ss;
|
struct sockaddr_storage ss;
|
||||||
struct addrinfo hints, *res;
|
struct addrinfo hints, *res;
|
||||||
@ -261,7 +263,7 @@
|
|||||||
|
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
hints.ai_socktype = SOCK_DGRAM;
|
hints.ai_socktype = SOCK_DGRAM;
|
||||||
@@ -244,6 +245,20 @@
|
@@ -244,6 +245,20 @@ do_query(int fd, int family, const char
|
||||||
} else {
|
} else {
|
||||||
memcpy(&ss, res->ai_addr, res->ai_addrlen);
|
memcpy(&ss, res->ai_addr, res->ai_addrlen);
|
||||||
}
|
}
|
||||||
@ -412,7 +414,7 @@
|
|||||||
+local6,local7.* -/var/log/localmessages
|
+local6,local7.* -/var/log/localmessages
|
||||||
--- syslog.c
|
--- syslog.c
|
||||||
+++ syslog.c 2006-02-08 17:29:50.000000000 +0100
|
+++ syslog.c 2006-02-08 17:29:50.000000000 +0100
|
||||||
@@ -70,7 +70,20 @@
|
@@ -70,7 +70,13 @@ static char sccsid[] = "@(#)syslog.c 5.2
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -424,19 +426,12 @@
|
|||||||
+# define _PATH_LOGNAME "/dev/log"
|
+# define _PATH_LOGNAME "/dev/log"
|
||||||
+#endif
|
+#endif
|
||||||
+
|
+
|
||||||
+#if defined(__USE_FORTIFY_LEVEL)
|
|
||||||
+# undef syslog
|
|
||||||
+# undef vsyslog
|
|
||||||
+# undef openlog
|
|
||||||
+# undef closelog
|
|
||||||
+# undef setlogmask
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
static int LogFile = -1; /* fd for log */
|
#include "fortify.h"
|
||||||
static int connected; /* have done connect */
|
|
||||||
--- syslogd.c
|
--- syslogd.c
|
||||||
+++ syslogd.c 2006-02-08 17:29:50.000000000 +0100
|
+++ syslogd.c 2008-05-28 12:14:25.000000000 +0200
|
||||||
@@ -466,6 +466,7 @@
|
@@ -466,6 +466,7 @@ static char sccsid[] __attribute__ ((un
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
@ -444,7 +439,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
@@ -579,7 +580,11 @@
|
@@ -579,7 +580,11 @@ int funix[MAXFUNIX] = { -1, };
|
||||||
# define UNAMESZ 8 /* length of a login name */
|
# define UNAMESZ 8 /* length of a login name */
|
||||||
#endif
|
#endif
|
||||||
#define MAXUNAMES 20 /* maximum number of user names */
|
#define MAXUNAMES 20 /* maximum number of user names */
|
||||||
@ -457,7 +452,7 @@
|
|||||||
|
|
||||||
#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */
|
#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */
|
||||||
#define TABLE_NOPRI 0 /* Value to indicate no priority in f_pmask */
|
#define TABLE_NOPRI 0 /* Value to indicate no priority in f_pmask */
|
||||||
@@ -659,8 +664,8 @@
|
@@ -659,8 +664,8 @@ struct filed {
|
||||||
* in seconds after previous message is logged. After each flush,
|
* in seconds after previous message is logged. After each flush,
|
||||||
* we move to the next interval until we reach the largest.
|
* we move to the next interval until we reach the largest.
|
||||||
*/
|
*/
|
||||||
@ -468,25 +463,25 @@
|
|||||||
#define REPEATTIME(f) ((f)->f_time + repeatinterval[(f)->f_repeatcount])
|
#define REPEATTIME(f) ((f)->f_time + repeatinterval[(f)->f_repeatcount])
|
||||||
#define BACKOFF(f) { if (++(f)->f_repeatcount > MAXREPEAT) \
|
#define BACKOFF(f) { if (++(f)->f_repeatcount > MAXREPEAT) \
|
||||||
(f)->f_repeatcount = MAXREPEAT; \
|
(f)->f_repeatcount = MAXREPEAT; \
|
||||||
@@ -771,7 +776,7 @@
|
@@ -774,7 +779,7 @@ int usage(void);
|
||||||
char **crunch_list(char *list);
|
static pid_t sid;
|
||||||
int usage(void);
|
#endif
|
||||||
void untty(void);
|
void untty(void);
|
||||||
-void printchopped(const char *hname, char *msg, int len, int fd);
|
-void printchopped(const char *hname, char *msg, int len, int fd);
|
||||||
+void printchopped(const char *hname, char *msg, size_t len, int fd);
|
+void printchopped(const char *hname, char *msg, size_t len, int fd);
|
||||||
void printline(const char *hname, char *msg);
|
void printline(const char *hname, char *msg);
|
||||||
void printsys(char *msg);
|
void printsys(char *msg);
|
||||||
void logmsg(int pri, char *msg, const char *from, int flags);
|
void logmsg(int pri, char *msg, const char *from, int flags);
|
||||||
@@ -816,7 +821,7 @@
|
@@ -822,7 +827,7 @@ int main(argc, argv)
|
||||||
int len, num_fds;
|
|
||||||
#else /* __GLIBC__ */
|
#else /* __GLIBC__ */
|
||||||
#ifndef TESTING
|
#ifndef TESTING
|
||||||
|
#ifdef SYSLOG_INET
|
||||||
- size_t len;
|
- size_t len;
|
||||||
+ socklen_t len;
|
+ socklen_t len;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
int num_fds;
|
int num_fds;
|
||||||
#endif /* __GLIBC__ */
|
@@ -868,7 +873,12 @@ int main(argc, argv)
|
||||||
@@ -857,7 +862,12 @@
|
|
||||||
int maxfds;
|
int maxfds;
|
||||||
|
|
||||||
#ifndef TESTING
|
#ifndef TESTING
|
||||||
@ -500,8 +495,8 @@
|
|||||||
#endif
|
#endif
|
||||||
for (i = 1; i < MAXFUNIX; i++) {
|
for (i = 1; i < MAXFUNIX; i++) {
|
||||||
funixn[i] = "";
|
funixn[i] = "";
|
||||||
@@ -1029,13 +1039,15 @@
|
@@ -1074,13 +1084,15 @@ int main(argc, argv)
|
||||||
*p = tolower(*p);
|
leave = 0;
|
||||||
|
|
||||||
(void) signal(SIGTERM, die);
|
(void) signal(SIGTERM, die);
|
||||||
+ (void) siginterrupt(SIGTERM,1); /* Make recvfrom() be able to receive EINTR */
|
+ (void) siginterrupt(SIGTERM,1); /* Make recvfrom() be able to receive EINTR */
|
||||||
@ -517,7 +512,7 @@
|
|||||||
|
|
||||||
/* Create a partial message table for all file descriptors. */
|
/* Create a partial message table for all file descriptors. */
|
||||||
num_fds = getdtablesize();
|
num_fds = getdtablesize();
|
||||||
@@ -1193,7 +1205,7 @@
|
@@ -1243,7 +1255,7 @@ int main(argc, argv)
|
||||||
* -Joey
|
* -Joey
|
||||||
*/
|
*/
|
||||||
printchopped(from, line, \
|
printchopped(from, line, \
|
||||||
@ -526,7 +521,7 @@
|
|||||||
} else if (i < 0 && errno != EINTR) {
|
} else if (i < 0 && errno != EINTR) {
|
||||||
dprintf("INET socket error: %d = %s.\n", \
|
dprintf("INET socket error: %d = %s.\n", \
|
||||||
errno, strerror(errno));
|
errno, strerror(errno));
|
||||||
@@ -1212,7 +1224,7 @@
|
@@ -1262,7 +1274,7 @@ int main(argc, argv)
|
||||||
parts[fileno(stdin)] = (char *) 0;
|
parts[fileno(stdin)] = (char *) 0;
|
||||||
i = read(fileno(stdin), line, MAXLINE);
|
i = read(fileno(stdin), line, MAXLINE);
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
@ -535,7 +530,7 @@
|
|||||||
} else if (i < 0) {
|
} else if (i < 0) {
|
||||||
if (errno != EINTR) {
|
if (errno != EINTR) {
|
||||||
logerror("stdin");
|
logerror("stdin");
|
||||||
@@ -1257,8 +1269,9 @@
|
@@ -1307,8 +1319,9 @@ static int create_unix_socket(const char
|
||||||
close(fd);
|
close(fd);
|
||||||
#ifndef SYSV
|
#ifndef SYSV
|
||||||
dienow();
|
dienow();
|
||||||
@ -546,7 +541,7 @@
|
|||||||
}
|
}
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
@@ -1435,7 +1448,7 @@
|
@@ -1485,7 +1498,7 @@ void untty()
|
||||||
void printchopped(hname, msg, len, fd)
|
void printchopped(hname, msg, len, fd)
|
||||||
const char *hname;
|
const char *hname;
|
||||||
char *msg;
|
char *msg;
|
||||||
@ -555,7 +550,7 @@
|
|||||||
int fd;
|
int fd;
|
||||||
{
|
{
|
||||||
auto int ptlngth;
|
auto int ptlngth;
|
||||||
@@ -1535,6 +1548,8 @@
|
@@ -1585,6 +1598,8 @@ void printline(hname, msg)
|
||||||
while ((c = *p++) && q < &line[sizeof(line) - 4]) {
|
while ((c = *p++) && q < &line[sizeof(line) - 4]) {
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
*q++ = ' ';
|
*q++ = ' ';
|
||||||
@ -564,7 +559,7 @@
|
|||||||
else if (c < 040) {
|
else if (c < 040) {
|
||||||
*q++ = '^';
|
*q++ = '^';
|
||||||
*q++ = c ^ 0100;
|
*q++ = c ^ 0100;
|
||||||
@@ -1702,7 +1717,7 @@
|
@@ -1756,7 +1771,7 @@ void logmsg(pri, msg, from, flags)
|
||||||
!strcmp(from, f->f_prevhost)) {
|
!strcmp(from, f->f_prevhost)) {
|
||||||
(void) strncpy(f->f_lasttime, timestamp, 15);
|
(void) strncpy(f->f_lasttime, timestamp, 15);
|
||||||
f->f_prevcount++;
|
f->f_prevcount++;
|
||||||
@ -573,7 +568,7 @@
|
|||||||
f->f_prevcount, now - f->f_time,
|
f->f_prevcount, now - f->f_time,
|
||||||
repeatinterval[f->f_repeatcount]);
|
repeatinterval[f->f_repeatcount]);
|
||||||
/*
|
/*
|
||||||
@@ -2031,13 +2046,7 @@
|
@@ -2085,13 +2100,7 @@ void wallmsg(f, iov)
|
||||||
register struct filed *f;
|
register struct filed *f;
|
||||||
struct iovec *iov;
|
struct iovec *iov;
|
||||||
{
|
{
|
||||||
@ -587,7 +582,7 @@
|
|||||||
|
|
||||||
if (reenter++)
|
if (reenter++)
|
||||||
return;
|
return;
|
||||||
@@ -2051,9 +2060,18 @@
|
@@ -2105,9 +2114,18 @@ void wallmsg(f, iov)
|
||||||
* and doing notty().
|
* and doing notty().
|
||||||
*/
|
*/
|
||||||
if (fork() == 0) {
|
if (fork() == 0) {
|
||||||
@ -606,7 +601,7 @@
|
|||||||
#ifndef SYSV
|
#ifndef SYSV
|
||||||
(void) signal(SIGTTOU, SIG_IGN);
|
(void) signal(SIGTTOU, SIG_IGN);
|
||||||
(void) sigsetmask(0);
|
(void) sigsetmask(0);
|
||||||
@@ -2069,7 +2087,7 @@
|
@@ -2123,7 +2141,7 @@ void wallmsg(f, iov)
|
||||||
/* is this slot used? */
|
/* is this slot used? */
|
||||||
if (ut.ut_name[0] == '\0')
|
if (ut.ut_name[0] == '\0')
|
||||||
continue;
|
continue;
|
||||||
@ -615,7 +610,7 @@
|
|||||||
continue;
|
continue;
|
||||||
if (!(strcmp (ut.ut_name,"LOGIN"))) /* paranoia */
|
if (!(strcmp (ut.ut_name,"LOGIN"))) /* paranoia */
|
||||||
continue;
|
continue;
|
||||||
@@ -2249,7 +2267,7 @@
|
@@ -2301,7 +2319,7 @@ void domark()
|
||||||
for (f = Files; f; f = f->f_next) {
|
for (f = Files; f; f = f->f_next) {
|
||||||
#endif
|
#endif
|
||||||
if (f->f_prevcount && now >= REPEATTIME(f)) {
|
if (f->f_prevcount && now >= REPEATTIME(f)) {
|
||||||
@ -624,7 +619,7 @@
|
|||||||
TypeNames[f->f_type], f->f_prevcount,
|
TypeNames[f->f_type], f->f_prevcount,
|
||||||
repeatinterval[f->f_repeatcount]);
|
repeatinterval[f->f_repeatcount]);
|
||||||
fprintlog(f, LocalHostName, 0, (char *)NULL);
|
fprintlog(f, LocalHostName, 0, (char *)NULL);
|
||||||
@@ -2259,6 +2277,7 @@
|
@@ -2311,6 +2329,7 @@ void domark()
|
||||||
}
|
}
|
||||||
(void) signal(SIGALRM, domark);
|
(void) signal(SIGALRM, domark);
|
||||||
(void) alarm(TIMERINTVL);
|
(void) alarm(TIMERINTVL);
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri May 30 12:32:52 CEST 2008 - werner@suse.de
|
||||||
|
|
||||||
|
- No flock() as this seems to be broken in newer glibc (bnc#395114)
|
||||||
|
- No fortify, make sylog function of klogd private (bnc#395666)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed May 28 12:15:37 CEST 2008 - werner@suse.de
|
||||||
|
|
||||||
|
- Be able to write errors on writing pid file to tty (bnc#394787)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue May 20 16:56:47 CEST 2008 - mt@suse.de
|
Tue May 20 16:56:47 CEST 2008 - mt@suse.de
|
||||||
|
|
||||||
|
11
syslogd.spec
11
syslogd.spec
@ -20,7 +20,7 @@ PreReq: coreutils %fillup_prereq klogd sed
|
|||||||
Provides: syslog
|
Provides: syslog
|
||||||
AutoReqProv: on
|
AutoReqProv: on
|
||||||
Version: 1.4.1
|
Version: 1.4.1
|
||||||
Release: 674
|
Release: 676
|
||||||
Summary: The Syslog daemon
|
Summary: The Syslog daemon
|
||||||
Source: sysklogd-1.4.1.tar.bz2
|
Source: sysklogd-1.4.1.tar.bz2
|
||||||
Source1: logrotate.syslog
|
Source1: logrotate.syslog
|
||||||
@ -49,6 +49,8 @@ Patch16: sysklogd-1.4.1-utf8.patch
|
|||||||
Patch17: sysklogd-1.4.1-ksym.patch
|
Patch17: sysklogd-1.4.1-ksym.patch
|
||||||
Patch18: sysklogd-1.4.1-dontsleep.patch
|
Patch18: sysklogd-1.4.1-dontsleep.patch
|
||||||
Patch19: sysklogd-1.4.1-signal.dif
|
Patch19: sysklogd-1.4.1-signal.dif
|
||||||
|
Patch20: sysklogd-1.4.1-clearing.patch
|
||||||
|
Patch21: sysklogd-1.4.1-nofortify.patch
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -113,6 +115,8 @@ Authors:
|
|||||||
%patch17 -p1 -b .ksym
|
%patch17 -p1 -b .ksym
|
||||||
%patch18 -p1 -b .sleep
|
%patch18 -p1 -b .sleep
|
||||||
%patch19 -p0 -b .signal
|
%patch19 -p0 -b .signal
|
||||||
|
%patch20 -p0 -b .clear
|
||||||
|
%patch21 -p0 -b .nofortify
|
||||||
%patch0 -p0
|
%patch0 -p0
|
||||||
|
|
||||||
%build
|
%build
|
||||||
@ -227,6 +231,11 @@ fi
|
|||||||
%{omc_svcdir}/syslog.xml
|
%{omc_svcdir}/syslog.xml
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri May 30 2008 werner@suse.de
|
||||||
|
- No flock() as this seems to be broken in newer glibc (bnc#395114)
|
||||||
|
- No fortify, make sylog function of klogd private (bnc#395666)
|
||||||
|
* Wed May 28 2008 werner@suse.de
|
||||||
|
- Be able to write errors on writing pid file to tty (bnc#394787)
|
||||||
* Tue May 20 2008 mt@suse.de
|
* Tue May 20 2008 mt@suse.de
|
||||||
- Added syslog(8) meta manual page to klogd package describing the
|
- Added syslog(8) meta manual page to klogd package describing the
|
||||||
syslog service (SYSLOG_DAEMON variable) handling (bnc#373960).
|
syslog service (SYSLOG_DAEMON variable) handling (bnc#373960).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user