On Wed, Aug 13, 2003 at 03:18:19PM -0700, Justin Erenkrantz wrote: > - addr *may* be NULL when alloc_listener is invoked. Adding a NULL check > before doing the strcmp would indeed fix this problem, but prevents > listener reuse.
Since NULL only defines unqualified addresses, ie: "Listen 80" , any reuse on the same port will always fail. Would it be enough to simply do: if (sa) { apr_sockaddr_port_get(&oldport, sa); - if (!strcmp(sa->hostname, addr) && port == oldport) { + if (( !addr || strcmp(sa->hostname, add)) && port == oldport) { /* re-use existing record */ After all, if someone did: Listen 80 and then: Listen 127.0.0.1 80 Shouldnt the original socket get re-used ? Or alternatively an error delivered. > - We don't allow NULLs in sa->hostname. Then, we need to take the 'name' > returned by getaddrinfo() and store it. However, we would have to do this > resolution before we can do the walking as NULL may resolve to (say): > '0.0.0.0' or '::'. Only after calling apr_sockaddr_info_get would we know > which it resolves to. getaddrinfo won't return a 'name' in this situation though, even with AI_CANONAME set for ai_flags. the v6 call_resolver would have to detect the passive bind and hardcode '::' and '0.0.0.0' all over again :( -- Colm MacCárthaigh Public Key: [EMAIL PROTECTED] [EMAIL PROTECTED] http://www.stdlib.net/