]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Support 'byte' (8bit unsigned integer) as a conffile type
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 26 Jun 2015 20:23:42 +0000 (16:23 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 27 Jun 2015 20:38:31 +0000 (16:38 -0400)
src/main/conffile.c

index 95d6bddc19bb87ca5092eb386b9b8b8e155c60e3..4749b45e3c3fbe851baf3e5919c4cde0b0c2530c 100644 (file)
@@ -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);