summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-04-17 10:58:30 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-04-17 10:58:30 +0200
commite1791996b81b486e53a36ec753c3bb595f671983 (patch)
tree67f468124cda86d5898a755b9026c8b936925bed /runtime
parent4824e56aed37b5edffc883cb53c91f0b61c3df62 (diff)
downloadrsyslog-e1791996b81b486e53a36ec753c3bb595f671983.tar.gz
rsyslog-e1791996b81b486e53a36ec753c3bb595f671983.tar.xz
rsyslog-e1791996b81b486e53a36ec753c3bb595f671983.zip
moved host/domain-name related variables to global data pool
Diffstat (limited to 'runtime')
-rw-r--r--runtime/glbl.h4
-rw-r--r--runtime/net.c15
2 files changed, 11 insertions, 8 deletions
diff --git a/runtime/glbl.h b/runtime/glbl.h
index 3116b66b..eb0495b2 100644
--- a/runtime/glbl.h
+++ b/runtime/glbl.h
@@ -54,6 +54,10 @@ BEGINinterface(glbl) /* name must also be changed in ENDinterface macro! */
SIMP_PROP(DropMalPTRMsgs, int);
SIMP_PROP(Option_DisallowWarning, int);
SIMP_PROP(DisableDNS, int);
+ SIMP_PROP(LocalHostName, uchar*)
+ SIMP_PROP(LocalDomain, uchar*)
+ SIMP_PROP(StripDomains, char**)
+ SIMP_PROP(LocalHosts, char**)
#undef SIMP_PROP
ENDinterface(glbl)
#define glblCURR_IF_VERSION 1 /* increment whenever you change the interface structure! */
diff --git a/runtime/net.c b/runtime/net.c
index bc4404cb..777d3fad 100644
--- a/runtime/net.c
+++ b/runtime/net.c
@@ -55,7 +55,6 @@
#include <fcntl.h>
#include <unistd.h>
-#include "dirty.h"
#include "syslogd-types.h"
#include "module-template.h"
#include "parse.h"
@@ -814,7 +813,7 @@ rsRetVal cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN
*/
strcpy((char*)pszHost, (char*)pszHostFQDN);
if ((p = (uchar*) strchr((char*)pszHost, '.'))) { /* find start of domain name "machine.example.com" */
- if(strcmp((char*) (p + 1), LocalDomain) == 0) {
+ if(strcmp((char*)(p + 1), (char*)glbl.GetLocalDomain()) == 0) {
*p = '\0'; /* simply terminate the string */
} else {
/* now check if we belong to any of the domain names that were specified
@@ -823,10 +822,10 @@ rsRetVal cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN
* For proper modularization, this must be done different, e.g. via a
* "to be stripped" property of *this* object itself.
*/
- if (StripDomains) {
+ if(glbl.GetStripDomains() != NULL) {
count=0;
- while (StripDomains[count]) {
- if (strcmp((char*)(p + 1), StripDomains[count]) == 0) {
+ while(glbl.GetStripDomains()[count]) {
+ if (strcmp((char*)(p + 1), glbl.GetStripDomains()[count]) == 0) {
*p = '\0';
FINALIZE; /* we are done */
}
@@ -842,10 +841,10 @@ rsRetVal cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN
* still occurs at *p, which points at the first dot after the hostname.
* TODO: this must also go away - see comment above -- rgerhards, 2008-04-16
*/
- if (LocalHosts) {
+ if(glbl.GetLocalHosts() != NULL) {
count=0;
- while (LocalHosts[count]) {
- if (!strcmp((char*)pszHost, LocalHosts[count])) {
+ while (glbl.GetLocalHosts()[count]) {
+ if (!strcmp((char*)pszHost, (char*)glbl.GetLocalHosts()[count])) {
*p = '\0';
break; /* we are done */
}