Accepting request 113327 from home:mtomaschewski:branches:Base:System
update + requery hostname on HUP -> works for me OBS-URL: https://build.opensuse.org/request/show/113327 OBS-URL: https://build.opensuse.org/package/show/Base:System/rsyslog?expand=0&rev=80
This commit is contained in:
parent
a6ba59f53e
commit
1fe9a6caa4
627
0001_5-bugfix-requery-hostname-on-HUP.patch
Normal file
627
0001_5-bugfix-requery-hostname-on-HUP.patch
Normal file
@ -0,0 +1,627 @@
|
||||
From d0a73d3449511392b115ca078517ff659aafe23d Mon Sep 17 00:00:00 2001
|
||||
From: Rainer Gerhards <rgerhards@adiscon.com>
|
||||
Date: Wed, 11 Apr 2012 11:18:41 +0200
|
||||
Subject: [PATCH 1/5] bugfix: hostname was not requeried on HUP
|
||||
|
||||
Thanks to Marius Tomaschewski for reporting this bug.
|
||||
|
||||
Signed-off-by: Marius Tomaschewski <mt@suse.com>
|
||||
---
|
||||
ChangeLog | 4 +
|
||||
doc/rsyslog_conf_global.html | 9 ---
|
||||
doc/v5compatibility.html | 1 +
|
||||
runtime/glbl.c | 107 ++++++++++++++++-----------
|
||||
tools/syslogd.c | 165 ++++++++++++++++++++++++------------------
|
||||
5 files changed, 161 insertions(+), 125 deletions(-)
|
||||
|
||||
diff --git a/ChangeLog b/ChangeLog
|
||||
index de33a6c..31f5fe9 100644
|
||||
--- a/ChangeLog
|
||||
+++ b/ChangeLog
|
||||
@@ -1,4 +1,8 @@
|
||||
---------------------------------------------------------------------------
|
||||
+Version 5.8.11 [V5-stable] 2012-04-??
|
||||
+- bugfix: hostname was not requeried on HUP
|
||||
+ Thanks to Marius Tomaschewski for reporting this bug.
|
||||
+---------------------------------------------------------------------------
|
||||
Version 5.8.10 [V5-stable] 2012-04-05
|
||||
- bugfix: segfault on startup if $actionqueuefilename was missing for disk
|
||||
queue config
|
||||
diff --git a/doc/rsyslog_conf_global.html b/doc/rsyslog_conf_global.html
|
||||
index 21786a7..83eb876 100644
|
||||
--- a/doc/rsyslog_conf_global.html
|
||||
+++ b/doc/rsyslog_conf_global.html
|
||||
@@ -152,15 +152,6 @@ our paper on <a href="multi_ruleset.html">using multiple rule sets in rsyslog</a
|
||||
<li><a href="rsconf1_gssforwardservicename.html">$GssForwardServiceName</a></li>
|
||||
<li><a href="rsconf1_gsslistenservicename.html">$GssListenServiceName</a></li>
|
||||
<li><a href="rsconf1_gssmode.html">$GssMode</a></li>
|
||||
-<li>$HUPisRestart [on/<b>off</b>] - if set to on, a HUP is a full daemon restart. This means any queued messages are discarded (depending
|
||||
-on queue configuration, of course) all modules are unloaded and reloaded. This mode keeps compatible with sysklogd, but is
|
||||
-not recommended for use with rsyslog. To do a full restart, simply stop and start the daemon. The default (since 4.5.1) is "off".
|
||||
-If it is set to "off", a HUP will only close open files. This is a much quicker action and usually
|
||||
-the only one that is needed e.g. for log rotation. <b>Restart-type HUPs (value "on") are depricated</b>
|
||||
-and will go away in rsyslog v5. So it is a good idea to change anything that needs it, now.
|
||||
-Usually that should not be a big issue, as the restart-type HUP can easily be replaced by
|
||||
-something along the lines of "/etc/init.d/rsyslog restart".
|
||||
-</li>
|
||||
<li><a href="rsconf1_includeconfig.html">$IncludeConfig</a></li><li>MainMsgQueueCheckpointInterval <number></li>
|
||||
<li><b>$LocalHostName</b> [name] - this directive permits to overwrite the system
|
||||
hostname with the one specified in the directive. If the directive is given
|
||||
diff --git a/doc/v5compatibility.html b/doc/v5compatibility.html
|
||||
index cc875b7..fc4289c 100644
|
||||
--- a/doc/v5compatibility.html
|
||||
+++ b/doc/v5compatibility.html
|
||||
@@ -16,6 +16,7 @@ available. This processing was redundant and had a lot a drawbacks.
|
||||
For details, please see the
|
||||
<a href="v4compatibility.html">rsyslog v4 compatibility notes</a> which elaborate
|
||||
on the reasons and the (few) things you may need to change.
|
||||
+<p>Please note that starting with 5.8.11 HUP will also requery the local hostname.
|
||||
<h2>Queue on-disk format</h2>
|
||||
<p>The queue information file format has been changed. When upgrading from v4 to
|
||||
v5, make sure that the queue is emptied and no on-disk structure present. We did
|
||||
diff --git a/runtime/glbl.c b/runtime/glbl.c
|
||||
index dea5a17..b6dc728 100644
|
||||
--- a/runtime/glbl.c
|
||||
+++ b/runtime/glbl.c
|
||||
@@ -69,10 +69,10 @@ static int bDropMalPTRMsgs = 0;/* Drop messages which have malicious PTR records
|
||||
static int option_DisallowWarning = 1; /* complain if message from disallowed sender is received */
|
||||
static int bDisableDNS = 0; /* don't look up IP addresses of remote messages */
|
||||
static prop_t *propLocalHostName = NULL;/* our hostname as FQDN - read-only after startup */
|
||||
-static uchar *LocalHostName = NULL;/* our hostname - read-only after startup */
|
||||
+static uchar *LocalHostName = NULL;/* our hostname - read-only after startup, except HUP */
|
||||
static uchar *LocalHostNameOverride = NULL;/* user-overridden hostname - read-only after startup */
|
||||
-static uchar *LocalFQDNName = NULL;/* our hostname as FQDN - read-only after startup */
|
||||
-static uchar *LocalDomain; /* our local domain name - read-only after startup */
|
||||
+static uchar *LocalFQDNName = NULL;/* our hostname as FQDN - read-only after startup, except HUP */
|
||||
+static uchar *LocalDomain = NULL;/* our local domain name - read-only after startup, except HUP */
|
||||
static char **StripDomains = NULL;/* these domains may be stripped before writing logs - r/o after s.u., never touched by init */
|
||||
static char **LocalHosts = NULL;/* these hosts are logged with their hostname - read-only after startup, never touched by init */
|
||||
static uchar *pszDfltNetstrmDrvr = NULL; /* module name of default netstream driver */
|
||||
@@ -115,15 +115,12 @@ SIMP_PROP(DefPFFamily, iDefPFFamily, int) /* note that in the future we may chec
|
||||
SIMP_PROP(DropMalPTRMsgs, bDropMalPTRMsgs, int)
|
||||
SIMP_PROP(Option_DisallowWarning, option_DisallowWarning, int)
|
||||
SIMP_PROP(DisableDNS, bDisableDNS, int)
|
||||
-SIMP_PROP(LocalDomain, LocalDomain, uchar*)
|
||||
SIMP_PROP(StripDomains, StripDomains, char**)
|
||||
SIMP_PROP(LocalHosts, LocalHosts, char**)
|
||||
#ifdef USE_UNLIMITED_SELECT
|
||||
SIMP_PROP(FdSetSize, iFdSetSize, int)
|
||||
#endif
|
||||
|
||||
-SIMP_PROP_SET(LocalFQDNName, LocalFQDNName, uchar*)
|
||||
-SIMP_PROP_SET(LocalHostName, LocalHostName, uchar*)
|
||||
SIMP_PROP_SET(DfltNetstrmDrvr, pszDfltNetstrmDrvr, uchar*) /* TODO: use custom function which frees existing value */
|
||||
SIMP_PROP_SET(DfltNetstrmDrvrCAF, pszDfltNetstrmDrvrCAF, uchar*) /* TODO: use custom function which frees existing value */
|
||||
SIMP_PROP_SET(DfltNetstrmDrvrKeyFile, pszDfltNetstrmDrvrKeyFile, uchar*) /* TODO: use custom function which frees existing value */
|
||||
@@ -202,6 +199,19 @@ finalize_it:
|
||||
RETiRet;
|
||||
}
|
||||
|
||||
+/* set our local hostname. Free previous hostname, if it was already set.
|
||||
+ * Note that we do now do this in a thread
|
||||
+ * "once in a lifetime" action which can not be undone. -- gerhards, 2009-07-20
|
||||
+ */
|
||||
+static rsRetVal
|
||||
+SetLocalHostName(uchar *newname)
|
||||
+{
|
||||
+ free(LocalHostName);
|
||||
+ LocalHostName = newname;
|
||||
+ return RS_RET_OK;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/* return our local hostname. if it is not set, "[localhost]" is returned
|
||||
*/
|
||||
static uchar*
|
||||
@@ -227,6 +237,26 @@ done:
|
||||
}
|
||||
|
||||
|
||||
+/* set our local domain name. Free previous domain, if it was already set.
|
||||
+ */
|
||||
+static rsRetVal
|
||||
+SetLocalDomain(uchar *newname)
|
||||
+{
|
||||
+ free(LocalDomain);
|
||||
+ LocalDomain = newname;
|
||||
+ return RS_RET_OK;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* return our local hostname. if it is not set, "[localhost]" is returned
|
||||
+ */
|
||||
+static uchar*
|
||||
+GetLocalDomain(void)
|
||||
+{
|
||||
+ return LocalDomain;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/* generate the local hostname property. This must be done after the hostname info
|
||||
* has been set as well as PreserveFQDN.
|
||||
* rgerhards, 2009-06-30
|
||||
@@ -271,6 +301,14 @@ GetLocalHostNameProp(void)
|
||||
}
|
||||
|
||||
|
||||
+static rsRetVal
|
||||
+SetLocalFQDNName(uchar *newname)
|
||||
+{
|
||||
+ free(LocalFQDNName);
|
||||
+ LocalFQDNName = newname;
|
||||
+ return RS_RET_OK;
|
||||
+}
|
||||
+
|
||||
/* return the current localhost name as FQDN (requires FQDN to be set)
|
||||
* TODO: we should set the FQDN ourselfs in here!
|
||||
*/
|
||||
@@ -373,30 +411,18 @@ ENDobjQueryInterface(glbl)
|
||||
*/
|
||||
static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal)
|
||||
{
|
||||
- if(pszDfltNetstrmDrvr != NULL) {
|
||||
- free(pszDfltNetstrmDrvr);
|
||||
- pszDfltNetstrmDrvr = NULL;
|
||||
- }
|
||||
- if(pszDfltNetstrmDrvrCAF != NULL) {
|
||||
- free(pszDfltNetstrmDrvrCAF);
|
||||
- pszDfltNetstrmDrvrCAF = NULL;
|
||||
- }
|
||||
- if(pszDfltNetstrmDrvrKeyFile != NULL) {
|
||||
- free(pszDfltNetstrmDrvrKeyFile);
|
||||
- pszDfltNetstrmDrvrKeyFile = NULL;
|
||||
- }
|
||||
- if(pszDfltNetstrmDrvrCertFile != NULL) {
|
||||
- free(pszDfltNetstrmDrvrCertFile);
|
||||
- pszDfltNetstrmDrvrCertFile = NULL;
|
||||
- }
|
||||
- if(LocalHostNameOverride != NULL) {
|
||||
- free(LocalHostNameOverride);
|
||||
- LocalHostNameOverride = NULL;
|
||||
- }
|
||||
- if(pszWorkDir != NULL) {
|
||||
- free(pszWorkDir);
|
||||
- pszWorkDir = NULL;
|
||||
- }
|
||||
+ free(pszDfltNetstrmDrvr);
|
||||
+ pszDfltNetstrmDrvr = NULL;
|
||||
+ free(pszDfltNetstrmDrvrCAF);
|
||||
+ pszDfltNetstrmDrvrCAF = NULL;
|
||||
+ free(pszDfltNetstrmDrvrKeyFile);
|
||||
+ pszDfltNetstrmDrvrKeyFile = NULL;
|
||||
+ free(pszDfltNetstrmDrvrCertFile);
|
||||
+ pszDfltNetstrmDrvrCertFile = NULL;
|
||||
+ free(LocalHostNameOverride);
|
||||
+ LocalHostNameOverride = NULL;
|
||||
+ free(pszWorkDir);
|
||||
+ pszWorkDir = NULL;
|
||||
bDropMalPTRMsgs = 0;
|
||||
bOptimizeUniProc = 1;
|
||||
bPreserveFQDN = 0;
|
||||
@@ -437,21 +463,14 @@ ENDObjClassInit(glbl)
|
||||
* rgerhards, 2008-04-17
|
||||
*/
|
||||
BEGINObjClassExit(glbl, OBJ_IS_CORE_MODULE) /* class, version */
|
||||
- if(pszDfltNetstrmDrvr != NULL)
|
||||
- free(pszDfltNetstrmDrvr);
|
||||
- if(pszDfltNetstrmDrvrCAF != NULL)
|
||||
- free(pszDfltNetstrmDrvrCAF);
|
||||
- if(pszDfltNetstrmDrvrKeyFile != NULL)
|
||||
- free(pszDfltNetstrmDrvrKeyFile);
|
||||
- if(pszDfltNetstrmDrvrCertFile != NULL)
|
||||
- free(pszDfltNetstrmDrvrCertFile);
|
||||
- if(pszWorkDir != NULL)
|
||||
- free(pszWorkDir);
|
||||
- if(LocalHostName != NULL)
|
||||
- free(LocalHostName);
|
||||
+ free(pszDfltNetstrmDrvr);
|
||||
+ free(pszDfltNetstrmDrvrCAF);
|
||||
+ free(pszDfltNetstrmDrvrKeyFile);
|
||||
+ free(pszDfltNetstrmDrvrCertFile);
|
||||
+ free(pszWorkDir);
|
||||
+ free(LocalHostName);
|
||||
free(LocalHostNameOverride);
|
||||
- if(LocalFQDNName != NULL)
|
||||
- free(LocalFQDNName);
|
||||
+ free(LocalFQDNName);
|
||||
objRelease(prop, CORE_COMPONENT);
|
||||
DESTROY_ATOMIC_HELPER_MUT(mutTerminateInputs);
|
||||
ENDObjClassExit(glbl)
|
||||
diff --git a/tools/syslogd.c b/tools/syslogd.c
|
||||
index 0b7bbc9..183decb 100644
|
||||
--- a/tools/syslogd.c
|
||||
+++ b/tools/syslogd.c
|
||||
@@ -154,6 +154,7 @@ DEFobjCurrIf(net) /* TODO: make go away! */
|
||||
|
||||
/* forward definitions */
|
||||
static rsRetVal GlobalClassExit(void);
|
||||
+static rsRetVal queryLocalHostname(void);
|
||||
|
||||
|
||||
#ifndef _PATH_LOGCONF
|
||||
@@ -1897,6 +1898,11 @@ DEFFUNC_llExecFunc(doHUPActions)
|
||||
* is *NOT* the sighup handler. The signal is recorded by the handler, that record
|
||||
* detected inside the mainloop and then this function is called to do the
|
||||
* real work. -- rgerhards, 2008-10-22
|
||||
+ * Note: there is a VERY slim chance of a data race when the hostname is reset.
|
||||
+ * We prefer to take this risk rather than sync all accesses, because to the best
|
||||
+ * of my analysis it can not really hurt (the actual property is reference-counted)
|
||||
+ * but the sync would require some extra CPU for *each* message processed.
|
||||
+ * rgerhards, 2012-04-11
|
||||
*/
|
||||
static inline void
|
||||
doHUP(void)
|
||||
@@ -1912,6 +1918,7 @@ doHUP(void)
|
||||
logmsgInternal(NO_ERRCODE, LOG_SYSLOG|LOG_INFO, (uchar*)buf, 0);
|
||||
}
|
||||
|
||||
+ queryLocalHostname(); /* re-read our name */
|
||||
ruleset.IterateAllActions(doHUPActions, NULL);
|
||||
}
|
||||
|
||||
@@ -2329,6 +2336,90 @@ GlobalClassExit(void)
|
||||
}
|
||||
|
||||
|
||||
+/* query our host and domain names - we need to do this early as we may emit
|
||||
+ * rgerhards, 2012-04-11
|
||||
+ */
|
||||
+static rsRetVal
|
||||
+queryLocalHostname(void)
|
||||
+{
|
||||
+ uchar *LocalHostName;
|
||||
+ uchar *LocalDomain;
|
||||
+ uchar *LocalFQDNName;
|
||||
+ uchar *p;
|
||||
+ struct hostent *hent;
|
||||
+ DEFiRet;
|
||||
+
|
||||
+ net.getLocalHostname(&LocalFQDNName);
|
||||
+ CHKmalloc(LocalHostName = (uchar*) strdup((char*)LocalFQDNName));
|
||||
+ glbl.SetLocalFQDNName(LocalFQDNName); /* set the FQDN before we modify it */
|
||||
+ if((p = (uchar*)strchr((char*)LocalHostName, '.'))) {
|
||||
+ *p++ = '\0';
|
||||
+ LocalDomain = p;
|
||||
+ } else {
|
||||
+ LocalDomain = (uchar*)"";
|
||||
+
|
||||
+ /* It's not clearly defined whether gethostname()
|
||||
+ * should return the simple hostname or the fqdn. A
|
||||
+ * good piece of software should be aware of both and
|
||||
+ * we want to distribute good software. Joey
|
||||
+ *
|
||||
+ * Good software also always checks its return values...
|
||||
+ * If syslogd starts up before DNS is up & /etc/hosts
|
||||
+ * doesn't have LocalHostName listed, gethostbyname will
|
||||
+ * return NULL.
|
||||
+ */
|
||||
+ /* TODO: gethostbyname() is not thread-safe, but replacing it is
|
||||
+ * not urgent as we do not run on multiple threads here. rgerhards, 2007-09-25
|
||||
+ */
|
||||
+ hent = gethostbyname((char*)LocalHostName);
|
||||
+ if(hent) {
|
||||
+ int i = 0;
|
||||
+
|
||||
+ if(hent->h_aliases) {
|
||||
+ size_t hnlen;
|
||||
+
|
||||
+ hnlen = strlen((char *) LocalHostName);
|
||||
+
|
||||
+ for (i = 0; hent->h_aliases[i]; i++) {
|
||||
+ if (!strncmp(hent->h_aliases[i], (char *) LocalHostName, hnlen)
|
||||
+ && hent->h_aliases[i][hnlen] == '.') {
|
||||
+ /* found a matching hostname */
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ free(LocalHostName);
|
||||
+ if(hent->h_aliases && hent->h_aliases[i]) {
|
||||
+ CHKmalloc(LocalHostName = (uchar*)strdup(hent->h_aliases[i]));
|
||||
+ } else {
|
||||
+ CHKmalloc(LocalHostName = (uchar*)strdup(hent->h_name));
|
||||
+ }
|
||||
+
|
||||
+ if((p = (uchar*)strchr((char*)LocalHostName, '.')))
|
||||
+ {
|
||||
+ *p++ = '\0';
|
||||
+ LocalDomain = p;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Convert to lower case to recognize the correct domain laterly */
|
||||
+ for(p = LocalDomain ; *p ; p++)
|
||||
+ *p = (char)tolower((int)*p);
|
||||
+
|
||||
+ /* we now have our hostname and can set it inside the global vars.
|
||||
+ * TODO: think if all of this would better be a runtime function
|
||||
+ * rgerhards, 2008-04-17
|
||||
+ */
|
||||
+ glbl.SetLocalHostName(LocalHostName);
|
||||
+ glbl.SetLocalDomain(LocalDomain);
|
||||
+ glbl.GenerateLocalHostNameProperty(); /* must be redone after conf processing, FQDN setting may have changed */
|
||||
+finalize_it:
|
||||
+ RETiRet;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/* some support for command line option parsing. Any non-trivial options must be
|
||||
* buffered until the complete command line has been parsed. This is necessary to
|
||||
* prevent dependencies between the options. That, in turn, means we need to have
|
||||
@@ -2530,9 +2621,7 @@ int realMain(int argc, char **argv)
|
||||
{
|
||||
DEFiRet;
|
||||
|
||||
- register uchar *p;
|
||||
int ch;
|
||||
- struct hostent *hent;
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
int bEOptionWasGiven = 0;
|
||||
@@ -2541,9 +2630,6 @@ int realMain(int argc, char **argv)
|
||||
int bChDirRoot = 1; /* change the current working directory to "/"? */
|
||||
char *arg; /* for command line option processing */
|
||||
uchar legacyConfLine[80];
|
||||
- uchar *LocalHostName;
|
||||
- uchar *LocalDomain;
|
||||
- uchar *LocalFQDNName;
|
||||
char cwdbuf[128]; /* buffer to obtain/display current working directory */
|
||||
|
||||
/* first, parse the command line options. We do not carry out any actual work, just
|
||||
@@ -2651,7 +2737,7 @@ int realMain(int argc, char **argv)
|
||||
|
||||
/* we need to create the inputName property (only once during our lifetime) */
|
||||
CHKiRet(prop.Construct(&pInternalInputName));
|
||||
- CHKiRet(prop.SetString(pInternalInputName, UCHAR_CONSTANT("rsyslogd"), sizeof("rsyslgod") - 1));
|
||||
+ CHKiRet(prop.SetString(pInternalInputName, UCHAR_CONSTANT("rsyslogd"), sizeof("rsyslogd") - 1));
|
||||
CHKiRet(prop.ConstructFinalize(pInternalInputName));
|
||||
|
||||
CHKiRet(prop.Construct(&pLocalHostIP));
|
||||
@@ -2661,72 +2747,7 @@ int realMain(int argc, char **argv)
|
||||
/* get our host and domain names - we need to do this early as we may emit
|
||||
* error log messages, which need the correct hostname. -- rgerhards, 2008-04-04
|
||||
*/
|
||||
- net.getLocalHostname(&LocalFQDNName);
|
||||
- CHKmalloc(LocalHostName = (uchar*) strdup((char*)LocalFQDNName));
|
||||
- glbl.SetLocalFQDNName(LocalFQDNName); /* set the FQDN before we modify it */
|
||||
- if((p = (uchar*)strchr((char*)LocalHostName, '.'))) {
|
||||
- *p++ = '\0';
|
||||
- LocalDomain = p;
|
||||
- } else {
|
||||
- LocalDomain = (uchar*)"";
|
||||
-
|
||||
- /* It's not clearly defined whether gethostname()
|
||||
- * should return the simple hostname or the fqdn. A
|
||||
- * good piece of software should be aware of both and
|
||||
- * we want to distribute good software. Joey
|
||||
- *
|
||||
- * Good software also always checks its return values...
|
||||
- * If syslogd starts up before DNS is up & /etc/hosts
|
||||
- * doesn't have LocalHostName listed, gethostbyname will
|
||||
- * return NULL.
|
||||
- */
|
||||
- /* TODO: gethostbyname() is not thread-safe, but replacing it is
|
||||
- * not urgent as we do not run on multiple threads here. rgerhards, 2007-09-25
|
||||
- */
|
||||
- hent = gethostbyname((char*)LocalHostName);
|
||||
- if(hent) {
|
||||
- int i = 0;
|
||||
-
|
||||
- if(hent->h_aliases) {
|
||||
- size_t hnlen;
|
||||
-
|
||||
- hnlen = strlen((char *) LocalHostName);
|
||||
-
|
||||
- for (i = 0; hent->h_aliases[i]; i++) {
|
||||
- if (!strncmp(hent->h_aliases[i], (char *) LocalHostName, hnlen)
|
||||
- && hent->h_aliases[i][hnlen] == '.') {
|
||||
- /* found a matching hostname */
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- free(LocalHostName);
|
||||
- if(hent->h_aliases && hent->h_aliases[i]) {
|
||||
- CHKmalloc(LocalHostName = (uchar*)strdup(hent->h_aliases[i]));
|
||||
- } else {
|
||||
- CHKmalloc(LocalHostName = (uchar*)strdup(hent->h_name));
|
||||
- }
|
||||
-
|
||||
- if((p = (uchar*)strchr((char*)LocalHostName, '.')))
|
||||
- {
|
||||
- *p++ = '\0';
|
||||
- LocalDomain = p;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /* Convert to lower case to recognize the correct domain laterly */
|
||||
- for(p = LocalDomain ; *p ; p++)
|
||||
- *p = (char)tolower((int)*p);
|
||||
-
|
||||
- /* we now have our hostname and can set it inside the global vars.
|
||||
- * TODO: think if all of this would better be a runtime function
|
||||
- * rgerhards, 2008-04-17
|
||||
- */
|
||||
- glbl.SetLocalHostName(LocalHostName);
|
||||
- glbl.SetLocalDomain(LocalDomain);
|
||||
- glbl.GenerateLocalHostNameProperty(); /* must be redone after conf processing, FQDN setting may have changed */
|
||||
+ queryLocalHostname();
|
||||
|
||||
/* initialize the objects */
|
||||
if((iRet = modInitIminternal()) != RS_RET_OK) {
|
||||
--
|
||||
1.7.7
|
||||
|
||||
|
||||
From 6e6bf2ded8b7478772fe9e30a9643844fb320ad4 Mon Sep 17 00:00:00 2001
|
||||
From: Rainer Gerhards <rgerhards@adiscon.com>
|
||||
Date: Wed, 11 Apr 2012 12:56:03 +0200
|
||||
Subject: [PATCH 2/5] doc: credits update for last bugfix
|
||||
|
||||
|
||||
Signed-off-by: Marius Tomaschewski <mt@suse.com>
|
||||
---
|
||||
ChangeLog | 3 ++-
|
||||
1 files changed, 2 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/ChangeLog b/ChangeLog
|
||||
index 31f5fe9..8a0d847 100644
|
||||
--- a/ChangeLog
|
||||
+++ b/ChangeLog
|
||||
@@ -1,7 +1,8 @@
|
||||
---------------------------------------------------------------------------
|
||||
Version 5.8.11 [V5-stable] 2012-04-??
|
||||
- bugfix: hostname was not requeried on HUP
|
||||
- Thanks to Marius Tomaschewski for reporting this bug.
|
||||
+ Thanks to Per Jessen for reporting this bug and Marius Tomaschewski for
|
||||
+ his help in testing the fix.
|
||||
---------------------------------------------------------------------------
|
||||
Version 5.8.10 [V5-stable] 2012-04-05
|
||||
- bugfix: segfault on startup if $actionqueuefilename was missing for disk
|
||||
--
|
||||
1.7.7
|
||||
|
||||
|
||||
From a3a0acadb4aa9d09bde3a6951557939b0a0eeda6 Mon Sep 17 00:00:00 2001
|
||||
From: Marius Tomaschewski <mt@suse.com>
|
||||
Date: Wed, 11 Apr 2012 14:39:42 +0200
|
||||
Subject: [PATCH 3/5] Allocate LocalDomain as new string
|
||||
|
||||
LocalDomain points to "" or the domain in LocalHostName,
|
||||
allocate as new string before passing to SetLocalDomain
|
||||
or free will fail later.
|
||||
|
||||
Signed-off-by: Marius Tomaschewski <mt@suse.com>
|
||||
---
|
||||
tools/syslogd.c | 3 +++
|
||||
1 files changed, 3 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/tools/syslogd.c b/tools/syslogd.c
|
||||
index 183decb..5e94bea 100644
|
||||
--- a/tools/syslogd.c
|
||||
+++ b/tools/syslogd.c
|
||||
@@ -2404,6 +2404,9 @@ queryLocalHostname(void)
|
||||
}
|
||||
}
|
||||
|
||||
+ /* LocalDomain is "" or part of LocalHostName, allocate a new string */
|
||||
+ CHKmalloc(LocalDomain = (uchar*)strdup(LocalDomain));
|
||||
+
|
||||
/* Convert to lower case to recognize the correct domain laterly */
|
||||
for(p = LocalDomain ; *p ; p++)
|
||||
*p = (char)tolower((int)*p);
|
||||
--
|
||||
1.7.7
|
||||
|
||||
|
||||
From b498a00e7805fbbc2fd1004b47ae2492e9c3da2f Mon Sep 17 00:00:00 2001
|
||||
From: Marius Tomaschewski <mt@suse.com>
|
||||
Date: Wed, 11 Apr 2012 14:53:07 +0200
|
||||
Subject: [PATCH 4/5] Free also LocalDomain in glbl class destructor
|
||||
|
||||
Signed-off-by: Marius Tomaschewski <mt@suse.com>
|
||||
---
|
||||
runtime/glbl.c | 1 +
|
||||
1 files changed, 1 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/runtime/glbl.c b/runtime/glbl.c
|
||||
index b6dc728..38e1f95 100644
|
||||
--- a/runtime/glbl.c
|
||||
+++ b/runtime/glbl.c
|
||||
@@ -468,6 +468,7 @@ BEGINObjClassExit(glbl, OBJ_IS_CORE_MODULE) /* class, version */
|
||||
free(pszDfltNetstrmDrvrKeyFile);
|
||||
free(pszDfltNetstrmDrvrCertFile);
|
||||
free(pszWorkDir);
|
||||
+ free(LocalDomain);
|
||||
free(LocalHostName);
|
||||
free(LocalHostNameOverride);
|
||||
free(LocalFQDNName);
|
||||
--
|
||||
1.7.7
|
||||
|
||||
|
||||
From d749dadcc30e35448894a152fb0ddf77d60b8300 Mon Sep 17 00:00:00 2001
|
||||
From: Rainer Gerhards <rgerhards@adiscon.com>
|
||||
Date: Thu, 12 Apr 2012 10:14:32 +0200
|
||||
Subject: [PATCH 5/5] imuxsock: do not cache hostname
|
||||
|
||||
|
||||
Signed-off-by: Marius Tomaschewski <mt@suse.com>
|
||||
---
|
||||
plugins/imuxsock/imuxsock.c | 14 ++++----------
|
||||
tools/syslogd.c | 2 +-
|
||||
2 files changed, 5 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
|
||||
index 5867f1c..9ad2421 100644
|
||||
--- a/plugins/imuxsock/imuxsock.c
|
||||
+++ b/plugins/imuxsock/imuxsock.c
|
||||
@@ -281,16 +281,16 @@ addLstnSocketName(void __attribute__((unused)) *pVal, uchar *pNewVal)
|
||||
} else {
|
||||
listeners[nfd].bParseHost = 0;
|
||||
}
|
||||
- CHKiRet(prop.Construct(&(listeners[nfd].hostName)));
|
||||
if(pLogHostName == NULL) {
|
||||
- CHKiRet(prop.SetString(listeners[nfd].hostName, glbl.GetLocalHostName(), ustrlen(glbl.GetLocalHostName())));
|
||||
+ listeners[nfd].hostName = NULL;
|
||||
} else {
|
||||
+ CHKiRet(prop.Construct(&(listeners[nfd].hostName)));
|
||||
CHKiRet(prop.SetString(listeners[nfd].hostName, pLogHostName, ustrlen(pLogHostName)));
|
||||
+ CHKiRet(prop.ConstructFinalize(listeners[nfd].hostName));
|
||||
/* reset hostname for next socket */
|
||||
free(pLogHostName);
|
||||
pLogHostName = NULL;
|
||||
}
|
||||
- CHKiRet(prop.ConstructFinalize(listeners[nfd].hostName));
|
||||
if(ratelimitInterval > 0) {
|
||||
if((listeners[nfd].ht = create_hashtable(100, hash_from_key_fn, key_equals_fn, NULL)) == NULL) {
|
||||
/* in this case, we simply turn of rate-limiting */
|
||||
@@ -602,7 +602,7 @@ SubmitMsg(uchar *pRcv, int lenRcv, lstn_t *pLstn, struct ucred *cred)
|
||||
pMsg->msgFlags = pLstn->flags;
|
||||
}
|
||||
|
||||
- MsgSetRcvFrom(pMsg, pLstn->hostName);
|
||||
+ MsgSetRcvFrom(pMsg, pLstn->hostName == NULL ? glbl.GetLocalHostNameProp() : pLstn->hostName);
|
||||
CHKiRet(MsgSetRcvFromIP(pMsg, pLocalHostIP));
|
||||
CHKiRet(submitMsg(pMsg));
|
||||
|
||||
@@ -864,7 +864,6 @@ CODESTARTafterRun
|
||||
|
||||
if(pInputName != NULL)
|
||||
prop.Destruct(&pInputName);
|
||||
-
|
||||
ENDafterRun
|
||||
|
||||
|
||||
@@ -958,11 +957,6 @@ CODEmodInit_QueryRegCFSLineHdlr
|
||||
CHKiRet(prop.SetString(pLocalHostIP, UCHAR_CONSTANT("127.0.0.1"), sizeof("127.0.0.1") - 1));
|
||||
CHKiRet(prop.ConstructFinalize(pLocalHostIP));
|
||||
|
||||
- /* now init listen socket zero, the local log socket */
|
||||
- CHKiRet(prop.Construct(&(listeners[0].hostName)));
|
||||
- CHKiRet(prop.SetString(listeners[0].hostName, glbl.GetLocalHostName(), ustrlen(glbl.GetLocalHostName())));
|
||||
- CHKiRet(prop.ConstructFinalize(listeners[0].hostName));
|
||||
-
|
||||
/* register config file handlers */
|
||||
CHKiRet(omsdRegCFSLineHdlr((uchar *)"omitlocallogging", 0, eCmdHdlrBinary,
|
||||
NULL, &bOmitLocalLogging, STD_LOADABLE_MODULE_ID));
|
||||
diff --git a/tools/syslogd.c b/tools/syslogd.c
|
||||
index 5e94bea..af63b11 100644
|
||||
--- a/tools/syslogd.c
|
||||
+++ b/tools/syslogd.c
|
||||
@@ -21,7 +21,7 @@
|
||||
* For further information, please see http://www.rsyslog.com
|
||||
*
|
||||
* rsyslog - An Enhanced syslogd Replacement.
|
||||
- * Copyright 2003-2009 Rainer Gerhards and Adiscon GmbH.
|
||||
+ * Copyright 2003-2012 Rainer Gerhards and Adiscon GmbH.
|
||||
*
|
||||
* This file is part of rsyslog.
|
||||
*
|
||||
--
|
||||
1.7.7
|
||||
|
3
rsyslog-5.8.10.tar.bz2
Normal file
3
rsyslog-5.8.10.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e18eeac3296ff839caae38d76d5834fae03544ca3b7ebdfc5d996b00d641e1c5
|
||||
size 1932752
|
@ -1,43 +0,0 @@
|
||||
From a738e3d5866a1dbbb1538b7461e266ec81cb1f45 Mon Sep 17 00:00:00 2001
|
||||
From: Marius Tomaschewski <mt@suse.com>
|
||||
Date: Mon, 20 Feb 2012 16:29:42 +0100
|
||||
Subject: [PATCH] Detect if to use /run/systemd/journal/syslog under systemd
|
||||
|
||||
Detect if we have to use the new /run/systemd/journal/syslog
|
||||
socket instead of the /dev/log under newer systemd versions.
|
||||
|
||||
Signed-off-by: Marius Tomaschewski <mt@suse.com>
|
||||
---
|
||||
plugins/imuxsock/imuxsock.c | 9 +++++++++
|
||||
1 files changed, 9 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
|
||||
index feddb20..767f9a9 100644
|
||||
--- a/plugins/imuxsock/imuxsock.c
|
||||
+++ b/plugins/imuxsock/imuxsock.c
|
||||
@@ -67,6 +67,9 @@ MODULE_TYPE_NOKEEP
|
||||
#define _PATH_LOG "/dev/log"
|
||||
#endif
|
||||
#endif
|
||||
+#ifndef SYSTEMD_PATH_LOG
|
||||
+#define SYSTEMD_PATH_LOG "/run/systemd/journal/syslog"
|
||||
+#endif
|
||||
|
||||
/* emulate struct ucred for platforms that do not have it */
|
||||
#ifndef HAVE_SCM_CREDENTIALS
|
||||
@@ -775,6 +778,12 @@ CODESTARTwillRun
|
||||
# endif
|
||||
if(pLogSockName != NULL)
|
||||
listeners[0].sockName = pLogSockName;
|
||||
+ else if(sd_booted()) {
|
||||
+ struct stat st;
|
||||
+ if(stat(SYSTEMD_PATH_LOG, &st) != -1 && S_ISSOCK(st.st_mode)) {
|
||||
+ listeners[0].sockName = SYSTEMD_PATH_LOG;
|
||||
+ }
|
||||
+ }
|
||||
if(ratelimitIntervalSysSock > 0) {
|
||||
if((listeners[0].ht = create_hashtable(100, hash_from_key_fn, key_equals_fn, NULL)) == NULL) {
|
||||
/* in this case, we simply turn of rate-limiting */
|
||||
--
|
||||
1.7.7
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6d43db0d7dbdefbdb0fce27ae70b304d53681ff5d8f6d823c761be4242bf5080
|
||||
size 1925789
|
@ -1,3 +1,30 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 12 09:22:38 UTC 2012 - mt@suse.com
|
||||
|
||||
- Added upstream patchset to requery hostname on HUP (bnc#755857)
|
||||
- Removed obsolete rsyslog-5.8.7-systemd-log-socket.patch
|
||||
- Updated to 5.8.10 [V5-stable] 2012-04-05:
|
||||
- bugfix: segfault on startup if $actionqueuefilename was missing
|
||||
for disk queue config. Thanks to Tomas Heinrich for the patch.
|
||||
- bugfix: segfault if disk-queue was started up with old queue file
|
||||
Thanks to Tomas Heinrich for the patch.
|
||||
- bugfix: memory leak in array passing output module mode
|
||||
by 5.8.9 [V5-stable] 2012-03-15:
|
||||
- added tool to recover disk queue if .qi file is missing
|
||||
(recover_qi.pl)
|
||||
Thanks to Kaiwang Chen for contributing this tool
|
||||
- bugfix: stopped DA queue was never processed after a restart
|
||||
due to a regression from statistics module.
|
||||
- added better doc for statsobj interface.
|
||||
Thanks to Kaiwang Chen for his suggestions and analysis in
|
||||
regard to the stats subsystem.
|
||||
by 5.8.8 [V5-stable] 2012-03-05:
|
||||
- bugfix: omprog made rsyslog abort on startup if not binary to
|
||||
execute was configured
|
||||
- bugfix: imklog invalidly computed facility and severity
|
||||
closes: http://bugzilla.adiscon.com/show_bug.cgi?id=313
|
||||
improves interop with systemd journal
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Feb 20 15:33:05 UTC 2012 - mt@suse.com
|
||||
|
||||
|
43
rsyslog.spec
43
rsyslog.spec
@ -15,12 +15,12 @@
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
# norootforbuild
|
||||
|
||||
|
||||
Name: rsyslog
|
||||
Summary: The enhanced syslogd for Linux and Unix
|
||||
Version: 5.8.7
|
||||
License: GPL-3.0+
|
||||
Group: System/Daemons
|
||||
Version: 5.8.10
|
||||
Release: 0
|
||||
# for setting those bcond_with* configs see
|
||||
# http://lizards.opensuse.org/2008/09/12/conditional-features-aka-use-flags/
|
||||
@ -56,10 +56,7 @@ Release: 0
|
||||
%define _libdir /%_lib
|
||||
%define rsyslog_module_dir_nodeps %{_libdir}/rsyslog/
|
||||
%define rsyslog_module_dir_withdeps %{_prefix}/%{_lib}/rsyslog/
|
||||
License: GPL-3.0+
|
||||
Group: System/Daemons
|
||||
Url: http://www.rsyslog.com/
|
||||
AutoReqProv: on
|
||||
Provides: syslog
|
||||
%if %{with syslogservice}
|
||||
Requires(pre): %insserv_prereq %fillup_prereq syslog-service /sbin/checkproc
|
||||
@ -87,8 +84,8 @@ BuildRequires: net-snmp-devel
|
||||
BuildRequires: postgresql-devel
|
||||
%endif
|
||||
%if %{with gnutls}
|
||||
BuildRequires: libgnutls-devel
|
||||
BuildRequires: libgcrypt-devel
|
||||
BuildRequires: libgnutls-devel
|
||||
%endif
|
||||
%if %{with dbi}
|
||||
BuildRequires: libdbi-devel
|
||||
@ -120,7 +117,7 @@ Source1: rsyslog.sysconfig
|
||||
Source2: rsyslog.conf.in
|
||||
Source3: rsyslog.early.conf.in
|
||||
Source4: rsyslog.d.remote.conf.in
|
||||
Patch1: rsyslog-5.8.7-systemd-log-socket.patch
|
||||
Patch1: 0001_5-bugfix-requery-hostname-on-HUP.patch
|
||||
|
||||
%description
|
||||
Rsyslog is an enhanced multi-threaded syslogd supporting, among others,
|
||||
@ -132,10 +129,9 @@ protected syslog relay chains while at the same time being very easy to
|
||||
setup for the novice user.
|
||||
|
||||
%package doc
|
||||
License: GPL-3.0+
|
||||
Group: System/Daemons
|
||||
Requires: %{name} = %{version}
|
||||
Summary: Additional documentation for rsyslog
|
||||
Group: System/Daemons
|
||||
|
||||
%description doc
|
||||
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
|
||||
@ -144,10 +140,9 @@ package.
|
||||
This package provides additional documentation for rsyslog.
|
||||
|
||||
%package diag-tools
|
||||
License: GPL-3.0+
|
||||
Group: System/Daemons
|
||||
Requires: %{name} = %{version}
|
||||
Summary: Diagnostic tools
|
||||
Group: System/Daemons
|
||||
|
||||
%description diag-tools
|
||||
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
|
||||
@ -159,10 +154,9 @@ usually not needed).
|
||||
%if %{with gssapi}
|
||||
|
||||
%package module-gssapi
|
||||
License: GPL-3.0+
|
||||
Group: System/Daemons
|
||||
Requires: %{name} = %{version}
|
||||
Summary: GSS-API support module for rsyslog
|
||||
Group: System/Daemons
|
||||
|
||||
%description module-gssapi
|
||||
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
|
||||
@ -175,10 +169,9 @@ network protected via Kerberos 5 encryption and authentication.
|
||||
%if %{with mysql}
|
||||
|
||||
%package module-mysql
|
||||
License: GPL-3.0+
|
||||
Group: System/Daemons
|
||||
Requires: %{name} = %{version}
|
||||
Summary: MySQL support module for rsyslog
|
||||
Group: System/Daemons
|
||||
|
||||
%description module-mysql
|
||||
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
|
||||
@ -191,10 +184,9 @@ databases.
|
||||
%if %{with pgsql}
|
||||
|
||||
%package module-pgsql
|
||||
License: GPL-3.0+
|
||||
Group: System/Daemons
|
||||
Requires: %{name} = %{version}
|
||||
Summary: PostgreSQL support module for rsyslog
|
||||
Group: System/Daemons
|
||||
|
||||
%description module-pgsql
|
||||
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
|
||||
@ -206,10 +198,9 @@ This module provides the support for logging into PostgreSQL databases.
|
||||
%if %{with dbi}
|
||||
|
||||
%package module-dbi
|
||||
License: GPL-3.0+
|
||||
Group: System/Daemons
|
||||
Requires: %{name} = %{version}
|
||||
Summary: Database support via DBI
|
||||
Group: System/Daemons
|
||||
|
||||
%description module-dbi
|
||||
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
|
||||
@ -222,10 +213,9 @@ supported databases.
|
||||
%if %{with snmp}
|
||||
|
||||
%package module-snmp
|
||||
License: GPL-3.0+
|
||||
Group: System/Daemons
|
||||
Requires: %{name} = %{version}
|
||||
Summary: SNMP support module for rsyslog
|
||||
Group: System/Daemons
|
||||
|
||||
%description module-snmp
|
||||
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
|
||||
@ -238,10 +228,9 @@ v2c traps.
|
||||
%if %{with gnutls}
|
||||
|
||||
%package module-gtls
|
||||
License: GPL-3.0+
|
||||
Group: System/Daemons
|
||||
Requires: %{name} = %{version}
|
||||
Summary: TLS encryption support module for rsyslog
|
||||
Group: System/Daemons
|
||||
|
||||
%description module-gtls
|
||||
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
|
||||
@ -254,10 +243,9 @@ on current syslog-transport-tls internet drafts).
|
||||
%if %{with relp}
|
||||
|
||||
%package module-relp
|
||||
License: GPL-3.0+
|
||||
Group: System/Daemons
|
||||
Requires: %{name} = %{version}
|
||||
Summary: RELP protocol support module for syslog
|
||||
Group: System/Daemons
|
||||
|
||||
%description module-relp
|
||||
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
|
||||
@ -268,10 +256,9 @@ This module provides Reliable Event Logging Protocol support.
|
||||
%endif
|
||||
|
||||
%package module-udpspoof
|
||||
License: GPL-3.0+
|
||||
Group: System/Daemons
|
||||
Requires: %{name} = %{version}
|
||||
Summary: UDP spoof support module for syslog
|
||||
Group: System/Daemons
|
||||
|
||||
%description module-udpspoof
|
||||
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
|
||||
|
Loading…
x
Reference in New Issue
Block a user