From: Arran Cudbard-Bell Date: Fri, 26 Jun 2015 20:23:42 +0000 (-0400) Subject: Support 'byte' (8bit unsigned integer) as a conffile type X-Git-Tag: release_3_0_9~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abdcdc880506a5c20466345a3b02c101f91d9403;p=thirdparty%2Ffreeradius-server.git Support 'byte' (8bit unsigned integer) as a conffile type --- diff --git a/src/main/conffile.c b/src/main/conffile.c index 95d6bddc19b..4749b45e3c3 100644 --- a/src/main/conffile.c +++ b/src/main/conffile.c @@ -1518,6 +1518,20 @@ int cf_item_parse(CONF_SECTION *cs, char const *name, unsigned int type, void *d } break; + case PW_TYPE_BYTE: + { + unsigned long v = strtoul(value, 0, 0); + + if (v > UINT8_MAX) { + cf_log_err(&(cs->item), "Invalid value \"%s\" for variable %s, must be between 0-%u", value, + name, UINT8_MAX); + return -1; + } + *(uint8_t *)data = (uint8_t) v; + cf_log_info(cs, "%.*s\t%s = %u", cs->depth, parse_spaces, name, *(uint8_t *)data); + } + break; + case PW_TYPE_SHORT: { unsigned long v = strtoul(value, 0, 0);