From 6eddb0ccb5e2e47722e4e7c367cccde73d6f57f5 Mon Sep 17 00:00:00 2001 From: "David M. Syzdek" Date: Mon, 21 Mar 2022 18:05:04 -0800 Subject: libtinyrad: updating arguments to tinyrad_conf_opt --- lib/libtinyrad/lconf.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/libtinyrad/lconf.c b/lib/libtinyrad/lconf.c index 7ede6ce..1fc7c9e 100644 --- a/lib/libtinyrad/lconf.c +++ b/lib/libtinyrad/lconf.c @@ -132,7 +132,7 @@ int tinyrad_conf_opt( TinyRad * tr, TinyRadDict * dict, - const char * name, + uint64_t optid, const char * value ); @@ -250,11 +250,11 @@ tinyrad_conf_environment( tinyrad_strlcpy(varname, "TINYRAD_", sizeof(varname)); tinyrad_strlcat(varname, opt->map_name, sizeof(varname)); if ((value = getenv(varname)) != NULL) - tinyrad_conf_opt(tr, dict, opt->map_name, value); + tinyrad_conf_opt(tr, dict, opt->map_value, value); }; if ((value = getenv("TINYRAD_STOPINIT")) != NULL) - tinyrad_conf_opt(tr, dict, "stopinit", value); + tinyrad_conf_opt(tr, dict, TRAD_CONF_STOPINIT, value); return(TRAD_SUCCESS); } @@ -274,6 +274,7 @@ tinyrad_conf_file( const char * val; size_t len; char ** argv; + uint64_t optid; TinyRadDebugTrace(); @@ -304,7 +305,8 @@ tinyrad_conf_file( continue; }; val = tinyrad_strexpand(value, argv[1], sizeof(value), TRAD_NO); - rc = tinyrad_conf_opt(tr, dict, argv[0], val); + if ((optid = tinyrad_map_lookup_name(tinyrad_conf_options, argv[0], NULL)) > 0) + rc = tinyrad_conf_opt(tr, dict, optid, val); tinyrad_strsfree(argv); }; @@ -321,26 +323,21 @@ int tinyrad_conf_opt( TinyRad * tr, TinyRadDict * dict, - const char * name, + uint64_t optid, const char * value ) { int i; int rc; - uint64_t optid; char * endptr; char ** strs; struct timeval tv; assert( ((tr)) || ((dict)) ); - assert(name != NULL); assert(value != NULL); tr = ( ((tr)) && (!(tr->opts & TRAD_STOPINIT)) ) ? tr : NULL; dict = ( ((dict)) && (!(dict->opts & TRAD_STOPINIT)) ) ? dict : NULL; - if ((optid = tinyrad_map_lookup_name(tinyrad_conf_options, name, NULL)) == 0) - return(TRAD_SUCCESS); - switch(optid) { case TRAD_CONF_BIND_ADDRESS: -- cgit v1.2.3