From: Alan T. DeKok Date: Tue, 13 Sep 2016 19:25:40 +0000 (-0400) Subject: more checks X-Git-Tag: release_3_0_12~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5107797e252fe1a78a3b2e73682d1a70f267d3e9;p=thirdparty%2Ffreeradius-server.git more checks --- diff --git a/src/lib/dict.c b/src/lib/dict.c index 70adfb2574e..273dd8781b7 100644 --- a/src/lib/dict.c +++ b/src/lib/dict.c @@ -1376,8 +1376,7 @@ int dict_str2oid(char const *ptr, unsigned int *pvalue, unsigned int *pvendor, { char const *p; unsigned int attr; - DICT_ATTR const *da = NULL; - + #ifdef WITH_DICT_OID_DEBUG fprintf(stderr, "PARSING %s tlv_depth %d pvalue %08x pvendor %08x\n", ptr, tlv_depth, *pvalue, *pvendor); @@ -1418,6 +1417,8 @@ int dict_str2oid(char const *ptr, unsigned int *pvalue, unsigned int *pvendor, * We have an OID, look up the attribute to see what it is. */ if (attr != PW_VENDOR_SPECIFIC) { + DICT_ATTR const *da; + da = dict_attrbyvalue(attr, 0); if (!da) { *pvalue = attr; @@ -1545,6 +1546,22 @@ keep_parsing: } attr <<= fr_attr_shift[tlv_depth]; + +#ifdef WITH_DICT_OID_DEBUG + if (*pvendor) { + DICT_ATTR const *da; + + da = dict_parent(*pvalue | attr, *pvendor); + if (!da) { + fprintf(stderr, "STR2OID FAILED PARENT %08x | %08x, %08x\n", + *pvalue, attr, *pvendor); + } else if ((da->attr != *pvalue) || (da->vendor != *pvendor)) { + fprintf(stderr, "STR2OID DISAGREEMENT WITH PARENT %08x, %08x\t%08x, %08x\n", + *pvalue, *pvendor, da->attr, da->vendor); + } + } +#endif + *pvalue |= attr; #ifdef WITH_DHCP