https://issues.apache.org/bugzilla/show_bug.cgi?id=44806
--- Comment #6 from D. Stussy <[EMAIL PROTECTED]> 2008-05-30 12:35:46 PST ---
Looking further at IPv6: apr_parse_addr_port() does most of the parsing
already - and it seems that IPv6 literals need to be enclosed in brackets
("[]"). The only thing that it doesn't handle is the +# at the end of this
(for the range) - so we would need to strip that off first. Using this routine
would probably be better as that way, parsing would be done in a consistent
manner. It also checks that the port is in the range 1-65535.
If not, then in the section reading:
+ if (!port) {
+ psf->bind_addr = arg;
shouldn't the arg also be duplicated?
+ psf->bind_addr = apr_pstrndup(parms->pool, arg, strlen(arg));
...or is it already in the pool?
Therefore, the command parsing part of the patch becomes:
@@ -1706,6 +1709,45 @@
return NULL;
}
+static const char*
+ set_proxy_bindaddr(cmd_parms *parms, void *dummy, const char *arg)
+{
+ char *host, *range, *scope_id;
+ apr_port_t port;
+ apr_status_t rv;
+ unsigned int x;
+
+ range = ap_strstr_c(arg, "+");
+ if (range) *range++ = 0;
+ x = range ? atoi(range) + 1 : 1;
+
+ if ((x < 1) || (x > 65534))
+ return "ProxyBindAddress: Invalid range - format is
<addr>:<port>+<range>";
+
+ rv = apr_parse_addr_port(&host, &scope_id, &port, arg, parms->pool);
+
+ if (rv != APR_SUCCESS)
+ return "ProxyBindAddress: Invalid address or port - format is
<addr>:<port>+<range>";
+
+ if (range && port)
+ return "ProxyBindAddress: Range requires valid port - format is
<addr>:<port>+<range>";
+
+ if (scope_id)
+ return "ProxyBindAddress: IPv6 Scope not valid here - format is
<addr>:<port>+<range>";
+
+ proxy_server_conf *psf =
+ ap_get_module_config(parms->server->module_config, &proxy_module);
+
+ if (!psf) return "ProxyBindAddress: Cannot allocate memory for internal
structure";
+
+ psf->bind_idx = 0;
+ psf->bind_addr = host;
+ psf->bind_port = (int) port; // maybe unsigned int?
+ psf->bind_range = x;
+ psf->bindopt_set = 1;
+ return NULL;
+}
+
static const char *add_member(cmd_parms *cmd, void *dummy, const char *arg)
{
server_rec *s = cmd->server;
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]