summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-11-10 19:32:31 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-11-10 19:32:31 +0300
commit51e97ee24d8178c85002255af4eb920324946ff2 (patch)
treecdc9e3614a8234fbec8032db254f20191b613b60 /src
parent161f4d012cb00bf40853a0bb59f22d1373dbff53 (diff)
downloadrspamd-51e97ee24d8178c85002255af4eb920324946ff2.tar.gz
rspamd-51e97ee24d8178c85002255af4eb920324946ff2.zip
* Fix parsing '*' as hostname in bind lines
Diffstat (limited to 'src')
-rw-r--r--src/cfg_utils.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/cfg_utils.c b/src/cfg_utils.c
index dee5db850..f8518e164 100644
--- a/src/cfg_utils.c
+++ b/src/cfg_utils.c
@@ -78,14 +78,20 @@ parse_host_port (const char *str, struct in_addr *ina, uint16_t *port)
/* Now try to parse host and write address to ina */
if (!inet_aton (tokens[0], ina)) {
- /* Try to call gethostbyname */
- hent = gethostbyname (tokens[0]);
- if (hent == NULL) {
- msg_warn ("parse_host_port: cannot resolve %s", tokens[0]);
- goto err;
+ if (strcmp (tokens[0], "*") == 0) {
+ /* Special case */
+ ina->s_addr = htonl (INADDR_ANY);
}
else {
- memcpy (ina, hent->h_addr, sizeof (struct in_addr));
+ /* Try to call gethostbyname */
+ hent = gethostbyname (tokens[0]);
+ if (hent == NULL) {
+ msg_warn ("parse_host_port: cannot resolve %s", tokens[0]);
+ goto err;
+ }
+ else {
+ memcpy (ina, hent->h_addr, sizeof (struct in_addr));
+ }
}
}
if (tokens[1] != NULL) {