r886 - trunk/varnish-cache/bin/varnishd

des at projects.linpro.no des at projects.linpro.no
Tue Aug 22 10:17:54 CEST 2006


Author: des
Date: 2006-08-22 10:17:54 +0200 (Tue, 22 Aug 2006)
New Revision: 886

Modified:
   trunk/varnish-cache/bin/varnishd/mgt_vcc.c
   trunk/varnish-cache/bin/varnishd/tcp.c
Log:
Allow an empty address if a port is specified; thus ":80" is a valid
listening address ("port 80 on all interfaces")

Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_vcc.c	2006-08-22 08:06:46 UTC (rev 885)
+++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c	2006-08-22 08:17:54 UTC (rev 886)
@@ -136,7 +136,7 @@
 		 * XXX: a bug for a backend to not reply at that time, so then
 		 * XXX: again: we should check it here in the "trivial" case.
 		 */
-		if (TCP_parse(b_arg, &addr, &port) != 0) {
+		if (TCP_parse(b_arg, &addr, &port) != 0 || addr == NULL) {
 			fprintf(stderr, "invalid backend address\n");
 			return (1);
 		}

Modified: trunk/varnish-cache/bin/varnishd/tcp.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/tcp.c	2006-08-22 08:06:46 UTC (rev 885)
+++ trunk/varnish-cache/bin/varnishd/tcp.c	2006-08-22 08:17:54 UTC (rev 886)
@@ -101,9 +101,8 @@
 		if (p == NULL) {
 			*addr = strdup(str);
 		} else {
-			if (p == str)
-				return (-1);
-			*addr = strndup(str, p - str);
+			if (p > str)
+				*addr = strndup(str, p - str);
 			*port = strdup(p + 1);
 		}
 	}




More information about the varnish-commit mailing list