From: Arran Cudbard-Bell Date: Fri, 28 Oct 2011 14:20:51 +0000 (+0200) Subject: Make dict_attr_types available from libradius.h so we can do integer to string type... X-Git-Tag: release_3_0_0_beta0~536 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d07fcf32f842273bdd1fd226782317f1ee2b2256;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 0a2effdbfcc..841a204e00b 100644 --- a/src/include/libradius.h +++ b/src/include/libradius.h @@ -124,6 +124,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 f1372669fce..9bffff32348 100644 --- a/src/lib/dict.c +++ b/src/lib/dict.c @@ -83,7 +83,7 @@ typedef struct value_fixup_t { */ static value_fixup_t *value_fixup = NULL; -static const FR_NAME_NUMBER type_table[] = { +const FR_NAME_NUMBER dict_attr_types[] = { { "integer", PW_TYPE_INTEGER }, { "string", PW_TYPE_STRING }, { "ipaddr", PW_TYPE_IPADDR }, @@ -874,7 +874,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; } @@ -1169,7 +1169,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]); @@ -1385,7 +1385,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; } }