2964. [bug] view->queryacl was being overloaded. Seperate the
usage into view->queryacl, view->cacheacl and
view->queryonacl. [RT #22114]
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
2964. [bug] view->queryacl was being overloaded. Seperate the
|
||||
usage into view->queryacl, view->cacheacl and
|
||||
view->queryonacl. [RT #22114]
|
||||
|
||||
2962. [port] win32: add more dependencies to BINDBuild.dsw.
|
||||
[RT #22062]
|
||||
|
||||
|
||||
+3
-3
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: client.c,v 1.259.12.3 2009/01/29 22:40:33 jinmei Exp $ */
|
||||
/* $Id: client.c,v 1.259.12.4 2010/09/24 08:09:07 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -1859,13 +1859,13 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
||||
client->view->recursionacl,
|
||||
ISC_TRUE) == ISC_R_SUCCESS &&
|
||||
ns_client_checkaclsilent(client, NULL,
|
||||
client->view->queryacl,
|
||||
client->view->cacheacl,
|
||||
ISC_TRUE) == ISC_R_SUCCESS &&
|
||||
ns_client_checkaclsilent(client, &client->interface->addr,
|
||||
client->view->recursiononacl,
|
||||
ISC_TRUE) == ISC_R_SUCCESS &&
|
||||
ns_client_checkaclsilent(client, &client->interface->addr,
|
||||
client->view->queryonacl,
|
||||
client->view->cacheonacl,
|
||||
ISC_TRUE) == ISC_R_SUCCESS)
|
||||
ra = ISC_TRUE;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: query.h,v 1.40 2007/06/19 23:46:59 tbox Exp $ */
|
||||
/* $Id: query.h,v 1.40.332.1 2010/09/24 08:09:08 marka Exp $ */
|
||||
|
||||
#ifndef NAMED_QUERY_H
|
||||
#define NAMED_QUERY_H 1
|
||||
@@ -71,6 +71,8 @@ struct ns_query {
|
||||
#define NS_QUERYATTR_SECURE 0x0200
|
||||
#define NS_QUERYATTR_NOAUTHORITY 0x0400
|
||||
#define NS_QUERYATTR_NOADDITIONAL 0x0800
|
||||
#define NS_QUERYATTR_CACHEACLOKVALID 0x1000
|
||||
#define NS_QUERYATTR_CACHEACLOK 0x2000
|
||||
|
||||
isc_result_t
|
||||
ns_query_init(ns_client_t *client);
|
||||
|
||||
+11
-14
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: query.c,v 1.313.20.23 2010/09/15 12:16:49 marka Exp $ */
|
||||
/* $Id: query.c,v 1.313.20.24 2010/09/24 08:09:07 marka Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -820,17 +820,15 @@ query_getcachedb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype,
|
||||
return (DNS_R_REFUSED);
|
||||
dns_db_attach(client->view->cachedb, &db);
|
||||
|
||||
if ((client->query.attributes &
|
||||
NS_QUERYATTR_QUERYOKVALID) != 0) {
|
||||
if ((client->query.attributes & NS_QUERYATTR_CACHEACLOKVALID) != 0) {
|
||||
/*
|
||||
* We've evaluated the view's queryacl already. If
|
||||
* NS_QUERYATTR_QUERYOK is set, then the client is
|
||||
* We've evaluated the view's cacheacl already. If
|
||||
* NS_QUERYATTR_CACHEACLOK is set, then the client is
|
||||
* allowed to make queries, otherwise the query should
|
||||
* be refused.
|
||||
*/
|
||||
check_acl = ISC_FALSE;
|
||||
if ((client->query.attributes &
|
||||
NS_QUERYATTR_QUERYOK) == 0)
|
||||
if ((client->query.attributes & NS_QUERYATTR_CACHEACLOK) == 0)
|
||||
goto refuse;
|
||||
} else {
|
||||
/*
|
||||
@@ -844,16 +842,15 @@ query_getcachedb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype,
|
||||
char msg[NS_CLIENT_ACLMSGSIZE("query (cache)")];
|
||||
|
||||
result = ns_client_checkaclsilent(client, NULL,
|
||||
client->view->queryacl,
|
||||
client->view->cacheacl,
|
||||
ISC_TRUE);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
/*
|
||||
* We were allowed by the default
|
||||
* "allow-query" ACL. Remember this so we
|
||||
* don't have to check again.
|
||||
* We were allowed by the "allow-query-cache" ACL.
|
||||
* Remember this so we don't have to check again.
|
||||
*/
|
||||
client->query.attributes |=
|
||||
NS_QUERYATTR_QUERYOK;
|
||||
NS_QUERYATTR_CACHEACLOK;
|
||||
if (log && isc_log_wouldlog(ns_g_lctx,
|
||||
ISC_LOG_DEBUG(3)))
|
||||
{
|
||||
@@ -876,9 +873,9 @@ query_getcachedb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype,
|
||||
}
|
||||
/*
|
||||
* We've now evaluated the view's query ACL, and
|
||||
* the NS_QUERYATTR_QUERYOK attribute is now valid.
|
||||
* the NS_QUERYATTR_CACHEACLOKVALID attribute is now valid.
|
||||
*/
|
||||
client->query.attributes |= NS_QUERYATTR_QUERYOKVALID;
|
||||
client->query.attributes |= NS_QUERYATTR_CACHEACLOKVALID;
|
||||
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto refuse;
|
||||
|
||||
+18
-18
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: server.c,v 1.520.12.16 2010/08/20 00:19:53 marka Exp $ */
|
||||
/* $Id: server.c,v 1.520.12.17 2010/09/24 08:09:07 marka Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -1137,6 +1137,9 @@ configure_view(dns_view_t *view, const cfg_obj_t *config,
|
||||
dns_acache_setcachesize(view->acache, max_acache_size);
|
||||
}
|
||||
|
||||
CHECK(configure_view_acl(NULL, ns_g_config, "allow-query", actx,
|
||||
ns_g_mctx, &view->queryacl));
|
||||
|
||||
/*
|
||||
* Configure the zones.
|
||||
*/
|
||||
@@ -1611,13 +1614,13 @@ configure_view(dns_view_t *view, const cfg_obj_t *config,
|
||||
* configured in named.conf.
|
||||
*/
|
||||
CHECK(configure_view_acl(vconfig, config, "allow-query-cache",
|
||||
actx, ns_g_mctx, &view->queryacl));
|
||||
actx, ns_g_mctx, &view->cacheacl));
|
||||
CHECK(configure_view_acl(vconfig, config, "allow-query-cache-on",
|
||||
actx, ns_g_mctx, &view->queryonacl));
|
||||
if (view->queryonacl == NULL)
|
||||
actx, ns_g_mctx, &view->cacheonacl));
|
||||
if (view->cacheonacl == NULL)
|
||||
CHECK(configure_view_acl(NULL, ns_g_config,
|
||||
"allow-query-cache-on", actx,
|
||||
ns_g_mctx, &view->queryonacl));
|
||||
ns_g_mctx, &view->cacheonacl));
|
||||
if (strcmp(view->name, "_bind") != 0) {
|
||||
CHECK(configure_view_acl(vconfig, config, "allow-recursion",
|
||||
actx, ns_g_mctx,
|
||||
@@ -1633,14 +1636,14 @@ configure_view(dns_view_t *view, const cfg_obj_t *config,
|
||||
* "allow-recursion" inherits from "allow-query-cache" if set,
|
||||
* otherwise from "allow-query" if set.
|
||||
*/
|
||||
if (view->queryacl == NULL && view->recursionacl != NULL)
|
||||
dns_acl_attach(view->recursionacl, &view->queryacl);
|
||||
if (view->queryacl == NULL && view->recursion)
|
||||
if (view->cacheacl == NULL && view->recursionacl != NULL)
|
||||
dns_acl_attach(view->recursionacl, &view->cacheacl);
|
||||
if (view->cacheacl == NULL && view->recursion)
|
||||
CHECK(configure_view_acl(vconfig, config, "allow-query",
|
||||
actx, ns_g_mctx, &view->queryacl));
|
||||
actx, ns_g_mctx, &view->cacheacl));
|
||||
if (view->recursion &&
|
||||
view->recursionacl == NULL && view->queryacl != NULL)
|
||||
dns_acl_attach(view->queryacl, &view->recursionacl);
|
||||
view->recursionacl == NULL && view->cacheacl != NULL)
|
||||
dns_acl_attach(view->cacheacl, &view->recursionacl);
|
||||
|
||||
/*
|
||||
* Set default "allow-recursion", "allow-recursion-on" and
|
||||
@@ -1656,16 +1659,13 @@ configure_view(dns_view_t *view, const cfg_obj_t *config,
|
||||
"allow-recursion-on",
|
||||
actx, ns_g_mctx,
|
||||
&view->recursiononacl));
|
||||
if (view->queryacl == NULL) {
|
||||
if (view->cacheacl == NULL) {
|
||||
if (view->recursion)
|
||||
CHECK(configure_view_acl(NULL, ns_g_config,
|
||||
"allow-query-cache", actx,
|
||||
ns_g_mctx, &view->queryacl));
|
||||
else {
|
||||
if (view->queryacl != NULL)
|
||||
dns_acl_detach(&view->queryacl);
|
||||
CHECK(dns_acl_none(ns_g_mctx, &view->queryacl));
|
||||
}
|
||||
ns_g_mctx, &view->cacheacl));
|
||||
else
|
||||
CHECK(dns_acl_none(ns_g_mctx, &view->cacheacl));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: view.h,v 1.111.88.4 2009/01/29 22:40:35 jinmei Exp $ */
|
||||
/* $Id: view.h,v 1.111.88.5 2010/09/24 08:09:08 marka Exp $ */
|
||||
|
||||
#ifndef DNS_VIEW_H
|
||||
#define DNS_VIEW_H 1
|
||||
@@ -118,6 +118,8 @@ struct dns_view {
|
||||
isc_boolean_t enablevalidation;
|
||||
isc_boolean_t acceptexpired;
|
||||
dns_transfer_format_t transfer_format;
|
||||
dns_acl_t * cacheacl;
|
||||
dns_acl_t * cacheonacl;
|
||||
dns_acl_t * queryacl;
|
||||
dns_acl_t * queryonacl;
|
||||
dns_acl_t * recursionacl;
|
||||
|
||||
+7
-1
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: view.c,v 1.150.84.5 2010/02/25 10:56:41 tbox Exp $ */
|
||||
/* $Id: view.c,v 1.150.84.6 2010/09/24 08:09:08 marka Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -168,6 +168,8 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
|
||||
view->acceptexpired = ISC_FALSE;
|
||||
view->minimalresponses = ISC_FALSE;
|
||||
view->transfer_format = dns_one_answer;
|
||||
view->cacheacl = NULL;
|
||||
view->cacheonacl = NULL;
|
||||
view->queryacl = NULL;
|
||||
view->queryonacl = NULL;
|
||||
view->recursionacl = NULL;
|
||||
@@ -294,6 +296,10 @@ destroy(dns_view_t *view) {
|
||||
dns_acl_detach(&view->matchclients);
|
||||
if (view->matchdestinations != NULL)
|
||||
dns_acl_detach(&view->matchdestinations);
|
||||
if (view->cacheacl != NULL)
|
||||
dns_acl_detach(&view->cacheacl);
|
||||
if (view->cacheonacl != NULL)
|
||||
dns_acl_detach(&view->cacheonacl);
|
||||
if (view->queryacl != NULL)
|
||||
dns_acl_detach(&view->queryacl);
|
||||
if (view->queryonacl != NULL)
|
||||
|
||||
Reference in New Issue
Block a user