diff --git a/CHANGES b/CHANGES index 9e9a15f630..86bec10f5f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +1991. [cleanup] The configuration data, once read, should be treated + as readonly. Expand the use of const to enforce this + at compile time. [RT #15813] + 1990. [bug] libbind: isc's override of broken gettimeofday() implementions was not always effective. [RT #15709] diff --git a/bin/check/named-checkconf.c b/bin/check/named-checkconf.c index 83d3cd9441..98f24c3a58 100644 --- a/bin/check/named-checkconf.c +++ b/bin/check/named-checkconf.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: named-checkconf.c,v 1.12.2.1 2004/03/09 06:09:09 marka Exp $ */ +/* $Id: named-checkconf.c,v 1.12.2.2 2006/03/01 01:34:04 marka Exp $ */ #include @@ -45,9 +45,9 @@ usage(void) { } static isc_result_t -directory_callback(const char *clausename, cfg_obj_t *obj, void *arg) { +directory_callback(const char *clausename, const cfg_obj_t *obj, void *arg) { isc_result_t result; - char *directory; + const char *directory; REQUIRE(strcasecmp("directory", clausename) == 0); diff --git a/bin/named/aclconf.c b/bin/named/aclconf.c index ef684fcc2d..c2459f2a72 100644 --- a/bin/named/aclconf.c +++ b/bin/named/aclconf.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: aclconf.c,v 1.27.2.3 2005/03/17 03:59:29 marka Exp $ */ +/* $Id: aclconf.c,v 1.27.2.4 2006/03/01 01:34:04 marka Exp $ */ #include @@ -52,10 +52,10 @@ ns_aclconfctx_destroy(ns_aclconfctx_t *ctx) { * Find the definition of the named acl whose name is "name". */ static isc_result_t -get_acl_def(cfg_obj_t *cctx, char *name, cfg_obj_t **ret) { +get_acl_def(const cfg_obj_t *cctx, const char *name, const cfg_obj_t **ret) { isc_result_t result; - cfg_obj_t *acls = NULL; - cfg_listelt_t *elt; + const cfg_obj_t *acls = NULL; + const cfg_listelt_t *elt; result = cfg_map_get(cctx, "acl", &acls); if (result != ISC_R_SUCCESS) @@ -63,7 +63,7 @@ get_acl_def(cfg_obj_t *cctx, char *name, cfg_obj_t **ret) { for (elt = cfg_list_first(acls); elt != NULL; elt = cfg_list_next(elt)) { - cfg_obj_t *acl = cfg_listelt_value(elt); + const cfg_obj_t *acl = cfg_listelt_value(elt); const char *aclname = cfg_obj_asstring(cfg_tuple_get(acl, "name")); if (strcasecmp(aclname, name) == 0) { *ret = cfg_tuple_get(acl, "value"); @@ -74,15 +74,15 @@ get_acl_def(cfg_obj_t *cctx, char *name, cfg_obj_t **ret) { } static isc_result_t -convert_named_acl(cfg_obj_t *nameobj, cfg_obj_t *cctx, +convert_named_acl(const cfg_obj_t *nameobj, const cfg_obj_t *cctx, ns_aclconfctx_t *ctx, isc_mem_t *mctx, dns_acl_t **target) { isc_result_t result; - cfg_obj_t *cacl = NULL; + const cfg_obj_t *cacl = NULL; dns_acl_t *dacl; dns_acl_t loop; - char *aclname = cfg_obj_asstring(nameobj); + const char *aclname = cfg_obj_asstring(nameobj); /* Look for an already-converted version. */ for (dacl = ISC_LIST_HEAD(ctx->named_acl_cache); @@ -111,7 +111,7 @@ convert_named_acl(cfg_obj_t *nameobj, cfg_obj_t *cctx, */ memset(&loop, 0, sizeof(loop)); ISC_LINK_INIT(&loop, nextincache); - loop.name = aclname; + DE_CONST(aclname, loop.name); loop.magic = LOOP_MAGIC; ISC_LIST_APPEND(ctx->named_acl_cache, &loop, nextincache); result = ns_acl_fromconfig(cacl, cctx, ctx, mctx, &dacl); @@ -129,7 +129,7 @@ convert_named_acl(cfg_obj_t *nameobj, cfg_obj_t *cctx, } static isc_result_t -convert_keyname(cfg_obj_t *keyobj, isc_mem_t *mctx, dns_name_t *dnsname) { +convert_keyname(const cfg_obj_t *keyobj, isc_mem_t *mctx, dns_name_t *dnsname) { isc_result_t result; isc_buffer_t buf; dns_fixedname_t fixname; @@ -152,8 +152,8 @@ convert_keyname(cfg_obj_t *keyobj, isc_mem_t *mctx, dns_name_t *dnsname) { } isc_result_t -ns_acl_fromconfig(cfg_obj_t *caml, - cfg_obj_t *cctx, +ns_acl_fromconfig(const cfg_obj_t *caml, + const cfg_obj_t *cctx, ns_aclconfctx_t *ctx, isc_mem_t *mctx, dns_acl_t **target) @@ -162,7 +162,7 @@ ns_acl_fromconfig(cfg_obj_t *caml, unsigned int count; dns_acl_t *dacl = NULL; dns_aclelement_t *de; - cfg_listelt_t *elt; + const cfg_listelt_t *elt; REQUIRE(target != NULL && *target == NULL); @@ -181,7 +181,7 @@ ns_acl_fromconfig(cfg_obj_t *caml, elt != NULL; elt = cfg_list_next(elt)) { - cfg_obj_t *ce = cfg_listelt_value(elt); + const cfg_obj_t *ce = cfg_listelt_value(elt); if (cfg_obj_istuple(ce)) { /* This must be a negated element. */ ce = cfg_tuple_get(ce, "value"); @@ -213,7 +213,7 @@ ns_acl_fromconfig(cfg_obj_t *caml, goto cleanup; } else if (cfg_obj_isstring(ce)) { /* ACL name */ - char *name = cfg_obj_asstring(ce); + const char *name = cfg_obj_asstring(ce); if (strcasecmp(name, "localhost") == 0) { de->type = dns_aclelementtype_localhost; } else if (strcasecmp(name, "localnets") == 0) { diff --git a/bin/named/config.c b/bin/named/config.c index 57cbd8c378..b8e639fe39 100644 --- a/bin/named/config.c +++ b/bin/named/config.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: config.c,v 1.11.2.8 2006/01/04 23:50:16 marka Exp $ */ +/* $Id: config.c,v 1.11.2.9 2006/03/01 01:34:04 marka Exp $ */ #include @@ -156,7 +156,7 @@ ns_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf) { } isc_result_t -ns_config_get(cfg_obj_t **maps, const char* name, cfg_obj_t **obj) { +ns_config_get(const cfg_obj_t **maps, const char* name, const cfg_obj_t **obj) { int i; for (i = 0; ; i++) { @@ -168,8 +168,8 @@ ns_config_get(cfg_obj_t **maps, const char* name, cfg_obj_t **obj) { } int -ns_config_listcount(cfg_obj_t *list) { - cfg_listelt_t *e; +ns_config_listcount(const cfg_obj_t *list) { + const cfg_listelt_t *e; int i = 0; for (e = cfg_list_first(list); e != NULL; e = cfg_list_next(e)) @@ -179,9 +179,9 @@ ns_config_listcount(cfg_obj_t *list) { } isc_result_t -ns_config_getclass(cfg_obj_t *classobj, dns_rdataclass_t defclass, +ns_config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass, dns_rdataclass_t *classp) { - char *str; + const char *str; isc_textregion_t r; isc_result_t result; @@ -190,7 +190,7 @@ ns_config_getclass(cfg_obj_t *classobj, dns_rdataclass_t defclass, return (ISC_R_SUCCESS); } str = cfg_obj_asstring(classobj); - r.base = str; + DE_CONST(str, r.base); r.length = strlen(str); result = dns_rdataclass_fromtext(classp, &r); if (result != ISC_R_SUCCESS) @@ -200,9 +200,9 @@ ns_config_getclass(cfg_obj_t *classobj, dns_rdataclass_t defclass, } dns_zonetype_t -ns_config_getzonetype(cfg_obj_t *zonetypeobj) { +ns_config_getzonetype(const cfg_obj_t *zonetypeobj) { dns_zonetype_t ztype = dns_zone_none; - char *str; + const char *str; str = cfg_obj_asstring(zonetypeobj); if (strcasecmp(str, "master") == 0) @@ -217,14 +217,14 @@ ns_config_getzonetype(cfg_obj_t *zonetypeobj) { } isc_result_t -ns_config_getiplist(cfg_obj_t *config, cfg_obj_t *list, +ns_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list, in_port_t defport, isc_mem_t *mctx, isc_sockaddr_t **addrsp, isc_uint32_t *countp) { int count, i = 0; - cfg_obj_t *addrlist; - cfg_obj_t *portobj; - cfg_listelt_t *element; + const cfg_obj_t *addrlist; + const cfg_obj_t *portobj; + const cfg_listelt_t *element; isc_sockaddr_t *addrs; in_port_t port; isc_result_t result; @@ -283,15 +283,15 @@ ns_config_putiplist(isc_mem_t *mctx, isc_sockaddr_t **addrsp, } isc_result_t -ns_config_getipandkeylist(cfg_obj_t *config, cfg_obj_t *list, isc_mem_t *mctx, - isc_sockaddr_t **addrsp, dns_name_t ***keysp, - isc_uint32_t *countp) +ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list, + isc_mem_t *mctx, isc_sockaddr_t **addrsp, + dns_name_t ***keysp, isc_uint32_t *countp) { isc_uint32_t count, i = 0; isc_result_t result; - cfg_listelt_t *element; - cfg_obj_t *addrlist; - cfg_obj_t *portobj; + const cfg_listelt_t *element; + const cfg_obj_t *addrlist; + const cfg_obj_t *portobj; in_port_t port; dns_fixedname_t fname; isc_sockaddr_t *addrs = NULL; @@ -332,9 +332,9 @@ ns_config_getipandkeylist(cfg_obj_t *config, cfg_obj_t *list, isc_mem_t *mctx, element != NULL; element = cfg_list_next(element), i++) { - cfg_obj_t *addr; - cfg_obj_t *key; - char *keystr; + const cfg_obj_t *addr; + const cfg_obj_t *key; + const char *keystr; isc_buffer_t b; INSIST(i < count); @@ -415,10 +415,10 @@ ns_config_putipandkeylist(isc_mem_t *mctx, isc_sockaddr_t **addrsp, } isc_result_t -ns_config_getport(cfg_obj_t *config, in_port_t *portp) { - cfg_obj_t *maps[3]; - cfg_obj_t *options = NULL; - cfg_obj_t *portobj = NULL; +ns_config_getport(const cfg_obj_t *config, in_port_t *portp) { + const cfg_obj_t *maps[3]; + const cfg_obj_t *options = NULL; + const cfg_obj_t *portobj = NULL; isc_result_t result; int i; diff --git a/bin/named/controlconf.c b/bin/named/controlconf.c index ceb3e2e8a7..ba3b381ea2 100644 --- a/bin/named/controlconf.c +++ b/bin/named/controlconf.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: controlconf.c,v 1.28.2.13 2006/01/04 23:50:16 marka Exp $ */ +/* $Id: controlconf.c,v 1.28.2.14 2006/03/01 01:34:05 marka Exp $ */ #include @@ -656,10 +656,12 @@ ns_controls_shutdown(ns_controls_t *controls) { } static isc_result_t -cfgkeylist_find(cfg_obj_t *keylist, const char *keyname, cfg_obj_t **objp) { - cfg_listelt_t *element; +cfgkeylist_find(const cfg_obj_t *keylist, const char *keyname, + const cfg_obj_t **objp) +{ + const cfg_listelt_t *element; const char *str; - cfg_obj_t *obj; + const cfg_obj_t *obj; for (element = cfg_list_first(keylist); element != NULL; @@ -678,13 +680,13 @@ cfgkeylist_find(cfg_obj_t *keylist, const char *keyname, cfg_obj_t **objp) { } static isc_result_t -controlkeylist_fromcfg(cfg_obj_t *keylist, isc_mem_t *mctx, +controlkeylist_fromcfg(const cfg_obj_t *keylist, isc_mem_t *mctx, controlkeylist_t *keyids) { - cfg_listelt_t *element; + const cfg_listelt_t *element; char *newstr = NULL; const char *str; - cfg_obj_t *obj; + const cfg_obj_t *obj; controlkey_t *key = NULL; for (element = cfg_list_first(keylist); @@ -719,11 +721,11 @@ controlkeylist_fromcfg(cfg_obj_t *keylist, isc_mem_t *mctx, } static void -register_keys(cfg_obj_t *control, cfg_obj_t *keylist, +register_keys(const cfg_obj_t *control, const cfg_obj_t *keylist, controlkeylist_t *keyids, isc_mem_t *mctx, const char *socktext) { controlkey_t *keyid, *next; - cfg_obj_t *keydef; + const cfg_obj_t *keydef; char secret[1024]; isc_buffer_t b; isc_result_t result; @@ -743,10 +745,10 @@ register_keys(cfg_obj_t *control, cfg_obj_t *keylist, ISC_LIST_UNLINK(*keyids, keyid, link); free_controlkey(keyid, mctx); } else { - cfg_obj_t *algobj = NULL; - cfg_obj_t *secretobj = NULL; - char *algstr = NULL; - char *secretstr = NULL; + const cfg_obj_t *algobj = NULL; + const cfg_obj_t *secretobj = NULL; + const char *algstr = NULL; + const char *secretstr = NULL; (void)cfg_map_get(keydef, "algorithm", &algobj); (void)cfg_map_get(keydef, "secret", &secretobj); @@ -812,11 +814,11 @@ get_rndckey(isc_mem_t *mctx, controlkeylist_t *keyids) { isc_result_t result; cfg_parser_t *pctx = NULL; cfg_obj_t *config = NULL; - cfg_obj_t *key = NULL; - cfg_obj_t *algobj = NULL; - cfg_obj_t *secretobj = NULL; - char *algstr = NULL; - char *secretstr = NULL; + const cfg_obj_t *key = NULL; + const cfg_obj_t *algobj = NULL; + const cfg_obj_t *secretobj = NULL; + const char *algstr = NULL; + const char *secretstr = NULL; controlkey_t *keyid = NULL; char secret[1024]; isc_buffer_t b; @@ -895,12 +897,13 @@ get_rndckey(isc_mem_t *mctx, controlkeylist_t *keyids) { * valid or both are NULL. */ static void -get_key_info(cfg_obj_t *config, cfg_obj_t *control, - cfg_obj_t **global_keylistp, cfg_obj_t **control_keylistp) +get_key_info(const cfg_obj_t *config, const cfg_obj_t *control, + const cfg_obj_t **global_keylistp, + const cfg_obj_t **control_keylistp) { isc_result_t result; - cfg_obj_t *control_keylist = NULL; - cfg_obj_t *global_keylist = NULL; + const cfg_obj_t *control_keylist = NULL; + const cfg_obj_t *global_keylist = NULL; REQUIRE(global_keylistp != NULL && *global_keylistp == NULL); REQUIRE(control_keylistp != NULL && *control_keylistp == NULL); @@ -919,15 +922,15 @@ get_key_info(cfg_obj_t *config, cfg_obj_t *control, } static void -update_listener(ns_controls_t *cp, - controllistener_t **listenerp, cfg_obj_t *control, - cfg_obj_t *config, isc_sockaddr_t *addr, - ns_aclconfctx_t *aclconfctx, const char *socktext) +update_listener(ns_controls_t *cp, controllistener_t **listenerp, + const cfg_obj_t *control, const cfg_obj_t *config, + isc_sockaddr_t *addr, ns_aclconfctx_t *aclconfctx, + const char *socktext) { controllistener_t *listener; - cfg_obj_t *allow; - cfg_obj_t *global_keylist = NULL; - cfg_obj_t *control_keylist = NULL; + const cfg_obj_t *allow; + const cfg_obj_t *global_keylist = NULL; + const cfg_obj_t *control_keylist = NULL; dns_acl_t *new_acl = NULL; controlkeylist_t keys; isc_result_t result = ISC_R_SUCCESS; @@ -1037,14 +1040,15 @@ update_listener(ns_controls_t *cp, static void add_listener(ns_controls_t *cp, controllistener_t **listenerp, - cfg_obj_t *control, cfg_obj_t *config, isc_sockaddr_t *addr, - ns_aclconfctx_t *aclconfctx, const char *socktext) + const cfg_obj_t *control, const cfg_obj_t *config, + isc_sockaddr_t *addr, ns_aclconfctx_t *aclconfctx, + const char *socktext) { isc_mem_t *mctx = cp->server->mctx; controllistener_t *listener; - cfg_obj_t *allow; - cfg_obj_t *global_keylist = NULL; - cfg_obj_t *control_keylist = NULL; + const cfg_obj_t *allow; + const cfg_obj_t *global_keylist = NULL; + const cfg_obj_t *control_keylist = NULL; dns_acl_t *new_acl = NULL; isc_result_t result = ISC_R_SUCCESS; @@ -1155,13 +1159,13 @@ add_listener(ns_controls_t *cp, controllistener_t **listenerp, } isc_result_t -ns_controls_configure(ns_controls_t *cp, cfg_obj_t *config, +ns_controls_configure(ns_controls_t *cp, const cfg_obj_t *config, ns_aclconfctx_t *aclconfctx) { controllistener_t *listener; controllistenerlist_t new_listeners; - cfg_obj_t *controlslist = NULL; - cfg_listelt_t *element, *element2; + const cfg_obj_t *controlslist = NULL; + const cfg_listelt_t *element, *element2; char socktext[ISC_SOCKADDR_FORMATSIZE]; ISC_LIST_INIT(new_listeners); @@ -1183,8 +1187,8 @@ ns_controls_configure(ns_controls_t *cp, cfg_obj_t *config, for (element = cfg_list_first(controlslist); element != NULL; element = cfg_list_next(element)) { - cfg_obj_t *controls; - cfg_obj_t *inetcontrols = NULL; + const cfg_obj_t *controls; + const cfg_obj_t *inetcontrols = NULL; controls = cfg_listelt_value(element); (void)cfg_map_get(controls, "inet", &inetcontrols); @@ -1194,9 +1198,9 @@ ns_controls_configure(ns_controls_t *cp, cfg_obj_t *config, for (element2 = cfg_list_first(inetcontrols); element2 != NULL; element2 = cfg_list_next(element2)) { - cfg_obj_t *control; - cfg_obj_t *obj; - isc_sockaddr_t *addr; + const cfg_obj_t *control; + const cfg_obj_t *obj; + isc_sockaddr_t addr; /* * The parser handles BIND 8 configuration file @@ -1209,12 +1213,12 @@ ns_controls_configure(ns_controls_t *cp, cfg_obj_t *config, control = cfg_listelt_value(element2); obj = cfg_tuple_get(control, "address"); - addr = cfg_obj_assockaddr(obj); - if (isc_sockaddr_getport(addr) == 0) - isc_sockaddr_setport(addr, + addr = *cfg_obj_assockaddr(obj); + if (isc_sockaddr_getport(&addr) == 0) + isc_sockaddr_setport(&addr, NS_CONTROL_PORT); - isc_sockaddr_format(addr, socktext, + isc_sockaddr_format(&addr, socktext, sizeof(socktext)); isc_log_write(ns_g_lctx, @@ -1225,7 +1229,7 @@ ns_controls_configure(ns_controls_t *cp, cfg_obj_t *config, socktext); update_listener(cp, &listener, control, config, - addr, aclconfctx, socktext); + &addr, aclconfctx, socktext); if (listener != NULL) /* @@ -1239,7 +1243,7 @@ ns_controls_configure(ns_controls_t *cp, cfg_obj_t *config, * This is a new listener. */ add_listener(cp, &listener, control, - config, addr, aclconfctx, + config, &addr, aclconfctx, socktext); if (listener != NULL) diff --git a/bin/named/include/named/aclconf.h b/bin/named/include/named/aclconf.h index 639ce5686c..661b22db9a 100644 --- a/bin/named/include/named/aclconf.h +++ b/bin/named/include/named/aclconf.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: aclconf.h,v 1.12.2.1 2004/03/09 06:09:21 marka Exp $ */ +/* $Id: aclconf.h,v 1.12.2.2 2006/03/01 01:34:05 marka Exp $ */ #ifndef NS_ACLCONF_H #define NS_ACLCONF_H 1 @@ -49,8 +49,8 @@ ns_aclconfctx_destroy(ns_aclconfctx_t *ctx); */ isc_result_t -ns_acl_fromconfig(cfg_obj_t *caml, - cfg_obj_t *cctx, +ns_acl_fromconfig(const cfg_obj_t *caml, + const cfg_obj_t *cctx, ns_aclconfctx_t *ctx, isc_mem_t *mctx, dns_acl_t **target); diff --git a/bin/named/include/named/config.h b/bin/named/include/named/config.h index 3d97be62c7..0d8b4560c8 100644 --- a/bin/named/include/named/config.h +++ b/bin/named/include/named/config.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: config.h,v 1.4.2.1 2004/03/09 06:09:21 marka Exp $ */ +/* $Id: config.h,v 1.4.2.2 2006/03/01 01:34:05 marka Exp $ */ #ifndef NAMED_CONFIG_H #define NAMED_CONFIG_H 1 @@ -29,20 +29,20 @@ isc_result_t ns_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf); isc_result_t -ns_config_get(cfg_obj_t **maps, const char* name, cfg_obj_t **obj); +ns_config_get(const cfg_obj_t **maps, const char* name, const cfg_obj_t **obj); int -ns_config_listcount(cfg_obj_t *list); +ns_config_listcount(const cfg_obj_t *list); isc_result_t -ns_config_getclass(cfg_obj_t *classobj, dns_rdataclass_t defclass, +ns_config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass, dns_rdataclass_t *classp); dns_zonetype_t -ns_config_getzonetype(cfg_obj_t *zonetypeobj); +ns_config_getzonetype(const cfg_obj_t *zonetypeobj); isc_result_t -ns_config_getiplist(cfg_obj_t *config, cfg_obj_t *list, +ns_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list, in_port_t defport, isc_mem_t *mctx, isc_sockaddr_t **addrsp, isc_uint32_t *countp); @@ -51,16 +51,16 @@ ns_config_putiplist(isc_mem_t *mctx, isc_sockaddr_t **addrsp, isc_uint32_t count); isc_result_t -ns_config_getipandkeylist(cfg_obj_t *config, cfg_obj_t *list, isc_mem_t *mctx, - isc_sockaddr_t **addrsp, dns_name_t ***keys, - isc_uint32_t *countp); +ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list, + isc_mem_t *mctx, isc_sockaddr_t **addrsp, + dns_name_t ***keys, isc_uint32_t *countp); void ns_config_putipandkeylist(isc_mem_t *mctx, isc_sockaddr_t **addrsp, dns_name_t ***keys, isc_uint32_t count); isc_result_t -ns_config_getport(cfg_obj_t *config, in_port_t *portp); +ns_config_getport(const cfg_obj_t *config, in_port_t *portp); isc_result_t ns_config_getkeyalgorithm(const char *str, dns_name_t **name); diff --git a/bin/named/include/named/control.h b/bin/named/include/named/control.h index a805c00867..880865dea1 100644 --- a/bin/named/include/named/control.h +++ b/bin/named/include/named/control.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: control.h,v 1.6.2.3 2004/03/09 06:09:21 marka Exp $ */ +/* $Id: control.h,v 1.6.2.4 2006/03/01 01:34:05 marka Exp $ */ #ifndef NAMED_CONTROL_H #define NAMED_CONTROL_H 1 @@ -61,7 +61,7 @@ ns_controls_destroy(ns_controls_t **ctrlsp); */ isc_result_t -ns_controls_configure(ns_controls_t *controls, cfg_obj_t *config, +ns_controls_configure(ns_controls_t *controls, const cfg_obj_t *config, ns_aclconfctx_t *aclconfctx); /* * Configure zero or more command channels into 'controls' diff --git a/bin/named/include/named/globals.h b/bin/named/include/named/globals.h index d2a2250e92..7c90132127 100644 --- a/bin/named/include/named/globals.h +++ b/bin/named/include/named/globals.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: globals.h,v 1.59.2.1 2004/03/09 06:09:21 marka Exp $ */ +/* $Id: globals.h,v 1.59.2.2 2006/03/01 01:34:05 marka Exp $ */ #ifndef NAMED_GLOBALS_H #define NAMED_GLOBALS_H 1 @@ -73,7 +73,7 @@ EXTERN unsigned int ns_g_debuglevel INIT(0); * Current configuration information. */ EXTERN cfg_obj_t * ns_g_config INIT(NULL); -EXTERN cfg_obj_t * ns_g_defaults INIT(NULL); +EXTERN const cfg_obj_t * ns_g_defaults INIT(NULL); EXTERN const char * ns_g_conffile INIT(NS_SYSCONFDIR "/named.conf"); EXTERN const char * ns_g_keyfile INIT(NS_SYSCONFDIR diff --git a/bin/named/include/named/logconf.h b/bin/named/include/named/logconf.h index 9e0dbf1a78..3ae7747475 100644 --- a/bin/named/include/named/logconf.h +++ b/bin/named/include/named/logconf.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: logconf.h,v 1.10.2.1 2004/03/09 06:09:22 marka Exp $ */ +/* $Id: logconf.h,v 1.10.2.2 2006/03/01 01:34:05 marka Exp $ */ #ifndef NAMED_LOGCONF_H #define NAMED_LOGCONF_H 1 @@ -23,7 +23,7 @@ #include isc_result_t -ns_log_configure(isc_logconfig_t *logconf, cfg_obj_t *logstmt); +ns_log_configure(isc_logconfig_t *logconf, const cfg_obj_t *logstmt); /* * Set up the logging configuration in '*logconf' according to * the named.conf data in 'logstmt'. diff --git a/bin/named/include/named/lwresd.h b/bin/named/include/named/lwresd.h index 37af4d64ee..6a8bda51a5 100644 --- a/bin/named/include/named/lwresd.h +++ b/bin/named/include/named/lwresd.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lwresd.h,v 1.12.2.1 2004/03/09 06:09:22 marka Exp $ */ +/* $Id: lwresd.h,v 1.12.2.2 2006/03/01 01:34:05 marka Exp $ */ #ifndef NAMED_LWRESD_H #define NAMED_LWRESD_H 1 @@ -56,7 +56,7 @@ struct ns_lwreslistener { * Configure lwresd. */ isc_result_t -ns_lwresd_configure(isc_mem_t *mctx, cfg_obj_t *config); +ns_lwresd_configure(isc_mem_t *mctx, const cfg_obj_t *config); isc_result_t ns_lwresd_parseeresolvconf(isc_mem_t *mctx, cfg_parser_t *pctx, @@ -72,7 +72,8 @@ ns_lwresd_shutdown(void); * Manager functions */ isc_result_t -ns_lwdmanager_create(isc_mem_t *mctx, cfg_obj_t *lwres, ns_lwresd_t **lwresdp); +ns_lwdmanager_create(isc_mem_t *mctx, const cfg_obj_t *lwres, + ns_lwresd_t **lwresdp); void ns_lwdmanager_attach(ns_lwresd_t *source, ns_lwresd_t **targetp); diff --git a/bin/named/include/named/server.h b/bin/named/include/named/server.h index fc112d5ea8..06606b05c2 100644 --- a/bin/named/include/named/server.h +++ b/bin/named/include/named/server.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.h,v 1.58.2.3 2004/03/09 06:09:23 marka Exp $ */ +/* $Id: server.h,v 1.58.2.4 2006/03/01 01:34:05 marka Exp $ */ #ifndef NAMED_SERVER_H #define NAMED_SERVER_H 1 @@ -177,6 +177,6 @@ ns_server_status(ns_server_t *server, isc_buffer_t *text); * Maintain a list of dispatches that require reserved ports. */ void -ns_add_reserved_dispatch(ns_server_t *server, isc_sockaddr_t *addr); +ns_add_reserved_dispatch(ns_server_t *server, const isc_sockaddr_t *addr); #endif /* NAMED_SERVER_H */ diff --git a/bin/named/include/named/sortlist.h b/bin/named/include/named/sortlist.h index 7b520b75b8..7d4e77e39e 100644 --- a/bin/named/include/named/sortlist.h +++ b/bin/named/include/named/sortlist.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sortlist.h,v 1.4.2.1 2004/03/09 06:09:23 marka Exp $ */ +/* $Id: sortlist.h,v 1.4.2.2 2006/03/01 01:34:05 marka Exp $ */ #ifndef NAMED_SORTLIST_H #define NAMED_SORTLIST_H 1 @@ -28,7 +28,7 @@ * Type for callback functions that rank addresses. */ typedef int -(*dns_addressorderfunc_t)(isc_netaddr_t *address, void *arg); +(*dns_addressorderfunc_t)(const isc_netaddr_t *address, const void *arg); /* * Return value type for setup_sortlist. @@ -40,7 +40,8 @@ typedef enum { } ns_sortlisttype_t; ns_sortlisttype_t -ns_sortlist_setup(dns_acl_t *acl, isc_netaddr_t *clientaddr, void **argp); +ns_sortlist_setup(dns_acl_t *acl, isc_netaddr_t *clientaddr, + const void **argp); /* * Find the sortlist statement in 'acl' that applies to 'clientaddr', if any. * @@ -55,14 +56,14 @@ ns_sortlist_setup(dns_acl_t *acl, isc_netaddr_t *clientaddr, void **argp); */ int -ns_sortlist_addrorder1(isc_netaddr_t *addr, void *arg); +ns_sortlist_addrorder1(const isc_netaddr_t *addr, const void *arg); /* * Find the sort order of 'addr' in 'arg', the matching element * of a 1-element top-level sortlist statement. */ int -ns_sortlist_addrorder2(isc_netaddr_t *addr, void *arg); +ns_sortlist_addrorder2(const isc_netaddr_t *addr, const void *arg); /* * Find the sort order of 'addr' in 'arg', a topology-like * ACL forming the second element in a 2-element top-level @@ -72,7 +73,7 @@ ns_sortlist_addrorder2(isc_netaddr_t *addr, void *arg); void ns_sortlist_byaddrsetup(dns_acl_t *sortlist_acl, isc_netaddr_t *client_addr, dns_addressorderfunc_t *orderp, - void **argp); + const void **argp); /* * Find the sortlist statement in 'acl' that applies to 'clientaddr', if any. * If a sortlist statement applies, return in '*orderp' a pointer to a function diff --git a/bin/named/include/named/tkeyconf.h b/bin/named/include/named/tkeyconf.h index 87ba18f9ee..3946ca9ac0 100644 --- a/bin/named/include/named/tkeyconf.h +++ b/bin/named/include/named/tkeyconf.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: tkeyconf.h,v 1.9.2.1 2004/03/09 06:09:23 marka Exp $ */ +/* $Id: tkeyconf.h,v 1.9.2.2 2006/03/01 01:34:05 marka Exp $ */ #ifndef NS_TKEYCONF_H #define NS_TKEYCONF_H 1 @@ -28,8 +28,8 @@ ISC_LANG_BEGINDECLS isc_result_t -ns_tkeyctx_fromconfig(cfg_obj_t *options, isc_mem_t *mctx, isc_entropy_t *ectx, - dns_tkeyctx_t **tctxp); +ns_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx, + isc_entropy_t *ectx, dns_tkeyctx_t **tctxp); /* * Create a TKEY context and configure it, including the default DH key * and default domain, according to 'options'. diff --git a/bin/named/include/named/tsigconf.h b/bin/named/include/named/tsigconf.h index 05f1a9ef3c..8116cbf872 100644 --- a/bin/named/include/named/tsigconf.h +++ b/bin/named/include/named/tsigconf.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: tsigconf.h,v 1.9.2.1 2004/03/09 06:09:23 marka Exp $ */ +/* $Id: tsigconf.h,v 1.9.2.2 2006/03/01 01:34:05 marka Exp $ */ #ifndef NS_TSIGCONF_H #define NS_TSIGCONF_H 1 @@ -26,7 +26,7 @@ ISC_LANG_BEGINDECLS isc_result_t -ns_tsigkeyring_fromconfig(cfg_obj_t *config, cfg_obj_t *vconfig, +ns_tsigkeyring_fromconfig(const cfg_obj_t *config, const cfg_obj_t *vconfig, isc_mem_t *mctx, dns_tsig_keyring_t **ringp); /* * Create a TSIG key ring and configure it according to the 'key' diff --git a/bin/named/include/named/zoneconf.h b/bin/named/include/named/zoneconf.h index a3437858a5..67bce66b28 100644 --- a/bin/named/include/named/zoneconf.h +++ b/bin/named/include/named/zoneconf.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zoneconf.h,v 1.16.2.3 2004/03/09 06:09:23 marka Exp $ */ +/* $Id: zoneconf.h,v 1.16.2.4 2006/03/01 01:34:05 marka Exp $ */ #ifndef NS_ZONECONF_H #define NS_ZONECONF_H 1 @@ -30,8 +30,9 @@ ISC_LANG_BEGINDECLS isc_result_t -ns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig, - ns_aclconfctx_t *ac, dns_zone_t *zone); +ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, + const cfg_obj_t *zconfig, ns_aclconfctx_t *ac, + dns_zone_t *zone); /* * Configure or reconfigure a zone according to the named.conf * data in 'cctx' and 'czone'. @@ -48,7 +49,7 @@ ns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig, */ isc_boolean_t -ns_zone_reusable(dns_zone_t *zone, cfg_obj_t *zconfig); +ns_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig); /* * If 'zone' can be safely reconfigured according to the configuration * data in 'zconfig', return ISC_TRUE. If the configuration data is so diff --git a/bin/named/logconf.c b/bin/named/logconf.c index 6e87d5cd46..d5baa0a097 100644 --- a/bin/named/logconf.c +++ b/bin/named/logconf.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: logconf.c,v 1.30.2.5 2004/03/09 06:09:18 marka Exp $ */ +/* $Id: logconf.c,v 1.30.2.6 2006/03/01 01:34:05 marka Exp $ */ #include @@ -41,13 +41,13 @@ * in 'ccat' and add it to 'lctx'. */ static isc_result_t -category_fromconf(cfg_obj_t *ccat, isc_logconfig_t *lctx) { +category_fromconf(const cfg_obj_t *ccat, isc_logconfig_t *lctx) { isc_result_t result; const char *catname; isc_logcategory_t *category; isc_logmodule_t *module; - cfg_obj_t *destinations = NULL; - cfg_listelt_t *element = NULL; + const cfg_obj_t *destinations = NULL; + const cfg_listelt_t *element = NULL; catname = cfg_obj_asstring(cfg_tuple_get(ccat, "name")); category = isc_log_categorybyname(ns_g_lctx, catname); @@ -68,8 +68,8 @@ category_fromconf(cfg_obj_t *ccat, isc_logconfig_t *lctx) { element != NULL; element = cfg_list_next(element)) { - cfg_obj_t *channel = cfg_listelt_value(element); - char *channelname = cfg_obj_asstring(channel); + const cfg_obj_t *channel = cfg_listelt_value(element); + const char *channelname = cfg_obj_asstring(channel); result = isc_log_usechannel(lctx, channelname, category, module); @@ -89,18 +89,18 @@ category_fromconf(cfg_obj_t *ccat, isc_logconfig_t *lctx) { * in 'cchan' and add it to 'lctx'. */ static isc_result_t -channel_fromconf(cfg_obj_t *channel, isc_logconfig_t *lctx) { +channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *lctx) { isc_result_t result; isc_logdestination_t dest; unsigned int type; unsigned int flags = 0; int level; const char *channelname; - cfg_obj_t *fileobj = NULL; - cfg_obj_t *syslogobj = NULL; - cfg_obj_t *nullobj = NULL; - cfg_obj_t *stderrobj = NULL; - cfg_obj_t *severity = NULL; + const cfg_obj_t *fileobj = NULL; + const cfg_obj_t *syslogobj = NULL; + const cfg_obj_t *nullobj = NULL; + const cfg_obj_t *stderrobj = NULL; + const cfg_obj_t *severity = NULL; int i; channelname = cfg_obj_asstring(cfg_map_getname(channel)); @@ -130,9 +130,10 @@ channel_fromconf(cfg_obj_t *channel, isc_logconfig_t *lctx) { type = ISC_LOG_TONULL; if (fileobj != NULL) { - cfg_obj_t *pathobj = cfg_tuple_get(fileobj, "file"); - cfg_obj_t *sizeobj = cfg_tuple_get(fileobj, "size"); - cfg_obj_t *versionsobj = cfg_tuple_get(fileobj, "versions"); + const cfg_obj_t *pathobj = cfg_tuple_get(fileobj, "file"); + const cfg_obj_t *sizeobj = cfg_tuple_get(fileobj, "size"); + const cfg_obj_t *versionsobj = + cfg_tuple_get(fileobj, "versions"); isc_int32_t versions = ISC_LOG_ROLLNEVER; isc_offset_t size = 0; @@ -157,7 +158,7 @@ channel_fromconf(cfg_obj_t *channel, isc_logconfig_t *lctx) { type = ISC_LOG_TOSYSLOG; if (cfg_obj_isstring(syslogobj)) { - char *facilitystr = cfg_obj_asstring(syslogobj); + const char *facilitystr = cfg_obj_asstring(syslogobj); (void)isc_syslog_facilityfromstring(facilitystr, &facility); } @@ -174,9 +175,9 @@ channel_fromconf(cfg_obj_t *channel, isc_logconfig_t *lctx) { * Munge flags. */ { - cfg_obj_t *printcat = NULL; - cfg_obj_t *printsev = NULL; - cfg_obj_t *printtime = NULL; + const cfg_obj_t *printcat = NULL; + const cfg_obj_t *printsev = NULL; + const cfg_obj_t *printtime = NULL; (void)cfg_map_get(channel, "print-category", &printcat); (void)cfg_map_get(channel, "print-severity", &printsev); @@ -193,7 +194,7 @@ channel_fromconf(cfg_obj_t *channel, isc_logconfig_t *lctx) { level = ISC_LOG_INFO; if (cfg_map_get(channel, "severity", &severity) == ISC_R_SUCCESS) { if (cfg_obj_isstring(severity)) { - char *str = cfg_obj_asstring(severity); + const char *str = cfg_obj_asstring(severity); if (strcasecmp(str, "critical") == 0) level = ISC_LOG_CRITICAL; else if (strcasecmp(str, "error") == 0) @@ -242,13 +243,14 @@ channel_fromconf(cfg_obj_t *channel, isc_logconfig_t *lctx) { } isc_result_t -ns_log_configure(isc_logconfig_t *logconf, cfg_obj_t *logstmt) { +ns_log_configure(isc_logconfig_t *logconf, const cfg_obj_t *logstmt) { isc_result_t result; - cfg_obj_t *channels = NULL; - cfg_obj_t *categories = NULL; - cfg_listelt_t *element; + const cfg_obj_t *channels = NULL; + const cfg_obj_t *categories = NULL; + const cfg_listelt_t *element; isc_boolean_t default_set = ISC_FALSE; isc_boolean_t unmatched_set = ISC_FALSE; + const cfg_obj_t *catname; CHECK(ns_log_setdefaultchannels(logconf)); @@ -257,7 +259,7 @@ ns_log_configure(isc_logconfig_t *logconf, cfg_obj_t *logstmt) { element != NULL; element = cfg_list_next(element)) { - cfg_obj_t *channel = cfg_listelt_value(element); + const cfg_obj_t *channel = cfg_listelt_value(element); CHECK(channel_fromconf(channel, logconf)); } @@ -266,15 +268,15 @@ ns_log_configure(isc_logconfig_t *logconf, cfg_obj_t *logstmt) { element != NULL; element = cfg_list_next(element)) { - cfg_obj_t *category = cfg_listelt_value(element); + const cfg_obj_t *category = cfg_listelt_value(element); CHECK(category_fromconf(category, logconf)); if (!default_set) { - cfg_obj_t *catname = cfg_tuple_get(category, "name"); + catname = cfg_tuple_get(category, "name"); if (strcmp(cfg_obj_asstring(catname), "default") == 0) default_set = ISC_TRUE; } if (!unmatched_set) { - cfg_obj_t *catname = cfg_tuple_get(category, "name"); + catname = cfg_tuple_get(category, "name"); if (strcmp(cfg_obj_asstring(catname), "unmatched") == 0) unmatched_set = ISC_TRUE; } diff --git a/bin/named/lwdgabn.c b/bin/named/lwdgabn.c index d53a5df728..4cc2962031 100644 --- a/bin/named/lwdgabn.c +++ b/bin/named/lwdgabn.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lwdgabn.c,v 1.13.2.1 2004/03/09 06:09:18 marka Exp $ */ +/* $Id: lwdgabn.c,v 1.13.2.2 2006/03/01 01:34:05 marka Exp $ */ #include @@ -120,7 +120,7 @@ sort_addresses(ns_lwdclient_t *client) { rankedaddress *addrs; isc_netaddr_t remote; dns_addressorderfunc_t order; - void *arg; + const void *arg; ns_lwresd_t *lwresd = client->clientmgr->listener->manager; unsigned int i; isc_result_t result; diff --git a/bin/named/lwresd.c b/bin/named/lwresd.c index d37f43ed74..5b90457251 100644 --- a/bin/named/lwresd.c +++ b/bin/named/lwresd.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lwresd.c,v 1.37.2.5 2006/01/04 23:50:16 marka Exp $ */ +/* $Id: lwresd.c,v 1.37.2.6 2006/03/01 01:34:05 marka Exp $ */ /* * Main program for the Lightweight Resolver Daemon. @@ -285,14 +285,14 @@ ns_lwresd_parseeresolvconf(isc_mem_t *mctx, cfg_parser_t *pctx, * Handle lwresd manager objects */ isc_result_t -ns_lwdmanager_create(isc_mem_t *mctx, cfg_obj_t *lwres, +ns_lwdmanager_create(isc_mem_t *mctx, const cfg_obj_t *lwres, ns_lwresd_t **lwresdp) { ns_lwresd_t *lwresd; const char *vname; dns_rdataclass_t vclass; - cfg_obj_t *obj, *viewobj, *searchobj; - cfg_listelt_t *element; + const cfg_obj_t *obj, *viewobj, *searchobj; + const cfg_listelt_t *element; isc_result_t result; INSIST(lwresdp != NULL && *lwresdp == NULL); @@ -356,8 +356,8 @@ ns_lwdmanager_create(isc_mem_t *mctx, cfg_obj_t *lwres, element != NULL; element = cfg_list_next(element)) { - cfg_obj_t *search; - char *searchstr; + const cfg_obj_t *search; + const char *searchstr; isc_buffer_t namebuf; dns_fixedname_t fname; dns_name_t *name; @@ -739,11 +739,11 @@ configure_listener(isc_sockaddr_t *address, ns_lwresd_t *lwresd, } isc_result_t -ns_lwresd_configure(isc_mem_t *mctx, cfg_obj_t *config) { - cfg_obj_t *lwreslist = NULL; - cfg_obj_t *lwres = NULL; - cfg_obj_t *listenerslist = NULL; - cfg_listelt_t *element = NULL; +ns_lwresd_configure(isc_mem_t *mctx, const cfg_obj_t *config) { + const cfg_obj_t *lwreslist = NULL; + const cfg_obj_t *lwres = NULL; + const cfg_obj_t *listenerslist = NULL; + const cfg_listelt_t *element = NULL; ns_lwreslistener_t *listener; ns_lwreslistenerlist_t newlisteners; isc_result_t result; diff --git a/bin/named/query.c b/bin/named/query.c index 6a054635d2..8fc512c926 100644 --- a/bin/named/query.c +++ b/bin/named/query.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: query.c,v 1.198.2.24 2006/02/03 23:51:35 marka Exp $ */ +/* $Id: query.c,v 1.198.2.25 2006/03/01 01:34:05 marka Exp $ */ #include @@ -2278,7 +2278,7 @@ do { \ * ISC_R_NOTIMPLEMENTED The rdata is not a known address type. */ static isc_result_t -rdata_tonetaddr(dns_rdata_t *rdata, isc_netaddr_t *netaddr) { +rdata_tonetaddr(const dns_rdata_t *rdata, isc_netaddr_t *netaddr) { struct in_addr ina; struct in6_addr in6a; @@ -2304,7 +2304,7 @@ rdata_tonetaddr(dns_rdata_t *rdata, isc_netaddr_t *netaddr) { * sortlist statement. */ static int -query_sortlist_order_2element(dns_rdata_t *rdata, void *arg) { +query_sortlist_order_2element(const dns_rdata_t *rdata, const void *arg) { isc_netaddr_t netaddr; if (rdata_tonetaddr(rdata, &netaddr) != ISC_R_SUCCESS) @@ -2317,7 +2317,7 @@ query_sortlist_order_2element(dns_rdata_t *rdata, void *arg) { * of a 1-element top-level sortlist statement. */ static int -query_sortlist_order_1element(dns_rdata_t *rdata, void *arg) { +query_sortlist_order_1element(const dns_rdata_t *rdata, const void *arg) { isc_netaddr_t netaddr; if (rdata_tonetaddr(rdata, &netaddr) != ISC_R_SUCCESS) @@ -2333,7 +2333,7 @@ static void setup_query_sortlist(ns_client_t *client) { isc_netaddr_t netaddr; dns_rdatasetorderfunc_t order = NULL; - void *order_arg = NULL; + const void *order_arg = NULL; isc_netaddr_fromsockaddr(&netaddr, &client->peeraddr); switch (ns_sortlist_setup(client->view->sortlist, diff --git a/bin/named/server.c b/bin/named/server.c index d7bc186977..737afbcf40 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.339.2.36 2006/01/04 23:50:16 marka Exp $ */ +/* $Id: server.c,v 1.339.2.37 2006/03/01 01:34:05 marka Exp $ */ #include @@ -119,21 +119,21 @@ static void ns_server_reload(isc_task_t *task, isc_event_t *event); static isc_result_t -ns_listenelt_fromconfig(cfg_obj_t *listener, cfg_obj_t *config, +ns_listenelt_fromconfig(const cfg_obj_t *listener, const cfg_obj_t *config, ns_aclconfctx_t *actx, isc_mem_t *mctx, ns_listenelt_t **target); static isc_result_t -ns_listenlist_fromconfig(cfg_obj_t *listenlist, cfg_obj_t *config, +ns_listenlist_fromconfig(const cfg_obj_t *listenlist, const cfg_obj_t *config, ns_aclconfctx_t *actx, isc_mem_t *mctx, ns_listenlist_t **target); static isc_result_t -configure_forward(cfg_obj_t *config, dns_view_t *view, dns_name_t *origin, - cfg_obj_t *forwarders, cfg_obj_t *forwardtype); +configure_forward(const cfg_obj_t *config, dns_view_t *view, dns_name_t *origin, + const cfg_obj_t *forwarders, const cfg_obj_t *forwardtype); static isc_result_t -configure_zone(cfg_obj_t *config, cfg_obj_t *zconfig, cfg_obj_t *vconfig, - isc_mem_t *mctx, dns_view_t *view, +configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig, + const cfg_obj_t *vconfig, isc_mem_t *mctx, dns_view_t *view, ns_aclconfctx_t *aclconf); static void @@ -145,13 +145,13 @@ end_reserved_dispatches(ns_server_t *server, isc_boolean_t all); * (for a global default). */ static isc_result_t -configure_view_acl(cfg_obj_t *vconfig, cfg_obj_t *config, +configure_view_acl(const cfg_obj_t *vconfig, const cfg_obj_t *config, const char *aclname, ns_aclconfctx_t *actx, isc_mem_t *mctx, dns_acl_t **aclp) { isc_result_t result; - cfg_obj_t *maps[3]; - cfg_obj_t *aclobj = NULL; + const cfg_obj_t *maps[3]; + const cfg_obj_t *aclobj = NULL; int i = 0; if (*aclp != NULL) @@ -159,7 +159,7 @@ configure_view_acl(cfg_obj_t *vconfig, cfg_obj_t *config, if (vconfig != NULL) maps[i++] = cfg_tuple_get(vconfig, "options"); if (config != NULL) { - cfg_obj_t *options = NULL; + const cfg_obj_t *options = NULL; cfg_map_get(config, "options", &options); if (options != NULL) maps[i++] = options; @@ -180,13 +180,13 @@ configure_view_acl(cfg_obj_t *vconfig, cfg_obj_t *config, #ifdef ISC_RFC2535 static isc_result_t -configure_view_dnsseckey(cfg_obj_t *vconfig, cfg_obj_t *key, +configure_view_dnsseckey(const cfg_obj_t *vconfig, const cfg_obj_t *key, dns_keytable_t *keytable, isc_mem_t *mctx) { dns_rdataclass_t viewclass; dns_rdata_key_t keystruct; isc_uint32_t flags, proto, alg; - char *keystr, *keynamestr; + const char *keystr, *keynamestr; unsigned char keydata[4096]; isc_buffer_t keydatabuf; unsigned char rrdata[4096]; @@ -207,7 +207,7 @@ configure_view_dnsseckey(cfg_obj_t *vconfig, cfg_obj_t *key, if (vconfig == NULL) viewclass = dns_rdataclass_in; else { - cfg_obj_t *classobj = cfg_tuple_get(vconfig, "class"); + const cfg_obj_t *classobj = cfg_tuple_get(vconfig, "class"); CHECK(ns_config_getclass(classobj, dns_rdataclass_in, &viewclass)); } @@ -284,16 +284,16 @@ configure_view_dnsseckey(cfg_obj_t *vconfig, cfg_obj_t *key, * from 'vconfig' and 'config'. The variable to be configured is '*target'. */ static isc_result_t -configure_view_dnsseckeys(cfg_obj_t *vconfig, cfg_obj_t *config, +configure_view_dnsseckeys(const cfg_obj_t *vconfig, const cfg_obj_t *config, isc_mem_t *mctx, dns_keytable_t **target) { isc_result_t result; #ifdef ISC_RFC2535 - cfg_obj_t *keys = NULL; - cfg_obj_t *voptions = NULL; - cfg_listelt_t *element, *element2; - cfg_obj_t *keylist; - cfg_obj_t *key; + const cfg_obj_t *keys = NULL; + const cfg_obj_t *voptions = NULL; + const cfg_listelt_t *element, *element2; + const cfg_obj_t *keylist; + const cfg_obj_t *key; #endif dns_keytable_t *keytable = NULL; @@ -341,14 +341,14 @@ configure_view_dnsseckeys(cfg_obj_t *vconfig, cfg_obj_t *config, * Get a dispatch appropriate for the resolver of a given view. */ static isc_result_t -get_view_querysource_dispatch(cfg_obj_t **maps, +get_view_querysource_dispatch(const cfg_obj_t **maps, int af, dns_dispatch_t **dispatchp) { isc_result_t result; dns_dispatch_t *disp; isc_sockaddr_t sa; unsigned int attrs, attrmask; - cfg_obj_t *obj = NULL; + const cfg_obj_t *obj = NULL; /* * Make compiler happy. @@ -439,12 +439,12 @@ get_view_querysource_dispatch(cfg_obj_t **maps, } static isc_result_t -configure_peer(cfg_obj_t *cpeer, isc_mem_t *mctx, dns_peer_t **peerp) { - isc_sockaddr_t *sa; +configure_peer(const cfg_obj_t *cpeer, isc_mem_t *mctx, dns_peer_t **peerp) { + const isc_sockaddr_t *sa; isc_netaddr_t na; dns_peer_t *peer; - cfg_obj_t *obj; - char *str; + const cfg_obj_t *obj; + const char *str; isc_result_t result; sa = cfg_obj_assockaddr(cfg_map_getname(cpeer)); @@ -515,18 +515,19 @@ configure_peer(cfg_obj_t *cpeer, isc_mem_t *mctx, dns_peer_t **peerp) { * global defaults in 'config' used exclusively. */ static isc_result_t -configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, - isc_mem_t *mctx, ns_aclconfctx_t *actx) +configure_view(dns_view_t *view, const cfg_obj_t *config, + const cfg_obj_t *vconfig, isc_mem_t *mctx, + ns_aclconfctx_t *actx) { - cfg_obj_t *maps[4]; - cfg_obj_t *cfgmaps[3]; - cfg_obj_t *options = NULL; - cfg_obj_t *voptions = NULL; - cfg_obj_t *forwardtype; - cfg_obj_t *forwarders; - cfg_obj_t *zonelist; - cfg_obj_t *obj; - cfg_listelt_t *element; + const cfg_obj_t *maps[4]; + const cfg_obj_t *cfgmaps[3]; + const cfg_obj_t *options = NULL; + const cfg_obj_t *voptions = NULL; + const cfg_obj_t *forwardtype; + const cfg_obj_t *forwarders; + const cfg_obj_t *zonelist; + const cfg_obj_t *obj; + const cfg_listelt_t *element; in_port_t port; dns_cache_t *cache = NULL; isc_result_t result; @@ -539,7 +540,7 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, dns_dispatch_t *dispatch6 = NULL; isc_boolean_t reused_cache = ISC_FALSE; int i; - char *str; + const char *str; REQUIRE(DNS_VIEW_VALID(view)); @@ -584,7 +585,7 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, element != NULL; element = cfg_list_next(element)) { - cfg_obj_t *zconfig = cfg_listelt_value(element); + const cfg_obj_t *zconfig = cfg_listelt_value(element); CHECK(configure_zone(config, zconfig, vconfig, mctx, view, actx)); } @@ -742,8 +743,8 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, * Configure the view's peer list. */ { - cfg_obj_t *peers = NULL; - cfg_listelt_t *element; + const cfg_obj_t *peers = NULL; + const cfg_listelt_t *element; dns_peerlist_t *newpeers = NULL; (void)ns_config_get(cfgmaps, "server", &peers); @@ -752,7 +753,7 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, element != NULL; element = cfg_list_next(element)) { - cfg_obj_t *cpeer = cfg_listelt_value(element); + const cfg_obj_t *cpeer = cfg_listelt_value(element); dns_peer_t *peer; CHECK(configure_peer(cpeer, mctx, &peer)); @@ -913,8 +914,8 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, dns_fixedname_t fixed; dns_name_t *name; isc_buffer_t b; - char *str; - cfg_obj_t *exclude; + const char *str; + const cfg_obj_t *exclude; dns_fixedname_init(&fixed); name = dns_fixedname_name(&fixed); @@ -981,14 +982,16 @@ create_bind_view(dns_view_t **viewp) { * option or the global defaults. */ static isc_result_t -create_version_zone(cfg_obj_t **maps, dns_zonemgr_t *zmgr, dns_view_t *view) { +create_version_zone(const cfg_obj_t **maps, dns_zonemgr_t *zmgr, + dns_view_t *view) +{ isc_result_t result; dns_db_t *db = NULL; dns_zone_t *zone = NULL; dns_dbversion_t *dbver = NULL; dns_difftuple_t *tuple = NULL; dns_diff_t diff; - char *versiontext; + const char *versiontext; unsigned char buf[256]; isc_region_t r; size_t len; @@ -1002,7 +1005,7 @@ create_version_zone(cfg_obj_t **maps, dns_zonemgr_t *zmgr, dns_view_t *view) { "\0\0\0\0" /* expire */ "\0\0\0\0"; /* minimum */ dns_name_t origin; - cfg_obj_t *obj = NULL; + const cfg_obj_t *obj = NULL; dns_acl_t *acl = NULL; dns_diff_init(ns_g_mctx, &diff); @@ -1094,7 +1097,8 @@ create_version_zone(cfg_obj_t **maps, dns_zonemgr_t *zmgr, dns_view_t *view) { * The strings returned list the BIND 9 authors. */ static isc_result_t -create_authors_zone(cfg_obj_t *options, dns_zonemgr_t *zmgr, dns_view_t *view) +create_authors_zone(const cfg_obj_t *options, dns_zonemgr_t *zmgr, + dns_view_t *view) { isc_result_t result; dns_db_t *db = NULL; @@ -1130,7 +1134,7 @@ create_authors_zone(cfg_obj_t *options, dns_zonemgr_t *zmgr, dns_view_t *view) "\020Brian Wellington", NULL, }; - cfg_obj_t *obj = NULL; + const cfg_obj_t *obj = NULL; dns_acl_t *acl = NULL; /* @@ -1236,12 +1240,12 @@ configure_hints(dns_view_t *view, const char *filename) { } static isc_result_t -configure_forward(cfg_obj_t *config, dns_view_t *view, dns_name_t *origin, - cfg_obj_t *forwarders, cfg_obj_t *forwardtype) +configure_forward(const cfg_obj_t *config, dns_view_t *view, dns_name_t *origin, + const cfg_obj_t *forwarders, const cfg_obj_t *forwardtype) { - cfg_obj_t *portobj; - cfg_obj_t *faddresses; - cfg_listelt_t *element; + const cfg_obj_t *portobj; + const cfg_obj_t *faddresses; + const cfg_listelt_t *element; dns_fwdpolicy_t fwdpolicy = dns_fwdpolicy_none; isc_sockaddrlist_t addresses; isc_sockaddr_t *sa; @@ -1279,7 +1283,7 @@ configure_forward(cfg_obj_t *config, dns_view_t *view, dns_name_t *origin, element != NULL; element = cfg_list_next(element)) { - cfg_obj_t *forwarder = cfg_listelt_value(element); + const cfg_obj_t *forwarder = cfg_listelt_value(element); sa = isc_mem_get(view->mctx, sizeof(isc_sockaddr_t)); if (sa == NULL) { result = ISC_R_NOMEMORY; @@ -1302,7 +1306,7 @@ configure_forward(cfg_obj_t *config, dns_view_t *view, dns_name_t *origin, if (forwardtype == NULL) fwdpolicy = dns_fwdpolicy_first; else { - char *forwardstr = cfg_obj_asstring(forwardtype); + const char *forwardstr = cfg_obj_asstring(forwardtype); if (strcasecmp(forwardstr, "first") == 0) fwdpolicy = dns_fwdpolicy_first; else if (strcasecmp(forwardstr, "only") == 0) @@ -1344,14 +1348,16 @@ configure_forward(cfg_obj_t *config, dns_view_t *view, dns_name_t *origin, * The view created is attached to '*viewp'. */ static isc_result_t -create_view(cfg_obj_t *vconfig, dns_viewlist_t *viewlist, dns_view_t **viewp) { +create_view(const cfg_obj_t *vconfig, dns_viewlist_t *viewlist, + dns_view_t **viewp) +{ isc_result_t result; const char *viewname; dns_rdataclass_t viewclass; dns_view_t *view = NULL; if (vconfig != NULL) { - cfg_obj_t *classobj = NULL; + const cfg_obj_t *classobj = NULL; viewname = cfg_obj_asstring(cfg_tuple_get(vconfig, "name")); classobj = cfg_tuple_get(vconfig, "class"); @@ -1381,19 +1387,19 @@ create_view(cfg_obj_t *vconfig, dns_viewlist_t *viewlist, dns_view_t **viewp) { * Configure or reconfigure a zone. */ static isc_result_t -configure_zone(cfg_obj_t *config, cfg_obj_t *zconfig, cfg_obj_t *vconfig, - isc_mem_t *mctx, dns_view_t *view, +configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig, + const cfg_obj_t *vconfig, isc_mem_t *mctx, dns_view_t *view, ns_aclconfctx_t *aclconf) { dns_view_t *pview = NULL; /* Production view */ dns_zone_t *zone = NULL; /* New or reused zone */ dns_zone_t *dupzone = NULL; - cfg_obj_t *options = NULL; - cfg_obj_t *zoptions = NULL; - cfg_obj_t *typeobj = NULL; - cfg_obj_t *forwarders = NULL; - cfg_obj_t *forwardtype = NULL; - cfg_obj_t *only = NULL; + const cfg_obj_t *options = NULL; + const cfg_obj_t *zoptions = NULL; + const cfg_obj_t *typeobj = NULL; + const cfg_obj_t *forwarders = NULL; + const cfg_obj_t *forwardtype = NULL; + const cfg_obj_t *only = NULL; isc_result_t result; isc_result_t tresult; isc_buffer_t buffer; @@ -1450,7 +1456,7 @@ configure_zone(cfg_obj_t *config, cfg_obj_t *zconfig, cfg_obj_t *vconfig, * configure it and return. */ if (strcasecmp(ztypestr, "hint") == 0) { - cfg_obj_t *fileobj = NULL; + const cfg_obj_t *fileobj = NULL; if (cfg_map_get(zoptions, "file", &fileobj) != ISC_R_SUCCESS) { isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_ERROR, @@ -1460,7 +1466,7 @@ configure_zone(cfg_obj_t *config, cfg_obj_t *zconfig, cfg_obj_t *vconfig, goto cleanup; } if (dns_name_equal(origin, dns_rootname)) { - char *hintsfile = cfg_obj_asstring(fileobj); + const char *hintsfile = cfg_obj_asstring(fileobj); result = configure_hints(view, hintsfile); if (result != ISC_R_SUCCESS) { @@ -1614,9 +1620,10 @@ configure_zone(cfg_obj_t *config, cfg_obj_t *zconfig, cfg_obj_t *vconfig, * Configure a single server quota. */ static void -configure_server_quota(cfg_obj_t **maps, const char *name, isc_quota_t *quota) +configure_server_quota(const cfg_obj_t **maps, const char *name, + isc_quota_t *quota) { - cfg_obj_t *obj = NULL; + const cfg_obj_t *obj = NULL; isc_result_t result; result = ns_config_get(maps, name, &obj); @@ -1629,9 +1636,9 @@ configure_server_quota(cfg_obj_t **maps, const char *name, isc_quota_t *quota) * parsed. This can be extended to support other options if necessary. */ static isc_result_t -directory_callback(const char *clausename, cfg_obj_t *obj, void *arg) { +directory_callback(const char *clausename, const cfg_obj_t *obj, void *arg) { isc_result_t result; - char *directory; + const char *directory; REQUIRE(strcasecmp("directory", clausename) == 0); @@ -1740,11 +1747,12 @@ setdumpfile(ns_server_t *server, const char *name) { } static void -set_limit(cfg_obj_t **maps, const char *configname, const char *description, - isc_resource_t resourceid, isc_resourcevalue_t defaultvalue) +set_limit(const cfg_obj_t **maps, const char *configname, + const char *description, isc_resource_t resourceid, + isc_resourcevalue_t defaultvalue) { - cfg_obj_t *obj = NULL; - char *resource; + const cfg_obj_t *obj = NULL; + const char *resource; isc_resourcevalue_t value; isc_result_t result; @@ -1775,7 +1783,7 @@ set_limit(cfg_obj_t **maps, const char *configname, const char *description, ns_g_init ## resource) static void -set_limits(cfg_obj_t **maps) { +set_limits(const cfg_obj_t **maps) { SETLIMIT("stacksize", stacksize, "stack size"); SETLIMIT("datasize", datasize, "data size"); SETLIMIT("coresize", coresize, "core size"); @@ -1789,11 +1797,11 @@ load_configuration(const char *filename, ns_server_t *server, isc_result_t result; cfg_parser_t *parser = NULL; cfg_obj_t *config; - cfg_obj_t *options; - cfg_obj_t *views; - cfg_obj_t *obj; - cfg_obj_t *maps[3]; - cfg_listelt_t *element; + const cfg_obj_t *options; + const cfg_obj_t *views; + const cfg_obj_t *obj; + const cfg_obj_t *maps[3]; + const cfg_listelt_t *element; dns_view_t *view = NULL; dns_view_t *view_next; dns_viewlist_t viewlist; @@ -1932,7 +1940,7 @@ load_configuration(const char *filename, ns_server_t *server, * statement. */ { - cfg_obj_t *clistenon = NULL; + const cfg_obj_t *clistenon = NULL; ns_listenlist_t *listenon = NULL; clistenon = NULL; @@ -1966,7 +1974,7 @@ load_configuration(const char *filename, ns_server_t *server, * Ditto for IPv6. */ { - cfg_obj_t *clistenon = NULL; + const cfg_obj_t *clistenon = NULL; ns_listenlist_t *listenon = NULL; if (options != NULL) @@ -2049,7 +2057,7 @@ load_configuration(const char *filename, ns_server_t *server, element != NULL; element = cfg_list_next(element)) { - cfg_obj_t *vconfig; + const cfg_obj_t *vconfig; view = NULL; vconfig = cfg_listelt_value(element); @@ -2169,7 +2177,7 @@ load_configuration(const char *filename, ns_server_t *server, "ignoring config file logging " "statement due to -g option"); } else { - cfg_obj_t *logobj = NULL; + const cfg_obj_t *logobj = NULL; isc_logconfig_t *logc = NULL; CHECKM(isc_logconfig_create(ns_g_lctx, &logc), @@ -2208,19 +2216,19 @@ load_configuration(const char *filename, ns_server_t *server, * compatibility. */ if (first_time) { - cfg_obj_t *logobj = NULL; - cfg_obj_t *categories = NULL; + const cfg_obj_t *logobj = NULL; + const cfg_obj_t *categories = NULL; (void)cfg_map_get(config, "logging", &logobj); if (logobj != NULL) (void)cfg_map_get(logobj, "category", &categories); if (categories != NULL) { - cfg_listelt_t *element; + const cfg_listelt_t *element; for (element = cfg_list_first(categories); element != NULL; element = cfg_list_next(element)) { - cfg_obj_t *catobj; - char *str; + const cfg_obj_t *catobj; + const char *str; obj = cfg_listelt_value(element); catobj = cfg_tuple_get(obj, "name"); @@ -2627,7 +2635,7 @@ end_reserved_dispatches(ns_server_t *server, isc_boolean_t all) { } void -ns_add_reserved_dispatch(ns_server_t *server, isc_sockaddr_t *addr) { +ns_add_reserved_dispatch(ns_server_t *server, const isc_sockaddr_t *addr) { ns_dispatch_t *dispatch; in_port_t port; char addrbuf[ISC_SOCKADDR_FORMATSIZE]; @@ -2929,12 +2937,12 @@ ns_server_togglequerylog(ns_server_t *server) { } static isc_result_t -ns_listenlist_fromconfig(cfg_obj_t *listenlist, cfg_obj_t *config, +ns_listenlist_fromconfig(const cfg_obj_t *listenlist, const cfg_obj_t *config, ns_aclconfctx_t *actx, isc_mem_t *mctx, ns_listenlist_t **target) { isc_result_t result; - cfg_listelt_t *element; + const cfg_listelt_t *element; ns_listenlist_t *dlist = NULL; REQUIRE(target != NULL && *target == NULL); @@ -2948,7 +2956,7 @@ ns_listenlist_fromconfig(cfg_obj_t *listenlist, cfg_obj_t *config, element = cfg_list_next(element)) { ns_listenelt_t *delt = NULL; - cfg_obj_t *listener = cfg_listelt_value(element); + const cfg_obj_t *listener = cfg_listelt_value(element); result = ns_listenelt_fromconfig(listener, config, actx, mctx, &delt); if (result != ISC_R_SUCCESS) @@ -2968,12 +2976,12 @@ ns_listenlist_fromconfig(cfg_obj_t *listenlist, cfg_obj_t *config, * data structure. */ static isc_result_t -ns_listenelt_fromconfig(cfg_obj_t *listener, cfg_obj_t *config, +ns_listenelt_fromconfig(const cfg_obj_t *listener, const cfg_obj_t *config, ns_aclconfctx_t *actx, isc_mem_t *mctx, ns_listenelt_t **target) { isc_result_t result; - cfg_obj_t *portobj; + const cfg_obj_t *portobj; in_port_t port; ns_listenelt_t *delt = NULL; REQUIRE(target != NULL && *target == NULL); diff --git a/bin/named/sortlist.c b/bin/named/sortlist.c index 4e8cffbcc7..6f92af4e79 100644 --- a/bin/named/sortlist.c +++ b/bin/named/sortlist.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sortlist.c,v 1.5.2.1 2004/03/09 06:09:20 marka Exp $ */ +/* $Id: sortlist.c,v 1.5.2.2 2006/03/01 01:34:05 marka Exp $ */ #include @@ -30,7 +30,9 @@ #include ns_sortlisttype_t -ns_sortlist_setup(dns_acl_t *acl, isc_netaddr_t *clientaddr, void **argp) { +ns_sortlist_setup(dns_acl_t *acl, isc_netaddr_t *clientaddr, + const void **argp) +{ unsigned int i; if (acl == NULL) @@ -42,7 +44,7 @@ ns_sortlist_setup(dns_acl_t *acl, isc_netaddr_t *clientaddr, void **argp) { * in the sortlist (see ARM). */ dns_aclelement_t *e = &acl->elements[i]; - dns_aclelement_t *matchelt = NULL; + const dns_aclelement_t *matchelt = NULL; dns_acl_t *inner; if (e->type != dns_aclelementtype_nestedacl) @@ -88,8 +90,8 @@ ns_sortlist_setup(dns_acl_t *acl, isc_netaddr_t *clientaddr, void **argp) { } int -ns_sortlist_addrorder2(isc_netaddr_t *addr, void *arg) { - dns_acl_t *sortacl = (dns_acl_t *) arg; +ns_sortlist_addrorder2(const isc_netaddr_t *addr, const void *arg) { + const dns_acl_t *sortacl = (const dns_acl_t *) arg; int match; (void)dns_acl_match(addr, NULL, sortacl, @@ -104,8 +106,8 @@ ns_sortlist_addrorder2(isc_netaddr_t *addr, void *arg) { } int -ns_sortlist_addrorder1(isc_netaddr_t *addr, void *arg) { - dns_aclelement_t *matchelt = (dns_aclelement_t *) arg; +ns_sortlist_addrorder1(const isc_netaddr_t *addr, const void *arg) { + const dns_aclelement_t *matchelt = (const dns_aclelement_t *) arg; if (dns_aclelement_match(addr, NULL, matchelt, &ns_g_server->aclenv, NULL)) { @@ -118,7 +120,7 @@ ns_sortlist_addrorder1(isc_netaddr_t *addr, void *arg) { void ns_sortlist_byaddrsetup(dns_acl_t *sortlist_acl, isc_netaddr_t *client_addr, dns_addressorderfunc_t *orderp, - void **argp) + const void **argp) { ns_sortlisttype_t sortlisttype; diff --git a/bin/named/tkeyconf.c b/bin/named/tkeyconf.c index 0f7dad6d38..bab4585ea3 100644 --- a/bin/named/tkeyconf.c +++ b/bin/named/tkeyconf.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: tkeyconf.c,v 1.19.2.1 2004/03/09 06:09:20 marka Exp $ */ +/* $Id: tkeyconf.c,v 1.19.2.2 2006/03/01 01:34:05 marka Exp $ */ #include @@ -42,17 +42,17 @@ isc_result_t -ns_tkeyctx_fromconfig(cfg_obj_t *options, isc_mem_t *mctx, isc_entropy_t *ectx, - dns_tkeyctx_t **tctxp) +ns_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx, + isc_entropy_t *ectx, dns_tkeyctx_t **tctxp) { isc_result_t result; dns_tkeyctx_t *tctx = NULL; - char *s; + const char *s; isc_uint32_t n; dns_fixedname_t fname; dns_name_t *name; isc_buffer_t b; - cfg_obj_t *obj; + const cfg_obj_t *obj; result = dns_tkeyctx_create(mctx, ectx, &tctx); if (result != ISC_R_SUCCESS) diff --git a/bin/named/tsigconf.c b/bin/named/tsigconf.c index 03f887abed..4a15eada9a 100644 --- a/bin/named/tsigconf.c +++ b/bin/named/tsigconf.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: tsigconf.c,v 1.21.2.1 2004/03/09 06:09:20 marka Exp $ */ +/* $Id: tsigconf.c,v 1.21.2.2 2006/03/01 01:34:05 marka Exp $ */ #include @@ -35,10 +35,12 @@ #include static isc_result_t -add_initial_keys(cfg_obj_t *list, dns_tsig_keyring_t *ring, isc_mem_t *mctx) { - cfg_listelt_t *element; - cfg_obj_t *key = NULL; - char *keyid = NULL; +add_initial_keys(const cfg_obj_t *list, dns_tsig_keyring_t *ring, + isc_mem_t *mctx) +{ + const cfg_listelt_t *element; + const cfg_obj_t *key = NULL; + const char *keyid = NULL; unsigned char *secret = NULL; int secretalloc = 0; int secretlen = 0; @@ -49,14 +51,14 @@ add_initial_keys(cfg_obj_t *list, dns_tsig_keyring_t *ring, isc_mem_t *mctx) { element != NULL; element = cfg_list_next(element)) { - cfg_obj_t *algobj = NULL; - cfg_obj_t *secretobj = NULL; + const cfg_obj_t *algobj = NULL; + const cfg_obj_t *secretobj = NULL; dns_name_t keyname; dns_name_t *alg; - char *algstr; + const char *algstr; char keynamedata[1024]; isc_buffer_t keynamesrc, keynamebuf; - char *secretstr; + const char *secretstr; isc_buffer_t secretbuf; key = cfg_listelt_value(element); @@ -129,11 +131,11 @@ add_initial_keys(cfg_obj_t *list, dns_tsig_keyring_t *ring, isc_mem_t *mctx) { } isc_result_t -ns_tsigkeyring_fromconfig(cfg_obj_t *config, cfg_obj_t *vconfig, +ns_tsigkeyring_fromconfig(const cfg_obj_t *config, const cfg_obj_t *vconfig, isc_mem_t *mctx, dns_tsig_keyring_t **ringp) { - cfg_obj_t *maps[3]; - cfg_obj_t *keylist; + const cfg_obj_t *maps[3]; + const cfg_obj_t *keylist; dns_tsig_keyring_t *ring = NULL; isc_result_t result; int i; diff --git a/bin/named/zoneconf.c b/bin/named/zoneconf.c index 2d87858207..31b41cc909 100644 --- a/bin/named/zoneconf.c +++ b/bin/named/zoneconf.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zoneconf.c,v 1.87.2.11 2006/01/05 03:38:35 marka Exp $ */ +/* $Id: zoneconf.c,v 1.87.2.12 2006/03/01 01:34:05 marka Exp $ */ #include @@ -52,15 +52,15 @@ * Convenience function for configuring a single zone ACL. */ static isc_result_t -configure_zone_acl(cfg_obj_t *zconfig, cfg_obj_t *vconfig, cfg_obj_t *config, - const char *aclname, ns_aclconfctx_t *actx, - dns_zone_t *zone, +configure_zone_acl(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig, + const cfg_obj_t *config, const char *aclname, + ns_aclconfctx_t *actx, dns_zone_t *zone, void (*setzacl)(dns_zone_t *, dns_acl_t *), void (*clearzacl)(dns_zone_t *)) { isc_result_t result; - cfg_obj_t *maps[4]; - cfg_obj_t *aclobj = NULL; + const cfg_obj_t *maps[4]; + const cfg_obj_t *aclobj = NULL; int i = 0; dns_acl_t *dacl = NULL; @@ -69,7 +69,7 @@ configure_zone_acl(cfg_obj_t *zconfig, cfg_obj_t *vconfig, cfg_obj_t *config, if (vconfig != NULL) maps[i++] = cfg_tuple_get(vconfig, "options"); if (config != NULL) { - cfg_obj_t *options = NULL; + const cfg_obj_t *options = NULL; (void)cfg_map_get(config, "options", &options); if (options != NULL) maps[i++] = options; @@ -95,9 +95,9 @@ configure_zone_acl(cfg_obj_t *zconfig, cfg_obj_t *vconfig, cfg_obj_t *config, * Parse the zone update-policy statement. */ static isc_result_t -configure_zone_ssutable(cfg_obj_t *zconfig, dns_zone_t *zone) { - cfg_obj_t *updatepolicy = NULL; - cfg_listelt_t *element, *element2; +configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone) { + const cfg_obj_t *updatepolicy = NULL; + const cfg_listelt_t *element, *element2; dns_ssutable_t *table = NULL; isc_mem_t *mctx = dns_zone_getmctx(zone); isc_result_t result; @@ -116,13 +116,13 @@ configure_zone_ssutable(cfg_obj_t *zconfig, dns_zone_t *zone) { element != NULL; element = cfg_list_next(element)) { - cfg_obj_t *stmt = cfg_listelt_value(element); - cfg_obj_t *mode = cfg_tuple_get(stmt, "mode"); - cfg_obj_t *identity = cfg_tuple_get(stmt, "identity"); - cfg_obj_t *matchtype = cfg_tuple_get(stmt, "matchtype"); - cfg_obj_t *dname = cfg_tuple_get(stmt, "name"); - cfg_obj_t *typelist = cfg_tuple_get(stmt, "types"); - char *str; + const cfg_obj_t *stmt = cfg_listelt_value(element); + const cfg_obj_t *mode = cfg_tuple_get(stmt, "mode"); + const cfg_obj_t *identity = cfg_tuple_get(stmt, "identity"); + const cfg_obj_t *matchtype = cfg_tuple_get(stmt, "matchtype"); + const cfg_obj_t *dname = cfg_tuple_get(stmt, "name"); + const cfg_obj_t *typelist = cfg_tuple_get(stmt, "types"); + const char *str; isc_boolean_t grant = ISC_FALSE; unsigned int mtype = DNS_SSUMATCHTYPE_NAME; dns_fixedname_t fname, fident; @@ -190,14 +190,14 @@ configure_zone_ssutable(cfg_obj_t *zconfig, dns_zone_t *zone) { element2 != NULL; element2 = cfg_list_next(element2)) { - cfg_obj_t *typeobj; + const cfg_obj_t *typeobj; isc_textregion_t r; INSIST(i < n); typeobj = cfg_listelt_value(element2); str = cfg_obj_asstring(typeobj); - r.base = str; + DE_CONST(str, r.base); r.length = strlen(str); result = dns_rdatatype_fromtext(&types[i++], &r); @@ -236,8 +236,8 @@ configure_zone_ssutable(cfg_obj_t *zconfig, dns_zone_t *zone) { * Convert a config file zone type into a server zone type. */ static inline dns_zonetype_t -zonetype_fromconfig(cfg_obj_t *map) { - cfg_obj_t *obj = NULL; +zonetype_fromconfig(const cfg_obj_t *map) { + const cfg_obj_t *obj = NULL; isc_result_t result; result = cfg_map_get(map, "type", &obj); @@ -292,17 +292,18 @@ strtoargv(isc_mem_t *mctx, char *s, unsigned int *argcp, char ***argvp) { } isc_result_t -ns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig, - ns_aclconfctx_t *ac, dns_zone_t *zone) +ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, + const cfg_obj_t *zconfig, ns_aclconfctx_t *ac, + dns_zone_t *zone) { isc_result_t result; - char *zname; + const char *zname; dns_rdataclass_t zclass; dns_rdataclass_t vclass; - cfg_obj_t *maps[5]; - cfg_obj_t *zoptions = NULL; - cfg_obj_t *options = NULL; - cfg_obj_t *obj; + const cfg_obj_t *maps[5]; + const cfg_obj_t *zoptions = NULL; + const cfg_obj_t *options = NULL; + const cfg_obj_t *obj; const char *filename = NULL; dns_notifytype_t notifytype = dns_notifytype_yes; isc_sockaddr_t *addrs; @@ -407,7 +408,7 @@ ns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig, else dialup = dns_dialuptype_no; } else { - char *dialupstr = cfg_obj_asstring(obj); + const char *dialupstr = cfg_obj_asstring(obj); if (strcasecmp(dialupstr, "notify") == 0) dialup = dns_dialuptype_notify; else if (strcasecmp(dialupstr, "notify-passive") == 0) @@ -441,7 +442,7 @@ ns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig, else notifytype = dns_notifytype_no; } else { - char *notifystr = cfg_obj_asstring(obj); + const char *notifystr = cfg_obj_asstring(obj); if (strcasecmp(notifystr, "explicit") == 0) notifytype = dns_notifytype_explicit; else @@ -602,9 +603,9 @@ ns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig, } isc_boolean_t -ns_zone_reusable(dns_zone_t *zone, cfg_obj_t *zconfig) { - cfg_obj_t *zoptions = NULL; - cfg_obj_t *obj = NULL; +ns_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig) { + const cfg_obj_t *zoptions = NULL; + const cfg_obj_t *obj = NULL; const char *cfilename; const char *zfilename; diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c index 071b8ac4c7..ba83be1edb 100644 --- a/bin/rndc/rndc.c +++ b/bin/rndc/rndc.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rndc.c,v 1.77.2.6 2004/03/09 06:09:27 marka Exp $ */ +/* $Id: rndc.c,v 1.77.2.7 2006/03/01 01:34:05 marka Exp $ */ /* * Principal Author: DCL @@ -409,17 +409,17 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname, { isc_result_t result; const char *conffile = admin_conffile; - cfg_obj_t *defkey = NULL; - cfg_obj_t *options = NULL; - cfg_obj_t *servers = NULL; - cfg_obj_t *server = NULL; - cfg_obj_t *keys = NULL; - cfg_obj_t *key = NULL; - cfg_obj_t *defport = NULL; - cfg_obj_t *secretobj = NULL; - cfg_obj_t *algorithmobj = NULL; + const cfg_obj_t *defkey = NULL; + const cfg_obj_t *options = NULL; + const cfg_obj_t *servers = NULL; + const cfg_obj_t *server = NULL; + const cfg_obj_t *keys = NULL; + const cfg_obj_t *key = NULL; + const cfg_obj_t *defport = NULL; + const cfg_obj_t *secretobj = NULL; + const cfg_obj_t *algorithmobj = NULL; cfg_obj_t *config = NULL; - cfg_listelt_t *elt; + const cfg_listelt_t *elt; const char *secretstr; const char *algorithm; static char secretarray[1024]; @@ -451,7 +451,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname, if (key_only && servername == NULL) servername = "127.0.0.1"; else if (servername == NULL && options != NULL) { - cfg_obj_t *defserverobj = NULL; + const cfg_obj_t *defserverobj = NULL; (void)cfg_map_get(options, "default-server", &defserverobj); if (defserverobj != NULL) servername = cfg_obj_asstring(defserverobj); diff --git a/lib/dns/acl.c b/lib/dns/acl.c index eb2fa1c54a..68962b6867 100644 --- a/lib/dns/acl.c +++ b/lib/dns/acl.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: acl.c,v 1.23.2.1 2004/03/09 06:10:59 marka Exp $ */ +/* $Id: acl.c,v 1.23.2.2 2006/03/01 01:34:05 marka Exp $ */ #include @@ -68,7 +68,7 @@ dns_acl_create(isc_mem_t *mctx, int n, dns_acl_t **target) { } isc_result_t -dns_acl_appendelement(dns_acl_t *acl, dns_aclelement_t *elt) { +dns_acl_appendelement(dns_acl_t *acl, const dns_aclelement_t *elt) { if (acl->length + 1 > acl->alloc) { /* * Resize the ACL. @@ -123,12 +123,12 @@ dns_acl_none(isc_mem_t *mctx, dns_acl_t **target) { } isc_result_t -dns_acl_match(isc_netaddr_t *reqaddr, - dns_name_t *reqsigner, - dns_acl_t *acl, - dns_aclenv_t *env, +dns_acl_match(const isc_netaddr_t *reqaddr, + const dns_name_t *reqsigner, + const dns_acl_t *acl, + const dns_aclenv_t *env, int *match, - dns_aclelement_t **matchelt) + dns_aclelement_t const**matchelt) { unsigned int i; @@ -150,14 +150,14 @@ dns_acl_match(isc_netaddr_t *reqaddr, } isc_boolean_t -dns_aclelement_match(isc_netaddr_t *reqaddr, - dns_name_t *reqsigner, - dns_aclelement_t *e, - dns_aclenv_t *env, - dns_aclelement_t **matchelt) +dns_aclelement_match(const isc_netaddr_t *reqaddr, + const dns_name_t *reqsigner, + const dns_aclelement_t *e, + const dns_aclenv_t *env, + const dns_aclelement_t **matchelt) { dns_acl_t *inner = NULL; - isc_netaddr_t *addr; + const isc_netaddr_t *addr; isc_netaddr_t v4addr; int indirectmatch; isc_result_t result; @@ -289,7 +289,7 @@ dns_acl_detach(dns_acl_t **aclp) { } isc_boolean_t -dns_aclelement_equal(dns_aclelement_t *ea, dns_aclelement_t *eb) { +dns_aclelement_equal(const dns_aclelement_t *ea, const dns_aclelement_t *eb) { if (ea->type != eb->type) return (ISC_FALSE); switch (ea->type) { @@ -314,7 +314,7 @@ dns_aclelement_equal(dns_aclelement_t *ea, dns_aclelement_t *eb) { } isc_boolean_t -dns_acl_equal(dns_acl_t *a, dns_acl_t *b) { +dns_acl_equal(const dns_acl_t *a, const dns_acl_t *b) { unsigned int i; if (a == b) return (ISC_TRUE); @@ -329,7 +329,7 @@ dns_acl_equal(dns_acl_t *a, dns_acl_t *b) { } static isc_boolean_t -is_loopback(dns_aclipprefix_t *p) { +is_loopback(const dns_aclipprefix_t *p) { switch (p->address.family) { case AF_INET: if (p->prefixlen == 32 && @@ -348,7 +348,7 @@ is_loopback(dns_aclipprefix_t *p) { } isc_boolean_t -dns_acl_isinsecure(dns_acl_t *a) { +dns_acl_isinsecure(const dns_acl_t *a) { unsigned int i; for (i = 0; i < a->length; i++) { dns_aclelement_t *e = &a->elements[i]; diff --git a/lib/dns/cache.c b/lib/dns/cache.c index 04e2de8957..4305e0c0de 100644 --- a/lib/dns/cache.c +++ b/lib/dns/cache.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: cache.c,v 1.45.2.10 2006/01/26 23:11:39 marka Exp $ */ +/* $Id: cache.c,v 1.45.2.11 2006/03/01 01:34:05 marka Exp $ */ #include @@ -378,7 +378,7 @@ dns_cache_attachdb(dns_cache_t *cache, dns_db_t **dbp) { } isc_result_t -dns_cache_setfilename(dns_cache_t *cache, char *filename) { +dns_cache_setfilename(dns_cache_t *cache, const char *filename) { char *newname; REQUIRE(VALID_CACHE(cache)); diff --git a/lib/dns/compress.c b/lib/dns/compress.c index e5c7631538..fd241a7fb3 100644 --- a/lib/dns/compress.c +++ b/lib/dns/compress.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: compress.c,v 1.50.2.2 2004/03/09 06:11:00 marka Exp $ */ +/* $Id: compress.c,v 1.50.2.3 2006/03/01 01:34:05 marka Exp $ */ #define DNS_NAME_USEINLINE 1 @@ -111,7 +111,7 @@ do { \ * If no match is found return ISC_FALSE. */ isc_boolean_t -dns_compress_findglobal(dns_compress_t *cctx, dns_name_t *name, +dns_compress_findglobal(dns_compress_t *cctx, const dns_name_t *name, dns_name_t *prefix, isc_uint16_t *offset) { dns_name_t tname, nname; @@ -161,15 +161,15 @@ dns_compress_findglobal(dns_compress_t *cctx, dns_name_t *name, } static inline unsigned int -name_length(dns_name_t *name) { +name_length(const dns_name_t *name) { isc_region_t r; dns_name_toregion(name, &r); return (r.length); } void -dns_compress_add(dns_compress_t *cctx, dns_name_t *name, dns_name_t *prefix, - isc_uint16_t offset) +dns_compress_add(dns_compress_t *cctx, const dns_name_t *name, + const dns_name_t *prefix, isc_uint16_t offset) { dns_name_t tname; unsigned int start; diff --git a/lib/dns/include/dns/acl.h b/lib/dns/include/dns/acl.h index 674a9c44ae..7a38b8d1c2 100644 --- a/lib/dns/include/dns/acl.h +++ b/lib/dns/include/dns/acl.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: acl.h,v 1.20.2.1 2004/03/09 06:11:12 marka Exp $ */ +/* $Id: acl.h,v 1.20.2.2 2006/03/01 01:34:05 marka Exp $ */ #ifndef DNS_ACL_H #define DNS_ACL_H 1 @@ -104,7 +104,7 @@ dns_acl_create(isc_mem_t *mctx, int n, dns_acl_t **target); */ isc_result_t -dns_acl_appendelement(dns_acl_t *acl, dns_aclelement_t *elt); +dns_acl_appendelement(dns_acl_t *acl, const dns_aclelement_t *elt); /* * Append an element to an existing ACL. */ @@ -128,13 +128,13 @@ void dns_acl_detach(dns_acl_t **aclp); isc_boolean_t -dns_aclelement_equal(dns_aclelement_t *ea, dns_aclelement_t *eb); +dns_aclelement_equal(const dns_aclelement_t *ea, const dns_aclelement_t *eb); isc_boolean_t -dns_acl_equal(dns_acl_t *a, dns_acl_t *b); +dns_acl_equal(const dns_acl_t *a, const dns_acl_t *b); isc_boolean_t -dns_acl_isinsecure(dns_acl_t *a); +dns_acl_isinsecure(const dns_acl_t *a); /* * Return ISC_TRUE iff the acl 'a' is considered insecure, that is, * if it contains IP addresses other than those of the local host. @@ -154,12 +154,12 @@ void dns_aclenv_destroy(dns_aclenv_t *env); isc_result_t -dns_acl_match(isc_netaddr_t *reqaddr, - dns_name_t *reqsigner, - dns_acl_t *acl, - dns_aclenv_t *env, +dns_acl_match(const isc_netaddr_t *reqaddr, + const dns_name_t *reqsigner, + const dns_acl_t *acl, + const dns_aclenv_t *env, int *match, - dns_aclelement_t **matchelt); + const dns_aclelement_t **matchelt); /* * General, low-level ACL matching. This is expected to * be useful even for weird stuff like the topology and sortlist statements. @@ -185,11 +185,11 @@ dns_acl_match(isc_netaddr_t *reqaddr, */ isc_boolean_t -dns_aclelement_match(isc_netaddr_t *reqaddr, - dns_name_t *reqsigner, - dns_aclelement_t *e, - dns_aclenv_t *env, - dns_aclelement_t **matchelt); +dns_aclelement_match(const isc_netaddr_t *reqaddr, + const dns_name_t *reqsigner, + const dns_aclelement_t *e, + const dns_aclenv_t *env, + const dns_aclelement_t **matchelt); /* * Like dns_acl_match, but matches against the single ACL element 'e' * rather than a complete list and returns ISC_TRUE iff it matched. diff --git a/lib/dns/include/dns/cache.h b/lib/dns/include/dns/cache.h index 4b4d9c8880..18c50cdaca 100644 --- a/lib/dns/include/dns/cache.h +++ b/lib/dns/include/dns/cache.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: cache.h,v 1.17.2.1 2004/03/09 06:11:13 marka Exp $ */ +/* $Id: cache.h,v 1.17.2.2 2006/03/01 01:34:05 marka Exp $ */ #ifndef DNS_CACHE_H #define DNS_CACHE_H 1 @@ -151,7 +151,7 @@ dns_cache_attachdb(dns_cache_t *cache, dns_db_t **dbp); isc_result_t -dns_cache_setfilename(dns_cache_t *cahce, char *filename); +dns_cache_setfilename(dns_cache_t *cahce, const char *filename); /* * If 'filename' is non-NULL, make the cache persistent. * The cache's data will be stored in the given file. diff --git a/lib/dns/include/dns/compress.h b/lib/dns/include/dns/compress.h index 8d7191fc3f..c514c3163b 100644 --- a/lib/dns/include/dns/compress.h +++ b/lib/dns/include/dns/compress.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: compress.h,v 1.29.2.3 2004/03/09 06:11:14 marka Exp $ */ +/* $Id: compress.h,v 1.29.2.4 2006/03/01 01:34:05 marka Exp $ */ #ifndef DNS_COMPRESS_H #define DNS_COMPRESS_H 1 @@ -136,7 +136,7 @@ dns_compress_getedns(dns_compress_t *cctx); */ isc_boolean_t -dns_compress_findglobal(dns_compress_t *cctx, dns_name_t *name, +dns_compress_findglobal(dns_compress_t *cctx, const dns_name_t *name, dns_name_t *prefix, isc_uint16_t *offset); /* * Finds longest possible match of 'name' in the global compression table. @@ -155,8 +155,8 @@ dns_compress_findglobal(dns_compress_t *cctx, dns_name_t *name, */ void -dns_compress_add(dns_compress_t *cctx, dns_name_t *name, dns_name_t *prefix, - isc_uint16_t offset); +dns_compress_add(dns_compress_t *cctx, const dns_name_t *name, + const dns_name_t *prefix, isc_uint16_t offset); /* * Add compression pointers for 'name' to the compression table, * not replacing existing pointers. diff --git a/lib/dns/include/dns/masterdump.h b/lib/dns/include/dns/masterdump.h index 6980cf808e..c9efb40139 100644 --- a/lib/dns/include/dns/masterdump.h +++ b/lib/dns/include/dns/masterdump.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: masterdump.h,v 1.22.2.3 2005/09/06 02:11:55 marka Exp $ */ +/* $Id: masterdump.h,v 1.22.2.4 2006/03/01 01:34:05 marka Exp $ */ #ifndef DNS_MASTERDUMP_H #define DNS_MASTERDUMP_H 1 @@ -159,7 +159,7 @@ dns_master_questiontotext(dns_name_t *owner_name, isc_result_t dns_rdataset_towire(dns_rdataset_t *rdataset, - dns_name_t *owner_name, + const dns_name_t *owner_name, dns_compress_t *cctx, isc_buffer_t *target, unsigned int *countp); diff --git a/lib/dns/include/dns/message.h b/lib/dns/include/dns/message.h index e084d43834..b49db0c582 100644 --- a/lib/dns/include/dns/message.h +++ b/lib/dns/include/dns/message.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: message.h,v 1.100.2.6 2006/01/06 00:01:41 marka Exp $ */ +/* $Id: message.h,v 1.100.2.7 2006/03/01 01:34:05 marka Exp $ */ #ifndef DNS_MESSAGE_H #define DNS_MESSAGE_H 1 @@ -231,7 +231,7 @@ struct dns_message { isc_region_t saved; dns_rdatasetorderfunc_t order; - void * order_arg; + const void * order_arg; }; /*** @@ -1247,7 +1247,7 @@ dns_message_getrawmessage(dns_message_t *msg); void dns_message_setsortorder(dns_message_t *msg, dns_rdatasetorderfunc_t order, - void *order_arg); + const void *order_arg); /* * Define the order in which RR sets get rendered by * dns_message_rendersection() to be the ascending order diff --git a/lib/dns/include/dns/name.h b/lib/dns/include/dns/name.h index d1f96d82ee..fe338830f1 100644 --- a/lib/dns/include/dns/name.h +++ b/lib/dns/include/dns/name.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: name.h,v 1.95.2.9 2004/09/08 00:34:23 marka Exp $ */ +/* $Id: name.h,v 1.95.2.10 2006/03/01 01:34:07 marka Exp $ */ #ifndef DNS_NAME_H #define DNS_NAME_H 1 @@ -679,7 +679,7 @@ dns_name_getlabelsequence(const dns_name_t *source, unsigned int first, void -dns_name_clone(dns_name_t *source, dns_name_t *target); +dns_name_clone(const dns_name_t *source, dns_name_t *target); /* * Make 'target' refer to the same name as 'source'. * @@ -796,7 +796,8 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, */ isc_result_t -dns_name_towire(dns_name_t *name, dns_compress_t *cctx, isc_buffer_t *target); +dns_name_towire(const dns_name_t *name, dns_compress_t *cctx, + isc_buffer_t *target); /* * Convert 'name' into wire format, compressing it as specified by the * compression context 'cctx', and storing the result in 'target'. @@ -1132,7 +1133,7 @@ dns_name_splitatdepth(dns_name_t *name, unsigned int depth, */ isc_result_t -dns_name_dup(dns_name_t *source, isc_mem_t *mctx, dns_name_t *target); +dns_name_dup(const dns_name_t *source, isc_mem_t *mctx, dns_name_t *target); /* * Make 'target' a dynamically allocated copy of 'source'. * diff --git a/lib/dns/include/dns/rdataset.h b/lib/dns/include/dns/rdataset.h index b6f6d00748..4854f2a8fc 100644 --- a/lib/dns/include/dns/rdataset.h +++ b/lib/dns/include/dns/rdataset.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rdataset.h,v 1.41.2.8 2005/03/16 00:57:43 marka Exp $ */ +/* $Id: rdataset.h,v 1.41.2.9 2006/03/01 01:34:07 marka Exp $ */ #ifndef DNS_RDATASET_H #define DNS_RDATASET_H 1 @@ -306,7 +306,7 @@ dns_rdataset_totext(dns_rdataset_t *rdataset, isc_result_t dns_rdataset_towire(dns_rdataset_t *rdataset, - dns_name_t *owner_name, + const dns_name_t *owner_name, dns_compress_t *cctx, isc_buffer_t *target, unsigned int *countp); @@ -344,11 +344,11 @@ dns_rdataset_towire(dns_rdataset_t *rdataset, isc_result_t dns_rdataset_towiresorted(dns_rdataset_t *rdataset, - dns_name_t *owner_name, + const dns_name_t *owner_name, dns_compress_t *cctx, isc_buffer_t *target, dns_rdatasetorderfunc_t order, - void *order_arg, + const void *order_arg, unsigned int *countp); /* * Like dns_rdataset_towire(), but sorting the rdatasets according to @@ -362,11 +362,11 @@ dns_rdataset_towiresorted(dns_rdataset_t *rdataset, isc_result_t dns_rdataset_towirepartial(dns_rdataset_t *rdataset, - dns_name_t *owner_name, + const dns_name_t *owner_name, dns_compress_t *cctx, isc_buffer_t *target, dns_rdatasetorderfunc_t order, - void *order_arg, + const void *order_arg, unsigned int *countp, void **state); /* diff --git a/lib/dns/include/dns/types.h b/lib/dns/include/dns/types.h index df6d8a3b94..caa244708e 100644 --- a/lib/dns/include/dns/types.h +++ b/lib/dns/include/dns/types.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: types.h,v 1.103.2.1 2004/03/09 06:11:24 marka Exp $ */ +/* $Id: types.h,v 1.103.2.2 2006/03/01 01:34:07 marka Exp $ */ #ifndef DNS_TYPES_H #define DNS_TYPES_H 1 @@ -299,6 +299,6 @@ typedef void (*dns_updatecallback_t)(void *, isc_result_t, dns_message_t *); typedef int -(*dns_rdatasetorderfunc_t)(dns_rdata_t *rdata, void *arg); +(*dns_rdatasetorderfunc_t)(const dns_rdata_t *rdata, const void *arg); #endif /* DNS_TYPES_H */ diff --git a/lib/dns/include/dns/zone.h b/lib/dns/include/dns/zone.h index fb54b08b5d..5a633a8e61 100644 --- a/lib/dns/include/dns/zone.h +++ b/lib/dns/include/dns/zone.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zone.h,v 1.106.2.9 2004/10/26 02:08:00 marka Exp $ */ +/* $Id: zone.h,v 1.106.2.10 2006/03/01 01:34:07 marka Exp $ */ #ifndef DNS_ZONE_H #define DNS_ZONE_H 1 @@ -156,7 +156,7 @@ dns_zone_getview(dns_zone_t *zone); */ isc_result_t -dns_zone_setorigin(dns_zone_t *zone, dns_name_t *origin); +dns_zone_setorigin(dns_zone_t *zone, const dns_name_t *origin); /* * Sets the zones origin to 'origin'. * @@ -393,11 +393,13 @@ dns_zone_maintenance(dns_zone_t *zone); */ isc_result_t -dns_zone_setmasters(dns_zone_t *zone, isc_sockaddr_t *masters, +dns_zone_setmasters(dns_zone_t *zone, const isc_sockaddr_t *masters, isc_uint32_t count); isc_result_t -dns_zone_setmasterswithkeys(dns_zone_t *zone, isc_sockaddr_t *masters, - dns_name_t **keynames, isc_uint32_t count); +dns_zone_setmasterswithkeys(dns_zone_t *zone, + const isc_sockaddr_t *masters, + dns_name_t **keynames, + isc_uint32_t count); /* * Set the list of master servers for the zone. * @@ -419,7 +421,7 @@ dns_zone_setmasterswithkeys(dns_zone_t *zone, isc_sockaddr_t *masters, */ isc_result_t -dns_zone_setalsonotify(dns_zone_t *zone, isc_sockaddr_t *notify, +dns_zone_setalsonotify(dns_zone_t *zone, const isc_sockaddr_t *notify, isc_uint32_t count); /* * Set the list of additional servers to be notified when @@ -504,7 +506,7 @@ dns_zone_setmaxretrytime(dns_zone_t *zone, isc_uint32_t val); */ isc_result_t -dns_zone_setxfrsource4(dns_zone_t *zone, isc_sockaddr_t *xfrsource); +dns_zone_setxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource); /* * Set the source address to be used in IPv4 zone transfers. * @@ -527,7 +529,7 @@ dns_zone_getxfrsource4(dns_zone_t *zone); */ isc_result_t -dns_zone_setxfrsource6(dns_zone_t *zone, isc_sockaddr_t *xfrsource); +dns_zone_setxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource); /* * Set the source address to be used in IPv6 zone transfers. * @@ -550,7 +552,7 @@ dns_zone_getxfrsource6(dns_zone_t *zone); */ isc_result_t -dns_zone_setnotifysrc4(dns_zone_t *zone, isc_sockaddr_t *notifysrc); +dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc); /* * Set the source address to be used with IPv4 NOTIFY messages. * @@ -573,7 +575,7 @@ dns_zone_getnotifysrc4(dns_zone_t *zone); */ isc_result_t -dns_zone_setnotifysrc6(dns_zone_t *zone, isc_sockaddr_t *notifysrc); +dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc); /* * Set the source address to be used with IPv6 NOTIFY messages. * diff --git a/lib/dns/message.c b/lib/dns/message.c index 25eb2e4c79..a19014df1c 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: message.c,v 1.194.2.19 2006/01/05 01:04:30 marka Exp $ */ +/* $Id: message.c,v 1.194.2.20 2006/03/01 01:34:05 marka Exp $ */ /*** *** Imports @@ -1799,7 +1799,7 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, if (rdataset != NULL && (rdataset->attributes & DNS_RDATASETATTR_REQUIREDGLUE) != 0 && (rdataset->attributes & DNS_RDATASETATTR_RENDERED) == 0) { - void *order_arg = msg->order_arg; + const void *order_arg = msg->order_arg; st = *(msg->buffer); count = 0; if (partial) @@ -3153,7 +3153,7 @@ dns_message_getrawmessage(dns_message_t *msg) { void dns_message_setsortorder(dns_message_t *msg, dns_rdatasetorderfunc_t order, - void *order_arg) + const void *order_arg) { REQUIRE(DNS_MESSAGE_VALID(msg)); msg->order = order; diff --git a/lib/dns/name.c b/lib/dns/name.c index 41ea103d21..e4fd8f87c5 100644 --- a/lib/dns/name.c +++ b/lib/dns/name.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: name.c,v 1.127.2.12 2005/07/23 04:34:21 marka Exp $ */ +/* $Id: name.c,v 1.127.2.13 2006/03/01 01:34:05 marka Exp $ */ #include @@ -1032,7 +1032,7 @@ dns_name_getlabelsequence(const dns_name_t *source, } void -dns_name_clone(dns_name_t *source, dns_name_t *target) { +dns_name_clone(const dns_name_t *source, dns_name_t *target) { /* * Make 'target' refer to the same name as 'source'. @@ -2545,7 +2545,9 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, } isc_result_t -dns_name_towire(dns_name_t *name, dns_compress_t *cctx, isc_buffer_t *target) { +dns_name_towire(const dns_name_t *name, dns_compress_t *cctx, + isc_buffer_t *target) +{ unsigned int methods; isc_uint16_t offset; dns_name_t gp; /* Global compression prefix */ @@ -3127,7 +3129,9 @@ dns_name_splitatdepth(dns_name_t *name, unsigned int depth, } isc_result_t -dns_name_dup(dns_name_t *source, isc_mem_t *mctx, dns_name_t *target) { +dns_name_dup(const dns_name_t *source, isc_mem_t *mctx, + dns_name_t *target) +{ /* * Make 'target' a dynamically allocated copy of 'source'. */ diff --git a/lib/dns/rdataset.c b/lib/dns/rdataset.c index f77765805c..534847d15c 100644 --- a/lib/dns/rdataset.c +++ b/lib/dns/rdataset.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rdataset.c,v 1.58.2.5 2004/03/09 06:11:06 marka Exp $ */ +/* $Id: rdataset.c,v 1.58.2.6 2006/03/01 01:34:05 marka Exp $ */ #include @@ -272,9 +272,9 @@ towire_compare(const void *av, const void *bv) { } static isc_result_t -towiresorted(dns_rdataset_t *rdataset, dns_name_t *owner_name, +towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name, dns_compress_t *cctx, isc_buffer_t *target, - dns_rdatasetorderfunc_t order, void *order_arg, + dns_rdatasetorderfunc_t order, const void *order_arg, isc_boolean_t partial, unsigned int *countp, void **state) { @@ -483,11 +483,11 @@ towiresorted(dns_rdataset_t *rdataset, dns_name_t *owner_name, isc_result_t dns_rdataset_towiresorted(dns_rdataset_t *rdataset, - dns_name_t *owner_name, + const dns_name_t *owner_name, dns_compress_t *cctx, isc_buffer_t *target, dns_rdatasetorderfunc_t order, - void *order_arg, + const void *order_arg, unsigned int *countp) { return (towiresorted(rdataset, owner_name, cctx, target, @@ -496,11 +496,11 @@ dns_rdataset_towiresorted(dns_rdataset_t *rdataset, isc_result_t dns_rdataset_towirepartial(dns_rdataset_t *rdataset, - dns_name_t *owner_name, + const dns_name_t *owner_name, dns_compress_t *cctx, isc_buffer_t *target, dns_rdatasetorderfunc_t order, - void *order_arg, + const void *order_arg, unsigned int *countp, void **state) { @@ -511,7 +511,7 @@ dns_rdataset_towirepartial(dns_rdataset_t *rdataset, isc_result_t dns_rdataset_towire(dns_rdataset_t *rdataset, - dns_name_t *owner_name, + const dns_name_t *owner_name, dns_compress_t *cctx, isc_buffer_t *target, unsigned int *countp) diff --git a/lib/dns/zone.c b/lib/dns/zone.c index f046f5d30c..ce09bbcbca 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zone.c,v 1.333.2.42 2006/01/04 04:08:14 marka Exp $ */ +/* $Id: zone.c,v 1.333.2.43 2006/03/01 01:34:05 marka Exp $ */ #include @@ -754,7 +754,7 @@ dns_zone_getview(dns_zone_t *zone) { isc_result_t -dns_zone_setorigin(dns_zone_t *zone, dns_name_t *origin) { +dns_zone_setorigin(dns_zone_t *zone, const dns_name_t *origin) { isc_result_t result; REQUIRE(DNS_ZONE_VALID(zone)); @@ -1698,7 +1698,7 @@ dns_zone_getoptions(dns_zone_t *zone) { } isc_result_t -dns_zone_setxfrsource4(dns_zone_t *zone, isc_sockaddr_t *xfrsource) { +dns_zone_setxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource) { REQUIRE(DNS_ZONE_VALID(zone)); LOCK_ZONE(zone); @@ -1715,7 +1715,7 @@ dns_zone_getxfrsource4(dns_zone_t *zone) { } isc_result_t -dns_zone_setxfrsource6(dns_zone_t *zone, isc_sockaddr_t *xfrsource) { +dns_zone_setxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource) { REQUIRE(DNS_ZONE_VALID(zone)); LOCK_ZONE(zone); @@ -1732,7 +1732,7 @@ dns_zone_getxfrsource6(dns_zone_t *zone) { } isc_result_t -dns_zone_setnotifysrc4(dns_zone_t *zone, isc_sockaddr_t *notifysrc) { +dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc) { REQUIRE(DNS_ZONE_VALID(zone)); LOCK_ZONE(zone); @@ -1749,7 +1749,7 @@ dns_zone_getnotifysrc4(dns_zone_t *zone) { } isc_result_t -dns_zone_setnotifysrc6(dns_zone_t *zone, isc_sockaddr_t *notifysrc) { +dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc) { REQUIRE(DNS_ZONE_VALID(zone)); LOCK_ZONE(zone); @@ -1766,7 +1766,7 @@ dns_zone_getnotifysrc6(dns_zone_t *zone) { } isc_result_t -dns_zone_setalsonotify(dns_zone_t *zone, isc_sockaddr_t *notify, +dns_zone_setalsonotify(dns_zone_t *zone, const isc_sockaddr_t *notify, isc_uint32_t count) { isc_sockaddr_t *new; @@ -1796,7 +1796,7 @@ dns_zone_setalsonotify(dns_zone_t *zone, isc_sockaddr_t *notify, } isc_result_t -dns_zone_setmasters(dns_zone_t *zone, isc_sockaddr_t *masters, +dns_zone_setmasters(dns_zone_t *zone, const isc_sockaddr_t *masters, isc_uint32_t count) { isc_result_t result; @@ -1806,8 +1806,10 @@ dns_zone_setmasters(dns_zone_t *zone, isc_sockaddr_t *masters, } isc_result_t -dns_zone_setmasterswithkeys(dns_zone_t *zone, isc_sockaddr_t *masters, - dns_name_t **keynames, isc_uint32_t count) +dns_zone_setmasterswithkeys(dns_zone_t *zone, + const isc_sockaddr_t *masters, + dns_name_t **keynames, + isc_uint32_t count) { isc_sockaddr_t *new; isc_result_t result = ISC_R_SUCCESS; diff --git a/lib/isc/include/isc/sockaddr.h b/lib/isc/include/isc/sockaddr.h index a18f1c623d..6bb470a43b 100644 --- a/lib/isc/include/isc/sockaddr.h +++ b/lib/isc/include/isc/sockaddr.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sockaddr.h,v 1.35.2.2 2004/03/09 06:12:01 marka Exp $ */ +/* $Id: sockaddr.h,v 1.35.2.3 2006/03/01 01:34:07 marka Exp $ */ #ifndef ISC_SOCKADDR_H #define ISC_SOCKADDR_H 1 @@ -138,7 +138,7 @@ isc_sockaddr_setport(isc_sockaddr_t *sockaddr, in_port_t port); */ in_port_t -isc_sockaddr_getport(isc_sockaddr_t *sockaddr); +isc_sockaddr_getport(const isc_sockaddr_t *sockaddr); /* * Get the port stored in 'sockaddr'. */ @@ -157,7 +157,7 @@ isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target); */ void -isc_sockaddr_format(isc_sockaddr_t *sa, char *array, unsigned int size); +isc_sockaddr_format(const isc_sockaddr_t *sa, char *array, unsigned int size); /* * Format a human-readable representation of the socket address '*sa' * into the character array 'array', which is of size 'size'. @@ -165,13 +165,13 @@ isc_sockaddr_format(isc_sockaddr_t *sa, char *array, unsigned int size); */ isc_boolean_t -isc_sockaddr_ismulticast(isc_sockaddr_t *sa); +isc_sockaddr_ismulticast(const isc_sockaddr_t *sa); /* * Returns ISC_TRUE if the address is a multicast address */ isc_boolean_t -isc_sockaddr_isexperimental(isc_sockaddr_t *sa); +isc_sockaddr_isexperimental(const isc_sockaddr_t *sa); /* * Returns ISC_TRUE if the address is a experimental (CLASS E) address. */ diff --git a/lib/isc/include/isc/symtab.h b/lib/isc/include/isc/symtab.h index 55ff8b57ab..b65529093e 100644 --- a/lib/isc/include/isc/symtab.h +++ b/lib/isc/include/isc/symtab.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: symtab.h,v 1.16.2.1 2004/03/09 06:12:02 marka Exp $ */ +/* $Id: symtab.h,v 1.16.2.2 2006/03/01 01:34:07 marka Exp $ */ #ifndef ISC_SYMTAB_H #define ISC_SYMTAB_H 1 @@ -88,6 +88,7 @@ typedef union isc_symvalue { void * as_pointer; + const void * as_cpointer; int as_integer; unsigned int as_uinteger; } isc_symvalue_t; diff --git a/lib/isc/sockaddr.c b/lib/isc/sockaddr.c index 89562118f5..58b9fe6f17 100644 --- a/lib/isc/sockaddr.c +++ b/lib/isc/sockaddr.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sockaddr.c,v 1.48.2.5 2004/03/09 06:11:51 marka Exp $ */ +/* $Id: sockaddr.c,v 1.48.2.6 2006/03/01 01:34:07 marka Exp $ */ #include @@ -155,7 +155,7 @@ isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) { } void -isc_sockaddr_format(isc_sockaddr_t *sa, char *array, unsigned int size) { +isc_sockaddr_format(const isc_sockaddr_t *sa, char *array, unsigned int size) { isc_result_t result; isc_buffer_t buf; @@ -388,7 +388,7 @@ isc_sockaddr_setport(isc_sockaddr_t *sockaddr, in_port_t port) { } in_port_t -isc_sockaddr_getport(isc_sockaddr_t *sockaddr) { +isc_sockaddr_getport(const isc_sockaddr_t *sockaddr) { in_port_t port = 0; switch (sockaddr->type.sa.sa_family) { @@ -410,7 +410,7 @@ isc_sockaddr_getport(isc_sockaddr_t *sockaddr) { } isc_boolean_t -isc_sockaddr_ismulticast(isc_sockaddr_t *sockaddr) { +isc_sockaddr_ismulticast(const isc_sockaddr_t *sockaddr) { isc_netaddr_t netaddr; isc_netaddr_fromsockaddr(&netaddr, sockaddr); @@ -418,7 +418,7 @@ isc_sockaddr_ismulticast(isc_sockaddr_t *sockaddr) { } isc_boolean_t -isc_sockaddr_isexperimental(isc_sockaddr_t *sockaddr) { +isc_sockaddr_isexperimental(const isc_sockaddr_t *sockaddr) { isc_netaddr_t netaddr; if (sockaddr->type.sa.sa_family == AF_INET) { diff --git a/lib/isccfg/check.c b/lib/isccfg/check.c index a69a4fdb91..7f09f76245 100644 --- a/lib/isccfg/check.c +++ b/lib/isccfg/check.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: check.c,v 1.14.2.26 2004/11/22 05:01:37 marka Exp $ */ +/* $Id: check.c,v 1.14.2.27 2006/03/01 01:34:07 marka Exp $ */ #include @@ -45,9 +45,9 @@ freekey(char *key, unsigned int type, isc_symvalue_t value, void *userarg) { } static isc_result_t -check_forward(cfg_obj_t *options, isc_log_t *logctx) { - cfg_obj_t *forward = NULL; - cfg_obj_t *forwarders = NULL; +check_forward(const cfg_obj_t *options, isc_log_t *logctx) { + const cfg_obj_t *forward = NULL; + const cfg_obj_t *forwarders = NULL; (void)cfg_map_get(options, "forward", &forward); (void)cfg_map_get(options, "forwarders", &forwarders); @@ -66,10 +66,10 @@ typedef struct { } intervaltable; static isc_result_t -check_options(cfg_obj_t *options, isc_log_t *logctx) { +check_options(const cfg_obj_t *options, isc_log_t *logctx) { isc_result_t result = ISC_R_SUCCESS; unsigned int i; - cfg_obj_t *obj; + const cfg_obj_t *obj; static intervaltable intervals[] = { { "cleaning-interval", 60 }, @@ -89,7 +89,7 @@ check_options(cfg_obj_t *options, isc_log_t *logctx) { */ for (i = 0; i < sizeof(intervals) / sizeof(intervals[0]); i++) { isc_uint32_t val; - cfg_obj_t *obj = NULL; + const cfg_obj_t *obj = NULL; (void)cfg_map_get(options, intervals[i].name, &obj); if (obj == NULL) continue; @@ -106,9 +106,9 @@ check_options(cfg_obj_t *options, isc_log_t *logctx) { (void)cfg_map_get(options, "root-delegation-only", &obj); if (obj != NULL) { if (!cfg_obj_isvoid(obj)) { - cfg_listelt_t *element; - cfg_obj_t *exclude; - char *str; + const cfg_listelt_t *element; + const cfg_obj_t *exclude; + const char *str; dns_fixedname_t fixed; dns_name_t *name; isc_buffer_t b; @@ -151,15 +151,15 @@ typedef struct { } optionstable; static isc_result_t -check_zoneconf(cfg_obj_t *zconfig, isc_symtab_t *symtab, isc_log_t *logctx, - isc_mem_t *mctx) +check_zoneconf(const cfg_obj_t *zconfig, isc_symtab_t *symtab, + isc_log_t *logctx, isc_mem_t *mctx) { const char *zname; const char *typestr; unsigned int ztype; - cfg_obj_t *zoptions; - cfg_obj_t *obj = NULL; - cfg_obj_t *addrlist = NULL; + const cfg_obj_t *zoptions; + const cfg_obj_t *obj = NULL; + const cfg_obj_t *addrlist = NULL; isc_symvalue_t symvalue; isc_result_t result = ISC_R_SUCCESS; isc_result_t tresult; @@ -349,10 +349,10 @@ check_zoneconf(cfg_obj_t *zconfig, isc_symtab_t *symtab, isc_log_t *logctx, * Check the excessively complicated "dialup" option. */ if (ztype == MASTERZONE || ztype == SLAVEZONE || ztype == STUBZONE) { - cfg_obj_t *dialup = NULL; + const cfg_obj_t *dialup = NULL; cfg_map_get(zoptions, "dialup", &dialup); if (dialup != NULL && cfg_obj_isstring(dialup)) { - char *str = cfg_obj_asstring(dialup); + const char *str = cfg_obj_asstring(dialup); for (i = 0; i < sizeof(dialups) / sizeof(dialups[0]); i++) @@ -417,9 +417,9 @@ check_zoneconf(cfg_obj_t *zconfig, isc_symtab_t *symtab, isc_log_t *logctx, } isc_result_t -cfg_check_key(cfg_obj_t *key, isc_log_t *logctx) { - cfg_obj_t *algobj = NULL; - cfg_obj_t *secretobj = NULL; +cfg_check_key(const cfg_obj_t *key, isc_log_t *logctx) { + const cfg_obj_t *algobj = NULL; + const cfg_obj_t *secretobj = NULL; const char *keyname = cfg_obj_asstring(cfg_map_getname(key)); cfg_map_get(key, "algorithm", &algobj); @@ -435,16 +435,16 @@ cfg_check_key(cfg_obj_t *key, isc_log_t *logctx) { } static isc_result_t -check_keylist(cfg_obj_t *keys, isc_symtab_t *symtab, isc_log_t *logctx) { +check_keylist(const cfg_obj_t *keys, isc_symtab_t *symtab, isc_log_t *logctx) { isc_result_t result = ISC_R_SUCCESS; isc_result_t tresult; - cfg_listelt_t *element; + const cfg_listelt_t *element; for (element = cfg_list_first(keys); element != NULL; element = cfg_list_next(element)) { - cfg_obj_t *key = cfg_listelt_value(element); + const cfg_obj_t *key = cfg_listelt_value(element); const char *keyname = cfg_obj_asstring(cfg_map_getname(key)); isc_symvalue_t symvalue; @@ -466,11 +466,11 @@ check_keylist(cfg_obj_t *keys, isc_symtab_t *symtab, isc_log_t *logctx) { } static isc_result_t -check_servers(cfg_obj_t *servers, isc_log_t *logctx) { +check_servers(const cfg_obj_t *servers, isc_log_t *logctx) { isc_result_t result = ISC_R_SUCCESS; - cfg_listelt_t *e1, *e2; - cfg_obj_t *v1, *v2; - isc_sockaddr_t *s1, *s2; + const cfg_listelt_t *e1, *e2; + const cfg_obj_t *v1, *v2; + const isc_sockaddr_t *s1, *s2; isc_netaddr_t na; for (e1 = cfg_list_first(servers); e1 != NULL; e1 = cfg_list_next(e1)) { @@ -501,12 +501,13 @@ check_servers(cfg_obj_t *servers, isc_log_t *logctx) { } static isc_result_t -check_viewconf(cfg_obj_t *config, cfg_obj_t *vconfig, isc_log_t *logctx, isc_mem_t *mctx) +check_viewconf(const cfg_obj_t *config, const cfg_obj_t *vconfig, + isc_log_t *logctx, isc_mem_t *mctx) { - cfg_obj_t *servers = NULL; - cfg_obj_t *zones = NULL; - cfg_obj_t *keys = NULL; - cfg_listelt_t *element; + const cfg_obj_t *servers = NULL; + const cfg_obj_t *zones = NULL; + const cfg_obj_t *keys = NULL; + const cfg_listelt_t *element; isc_symtab_t *symtab = NULL; isc_result_t result = ISC_R_SUCCESS; isc_result_t tresult = ISC_R_SUCCESS; @@ -529,7 +530,7 @@ check_viewconf(cfg_obj_t *config, cfg_obj_t *vconfig, isc_log_t *logctx, isc_mem element != NULL; element = cfg_list_next(element)) { - cfg_obj_t *zone = cfg_listelt_value(element); + const cfg_obj_t *zone = cfg_listelt_value(element); if (check_zoneconf(zone, symtab, logctx, mctx) != ISC_R_SUCCESS) result = ISC_R_FAILURE; @@ -572,7 +573,7 @@ check_viewconf(cfg_obj_t *config, cfg_obj_t *vconfig, isc_log_t *logctx, isc_mem * Check that forwarding is reasonable. */ if (vconfig == NULL) { - cfg_obj_t *options = NULL; + const cfg_obj_t *options = NULL; cfg_map_get(config, "options", &options); if (options != NULL) if (check_forward(options, logctx) != ISC_R_SUCCESS) @@ -602,13 +603,15 @@ check_viewconf(cfg_obj_t *config, cfg_obj_t *vconfig, isc_log_t *logctx, isc_mem isc_result_t -cfg_check_namedconf(cfg_obj_t *config, isc_log_t *logctx, isc_mem_t *mctx) { - cfg_obj_t *options = NULL; - cfg_obj_t *servers = NULL; - cfg_obj_t *views = NULL; - cfg_obj_t *acls = NULL; - cfg_obj_t *obj; - cfg_listelt_t *velement; +cfg_check_namedconf(const cfg_obj_t *config, isc_log_t *logctx, + isc_mem_t *mctx) +{ + const cfg_obj_t *options = NULL; + const cfg_obj_t *servers = NULL; + const cfg_obj_t *views = NULL; + const cfg_obj_t *acls = NULL; + const cfg_obj_t *obj; + const cfg_listelt_t *velement; isc_result_t result = ISC_R_SUCCESS; isc_result_t tresult; isc_symtab_t *symtab = NULL; @@ -634,7 +637,7 @@ cfg_check_namedconf(cfg_obj_t *config, isc_log_t *logctx, isc_mem_t *mctx) { != ISC_R_SUCCESS) result = ISC_R_FAILURE; } else { - cfg_obj_t *zones = NULL; + const cfg_obj_t *zones = NULL; (void)cfg_map_get(config, "zone", &zones); if (zones != NULL) { @@ -652,10 +655,10 @@ cfg_check_namedconf(cfg_obj_t *config, isc_log_t *logctx, isc_mem_t *mctx) { velement != NULL; velement = cfg_list_next(velement)) { - cfg_obj_t *view = cfg_listelt_value(velement); - cfg_obj_t *vname = cfg_tuple_get(view, "name"); - cfg_obj_t *voptions = cfg_tuple_get(view, "options"); - cfg_obj_t *vclassobj = cfg_tuple_get(view, "class"); + const cfg_obj_t *view = cfg_listelt_value(velement); + const cfg_obj_t *vname = cfg_tuple_get(view, "name"); + const cfg_obj_t *voptions = cfg_tuple_get(view, "options"); + const cfg_obj_t *vclassobj = cfg_tuple_get(view, "class"); dns_rdataclass_t vclass = dns_rdataclass_in; isc_result_t tresult = ISC_R_SUCCESS; const char *key = cfg_obj_asstring(vname); @@ -673,7 +676,7 @@ cfg_check_namedconf(cfg_obj_t *config, isc_log_t *logctx, isc_mem_t *mctx) { cfg_obj_asstring(vname), r.base); } if (tresult == ISC_R_SUCCESS && symtab != NULL) { - symvalue.as_pointer = view; + symvalue.as_cpointer = view; tresult = isc_symtab_define(symtab, key, vclass, symvalue, isc_symexists_reject); @@ -713,14 +716,14 @@ cfg_check_namedconf(cfg_obj_t *config, isc_log_t *logctx, isc_mem_t *mctx) { tresult = cfg_map_get(config, "acl", &acls); if (tresult == ISC_R_SUCCESS) { - cfg_listelt_t *elt; - cfg_listelt_t *elt2; + const cfg_listelt_t *elt; + const cfg_listelt_t *elt2; const char *aclname; for (elt = cfg_list_first(acls); elt != NULL; elt = cfg_list_next(elt)) { - cfg_obj_t *acl = cfg_listelt_value(elt); + const cfg_obj_t *acl = cfg_listelt_value(elt); unsigned int i; aclname = cfg_obj_asstring(cfg_tuple_get(acl, "name")); @@ -739,7 +742,7 @@ cfg_check_namedconf(cfg_obj_t *config, isc_log_t *logctx, isc_mem_t *mctx) { for (elt2 = cfg_list_next(elt); elt2 != NULL; elt2 = cfg_list_next(elt2)) { - cfg_obj_t *acl2 = cfg_listelt_value(elt2); + const cfg_obj_t *acl2 = cfg_listelt_value(elt2); const char *name; name = cfg_obj_asstring(cfg_tuple_get(acl2, "name")); diff --git a/lib/isccfg/include/isccfg/cfg.h b/lib/isccfg/include/isccfg/cfg.h index c7fa8cbafb..46c04c90b3 100644 --- a/lib/isccfg/include/isccfg/cfg.h +++ b/lib/isccfg/include/isccfg/cfg.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: cfg.h,v 1.30.2.1 2004/03/09 06:12:31 marka Exp $ */ +/* $Id: cfg.h,v 1.30.2.2 2006/03/01 01:34:08 marka Exp $ */ #ifndef ISCCFG_CFG_H #define ISCCFG_CFG_H 1 @@ -75,7 +75,7 @@ typedef struct cfg_listelt cfg_listelt_t; * "directory". */ typedef isc_result_t -(*cfg_parsecallback_t)(const char *clausename, cfg_obj_t *obj, void *arg); +(*cfg_parsecallback_t)(const char *clausename, const cfg_obj_t *obj, void *arg); /*** *** Functions @@ -144,20 +144,20 @@ cfg_parser_destroy(cfg_parser_t **pctxp); */ isc_boolean_t -cfg_obj_isvoid(cfg_obj_t *obj); +cfg_obj_isvoid(const cfg_obj_t *obj); /* * Return true iff 'obj' is of void type (e.g., an optional * value not specified). */ isc_boolean_t -cfg_obj_ismap(cfg_obj_t *obj); +cfg_obj_ismap(const cfg_obj_t *obj); /* * Return true iff 'obj' is of a map type. */ isc_result_t -cfg_map_get(cfg_obj_t *mapobj, const char* name, cfg_obj_t **obj); +cfg_map_get(const cfg_obj_t *mapobj, const char* name, const cfg_obj_t **obj); /* * Extract an element from a configuration object, which * must be of a map type. @@ -172,8 +172,8 @@ cfg_map_get(cfg_obj_t *mapobj, const char* name, cfg_obj_t **obj); * ISC_R_NOTFOUND - name not found in map */ -cfg_obj_t * -cfg_map_getname(cfg_obj_t *mapobj); +const cfg_obj_t * +cfg_map_getname(const cfg_obj_t *mapobj); /* * Get the name of a named map object, like a server "key" clause. * @@ -186,13 +186,13 @@ cfg_map_getname(cfg_obj_t *mapobj); */ isc_boolean_t -cfg_obj_istuple(cfg_obj_t *obj); +cfg_obj_istuple(const cfg_obj_t *obj); /* * Return true iff 'obj' is of a map type. */ -cfg_obj_t * -cfg_tuple_get(cfg_obj_t *tupleobj, const char *name); +const cfg_obj_t * +cfg_tuple_get(const cfg_obj_t *tupleobj, const char *name); /* * Extract an element from a configuration object, which * must be of a tuple type. @@ -204,13 +204,13 @@ cfg_tuple_get(cfg_obj_t *tupleobj, const char *name); */ isc_boolean_t -cfg_obj_isuint32(cfg_obj_t *obj); +cfg_obj_isuint32(const cfg_obj_t *obj); /* * Return true iff 'obj' is of integer type. */ isc_uint32_t -cfg_obj_asuint32(cfg_obj_t *obj); +cfg_obj_asuint32(const cfg_obj_t *obj); /* * Returns the value of a configuration object of 32-bit integer type. * @@ -222,13 +222,13 @@ cfg_obj_asuint32(cfg_obj_t *obj); */ isc_boolean_t -cfg_obj_isuint64(cfg_obj_t *obj); +cfg_obj_isuint64(const cfg_obj_t *obj); /* * Return true iff 'obj' is of integer type. */ isc_uint64_t -cfg_obj_asuint64(cfg_obj_t *obj); +cfg_obj_asuint64(const cfg_obj_t *obj); /* * Returns the value of a configuration object of 64-bit integer type. * @@ -240,13 +240,13 @@ cfg_obj_asuint64(cfg_obj_t *obj); */ isc_boolean_t -cfg_obj_isstring(cfg_obj_t *obj); +cfg_obj_isstring(const cfg_obj_t *obj); /* * Return true iff 'obj' is of string type. */ -char * -cfg_obj_asstring(cfg_obj_t *obj); +const char * +cfg_obj_asstring(const cfg_obj_t *obj); /* * Returns the value of a configuration object of a string type * as a null-terminated string. @@ -259,13 +259,13 @@ cfg_obj_asstring(cfg_obj_t *obj); */ isc_boolean_t -cfg_obj_isboolean(cfg_obj_t *obj); +cfg_obj_isboolean(const cfg_obj_t *obj); /* * Return true iff 'obj' is of a boolean type. */ isc_boolean_t -cfg_obj_asboolean(cfg_obj_t *obj); +cfg_obj_asboolean(const cfg_obj_t *obj); /* * Returns the value of a configuration object of a boolean type. * @@ -277,13 +277,13 @@ cfg_obj_asboolean(cfg_obj_t *obj); */ isc_boolean_t -cfg_obj_issockaddr(cfg_obj_t *obj); +cfg_obj_issockaddr(const cfg_obj_t *obj); /* * Return true iff 'obj' is a socket address. */ -isc_sockaddr_t * -cfg_obj_assockaddr(cfg_obj_t *obj); +const isc_sockaddr_t * +cfg_obj_assockaddr(const cfg_obj_t *obj); /* * Returns the value of a configuration object representing a socket address. * @@ -296,13 +296,13 @@ cfg_obj_assockaddr(cfg_obj_t *obj); */ isc_boolean_t -cfg_obj_isnetprefix(cfg_obj_t *obj); +cfg_obj_isnetprefix(const cfg_obj_t *obj); /* * Return true iff 'obj' is a network prefix. */ void -cfg_obj_asnetprefix(cfg_obj_t *obj, isc_netaddr_t *netaddr, +cfg_obj_asnetprefix(const cfg_obj_t *obj, isc_netaddr_t *netaddr, unsigned int *prefixlen); /* * Gets the value of a configuration object representing a network @@ -315,13 +315,13 @@ cfg_obj_asnetprefix(cfg_obj_t *obj, isc_netaddr_t *netaddr, */ isc_boolean_t -cfg_obj_islist(cfg_obj_t *obj); +cfg_obj_islist(const cfg_obj_t *obj); /* * Return true iff 'obj' is of list type. */ -cfg_listelt_t * -cfg_list_first(cfg_obj_t *obj); +const cfg_listelt_t * +cfg_list_first(const cfg_obj_t *obj); /* * Returns the first list element in a configuration object of a list type. * @@ -333,8 +333,8 @@ cfg_list_first(cfg_obj_t *obj); * or NULL if the list is empty or nonexistent. */ -cfg_listelt_t * -cfg_list_next(cfg_listelt_t *elt); +const cfg_listelt_t * +cfg_list_next(const cfg_listelt_t *elt); /* * Returns the next element of a list of configuration objects. * @@ -347,8 +347,8 @@ cfg_list_next(cfg_listelt_t *elt); * or NULL if there are no more elements. */ -cfg_obj_t * -cfg_listelt_value(cfg_listelt_t *elt); +const cfg_obj_t * +cfg_listelt_value(const cfg_listelt_t *elt); /* * Returns the configuration object associated with cfg_listelt_t. * @@ -361,7 +361,7 @@ cfg_listelt_value(cfg_listelt_t *elt); */ void -cfg_print(cfg_obj_t *obj, +cfg_print(const cfg_obj_t *obj, void (*f)(void *closure, const char *text, int textlen), void *closure); /* @@ -379,7 +379,7 @@ cfg_print_grammar(const cfg_type_t *type, */ isc_boolean_t -cfg_obj_istype(cfg_obj_t *obj, const cfg_type_t *type); +cfg_obj_istype(const cfg_obj_t *obj, const cfg_type_t *type); /* * Return true iff 'obj' is of type 'type'. */ @@ -390,7 +390,8 @@ void cfg_obj_destroy(cfg_parser_t *pctx, cfg_obj_t **obj); */ void -cfg_obj_log(cfg_obj_t *obj, isc_log_t *lctx, int level, const char *fmt, ...) +cfg_obj_log(const cfg_obj_t *obj, isc_log_t *lctx, int level, + const char *fmt, ...) ISC_FORMAT_PRINTF(4, 5); /* * Log a message concerning configuration object 'obj' to the logging diff --git a/lib/isccfg/include/isccfg/check.h b/lib/isccfg/include/isccfg/check.h index b45e385a10..0c9811673c 100644 --- a/lib/isccfg/include/isccfg/check.h +++ b/lib/isccfg/include/isccfg/check.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: check.h,v 1.4.2.1 2004/03/09 06:12:31 marka Exp $ */ +/* $Id: check.h,v 1.4.2.2 2006/03/01 01:34:08 marka Exp $ */ #ifndef ISCCFG_CHECK_H #define ISCCFG_CHECK_H 1 @@ -28,7 +28,8 @@ ISC_LANG_BEGINDECLS isc_result_t -cfg_check_namedconf(cfg_obj_t *config, isc_log_t *logctx, isc_mem_t *mctx); +cfg_check_namedconf(const cfg_obj_t *config, isc_log_t *logctx, + isc_mem_t *mctx); /* * Check the syntactic validity of a configuration parse tree generated from * a named.conf file. @@ -44,7 +45,7 @@ cfg_check_namedconf(cfg_obj_t *config, isc_log_t *logctx, isc_mem_t *mctx); */ isc_result_t -cfg_check_key(cfg_obj_t *config, isc_log_t *logctx); +cfg_check_key(const cfg_obj_t *config, isc_log_t *logctx); /* * As above, but for a single 'key' statement. */ diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 7d48910da4..32146a167f 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: parser.c,v 1.70.2.27 2006/01/04 23:50:17 marka Exp $ */ +/* $Id: parser.c,v 1.70.2.28 2006/03/01 01:34:07 marka Exp $ */ #include @@ -101,7 +101,7 @@ typedef struct cfg_rep cfg_rep_t; typedef isc_result_t (*cfg_parsefunc_t)(cfg_parser_t *, const cfg_type_t *type, cfg_obj_t **); -typedef void (*cfg_printfunc_t)(cfg_printer_t *, cfg_obj_t *); +typedef void (*cfg_printfunc_t)(cfg_printer_t *, const cfg_obj_t *); typedef void (*cfg_freefunc_t)(cfg_parser_t *, cfg_obj_t *); @@ -290,7 +290,7 @@ static void print(cfg_printer_t *pctx, const char *text, int len); static void -print_void(cfg_printer_t *pctx, cfg_obj_t *obj); +print_void(cfg_printer_t *pctx, const cfg_obj_t *obj); static isc_result_t parse_enum_or_other(cfg_parser_t *pctx, const cfg_type_t *enumtype, @@ -300,13 +300,13 @@ static isc_result_t parse_mapbody(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); static void -print_mapbody(cfg_printer_t *pctx, cfg_obj_t *obj); +print_mapbody(cfg_printer_t *pctx, const cfg_obj_t *obj); static isc_result_t parse_map(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); static void -print_map(cfg_printer_t *pctx, cfg_obj_t *obj); +print_map(cfg_printer_t *pctx, const cfg_obj_t *obj); static isc_result_t parse_named_map(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); @@ -318,13 +318,13 @@ static isc_result_t parse_list(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); static void -print_list(cfg_printer_t *pctx, cfg_obj_t *obj); +print_list(cfg_printer_t *pctx, const cfg_obj_t *obj); static isc_result_t parse_tuple(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); static void -print_tuple(cfg_printer_t *pctx, cfg_obj_t *obj); +print_tuple(cfg_printer_t *pctx, const cfg_obj_t *obj); static void free_tuple(cfg_parser_t *pctx, cfg_obj_t *obj); @@ -333,10 +333,10 @@ static isc_result_t parse_spacelist(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); static void -print_spacelist(cfg_printer_t *pctx, cfg_obj_t *obj); +print_spacelist(cfg_printer_t *pctx, const cfg_obj_t *obj); static void -print_sockaddr(cfg_printer_t *pctx, cfg_obj_t *obj); +print_sockaddr(cfg_printer_t *pctx, const cfg_obj_t *obj); static isc_result_t parse_addrmatchelt(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); @@ -345,7 +345,7 @@ static isc_result_t parse_bracketed_list(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); static void -print_bracketed_list(cfg_printer_t *pctx, cfg_obj_t *obj); +print_bracketed_list(cfg_printer_t *pctx, const cfg_obj_t *obj); static isc_result_t parse_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); @@ -354,7 +354,7 @@ static isc_result_t parse_optional_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); static void -print_keyvalue(cfg_printer_t *pctx, cfg_obj_t *obj); +print_keyvalue(cfg_printer_t *pctx, const cfg_obj_t *obj); static isc_result_t parse_symtab_elt(cfg_parser_t *pctx, const char *name, @@ -389,10 +389,10 @@ parser_complain(cfg_parser_t *pctx, isc_boolean_t is_warning, unsigned int flags, const char *format, va_list args); static void -print_uint32(cfg_printer_t *pctx, cfg_obj_t *obj); +print_uint32(cfg_printer_t *pctx, const cfg_obj_t *obj); static void -print_ustring(cfg_printer_t *pctx, cfg_obj_t *obj); +print_ustring(cfg_printer_t *pctx, const cfg_obj_t *obj); static isc_result_t parse_enum(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); @@ -1132,7 +1132,7 @@ static cfg_type_t cfg_type_logging = { /* Functions. */ static void -print_obj(cfg_printer_t *pctx, cfg_obj_t *obj) { +print_obj(cfg_printer_t *pctx, const cfg_obj_t *obj) { obj->type->print(pctx, obj); } @@ -1175,7 +1175,7 @@ parse(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { } void -cfg_print(cfg_obj_t *obj, +cfg_print(const cfg_obj_t *obj, void (*f)(void *closure, const char *text, int textlen), void *closure) { @@ -1241,7 +1241,7 @@ parse_tuple(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) } static void -print_tuple(cfg_printer_t *pctx, cfg_obj_t *obj) { +print_tuple(cfg_printer_t *pctx, const cfg_obj_t *obj) { unsigned int i; const cfg_tuplefielddef_t *fields = obj->type->of; const cfg_tuplefielddef_t *f; @@ -1275,13 +1275,13 @@ free_tuple(cfg_parser_t *pctx, cfg_obj_t *obj) { } isc_boolean_t -cfg_obj_istuple(cfg_obj_t *obj) { +cfg_obj_istuple(const cfg_obj_t *obj) { REQUIRE(obj != NULL); return (ISC_TF(obj->type->rep == &cfg_rep_tuple)); } -cfg_obj_t * -cfg_tuple_get(cfg_obj_t *tupleobj, const char* name) { +const cfg_obj_t * +cfg_tuple_get(const cfg_obj_t *tupleobj, const char* name) { unsigned int i; const cfg_tuplefielddef_t *fields; const cfg_tuplefielddef_t *f; @@ -1536,13 +1536,13 @@ parse_void(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { } static void -print_void(cfg_printer_t *pctx, cfg_obj_t *obj) { +print_void(cfg_printer_t *pctx, const cfg_obj_t *obj) { UNUSED(pctx); UNUSED(obj); } isc_boolean_t -cfg_obj_isvoid(cfg_obj_t *obj) { +cfg_obj_isvoid(const cfg_obj_t *obj) { REQUIRE(obj != NULL); return (ISC_TF(obj->type->rep == &cfg_rep_void)); } @@ -1587,18 +1587,18 @@ print_uint(cfg_printer_t *pctx, unsigned int u) { } static void -print_uint32(cfg_printer_t *pctx, cfg_obj_t *obj) { +print_uint32(cfg_printer_t *pctx, const cfg_obj_t *obj) { print_uint(pctx, obj->value.uint32); } isc_boolean_t -cfg_obj_isuint32(cfg_obj_t *obj) { +cfg_obj_isuint32(const cfg_obj_t *obj) { REQUIRE(obj != NULL); return (ISC_TF(obj->type->rep == &cfg_rep_uint32)); } isc_uint32_t -cfg_obj_asuint32(cfg_obj_t *obj) { +cfg_obj_asuint32(const cfg_obj_t *obj) { REQUIRE(obj != NULL && obj->type->rep == &cfg_rep_uint32); return (obj->value.uint32); } @@ -1611,13 +1611,13 @@ static cfg_type_t cfg_type_uint32 = { * uint64 */ isc_boolean_t -cfg_obj_isuint64(cfg_obj_t *obj) { +cfg_obj_isuint64(const cfg_obj_t *obj) { REQUIRE(obj != NULL); return (ISC_TF(obj->type->rep == &cfg_rep_uint64)); } isc_uint64_t -cfg_obj_asuint64(cfg_obj_t *obj) { +cfg_obj_asuint64(const cfg_obj_t *obj) { REQUIRE(obj != NULL && obj->type->rep == &cfg_rep_uint64); return (obj->value.uint64); } @@ -1662,7 +1662,7 @@ parse_unitstring(char *str, isc_resourcevalue_t *valuep) { } static void -print_uint64(cfg_printer_t *pctx, cfg_obj_t *obj) { +print_uint64(cfg_printer_t *pctx, const cfg_obj_t *obj) { char buf[32]; sprintf(buf, "%" ISC_PRINT_QUADFORMAT "u", obj->value.uint64); print_cstr(pctx, buf); @@ -1768,7 +1768,7 @@ parse_optional_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t ** } static void -print_keyvalue(cfg_printer_t *pctx, cfg_obj_t *obj) { +print_keyvalue(cfg_printer_t *pctx, const cfg_obj_t *obj) { const keyword_type_t *kw = obj->type->of; print_cstr(pctx, kw->name); print(pctx, " ", 1); @@ -1907,12 +1907,12 @@ parse_enum_or_other(cfg_parser_t *pctx, const cfg_type_t *enumtype, * Print a string object. */ static void -print_ustring(cfg_printer_t *pctx, cfg_obj_t *obj) { +print_ustring(cfg_printer_t *pctx, const cfg_obj_t *obj) { print(pctx, obj->value.string.base, obj->value.string.length); } static void -print_qstring(cfg_printer_t *pctx, cfg_obj_t *obj) { +print_qstring(cfg_printer_t *pctx, const cfg_obj_t *obj) { print(pctx, "\"", 1); print_ustring(pctx, obj); print(pctx, "\"", 1); @@ -1925,25 +1925,25 @@ free_string(cfg_parser_t *pctx, cfg_obj_t *obj) { } isc_boolean_t -cfg_obj_isstring(cfg_obj_t *obj) { +cfg_obj_isstring(const cfg_obj_t *obj) { REQUIRE(obj != NULL); return (ISC_TF(obj->type->rep == &cfg_rep_string)); } -char * -cfg_obj_asstring(cfg_obj_t *obj) { +const char * +cfg_obj_asstring(const cfg_obj_t *obj) { REQUIRE(obj != NULL && obj->type->rep == &cfg_rep_string); return (obj->value.string.base); } isc_boolean_t -cfg_obj_isboolean(cfg_obj_t *obj) { +cfg_obj_isboolean(const cfg_obj_t *obj) { REQUIRE(obj != NULL); return (ISC_TF(obj->type->rep == &cfg_rep_boolean)); } isc_boolean_t -cfg_obj_asboolean(cfg_obj_t *obj) { +cfg_obj_asboolean(const cfg_obj_t *obj) { REQUIRE(obj != NULL && obj->type->rep == &cfg_rep_boolean); return (obj->value.boolean); } @@ -2005,7 +2005,7 @@ parse_boolean(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) } static void -print_boolean(cfg_printer_t *pctx, cfg_obj_t *obj) { +print_boolean(cfg_printer_t *pctx, const cfg_obj_t *obj) { if (obj->value.boolean) print(pctx, "yes", 3); else @@ -2151,9 +2151,9 @@ parse_list(cfg_parser_t *pctx, const cfg_type_t *listtype, cfg_obj_t **ret) } static void -print_list(cfg_printer_t *pctx, cfg_obj_t *obj) { - cfg_list_t *list = &obj->value.list; - cfg_listelt_t *elt; +print_list(cfg_printer_t *pctx, const cfg_obj_t *obj) { + const cfg_list_t *list = &obj->value.list; + const cfg_listelt_t *elt; for (elt = ISC_LIST_HEAD(*list); elt != NULL; @@ -2176,7 +2176,7 @@ parse_bracketed_list(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret } static void -print_bracketed_list(cfg_printer_t *pctx, cfg_obj_t *obj) { +print_bracketed_list(cfg_printer_t *pctx, const cfg_obj_t *obj) { print_open(pctx); print_list(pctx, obj); print_close(pctx); @@ -2215,9 +2215,9 @@ parse_spacelist(cfg_parser_t *pctx, const cfg_type_t *listtype, cfg_obj_t **ret) } static void -print_spacelist(cfg_printer_t *pctx, cfg_obj_t *obj) { - cfg_list_t *list = &obj->value.list; - cfg_listelt_t *elt; +print_spacelist(cfg_printer_t *pctx, const cfg_obj_t *obj) { + const cfg_list_t *list = &obj->value.list; + const cfg_listelt_t *elt; for (elt = ISC_LIST_HEAD(*list); elt != NULL; @@ -2229,27 +2229,27 @@ print_spacelist(cfg_printer_t *pctx, cfg_obj_t *obj) { } isc_boolean_t -cfg_obj_islist(cfg_obj_t *obj) { +cfg_obj_islist(const cfg_obj_t *obj) { REQUIRE(obj != NULL); return (ISC_TF(obj->type->rep == &cfg_rep_list)); } -cfg_listelt_t * -cfg_list_first(cfg_obj_t *obj) { +const cfg_listelt_t * +cfg_list_first(const cfg_obj_t *obj) { REQUIRE(obj == NULL || obj->type->rep == &cfg_rep_list); if (obj == NULL) return (NULL); return (ISC_LIST_HEAD(obj->value.list)); } -cfg_listelt_t * -cfg_list_next(cfg_listelt_t *elt) { +const cfg_listelt_t * +cfg_list_next(const cfg_listelt_t *elt) { REQUIRE(elt != NULL); return (ISC_LIST_NEXT(elt, link)); } -cfg_obj_t * -cfg_listelt_value(cfg_listelt_t *elt) { +const cfg_obj_t * +cfg_listelt_value(const cfg_listelt_t *elt) { REQUIRE(elt != NULL); return (elt->obj); } @@ -2509,7 +2509,7 @@ parse_addressed_map(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) } static void -print_mapbody(cfg_printer_t *pctx, cfg_obj_t *obj) { +print_mapbody(cfg_printer_t *pctx, const cfg_obj_t *obj) { isc_result_t result = ISC_R_SUCCESS; const cfg_clausedef_t * const *clauseset; @@ -2559,7 +2559,7 @@ print_mapbody(cfg_printer_t *pctx, cfg_obj_t *obj) { } static void -print_map(cfg_printer_t *pctx, cfg_obj_t *obj) { +print_map(cfg_printer_t *pctx, const cfg_obj_t *obj) { if (obj->value.map.id != NULL) { print_obj(pctx, obj->value.map.id); print(pctx, " ", 1); @@ -2570,16 +2570,16 @@ print_map(cfg_printer_t *pctx, cfg_obj_t *obj) { } isc_boolean_t -cfg_obj_ismap(cfg_obj_t *obj) { +cfg_obj_ismap(const cfg_obj_t *obj) { REQUIRE(obj != NULL); return (ISC_TF(obj->type->rep == &cfg_rep_map)); } isc_result_t -cfg_map_get(cfg_obj_t *mapobj, const char* name, cfg_obj_t **obj) { +cfg_map_get(const cfg_obj_t *mapobj, const char* name, const cfg_obj_t **obj) { isc_result_t result; isc_symvalue_t val; - cfg_map_t *map; + const cfg_map_t *map; REQUIRE(mapobj != NULL && mapobj->type->rep == &cfg_rep_map); REQUIRE(name != NULL); @@ -2594,8 +2594,8 @@ cfg_map_get(cfg_obj_t *mapobj, const char* name, cfg_obj_t **obj) { return (ISC_R_SUCCESS); } -cfg_obj_t * -cfg_map_getname(cfg_obj_t *mapobj) { +const cfg_obj_t * +cfg_map_getname(const cfg_obj_t *mapobj) { REQUIRE(mapobj != NULL && mapobj->type->rep == &cfg_rep_map); return (mapobj->value.map.id); } @@ -2936,7 +2936,7 @@ parse_querysource6(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) } static void -print_isc_netaddr(cfg_printer_t *pctx, isc_netaddr_t *na) { +print_isc_netaddr(cfg_printer_t *pctx, const isc_netaddr_t *na) { isc_result_t result; char text[128]; isc_buffer_t buf; @@ -2948,7 +2948,7 @@ print_isc_netaddr(cfg_printer_t *pctx, isc_netaddr_t *na) { } static void -print_querysource(cfg_printer_t *pctx, cfg_obj_t *obj) { +print_querysource(cfg_printer_t *pctx, const cfg_obj_t *obj) { isc_netaddr_t na; isc_netaddr_fromsockaddr(&na, &obj->value.sockaddr); print(pctx, "address ", 8); @@ -3038,21 +3038,21 @@ parse_netprefix(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { } static void -print_netprefix(cfg_printer_t *pctx, cfg_obj_t *obj) { - cfg_netprefix_t *p = &obj->value.netprefix; +print_netprefix(cfg_printer_t *pctx, const cfg_obj_t *obj) { + const cfg_netprefix_t *p = &obj->value.netprefix; print_isc_netaddr(pctx, &p->address); print(pctx, "/", 1); print_uint(pctx, p->prefixlen); } isc_boolean_t -cfg_obj_isnetprefix(cfg_obj_t *obj) { +cfg_obj_isnetprefix(const cfg_obj_t *obj) { REQUIRE(obj != NULL); return (ISC_TF(obj->type->rep == &cfg_rep_netprefix)); } void -cfg_obj_asnetprefix(cfg_obj_t *obj, isc_netaddr_t *netaddr, +cfg_obj_asnetprefix(const cfg_obj_t *obj, isc_netaddr_t *netaddr, unsigned int *prefixlen) { REQUIRE(obj != NULL && obj->type->rep == &cfg_rep_netprefix); *netaddr = obj->value.netprefix.address; @@ -3115,7 +3115,7 @@ static cfg_tuplefielddef_t negated_fields[] = { }; static void -print_negated(cfg_printer_t *pctx, cfg_obj_t *obj) { +print_negated(cfg_printer_t *pctx, const cfg_obj_t *obj) { print(pctx, "!", 1); print_tuple(pctx, obj); } @@ -3167,7 +3167,7 @@ parse_sockaddr(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { } static void -print_sockaddr(cfg_printer_t *pctx, cfg_obj_t *obj) { +print_sockaddr(cfg_printer_t *pctx, const cfg_obj_t *obj) { isc_netaddr_t netaddr; in_port_t port; char buf[ISC_NETADDR_FORMATSIZE]; @@ -3183,13 +3183,13 @@ print_sockaddr(cfg_printer_t *pctx, cfg_obj_t *obj) { } isc_boolean_t -cfg_obj_issockaddr(cfg_obj_t *obj) { +cfg_obj_issockaddr(const cfg_obj_t *obj) { REQUIRE(obj != NULL); return (ISC_TF(obj->type->rep == &cfg_rep_sockaddr)); } -isc_sockaddr_t * -cfg_obj_assockaddr(cfg_obj_t *obj) { +const isc_sockaddr_t * +cfg_obj_assockaddr(const cfg_obj_t *obj) { REQUIRE(obj != NULL && obj->type->rep == &cfg_rep_sockaddr); return (&obj->value.sockaddr); } @@ -3400,7 +3400,7 @@ parse_logfile(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { } static void -print_logfile(cfg_printer_t *pctx, cfg_obj_t *obj) { +print_logfile(cfg_printer_t *pctx, const cfg_obj_t *obj) { print_obj(pctx, obj->value.tuple[0]); /* file */ if (obj->value.tuple[1]->type->print != print_void) { print(pctx, " versions ", 10); @@ -3720,7 +3720,8 @@ parser_complain(cfg_parser_t *pctx, isc_boolean_t is_warning, } void -cfg_obj_log(cfg_obj_t *obj, isc_log_t *lctx, int level, const char *fmt, ...) { +cfg_obj_log(const cfg_obj_t *obj, isc_log_t *lctx, int level, + const char *fmt, ...) { va_list ap; char msgbuf[2048]; @@ -3794,7 +3795,7 @@ free_map(cfg_parser_t *pctx, cfg_obj_t *obj) { } isc_boolean_t -cfg_obj_istype(cfg_obj_t *obj, const cfg_type_t *type) { +cfg_obj_istype(const cfg_obj_t *obj, const cfg_type_t *type) { return (ISC_TF(obj->type == type)); }