Update to sysklogd 1.5.1
OBS-URL: https://build.opensuse.org/package/show/Base:System/syslogd?expand=0&rev=164
This commit is contained in:
parent
87ca2d1f61
commit
4e7c0d2e3b
@ -1,30 +0,0 @@
|
||||
Index: sysklogd-1.4.1/ksym_mod.c
|
||||
===================================================================
|
||||
--- sysklogd-1.4.1.orig/ksym_mod.c
|
||||
+++ sysklogd-1.4.1/ksym_mod.c
|
||||
@@ -89,6 +89,7 @@
|
||||
#include <errno.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
+#include <sys/syscall.h>
|
||||
#include <stdarg.h>
|
||||
#include <paths.h>
|
||||
#include <limits.h>
|
||||
@@ -105,7 +106,16 @@ struct kernel_sym
|
||||
};
|
||||
|
||||
extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
|
||||
-extern int get_kernel_syms __P ((struct kernel_sym *__table));
|
||||
+
|
||||
+static int get_kernel_syms(struct kernel_sym *table)
|
||||
+{
|
||||
+#ifdef SYS_get_kernel_syms
|
||||
+ return syscall(SYS_get_kernel_syms, table);
|
||||
+#else
|
||||
+ errno = ENOSYS;
|
||||
+ return -1;
|
||||
+#endif
|
||||
+}
|
||||
|
||||
static inline __off64_t seek64(int fd, uintptr_t address)
|
||||
{
|
@ -5,7 +5,7 @@
|
||||
|
||||
--- syslog.c
|
||||
+++ syslog.c 2014-09-24 16:09:26.062235727 +0000
|
||||
@@ -72,6 +72,13 @@ static char sccsid[] = "@(#)syslog.c 5.2
|
||||
@@ -75,6 +75,13 @@ static char sccsid[] = "@(#)syslog.c 5.2
|
||||
|
||||
#define _PATH_LOGNAME "/dev/log"
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
static int LogFile = -1; /* fd for log */
|
||||
--- syslogd.c
|
||||
+++ syslogd.c 2014-09-22 08:18:13.122235747 +0000
|
||||
@@ -565,6 +565,13 @@ static char sccsid[] __attribute__ ((un
|
||||
@@ -614,6 +614,13 @@ static char sccsid[] __attribute__ ((un
|
||||
#define SYSTEMD_PATH_LOG "/run/systemd/journal/syslog"
|
||||
#endif
|
||||
|
||||
|
@ -2,52 +2,142 @@
|
||||
! Be able to write errors on creating of pid file on
|
||||
! the current terminal (bug #394787)
|
||||
!
|
||||
---
|
||||
klogd.c | 78 +++++++++++++++++++++++++++++++++++---------------------------
|
||||
pidfile.c | 39 +++++++++++++++++++++++++++----
|
||||
syslogd.c | 60 +++++++++++++++++++++++++++++------------------
|
||||
3 files changed, 117 insertions(+), 60 deletions(-)
|
||||
|
||||
--- klogd.c
|
||||
+++ klogd.c 2008-05-28 10:01:46.000000000 +0000
|
||||
@@ -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();
|
||||
+++ klogd.c 2022-10-17 11:12:11.438652739 +0000
|
||||
@@ -268,6 +268,8 @@
|
||||
#include <stdarg.h>
|
||||
#include <paths.h>
|
||||
#include <stdlib.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/wait.h>
|
||||
#include "klogd.h"
|
||||
#include "ksyms.h"
|
||||
#ifndef TESTING
|
||||
@@ -366,13 +368,12 @@ static void CloseLogSrc()
|
||||
/*
|
||||
* Signal handler to terminate the parent process.
|
||||
*/
|
||||
+static volatile sig_atomic_t leave;
|
||||
#ifndef TESTING
|
||||
void doexit(sig)
|
||||
-
|
||||
int sig;
|
||||
-
|
||||
{
|
||||
- exit (0);
|
||||
+ leave++;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1110,14 +1111,41 @@ int main(argc, argv)
|
||||
{
|
||||
if (!check_pid(PidFile))
|
||||
{
|
||||
- signal (SIGTERM, doexit);
|
||||
- if ( fork() == 0 )
|
||||
- {
|
||||
- auto int fl;
|
||||
- int num_fds = getdtablesize();
|
||||
+ pid_t pid;
|
||||
+ int n=0, num_fds, fl, status;
|
||||
|
||||
+ leave = 0;
|
||||
+ signal (SIGTERM, doexit);
|
||||
+ switch ((pid = fork())) {
|
||||
+ default:
|
||||
+ retry:
|
||||
+ /*
|
||||
+ * Parent process
|
||||
+ */
|
||||
+ switch (waitpid(pid, &status, WNOHANG|WUNTRACED)) {
|
||||
+ case -1:
|
||||
+ if (errno == EINTR)
|
||||
+ goto retry;
|
||||
+ break;
|
||||
+ case 0:
|
||||
+ if (leave)
|
||||
+ exit(0);
|
||||
+ usleep(10*1000);
|
||||
+ if (++n < 30000)
|
||||
+ goto retry;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ case -1:
|
||||
+ /*
|
||||
+ * Not reached unless something major went wrong.
|
||||
+ */
|
||||
+ exit(1);
|
||||
+ case 0:
|
||||
signal (SIGTERM, SIG_DFL);
|
||||
-
|
||||
+
|
||||
+ num_fds = getdtablesize();
|
||||
+
|
||||
/* 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);
|
||||
@@ -1128,17 +1156,12 @@ int main(argc, argv)
|
||||
}
|
||||
|
||||
setsid();
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- /*
|
||||
- * Parent process
|
||||
- */
|
||||
- sleep(300);
|
||||
- /*
|
||||
- * Not reached unless something major went wrong.
|
||||
- */
|
||||
- exit(1);
|
||||
+
|
||||
+ /* tuck my process id away */
|
||||
+ if (!write_pid(PidFile))
|
||||
+ Terminate();
|
||||
+
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1147,19 +1170,6 @@ int main(argc, argv)
|
||||
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();
|
||||
- Terminate();
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- fputs("klogd: Already running.\n", stderr);
|
||||
- Terminate();
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
#endif
|
||||
|
||||
/* Signal setups. */
|
||||
@@ -1225,6 +1235,8 @@ int main(argc, argv)
|
||||
{
|
||||
if ( change_state )
|
||||
ChangeLogging();
|
||||
+ if (leave)
|
||||
+ exit(0);
|
||||
switch ( logsrc )
|
||||
{
|
||||
case kernel:
|
||||
--- pidfile.c
|
||||
+++ pidfile.c 2008-05-29 21:43:35.280028303 +0000
|
||||
+++ pidfile.c 2022-10-17 11:11:16.627630427 +0000
|
||||
@@ -23,6 +23,7 @@
|
||||
* Sat Aug 19 13:24:33 MET DST 1995: Martin Schulze
|
||||
* First version (v0.2) released
|
||||
@ -75,7 +165,7 @@
|
||||
+ struct flock lck;
|
||||
+#endif
|
||||
|
||||
if ( ((fd = open(pidfile, O_RDWR|O_CREAT, 0644)) == -1)
|
||||
if ( ((fd = open(pidfile, O_RDWR|O_CREAT|O_TRUNC, 0644)) == -1)
|
||||
|| ((f = fdopen(fd, "r+")) == NULL) ) {
|
||||
@@ -93,23 +101,46 @@ int write_pid (char *pidfile)
|
||||
return 0;
|
||||
@ -129,7 +219,7 @@
|
||||
return 0;
|
||||
}
|
||||
--- syslogd.c
|
||||
+++ syslogd.c 2008-05-28 10:12:25.000000000 +0000
|
||||
+++ syslogd.c 2022-10-17 11:11:16.627630427 +0000
|
||||
@@ -22,7 +22,7 @@ char copyright2[] =
|
||||
#endif /* not lint */
|
||||
|
||||
@ -139,18 +229,7 @@
|
||||
#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)
|
||||
@@ -900,7 +900,9 @@ int main(argc, argv)
|
||||
fd_set readfds;
|
||||
|
||||
#ifndef TESTING
|
||||
@ -160,7 +239,7 @@
|
||||
#ifdef SYSLOG_INET
|
||||
#ifdef INET6
|
||||
struct sockaddr_storage frominet;
|
||||
@@ -856,7 +860,9 @@ int main(argc, argv)
|
||||
@@ -915,7 +917,9 @@ int main(argc, argv)
|
||||
int ch;
|
||||
struct hostent *hent;
|
||||
|
||||
@ -170,10 +249,12 @@
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
int maxfds;
|
||||
@@ -975,10 +981,19 @@ int main(argc, argv)
|
||||
@@ -1033,11 +1037,20 @@ int main(argc, argv)
|
||||
exit(1);
|
||||
case 0:
|
||||
signal (SIGTERM, SIG_DFL);
|
||||
|
||||
signal (SIGTERM, SIG_DFL);
|
||||
-
|
||||
+
|
||||
+ /* tuck my process id away */
|
||||
+ dprintf("Writing pidfile.\n");
|
||||
+ if (!write_pid(PidFile))
|
||||
@ -190,7 +271,7 @@
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -988,32 +1003,32 @@ int main(argc, argv)
|
||||
@@ -1047,36 +1060,37 @@ int main(argc, argv)
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -201,7 +282,7 @@
|
||||
- else
|
||||
setlinebuf(stdout);
|
||||
#endif
|
||||
-
|
||||
|
||||
#ifndef TESTING
|
||||
- /* tuck my process id away */
|
||||
- if ( !Debug )
|
||||
@ -214,23 +295,29 @@
|
||||
- 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");
|
||||
+ if (getpid() != ppid)
|
||||
+ kill (ppid, SIGTERM);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
{
|
||||
- dprintf("Can't write pid.\n");
|
||||
+ dprintf("Pidfile (and pid) already exist.\n");
|
||||
if (getpid() != ppid)
|
||||
kill (ppid, SIGTERM);
|
||||
exit(1);
|
||||
}
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- dprintf("Pidfile (and pid) already exist.\n");
|
||||
- if (getpid() != ppid)
|
||||
- kill (ppid, SIGTERM);
|
||||
- exit(1);
|
||||
- }
|
||||
- } /* if ( !Debug ) */
|
||||
@ -239,22 +326,25 @@
|
||||
#endif
|
||||
|
||||
consfile.f_type = F_CONSOLE;
|
||||
@@ -1659,8 +1674,13 @@ void logmsg(pri, msg, from, flags)
|
||||
@@ -1738,7 +1752,7 @@ 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;
|
||||
char *timestamp;
|
||||
#ifdef __gnu_linux__
|
||||
@@ -1746,6 +1760,8 @@ void logmsg(pri, msg, from, flags)
|
||||
#else
|
||||
#ifndef SYSV
|
||||
sigset_t omask;
|
||||
+#else
|
||||
+ int lognum;
|
||||
+#endif
|
||||
char *timestamp;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
dprintf("logmsg: %s, flags %x, from %s, msg %s\n", textpri(pri), flags, from, msg);
|
||||
@@ -2402,11 +2422,9 @@ void init()
|
||||
@@ -2512,11 +2528,9 @@ void init()
|
||||
register int i, lognum;
|
||||
register FILE *cf;
|
||||
register struct filed *f;
|
||||
@ -266,7 +356,7 @@
|
||||
register char *p;
|
||||
register unsigned int Forwarding = 0;
|
||||
#ifdef CONT_LINE
|
||||
@@ -2487,7 +2505,7 @@ void init()
|
||||
@@ -2601,7 +2615,7 @@ void init()
|
||||
#else
|
||||
*nextp = (struct filed *)calloc(1, sizeof(*f));
|
||||
cfline("*.ERR\t" _PATH_CONSOLE, *nextp);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- syslog.c
|
||||
+++ syslog.c 2001-05-23 18:48:13.000000000 +0000
|
||||
@@ -211,8 +211,9 @@ openlog(ident, logstat, logfac)
|
||||
@@ -224,8 +224,9 @@ openlog(ident, logstat, logfac)
|
||||
strncpy(SyslogAddr.sa_data, _PATH_LOGNAME,
|
||||
sizeof(SyslogAddr.sa_data));
|
||||
if (LogStat & LOG_NDELAY) {
|
||||
|
@ -1,6 +1,12 @@
|
||||
---
|
||||
Makefile | 4
|
||||
resolve.c | 249 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
syslogd.c | 139 +++++-----------------------------
|
||||
3 files changed, 275 insertions(+), 117 deletions(-)
|
||||
|
||||
--- Makefile
|
||||
+++ Makefile 2003-06-02 12:30:18.000000000 +0000
|
||||
@@ -59,8 +59,8 @@ test: syslog_tst ksym oops_test tsyslogd
|
||||
+++ Makefile 2022-10-18 06:11:16.691008894 +0000
|
||||
@@ -79,8 +79,8 @@ test: syslog_tst ksym oops.ko tsyslogd
|
||||
|
||||
install: install_man install_exec
|
||||
|
||||
@ -12,7 +18,7 @@
|
||||
klogd: klogd.o syslog.o pidfile.o ksym.o ksym_mod.o
|
||||
${CC} ${LDFLAGS} -o klogd klogd.o syslog.o pidfile.o ksym.o \
|
||||
--- resolve.c
|
||||
+++ resolve.c 2003-06-02 12:30:33.000000000 +0000
|
||||
+++ resolve.c 2022-10-18 06:11:16.691008894 +0000
|
||||
@@ -0,0 +1,249 @@
|
||||
+/*
|
||||
+ * Resolve a hostname
|
||||
@ -264,8 +270,8 @@
|
||||
+ exit(0);
|
||||
+}
|
||||
--- syslogd.c
|
||||
+++ syslogd.c 2003-06-02 12:30:26.000000000 +0000
|
||||
@@ -628,14 +628,7 @@ struct filed {
|
||||
+++ syslogd.c 2022-10-18 06:17:39.648170295 +0000
|
||||
@@ -683,14 +683,7 @@ struct filed {
|
||||
struct {
|
||||
char f_hname[MAXHOSTNAMELEN+1];
|
||||
#ifdef INET6
|
||||
@ -281,16 +287,18 @@
|
||||
#else
|
||||
struct sockaddr_in f_addr;
|
||||
#endif
|
||||
@@ -790,7 +783,7 @@ int decode(char *name, struct code *code
|
||||
@@ -846,19 +839,17 @@ int decode(char *name, struct code *code
|
||||
#if defined(__GLIBC__)
|
||||
#define dprintf mydprintf
|
||||
#endif /* __GLIBC__ */
|
||||
-static void dprintf(char *, ...);
|
||||
+void dprintf(char *, ...);
|
||||
static void allocate_log(void);
|
||||
void sighup_handler();
|
||||
-void sighup_handler();
|
||||
+void sighup_handler(int sig);
|
||||
|
||||
@@ -799,10 +792,8 @@ static int create_unix_socket(const char
|
||||
#ifdef SYSLOG_UNIXAF
|
||||
static int create_unix_socket(const char *path);
|
||||
#endif
|
||||
#ifdef SYSLOG_INET
|
||||
static int create_inet_socket();
|
||||
@ -303,7 +311,7 @@
|
||||
#endif
|
||||
|
||||
int main(argc, argv)
|
||||
@@ -1337,63 +1328,6 @@ static int create_inet_socket()
|
||||
@@ -1413,63 +1404,6 @@ static int create_inet_socket()
|
||||
return fd;
|
||||
}
|
||||
|
||||
@ -367,7 +375,7 @@
|
||||
#endif
|
||||
|
||||
char **
|
||||
@@ -1814,7 +1748,7 @@ void fprintlog(f, from, flags, msg)
|
||||
@@ -1913,7 +1847,7 @@ void fprintlog(f, from, flags, msg)
|
||||
char line[MAXLINE + 1];
|
||||
time_t fwd_suspend;
|
||||
#ifdef INET6
|
||||
@ -376,7 +384,7 @@
|
||||
#else
|
||||
struct hostent *hp;
|
||||
#endif
|
||||
@@ -1883,38 +1817,21 @@ void fprintlog(f, from, flags, msg)
|
||||
@@ -1982,38 +1916,21 @@ void fprintlog(f, from, flags, msg)
|
||||
*/
|
||||
case F_FORW_UNKN:
|
||||
dprintf(" %s\n", f->f_un.f_forw.f_hname);
|
||||
@ -429,7 +437,17 @@
|
||||
|
||||
case F_FORW:
|
||||
/*
|
||||
@@ -2544,6 +2461,7 @@ void init()
|
||||
@@ -2429,9 +2346,7 @@ void logerror(type)
|
||||
}
|
||||
|
||||
void die(sig)
|
||||
-
|
||||
int sig;
|
||||
-
|
||||
{
|
||||
register struct filed *f;
|
||||
char buf[100];
|
||||
@@ -2655,6 +2570,7 @@ void init()
|
||||
#endif
|
||||
|
||||
#ifdef SYSLOG_INET
|
||||
@ -437,7 +455,7 @@
|
||||
if (Forwarding || AcceptRemote) {
|
||||
if (finet < 0) {
|
||||
finet = create_inet_socket();
|
||||
@@ -2560,10 +2478,6 @@ void init()
|
||||
@@ -2671,10 +2587,6 @@ void init()
|
||||
InetInuse = 0;
|
||||
}
|
||||
inetm = finet;
|
||||
@ -448,12 +466,33 @@
|
||||
#endif
|
||||
|
||||
Initialized = 1;
|
||||
@@ -2923,7 +2837,7 @@ int decode(name, codetab)
|
||||
@@ -3040,8 +2952,7 @@ int decode(name, codetab)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
-static void dprintf(char *fmt, ...)
|
||||
-
|
||||
+void dprintf(char *fmt, ...)
|
||||
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@@ -3061,8 +2972,7 @@ static void dprintf(char *fmt, ...)
|
||||
* The following function is responsible for allocating/reallocating the
|
||||
* array which holds the structures which define the logging outputs.
|
||||
*/
|
||||
-static void allocate_log()
|
||||
-
|
||||
+static void allocate_log(void)
|
||||
{
|
||||
dprintf("Called allocate_log, nlogs = %d.\n", nlogs);
|
||||
|
||||
@@ -3109,8 +3019,7 @@ static void allocate_log()
|
||||
* doing this during a signal handler. Instead this function simply sets
|
||||
* a flag variable which will tell the main loop to go through a restart.
|
||||
*/
|
||||
-void sighup_handler()
|
||||
-
|
||||
+void sighup_handler(int sig)
|
||||
{
|
||||
restart = 1;
|
||||
signal(SIGHUP, sighup_handler);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- klogd.c
|
||||
+++ klogd.c 2007-06-18 11:22:06.978362000 +0000
|
||||
@@ -416,9 +416,11 @@ static void Terminate()
|
||||
@@ -436,9 +436,11 @@ static void Terminate()
|
||||
{
|
||||
CloseLogSrc();
|
||||
Syslog(LOG_INFO, "Kernel log daemon terminating.");
|
||||
|
@ -1,18 +0,0 @@
|
||||
--- ksym.c
|
||||
+++ ksym.c 2001-05-23 18:54:18.000000000 +0000
|
||||
@@ -345,6 +345,7 @@ static char * FindSymbolFile()
|
||||
if ( (sym_file = fopen(symfile, "r")) != (FILE *) 0 ) {
|
||||
if (CheckMapVersion(symfile) == 1)
|
||||
file = symfile;
|
||||
+ fclose(sym_file);
|
||||
}
|
||||
if (sym_file == (FILE *) 0 || file == (char *) 0) {
|
||||
sprintf (symfile, "%s", *mf);
|
||||
@@ -353,6 +354,7 @@ static char * FindSymbolFile()
|
||||
if ( (sym_file = fopen(symfile, "r")) != (FILE *) 0 ) {
|
||||
if (CheckMapVersion(symfile) == 1)
|
||||
file = symfile;
|
||||
+ fclose(sym_file);
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,18 @@
|
||||
---
|
||||
sysklogd.8 | 6 ++++++
|
||||
syslogd.c | 26 +++++++++++++++++++++++++-
|
||||
2 files changed, 31 insertions(+), 1 deletion(-)
|
||||
|
||||
--- sysklogd.8
|
||||
+++ sysklogd.8 2001-05-23 18:59:26.000000000 +0000
|
||||
+++ sysklogd.8 2022-10-13 08:04:12.411821359 +0000
|
||||
@@ -29,6 +29,7 @@ sysklogd \- Linux system logging utiliti
|
||||
.RB [ " \-s "
|
||||
.I domainlist
|
||||
]
|
||||
+.RB [ " \-t " ]
|
||||
.RB [ " \-v " ]
|
||||
.LP
|
||||
.SH DESCRIPTION
|
||||
.B Sysklogd
|
||||
@@ -150,6 +151,11 @@ is specified and the host logging resolv
|
||||
no domain would be cut, you will have to specify two domains like:
|
||||
.BR "\-s north.de:infodrom.north.de" .
|
||||
@ -19,24 +24,24 @@
|
||||
+.TP
|
||||
.B "\-v"
|
||||
Print version and exit.
|
||||
.LP
|
||||
.SH SIGNALS
|
||||
--- syslogd.c
|
||||
+++ syslogd.c 2001-05-23 19:01:21.000000000 +0000
|
||||
+++ syslogd.c 2022-10-13 08:08:49.502856189 +0000
|
||||
@@ -417,6 +417,13 @@ static char sccsid[] = "@(#)syslogd.c 5.
|
||||
* file is defined in the used libc and should not be hardcoded
|
||||
* into the syslogd binary referring the system it was compiled on.
|
||||
*
|
||||
+ * Mon Oct 18 19:23:00 CEST 1999: Andreas Siegert <afx@suse.de>
|
||||
+ * Added -t flag that triggers tagging of forwarded messages with
|
||||
+ * the sending hosts name as seen by the forwarder.
|
||||
+ * Useful for relaying syslog from DMZs through the firwall to an
|
||||
+ * internal loghost.
|
||||
+ * Format is "<""hostname"
|
||||
+ * Added -t flag that triggers tagging of forwarded messages with
|
||||
+ * the sending hosts name as seen by the forwarder.
|
||||
+ * Useful for relaying syslog from DMZs through the firwall to an
|
||||
+ * internal loghost.
|
||||
+ * Format is "<""hostname"
|
||||
+ *
|
||||
* Sun Sep 17 20:45:33 CEST 2000: Martin Schulze <joey@infodrom.ffis.de>
|
||||
* Fixed some bugs in printline() code that did not escape
|
||||
* control characters '\177' through '\237' and contained a
|
||||
@@ -731,6 +738,7 @@ int MarkInterval = 20 * 60; /* interval
|
||||
* Sun Sep 17 21:26:16 CEST 2000: Martin Schulze <joey@infodrom.ffis.de>
|
||||
* Don't close open sockets upon reload. Thanks to Bill
|
||||
* Nottingham.
|
||||
@@ -787,6 +794,7 @@ int MarkInterval = 20 * 60; /* interval
|
||||
int MarkSeq = 0; /* mark sequence number */
|
||||
int NoFork = 0; /* don't fork - don't run in daemon mode */
|
||||
int AcceptRemote = 0; /* receive messages that come via UDP */
|
||||
@ -44,7 +49,7 @@
|
||||
char **StripDomains = NULL; /* these domains may be stripped before writing logs */
|
||||
char **LocalHosts = NULL; /* these hosts are logged with their hostname */
|
||||
int NoHops = 1; /* Can we bounce syslog messages through an
|
||||
@@ -829,7 +837,7 @@ int main(argc, argv)
|
||||
@@ -888,7 +896,7 @@ int main(argc, argv)
|
||||
funix[i] = -1;
|
||||
}
|
||||
|
||||
@ -53,7 +58,7 @@
|
||||
switch((char)ch) {
|
||||
case 'a':
|
||||
if (nfunix < MAXFUNIX)
|
||||
@@ -874,6 +882,10 @@ int main(argc, argv)
|
||||
@@ -933,6 +941,10 @@ int main(argc, argv)
|
||||
}
|
||||
StripDomains = crunch_list(optarg);
|
||||
break;
|
||||
@ -64,25 +69,22 @@
|
||||
case 'v':
|
||||
printf("syslogd %s.%s\n", VERSION, PATCHLEVEL);
|
||||
exit (0);
|
||||
@@ -1771,8 +1783,19 @@ void fprintlog(f, from, flags, msg)
|
||||
dprintf("Not sending message to remote.\n");
|
||||
else {
|
||||
@@ -1872,6 +1884,18 @@ void fprintlog(f, from, flags, msg)
|
||||
f->f_time = now;
|
||||
- (void) snprintf(line, sizeof(line), "<%d>%s\n", f->f_prevpri, \
|
||||
- (char *) iov[4].iov_base);
|
||||
+/* afx: add <sourcehost
|
||||
+ */
|
||||
+ if ((TagForward == 1) &&
|
||||
(void) snprintf(line, sizeof(line), "<%d>%s", f->f_prevpri, \
|
||||
(char *) iov[4].iov_base);
|
||||
+/* afx: add <sourcehost */
|
||||
+ if ((TagForward == 1) &&
|
||||
+ strncmp(f->f_prevhost,LocalHostName,MAXHOSTNAMELEN+1)) {
|
||||
+ (void) snprintf(line, sizeof(line), "<%d><%s: %s\n",
|
||||
+ f->f_prevpri, f->f_prevhost,
|
||||
+ (void) snprintf(line, sizeof(line), "<%d><%s: %s\n",
|
||||
+ f->f_prevpri, f->f_prevhost,
|
||||
+ (char *) iov[4].iov_base);
|
||||
+ } else {
|
||||
+ (void) snprintf(line, sizeof(line), "<%d>%s\n",
|
||||
+ f->f_prevpri,
|
||||
+ f->f_prevpri,
|
||||
+ (char *) iov[4].iov_base);
|
||||
+ }
|
||||
+/* end afx */
|
||||
+/* end afx */
|
||||
l = strlen(line);
|
||||
if (l > MAXLINE)
|
||||
l = MAXLINE;
|
||||
|
@ -1,6 +1,13 @@
|
||||
---
|
||||
klogd.c | 4 ++--
|
||||
ksym.c | 55 +++++++++++++++++++++++++++++++++++++++----------------
|
||||
ksym_mod.c | 11 +++++------
|
||||
ksyms.h | 11 +++++++----
|
||||
4 files changed, 53 insertions(+), 28 deletions(-)
|
||||
|
||||
--- klogd.c
|
||||
+++ klogd.c 2003-09-09 14:15:47.000000000 +0000
|
||||
@@ -879,7 +879,7 @@ static void LogLine(char *ptr, int len)
|
||||
+++ klogd.c 2022-10-13 08:49:17.755515718 +0000
|
||||
@@ -874,7 +874,7 @@ static void LogLine(char *ptr, int len)
|
||||
{
|
||||
auto int sym_space;
|
||||
|
||||
@ -9,27 +16,18 @@
|
||||
auto struct symbol sym;
|
||||
auto char *symbol;
|
||||
|
||||
@@ -904,7 +904,7 @@ static void LogLine(char *ptr, int len)
|
||||
@@ -899,7 +899,7 @@ static void LogLine(char *ptr, int len)
|
||||
break;
|
||||
}
|
||||
|
||||
- delta = sprintf( sym_start, "%s+%d/%d]",
|
||||
+ delta = sprintf( sym_start, "%s+%llu/%zu]",
|
||||
- delta = sprintf( sym_start, "%s+0x%x/0x%02x]",
|
||||
+ delta = sprintf( sym_start, "%s+%zl/%zu]",
|
||||
symbol, sym.offset, sym.size );
|
||||
|
||||
space = sym_space + delta;
|
||||
--- ksym.c
|
||||
+++ ksym.c 2003-09-09 14:15:47.000000000 +0000
|
||||
@@ -122,7 +122,7 @@
|
||||
/* Variables static to this module. */
|
||||
struct sym_table
|
||||
{
|
||||
- unsigned long value;
|
||||
+ uintptr_t value;
|
||||
char *name;
|
||||
};
|
||||
|
||||
@@ -151,7 +151,7 @@ extern int debugging;
|
||||
+++ ksym.c 2022-10-13 09:00:17.403732468 +0000
|
||||
@@ -164,7 +164,7 @@ extern int debugging;
|
||||
|
||||
/* Function prototypes. */
|
||||
static char * FindSymbolFile(void);
|
||||
@ -38,7 +36,7 @@
|
||||
static void FreeSymbols(void);
|
||||
static int CheckVersion(char *);
|
||||
static int CheckMapVersion(char *);
|
||||
@@ -185,7 +185,7 @@ extern int InitKsyms(mapfile)
|
||||
@@ -198,7 +198,7 @@ extern int InitKsyms(mapfile)
|
||||
|
||||
auto int version = 0;
|
||||
|
||||
@ -47,16 +45,16 @@
|
||||
|
||||
auto FILE *sym_file;
|
||||
|
||||
@@ -237,16 +237,24 @@ extern int InitKsyms(mapfile)
|
||||
@@ -250,16 +250,24 @@ extern int InitKsyms(mapfile)
|
||||
*/
|
||||
while ( !feof(sym_file) )
|
||||
{
|
||||
- if ( fscanf(sym_file, "%lx %c %s\n", &address, &type, sym)
|
||||
- if ( fscanf(sym_file, "%lx %c %511s\n", &address, &type, sym)
|
||||
- != 3 )
|
||||
+#if __WORDSIZE == 64
|
||||
+ if ( fscanf(sym_file, "%lx %c %s\n", &address, &type, sym) != 3 )
|
||||
+ if ( fscanf(sym_file, "%lx %c %511s\n", &address, &type, sym) != 3 )
|
||||
+#else
|
||||
+ if ( fscanf(sym_file, "%x %c %s\n", &address, &type, sym) != 3 )
|
||||
+ if ( fscanf(sym_file, "%x %c %511s\n", &address, &type, sym) != 3 )
|
||||
+#endif
|
||||
{
|
||||
Syslog(LOG_ERR, "Error in symbol table input (#1).");
|
||||
@ -74,7 +72,7 @@
|
||||
|
||||
if ( AddSymbol(address, sym) == 0 )
|
||||
{
|
||||
@@ -521,7 +529,7 @@ static int CheckMapVersion(fname)
|
||||
@@ -534,7 +542,7 @@ static int CheckMapVersion(fname)
|
||||
{
|
||||
int version;
|
||||
FILE *sym_file;
|
||||
@ -83,16 +81,16 @@
|
||||
auto char type,
|
||||
sym[512];
|
||||
|
||||
@@ -536,16 +544,24 @@ static int CheckMapVersion(fname)
|
||||
@@ -549,16 +557,24 @@ static int CheckMapVersion(fname)
|
||||
version = 0;
|
||||
while ( !feof(sym_file) && (version == 0) )
|
||||
{
|
||||
- if ( fscanf(sym_file, "%lx %c %s\n", &address, \
|
||||
- if ( fscanf(sym_file, "%lx %c %511s\n", &address, \
|
||||
- &type, sym) != 3 )
|
||||
+#if __WORDSIZE == 64
|
||||
+ if ( fscanf(sym_file, "%lx %c %s\n", &address, &type, sym) != 3 )
|
||||
+ if ( fscanf(sym_file, "%lx %c %511s\n", &address, &type, sym) != 3 )
|
||||
+#else
|
||||
+ if ( fscanf(sym_file, "%x %c %s\n", &address, &type, sym) != 3 )
|
||||
+ if ( fscanf(sym_file, "%x %c %511s\n", &address, &type, sym) != 3 )
|
||||
+#endif
|
||||
{
|
||||
Syslog(LOG_ERR, "Error in symbol table input (#2).");
|
||||
@ -110,16 +108,16 @@
|
||||
|
||||
version = CheckVersion(sym);
|
||||
}
|
||||
@@ -583,7 +599,7 @@ static int CheckMapVersion(fname)
|
||||
@@ -596,7 +612,7 @@ static int CheckMapVersion(fname)
|
||||
* Purpose: This function is responsible for adding a symbol name
|
||||
* and its address to the symbol table.
|
||||
*
|
||||
- * Arguements: (unsigned long) address, (char *) symbol
|
||||
+ * Arguements: (uintptr_t) address, (char *) symbol
|
||||
- * Arguments: (unsigned long) address, (char *) symbol
|
||||
+ * Arguments: (uintptr_t) address, (char *) symbol
|
||||
*
|
||||
* Return: int
|
||||
*
|
||||
@@ -593,7 +609,7 @@ static int CheckMapVersion(fname)
|
||||
@@ -606,7 +622,7 @@ static int CheckMapVersion(fname)
|
||||
|
||||
static int AddSymbol(address, symbol)
|
||||
|
||||
@ -128,7 +126,7 @@
|
||||
|
||||
char *symbol;
|
||||
|
||||
@@ -639,7 +655,7 @@ static int AddSymbol(address, symbol)
|
||||
@@ -652,7 +668,7 @@ static int AddSymbol(address, symbol)
|
||||
|
||||
char * LookupSymbol(value, sym)
|
||||
|
||||
@ -137,7 +135,7 @@
|
||||
|
||||
struct symbol *sym;
|
||||
|
||||
@@ -739,7 +755,7 @@ extern char * ExpandKadds(line, el)
|
||||
@@ -774,7 +790,7 @@ extern char * ExpandKadds(line, el)
|
||||
*symbol;
|
||||
|
||||
char num[15];
|
||||
@ -146,45 +144,45 @@
|
||||
|
||||
auto struct symbol sym;
|
||||
|
||||
@@ -821,7 +837,7 @@ extern char * ExpandKadds(line, el)
|
||||
@@ -858,7 +874,7 @@ extern char * ExpandKadds(line, el)
|
||||
value = strtol(kp2, (char **) 0, 16);
|
||||
if ( (symbol = LookupSymbol(value, &sym)) ) {
|
||||
if (sym.size)
|
||||
- elp += sprintf(elp, " (%s+%d/%d)", symbol, sym.offset, sym.size);
|
||||
+ elp += sprintf(elp, " (%s+%ll/%zu)", symbol, sym.offset, sym.size);
|
||||
+ elp += sprintf(elp, " (%s+%zl/%zu)", symbol, sym.offset, sym.size);
|
||||
else
|
||||
elp += sprintf(elp, " (%s)", symbol);
|
||||
}
|
||||
@@ -830,7 +846,7 @@ extern char * ExpandKadds(line, el)
|
||||
@@ -867,7 +883,7 @@ extern char * ExpandKadds(line, el)
|
||||
value = strtol(kp3, (char **) 0, 16);
|
||||
if ( (symbol = LookupSymbol(value, &sym)) ) {
|
||||
if (sym.size)
|
||||
- elp += sprintf(elp, " (%s+%d/%d)", symbol, sym.offset, sym.size);
|
||||
+ elp += sprintf(elp, " (%s+%ll/%zu)", symbol, sym.offset, sym.size);
|
||||
+ elp += sprintf(elp, " (%s+%zl/%zu)", symbol, sym.offset, sym.size);
|
||||
else
|
||||
elp += sprintf(elp, " (%s)", symbol);
|
||||
}
|
||||
@@ -841,7 +857,7 @@ extern char * ExpandKadds(line, el)
|
||||
@@ -878,7 +894,7 @@ extern char * ExpandKadds(line, el)
|
||||
value = strtol(kp2, (char **) 0, 16);
|
||||
if ( (symbol = LookupSymbol(value, &sym)) ) {
|
||||
if (sym.size)
|
||||
- elp += sprintf(elp, " (%s+%d/%d)", symbol, sym.offset, sym.size);
|
||||
+ elp += sprintf(elp, " (%s+%ll/%zu)", symbol, sym.offset, sym.size);
|
||||
+ elp += sprintf(elp, " (%s+%zl/%zu)", symbol, sym.offset, sym.size);
|
||||
else
|
||||
elp += sprintf(elp, " (%s)", symbol);
|
||||
}
|
||||
@@ -877,17 +893,24 @@ extern char * ExpandKadds(line, el)
|
||||
@@ -914,17 +930,24 @@ extern char * ExpandKadds(line, el)
|
||||
strcat(elp, symbol);
|
||||
elp += strlen(symbol);
|
||||
if ( debugging )
|
||||
- fprintf(stderr, "Symbol: %s = %lx = %s, %x/%d\n", \
|
||||
+#if __WORDSIZE == 64
|
||||
+ fprintf(stderr, "Symbol: %s = %lx = %s, %llx/%zu\n", \
|
||||
+ fprintf(stderr, "Symbol: %s = %lx = %s, %zx/%zu\n", \
|
||||
sl+1, value, \
|
||||
(sym.size==0) ? symbol+1 : symbol, \
|
||||
sym.offset, sym.size);
|
||||
+#else
|
||||
+ fprintf(stderr, "Symbol: %s = %x = %s, %llx/%zu\n", \
|
||||
+ fprintf(stderr, "Symbol: %s = %x = %s, %zx/%zu\n", \
|
||||
+ sl+1, value, \
|
||||
+ (sym.size==0) ? symbol+1 : symbol, \
|
||||
+ sym.offset, sym.size);
|
||||
@ -195,223 +193,39 @@
|
||||
{
|
||||
--value;
|
||||
++kp;
|
||||
- elp += sprintf(elp, "+%x/%d", sym.offset, sym.size);
|
||||
+ elp += sprintf(elp, "+%llx/%zu", sym.offset, sym.size);
|
||||
- elp += sprintf(elp, "+0x%x/0x%02x", sym.offset, sym.size);
|
||||
+ elp += sprintf(elp, "+%zx/%zu", sym.offset, sym.size);
|
||||
}
|
||||
strncat(elp, kp, value);
|
||||
elp += value;
|
||||
--- ksym_mod.c
|
||||
+++ ksym_mod.c 2003-09-09 16:51:08.000000000 +0000
|
||||
@@ -89,43 +89,101 @@
|
||||
#include <errno.h>
|
||||
+++ ksym_mod.c 2022-10-13 10:53:51.690149032 +0000
|
||||
@@ -116,12 +116,11 @@
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "module.h"
|
||||
-#if !defined(__GLIBC__)
|
||||
-#include <linux/time.h>
|
||||
-#include <linux/module.h>
|
||||
-#else /* __GLIBC__ */
|
||||
-#include <linux/module.h>
|
||||
-extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
|
||||
-extern int get_kernel_syms __P ((struct kernel_sym *__table));
|
||||
-#endif /* __GLIBC__ */
|
||||
#include <stdarg.h>
|
||||
#include <paths.h>
|
||||
-#include <linux/version.h>
|
||||
+#include <asm/atomic.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <limits.h>
|
||||
+/* #include <linux/version.h> */
|
||||
|
||||
#include "klogd.h"
|
||||
#include "ksyms.h"
|
||||
|
||||
+/* Used by get_kernel_syms, which is obsolete. */
|
||||
+struct kernel_sym
|
||||
+{
|
||||
+ uintptr_t value;
|
||||
+ char name[60]; /* should have been 64-sizeof(long); oh well */
|
||||
+};
|
||||
+
|
||||
+extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
|
||||
+extern int get_kernel_syms __P ((struct kernel_sym *__table));
|
||||
+
|
||||
+static inline __off64_t seek64(int fd, uintptr_t address)
|
||||
+{
|
||||
+ __off64_t off = (__off64_t)address;
|
||||
+ __off64_t ret = (__off64_t)-1;
|
||||
+
|
||||
+ if (off < 0) {
|
||||
+ __off64_t rel;
|
||||
+ if (lseek64(fd, LONG_MAX, SEEK_SET) != LONG_MAX && errno)
|
||||
+ goto err;
|
||||
+ rel = (__off64_t)(address - LONG_MAX);
|
||||
+ if ((ret = lseek64(fd, rel, SEEK_CUR)) != off && errno)
|
||||
+ goto err;
|
||||
+ ret = -ret; /* Relative to LONG_MAX */
|
||||
+ } else
|
||||
+ ret = lseek64(fd, off, SEEK_SET);
|
||||
+err:
|
||||
+ return ret;
|
||||
+}
|
||||
|
||||
-#if !defined(__GLIBC__)
|
||||
-/*
|
||||
- * The following bit uses some kernel/library magic to product what
|
||||
- * looks like a function call to user level code. This function is
|
||||
- * actually a system call in disguise. The purpose of the getsyms
|
||||
- * call is to return a current copy of the in-kernel symbol table.
|
||||
- */
|
||||
-#define __LIBRARY__
|
||||
-#include <linux/unistd.h>
|
||||
-#define __NR_getsyms __NR_get_kernel_syms
|
||||
-_syscall1(int, getsyms, struct kernel_sym *, syms);
|
||||
-#undef __LIBRARY__
|
||||
-extern int getsyms(struct kernel_sym *);
|
||||
-#else /* __GLIBC__ */
|
||||
#define getsyms get_kernel_syms
|
||||
-#endif /* __GLIBC__ */
|
||||
+
|
||||
+struct module
|
||||
+{
|
||||
+ size_t size_of_struct; /* == sizeof(module) */
|
||||
+ struct module *next;
|
||||
+ const char *name;
|
||||
+ size_t size;
|
||||
+
|
||||
+ union
|
||||
+ {
|
||||
+ atomic_t usecount;
|
||||
+ long pad;
|
||||
+ } uc; /* Needs to keep its size - so says rth */
|
||||
+
|
||||
+ unsigned long flags; /* AUTOCLEAN et al */
|
||||
+
|
||||
+ unsigned nsyms;
|
||||
+ unsigned ndeps;
|
||||
+
|
||||
+ struct module_symbol *syms;
|
||||
+ struct module_ref *deps;
|
||||
+ struct module_ref *refs;
|
||||
+ int (*init)(void);
|
||||
+ void (*cleanup)(void);
|
||||
+ const struct exception_table_entry *ex_table_start;
|
||||
+ const struct exception_table_entry *ex_table_end;
|
||||
+#ifdef __alpha__
|
||||
+ unsigned long gp;
|
||||
+#endif
|
||||
+ /* Members past this point are extensions to the basic
|
||||
+ module support and are optional. Use mod_member_present()
|
||||
+ to examine them. */
|
||||
+ const struct module_persist *persist_start;
|
||||
+ const struct module_persist *persist_end;
|
||||
+ int (*can_unload)(void);
|
||||
+ int runsize; /* In modutils, not currently used */
|
||||
+ const char *kallsyms_start; /* All symbols for kernel debugging */
|
||||
+ const char *kallsyms_end;
|
||||
+ const char *archdata_start; /* arch specific data for module */
|
||||
+ const char *archdata_end;
|
||||
+ const char *kernel_data; /* Reserved for kernel internal use */
|
||||
+};
|
||||
+
|
||||
+struct module_info
|
||||
+{
|
||||
+ uintptr_t addr;
|
||||
+ size_t size;
|
||||
+ unsigned long flags;
|
||||
+ long usecount;
|
||||
+};
|
||||
+
|
||||
|
||||
/* Variables static to this module. */
|
||||
struct sym_table
|
||||
{
|
||||
- unsigned long value;
|
||||
+ uintptr_t value;
|
||||
char *name;
|
||||
};
|
||||
|
||||
@@ -136,9 +194,7 @@ struct Module
|
||||
|
||||
char *name;
|
||||
struct module module;
|
||||
-#if LINUX_VERSION_CODE >= 0x20112
|
||||
struct module_info module_info;
|
||||
-#endif
|
||||
};
|
||||
|
||||
static int num_modules = 0;
|
||||
@@ -155,8 +211,8 @@ extern int debugging;
|
||||
|
||||
/* Function prototypes. */
|
||||
static void FreeModules(void);
|
||||
-static int AddSymbol(struct Module *mp, unsigned long, char *);
|
||||
-static int AddModule(unsigned long, char *);
|
||||
+static int AddSymbol(struct Module *mp, uintptr_t, char *);
|
||||
+static int AddModule(uintptr_t, char *);
|
||||
static int symsort(const void *, const void *);
|
||||
|
||||
|
||||
@@ -344,7 +400,7 @@ static void FreeModules()
|
||||
* Purpose: This function is responsible for adding a module to
|
||||
* the list of currently loaded modules.
|
||||
*
|
||||
- * Arguements: (unsigned long) address, (char *) symbol
|
||||
+ * Arguements: (uintptr_t) address, (char *) symbol
|
||||
*
|
||||
* address:-> The address of the module.
|
||||
*
|
||||
@@ -355,7 +411,7 @@ static void FreeModules()
|
||||
|
||||
static int AddModule(address, symbol)
|
||||
|
||||
- unsigned long address;
|
||||
+ uintptr_t address;
|
||||
|
||||
char *symbol;
|
||||
|
||||
@@ -403,10 +459,14 @@ static int AddModule(address, symbol)
|
||||
Syslog(LOG_WARNING, "Error opening /dev/kmem\n");
|
||||
return(0);
|
||||
}
|
||||
- if ( lseek64(memfd, address, SEEK_SET) < 0 )
|
||||
+ if ( seek64(memfd, address) < 0 )
|
||||
{
|
||||
Syslog(LOG_WARNING, "Error seeking in /dev/kmem\n");
|
||||
+#if __WORDSIZE == 64
|
||||
+ Syslog(LOG_WARNING, "Symbol %s, value %16lx\n", symbol, address);
|
||||
+#else
|
||||
Syslog(LOG_WARNING, "Symbol %s, value %08x\n", symbol, address);
|
||||
+#endif
|
||||
return(0);
|
||||
}
|
||||
if ( read(memfd, \
|
||||
@@ -450,7 +510,7 @@ static int AddModule(address, symbol)
|
||||
* Purpose: This function is responsible for adding a symbol name
|
||||
* and its address to the symbol table.
|
||||
*
|
||||
- * Arguements: (struct Module *) mp, (unsigned long) address, (char *) symbol
|
||||
+ * Arguements: (struct Module *) mp, (uintptr_t) address, (char *) symbol
|
||||
*
|
||||
* mp:-> A pointer to the module which the symbol is
|
||||
* to be added to.
|
||||
@@ -469,7 +529,7 @@ static int AddSymbol(mp, address, symbol
|
||||
|
||||
struct Module *mp;
|
||||
|
||||
- unsigned long address;
|
||||
+ uintptr_t address;
|
||||
|
||||
char *symbol;
|
||||
|
||||
@@ -508,7 +568,7 @@ static int AddSymbol(mp, address, symbol
|
||||
@@ -465,7 +464,7 @@ static int AddSymbol(line)
|
||||
* Purpose: Find the symbol which is related to the given address from
|
||||
* a kernel module.
|
||||
*
|
||||
- * Arguements: (long int) value, (struct symbol *) sym
|
||||
+ * Arguements: (uintptr_t) value, (struct symbol *) sym
|
||||
- * Arguments: (long int) value, (struct symbol *) sym
|
||||
+ * Arguments: (uintptr_t) value, (struct symbol *) sym
|
||||
*
|
||||
* value:-> The address to be located.
|
||||
*
|
||||
@@ -524,7 +584,7 @@ static int AddSymbol(mp, address, symbol
|
||||
@@ -481,7 +480,7 @@ static int AddSymbol(line)
|
||||
|
||||
extern char * LookupModuleSymbol(value, sym)
|
||||
|
||||
@ -420,54 +234,8 @@
|
||||
|
||||
struct symbol *sym;
|
||||
|
||||
@@ -574,15 +634,9 @@ extern char * LookupModuleSymbol(value,
|
||||
* If it is in this range we can at least return the
|
||||
* name of the module.
|
||||
*/
|
||||
-#if LINUX_VERSION_CODE < 0x20112
|
||||
- if ( (void *) value >= mp->module.addr &&
|
||||
- (void *) value <= (mp->module.addr + \
|
||||
- mp->module.size * 4096) )
|
||||
-#else
|
||||
if ( value >= mp->module_info.addr &&
|
||||
value <= (mp->module_info.addr + \
|
||||
- mp->module.size * 4096) )
|
||||
-#endif
|
||||
+ mp->module.size * getpagesize()) )
|
||||
{
|
||||
/*
|
||||
* A special case needs to be checked for. The above
|
||||
@@ -601,13 +655,8 @@ extern char * LookupModuleSymbol(value,
|
||||
if ( mp->num_syms > 0 )
|
||||
{
|
||||
last = &mp->sym_array[mp->num_syms - 1];
|
||||
-#if LINUX_VERSION_CODE < 0x20112
|
||||
- sym->size = (int) mp->module.addr + \
|
||||
- (mp->module.size * 4096) - value;
|
||||
-#else
|
||||
sym->size = (int) mp->module_info.addr + \
|
||||
- (mp->module.size * 4096) - value;
|
||||
-#endif
|
||||
+ (mp->module.size * getpagesize()) - value;
|
||||
sym->offset = value - last->value;
|
||||
return(last->name);
|
||||
}
|
||||
@@ -617,12 +666,8 @@ extern char * LookupModuleSymbol(value,
|
||||
* Return the module name and the offset of the
|
||||
* faulting address in the module.
|
||||
*/
|
||||
- sym->size = mp->module.size * 4096;
|
||||
-#if LINUX_VERSION_CODE < 0x20112
|
||||
- sym->offset = (void *) value - mp->module.addr;
|
||||
-#else
|
||||
+ sym->size = mp->module.size * getpagesize();
|
||||
sym->offset = value - mp->module_info.addr;
|
||||
-#endif
|
||||
return(mp->name);
|
||||
}
|
||||
}
|
||||
--- ksyms.h
|
||||
+++ ksyms.h 2003-09-09 14:15:47.000000000 +0000
|
||||
+++ ksyms.h 2022-10-13 08:44:58.028153542 +0000
|
||||
@@ -20,16 +20,19 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
@ -1,23 +0,0 @@
|
||||
---
|
||||
ksym_mod.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- ksym_mod.c
|
||||
+++ ksym_mod.c 2007-08-09 00:00:00.000000000 +0200
|
||||
@@ -91,7 +91,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <stdarg.h>
|
||||
#include <paths.h>
|
||||
-#include <asm/atomic.h>
|
||||
#include <limits.h>
|
||||
/* #include <linux/version.h> */
|
||||
|
||||
@@ -129,6 +128,8 @@ err:
|
||||
|
||||
#define getsyms get_kernel_syms
|
||||
|
||||
+typedef struct { volatile int counter; } atomic_t;
|
||||
+
|
||||
struct module
|
||||
{
|
||||
size_t size_of_struct; /* == sizeof(module) */
|
@ -1,6 +1,10 @@
|
||||
---
|
||||
klogd.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++-----
|
||||
1 file changed, 47 insertions(+), 5 deletions(-)
|
||||
|
||||
--- klogd.c
|
||||
+++ klogd.c 2004-07-27 11:53:48.985727118 +0000
|
||||
@@ -299,8 +299,10 @@ static int use_syscall = 0,
|
||||
+++ klogd.c 2022-10-14 13:17:38.386601331 +0000
|
||||
@@ -309,8 +309,10 @@ static int use_syscall = 0,
|
||||
no_fork = 0; /* don't fork - don't run in daemon mode */
|
||||
|
||||
static char *symfile = (char *) 0,
|
||||
@ -12,18 +16,18 @@
|
||||
static FILE *output_file = (FILE *) 0;
|
||||
|
||||
static enum LOGSRC {none, proc, kernel} logsrc;
|
||||
@@ -937,8 +939,8 @@ static void LogKernelLine(void)
|
||||
@@ -932,8 +934,8 @@ static void LogKernelLine(void)
|
||||
* which will contain old messages. Then read the kernel log
|
||||
* messages into this fresh buffer.
|
||||
*/
|
||||
- memset(log_buffer, '\0', sizeof(log_buffer));
|
||||
- if ( (rdcnt = ksyslog(2, log_buffer, sizeof(log_buffer))) < 0 )
|
||||
- if ( (rdcnt = ksyslog(2, log_buffer, sizeof(log_buffer)-1)) < 0 )
|
||||
+ memset(log_buffer, '\0', log_buf_size);
|
||||
+ if ( (rdcnt = ksyslog(2, log_buffer, log_buf_size-1)) < 0 )
|
||||
{
|
||||
if ( errno == EINTR )
|
||||
return;
|
||||
@@ -962,8 +964,8 @@ static void LogProcLine(void)
|
||||
@@ -957,8 +959,8 @@ static void LogProcLine(void)
|
||||
* which will contain old messages. Then read the kernel messages
|
||||
* from the message pseudo-file into this fresh buffer.
|
||||
*/
|
||||
@ -34,7 +38,7 @@
|
||||
{
|
||||
if ( errno == EINTR )
|
||||
return;
|
||||
@@ -976,6 +978,44 @@ static void LogProcLine(void)
|
||||
@@ -971,6 +973,44 @@ static void LogProcLine(void)
|
||||
return;
|
||||
}
|
||||
|
||||
@ -79,7 +83,7 @@
|
||||
|
||||
int main(argc, argv)
|
||||
|
||||
@@ -1053,6 +1093,8 @@ int main(argc, argv)
|
||||
@@ -1049,6 +1089,8 @@ int main(argc, argv)
|
||||
console_log_level = *log_level - '0';
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
---
|
||||
Makefile | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- Makefile
|
||||
+++ Makefile 2003-05-20 13:15:53.000000000 +0000
|
||||
@@ -29,7 +29,7 @@ MANDIR = /usr/man
|
||||
+++ Makefile 2022-10-13 10:55:16.540631345 +0000
|
||||
@@ -51,7 +51,7 @@ MANDIR = $(prefix)/usr/share/man
|
||||
|
||||
# The following define determines whether the package adheres to the
|
||||
# file system standard.
|
||||
@ -9,22 +13,3 @@
|
||||
|
||||
# The following define establishes ownership for the man pages.
|
||||
# Avery tells me that there is a difference between Debian and
|
||||
--- syslogd.c
|
||||
+++ syslogd.c 2003-05-20 13:12:35.000000000 +0000
|
||||
@@ -1030,6 +1030,7 @@ int main(argc, argv)
|
||||
(void) signal(SIGCHLD, reapchild);
|
||||
(void) signal(SIGALRM, domark);
|
||||
(void) signal(SIGUSR1, Debug ? debug_switch : SIG_IGN);
|
||||
+ (void) signal(SIGXFSZ, SIG_IGN);
|
||||
(void) alarm(TIMERINTVL);
|
||||
|
||||
/* Create a partial message table for all file descriptors. */
|
||||
@@ -2023,7 +2024,7 @@ void fprintlog(f, from, flags, msg)
|
||||
errno = e;
|
||||
logerror(f->f_un.f_fname);
|
||||
}
|
||||
- } else if (f->f_flags & SYNC_FILE)
|
||||
+ } else if (f->f_type == F_FILE && (f->f_flags & SYNC_FILE))
|
||||
(void) fsync(f->f_file);
|
||||
break;
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
--- syslogd.c
|
||||
+++ syslogd.c 2003-09-29 08:50:05.000000000 +0000
|
||||
@@ -1305,6 +1305,7 @@ static int create_inet_socket()
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
+#ifdef SO_BSDCOMPAT
|
||||
/* We need to enable BSD compatibility. Otherwise an attacker
|
||||
* could flood our log files by sending us tons of ICMP errors.
|
||||
*/
|
||||
@@ -1314,6 +1315,7 @@ static int create_inet_socket()
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
+#endif
|
||||
#ifdef INET6
|
||||
error = bind(fd, res->ai_addr, res->ai_addrlen);
|
||||
freeaddrinfo(res);
|
@ -20,7 +20,7 @@
|
||||
+#endif
|
||||
--- klogd.c
|
||||
+++ klogd.c 2008-05-30 10:19:59.501151202 +0000
|
||||
@@ -286,6 +286,8 @@ static char *PidFile = "/etc/klogd.pid";
|
||||
@@ -296,6 +296,8 @@ static char *PidFile = "/etc/klogd.pid";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
terminate = 0,
|
||||
--- syslog.c
|
||||
+++ syslog.c 2008-05-30 10:20:24.799728870 +0000
|
||||
@@ -72,6 +72,8 @@ static char sccsid[] = "@(#)syslog.c 5.2
|
||||
@@ -75,6 +75,8 @@ static char sccsid[] = "@(#)syslog.c 5.2
|
||||
|
||||
#define _PATH_LOGNAME "/dev/log"
|
||||
|
||||
|
@ -1,86 +0,0 @@
|
||||
--- syslogd.c
|
||||
+++ syslogd.c 2004-04-18 01:42:21.000000000 +0000
|
||||
@@ -1336,30 +1336,26 @@ char **
|
||||
crunch_list(list)
|
||||
char *list;
|
||||
{
|
||||
- int count, i;
|
||||
+ int i, m, n;
|
||||
char *p, *q;
|
||||
char **result = NULL;
|
||||
|
||||
p = list;
|
||||
|
||||
/* strip off trailing delimiters */
|
||||
- while (p[strlen(p)-1] == LIST_DELIMITER) {
|
||||
- count--;
|
||||
+ while (*p && p[strlen(p)-1] == LIST_DELIMITER)
|
||||
p[strlen(p)-1] = '\0';
|
||||
- }
|
||||
/* cut off leading delimiters */
|
||||
- while (p[0] == LIST_DELIMITER) {
|
||||
- count--;
|
||||
+ while (p[0] == LIST_DELIMITER)
|
||||
p++;
|
||||
- }
|
||||
|
||||
- /* count delimiters to calculate elements */
|
||||
- for (count=i=0; p[i]; i++)
|
||||
- if (p[i] == LIST_DELIMITER) count++;
|
||||
+ /* count delimiters to calculate the number of elements */
|
||||
+ for (n = i = 0; p[i]; i++)
|
||||
+ if (p[i] == LIST_DELIMITER) n++;
|
||||
|
||||
- if ((result = (char **)malloc(sizeof(char *) * count+2)) == NULL) {
|
||||
+ if ((result = (char **)malloc(sizeof(char *) * (n + 2))) == NULL) {
|
||||
printf ("Sorry, can't get enough memory, exiting.\n");
|
||||
- exit(0);
|
||||
+ exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1367,30 +1363,28 @@ crunch_list(list)
|
||||
* characters are different from any delimiters,
|
||||
* so we don't have to care about this.
|
||||
*/
|
||||
- count = 0;
|
||||
- while ((q=strchr(p, LIST_DELIMITER))) {
|
||||
- result[count] = (char *) malloc((q - p + 1) * sizeof(char));
|
||||
- if (result[count] == NULL) {
|
||||
+ m = 0;
|
||||
+ while ((q = strchr(p, LIST_DELIMITER)) && m < n) {
|
||||
+ result[m] = (char *) malloc((q - p + 1) * sizeof(char));
|
||||
+ if (result[m] == NULL) {
|
||||
printf ("Sorry, can't get enough memory, exiting.\n");
|
||||
- exit(0);
|
||||
+ exit(1);
|
||||
}
|
||||
- strncpy(result[count], p, q - p);
|
||||
- result[count][q - p] = '\0';
|
||||
+ memcpy(result[m], p, q - p);
|
||||
+ result[m][q - p] = '\0';
|
||||
p = q; p++;
|
||||
- count++;
|
||||
+ m++;
|
||||
}
|
||||
- if ((result[count] = \
|
||||
- (char *)malloc(sizeof(char) * strlen(p) + 1)) == NULL) {
|
||||
+ if ((result[m] = strdup(p)) == NULL) {
|
||||
printf ("Sorry, can't get enough memory, exiting.\n");
|
||||
- exit(0);
|
||||
+ exit(1);
|
||||
}
|
||||
- strcpy(result[count],p);
|
||||
- result[++count] = NULL;
|
||||
+ result[++m] = NULL;
|
||||
|
||||
#if 0
|
||||
- count=0;
|
||||
- while (result[count])
|
||||
- dprintf ("#%d: %s\n", count, StripDomains[count++]);
|
||||
+ m = 0;
|
||||
+ while (result[m])
|
||||
+ dprintf ("#%d: %s\n", m, result[m++]);
|
||||
#endif
|
||||
return result;
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
--- klogd.c
|
||||
+++ klogd.c 2004-12-02 20:58:17.026614000 +0000
|
||||
@@ -740,7 +740,7 @@ static void LogLine(char *ptr, int len)
|
||||
switch( parse_state )
|
||||
{
|
||||
case PARSING_TEXT:
|
||||
- delta = copyin( line, space, ptr, len, "\n[%" );
|
||||
+ delta = copyin( line, space, ptr, len, "\n[" );
|
||||
line += delta;
|
||||
ptr += delta;
|
||||
space -= delta;
|
||||
@@ -796,30 +796,9 @@ static void LogLine(char *ptr, int len)
|
||||
parse_state = PARSING_SYMSTART; /* at < */
|
||||
break;
|
||||
}
|
||||
- if( *ptr == '%' ) /* dangerous printf marker */
|
||||
- {
|
||||
- delta = 0;
|
||||
- while (len && *ptr == '%')
|
||||
- {
|
||||
- *line++ = *ptr++; /* copy it in */
|
||||
- space -= 1;
|
||||
- len -= 1;
|
||||
- delta++;
|
||||
- }
|
||||
- if (delta % 2) /* odd amount of %'s */
|
||||
- {
|
||||
- if (space)
|
||||
- {
|
||||
- *line++ = '%'; /* so simply add one */
|
||||
- space -= 1;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- *line++ = '\0'; /* remove the last one / terminate the string */
|
||||
- }
|
||||
-
|
||||
- }
|
||||
- }
|
||||
+ /* Now that line_buff is no longer fed to *printf as format
|
||||
+ * string, '%'s are no longer "dangerous".
|
||||
+ */
|
||||
break;
|
||||
|
||||
case PARSING_SYMSTART:
|
@ -1,8 +1,21 @@
|
||||
Index: syslogd.c
|
||||
===================================================================
|
||||
--- syslogd.c.orig
|
||||
+++ syslogd.c
|
||||
@@ -565,7 +565,7 @@ char **parts;
|
||||
---
|
||||
syslogd.c | 68 ++++++++++++++++++++++++++++++++++++++------------------------
|
||||
1 file changed, 42 insertions(+), 26 deletions(-)
|
||||
|
||||
--- syslogd.c
|
||||
+++ syslogd.c 2022-10-19 09:49:43.134694341 +0000
|
||||
@@ -544,6 +544,10 @@ static char sccsid[] __attribute__ ((un
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <signal.h>
|
||||
+#ifndef _GNU_SOURCE
|
||||
+typedef void (*sighandler_t)(int);
|
||||
+#endif
|
||||
+static sighandler_t resignal(int signum, sighandler_t handler);
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
@@ -618,7 +622,7 @@ char **parts;
|
||||
int inetm = 0;
|
||||
static int debugging_on = 0;
|
||||
static int nlogs = -1;
|
||||
@ -11,15 +24,33 @@ Index: syslogd.c
|
||||
|
||||
#define MAXFUNIX 20
|
||||
|
||||
@@ -1096,6 +1096,7 @@ int main(argc, argv)
|
||||
@@ -1134,13 +1138,13 @@ int main(argc, argv)
|
||||
|
||||
leave = 0;
|
||||
|
||||
- (void) signal(SIGTERM, die);
|
||||
+ (void) resignal(SIGTERM, die); /* Make recvfrom() be able to receive EINTR */
|
||||
(void) signal(SIGINT, Debug ? die : SIG_IGN);
|
||||
(void) signal(SIGQUIT, Debug ? die : SIG_IGN);
|
||||
- (void) signal(SIGCHLD, reapchild);
|
||||
- (void) signal(SIGALRM, domark);
|
||||
- (void) signal(SIGUSR1, Debug ? debug_switch : SIG_IGN);
|
||||
+ (void) resignal(SIGCHLD, reapchild);
|
||||
+ (void) resignal(SIGUSR1, Debug ? debug_switch : SIG_IGN);
|
||||
(void) signal(SIGXFSZ, SIG_IGN);
|
||||
+ (void) resignal(SIGALRM, domark); /* Make recvfrom() be able to receive EINTR */
|
||||
(void) alarm(TIMERINTVL);
|
||||
|
||||
/* Create a partial message table for all file descriptors. */
|
||||
@@ -1161,6 +1165,7 @@ int main(argc, argv)
|
||||
|
||||
dprintf("Starting.\n");
|
||||
init();
|
||||
+ (void) signal(SIGHUP, sighup_handler);
|
||||
+ (void) resignal(SIGHUP, sighup_handler);
|
||||
#ifndef TESTING
|
||||
if ( Debug )
|
||||
{
|
||||
@@ -1167,9 +1168,14 @@ int main(argc, argv)
|
||||
@@ -1232,9 +1237,14 @@ int main(argc, argv)
|
||||
(fd_set *) NULL, (struct timeval *) NULL);
|
||||
if ( restart )
|
||||
{
|
||||
@ -27,64 +58,54 @@ Index: syslogd.c
|
||||
+ sigemptyset(&blockhup);
|
||||
+ sigaddset (&blockhup, SIGHUP);
|
||||
+ (void) sigprocmask(SIG_BLOCK, &blockhup, NULL);
|
||||
+ restart = 0;
|
||||
restart = 0;
|
||||
dprintf("\nReceived SIGHUP, reloading syslogd.\n");
|
||||
init();
|
||||
- restart = 0;
|
||||
+ (void) sigprocmask (SIG_UNBLOCK, &blockhup, NULL);
|
||||
continue;
|
||||
}
|
||||
if (nfds == 0) {
|
||||
@@ -1676,18 +1682,16 @@ void logmsg(pri, msg, from, flags)
|
||||
register struct filed *f;
|
||||
int fac, prilev;
|
||||
@@ -1756,7 +1766,8 @@ void logmsg(pri, msg, from, flags)
|
||||
int msglen;
|
||||
-#ifndef SYSV
|
||||
- int omask;
|
||||
-#else
|
||||
int lognum;
|
||||
-#endif
|
||||
+ sigset_t nset, oset;
|
||||
char *timestamp;
|
||||
|
||||
dprintf("logmsg: %s, flags %x, from %s, msg %s\n", textpri(pri), flags, from, msg);
|
||||
|
||||
-#ifndef SYSV
|
||||
- omask = sigblock(sigmask(SIGHUP)|sigmask(SIGALRM));
|
||||
-#endif
|
||||
+ sigemptyset(&nset);
|
||||
+ sigaddset (&nset, SIGHUP);
|
||||
+ sigaddset (&nset, SIGALRM);
|
||||
+ (void)sigprocmask(SIG_BLOCK, &nset, &oset);
|
||||
|
||||
/*
|
||||
* Check to see if msg looks non-standard.
|
||||
@@ -1724,9 +1728,7 @@ void logmsg(pri, msg, from, flags)
|
||||
(void) close(f->f_file);
|
||||
#ifdef __gnu_linux__
|
||||
- sigset_t mask;
|
||||
+ sigset_t mask, omask;
|
||||
+ int lognum;
|
||||
#else
|
||||
#ifndef SYSV
|
||||
sigset_t omask;
|
||||
@@ -1771,7 +1782,7 @@ void logmsg(pri, msg, from, flags)
|
||||
sigemptyset(&mask);
|
||||
sigaddset(&mask, SIGHUP);
|
||||
sigaddset(&mask, SIGALRM);
|
||||
- sigprocmask(SIG_BLOCK, &mask, NULL);
|
||||
+ sigprocmask(SIG_BLOCK, &mask, &omask);
|
||||
#else
|
||||
#ifndef SYSV
|
||||
omask = sigblock(sigmask(SIGHUP)|sigmask(SIGALRM));
|
||||
@@ -1815,7 +1826,7 @@ void logmsg(pri, msg, from, flags)
|
||||
f->f_file = -1;
|
||||
}
|
||||
-#ifndef SYSV
|
||||
- (void) sigsetmask(omask);
|
||||
-#endif
|
||||
+ (void)sigprocmask(SIG_SETMASK, &oset, NULL);
|
||||
return;
|
||||
}
|
||||
#ifdef SYSV
|
||||
@@ -1789,9 +1791,7 @@ void logmsg(pri, msg, from, flags)
|
||||
}
|
||||
#ifdef __gnu_linux__
|
||||
- sigprocmask(SIG_UNBLOCK, &mask, NULL);
|
||||
+ sigprocmask(SIG_SETMASK, &omask, NULL);
|
||||
#else
|
||||
#ifndef SYSV
|
||||
(void) sigsetmask(omask);
|
||||
@@ -1884,7 +1895,7 @@ void logmsg(pri, msg, from, flags)
|
||||
}
|
||||
}
|
||||
-#ifndef SYSV
|
||||
- (void) sigsetmask(omask);
|
||||
-#endif
|
||||
+ (void)sigprocmask(SIG_SETMASK, &oset, NULL);
|
||||
}
|
||||
#if FALSE
|
||||
} /* balance parentheses for emacs */
|
||||
@@ -2108,10 +2108,6 @@ void wallmsg(f, iov)
|
||||
#ifdef __gnu_linux__
|
||||
- sigprocmask(SIG_UNBLOCK, &mask, NULL);
|
||||
+ sigprocmask(SIG_SETMASK, &omask, NULL);
|
||||
#else
|
||||
#ifndef SYSV
|
||||
(void) sigsetmask(omask);
|
||||
@@ -2213,10 +2224,6 @@ void wallmsg(f, iov)
|
||||
if (fork() == 0) {
|
||||
(void) signal(SIGTERM, SIG_DFL);
|
||||
(void) alarm(0);
|
||||
(void) signal(SIGALRM, endtty);
|
||||
-#ifndef SYSV
|
||||
- (void) signal(SIGTTOU, SIG_IGN);
|
||||
- (void) sigsetmask(0);
|
||||
@ -92,7 +113,31 @@ Index: syslogd.c
|
||||
(void) snprintf(greetings, sizeof(greetings),
|
||||
"\r\n\7Message from syslogd@%s at %.24s ...\r\n",
|
||||
(char *) iov[2].iov_base, ctime(&now));
|
||||
@@ -2178,16 +2174,8 @@ void wallmsg(f, iov)
|
||||
@@ -2281,19 +2288,32 @@ void wallmsg(f, iov)
|
||||
reenter = 0;
|
||||
}
|
||||
|
||||
+static sighandler_t resignal(int signum, sighandler_t handler)
|
||||
+{
|
||||
+ struct sigaction nact, oact;
|
||||
+ sigset_t sigset;
|
||||
+
|
||||
+ nact.sa_handler = handler;
|
||||
+ sigemptyset (&nact.sa_mask);
|
||||
+
|
||||
+ do {
|
||||
+ if (sigaction(signum, &nact, &oact) == 0)
|
||||
+ break;
|
||||
+ } while (errno == EINTR);
|
||||
+
|
||||
+ sigemptyset(&sigset);
|
||||
+ sigaddset(&sigset, signum);
|
||||
+
|
||||
+ sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
+
|
||||
+ return oact.sa_handler;
|
||||
+}
|
||||
+
|
||||
void reapchild()
|
||||
{
|
||||
int saved_errno = errno;
|
||||
@ -109,7 +154,24 @@ Index: syslogd.c
|
||||
errno = saved_errno;
|
||||
}
|
||||
|
||||
@@ -2318,7 +2306,6 @@ void debug_switch()
|
||||
@@ -2403,6 +2423,7 @@ void domark()
|
||||
#ifdef SYSV
|
||||
for (lognum = 0; lognum <= nlogs; lognum++) {
|
||||
f = &Files[lognum];
|
||||
+ }
|
||||
#else
|
||||
for (f = Files; f; f = f->f_next) {
|
||||
#endif
|
||||
@@ -2414,8 +2435,6 @@ void domark()
|
||||
BACKOFF(f);
|
||||
}
|
||||
}
|
||||
- }
|
||||
- (void) signal(SIGALRM, domark);
|
||||
(void) alarm(TIMERINTVL);
|
||||
}
|
||||
|
||||
@@ -2424,7 +2443,6 @@ void debug_switch()
|
||||
{
|
||||
dprintf("Switching debugging_on to %s\n", (debugging_on == 0) ? "true" : "false");
|
||||
debugging_on = (debugging_on == 0) ? 1 : 0;
|
||||
@ -117,7 +179,7 @@ Index: syslogd.c
|
||||
}
|
||||
|
||||
|
||||
@@ -2664,7 +2651,6 @@ void init()
|
||||
@@ -2774,7 +2792,6 @@ void init()
|
||||
logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "." PATCHLEVEL \
|
||||
": restart." , LocalHostName, ADDDATE);
|
||||
#endif
|
||||
@ -125,8 +187,8 @@ Index: syslogd.c
|
||||
dprintf("syslogd: restarted.\n");
|
||||
}
|
||||
#if FALSE
|
||||
@@ -3061,7 +3047,6 @@ void sighup_handler()
|
||||
|
||||
@@ -3175,7 +3192,6 @@ static void allocate_log(void)
|
||||
void sighup_handler(int sig)
|
||||
{
|
||||
restart = 1;
|
||||
- signal(SIGHUP, sighup_handler);
|
||||
|
@ -9,32 +9,19 @@
|
||||
#
|
||||
# Author: mt@suse.de
|
||||
#
|
||||
---
|
||||
syslog.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- syslog.c
|
||||
+++ syslog.c 2003-08-26 11:34:34.000000000 +0000
|
||||
@@ -97,7 +97,7 @@ vsyslog(pri, fmt, ap)
|
||||
register int cnt;
|
||||
register char *p;
|
||||
time_t now;
|
||||
- int fd, saved_errno;
|
||||
+ int fd, saved_errno, rc;
|
||||
char tbuf[2048], fmt_cpy[1024], *stdp = (char *) 0;
|
||||
|
||||
saved_errno = errno;
|
||||
@@ -167,7 +167,16 @@ vsyslog(pri, fmt, ap)
|
||||
+++ syslog.c 2022-10-14 13:04:57.692223266 +0000
|
||||
@@ -177,7 +177,8 @@ vsyslog(pri, fmt, ap)
|
||||
&& (errno == ECONNRESET || errno == ENOTCONN || errno == ECONNREFUSED)) {
|
||||
closelog();
|
||||
openlog(LogTag, LogStat | LOG_NDELAY, LogFacility);
|
||||
- result = write(LogFile, tbuf, cnt + 1);
|
||||
+ if (connected)
|
||||
+ result = write(LogFile, tbuf, cnt + 1);
|
||||
}
|
||||
|
||||
/* output the message to the local logger */
|
||||
- if (write(LogFile, tbuf, cnt + 1) >= 0 || !(LogStat&LOG_CONS))
|
||||
+ rc = write(LogFile, tbuf, cnt + 1);
|
||||
+ if(rc == -1 && connected && (ECONNREFUSED == errno ||
|
||||
+ ENOTCONN == errno)) {
|
||||
+ /* try to reopen and write again */
|
||||
+ closelog();
|
||||
+ openlog(LogTag, LogStat | LOG_NDELAY, LogFacility);
|
||||
+ if(connected)
|
||||
+ rc = write(LogFile, tbuf, cnt + 1);
|
||||
+ }
|
||||
+ if(rc >= 0 || !(LogStat&LOG_CONS))
|
||||
return;
|
||||
|
||||
/*
|
||||
if (result >= 0 || !(LogStat&LOG_CONS))
|
||||
|
@ -1,13 +1,18 @@
|
||||
---
|
||||
sysklogd.8 | 23 +++++++++++++++++++++++
|
||||
syslogd.c | 54 ++++++++++++++++++++++++++++++++++++++----------------
|
||||
2 files changed, 61 insertions(+), 16 deletions(-)
|
||||
|
||||
--- sysklogd.8
|
||||
+++ sysklogd.8 2005-05-23 14:48:34.564338699 +0000
|
||||
+++ sysklogd.8 2022-10-14 13:33:28.961599858 +0000
|
||||
@@ -31,6 +31,7 @@ sysklogd \- Linux system logging utiliti
|
||||
]
|
||||
.RB [ " \-t " ]
|
||||
.RB [ " \-v " ]
|
||||
+.RB [ " \-S " ]
|
||||
.LP
|
||||
.SH DESCRIPTION
|
||||
.B Sysklogd
|
||||
provides two system utilities which provide support for
|
||||
@@ -158,6 +159,28 @@ loghost.
|
||||
.TP
|
||||
.B "\-v"
|
||||
@ -34,12 +39,12 @@
|
||||
+
|
||||
+The above message contains a priority/facility code of '5Q', which breaks
|
||||
+down to a priority of 5 (LOG_NOTICE) and a facility of 16 (LOG_LOCAL0).
|
||||
.LP
|
||||
.SH SIGNALS
|
||||
.B Syslogd
|
||||
reacts to a set of signals. You may easily send a signal to
|
||||
--- syslogd.c
|
||||
+++ syslogd.c 2009-11-24 18:12:55.320216000 +0100
|
||||
@@ -594,6 +594,9 @@ int funix[MAXFUNIX] = { -1, };
|
||||
+++ syslogd.c 2022-10-14 13:27:33.395957312 +0000
|
||||
@@ -649,6 +649,9 @@ int funix[MAXFUNIX] = { -1, };
|
||||
#define SYNC_FILE 0x002 /* do fsync on file after printing */
|
||||
#define ADDDATE 0x004 /* add a date to the message */
|
||||
#define MARK 0x008 /* this message is a mark */
|
||||
@ -49,7 +54,7 @@
|
||||
|
||||
/*
|
||||
* This table contains plain text for h_errno errors used by the
|
||||
@@ -772,7 +775,7 @@ void printchopped(const char *hname, cha
|
||||
@@ -828,7 +831,7 @@ void printchopped(const char *hname, cha
|
||||
void printline(const char *hname, char *msg);
|
||||
void printsys(char *msg);
|
||||
void logmsg(int pri, char *msg, const char *from, int flags);
|
||||
@ -58,7 +63,7 @@
|
||||
void endtty();
|
||||
void wallmsg(register struct filed *f, struct iovec *iov);
|
||||
void reapchild();
|
||||
@@ -861,7 +864,7 @@ int main(argc, argv)
|
||||
@@ -920,7 +923,7 @@ int main(argc, argv)
|
||||
funix[i] = -1;
|
||||
}
|
||||
|
||||
@ -67,7 +72,7 @@
|
||||
switch((char)ch) {
|
||||
case 'a':
|
||||
if (nfunix < MAXFUNIX)
|
||||
@@ -913,6 +916,9 @@ int main(argc, argv)
|
||||
@@ -972,6 +975,9 @@ int main(argc, argv)
|
||||
case 'v':
|
||||
printf("syslogd %s.%s\n", VERSION, PATCHLEVEL);
|
||||
exit (0);
|
||||
@ -77,19 +82,7 @@
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
@@ -1151,9 +1157,9 @@ int main(argc, argv)
|
||||
dprintf("UNIX socket error: %d = %s.\n", \
|
||||
errno, strerror(errno));
|
||||
logerror("recvfrom UNIX");
|
||||
- }
|
||||
- }
|
||||
}
|
||||
+ }
|
||||
+ }
|
||||
#endif
|
||||
|
||||
#ifdef SYSLOG_INET
|
||||
@@ -1221,7 +1227,7 @@ int main(argc, argv)
|
||||
@@ -1287,7 +1293,7 @@ int main(argc, argv)
|
||||
|
||||
int usage()
|
||||
{
|
||||
@ -98,7 +91,7 @@
|
||||
" [-s domainlist] [-f conffile]\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -1660,7 +1666,7 @@ void logmsg(pri, msg, from, flags)
|
||||
@@ -1755,7 +1761,7 @@ void logmsg(pri, msg, from, flags)
|
||||
|
||||
if (f->f_file >= 0) {
|
||||
untty();
|
||||
@ -107,7 +100,7 @@
|
||||
(void) close(f->f_file);
|
||||
f->f_file = -1;
|
||||
}
|
||||
@@ -1706,13 +1712,13 @@ void logmsg(pri, msg, from, flags)
|
||||
@@ -1805,13 +1811,13 @@ void logmsg(pri, msg, from, flags)
|
||||
* in the future.
|
||||
*/
|
||||
if (now > REPEATTIME(f)) {
|
||||
@ -123,7 +116,7 @@
|
||||
f->f_prevpri = pri;
|
||||
f->f_repeatcount = 0;
|
||||
(void) strncpy(f->f_lasttime, timestamp, 15);
|
||||
@@ -1721,11 +1727,11 @@ void logmsg(pri, msg, from, flags)
|
||||
@@ -1820,11 +1826,11 @@ void logmsg(pri, msg, from, flags)
|
||||
if (msglen < MAXSVLINE) {
|
||||
f->f_prevlen = msglen;
|
||||
(void) strcpy(f->f_prevline, msg);
|
||||
@ -137,7 +130,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1737,11 +1743,7 @@ void logmsg(pri, msg, from, flags)
|
||||
@@ -1840,11 +1846,7 @@ void logmsg(pri, msg, from, flags)
|
||||
} /* balance parentheses for emacs */
|
||||
#endif
|
||||
|
||||
@ -150,7 +143,7 @@
|
||||
{
|
||||
struct iovec iov[6];
|
||||
register struct iovec *v = iov;
|
||||
@@ -1762,9 +1764,29 @@ void fprintlog(f, from, flags, msg)
|
||||
@@ -1865,9 +1867,29 @@ void fprintlog(f, from, flags, msg)
|
||||
v->iov_base = f->f_lasttime;
|
||||
v->iov_len = 15;
|
||||
v++;
|
||||
|
@ -1,6 +1,10 @@
|
||||
---
|
||||
syslogd.c | 107 +++++++++++++++++++++++++++++++++++++++++++++-----------------
|
||||
1 file changed, 78 insertions(+), 29 deletions(-)
|
||||
|
||||
--- syslogd.c
|
||||
+++ syslogd.c 2008-03-26 16:45:54.247851855 +0000
|
||||
@@ -770,6 +770,9 @@ extern int errno;
|
||||
+++ syslogd.c 2022-10-18 06:25:00.236304111 +0000
|
||||
@@ -826,6 +826,9 @@ extern int errno;
|
||||
int main(int argc, char **argv);
|
||||
char **crunch_list(char *list);
|
||||
int usage(void);
|
||||
@ -10,7 +14,7 @@
|
||||
void untty(void);
|
||||
void printchopped(const char *hname, char *msg, int len, int fd);
|
||||
void printline(const char *hname, char *msg);
|
||||
@@ -783,7 +786,9 @@ const char *cvthname(struct sockaddr *f)
|
||||
@@ -839,7 +842,9 @@ const char *cvthname(struct sockaddr *f)
|
||||
void domark();
|
||||
void debug_switch();
|
||||
void logerror(const char *type);
|
||||
@ -20,23 +24,22 @@
|
||||
#ifndef TESTING
|
||||
void doexit(int sig);
|
||||
#endif
|
||||
@@ -932,12 +937,32 @@ int main(argc, argv)
|
||||
@@ -991,12 +996,32 @@ int main(argc, argv)
|
||||
dprintf("Checking pidfile.\n");
|
||||
if (!check_pid(PidFile))
|
||||
{
|
||||
- if (fork()) {
|
||||
+ pid_t pid;
|
||||
+ int n = 0, status;
|
||||
+
|
||||
+ signal (SIGTERM, doexit);
|
||||
+
|
||||
+
|
||||
signal (SIGTERM, doexit);
|
||||
- if (fork()) {
|
||||
+
|
||||
+ switch ((pid = fork())) {
|
||||
+ default:
|
||||
+ retry:
|
||||
/*
|
||||
* Parent process
|
||||
*/
|
||||
- signal (SIGTERM, doexit);
|
||||
- sleep(300);
|
||||
+ switch (waitpid(pid, &status, WNOHANG|WUNTRACED)) {
|
||||
+ case -1:
|
||||
@ -56,18 +59,19 @@
|
||||
/*
|
||||
* Not reached unless something major went wrong. 5
|
||||
* minutes should be a fair amount of time to wait.
|
||||
@@ -947,11 +972,14 @@ int main(argc, argv)
|
||||
@@ -1006,12 +1031,14 @@ int main(argc, argv)
|
||||
* logs. -Joey
|
||||
*/
|
||||
exit(1);
|
||||
+ case 0:
|
||||
+ signal (SIGTERM, SIG_DFL);
|
||||
+
|
||||
+ signal (SIGTERM, SIG_DFL);
|
||||
+
|
||||
+ num_fds = getdtablesize();
|
||||
+ for (i = 0; i < num_fds; i++)
|
||||
+ (void) close(i);
|
||||
+ untty();
|
||||
}
|
||||
- signal (SIGTERM, SIG_DFL);
|
||||
- num_fds = getdtablesize();
|
||||
- for (i= 0; i < num_fds; i++)
|
||||
- (void) close(i);
|
||||
@ -75,7 +79,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1028,6 +1056,8 @@ int main(argc, argv)
|
||||
@@ -1091,6 +1118,8 @@ int main(argc, argv)
|
||||
if (isupper(*p))
|
||||
*p = tolower(*p);
|
||||
|
||||
@ -84,16 +88,16 @@
|
||||
(void) signal(SIGTERM, die);
|
||||
(void) signal(SIGINT, Debug ? die : SIG_IGN);
|
||||
(void) signal(SIGQUIT, Debug ? die : SIG_IGN);
|
||||
@@ -1044,7 +1074,7 @@ int main(argc, argv)
|
||||
(char **) 0 )
|
||||
{
|
||||
logerror("Cannot allocate memory for message parts table.");
|
||||
@@ -1111,7 +1140,7 @@ int main(argc, argv)
|
||||
if (getpid() != ppid)
|
||||
kill (ppid, SIGTERM);
|
||||
#endif
|
||||
- die(0);
|
||||
+ dienow();
|
||||
}
|
||||
for(i= 0; i < num_fds; ++i)
|
||||
parts[i] = (char *) 0;
|
||||
@@ -1067,9 +1097,14 @@ int main(argc, argv)
|
||||
@@ -1134,9 +1163,14 @@ int main(argc, argv)
|
||||
/* Main loop begins here. */
|
||||
for (;;) {
|
||||
int nfds;
|
||||
@ -108,7 +112,7 @@
|
||||
#ifdef SYSLOG_UNIXAF
|
||||
#ifndef TESTING
|
||||
/*
|
||||
@@ -1256,7 +1291,7 @@ static int create_unix_socket(const char
|
||||
@@ -1322,7 +1356,7 @@ static int create_unix_socket(const char
|
||||
dprintf("cannot create %s (%d).\n", path, errno);
|
||||
close(fd);
|
||||
#ifndef SYSV
|
||||
@ -117,7 +121,7 @@
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
@@ -1406,8 +1441,8 @@ crunch_list(list)
|
||||
@@ -1480,8 +1514,8 @@ crunch_list(list)
|
||||
void untty()
|
||||
#ifdef SYSV
|
||||
{
|
||||
@ -128,7 +132,7 @@
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1597,8 +1632,7 @@ void printsys(msg)
|
||||
@@ -1677,8 +1711,7 @@ void printsys(msg)
|
||||
/*
|
||||
* Decode a priority into textual information like auth.emerg.
|
||||
*/
|
||||
@ -138,7 +142,7 @@
|
||||
{
|
||||
static char res[20];
|
||||
CODE *c_pri, *c_fac;
|
||||
@@ -2128,9 +2162,7 @@ void reapchild()
|
||||
@@ -2239,9 +2272,7 @@ void reapchild()
|
||||
(void) signal(SIGCHLD, reapchild); /* reset signal handler -ASP */
|
||||
wait ((int *)0);
|
||||
#else
|
||||
@ -149,18 +153,18 @@
|
||||
;
|
||||
#endif
|
||||
#ifdef linux
|
||||
@@ -2289,13 +2321,21 @@ void logerror(type)
|
||||
@@ -2400,11 +2431,21 @@ void logerror(type)
|
||||
return;
|
||||
}
|
||||
|
||||
-void die(sig)
|
||||
+void die(int sig)
|
||||
+{
|
||||
+ char buf[100];
|
||||
+ leave++;
|
||||
|
||||
- int sig;
|
||||
-
|
||||
+void die(int sig)
|
||||
{
|
||||
- register struct filed *f;
|
||||
char buf[100];
|
||||
+ leave++;
|
||||
+
|
||||
+ dprintf("syslogd: exiting on signal %d\n", sig);
|
||||
+ (void) snprintf(buf, sizeof(buf), "exiting on signal %d", sig);
|
||||
+ errno = 0;
|
||||
@ -169,13 +173,12 @@
|
||||
+}
|
||||
+
|
||||
+void dienow(void)
|
||||
{
|
||||
register struct filed *f;
|
||||
- char buf[100];
|
||||
+{
|
||||
+ register struct filed *f;
|
||||
int lognum;
|
||||
int i;
|
||||
int was_initialized = Initialized;
|
||||
@@ -2311,24 +2351,31 @@ void die(sig)
|
||||
@@ -2420,24 +2461,31 @@ void die(sig)
|
||||
}
|
||||
|
||||
Initialized = was_initialized;
|
||||
@ -215,7 +218,7 @@
|
||||
#ifndef TESTING
|
||||
(void) remove_pid(PidFile);
|
||||
#endif
|
||||
@@ -2342,7 +2389,7 @@ void die(sig)
|
||||
@@ -2451,7 +2499,7 @@ void die(sig)
|
||||
void doexit(sig)
|
||||
int sig;
|
||||
{
|
||||
@ -224,7 +227,7 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2403,7 +2450,8 @@ void init()
|
||||
@@ -2516,7 +2564,8 @@ void init()
|
||||
case F_TTY:
|
||||
case F_CONSOLE:
|
||||
case F_USOCK:
|
||||
|
@ -1,14 +1,14 @@
|
||||
--- ksym.c
|
||||
+++ ksym.c 2001-05-23 18:50:36.000000000 +0000
|
||||
@@ -112,6 +112,7 @@
|
||||
@@ -130,6 +130,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <sys/utsname.h>
|
||||
+#include <ctype.h>
|
||||
#include "klogd.h"
|
||||
#include "ksyms.h"
|
||||
|
||||
@@ -770,6 +771,84 @@ extern char * ExpandKadds(line, el)
|
||||
#include "module.h"
|
||||
@@ -809,6 +810,84 @@ extern char * ExpandKadds(line, el)
|
||||
if ( (num_syms == 0) ||
|
||||
(kp = strstr(line, "[<")) == (char *) 0 )
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
|
||||
|
||||
--- klogd.c
|
||||
+++ klogd.c 2009-08-12 12:19:17.333901686 +0000
|
||||
@@ -275,6 +275,8 @@ _syscall3(int,ksyslog,int, type, char *,
|
||||
@@ -285,6 +285,8 @@ _syscall3(int,ksyslog,int, type, char *,
|
||||
#define ksyslog klogctl
|
||||
#endif
|
||||
|
||||
@ -28,7 +28,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
|
||||
#define LOG_BUFFER_SIZE 4096
|
||||
#define LOG_LINE_LENGTH 1000
|
||||
|
||||
@@ -999,6 +1001,23 @@ static void SetBufSize(void)
|
||||
@@ -1014,6 +1016,23 @@ static void SetBufSize(void)
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
|
||||
|
||||
int main(argc, argv)
|
||||
|
||||
@@ -1166,6 +1185,9 @@ int main(argc, argv)
|
||||
@@ -1199,6 +1218,9 @@ int main(argc, argv)
|
||||
else
|
||||
openlog("kernel", 0, LOG_KERN);
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
---
|
||||
syslogd.c | 121 +++++++++++++++++++++++++++++++++++---------------------------
|
||||
1 file changed, 70 insertions(+), 51 deletions(-)
|
||||
|
||||
--- syslogd.c
|
||||
+++ syslogd.c 2011/01/20 10:55:18
|
||||
@@ -574,6 +574,9 @@ static volatile sig_atomic_t restart;
|
||||
+++ syslogd.c 2022-10-17 09:33:43.942759127 +0000
|
||||
@@ -626,6 +626,9 @@ static volatile sig_atomic_t restart;
|
||||
int nfunix = 1;
|
||||
char *funixn[MAXFUNIX] = { _PATH_LOG };
|
||||
int funix[MAXFUNIX] = { -1, };
|
||||
@ -10,7 +14,7 @@
|
||||
|
||||
#ifdef UT_NAMESIZE
|
||||
# define UNAMESZ UT_NAMESIZE /* length of a login name */
|
||||
@@ -1000,12 +1003,44 @@ int main(argc, argv)
|
||||
@@ -1047,12 +1050,44 @@ int main(argc, argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -58,12 +62,10 @@
|
||||
untty();
|
||||
break;
|
||||
}
|
||||
@@ -1041,7 +1076,12 @@ int main(argc, argv)
|
||||
dprintf("Pidfile (and pid) already exist.\n");
|
||||
@@ -1094,6 +1129,11 @@ int main(argc, argv)
|
||||
exit(1);
|
||||
}
|
||||
- } /* if ( !Debug ) */
|
||||
+ } /* if ( !(Debug || NoFork)) */
|
||||
} /* if ( !Debug ) */
|
||||
+#if defined(__linux__)
|
||||
+ /* if (sd_booted()) */ {
|
||||
+ sd_fds = sd_listen_fds(0);
|
||||
@ -72,7 +74,7 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1323,54 +1363,30 @@ static int create_unix_socket(const char
|
||||
@@ -1367,54 +1407,30 @@ static int create_unix_socket(const char
|
||||
return -1;
|
||||
|
||||
#if defined(__linux__)
|
||||
@ -121,12 +123,7 @@
|
||||
-#else
|
||||
- return -1;
|
||||
-#endif
|
||||
+ if (sd_fds > 0) {
|
||||
+ for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + sd_fds; fd++) {
|
||||
+ if( sd_is_socket_unix(fd, SOCK_DGRAM, -1, path, 0) == 1) {
|
||||
+ /* ok, it matches -- just use as is */
|
||||
+ return fd;
|
||||
}
|
||||
- }
|
||||
-
|
||||
- if (!r) {
|
||||
- logerror("Passed systemd socket of wrong type");
|
||||
@ -135,7 +132,12 @@
|
||||
-#else
|
||||
- return -1;
|
||||
-#endif
|
||||
- }
|
||||
+ if (sd_fds > 0) {
|
||||
+ for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + sd_fds; fd++) {
|
||||
+ if( sd_is_socket_unix(fd, SOCK_DGRAM, -1, path, 0) == 1) {
|
||||
+ /* ok, it matches -- just use as is */
|
||||
+ return fd;
|
||||
}
|
||||
-
|
||||
- return fd;
|
||||
+ /*
|
||||
@ -146,7 +148,7 @@
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -2485,14 +2501,17 @@ void dienow(void)
|
||||
@@ -2537,14 +2553,17 @@ void dienow(void)
|
||||
if (InetInuse) close(inetm);
|
||||
|
||||
/* Clean-up files. */
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- syslogd.c
|
||||
+++ syslogd.c 2012/02/20 19:41:22
|
||||
@@ -558,6 +558,10 @@ static char sccsid[] __attribute__ ((un
|
||||
@@ -610,6 +610,10 @@ static char sccsid[] __attribute__ ((un
|
||||
#define _PATH_LOG "/dev/log"
|
||||
#endif
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
char *ConfFile = _PATH_LOGCONF;
|
||||
char *PidFile = _PATH_LOGPID;
|
||||
char ctty[] = _PATH_CONSOLE;
|
||||
@@ -889,6 +893,15 @@ int main(argc, argv)
|
||||
@@ -936,6 +940,15 @@ int main(argc, argv)
|
||||
funix[i] = -1;
|
||||
}
|
||||
|
||||
|
@ -4,17 +4,17 @@
|
||||
2 files changed, 67 insertions(+), 5 deletions(-)
|
||||
|
||||
--- Makefile
|
||||
+++ Makefile 2017-04-06 09:32:55.360422009 +0000
|
||||
@@ -3,7 +3,7 @@
|
||||
+++ Makefile 2022-10-17 09:00:32.945828594 +0000
|
||||
@@ -20,7 +20,7 @@
|
||||
CC= gcc
|
||||
#CFLAGS= -g -DSYSV -Wall
|
||||
#SKFLAGS= -g -DSYSV -Wall
|
||||
#LDFLAGS= -g
|
||||
-CFLAGS= $(RPM_OPT_FLAGS) -DINET6 -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce
|
||||
+CFLAGS= $(RPM_OPT_FLAGS) -DINET6 -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce -I.
|
||||
LDFLAGS= -s
|
||||
|
||||
# Look where your install program is.
|
||||
@@ -21,7 +21,7 @@ MANDIR = /usr/man
|
||||
-SKFLAGS= $(RPM_OPT_FLAGS) -DINET6 -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce
|
||||
+SKFLAGS= $(RPM_OPT_FLAGS) -DINET6 -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce -I.
|
||||
# -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
|
||||
# -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
|
||||
# $(shell getconf LFS_SKFLAGS)
|
||||
@@ -43,7 +43,7 @@ MANDIR = $(prefix)/usr/share/man
|
||||
# specific to the ALPHA. If you are attempting to build this package under
|
||||
# an ALPHA and linking fails with unresolved references please try
|
||||
# uncommenting the following define.
|
||||
@ -24,8 +24,8 @@
|
||||
# Define the following to impart start-up delay in klogd. This is
|
||||
# useful if klogd is started simultaneously or in close-proximity to syslogd.
|
||||
--- syslogd.c
|
||||
+++ syslogd.c 2017-04-06 09:29:43.524044965 +0000
|
||||
@@ -505,6 +505,7 @@ static char sccsid[] __attribute__ ((un
|
||||
+++ syslogd.c 2022-10-17 08:59:33.354879789 +0000
|
||||
@@ -558,6 +558,7 @@ static char sccsid[] __attribute__ ((un
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <paths.h>
|
||||
@ -33,7 +33,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef UTMP_FILE
|
||||
@@ -990,8 +991,11 @@ int main(argc, argv)
|
||||
@@ -1047,8 +1048,11 @@ int main(argc, argv)
|
||||
}
|
||||
|
||||
num_fds = getdtablesize();
|
||||
@ -47,7 +47,7 @@
|
||||
untty();
|
||||
break;
|
||||
}
|
||||
@@ -1298,6 +1302,59 @@ static int create_unix_socket(const char
|
||||
@@ -1362,6 +1366,59 @@ static int create_unix_socket(const char
|
||||
if (path[0] == '\0')
|
||||
return -1;
|
||||
|
||||
@ -107,7 +107,7 @@
|
||||
(void) unlink(path);
|
||||
|
||||
memset(&sunx, 0, sizeof(sunx));
|
||||
@@ -2368,7 +2425,12 @@ void dienow(void)
|
||||
@@ -2480,7 +2537,12 @@ void dienow(void)
|
||||
if (InetInuse) close(inetm);
|
||||
|
||||
/* Clean-up files. */
|
||||
|
@ -1,6 +1,11 @@
|
||||
---
|
||||
syslog.conf.5 | 10 +++++++
|
||||
syslogd.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----
|
||||
2 files changed, 82 insertions(+), 4 deletions(-)
|
||||
|
||||
--- syslog.conf.5
|
||||
+++ syslog.conf.5 2004-09-16 20:21:07.144284248 +0000
|
||||
@@ -159,6 +159,16 @@ command before
|
||||
+++ syslog.conf.5 2022-10-14 13:18:21.953821655 +0000
|
||||
@@ -173,6 +173,16 @@ command before
|
||||
.BR syslogd (8)
|
||||
is started.
|
||||
|
||||
@ -18,8 +23,8 @@
|
||||
If the file you specified is a tty, special tty-handling is done, same
|
||||
with
|
||||
--- syslogd.c
|
||||
+++ syslogd.c 2004-09-16 20:21:07.150143661 +0000
|
||||
@@ -633,6 +633,10 @@ struct filed {
|
||||
+++ syslogd.c 2022-10-14 13:25:41.625956092 +0000
|
||||
@@ -688,6 +688,10 @@ struct filed {
|
||||
struct sockaddr_in f_addr;
|
||||
#endif
|
||||
} f_forw; /* forwarding address */
|
||||
@ -30,7 +35,7 @@
|
||||
char f_fname[MAXFNAME];
|
||||
} f_un;
|
||||
char f_prevline[MAXSVLINE]; /* last message logged */
|
||||
@@ -644,6 +648,8 @@ struct filed {
|
||||
@@ -699,6 +703,8 @@ struct filed {
|
||||
int f_repeatcount; /* number of "repeated" msgs */
|
||||
int f_flags; /* store some additional flags */
|
||||
};
|
||||
@ -39,7 +44,7 @@
|
||||
|
||||
/*
|
||||
* Intervals at which we flush out "message repeated" messages,
|
||||
@@ -674,10 +680,11 @@ int repeatinterval[] = { 30, 60 }; /* #
|
||||
@@ -729,10 +735,11 @@ int repeatinterval[] = { 30, 60 }; /* #
|
||||
#define F_FORW_SUSP 7 /* suspended host forwarding */
|
||||
#define F_FORW_UNKN 8 /* unknown host forwarding */
|
||||
#define F_PIPE 9 /* named pipe */
|
||||
@ -52,7 +57,7 @@
|
||||
};
|
||||
|
||||
struct filed *Files = (struct filed *) 0;
|
||||
@@ -1941,6 +1948,32 @@ void fprintlog(f, from, flags, msg)
|
||||
@@ -2050,6 +2057,32 @@ void fprintlog(f, from, flags, msg)
|
||||
(void) fsync(f->f_file);
|
||||
break;
|
||||
|
||||
@ -85,7 +90,7 @@
|
||||
case F_USERS:
|
||||
case F_WALL:
|
||||
f->f_time = now;
|
||||
@@ -2347,6 +2380,7 @@ void init()
|
||||
@@ -2462,6 +2495,7 @@ void init()
|
||||
case F_PIPE:
|
||||
case F_TTY:
|
||||
case F_CONSOLE:
|
||||
@ -93,7 +98,7 @@
|
||||
(void) close(f->f_file);
|
||||
break;
|
||||
}
|
||||
@@ -2499,7 +2533,11 @@ void init()
|
||||
@@ -2614,7 +2648,11 @@ void init()
|
||||
case F_PIPE:
|
||||
case F_TTY:
|
||||
case F_CONSOLE:
|
||||
@ -106,7 +111,7 @@
|
||||
if (f->f_file == -1)
|
||||
printf(" (unused)");
|
||||
break;
|
||||
@@ -2717,8 +2755,37 @@ void cfline(line, f)
|
||||
@@ -2832,14 +2870,44 @@ void cfline(line, f)
|
||||
switch (*p)
|
||||
{
|
||||
case '@':
|
||||
@ -135,12 +140,20 @@
|
||||
+ (chmod(f->fus_su.sun_path, 0666) < 0)) {
|
||||
+ dprintf("Can't bind unix socket to name\n");
|
||||
+ logerror("Can't bind unix unix socket to name");
|
||||
+ break;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
#ifdef SYSLOG_INET
|
||||
+#ifndef INET6
|
||||
if (!LogPort) {
|
||||
f->f_type = F_UNUSED;
|
||||
logerror("Forward rule without networking enabled");
|
||||
break;
|
||||
}
|
||||
-
|
||||
- (void) strcpy(f->f_un.f_forw.f_hname, ++p);
|
||||
+#endif
|
||||
+ (void) strcpy(f->f_un.f_forw.f_hname, p);
|
||||
dprintf("forwarding host: %s\n", p); /*ASP*/
|
||||
#ifdef INET6
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- syslogd.c
|
||||
+++ syslogd.c 2004-09-26 02:41:27.136610056 +0000
|
||||
@@ -1538,7 +1538,7 @@ void printline(hname, msg)
|
||||
else if (c < 040) {
|
||||
*q++ = '^';
|
||||
*q++ = c ^ 0100;
|
||||
- } else if (c == 0177 || (c & 0177) < 040) {
|
||||
+ } else if (c == 0177 || c >= 0376) {
|
||||
*q++ = '\\';
|
||||
*q++ = '0' + ((c & 0300) >> 6);
|
||||
*q++ = '0' + ((c & 0070) >> 3);
|
@ -1,55 +1,44 @@
|
||||
Index: .pkgextract
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ .pkgextract
|
||||
@@ -0,0 +1,20 @@
|
||||
+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=.forw -s < ../sysklogd-1.4.1-forw.patch
|
||||
+patch -p0 -b --suffix=.fileleak -s < ../sysklogd-1.4.1-fileleak.patch
|
||||
+patch -p0 -b --suffix=.ipv6 -s < ../sysklogd-ipv6.diff
|
||||
+patch -p0 -b --suffix=.klogd24 -s < ../sysklogd-1.4.1-klogd24.dif
|
||||
+patch -p0 -b --suffix=.large -s < ../sysklogd-1.4.1-large.patch
|
||||
+patch -p1 -b --suffix=.dns -s < ../sysklogd-1.4.1-dns.patch
|
||||
+patch -p0 -b --suffix=.reopen -s < ../sysklogd-1.4.1-reopen.patch
|
||||
+patch -p0 -b --suffix=.sobsd -s < ../sysklogd-1.4.1-no_SO_BSDCOMPAT.diff
|
||||
+patch -p1 -b --suffix=.owlcr -s < ../sysklogd-1.4.1-owl-crunch_list.diff
|
||||
+patch -p1 -b --suffix=.klsize -s < ../sysklogd-1.4.1-ksyslogsize.diff
|
||||
+patch -p0 -b --suffix=.usock -s < ../sysklogd-1.4.1-unix_sockets.patch
|
||||
+patch -p0 -b --suffix=.shprio -s < ../sysklogd-1.4.1-showpri.patch
|
||||
+patch -p1 -b --suffix=.presperc -s < ../sysklogd-1.4.1-preserve_percents.patch
|
||||
+patch -p1 -b --suffix=.utf8 -s < ../sysklogd-1.4.1-utf8.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 -p0 -b --suffix=.signal -s < ../sysklogd-1.4.1-signal.dif
|
||||
+patch -p0 -b --suffix=.clear -s < ../sysklogd-1.4.1-clearing.patch
|
||||
Index: Makefile
|
||||
===================================================================
|
||||
--- Makefile.orig
|
||||
+++ Makefile
|
||||
@@ -1,14 +1,17 @@
|
||||
# Makefile for syslogd and klogd daemons.
|
||||
---
|
||||
Makefile | 24 ++++++++++++----------
|
||||
klogd.c | 57 ++++++++++++++++++++++++++++++++++++++++------------
|
||||
pidfile.c | 10 ++++-----
|
||||
resolve.c | 21 ++++++++++++++++---
|
||||
sample-s390.conf | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
sample.conf | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
syslog.c | 7 +++++-
|
||||
syslogd.c | 51 ++++++++++++++++++++++++++++------------------
|
||||
8 files changed, 238 insertions(+), 52 deletions(-)
|
||||
|
||||
--- Makefile
|
||||
+++ Makefile 2022-10-19 09:50:35.677760471 +0000
|
||||
@@ -17,20 +17,23 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
+# For newer Kernel we have 16k buffer size
|
||||
+LOG_BUFFER_SIZE = -DLOG_BUFFER_SIZE=16384
|
||||
+
|
||||
CC= gcc
|
||||
-#CFLAGS= -g -DSYSV -Wall
|
||||
+#CFLAGS= -g -DSYSV -Wall $(LOG_BUFFER_SIZE)
|
||||
#SKFLAGS= -g -DSYSV -Wall
|
||||
#LDFLAGS= -g
|
||||
-CFLAGS= $(RPM_OPT_FLAGS) -DINET6 -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce -I.
|
||||
-SKFLAGS= $(RPM_OPT_FLAGS) -DINET6 -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce -I.
|
||||
+SKFLAGS= $(RPM_OPT_FLAGS) -D_GNU_SOURCE -DINET6 -DSYSV -Wall $(LOG_BUFFER_SIZE) -fPIE -I.
|
||||
# -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
|
||||
# -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
|
||||
# $(shell getconf LFS_SKFLAGS)
|
||||
-LDFLAGS= -s
|
||||
+CFLAGS= $(RPM_OPT_FLAGS) -D_GNU_SOURCE -DINET6 -DSYSV -Wall -pipe $(LOG_BUFFER_SIZE) -fPIE -I.
|
||||
+LDFLAGS= -pie
|
||||
|
||||
# Look where your install program is.
|
||||
INSTALL = /usr/bin/install
|
||||
-BINDIR = /usr/sbin
|
||||
+BINDIR = /sbin
|
||||
MANDIR = /usr/man
|
||||
|
||||
# Destination paths, set prefix=/opt if required
|
||||
-BINDIR = $(prefix)/usr/sbin
|
||||
+BINDIR = $(prefix)/sbin
|
||||
MANDIR = $(prefix)/usr/share/man
|
||||
|
||||
# There is one report that under an all ELF system there may be a need to
|
||||
@@ -25,7 +28,7 @@ MANDIR = /usr/man
|
||||
@@ -47,7 +50,7 @@ LIBS += $(shell pkg-config libsystemd --
|
||||
|
||||
# Define the following to impart start-up delay in klogd. This is
|
||||
# useful if klogd is started simultaneously or in close-proximity to syslogd.
|
||||
@ -58,30 +47,31 @@ Index: Makefile
|
||||
|
||||
# The following define determines whether the package adheres to the
|
||||
# file system standard.
|
||||
@@ -115,11 +118,12 @@ clobber: clean
|
||||
@@ -127,14 +130,15 @@ clobber: clean
|
||||
rm -f syslogd klogd ksym syslog_tst oops_test TAGS tsyslogd tklogd
|
||||
|
||||
install_exec: syslogd klogd
|
||||
- ${INSTALL} -m 500 -s syslogd ${BINDIR}/syslogd
|
||||
- ${INSTALL} -m 500 -s klogd ${BINDIR}/klogd
|
||||
+ ${INSTALL} syslogd ${DESTDIR}${BINDIR}/syslogd
|
||||
+ ${INSTALL} klogd ${DESTDIR}${BINDIR}/klogd
|
||||
+ ${INSTALL} -m 500 -s syslogd ${DESTDIR}${BINDIR}/syslogd
|
||||
+ ${INSTALL} -m 500 -s klogd ${DESTDIR}${BINDIR}/klogd
|
||||
+ ${INSTALL} -m 644 sample.conf ${DESTDIR}/etc/syslog.conf
|
||||
|
||||
install_man:
|
||||
- ${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 sysklogd.8 ${MANDIR}/man8/sysklogd.8
|
||||
- ${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 syslogd.8 ${MANDIR}/man8/syslogd.8
|
||||
- ${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 syslog.conf.5 ${MANDIR}/man5/syslog.conf.5
|
||||
- ${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 klogd.8 ${MANDIR}/man8/klogd.8
|
||||
+ ${INSTALL} -m 644 sysklogd.8 ${DESTDIR}${MANDIR}/man8/sysklogd.8
|
||||
+ ${INSTALL} -m 644 syslogd.8 ${DESTDIR}${MANDIR}/man8/syslogd.8
|
||||
+ ${INSTALL} -m 644 syslog.conf.5 ${DESTDIR}${MANDIR}/man5/syslog.conf.5
|
||||
+ ${INSTALL} -m 644 klogd.8 ${DESTDIR}${MANDIR}/man8/klogd.8
|
||||
Index: klogd.c
|
||||
===================================================================
|
||||
--- klogd.c.orig
|
||||
+++ klogd.c
|
||||
@@ -277,15 +277,21 @@ _syscall3(int,ksyslog,int, type, char *,
|
||||
- ${INSTALL} -o ${MAN_USER} -g ${MAN_GROUP} -m ${MAN_PERMS} sysklogd.8 ${MANDIR}/man8/sysklogd.8
|
||||
- ${INSTALL} -o ${MAN_USER} -g ${MAN_GROUP} -m ${MAN_PERMS} syslogd.8 ${MANDIR}/man8/syslogd.8
|
||||
- ${INSTALL} -o ${MAN_USER} -g ${MAN_GROUP} -m ${MAN_PERMS} syslog.conf.5 ${MANDIR}/man5/syslog.conf.5
|
||||
- ${INSTALL} -o ${MAN_USER} -g ${MAN_GROUP} -m ${MAN_PERMS} klogd.8 ${MANDIR}/man8/klogd.8
|
||||
+ ${INSTALL} -m ${MAN_PERMS} sysklogd.8 ${DESTDIR}${MANDIR}/man8/sysklogd.8
|
||||
+ ${INSTALL} -m ${MAN_PERMS} syslogd.8 ${DESTDIR}${MANDIR}/man8/syslogd.8
|
||||
+ ${INSTALL} -m ${MAN_PERMS} syslog.conf.5 ${DESTDIR}${MANDIR}/man5/syslog.conf.5
|
||||
+ ${INSTALL} -m ${MAN_PERMS} klogd.8 ${DESTDIR}${MANDIR}/man8/klogd.8
|
||||
|
||||
obj-m += oops.o
|
||||
|
||||
--- klogd.c
|
||||
+++ klogd.c 2022-10-19 09:50:35.677760471 +0000
|
||||
@@ -289,15 +289,21 @@ _syscall3(int,ksyslog,int, type, char *,
|
||||
|
||||
#include <sys/utsname.h>
|
||||
|
||||
@ -107,7 +97,7 @@ Index: klogd.c
|
||||
#endif
|
||||
|
||||
#include "fortify.h"
|
||||
@@ -299,6 +305,8 @@ static int kmsg,
|
||||
@@ -311,6 +317,8 @@ static int kmsg,
|
||||
|
||||
static int use_syscall = 0,
|
||||
one_shot = 0,
|
||||
@ -116,7 +106,7 @@ Index: klogd.c
|
||||
symbol_lookup = 1,
|
||||
no_fork = 0; /* don't fork - don't run in daemon mode */
|
||||
|
||||
@@ -874,8 +882,7 @@ static void LogLine(char *ptr, int len)
|
||||
@@ -891,8 +899,7 @@ static void LogLine(char *ptr, int len)
|
||||
value = strtoul(sym_start+1, (char **) 0, 16);
|
||||
*(line-1) = '>'; /* put back delim */
|
||||
|
||||
@ -126,7 +116,7 @@ Index: klogd.c
|
||||
{
|
||||
parse_state = PARSING_TEXT;
|
||||
break;
|
||||
@@ -916,7 +923,7 @@ static void LogLine(char *ptr, int len)
|
||||
@@ -933,7 +940,7 @@ static void LogLine(char *ptr, int len)
|
||||
static void LogKernelLine(void)
|
||||
|
||||
{
|
||||
@ -135,7 +125,7 @@ Index: klogd.c
|
||||
|
||||
/*
|
||||
* Zero-fill the log buffer. This should cure a multitude of
|
||||
@@ -925,6 +932,11 @@ static void LogKernelLine(void)
|
||||
@@ -942,6 +949,11 @@ static void LogKernelLine(void)
|
||||
* messages into this fresh buffer.
|
||||
*/
|
||||
memset(log_buffer, '\0', log_buf_size);
|
||||
@ -147,12 +137,12 @@ Index: klogd.c
|
||||
if ( (rdcnt = ksyslog(2, log_buffer, log_buf_size-1)) < 0 )
|
||||
{
|
||||
if ( errno == EINTR )
|
||||
@@ -1033,10 +1045,15 @@ int main(argc, argv)
|
||||
*output = (char *) 0;
|
||||
@@ -1051,10 +1063,15 @@ int main(argc, argv)
|
||||
|
||||
#ifndef TESTING
|
||||
pid_t ppid = getpid();
|
||||
- chdir ("/");
|
||||
+ if (chdir("/") < 0) {
|
||||
+ if (chdir ("/") < 0) {
|
||||
+ fprintf(stderr,
|
||||
+ "klogd: Can not change to root directory: %s\n",
|
||||
+ strerror(errno));
|
||||
@ -165,7 +155,7 @@ Index: klogd.c
|
||||
switch((char)ch)
|
||||
{
|
||||
case '2': /* Print lines with symbols twice. */
|
||||
@@ -1067,6 +1084,14 @@ int main(argc, argv)
|
||||
@@ -1085,6 +1102,14 @@ int main(argc, argv)
|
||||
case 'o': /* One-shot mode. */
|
||||
one_shot = 1;
|
||||
break;
|
||||
@ -180,7 +170,7 @@ Index: klogd.c
|
||||
case 'p':
|
||||
SetParanoiaLevel(1); /* Load symbols on oops. */
|
||||
break;
|
||||
@@ -1193,8 +1218,11 @@ int main(argc, argv)
|
||||
@@ -1229,8 +1254,11 @@ int main(argc, argv)
|
||||
if ( one_shot )
|
||||
{
|
||||
if (symbol_lookup) {
|
||||
@ -194,7 +184,7 @@ Index: klogd.c
|
||||
}
|
||||
if ( (logsrc = GetKernelLogSrc()) == kernel )
|
||||
LogKernelLine();
|
||||
@@ -1209,8 +1237,11 @@ int main(argc, argv)
|
||||
@@ -1245,8 +1273,11 @@ int main(argc, argv)
|
||||
#endif
|
||||
logsrc = GetKernelLogSrc();
|
||||
if (symbol_lookup) {
|
||||
@ -207,11 +197,9 @@ Index: klogd.c
|
||||
+ Syslog(LOG_WARNING, "Cannot build symbol table - disabling symbol lookups");
|
||||
}
|
||||
|
||||
/* The main loop. */
|
||||
Index: pidfile.c
|
||||
===================================================================
|
||||
--- pidfile.c.orig
|
||||
+++ pidfile.c
|
||||
#ifndef TESTING
|
||||
--- pidfile.c
|
||||
+++ pidfile.c 2022-10-19 09:50:35.677760471 +0000
|
||||
@@ -46,11 +46,11 @@
|
||||
int read_pid (char *pidfile)
|
||||
{
|
||||
@ -252,10 +240,8 @@ Index: pidfile.c
|
||||
if (!fprintf(f,"%d\n", pid)) {
|
||||
fprintf(stderr, "Can't write pid , %s.\n", strerror(errno));
|
||||
close(fd);
|
||||
Index: resolve.c
|
||||
===================================================================
|
||||
--- resolve.c.orig
|
||||
+++ resolve.c
|
||||
--- resolve.c
|
||||
+++ resolve.c 2022-10-19 09:50:35.677760471 +0000
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
@ -296,10 +282,8 @@ Index: resolve.c
|
||||
+ dprintf("failed to write: %s\n", strerror(errno));
|
||||
+ exit(1);
|
||||
}
|
||||
Index: sample-s390.conf
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ sample-s390.conf
|
||||
--- sample-s390.conf
|
||||
+++ sample-s390.conf 2022-10-19 09:50:35.677760471 +0000
|
||||
@@ -0,0 +1,60 @@
|
||||
+# /etc/syslog.conf - Configuration file for syslogd(8)
|
||||
+#
|
||||
@ -361,10 +345,8 @@ Index: sample-s390.conf
|
||||
+local2,local3.* -/var/log/localmessages
|
||||
+local4,local5.* -/var/log/localmessages
|
||||
+local6,local7.* -/var/log/localmessages
|
||||
Index: sample.conf
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ sample.conf
|
||||
--- sample.conf
|
||||
+++ sample.conf 2022-10-19 09:50:35.677760471 +0000
|
||||
@@ -0,0 +1,60 @@
|
||||
+# /etc/syslog.conf - Configuration file for syslogd(8)
|
||||
+#
|
||||
@ -426,11 +408,9 @@ Index: sample.conf
|
||||
+local2,local3.* -/var/log/localmessages
|
||||
+local4,local5.* -/var/log/localmessages
|
||||
+local6,local7.* -/var/log/localmessages
|
||||
Index: syslog.c
|
||||
===================================================================
|
||||
--- syslog.c.orig
|
||||
+++ syslog.c
|
||||
@@ -70,7 +70,12 @@ static char sccsid[] = "@(#)syslog.c 5.2
|
||||
--- syslog.c
|
||||
+++ syslog.c 2022-10-19 09:50:35.677760471 +0000
|
||||
@@ -73,7 +73,12 @@ static char sccsid[] = "@(#)syslog.c 5.2
|
||||
#include <paths.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@ -444,11 +424,9 @@ Index: syslog.c
|
||||
|
||||
#undef LOG_FAC
|
||||
static inline int LOG_FAC(const int pri)
|
||||
Index: syslogd.c
|
||||
===================================================================
|
||||
--- syslogd.c.orig
|
||||
+++ syslogd.c
|
||||
@@ -466,6 +466,7 @@ static char sccsid[] __attribute__ ((un
|
||||
--- syslogd.c
|
||||
+++ syslogd.c 2022-10-19 09:55:06.300950261 +0000
|
||||
@@ -519,6 +519,7 @@ static char sccsid[] __attribute__ ((un
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <utmp.h>
|
||||
@ -456,7 +434,7 @@ Index: syslogd.c
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <setjmp.h>
|
||||
@@ -594,7 +595,11 @@ int sd_fds = 0;
|
||||
@@ -651,7 +652,11 @@ int sd_fds = 0;
|
||||
# define UNAMESZ 8 /* length of a login name */
|
||||
#endif
|
||||
#define MAXUNAMES 20 /* maximum number of user names */
|
||||
@ -469,7 +447,7 @@ Index: syslogd.c
|
||||
|
||||
#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */
|
||||
#define TABLE_NOPRI 0 /* Value to indicate no priority in f_pmask */
|
||||
@@ -674,8 +679,8 @@ struct filed {
|
||||
@@ -733,8 +738,8 @@ struct filed {
|
||||
* in seconds after previous message is logged. After each flush,
|
||||
* we move to the next interval until we reach the largest.
|
||||
*/
|
||||
@ -480,7 +458,7 @@ Index: syslogd.c
|
||||
#define REPEATTIME(f) ((f)->f_time + repeatinterval[(f)->f_repeatcount])
|
||||
#define BACKOFF(f) { if (++(f)->f_repeatcount > MAXREPEAT) \
|
||||
(f)->f_repeatcount = MAXREPEAT; \
|
||||
@@ -789,7 +794,7 @@ int usage(void);
|
||||
@@ -849,7 +854,7 @@ int usage(void);
|
||||
static pid_t sid;
|
||||
#endif
|
||||
void untty(void);
|
||||
@ -489,16 +467,7 @@ Index: syslogd.c
|
||||
void printline(const char *hname, char *msg);
|
||||
void printsys(char *msg);
|
||||
void logmsg(int pri, char *msg, const char *from, int flags);
|
||||
@@ -837,7 +842,7 @@ int main(argc, argv)
|
||||
#else /* __GLIBC__ */
|
||||
#ifndef TESTING
|
||||
#ifdef SYSLOG_INET
|
||||
- size_t len;
|
||||
+ socklen_t len;
|
||||
#endif
|
||||
#endif
|
||||
int num_fds;
|
||||
@@ -883,7 +888,12 @@ int main(argc, argv)
|
||||
@@ -944,7 +949,12 @@ int main(argc, argv)
|
||||
int maxfds;
|
||||
|
||||
#ifndef TESTING
|
||||
@ -512,33 +481,7 @@ Index: syslogd.c
|
||||
#endif
|
||||
for (i = 1; i < MAXFUNIX; i++) {
|
||||
funixn[i] = "";
|
||||
@@ -1138,13 +1148,15 @@ int main(argc, argv)
|
||||
leave = 0;
|
||||
|
||||
(void) signal(SIGTERM, die);
|
||||
+ (void) siginterrupt(SIGTERM,1); /* Make recvfrom() be able to receive EINTR */
|
||||
(void) signal(SIGINT, Debug ? die : SIG_IGN);
|
||||
(void) signal(SIGQUIT, Debug ? die : SIG_IGN);
|
||||
(void) signal(SIGCHLD, reapchild);
|
||||
- (void) signal(SIGALRM, domark);
|
||||
(void) signal(SIGUSR1, Debug ? debug_switch : SIG_IGN);
|
||||
(void) signal(SIGXFSZ, SIG_IGN);
|
||||
+ (void) signal(SIGALRM, domark);
|
||||
(void) alarm(TIMERINTVL);
|
||||
+ (void) siginterrupt(SIGALRM,1); /* Make recvfrom() be able to receive EINTR */
|
||||
|
||||
/* Create a partial message table for all file descriptors. */
|
||||
num_fds = getdtablesize();
|
||||
@@ -1313,7 +1325,7 @@ int main(argc, argv)
|
||||
* -Joey
|
||||
*/
|
||||
printchopped(from, line, \
|
||||
- i + 2, finet);
|
||||
+ (size_t)(i + 2), finet);
|
||||
} else if (i < 0 && errno != EINTR) {
|
||||
dprintf("INET socket error: %d = %s.\n", \
|
||||
errno, strerror(errno));
|
||||
@@ -1332,7 +1344,7 @@ int main(argc, argv)
|
||||
@@ -1400,7 +1410,7 @@ int main(argc, argv)
|
||||
parts[fileno(stdin)] = (char *) 0;
|
||||
i = read(fileno(stdin), line, MAXLINE);
|
||||
if (i > 0) {
|
||||
@ -547,7 +490,7 @@ Index: syslogd.c
|
||||
} else if (i < 0) {
|
||||
if (errno != EINTR) {
|
||||
logerror("stdin");
|
||||
@@ -1406,8 +1418,9 @@ static int create_unix_socket(const char
|
||||
@@ -1474,8 +1484,9 @@ static int create_unix_socket(const char
|
||||
close(fd);
|
||||
#ifndef SYSV
|
||||
dienow();
|
||||
@ -558,7 +501,7 @@ Index: syslogd.c
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
@@ -1584,7 +1597,7 @@ void untty()
|
||||
@@ -1660,7 +1671,7 @@ void untty()
|
||||
void printchopped(hname, msg, len, fd)
|
||||
const char *hname;
|
||||
char *msg;
|
||||
@ -567,16 +510,16 @@ Index: syslogd.c
|
||||
int fd;
|
||||
{
|
||||
auto int ptlngth;
|
||||
@@ -1684,6 +1697,8 @@ void printline(hname, msg)
|
||||
@@ -1771,6 +1782,8 @@ void printline(hname, msg)
|
||||
while ((c = *p++) && q < &line[sizeof(line) - 4]) {
|
||||
if (c == '\n')
|
||||
if (c == '\n' || c == 127)
|
||||
*q++ = ' ';
|
||||
+ else if (c == '\t')
|
||||
+ *q++ = c;
|
||||
else if (c < 040) {
|
||||
*q++ = '^';
|
||||
*q++ = c ^ 0100;
|
||||
@@ -1851,7 +1866,7 @@ void logmsg(pri, msg, from, flags)
|
||||
@@ -1954,7 +1967,7 @@ void logmsg(pri, msg, from, flags)
|
||||
!strcmp(from, f->f_prevhost)) {
|
||||
(void) strncpy(f->f_lasttime, timestamp, 15);
|
||||
f->f_prevcount++;
|
||||
@ -585,49 +528,52 @@ Index: syslogd.c
|
||||
f->f_prevcount, now - f->f_time,
|
||||
repeatinterval[f->f_repeatcount]);
|
||||
/*
|
||||
@@ -2178,13 +2193,7 @@ void wallmsg(f, iov)
|
||||
@@ -2293,15 +2306,7 @@ void wallmsg(f, iov)
|
||||
register struct filed *f;
|
||||
struct iovec *iov;
|
||||
{
|
||||
- char p[6 + UNAMESZ];
|
||||
- char p[sizeof (_PATH_DEV) + UNAMESZ];
|
||||
- register int i;
|
||||
- int ttyf, len;
|
||||
static int reenter = 0;
|
||||
- struct utmp ut;
|
||||
- struct utmp *uptr;
|
||||
- char greetings[200];
|
||||
-
|
||||
- (void) &len;
|
||||
|
||||
if (reenter++)
|
||||
return;
|
||||
@@ -2198,9 +2207,18 @@ void wallmsg(f, iov)
|
||||
@@ -2309,12 +2314,18 @@ void wallmsg(f, iov)
|
||||
/* open the user login file */
|
||||
setutent();
|
||||
|
||||
-
|
||||
/*
|
||||
* Might as well fork instead of using nonblocking I/O
|
||||
* and doing notty().
|
||||
*/
|
||||
if (fork() == 0) {
|
||||
+ char p[6 + UNAMESZ];
|
||||
+ char p[sizeof (_PATH_DEV) + UNAMESZ];
|
||||
+ register int i;
|
||||
+ int ttyf;
|
||||
+ static int len = 0;
|
||||
+ int ttyf, len;
|
||||
+ struct utmp ut;
|
||||
+ struct utmp *uptr;
|
||||
+ static char greetings[200];
|
||||
+ char greetings[200];
|
||||
+
|
||||
(void) signal(SIGTERM, SIG_DFL);
|
||||
(void) alarm(0);
|
||||
(void) signal(SIGALRM, endtty);
|
||||
+ (void) siginterrupt(SIGALRM,1); /* Make recvfrom() be able to receive EINTR */
|
||||
(void) snprintf(greetings, sizeof(greetings),
|
||||
"\r\n\7Message from syslogd@%s at %.24s ...\r\n",
|
||||
(char *) iov[2].iov_base, ctime(&now));
|
||||
@@ -2212,7 +2230,7 @@ void wallmsg(f, iov)
|
||||
/* is this slot used? */
|
||||
if (ut.ut_name[0] == '\0')
|
||||
continue;
|
||||
- if (ut.ut_type == LOGIN_PROCESS)
|
||||
+ if (ut.ut_type != USER_PROCESS)
|
||||
continue;
|
||||
if (!(strcmp (ut.ut_name,"LOGIN"))) /* paranoia */
|
||||
continue;
|
||||
@@ -2382,7 +2400,7 @@ void domark()
|
||||
@@ -2358,7 +2369,7 @@ void wallmsg(f, iov)
|
||||
iov[1].iov_len = 0;
|
||||
}
|
||||
if (setjmp(ttybuf) == 0) {
|
||||
- (void) signal(SIGALRM, endtty);
|
||||
+ (void) resignal(SIGALRM, endtty);
|
||||
(void) alarm(15);
|
||||
/* open the terminal */
|
||||
ttyf = open(p, O_WRONLY|O_NOCTTY);
|
||||
@@ -2521,7 +2532,7 @@ void domark()
|
||||
for (f = Files; f; f = f->f_next) {
|
||||
#endif
|
||||
if (f->f_prevcount && now >= REPEATTIME(f)) {
|
||||
@ -636,11 +582,3 @@ Index: syslogd.c
|
||||
TypeNames[f->f_type], f->f_prevcount,
|
||||
repeatinterval[f->f_repeatcount]);
|
||||
fprintlog(f, LocalHostName, 0, (char *)NULL);
|
||||
@@ -2392,6 +2410,7 @@ void domark()
|
||||
}
|
||||
(void) signal(SIGALRM, domark);
|
||||
(void) alarm(TIMERINTVL);
|
||||
+ (void) siginterrupt(SIGALRM,1); /* Make recvfrom() be able to receive EINTR */
|
||||
}
|
||||
|
||||
void debug_switch()
|
||||
|
BIN
sysklogd-1.5.1.tar.gz
(Stored with Git LFS)
Normal file
BIN
sysklogd-1.5.1.tar.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,27 +1,35 @@
|
||||
---
|
||||
CHANGES | 3
|
||||
Makefile | 2
|
||||
syslogd.c | 228 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
|
||||
3 files changed, 210 insertions(+), 23 deletions(-)
|
||||
|
||||
--- CHANGES
|
||||
+++ CHANGES 2002-08-02 11:28:10.000000000 +0000
|
||||
@@ -1,3 +1,7 @@
|
||||
+++ CHANGES 2022-10-13 08:13:35.285747318 +0000
|
||||
@@ -72,6 +72,9 @@ Version 1.5
|
||||
. Matthew Fischer <futhark@vzavenue.net>
|
||||
- Remove special treatment of the percent sign in klogd
|
||||
|
||||
+Version 1.4.1-usagi (2001/03/21)
|
||||
+ - syslogd IPv6 support
|
||||
+ (based on patch from Hiroyuki YAMAMORI <h-yamamo@db3.so-net.ne.jp>)
|
||||
+
|
||||
|
||||
Version 1.4.1
|
||||
|
||||
. klogd will set the console log level only if `-c' is given on the
|
||||
--- Makefile
|
||||
+++ Makefile 2002-08-02 11:58:42.000000000 +0000
|
||||
@@ -3,7 +3,7 @@
|
||||
+++ Makefile 2022-10-13 08:30:44.607385067 +0000
|
||||
@@ -20,7 +20,7 @@
|
||||
CC= gcc
|
||||
#CFLAGS= -g -DSYSV -Wall
|
||||
#SKFLAGS= -g -DSYSV -Wall
|
||||
#LDFLAGS= -g
|
||||
-CFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce
|
||||
+CFLAGS= $(RPM_OPT_FLAGS) -DINET6 -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce
|
||||
LDFLAGS= -s
|
||||
|
||||
# Look where your install program is.
|
||||
-SKFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce
|
||||
+SKFLAGS= $(RPM_OPT_FLAGS) -DINET6 -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce
|
||||
# -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
|
||||
# -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
|
||||
# $(shell getconf LFS_SKFLAGS)
|
||||
--- syslogd.c
|
||||
+++ syslogd.c 2002-08-02 12:00:16.000000000 +0000
|
||||
@@ -599,6 +599,7 @@ int funix[MAXFUNIX] = { -1, };
|
||||
+++ syslogd.c 2022-10-13 08:30:05.088090073 +0000
|
||||
@@ -654,6 +654,7 @@ int funix[MAXFUNIX] = { -1, };
|
||||
* This table contains plain text for h_errno errors used by the
|
||||
* net subsystem.
|
||||
*/
|
||||
@ -29,7 +37,7 @@
|
||||
const char *sys_h_errlist[] = {
|
||||
"No problem", /* NETDB_SUCCESS */
|
||||
"Authoritative answer: host not found", /* HOST_NOT_FOUND */
|
||||
@@ -607,6 +608,7 @@ const char *sys_h_errlist[] = {
|
||||
@@ -662,6 +663,7 @@ const char *sys_h_errlist[] = {
|
||||
"Valid name, no data record of requested type", /* NO_DATA */
|
||||
"no address, look for MX record" /* NO_ADDRESS */
|
||||
};
|
||||
@ -37,7 +45,7 @@
|
||||
|
||||
/*
|
||||
* This structure represents the files that will have log
|
||||
@@ -625,7 +627,18 @@ struct filed {
|
||||
@@ -680,7 +682,18 @@ struct filed {
|
||||
char f_uname[MAXUNAMES][UNAMESZ+1];
|
||||
struct {
|
||||
char f_hname[MAXHOSTNAMELEN+1];
|
||||
@ -56,8 +64,8 @@
|
||||
} f_forw; /* forwarding address */
|
||||
char f_fname[MAXFNAME];
|
||||
} f_un;
|
||||
@@ -732,7 +745,11 @@ char LocalHostName[MAXHOSTNAMELEN+1]; /*
|
||||
char *LocalDomain; /* our local domain name */
|
||||
@@ -788,7 +801,11 @@ char *LocalDomain; /* our local domain
|
||||
char *emptystring = "";
|
||||
int InetInuse = 0; /* non-zero if INET sockets are being used */
|
||||
int finet = -1; /* Internet datagram socket */
|
||||
+#ifdef INET6
|
||||
@ -68,7 +76,7 @@
|
||||
int Initialized = 0; /* set when we have initialized ourselves */
|
||||
int MarkInterval = 20 * 60; /* interval between marks in seconds */
|
||||
int MarkSeq = 0; /* mark sequence number */
|
||||
@@ -759,10 +776,10 @@ void fprintlog(register struct filed *f,
|
||||
@@ -815,10 +832,10 @@ void fprintlog(register struct filed *f,
|
||||
void endtty();
|
||||
void wallmsg(register struct filed *f, struct iovec *iov);
|
||||
void reapchild();
|
||||
@ -81,7 +89,7 @@
|
||||
void die(int sig);
|
||||
#ifndef TESTING
|
||||
void doexit(int sig);
|
||||
@@ -782,6 +799,10 @@ static int create_unix_socket(const char
|
||||
@@ -838,6 +855,10 @@ static int create_unix_socket(const char
|
||||
#endif
|
||||
#ifdef SYSLOG_INET
|
||||
static int create_inet_socket();
|
||||
@ -92,7 +100,7 @@
|
||||
#endif
|
||||
|
||||
int main(argc, argv)
|
||||
@@ -816,7 +837,12 @@ int main(argc, argv)
|
||||
@@ -875,7 +896,12 @@ int main(argc, argv)
|
||||
#ifndef TESTING
|
||||
int fd;
|
||||
#ifdef SYSLOG_INET
|
||||
@ -105,9 +113,9 @@
|
||||
char *from;
|
||||
#endif
|
||||
pid_t ppid = getpid();
|
||||
@@ -1137,11 +1163,21 @@ int main(argc, argv)
|
||||
memset(line, '\0', sizeof(line));
|
||||
i = recvfrom(finet, line, MAXLINE - 2, 0, \
|
||||
@@ -1204,10 +1230,21 @@ int main(argc, argv)
|
||||
memset(line, 0, sizeof(line));
|
||||
msglen = recvfrom(finet, line, MAXLINE - 2, 0, \
|
||||
(struct sockaddr *) &frominet, &len);
|
||||
+#ifdef INET6
|
||||
+ if (getnameinfo((struct sockaddr *)&frominet, len,
|
||||
@ -118,17 +126,17 @@
|
||||
+ dprintf("Message from inetd socket: #%d, host: %s\n",
|
||||
+ inetm, hbuf);
|
||||
+#else
|
||||
+
|
||||
dprintf("Message from inetd socket: #%d, host: %s\n",
|
||||
inetm, inet_ntoa(frominet.sin_addr));
|
||||
+#endif
|
||||
if (i > 0) {
|
||||
line[i] = line[i+1] = '\0';
|
||||
if (msglen > 0) {
|
||||
- from = (char *)cvthname(&frominet);
|
||||
+ from = (char *)cvthname((struct sockaddr*)&frominet);
|
||||
/*
|
||||
* Here we could check if the host is permitted
|
||||
* to send us syslog messages. We just have to
|
||||
@@ -1227,17 +1263,50 @@ static int create_unix_socket(const char
|
||||
@@ -1293,18 +1330,51 @@ static int create_unix_socket(const char
|
||||
static int create_inet_socket()
|
||||
{
|
||||
int fd, on = 1;
|
||||
@ -138,6 +146,7 @@
|
||||
+#else
|
||||
struct sockaddr_in sin;
|
||||
+#endif
|
||||
int sockflags;
|
||||
|
||||
+#ifdef INET6
|
||||
+ fd = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
@ -179,7 +188,7 @@
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, \
|
||||
(char *) &on, sizeof(on)) < 0 ) {
|
||||
logerror("setsockopt(REUSEADDR), suspending inet");
|
||||
@@ -1253,13 +1322,77 @@ static int create_inet_socket()
|
||||
@@ -1329,13 +1399,77 @@ static int create_inet_socket()
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
@ -257,7 +266,7 @@
|
||||
#endif
|
||||
|
||||
char **
|
||||
@@ -1679,8 +1812,12 @@ void fprintlog(f, from, flags, msg)
|
||||
@@ -1778,8 +1912,12 @@ void fprintlog(f, from, flags, msg)
|
||||
register int l;
|
||||
char line[MAXLINE + 1];
|
||||
time_t fwd_suspend;
|
||||
@ -270,7 +279,7 @@
|
||||
|
||||
dprintf("Called fprintlog, ");
|
||||
|
||||
@@ -1734,22 +1871,27 @@ void fprintlog(f, from, flags, msg)
|
||||
@@ -1833,22 +1971,27 @@ void fprintlog(f, from, flags, msg)
|
||||
fwd_suspend);
|
||||
}
|
||||
break;
|
||||
@ -300,7 +309,7 @@
|
||||
dprintf("Retries: %d\n", f->f_prevcount);
|
||||
if ( --f->f_prevcount < 0 ) {
|
||||
dprintf("Giving up.\n");
|
||||
@@ -1760,7 +1902,9 @@ void fprintlog(f, from, flags, msg)
|
||||
@@ -1859,7 +2002,9 @@ void fprintlog(f, from, flags, msg)
|
||||
}
|
||||
else {
|
||||
dprintf("%s found, resuming.\n", f->f_un.f_forw.f_hname);
|
||||
@ -310,31 +319,7 @@
|
||||
f->f_prevcount = 0;
|
||||
f->f_type = F_FORW;
|
||||
goto f_forw;
|
||||
@@ -1783,27 +1927,31 @@ void fprintlog(f, from, flags, msg)
|
||||
dprintf("Not sending message to remote.\n");
|
||||
else {
|
||||
f->f_time = now;
|
||||
-/* afx: add <sourcehost
|
||||
+/* afx: add <sourcehost
|
||||
*/
|
||||
- if ((TagForward == 1) &&
|
||||
+ if ((TagForward == 1) &&
|
||||
strncmp(f->f_prevhost,LocalHostName,MAXHOSTNAMELEN+1)) {
|
||||
- (void) snprintf(line, sizeof(line), "<%d><%s: %s\n",
|
||||
- f->f_prevpri, f->f_prevhost,
|
||||
+ (void) snprintf(line, sizeof(line), "<%d><%s: %s\n",
|
||||
+ f->f_prevpri, f->f_prevhost,
|
||||
(char *) iov[4].iov_base);
|
||||
} else {
|
||||
(void) snprintf(line, sizeof(line), "<%d>%s\n",
|
||||
- f->f_prevpri,
|
||||
+ f->f_prevpri,
|
||||
(char *) iov[4].iov_base);
|
||||
}
|
||||
-/* end afx */
|
||||
+/* end afx */
|
||||
l = strlen(line);
|
||||
if (l > MAXLINE)
|
||||
@@ -1901,7 +2046,11 @@ void fprintlog(f, from, flags, msg)
|
||||
l = MAXLINE;
|
||||
if (sendto(finet, line, l, 0, \
|
||||
(struct sockaddr *) &f->f_un.f_forw.f_addr,
|
||||
@ -343,14 +328,11 @@
|
||||
+ family == AF_INET6 ?
|
||||
+ sizeof(struct sockaddr_in6) :
|
||||
+#endif
|
||||
+ sizeof(struct sockaddr_in)) != l) {
|
||||
+ sizeof(f->f_un.f_forw.f_addr)) != l) {
|
||||
int e = errno;
|
||||
- dprintf("INET sendto error: %d = %s.\n",
|
||||
+ dprintf("INET sendto error: %d = %s.\n",
|
||||
dprintf("INET sendto error: %d = %s.\n",
|
||||
e, strerror(e));
|
||||
f->f_type = F_FORW_SUSP;
|
||||
errno = e;
|
||||
@@ -2025,28 +2173,53 @@ void reapchild()
|
||||
@@ -2132,28 +2281,53 @@ void reapchild()
|
||||
/*
|
||||
* Return a printable representation of a host address.
|
||||
*/
|
||||
@ -412,7 +394,7 @@
|
||||
if (isupper(*p))
|
||||
*p = tolower(*p);
|
||||
|
||||
@@ -2054,17 +2227,17 @@ const char *cvthname(f)
|
||||
@@ -2161,17 +2335,17 @@ const char *cvthname(f)
|
||||
* Notice that the string still contains the fqdn, but your
|
||||
* hostname and domain are separated by a '\0'.
|
||||
*/
|
||||
@ -433,7 +415,7 @@
|
||||
}
|
||||
count++;
|
||||
}
|
||||
@@ -2072,9 +2245,9 @@ const char *cvthname(f)
|
||||
@@ -2179,9 +2353,9 @@ const char *cvthname(f)
|
||||
if (LocalHosts) {
|
||||
count=0;
|
||||
while (LocalHosts[count]) {
|
||||
@ -445,7 +427,7 @@
|
||||
}
|
||||
count++;
|
||||
}
|
||||
@@ -2082,7 +2255,7 @@ const char *cvthname(f)
|
||||
@@ -2189,7 +2363,7 @@ const char *cvthname(f)
|
||||
}
|
||||
}
|
||||
|
||||
@ -454,7 +436,7 @@
|
||||
}
|
||||
|
||||
void domark()
|
||||
@@ -2132,7 +2305,7 @@ void debug_switch()
|
||||
@@ -2239,7 +2413,7 @@ void debug_switch()
|
||||
* Print syslogd errors some place.
|
||||
*/
|
||||
void logerror(type)
|
||||
@ -463,7 +445,7 @@
|
||||
{
|
||||
char buf[100];
|
||||
|
||||
@@ -2226,6 +2399,7 @@ void init()
|
||||
@@ -2333,6 +2507,7 @@ void init()
|
||||
#else
|
||||
char cline[BUFSIZ];
|
||||
#endif
|
||||
@ -471,15 +453,15 @@
|
||||
struct servent *sp;
|
||||
|
||||
sp = getservbyname("syslog", "udp");
|
||||
@@ -2236,6 +2410,7 @@ void init()
|
||||
return;
|
||||
}
|
||||
@@ -2347,6 +2522,7 @@ void init()
|
||||
LogPort = 0;
|
||||
} else
|
||||
LogPort = sp->s_port;
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* Close all open log files and free log descriptor array.
|
||||
@@ -2384,6 +2559,10 @@ void init()
|
||||
@@ -2495,6 +2671,10 @@ void init()
|
||||
InetInuse = 0;
|
||||
}
|
||||
inetm = finet;
|
||||
@ -490,7 +472,7 @@
|
||||
#endif
|
||||
|
||||
Initialized = 1;
|
||||
@@ -2471,7 +2650,7 @@ void cfline(line, f)
|
||||
@@ -2582,7 +2762,7 @@ void cfline(line, f)
|
||||
int singlpri = 0;
|
||||
int ignorepri = 0;
|
||||
int syncfile;
|
||||
@ -499,8 +481,8 @@
|
||||
struct hostent *hp;
|
||||
#endif
|
||||
char buf[MAXLINE];
|
||||
@@ -2630,6 +2809,9 @@ void cfline(line, f)
|
||||
#ifdef SYSLOG_INET
|
||||
@@ -2747,6 +2927,9 @@ void cfline(line, f)
|
||||
|
||||
(void) strcpy(f->f_un.f_forw.f_hname, ++p);
|
||||
dprintf("forwarding host: %s\n", p); /*ASP*/
|
||||
+#ifdef INET6
|
||||
@ -509,7 +491,7 @@
|
||||
if ( (hp = gethostbyname(p)) == NULL ) {
|
||||
f->f_type = F_FORW_UNKN;
|
||||
f->f_prevcount = INET_RETRY_MAX;
|
||||
@@ -2644,6 +2826,7 @@ void cfline(line, f)
|
||||
@@ -2761,6 +2944,7 @@ void cfline(line, f)
|
||||
f->f_un.f_forw.f_addr.sin_port = LogPort;
|
||||
if ( f->f_type == F_FORW )
|
||||
memcpy((char *) &f->f_un.f_forw.f_addr.sin_addr, hp->h_addr, hp->h_length);
|
||||
|
@ -1,9 +1,3 @@
|
||||
addFilter(".*incoherent-logrotate-file.*")
|
||||
addFilter(".*init-script-non-var-dependency.*")
|
||||
addFilter(".*dangling-symlink.*/lib/systemd/system/earlysyslog\.service.*/dev/null.*")
|
||||
addFilter(".*no-reload-entry.*/etc/init\.d/early.*")
|
||||
addFilter(".*no-status-entry.*/etc/init\.d/early.*")
|
||||
addFilter(".*no-url-tag.*")
|
||||
addFilter(".*non-etc-or-var-file-marked-as-conffile.*/lib/systemd/system/.*")
|
||||
addFilter(".*suse-logrotate-log-dir-not-packaged.*/var/log/news.*")
|
||||
addFilter(".*suse-missing-rclink.*early.*")
|
||||
addFilter(".*W:.*macro-in-comment.*%{version}.*")
|
||||
addFilter(".*W:.*binary-or-shlib-calls-gethostbyname.*/usr/sbin/syslogd.*")
|
||||
|
||||
|
@ -1,3 +1,89 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 19 11:57:37 UTC 2022 - Dr. Werner Fink <werner@suse.de>
|
||||
|
||||
- Update ot version 1.5.1
|
||||
ChangeLog for version 1.5.1
|
||||
Many thanks to Rainer Gerhards, rsyslog project lead, for
|
||||
identifying a problem with how rsyslog's rsyslogd and sysklogd's
|
||||
syslogd check for invalid priority values (CVE-2014-3634).
|
||||
ChangeLog for version 1.5
|
||||
* Fix file descriptor leak in klogd
|
||||
* Improve argument list processing
|
||||
* Prevent potential buffer overflow in reading messages from the
|
||||
kernel log ringbuffer
|
||||
* Ensure that "len" is not placed in a register, and that the endtty()
|
||||
signal handler is not installed too early which could cause a
|
||||
segmentation fault or worse
|
||||
* klogd will reconnect to the logger (mostly syslogd) after it went
|
||||
away during operation
|
||||
* On heavily loaded system syslog will not spit out error messages
|
||||
anymore when recvfrom() results in EAGAIN
|
||||
* Makefile improvements
|
||||
* Local copy of module.h
|
||||
* Improved manpage
|
||||
* Always log with syslogd's timezone and locale
|
||||
* Remove trailing newline when forwarding messages
|
||||
* Continue working properly if /etc/service is missing and ignore
|
||||
network activity
|
||||
* Continue writing to log files as soon as space becomes available
|
||||
again after a filled up disk
|
||||
* Removed test to detect control characters> 0x20 as this prevented
|
||||
characters encoded in UTF-8 to be properly passed through
|
||||
* Only resolve the local domain when accepting messages from remote
|
||||
* Properly accompany the MARK message with the facility
|
||||
* Improved daemonise routine in klogd to stabilise startup
|
||||
* klogd will not change the console log level anymore unless -c is given
|
||||
* Added back /usr/src/linux/System.map as fall-back location
|
||||
* Rewrite the module symbol parser to read from /proc/kallsyms
|
||||
* Notify the waiting parent process if the client dies
|
||||
* Complete rewrite of the oops kernel module for Linux 2.6
|
||||
* Only read kernel symbols from /proc/kallsyms if no System.map
|
||||
has been read
|
||||
* Improved symbol lookup
|
||||
* Prevent named pipes from becoming the controlling tty
|
||||
* Fixing a race condition in syslogd discovered in UML
|
||||
* Improved README.linux
|
||||
* Added boundary checks in klogd
|
||||
* Don't block on the network socket in case of packet loss
|
||||
* Don't crash when filesize limit is reached (e.g. without LFS)
|
||||
* Fix spurious hanging syslogd in connection with futex and NPTL
|
||||
introduced in recent glibc versions and Linux 2.6 (details)
|
||||
* Improved syslog.conf(5) manpage
|
||||
* Use socklen_t where appropriate
|
||||
* Use newer query_module function rather than stepping through /dev/kmem.
|
||||
* Remove special treatment of the percent sign in klogd
|
||||
- Remove patches now upstream solved
|
||||
* klogd-obsolete.patch
|
||||
* sysklogd-1.4.1-fileleak.patch
|
||||
* sysklogd-1.4.1-ksym.patch
|
||||
* sysklogd-1.4.1-no_SO_BSDCOMPAT.diff
|
||||
* sysklogd-1.4.1-owl-crunch_list.diff
|
||||
* sysklogd-1.4.1-preserve_percents.patch
|
||||
* sysklogd-1.4.1-utf8.patch
|
||||
- Port patches
|
||||
* sysklogd-1.4.1-CVE-2014-3634.patch
|
||||
* sysklogd-1.4.1-clearing.patch
|
||||
* sysklogd-1.4.1-dgram.patch
|
||||
* sysklogd-1.4.1-dns.patch
|
||||
* sysklogd-1.4.1-dontsleep.patch
|
||||
* sysklogd-1.4.1-forw.patch
|
||||
* sysklogd-1.4.1-klogd24.dif
|
||||
* sysklogd-1.4.1-ksyslogsize.diff
|
||||
* sysklogd-1.4.1-large.patch
|
||||
* sysklogd-1.4.1-nofortify.patch
|
||||
* sysklogd-1.4.1-reload.dif
|
||||
* sysklogd-1.4.1-reopen.patch
|
||||
* sysklogd-1.4.1-showpri.patch
|
||||
* sysklogd-1.4.1-signal.dif
|
||||
* sysklogd-1.4.1-sparc.patch
|
||||
* sysklogd-1.4.1-sysmap-prior-to-2.5.patch
|
||||
* sysklogd-1.4.1-systemd-multi.dif
|
||||
* sysklogd-1.4.1-systemd-sock-name.patch
|
||||
* sysklogd-1.4.1-systemd.dif
|
||||
* sysklogd-1.4.1-unix_sockets.patch
|
||||
* sysklogd-1.4.1.dif
|
||||
* sysklogd-ipv6.diff
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 13 06:32:11 UTC 2022 - Dr. Werner Fink <werner@suse.de>
|
||||
|
||||
@ -19,7 +105,7 @@ Tue Jun 21 12:20:58 UTC 2022 - Stefan Schubert <schubi@suse.com>
|
||||
Tue Apr 19 14:51:10 UTC 2022 - Marcus Meissner <meissner@suse.com>
|
||||
|
||||
- https urls, added gpg signature (but not the keyring, could not
|
||||
find id)
|
||||
find it)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 4 07:22:27 UTC 2022 - Dr. Werner Fink <werner@suse.de>
|
||||
|
29
syslogd.spec
29
syslogd.spec
@ -25,14 +25,14 @@
|
||||
%define _rundir %{_localstatedir}/run
|
||||
%endif
|
||||
Name: syslogd
|
||||
Version: 1.4.1
|
||||
Version: 1.5.1
|
||||
Release: 0
|
||||
Summary: The Syslog daemon
|
||||
License: GPL-2.0-or-later
|
||||
Group: System/Daemons
|
||||
URL: https://www.infodrom.org/projects/sysklogd/
|
||||
Source: https://www.infodrom.org/projects/sysklogd/download/sysklogd-%{version}.tar.gz
|
||||
Source4: https://www.infodrom.org/projects/sysklogd/download/sysklogd-%{version}.tar.gz.asc
|
||||
#Source4: https://www.infodrom.org/projects/sysklogd/download/sysklogd-%{version}.tar.gz.asc
|
||||
Source1: logrotate.syslog
|
||||
Source2: sysconfig.syslogd
|
||||
Source3: sysconfig.klogd
|
||||
@ -47,20 +47,14 @@ Patch0: sysklogd-1.4.1.dif
|
||||
Patch1: sysklogd-1.4.1-dgram.patch
|
||||
Patch2: sysklogd-1.4.1-sparc.patch
|
||||
Patch3: sysklogd-1.4.1-forw.patch
|
||||
Patch4: sysklogd-1.4.1-fileleak.patch
|
||||
Patch5: sysklogd-ipv6.diff
|
||||
Patch6: sysklogd-1.4.1-klogd24.dif
|
||||
Patch7: sysklogd-1.4.1-large.patch
|
||||
Patch8: sysklogd-1.4.1-dns.patch
|
||||
Patch9: sysklogd-1.4.1-reopen.patch
|
||||
Patch10: sysklogd-1.4.1-no_SO_BSDCOMPAT.diff
|
||||
Patch11: sysklogd-1.4.1-owl-crunch_list.diff
|
||||
Patch12: sysklogd-1.4.1-ksyslogsize.diff
|
||||
Patch13: sysklogd-1.4.1-unix_sockets.patch
|
||||
Patch14: sysklogd-1.4.1-showpri.patch
|
||||
Patch15: sysklogd-1.4.1-preserve_percents.patch
|
||||
Patch16: sysklogd-1.4.1-utf8.patch
|
||||
Patch17: sysklogd-1.4.1-ksym.patch
|
||||
Patch18: sysklogd-1.4.1-dontsleep.patch
|
||||
Patch19: sysklogd-1.4.1-signal.dif
|
||||
Patch20: sysklogd-1.4.1-clearing.patch
|
||||
@ -72,18 +66,20 @@ Patch25: sysklogd-1.4.1-systemd-multi.dif
|
||||
Patch26: sysklogd-1.4.1-systemd-sock-name.patch
|
||||
# PATCH-FIX-SUSE bsc#897262, CVE-2014-3634 rsyslog/syslogd: remote syslog PRI vulnerability
|
||||
Patch28: sysklogd-1.4.1-CVE-2014-3634.patch
|
||||
Patch29: klogd-obsolete.patch
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: group(news)
|
||||
BuildRequires: pkgconfig(libsystemd)
|
||||
BuildRequires: pkgconfig(systemd)
|
||||
BuildRequires: user(news)
|
||||
Requires: klogd
|
||||
Requires(post): %fillup_prereq
|
||||
Requires(post): permissions
|
||||
# Note: this package is for >= 12.3 only
|
||||
# and does not provide LSB init scripts!
|
||||
Requires(pre): syslog-service >= 2.0
|
||||
Requires(pre): user(news) group(news)
|
||||
Conflicts: otherproviders(syslog)
|
||||
Requires(pre): user(news)
|
||||
Requires(pre): group(news)
|
||||
Conflicts: syslog
|
||||
Provides: sysklogd
|
||||
Provides: syslog
|
||||
Provides: sysvinit(syslog)
|
||||
@ -125,24 +121,18 @@ The package syslog-service provides the service boot
|
||||
scripts for SysV and the service unit files for systemd.
|
||||
|
||||
%prep
|
||||
%setup -q -n sysklogd-1.4.1
|
||||
%setup -q -n sysklogd-1.5.1
|
||||
%patch1 -b .dgram
|
||||
%patch2 -b .sparc
|
||||
%patch3 -b .forw
|
||||
%patch4 -b .fileleak
|
||||
%patch5 -b .ipv6
|
||||
%patch6 -b .klogd24
|
||||
%patch7 -b .large
|
||||
%patch8 -b .dns
|
||||
%patch9 -b .reopen
|
||||
%patch10 -b .sobsd
|
||||
%patch11 -b .owlcr
|
||||
%patch12 -b .klsize
|
||||
%patch13 -b .usock
|
||||
%patch14 -b .shprio
|
||||
%patch15 -b .presperc
|
||||
%patch16 -b .utf8
|
||||
%patch17 -b .ksym
|
||||
%patch18 -b .sleep
|
||||
%patch19 -b .signal
|
||||
%patch20 -b .clear
|
||||
@ -153,8 +143,7 @@ scripts for SysV and the service unit files for systemd.
|
||||
%patch25 -b .sd2
|
||||
%patch26 -b .sd3
|
||||
%patch28 -b .cve20143634
|
||||
%patch29 -p1
|
||||
%patch0
|
||||
%patch0 -b .p0
|
||||
|
||||
%build
|
||||
%ifarch s390 s390x
|
||||
|
Loading…
Reference in New Issue
Block a user