[PATCH] rrd_client, rrd_daemon: Do not require hostnames to contain a dot.

2 messages Options
Embed this post
Permalink
Sebastian Harl

[PATCH] rrd_client, rrd_daemon: Do not require hostnames to contain a dot.

Reply Threaded More More options
Print post
Permalink
Non-FQDN (e.g. "localhost") are now supported as well. Anything that does not
start with '[' should be (and is now) treated as <name>[:<port>].
---
 program/src/rrd_client.c |    4 ++--
 program/src/rrd_daemon.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/program/src/rrd_client.c b/program/src/rrd_client.c
index 91d3547..23774f7 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 81c58e1..0ca1818 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)
--
1.6.5.rc2



_______________________________________________
rrd-developers mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

signature.asc (204 bytes) Download Attachment
oetiker

Re: [PATCH] rrd_client, rrd_daemon: Do not require hostnames to contain a dot.

Reply Threaded More More options
Print post
Permalink
Hi Sebastian,
Today Sebastian Harl wrote:

> Non-FQDN (e.g. "localhost") are now supported as well. Anything that does not
> start with '[' should be (and is now) treated as <name>[:<port>].

thanks,
applied
tobi

--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch [hidden email] ++41 62 775 9902 / sb: -9900

_______________________________________________
rrd-developers mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers