Removed tkey from server statement.

Added integer argument to tkey options value.
This commit is contained in:
James Brister 1999-10-26 15:25:38 +00:00
parent 7d9cb86e80
commit 01fa4e3634
5 changed files with 41 additions and 200 deletions

View file

@ -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,

View file

@ -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 <config.h>
@ -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);
}
;
/*

View file

@ -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);
}

View file

@ -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,

View file

@ -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 */