From 01fa4e36346063cd60c548419bb3ed9bf0f91eae Mon Sep 17 00:00:00 2001 From: James Brister Date: Tue, 26 Oct 1999 15:25:38 +0000 Subject: [PATCH] Removed tkey from server statement. Added integer argument to tkey options value. --- lib/dns/config/confctx.c | 44 ++++++++---- lib/dns/config/confparser.y | 47 +----------- lib/dns/config/confserv.c | 127 --------------------------------- lib/dns/include/dns/confctx.h | 13 ++-- lib/dns/include/dns/confserv.h | 10 --- 5 files changed, 41 insertions(+), 200 deletions(-) diff --git a/lib/dns/config/confctx.c b/lib/dns/config/confctx.c index 96db9b0a87..ba4ba2a550 100644 --- a/lib/dns/config/confctx.c +++ b/lib/dns/config/confctx.c @@ -731,8 +731,8 @@ dns_c_ctx_settkeydomain(isc_log_t *lctx, isc_result_t -dns_c_ctx_settkeydhkey(isc_log_t *lctx, - dns_c_ctx_t *cfg, const char *newval) +dns_c_ctx_settkeydhkey(isc_log_t *lctx, dns_c_ctx_t *cfg, + const char *charval, isc_int32_t intval) { isc_result_t res; @@ -742,10 +742,11 @@ dns_c_ctx_settkeydhkey(isc_log_t *lctx, if (res != ISC_R_SUCCESS) { return (res); } - + + cfg->options->tkeydhkeyi = intval; return (cfg_set_string(lctx, cfg->options, - &cfg->options->tkeydhkey, - newval)); + &cfg->options->tkeydhkeycp, + charval)); } @@ -1956,13 +1957,16 @@ dns_c_ctx_gettkeydomain(isc_log_t *lctx, isc_result_t -dns_c_ctx_gettkeydhkey(isc_log_t *lctx, - dns_c_ctx_t *cfg, char **retval) +dns_c_ctx_gettkeydhkey(isc_log_t *lctx, dns_c_ctx_t *cfg, + char **charpval, isc_int32_t *intval) { + isc_result_t res; + (void) lctx; REQUIRE(DNS_CONFCTX_VALID(cfg)); - REQUIRE(retval != NULL); + REQUIRE(charpval != NULL); + REQUIRE(intval != NULL); if (cfg->options == NULL) { return (ISC_R_NOTFOUND); @@ -1970,9 +1974,15 @@ dns_c_ctx_gettkeydhkey(isc_log_t *lctx, REQUIRE(DNS_CONFOPT_VALID(cfg->options)); - *retval = cfg->options->tkeydhkey; + if (cfg->options->tkeydhkeycp == NULL) { + res = ISC_R_NOTFOUND; + } else { + *charpval = cfg->options->tkeydhkeycp; + *intval = cfg->options->tkeydhkeyi; + res = ISC_R_SUCCESS; + } - return (*retval == NULL ? ISC_R_NOTFOUND : ISC_R_SUCCESS); + return (res); } @@ -2883,7 +2893,8 @@ dns_c_ctx_optionsnew(isc_log_t *lctx, opts->memstats_filename = NULL; opts->named_xfer = NULL; opts->tkeydomain = NULL; - opts->tkeydhkey = NULL; + opts->tkeydhkeycp = NULL; + opts->tkeydhkeyi = 0; opts->mem = mem; opts->magic = OPTION_MAGIC; @@ -2994,8 +3005,8 @@ dns_c_ctx_optionsdelete(isc_log_t *lctx, isc_mem_free(options->mem, options->tkeydomain); } - if (options->tkeydhkey != NULL) { - isc_mem_free(options->mem, options->tkeydhkey); + if (options->tkeydhkeycp != NULL) { + isc_mem_free(options->mem, options->tkeydhkeycp); } r = dns_c_ipmatchlist_delete(lctx, &options->queryacl); @@ -3099,8 +3110,13 @@ dns_c_ctx_optionsprint(isc_log_t *lctx, PRINT_CHAR_P(memstats_filename, "memstatistics-file"); PRINT_CHAR_P(named_xfer, "named-xfer"); PRINT_CHAR_P(tkeydomain, "tkey-domain"); - PRINT_CHAR_P(tkeydhkey, "tkey-dhkey"); + if (options->tkeydhkeycp != NULL) { + dns_c_printtabs(lctx, fp, indent + 1); + fprintf(fp, "tkey-dhkey \"%s\" %d ;\n", + options->tkeydhkeycp, options->tkeydhkeyi); + } + PRINT_INTEGER(transfers_in, TRANSFERS_IN_BIT, "transfers-in", setflags1); PRINT_INTEGER(transfers_per_ns, TRANSFERS_PER_NS_BIT, diff --git a/lib/dns/config/confparser.y b/lib/dns/config/confparser.y index 7673e73976..4b2af770c1 100644 --- a/lib/dns/config/confparser.y +++ b/lib/dns/config/confparser.y @@ -17,7 +17,7 @@ */ #if !defined(lint) && !defined(SABER) -static char rcsid[] = "$Id: confparser.y,v 1.13 1999/10/25 10:00:38 brister Exp $"; +static char rcsid[] = "$Id: confparser.y,v 1.14 1999/10/26 15:25:36 brister Exp $"; #endif /* not lint */ #include @@ -450,9 +450,9 @@ option: /* Empty */ isc_mem_free(memctx, $2); } - | L_TKEY_DHKEY L_QSTRING + | L_TKEY_DHKEY L_QSTRING L_INTEGER { - tmpres = dns_c_ctx_settkeydhkey(logcontext, currcfg, $2); + tmpres = dns_c_ctx_settkeydhkey(logcontext, currcfg, $2, $3); if (tmpres == ISC_R_EXISTS) { parser_error(ISC_FALSE, "Redefining tkey-dhkey"); @@ -1961,47 +1961,6 @@ server_info: L_BOGUS yea_or_nay } } } key_list L_RBRACE - | L_TKEY_DOMAIN L_QSTRING - { - dns_c_srv_t *server; - - INSIST(currcfg->servers != NULL); - server = ISC_LIST_TAIL(currcfg->servers->elements); - INSIST(server != NULL); - - tmpres = dns_c_srv_settkeydomain(logcontext, server, $2); - - if (tmpres == ISC_R_EXISTS) { - parser_error(ISC_FALSE, "Redefining tkey-domain"); - } else if (tmpres != ISC_R_SUCCESS) { - parser_error(ISC_FALSE, - "set tkey-domain error: %s: %s", - isc_result_totext(tmpres), $2); - YYABORT; - } - - isc_mem_free(memctx, $2); - } - | L_TKEY_DHKEY L_QSTRING - { - dns_c_srv_t *server; - - INSIST(currcfg->servers != NULL); - server = ISC_LIST_TAIL(currcfg->servers->elements); - INSIST(server != NULL); - - tmpres = dns_c_srv_settkeydhkey(logcontext, server, $2); - - if (tmpres == ISC_R_EXISTS) { - parser_error(ISC_FALSE, "Redefining tkey-dhkey"); - } else if (tmpres != ISC_R_SUCCESS) { - parser_error(ISC_FALSE, "set tkey-dhkey error: %s: %s", - isc_result_totext(tmpres), $2); - YYABORT; - } - - isc_mem_free(memctx, $2); - } ; /* diff --git a/lib/dns/config/confserv.c b/lib/dns/config/confserv.c index 504004d30d..5c7a777723 100644 --- a/lib/dns/config/confserv.c +++ b/lib/dns/config/confserv.c @@ -181,8 +181,6 @@ dns_c_srv_new(isc_log_t *lctx, isc_mem_t *mem, isc_sockaddr_t addr, serv->transfers = 0; serv->support_ixfr = ISC_FALSE; serv->keys = NULL; - serv->tkeydomain = NULL; - serv->tkeydhkey = NULL; memset(&serv->bitflags, 0x0, sizeof serv->bitflags); @@ -211,14 +209,6 @@ dns_c_srv_delete(isc_log_t *lctx, dns_c_srv_t **server) serv->mem = NULL; dns_c_kidlist_delete(lctx, &serv->keys); - if (serv->tkeydomain != NULL) { - isc_mem_free(mem, serv->tkeydomain); - } - - if (serv->tkeydhkey != NULL) { - isc_mem_free(mem, serv->tkeydhkey); - } - isc_mem_put(mem, serv, sizeof *serv); *server = NULL; @@ -266,16 +256,6 @@ dns_c_srv_print(isc_log_t *lctx, FILE *fp, int indent, dns_c_srv_t *server) dns_c_kidlist_print(lctx, fp, indent + 1, server->keys); } - if (server->tkeydomain != NULL) { - dns_c_printtabs(lctx, fp, indent + 1); - fprintf(fp, "tkey-domain \"%s\";\n", server->tkeydomain); - } - - if (server->tkeydhkey != NULL) { - dns_c_printtabs(lctx, fp, indent + 1); - fprintf(fp, "tkey-dhkey \"%s\";\n", server->tkeydhkey); - } - dns_c_printtabs(lctx, fp, indent); fprintf(fp, "};\n"); } @@ -409,110 +389,3 @@ dns_c_srv_gettransferformat(isc_log_t *lctx, dns_c_srv_t *server, return (ISC_R_NOTFOUND); } } - - -isc_result_t -dns_c_srv_settkeydomain(isc_log_t *lctx, dns_c_srv_t *server, - char *newval) -{ - isc_boolean_t existed = ISC_FALSE; - isc_result_t res = ISC_R_SUCCESS; - - (void) lctx; - - REQUIRE(server != NULL); - - if (server->tkeydomain != NULL) { - existed = ISC_TRUE; - isc_mem_free(server->mem, server->tkeydomain); - } - - if (newval != NULL) { - server->tkeydomain = isc_mem_strdup(server->mem, newval); - - if (server->tkeydomain == NULL) { - res = ISC_R_NOMEMORY; - } else if (existed) { - res = ISC_R_EXISTS; - } - } else { - server->tkeydomain = NULL; - if (existed) { - res = ISC_R_EXISTS; - } - } - - return (res); -} - -isc_result_t -dns_c_srv_gettkeydomain(isc_log_t *lctx, dns_c_srv_t *server, - char **retval) -{ - isc_result_t res; - - (void) lctx; - - REQUIRE(server != NULL); - REQUIRE(retval != NULL); - - if (server->tkeydomain != NULL) { - *retval = server->tkeydomain; - res = ISC_R_SUCCESS; - } else { - res = ISC_R_NOTFOUND; - } - - return (res); -} - - - -isc_result_t -dns_c_srv_settkeydhkey(isc_log_t *lctx, dns_c_srv_t *server, char *newval) -{ - isc_boolean_t existed = ISC_FALSE; - isc_result_t res; - - (void) lctx; - - if (server->tkeydhkey != NULL) { - existed = ISC_TRUE; - isc_mem_free(server->mem, server->tkeydhkey); - } - - server->tkeydhkey = isc_mem_strdup(server->mem, newval); - - if (server->tkeydhkey == NULL) { - res = ISC_R_NOMEMORY; - } else if (existed) { - res = ISC_R_EXISTS; - } else { - res = ISC_R_SUCCESS; - } - - return (res); -} - -isc_result_t -dns_c_srv_gettkeydhkey(isc_log_t *lctx, dns_c_srv_t *server, char **retval) -{ - isc_result_t res; - - (void) lctx; - - REQUIRE(server != NULL); - REQUIRE(retval != NULL); - - if (server->tkeydhkey != NULL) { - *retval = server->tkeydhkey; - res = ISC_R_SUCCESS; - } else { - res = ISC_R_NOTFOUND; - } - - return (res); -} - - - diff --git a/lib/dns/include/dns/confctx.h b/lib/dns/include/dns/confctx.h index 807cc6ea8c..e4e9ef81e1 100644 --- a/lib/dns/include/dns/confctx.h +++ b/lib/dns/include/dns/confctx.h @@ -126,7 +126,9 @@ struct dns_c_options char *memstats_filename; char *named_xfer; char *tkeydomain; - char *tkeydhkey; + + char *tkeydhkeycp; + isc_int32_t tkeydhkeyi; isc_uint32_t flags; isc_uint32_t max_ncache_ttl; @@ -296,8 +298,9 @@ isc_result_t dns_c_ctx_setnamedxfer(isc_log_t *lctx, dns_c_ctx_t *cfg, const char *newval); isc_result_t dns_c_ctx_settkeydomain(isc_log_t *lctx, dns_c_ctx_t *cfg, const char *newval); -isc_result_t dns_c_ctx_settkeydhkey(isc_log_t *lctx, - dns_c_ctx_t *cfg, const char *newval); +isc_result_t dns_c_ctx_settkeydhkey(isc_log_t *lctx, dns_c_ctx_t *cfg, + const char *newcpval, + isc_int32_t newival); isc_result_t dns_c_ctx_setmaxncachettl(isc_log_t *lctx, dns_c_ctx_t *cfg, isc_uint32_t newval); @@ -464,8 +467,8 @@ isc_result_t dns_c_ctx_getnamedxfer(isc_log_t *lctx, dns_c_ctx_t *cfg, char **retval); isc_result_t dns_c_ctx_gettkeydomain(isc_log_t *lctx, dns_c_ctx_t *cfg, char **retval); -isc_result_t dns_c_ctx_gettkeydhkey(isc_log_t *lctx, - dns_c_ctx_t *cfg, char **retval); +isc_result_t dns_c_ctx_gettkeydhkey(isc_log_t *lctx, dns_c_ctx_t *cfg, + char **retcpval, isc_int32_t *retival); isc_result_t dns_c_ctx_getmaxncachettl(isc_log_t *lctx, dns_c_ctx_t *cfg, isc_uint32_t *retval); isc_result_t dns_c_ctx_gettransfersin(isc_log_t *lctx, dns_c_ctx_t *cfg, diff --git a/lib/dns/include/dns/confserv.h b/lib/dns/include/dns/confserv.h index 300660057e..7852d8070e 100644 --- a/lib/dns/include/dns/confserv.h +++ b/lib/dns/include/dns/confserv.h @@ -85,8 +85,6 @@ struct dns_c_srv int transfers; isc_boolean_t support_ixfr; dns_c_kidlist_t *keys; - char *tkeydomain; - char *tkeydhkey; dns_c_setbits_t bitflags; @@ -142,12 +140,4 @@ isc_result_t dns_c_srv_settkeydomain(isc_log_t *lctx, dns_c_srv_t *server, isc_result_t dns_c_srv_gettkeydomain(isc_log_t *lctx, dns_c_srv_t *server, char **retval); -isc_result_t dns_c_srv_settkeydhkey(isc_log_t *lctx, dns_c_srv_t *server, - char *newval); -isc_result_t dns_c_srv_gettkeydhkey(isc_log_t *lctx, dns_c_srv_t *server, - char **retval); - - - - #endif /* DNS_CONFIG_CONFSERV_H */