summaryrefslogtreecommitdiffstats
path: root/net.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-09-26 12:28:56 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-09-26 12:28:56 +0000
commita8ab44bc9f34c56875c8716d709472fcebd2a915 (patch)
treed56220bb0549c7f6fc524172218120780f60fa31 /net.c
parent88bbc402201c8bf088d310a9048bf38b77fb2f8e (diff)
downloadrsyslog-a8ab44bc9f34c56875c8716d709472fcebd2a915.tar.gz
rsyslog-a8ab44bc9f34c56875c8716d709472fcebd2a915.tar.xz
rsyslog-a8ab44bc9f34c56875c8716d709472fcebd2a915.zip
fixed a bug in cvthname() that lead to message loss if part of the source
hostname would have been dropped
Diffstat (limited to 'net.c')
-rw-r--r--net.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net.c b/net.c
index bcefad41..b6539846 100644
--- a/net.c
+++ b/net.c
@@ -190,8 +190,11 @@ rsRetVal gethname(struct sockaddr_storage *f, uchar *pszHostFQDN)
}
finalize_it:
+dbgprintf("hname() iRet: %d\n", iRet);
return iRet;
}
+
+
/* Return a printable representation of a host address.
* Now (2007-07-16) also returns the full host name (if it could be obtained)
* in the second param [thanks to mildew@gmail.com for the patch].
@@ -242,7 +245,6 @@ rsRetVal cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN
if ((p = (uchar*) strchr((char*)pszHost, '.'))) { /* find start of domain name "machine.example.com" */
if(strcmp((char*) (p + 1), LocalDomain) == 0) {
*p = '\0'; /* simply terminate the string */
- return 1;
} else {
/* now check if we belong to any of the domain names that were specified
* in the -s command line option. If so, remove and we are done.
@@ -252,7 +254,7 @@ rsRetVal cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN
while (StripDomains[count]) {
if (strcmp((char*)(p + 1), StripDomains[count]) == 0) {
*p = '\0';
- return 1;
+ FINALIZE; /* we are done */
}
count++;
}
@@ -270,7 +272,7 @@ rsRetVal cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN
while (LocalHosts[count]) {
if (!strcmp((char*)pszHost, LocalHosts[count])) {
*p = '\0';
- return 1;
+ break; /* we are done */
}
count++;
}
@@ -279,6 +281,7 @@ rsRetVal cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN
}
finalize_it:
+dbgprintf("cvthname() iRet: %d\n", iRet);
return iRet;
}