From: Arran Cudbard-Bell Date: Fri, 28 Oct 2011 14:10:06 +0000 (+0200) Subject: Make dict_attr_types available from libradius.h so we can do integer to string type... X-Git-Tag: release_2_2_0~274 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5bf20309132c5d1724f8ea1988ab236b15920128;p=thirdparty%2Ffreeradius-server.git Make dict_attr_types available from libradius.h so we can do integer to string type conversions --- diff --git a/src/include/libradius.h b/src/include/libradius.h index 7dd6b44c731..b81205c63c8 100644 --- a/src/include/libradius.h +++ b/src/include/libradius.h @@ -116,6 +116,8 @@ typedef struct attr_flags { #define FLAG_ENCRYPT_TUNNEL_PASSWORD (2) #define FLAG_ENCRYPT_ASCEND_SECRET (3) +extern const FR_NAME_NUMBER dict_attr_types[]; + typedef struct dict_attr { unsigned int attr; int type; diff --git a/src/lib/dict.c b/src/lib/dict.c index 72ac60e81f2..30803ee14fc 100644 --- a/src/lib/dict.c +++ b/src/lib/dict.c @@ -78,7 +78,7 @@ typedef struct value_fixup_t { */ static value_fixup_t *value_fixup = NULL; -static const FR_NAME_NUMBER type_table[] = { +extern const FR_NAME_NUMBER dict_attr_types[] = { { "integer", PW_TYPE_INTEGER }, { "string", PW_TYPE_STRING }, { "ipaddr", PW_TYPE_IPADDR }, @@ -763,7 +763,7 @@ int dict_addvalue(const char *namestr, const char *attrstr, int value) default: fr_pool_free(dval); fr_strerror_printf("dict_addvalue: VALUEs cannot be defined for attributes of type '%s'", - fr_int2str(type_table, dattr->type, "?Unknown?")); + fr_int2str(dict_attr_types, dattr->type, "?Unknown?")); return -1; } @@ -887,7 +887,7 @@ static int process_attribute(const char* fn, const int line, /* * find the type of the attribute. */ - type = fr_str2int(type_table, argv[2], -1); + type = fr_str2int(dict_attr_types, argv[2], -1); if (type < 0) { fr_strerror_printf("dict_init: %s[%d]: invalid type \"%s\"", fn, line, argv[2]); @@ -986,7 +986,7 @@ static int process_attribute(const char* fn, const int line, default: fr_strerror_printf("dict_init: %s[%d]: Attributes of type %s cannot be tagged.", fn, line, - fr_int2str(type_table, type, "?Unknown?")); + fr_int2str(dict_attr_types, type, "?Unknown?")); return -1; }