Hi Amos,
I have just tested the squid-2 version of the patch, and it works fine.
Index: src/cache_cf.c
===================================================================
RCS file: /cvsroot/squid/squid/src/cache_cf.c,v
retrieving revision 1.510
diff -u -p -r1.510 cache_cf.c
--- src/cache_cf.c 21 May 2009 03:08:57 -0000 1.510
+++ src/cache_cf.c 30 May 2009 13:49:15 -0000
@@ -1765,6 +1765,23 @@ dump_peer(StoreEntry * entry, const char
}
}
+/*
+ * utility function to prevent getservbyname() being called with a
numeric value
+ * on Windows at least it returns garage results.
+ */
+static int
+isUnsignedNumeric(const char *str, size_t len)
+{
+ if (len < 1)
+ return 0;
+
+ for (; len > 0 && *str; str++, len--) {
+ if (!isdigit(*str))
+ return 0;
+ }
+ return 1;
+}
+
static u_short
GetService(const char *proto)
{
@@ -1774,7 +1791,8 @@ GetService(const char *proto)
self_destruct();
return -1; /* NEVER REACHED */
}
- port = getservbyname(token, proto);
+ if (!isUnsignedNumeric(token, strlen(token)))
+ port = getservbyname(token, proto);
if (port != NULL) {
return ntohs((u_short) port->s_port);
}
If there are no opposition, I will commit it tomorrow.
Regards
Guido
At 05.12 30/05/2009, Amos Jeffries wrote:
>The result of our discussions so far.
>Someone please double-check me then its in.
>
>Amos
>--
-
========================================================
Guido Serassio
Acme Consulting S.r.l. - Microsoft Certified Partner
Via Lucia Savarino, 1 10098 - Rivoli (TO) - ITALY
Tel. : +39.011.9530135 Fax. : +39.011.9781115
Email: guido.serassio_at_acmeconsulting.it
WWW: http://www.acmeconsulting.it/
Received on Sat May 30 2009 - 14:32:22 MDT
This archive was generated by hypermail 2.2.0 : Sun May 31 2009 - 12:00:02 MDT