]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4162. [bug] httpdmgr->flags was not being initialized. [RT #40017]
authorMark Andrews <marka@isc.org>
Fri, 10 Jul 2015 08:42:20 +0000 (18:42 +1000)
committerMark Andrews <marka@isc.org>
Fri, 10 Jul 2015 08:44:16 +0000 (18:44 +1000)
(cherry picked from commit 0bc743f9bc0ad5989c9b2a65bf54d25c4f78d30d)

CHANGES
lib/isc/httpd.c

diff --git a/CHANGES b/CHANGES
index e3e02b56e7635ab46410a762b043d1d76c444b76..f10c9ab4478df9599fa55145b73288bb3905ef01 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+4162.  [bug]           httpdmgr->flags was not being initialized. [RT #40017]
+
 4159.  [cleanup]       Alphabetize dig's help output. [RT #39966]
 
 4158.  [protocol]      Support the printing of EDNS COOKIE and EXPIRE options.
index 55bd58432f4035fad32ebd89261f8173d45fd78a..4596ca736eed4b3ef4418e3816ae6106b81ea865 100644 (file)
@@ -237,39 +237,40 @@ isc_result_t
 isc_httpdmgr_create(isc_mem_t *mctx, isc_socket_t *sock, isc_task_t *task,
                    isc_httpdclientok_t *client_ok,
                    isc_httpdondestroy_t *ondestroy, void *cb_arg,
-                   isc_timermgr_t *tmgr, isc_httpdmgr_t **httpdp)
+                   isc_timermgr_t *tmgr, isc_httpdmgr_t **httpdmgrp)
 {
        isc_result_t result;
-       isc_httpdmgr_t *httpd;
+       isc_httpdmgr_t *httpdmgr;
 
        REQUIRE(mctx != NULL);
        REQUIRE(sock != NULL);
        REQUIRE(task != NULL);
        REQUIRE(tmgr != NULL);
-       REQUIRE(httpdp != NULL && *httpdp == NULL);
+       REQUIRE(httpdmgrp != NULL && *httpdmgrp == NULL);
 
-       httpd = isc_mem_get(mctx, sizeof(isc_httpdmgr_t));
-       if (httpd == NULL)
+       httpdmgr = isc_mem_get(mctx, sizeof(isc_httpdmgr_t));
+       if (httpdmgr == NULL)
                return (ISC_R_NOMEMORY);
 
-       result = isc_mutex_init(&httpd->lock);
+       result = isc_mutex_init(&httpdmgr->lock);
        if (result != ISC_R_SUCCESS) {
-               isc_mem_put(mctx, httpd, sizeof(isc_httpdmgr_t));
+               isc_mem_put(mctx, httpdmgr, sizeof(isc_httpdmgr_t));
                return (result);
        }
-       httpd->mctx = NULL;
-       isc_mem_attach(mctx, &httpd->mctx);
-       httpd->sock = NULL;
-       isc_socket_attach(sock, &httpd->sock);
-       httpd->task = NULL;
-       isc_task_attach(task, &httpd->task);
-       httpd->timermgr = tmgr; /* XXXMLG no attach function? */
-       httpd->client_ok = client_ok;
-       httpd->ondestroy = ondestroy;
-       httpd->cb_arg = cb_arg;
-
-       ISC_LIST_INIT(httpd->running);
-       ISC_LIST_INIT(httpd->urls);
+       httpdmgr->mctx = NULL;
+       isc_mem_attach(mctx, &httpdmgr->mctx);
+       httpdmgr->sock = NULL;
+       isc_socket_attach(sock, &httpdmgr->sock);
+       httpdmgr->task = NULL;
+       isc_task_attach(task, &httpdmgr->task);
+       httpdmgr->timermgr = tmgr; /* XXXMLG no attach function? */
+       httpdmgr->client_ok = client_ok;
+       httpdmgr->ondestroy = ondestroy;
+       httpdmgr->cb_arg = cb_arg;
+       httpdmgr->flags = 0;
+
+       ISC_LIST_INIT(httpdmgr->running);
+       ISC_LIST_INIT(httpdmgr->urls);
 
        /* XXXMLG ignore errors on isc_socket_listen() */
        result = isc_socket_listen(sock, SOMAXCONN);
@@ -282,22 +283,22 @@ isc_httpdmgr_create(isc_mem_t *mctx, isc_socket_t *sock, isc_task_t *task,
 
        (void)isc_socket_filter(sock, "httpready");
 
-       result = isc_socket_accept(sock, task, isc_httpd_accept, httpd);
+       result = isc_socket_accept(sock, task, isc_httpd_accept, httpdmgr);
        if (result != ISC_R_SUCCESS)
                goto cleanup;
 
-       httpd->render_404 = render_404;
-       httpd->render_500 = render_500;
+       httpdmgr->render_404 = render_404;
+       httpdmgr->render_500 = render_500;
 
-       *httpdp = httpd;
+       *httpdmgrp = httpdmgr;
        return (ISC_R_SUCCESS);
 
   cleanup:
-       isc_task_detach(&httpd->task);
-       isc_socket_detach(&httpd->sock);
-       isc_mem_detach(&httpd->mctx);
-       (void)isc_mutex_destroy(&httpd->lock);
-       isc_mem_put(mctx, httpd, sizeof(isc_httpdmgr_t));
+       isc_task_detach(&httpdmgr->task);
+       isc_socket_detach(&httpdmgr->sock);
+       isc_mem_detach(&httpdmgr->mctx);
+       (void)isc_mutex_destroy(&httpdmgr->lock);
+       isc_mem_put(mctx, httpdmgr, sizeof(isc_httpdmgr_t));
        return (result);
 }