The result of our discussions so far.
Someone please double-check me then its in.
Amos
--
Please be using
Current Stable Squid 2.7.STABLE6 or 3.0.STABLE15
Current Beta Squid 3.1.0.8 or 3.0.STABLE16-RC1
=== modified file 'src/cache_cf.cc'
--- src/cache_cf.cc 2009-05-08 11:22:30 +0000
+++ src/cache_cf.cc 2009-05-29 05:26:48 +0000
@@ -1609,6 +1609,22 @@
}
/**
+ * utility function to prevent getservbyname() being called with a numeric value
+ * on Windows at least it returns garage results.
+ */
+static bool
+isUnsignedNumeric(const char *str, size_t len)
+{
+ if (len < 1) return false;
+
+ for (; len >0 && *str; str++, len--) {
+ if (! isdigit(*str))
+ return false;
+ }
+ return true;
+}
+
+/**
\param proto 'tcp' or 'udp' for protocol
\returns Port the named service is supposed to be listening on.
*/
@@ -1623,7 +1639,8 @@
return 0; /* NEVER REACHED */
}
/** Returns either the service port number from /etc/services */
- port = getservbyname(token, proto);
+ if( !isUnsignedNumeric(token, strlen(token)) )
+ port = getservbyname(token, proto);
if (port != NULL) {
return ntohs((u_short)port->s_port);
}