From 1b890257da34d8204f148445194b1a35a34a5e40 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 11 Jun 2015 19:42:48 +1000 Subject: [PATCH] Preserve the name used in redirecturl config for the redirector --- src/ckpool.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ckpool.c b/src/ckpool.c index 554580ef..2d5b54a3 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -1262,7 +1262,8 @@ static bool parse_redirecturls(ckpool_t *ckp, const json_t *arr_val) { bool ret = false; int arr_size, i; - char redirecturl[INET6_ADDRSTRLEN], url[INET6_ADDRSTRLEN], port[8]; + char *redirecturl, url[INET6_ADDRSTRLEN], port[8]; + redirecturl = alloca(INET6_ADDRSTRLEN); if (!arr_val) goto out; @@ -1282,9 +1283,10 @@ static bool parse_redirecturls(ckpool_t *ckp, const json_t *arr_val) json_t *val = json_array_get(arr_val, i); strncpy(redirecturl, json_string_value(val), INET6_ADDRSTRLEN - 1); + /* See that the url properly resolves */ if (!url_from_serverurl(redirecturl, url, port)) quit(1, "Invalid redirecturl entry %d %s", i, redirecturl); - ckp->redirecturl[i] = strdup(url); + ckp->redirecturl[i] = strdup(strsep(&redirecturl, ":")); ckp->redirectport[i] = strdup(port); } ret = true;