2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-02 07:35:26 +00:00

4162. [bug] httpdmgr->flags was not being initialized. [RT #40017]

This commit is contained in:
Mark Andrews
2015-07-10 18:42:20 +10:00
parent 539c3f73b7
commit 0bc743f9bc
2 changed files with 31 additions and 28 deletions

View File

@@ -1,3 +1,5 @@
4162. [bug] httpdmgr->flags was not being initialized. [RT #40017]
4161. [test] Add JSON test for traffic size stats; also test 4161. [test] Add JSON test for traffic size stats; also test
for consistency between "rndc stats" and the XML for consistency between "rndc stats" and the XML
and JSON statistics channel contents. [RT #38700] and JSON statistics channel contents. [RT #38700]

View File

@@ -237,39 +237,40 @@ isc_result_t
isc_httpdmgr_create(isc_mem_t *mctx, isc_socket_t *sock, isc_task_t *task, isc_httpdmgr_create(isc_mem_t *mctx, isc_socket_t *sock, isc_task_t *task,
isc_httpdclientok_t *client_ok, isc_httpdclientok_t *client_ok,
isc_httpdondestroy_t *ondestroy, void *cb_arg, 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_result_t result;
isc_httpdmgr_t *httpd; isc_httpdmgr_t *httpdmgr;
REQUIRE(mctx != NULL); REQUIRE(mctx != NULL);
REQUIRE(sock != NULL); REQUIRE(sock != NULL);
REQUIRE(task != NULL); REQUIRE(task != NULL);
REQUIRE(tmgr != NULL); REQUIRE(tmgr != NULL);
REQUIRE(httpdp != NULL && *httpdp == NULL); REQUIRE(httpdmgrp != NULL && *httpdmgrp == NULL);
httpd = isc_mem_get(mctx, sizeof(isc_httpdmgr_t)); httpdmgr = isc_mem_get(mctx, sizeof(isc_httpdmgr_t));
if (httpd == NULL) if (httpdmgr == NULL)
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
result = isc_mutex_init(&httpd->lock); result = isc_mutex_init(&httpdmgr->lock);
if (result != ISC_R_SUCCESS) { 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); return (result);
} }
httpd->mctx = NULL; httpdmgr->mctx = NULL;
isc_mem_attach(mctx, &httpd->mctx); isc_mem_attach(mctx, &httpdmgr->mctx);
httpd->sock = NULL; httpdmgr->sock = NULL;
isc_socket_attach(sock, &httpd->sock); isc_socket_attach(sock, &httpdmgr->sock);
httpd->task = NULL; httpdmgr->task = NULL;
isc_task_attach(task, &httpd->task); isc_task_attach(task, &httpdmgr->task);
httpd->timermgr = tmgr; /* XXXMLG no attach function? */ httpdmgr->timermgr = tmgr; /* XXXMLG no attach function? */
httpd->client_ok = client_ok; httpdmgr->client_ok = client_ok;
httpd->ondestroy = ondestroy; httpdmgr->ondestroy = ondestroy;
httpd->cb_arg = cb_arg; httpdmgr->cb_arg = cb_arg;
httpdmgr->flags = 0;
ISC_LIST_INIT(httpd->running); ISC_LIST_INIT(httpdmgr->running);
ISC_LIST_INIT(httpd->urls); ISC_LIST_INIT(httpdmgr->urls);
/* XXXMLG ignore errors on isc_socket_listen() */ /* XXXMLG ignore errors on isc_socket_listen() */
result = isc_socket_listen(sock, SOMAXCONN); 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"); (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) if (result != ISC_R_SUCCESS)
goto cleanup; goto cleanup;
httpd->render_404 = render_404; httpdmgr->render_404 = render_404;
httpd->render_500 = render_500; httpdmgr->render_500 = render_500;
*httpdp = httpd; *httpdmgrp = httpdmgr;
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
cleanup: cleanup:
isc_task_detach(&httpd->task); isc_task_detach(&httpdmgr->task);
isc_socket_detach(&httpd->sock); isc_socket_detach(&httpdmgr->sock);
isc_mem_detach(&httpd->mctx); isc_mem_detach(&httpdmgr->mctx);
(void)isc_mutex_destroy(&httpd->lock); (void)isc_mutex_destroy(&httpdmgr->lock);
isc_mem_put(mctx, httpd, sizeof(isc_httpdmgr_t)); isc_mem_put(mctx, httpdmgr, sizeof(isc_httpdmgr_t));
return (result); return (result);
} }