From: oetiker Date: Sun, 4 Oct 2009 11:37:25 +0000 (+0000) Subject: rrd_client, rrd_daemon: Do not require hostnames to contain a dot. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2bf160a90e146af51f0cd3df6b6c3038a876287e;p=rrdtool-all.git rrd_client, rrd_daemon: Do not require hostnames to contain a dot. Non-FQDN (e.g. "localhost") are now supported as well. Anything that does not start with '[' should be (and is now) treated as [:]. -- Sebastian Harl git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1930 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/src/rrd_client.c b/program/src/rrd_client.c index 287f642d..a4f1ba9c 100644 --- a/program/src/rrd_client.c +++ b/program/src/rrd_client.c @@ -436,8 +436,8 @@ static int rrdc_connect_network (const char *addr_orig) /* {{{ */ rrd_set_error("garbage after address: %s", port); return (-1); } - } /* if (*addr = ']') */ - else if (strchr (addr, '.') != NULL) /* Hostname or IPv4 */ + } /* if (*addr == '[') */ + else { port = rindex(addr, ':'); if (port != NULL) diff --git a/program/src/rrd_daemon.c b/program/src/rrd_daemon.c index 81c58e1a..0ca1818d 100644 --- a/program/src/rrd_daemon.c +++ b/program/src/rrd_daemon.c @@ -2390,8 +2390,8 @@ static int open_listen_socket_network(const listen_socket_t *sock) /* {{{ */ fprintf (stderr, "rrdcached: Garbage after address: %s\n", port); return (-1); } - } /* if (*addr = ']') */ - else if (strchr (addr, '.') != NULL) /* Hostname or IPv4 */ + } /* if (*addr == '[') */ + else { port = rindex(addr, ':'); if (port != NULL)