diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-01-18 14:08:24 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-01-18 14:08:24 +0100 |
commit | ac9afc4149db314d9c480232d70216960342e3e4 (patch) | |
tree | a35a772b89985b2e73b76ddedc28dd5e0b507bf6 /tools/syslogd.c | |
parent | e1e6ef71f4572de404d63a53f43c53c1b2b56803 (diff) | |
parent | 92f7e549df5a1333f037cf3b290e3087fd9ad5da (diff) | |
download | rsyslog-ac9afc4149db314d9c480232d70216960342e3e4.tar.gz rsyslog-ac9afc4149db314d9c480232d70216960342e3e4.tar.bz2 rsyslog-ac9afc4149db314d9c480232d70216960342e3e4.zip |
Merge branch 'v5-stable' into master
Conflicts:
ChangeLog
action.h
configure.ac
doc/manual.html
plugins/immark/immark.c
plugins/impstats/impstats.c
plugins/imptcp/imptcp.c
plugins/imtcp/imtcp.c
runtime/cfsysline.c
runtime/cfsysline.h
runtime/conf.c
runtime/ctok.c
runtime/ctok.h
runtime/ctok_token.c
runtime/ctok_token.h
runtime/dnscache.h
runtime/expr.c
runtime/expr.h
runtime/rule.c
runtime/rule.h
runtime/ruleset.h
runtime/sysvar.c
runtime/vm.h
runtime/vmop.c
runtime/vmop.h
runtime/vmprg.c
runtime/vmprg.h
runtime/vmstk.c
runtime/vmstk.h
tools/omusrmsg.c
Diffstat (limited to 'tools/syslogd.c')
-rw-r--r-- | tools/syslogd.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c index d1224f2d..a24bef68 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -1818,8 +1818,28 @@ int realMain(int argc, char **argv) */ 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); - CHKmalloc(LocalHostName = (uchar*)strdup(hent->h_name)); + 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, '.'))) { |