From f684c24d39490ca0be46df3af22ca106240e494d Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 14 Aug 2024 17:37:40 +0000 Subject: [PATCH] sortlist is unused --- usr.bin/dig/lib/lwres/include/lwres/lwres.h | 10 +-- usr.bin/dig/lib/lwres/lwconfig.c | 67 --------------------- 2 files changed, 1 insertion(+), 76 deletions(-) diff --git a/usr.bin/dig/lib/lwres/include/lwres/lwres.h b/usr.bin/dig/lib/lwres/include/lwres/lwres.h index b8029eb6fc4..86f56774636 100644 --- a/usr.bin/dig/lib/lwres/include/lwres/lwres.h +++ b/usr.bin/dig/lib/lwres/include/lwres/lwres.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lwres.h,v 1.4 2024/08/14 17:36:48 florian Exp $ */ +/* $Id: lwres.h,v 1.5 2024/08/14 17:37:40 florian Exp $ */ #ifndef LWRES_LWRES_H #define LWRES_LWRES_H 1 @@ -103,7 +103,6 @@ struct lwres_addr { #define LWRES_CONFMAXNAMESERVERS 3 /*%< max 3 "nameserver" entries */ #define LWRES_CONFMAXSEARCH 8 /*%< max 8 domains in "search" entry */ #define LWRES_CONFMAXLINELEN 256 /*%< max size of a line */ -#define LWRES_CONFMAXSORTLIST 10 /*%< max 10 */ /*% lwres_conf_t */ typedef struct { @@ -115,13 +114,6 @@ typedef struct { char *search[LWRES_CONFMAXSEARCH]; uint8_t searchnxt; /*%< index for next free slot */ - struct { - lwres_addr_t addr; - /*% mask has a non-zero 'family' and 'length' if set */ - lwres_addr_t mask; - } sortlist[LWRES_CONFMAXSORTLIST]; - uint8_t sortlistnxt; - uint8_t resdebug; /*%< non-zero if 'options debug' set */ uint8_t ndots; /*%< set to n in 'options ndots:n' */ uint8_t no_tld_query; /*%< non-zero if 'options no_tld_query' */ diff --git a/usr.bin/dig/lib/lwres/lwconfig.c b/usr.bin/dig/lib/lwres/lwconfig.c index 76d35e1c6d1..fd8fbf1497b 100644 --- a/usr.bin/dig/lib/lwres/lwconfig.c +++ b/usr.bin/dig/lib/lwres/lwconfig.c @@ -62,9 +62,6 @@ lwres_conf_parsedomain(lwres_conf_t *confdata, FILE *fp); static lwres_result_t lwres_conf_parsesearch(lwres_conf_t *confdata, FILE *fp); -static lwres_result_t -lwres_conf_parsesortlist(lwres_conf_t *confdata, FILE *fp); - static lwres_result_t lwres_conf_parseoption(lwres_conf_t *confdata, FILE *fp); @@ -158,7 +155,6 @@ lwres_conf_init(lwres_conf_t *confdata, int lwresflags) { confdata->nsnext = 0; confdata->domainname = NULL; confdata->searchnxt = 0; - confdata->sortlistnxt = 0; confdata->resdebug = 0; confdata->ndots = 1; confdata->no_tld_query = 0; @@ -170,10 +166,6 @@ lwres_conf_init(lwres_conf_t *confdata, int lwresflags) { for (i = 0; i < LWRES_CONFMAXSEARCH; i++) confdata->search[i] = NULL; - for (i = 0; i < LWRES_CONFMAXSORTLIST; i++) { - lwres_resetaddr(&confdata->sortlist[i].addr); - lwres_resetaddr(&confdata->sortlist[i].mask); - } } /*% Frees up all the internal memory used by the config data structure, returning it to the lwres_context_t. */ @@ -192,15 +184,9 @@ lwres_conf_clear(lwres_conf_t *confdata) { confdata->search[i] = NULL; } - for (i = 0; i < LWRES_CONFMAXSORTLIST; i++) { - lwres_resetaddr(&confdata->sortlist[i].addr); - lwres_resetaddr(&confdata->sortlist[i].mask); - } - confdata->nsnext = 0; confdata->domainname = NULL; confdata->searchnxt = 0; - confdata->sortlistnxt = 0; confdata->resdebug = 0; confdata->ndots = 1; confdata->no_tld_query = 0; @@ -368,57 +354,6 @@ lwres_create_addr(const char *buffer, lwres_addr_t *addr, int convert_zero) { return (LWRES_R_SUCCESS); } -static lwres_result_t -lwres_conf_parsesortlist(lwres_conf_t *confdata, FILE *fp) { - int delim, res, idx; - char word[LWRES_CONFMAXLINELEN]; - char *p; - - delim = getword(fp, word, sizeof(word)); - if (strlen(word) == 0U) - return (LWRES_R_FAILURE); /* Empty line after keyword. */ - - while (strlen(word) > 0U) { - if (confdata->sortlistnxt == LWRES_CONFMAXSORTLIST) - return (LWRES_R_FAILURE); /* Too many values. */ - - p = strchr(word, '/'); - if (p != NULL) - *p++ = '\0'; - - idx = confdata->sortlistnxt; - res = lwres_create_addr(word, &confdata->sortlist[idx].addr, 1); - if (res != LWRES_R_SUCCESS) - return (res); - - if (p != NULL) { - res = lwres_create_addr(p, - &confdata->sortlist[idx].mask, - 0); - if (res != LWRES_R_SUCCESS) - return (res); - } else { - /* - * Make up a mask. - */ - confdata->sortlist[idx].mask = - confdata->sortlist[idx].addr; - - memset(&confdata->sortlist[idx].mask.address, 0xff, - confdata->sortlist[idx].addr.length); - } - - confdata->sortlistnxt++; - - if (delim == EOF || delim == '\n') - break; - else - delim = getword(fp, word, sizeof(word)); - } - - return (LWRES_R_SUCCESS); -} - static lwres_result_t lwres_conf_parseoption(lwres_conf_t *confdata, FILE *fp) { int delim; @@ -483,8 +418,6 @@ lwres_conf_parse(lwres_conf_t *confdata, const char *filename) { rval = lwres_conf_parsedomain(confdata, fp); else if (strcmp(word, "search") == 0) rval = lwres_conf_parsesearch(confdata, fp); - else if (strcmp(word, "sortlist") == 0) - rval = lwres_conf_parsesortlist(confdata, fp); else if (strcmp(word, "options") == 0) rval = lwres_conf_parseoption(confdata, fp); else { -- 2.20.1