netsnmp_ds_get_boolean:
  242|    892|{
  243|    892|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|  1.78k|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (243:9): [True: 0, False: 892]
  |  Branch (243:24): [True: 0, False: 892]
  ------------------
  244|    892|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|    892|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (244:2): [True: 0, False: 892]
  |  Branch (244:17): [True: 0, False: 892]
  ------------------
  245|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  246|      0|    }
  247|       |
  248|    892|    return (netsnmp_ds_booleans[storeid][which/8] & (1 << (which % 8))) ? 1:0;
  ------------------
  |  Branch (248:12): [True: 0, False: 892]
  ------------------
  249|    892|}
netsnmp_ds_get_int:
  268|     10|{
  269|     10|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|     20|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (269:9): [True: 0, False: 10]
  |  Branch (269:24): [True: 0, False: 10]
  ------------------
  270|     10|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|     10|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (270:2): [True: 0, False: 10]
  |  Branch (270:17): [True: 0, False: 10]
  ------------------
  271|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  272|      0|    }
  273|       |
  274|     10|    return netsnmp_ds_integers[storeid][which];
  275|     10|}
netsnmp_ds_set_string:
  279|      1|{
  280|      1|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|      2|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (280:9): [True: 0, False: 1]
  |  Branch (280:24): [True: 0, False: 1]
  ------------------
  281|      1|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|      1|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (281:2): [True: 0, False: 1]
  |  Branch (281:17): [True: 0, False: 1]
  ------------------
  282|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  283|      0|    }
  284|       |
  285|      1|    DEBUGMSGTL(("netsnmp_ds_set_string", "Setting %s:%d = \"%s\"\n",
  ------------------
  |  |   66|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 1]
  |  |  ------------------
  ------------------
  286|      1|                stores[storeid], which, (value ? value : "(null)")));
  287|       |
  288|       |    /*
  289|       |     * is some silly person is calling us with our own pointer?
  290|       |     */
  291|      1|    if (netsnmp_ds_strings[storeid][which] == value)
  ------------------
  |  Branch (291:9): [True: 0, False: 1]
  ------------------
  292|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  293|       |
  294|      1|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|      1|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 1]
  |  |  ------------------
  ------------------
  295|      1|    if (netsnmp_ds_strings[storeid][which] != NULL) {
  ------------------
  |  Branch (295:9): [True: 0, False: 1]
  ------------------
  296|      0|        free(netsnmp_ds_strings[storeid][which]);
  297|      0|	netsnmp_ds_strings[storeid][which] = NULL;
  298|      0|    }
  299|      1|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|      1|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 1]
  |  |  ------------------
  ------------------
  300|       |
  301|      1|    if (value) {
  ------------------
  |  Branch (301:9): [True: 1, False: 0]
  ------------------
  302|      1|        netsnmp_ds_strings[storeid][which] = strdup(value);
  303|      1|    } else {
  304|      0|        netsnmp_ds_strings[storeid][which] = NULL;
  305|      0|    }
  306|       |
  307|      1|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|      1|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  308|      1|}
netsnmp_ds_get_string:
  312|      3|{
  313|      3|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|      6|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (313:9): [True: 0, False: 3]
  |  Branch (313:24): [True: 0, False: 3]
  ------------------
  314|      3|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|      3|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (314:2): [True: 0, False: 3]
  |  Branch (314:17): [True: 0, False: 3]
  ------------------
  315|      0|        return NULL;
  316|      0|    }
  317|       |
  318|      3|    return netsnmp_ds_strings[storeid][which];
  319|      3|}

netsnmp_set_mib_directory:
 2566|      1|{
 2567|      1|    const char *newdir;
 2568|      1|    char *olddir, *tmpdir = NULL;
 2569|       |
 2570|      1|    DEBUGTRACE;
  ------------------
  |  |   63|      1|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 1]
  |  |  ------------------
  ------------------
 2571|      1|    if (NULL == dir) {
  ------------------
  |  Branch (2571:9): [True: 0, False: 1]
  ------------------
 2572|      0|        return;
 2573|      0|    }
 2574|       |    
 2575|      1|    olddir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 2576|      1|				   NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|      1|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2577|      1|    if (olddir) {
  ------------------
  |  Branch (2577:9): [True: 0, False: 1]
  ------------------
 2578|      0|        if ((*dir == '+') || (*dir == '-')) {
  ------------------
  |  Branch (2578:13): [True: 0, False: 0]
  |  Branch (2578:30): [True: 0, False: 0]
  ------------------
 2579|       |            /** New dir starts with '+', thus we add it. */
 2580|      0|            if (*dir++ == '+') {
  ------------------
  |  Branch (2580:17): [True: 0, False: 0]
  ------------------
 2581|      0|                if (asprintf(&tmpdir, "%s%c%s", olddir, ENV_SEPARATOR_CHAR, dir) < 0)
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
  |  Branch (2581:21): [True: 0, False: 0]
  ------------------
 2582|      0|                    tmpdir = NULL;
 2583|      0|            } else {
 2584|      0|                if (asprintf(&tmpdir, "%s%c%s", dir, ENV_SEPARATOR_CHAR, olddir) < 0)
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
  |  Branch (2584:21): [True: 0, False: 0]
  ------------------
 2585|      0|                    tmpdir = NULL;
 2586|      0|            }
 2587|      0|            if (!tmpdir) {
  ------------------
  |  Branch (2587:17): [True: 0, False: 0]
  ------------------
 2588|      0|                DEBUGMSGTL(("read_config:initmib", "set mibdir malloc failed"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2589|      0|                return;
 2590|      0|            }
 2591|      0|            newdir = tmpdir;
 2592|      0|        } else {
 2593|      0|            newdir = dir;
 2594|      0|        }
 2595|      1|    } else {
 2596|       |        /** If dir starts with '+' skip '+' it. */
 2597|      1|        newdir = ((*dir == '+') ? ++dir : dir);
  ------------------
  |  Branch (2597:19): [True: 0, False: 1]
  ------------------
 2598|      1|    }
 2599|      1|    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS,
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS,
  ------------------
  |  |  162|      1|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2600|      1|                          newdir);
 2601|       |
 2602|       |    /** set_string calls strdup, so if we allocated memory, free it */
 2603|      1|    if (tmpdir == newdir) {
  ------------------
  |  Branch (2603:9): [True: 0, False: 1]
  ------------------
 2604|       |        SNMP_FREE(tmpdir);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2605|      0|    }
 2606|      1|}
netsnmp_get_mib_directory:
 2623|      1|{
 2624|      1|    char *dir;
 2625|       |
 2626|      1|    DEBUGTRACE;
  ------------------
  |  |   63|      1|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 1]
  |  |  ------------------
  ------------------
 2627|      1|    dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|      1|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2628|      1|    if (dir == NULL) {
  ------------------
  |  Branch (2628:9): [True: 1, False: 0]
  ------------------
 2629|      1|        DEBUGMSGTL(("get_mib_directory", "no mib directories set\n"));
  ------------------
  |  |   66|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 1]
  |  |  ------------------
  ------------------
 2630|       |
 2631|       |        /** Check if the environment variable is set */
 2632|      1|        dir = netsnmp_getenv("MIBDIRS");
 2633|      1|        if (dir == NULL) {
  ------------------
  |  Branch (2633:13): [True: 1, False: 0]
  ------------------
 2634|      1|            DEBUGMSGTL(("get_mib_directory", "no mib directories set by environment\n"));
  ------------------
  |  |   66|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 1]
  |  |  ------------------
  ------------------
 2635|       |            /** Not set use hard coded path */
 2636|      1|            if (confmibdir == NULL) {
  ------------------
  |  Branch (2636:17): [True: 1, False: 0]
  ------------------
 2637|      1|                DEBUGMSGTL(("get_mib_directory", "no mib directories set by config\n"));
  ------------------
  |  |   66|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 1]
  |  |  ------------------
  ------------------
 2638|      1|                netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1675|      1|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2639|      1|            }
 2640|      0|            else if ((*confmibdir == '+') || (*confmibdir == '-')) {
  ------------------
  |  Branch (2640:22): [True: 0, False: 0]
  |  Branch (2640:46): [True: 0, False: 0]
  ------------------
 2641|      0|                DEBUGMSGTL(("get_mib_directory", "mib directories set by config (but added)\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2642|      0|                netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1675|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2643|      0|                netsnmp_set_mib_directory(confmibdir);
 2644|      0|            }
 2645|      0|            else {
 2646|      0|                DEBUGMSGTL(("get_mib_directory", "mib directories set by config\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2647|      0|                netsnmp_set_mib_directory(confmibdir);
 2648|      0|            }
 2649|      1|        } else if ((*dir == '+') || (*dir == '-')) {
  ------------------
  |  Branch (2649:20): [True: 0, False: 0]
  |  Branch (2649:37): [True: 0, False: 0]
  ------------------
 2650|      0|            DEBUGMSGTL(("get_mib_directory", "mib directories set by environment (but added)\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2651|      0|            netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1675|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2652|      0|            netsnmp_set_mib_directory(dir);
 2653|      0|        } else {
 2654|      0|            DEBUGMSGTL(("get_mib_directory", "mib directories set by environment\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2655|      0|            netsnmp_set_mib_directory(dir);
 2656|      0|        }
 2657|      1|        dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                      dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|      1|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2658|      1|    }
 2659|      1|    DEBUGMSGTL(("get_mib_directory", "mib directories set '%s'\n", dir));
  ------------------
  |  |   66|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 1]
  |  |  ------------------
  ------------------
 2660|      1|    return(dir);
 2661|      1|}
set_function:
 2955|      3|{
 2956|      3|    subtree->printer = NULL;
 2957|      3|    switch (subtree->type) {
 2958|      0|    case TYPE_OBJID:
  ------------------
  |  |  155|      0|#define TYPE_OBJID          1
  ------------------
  |  Branch (2958:5): [True: 0, False: 3]
  ------------------
 2959|      0|        subtree->printomat = sprint_realloc_object_identifier;
 2960|      0|        break;
 2961|      0|    case TYPE_OCTETSTR:
  ------------------
  |  |  156|      0|#define TYPE_OCTETSTR       2
  ------------------
  |  Branch (2961:5): [True: 0, False: 3]
  ------------------
 2962|      0|        subtree->printomat = sprint_realloc_octet_string;
 2963|      0|        break;
 2964|      0|    case TYPE_INTEGER:
  ------------------
  |  |  157|      0|#define TYPE_INTEGER        3
  ------------------
  |  Branch (2964:5): [True: 0, False: 3]
  ------------------
 2965|      0|        subtree->printomat = sprint_realloc_integer;
 2966|      0|        break;
 2967|      0|    case TYPE_INTEGER32:
  ------------------
  |  |  170|      0|#define TYPE_INTEGER32      16
  ------------------
  |  Branch (2967:5): [True: 0, False: 3]
  ------------------
 2968|      0|        subtree->printomat = sprint_realloc_integer;
 2969|      0|        break;
 2970|      0|    case TYPE_NETADDR:
  ------------------
  |  |  158|      0|#define TYPE_NETADDR        4
  ------------------
  |  Branch (2970:5): [True: 0, False: 3]
  ------------------
 2971|      0|        subtree->printomat = sprint_realloc_networkaddress;
 2972|      0|        break;
 2973|      0|    case TYPE_IPADDR:
  ------------------
  |  |  159|      0|#define TYPE_IPADDR         5
  ------------------
  |  Branch (2973:5): [True: 0, False: 3]
  ------------------
 2974|      0|        subtree->printomat = sprint_realloc_ipaddress;
 2975|      0|        break;
 2976|      0|    case TYPE_COUNTER:
  ------------------
  |  |  160|      0|#define TYPE_COUNTER        6
  ------------------
  |  Branch (2976:5): [True: 0, False: 3]
  ------------------
 2977|      0|        subtree->printomat = sprint_realloc_counter;
 2978|      0|        break;
 2979|      0|    case TYPE_GAUGE:
  ------------------
  |  |  161|      0|#define TYPE_GAUGE          7
  ------------------
  |  Branch (2979:5): [True: 0, False: 3]
  ------------------
 2980|      0|        subtree->printomat = sprint_realloc_gauge;
 2981|      0|        break;
 2982|      0|    case TYPE_TIMETICKS:
  ------------------
  |  |  162|      0|#define TYPE_TIMETICKS      8
  ------------------
  |  Branch (2982:5): [True: 0, False: 3]
  ------------------
 2983|      0|        subtree->printomat = sprint_realloc_timeticks;
 2984|      0|        break;
 2985|      0|    case TYPE_OPAQUE:
  ------------------
  |  |  163|      0|#define TYPE_OPAQUE         9
  ------------------
  |  Branch (2985:5): [True: 0, False: 3]
  ------------------
 2986|      0|        subtree->printomat = sprint_realloc_opaque;
 2987|      0|        break;
 2988|      0|    case TYPE_NULL:
  ------------------
  |  |  164|      0|#define TYPE_NULL           10
  ------------------
  |  Branch (2988:5): [True: 0, False: 3]
  ------------------
 2989|      0|        subtree->printomat = sprint_realloc_null;
 2990|      0|        break;
 2991|      0|    case TYPE_BITSTRING:
  ------------------
  |  |  166|      0|#define TYPE_BITSTRING      12
  ------------------
  |  Branch (2991:5): [True: 0, False: 3]
  ------------------
 2992|      0|        subtree->printomat = sprint_realloc_bitstring;
 2993|      0|        break;
 2994|      0|    case TYPE_NSAPADDRESS:
  ------------------
  |  |  167|      0|#define TYPE_NSAPADDRESS    13
  ------------------
  |  Branch (2994:5): [True: 0, False: 3]
  ------------------
 2995|      0|        subtree->printomat = sprint_realloc_nsapaddress;
 2996|      0|        break;
 2997|      0|    case TYPE_COUNTER64:
  ------------------
  |  |  165|      0|#define TYPE_COUNTER64      11
  ------------------
  |  Branch (2997:5): [True: 0, False: 3]
  ------------------
 2998|      0|        subtree->printomat = sprint_realloc_counter64;
 2999|      0|        break;
 3000|      0|    case TYPE_UINTEGER:
  ------------------
  |  |  168|      0|#define TYPE_UINTEGER       14
  ------------------
  |  Branch (3000:5): [True: 0, False: 3]
  ------------------
 3001|      0|        subtree->printomat = sprint_realloc_uinteger;
 3002|      0|        break;
 3003|      0|    case TYPE_UNSIGNED32:
  ------------------
  |  |  169|      0|#define TYPE_UNSIGNED32     15
  ------------------
  |  Branch (3003:5): [True: 0, False: 3]
  ------------------
 3004|      0|        subtree->printomat = sprint_realloc_gauge;
 3005|      0|        break;
 3006|      3|    case TYPE_OTHER:
  ------------------
  |  |  154|      3|#define TYPE_OTHER          0
  ------------------
  |  Branch (3006:5): [True: 3, False: 0]
  ------------------
 3007|      3|    default:
  ------------------
  |  Branch (3007:5): [True: 0, False: 3]
  ------------------
 3008|      3|        subtree->printomat = sprint_realloc_by_type;
 3009|      3|        break;
 3010|      3|    }
 3011|      3|}
read_objid:
 3032|    616|{
 3033|    616|#ifndef NETSNMP_DISABLE_MIB_LOADING
 3034|    616|    struct tree    *root = tree_top;
 3035|    616|    char            buf[SPRINT_MAX_LEN];
 3036|    616|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 3037|    616|    int             ret, max_out_len;
 3038|    616|    char           *name, ch;
 3039|    616|    const char     *cp;
 3040|       |
 3041|    616|    cp = input;
 3042|  6.19k|    while ((ch = *cp)) {
  ------------------
  |  Branch (3042:12): [True: 6.13k, False: 53]
  ------------------
 3043|  6.13k|        if (('0' <= ch && ch <= '9')
  ------------------
  |  Branch (3043:14): [True: 4.89k, False: 1.24k]
  |  Branch (3043:27): [True: 1.86k, False: 3.03k]
  ------------------
 3044|  4.27k|            || ('a' <= ch && ch <= 'z')
  ------------------
  |  Branch (3044:17): [True: 566, False: 3.70k]
  |  Branch (3044:30): [True: 563, False: 3]
  ------------------
 3045|  3.71k|            || ('A' <= ch && ch <= 'Z')
  ------------------
  |  Branch (3045:17): [True: 2.11k, False: 1.59k]
  |  Branch (3045:30): [True: 2.10k, False: 7]
  ------------------
 3046|  1.60k|            || ch == '-')
  ------------------
  |  Branch (3046:16): [True: 1.04k, False: 563]
  ------------------
 3047|  5.57k|            cp++;
 3048|    563|        else
 3049|    563|            break;
 3050|  6.13k|    }
 3051|    616|#ifndef NETSNMP_DISABLE_MIB_LOADING
 3052|    616|    if (ch == ':')
  ------------------
  |  Branch (3052:9): [True: 352, False: 264]
  ------------------
 3053|    352|        return get_node(input, output, out_len);
 3054|    264|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 3055|       |
 3056|    264|    if (*input == '.')
  ------------------
  |  Branch (3056:9): [True: 1, False: 263]
  ------------------
 3057|      1|        input++;
 3058|    263|#ifndef NETSNMP_DISABLE_MIB_LOADING
 3059|    263|    else if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_READ_UCD_STYLE_OID)) {
  ------------------
  |  |   48|    263|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  else if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_READ_UCD_STYLE_OID)) {
  ------------------
  |  |   85|    263|#define NETSNMP_DS_LIB_READ_UCD_STYLE_OID  25   /* require top-level OIDs to be prefixed with a dot */
  ------------------
  |  Branch (3059:14): [True: 0, False: 263]
  ------------------
 3060|       |        /*
 3061|       |         * get past leading '.', append '.' to Prefix. 
 3062|       |         */
 3063|      0|        if (*Prefix == '.')
  ------------------
  |  Branch (3063:13): [True: 0, False: 0]
  ------------------
 3064|      0|            strlcpy(buf, Prefix + 1, sizeof(buf));
 3065|      0|        else
 3066|      0|            strlcpy(buf, Prefix, sizeof(buf));
 3067|      0|        strlcat(buf, ".", sizeof(buf));
 3068|      0|        strlcat(buf, input, sizeof(buf));
 3069|      0|        input = buf;
 3070|      0|    }
 3071|    264|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 3072|       |
 3073|    264|#ifndef NETSNMP_DISABLE_MIB_LOADING
 3074|    264|    if ((root == NULL) && (tree_head != NULL)) {
  ------------------
  |  Branch (3074:9): [True: 264, False: 0]
  |  Branch (3074:27): [True: 208, False: 56]
  ------------------
 3075|    208|        root = tree_head;
 3076|    208|    }
 3077|     56|    else if (root == NULL) {
  ------------------
  |  Branch (3077:14): [True: 56, False: 0]
  ------------------
 3078|     56|        SET_SNMP_ERROR(SNMPERR_NOMIB);
  ------------------
  |  |   43|     56|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 3079|     56|        *out_len = 0;
 3080|     56|        return 0;
 3081|     56|    }
 3082|    208|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 3083|    208|    name = strdup(input);
 3084|    208|    max_out_len = *out_len;
 3085|    208|    *out_len = 0;
 3086|    208|#ifndef NETSNMP_DISABLE_MIB_LOADING
 3087|    208|    if ((ret =
  ------------------
  |  Branch (3087:9): [True: 114, False: 94]
  ------------------
 3088|    208|         _add_strings_to_oid(root, name, output, out_len,
 3089|    208|                             max_out_len)) <= 0)
 3090|       |#else
 3091|       |    if ((ret =
 3092|       |         _add_strings_to_oid(NULL, name, output, out_len,
 3093|       |                             max_out_len)) <= 0)
 3094|       |#endif /* NETSNMP_DISABLE_MIB_LOADING */
 3095|    114|    {
 3096|    114|        if (ret == 0)
  ------------------
  |  Branch (3096:13): [True: 114, False: 0]
  ------------------
 3097|    114|            ret = SNMPERR_UNKNOWN_OBJID;
  ------------------
  |  |  242|    114|#define SNMPERR_UNKNOWN_OBJID		(-58)
  ------------------
 3098|    114|        SET_SNMP_ERROR(ret);
  ------------------
  |  |   43|    114|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 3099|    114|        SNMP_FREE(name);
  ------------------
  |  |   62|    114|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 114, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 114]
  |  |  ------------------
  ------------------
 3100|    114|        return 0;
 3101|    114|    }
 3102|     94|    SNMP_FREE(name);
  ------------------
  |  |   62|     94|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 94, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 94]
  |  |  ------------------
  ------------------
 3103|       |
 3104|     94|    return 1;
 3105|    208|}
get_module_node:
 5200|    352|{
 5201|    352|    int             modid, rc = 0;
 5202|    352|    struct tree    *tp;
 5203|    352|    char           *name, *cp;
 5204|       |
 5205|    352|    if (!strcmp(module, "ANY"))
  ------------------
  |  Branch (5205:9): [True: 138, False: 214]
  ------------------
 5206|    138|        modid = -1;
 5207|    214|    else {
 5208|    214|        netsnmp_read_module(module);
 5209|    214|        modid = which_module(module);
 5210|    214|        if (modid == -1)
  ------------------
  |  Branch (5210:13): [True: 214, False: 0]
  ------------------
 5211|    214|            return 0;
 5212|    214|    }
 5213|       |
 5214|       |    /*
 5215|       |     * Isolate the first component of the name ... 
 5216|       |     */
 5217|    138|    name = strdup(fname);
 5218|    138|    if (name == NULL)
  ------------------
  |  Branch (5218:9): [True: 0, False: 138]
  ------------------
 5219|      0|        return -1;
 5220|    138|    cp = strchr(name, '.');
 5221|    138|    if (cp != NULL) {
  ------------------
  |  Branch (5221:9): [True: 2, False: 136]
  ------------------
 5222|      2|        *cp = '\0';
 5223|      2|        cp++;
 5224|      2|    }
 5225|       |    /*
 5226|       |     * ... and locate it in the tree. 
 5227|       |     */
 5228|    138|    tp = find_tree_node(name, modid);
 5229|    138|    if (tp) {
  ------------------
  |  Branch (5229:9): [True: 2, False: 136]
  ------------------
 5230|      2|        size_t          maxlen = *objidlen;
 5231|       |
 5232|       |        /*
 5233|       |         * Set the first element of the object ID 
 5234|       |         */
 5235|      2|        if (node_to_oid(tp, objid, objidlen)) {
  ------------------
  |  Branch (5235:13): [True: 2, False: 0]
  ------------------
 5236|      2|            rc = 1;
 5237|       |
 5238|       |            /*
 5239|       |             * If the name requested was more than one element,
 5240|       |             * tag on the rest of the components 
 5241|       |             */
 5242|      2|            if (cp != NULL)
  ------------------
  |  Branch (5242:17): [True: 1, False: 1]
  ------------------
 5243|      1|                rc = _add_strings_to_oid(tp, cp, objid, objidlen, maxlen);
 5244|      2|        }
 5245|      2|    }
 5246|       |
 5247|       |    SNMP_FREE(name);
  ------------------
  |  |   62|    138|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 138, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 138]
  |  |  ------------------
  ------------------
 5248|    138|    return (rc);
 5249|    138|}
get_node:
 5759|    352|{
 5760|    352|    const char     *cp;
 5761|    352|    char            ch;
 5762|    352|    int             res;
 5763|       |
 5764|    352|    cp = name;
 5765|  5.04k|    while ((ch = *cp))
  ------------------
  |  Branch (5765:12): [True: 5.04k, False: 0]
  ------------------
 5766|  5.04k|        if (('0' <= ch && ch <= '9')
  ------------------
  |  Branch (5766:14): [True: 4.19k, False: 844]
  |  Branch (5766:27): [True: 1.57k, False: 2.62k]
  ------------------
 5767|  3.46k|            || ('a' <= ch && ch <= 'z')
  ------------------
  |  Branch (5767:17): [True: 365, False: 3.10k]
  |  Branch (5767:30): [True: 365, False: 0]
  ------------------
 5768|  3.10k|            || ('A' <= ch && ch <= 'Z')
  ------------------
  |  Branch (5768:17): [True: 1.90k, False: 1.19k]
  |  Branch (5768:30): [True: 1.90k, False: 0]
  ------------------
 5769|  1.19k|            || ch == '-')
  ------------------
  |  Branch (5769:16): [True: 844, False: 352]
  ------------------
 5770|  4.68k|            cp++;
 5771|    352|        else
 5772|    352|            break;
 5773|    352|    if (ch != ':')
  ------------------
  |  Branch (5773:9): [True: 0, False: 352]
  ------------------
 5774|      0|        if (*name == '.')
  ------------------
  |  Branch (5774:13): [True: 0, False: 0]
  ------------------
 5775|      0|            res = get_module_node(name + 1, "ANY", objid, objidlen);
 5776|      0|        else
 5777|      0|            res = get_module_node(name, "ANY", objid, objidlen);
 5778|    352|    else {
 5779|    352|        char           *module;
 5780|    352|        size_t          module_len;
 5781|       |        /*
 5782|       |         *  requested name is of the form
 5783|       |         *      "module:subidentifier"
 5784|       |         */
 5785|    352|        module_len = (size_t) (cp - name + 1);
 5786|    352|        module = (char *) malloc(module_len);
 5787|    352|        if (!module)
  ------------------
  |  Branch (5787:13): [True: 0, False: 352]
  ------------------
 5788|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5789|    352|        snprintf(module, module_len, "%.*s", (int) (cp - name), name);
 5790|    352|        cp++;                   /* cp now point to the subidentifier */
 5791|    352|        if (*cp == ':')
  ------------------
  |  Branch (5791:13): [True: 1, False: 351]
  ------------------
 5792|      1|            cp++;
 5793|       |
 5794|       |        /*
 5795|       |         * 'cp' and 'name' *do* go that way round! 
 5796|       |         */
 5797|    352|        res = get_module_node(cp, module, objid, objidlen);
 5798|    352|        SNMP_FREE(module);
  ------------------
  |  |   62|    352|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 352, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 352]
  |  |  ------------------
  ------------------
 5799|    352|    }
 5800|    352|    if (res == 0) {
  ------------------
  |  Branch (5800:9): [True: 351, False: 1]
  ------------------
 5801|    351|        SET_SNMP_ERROR(SNMPERR_UNKNOWN_OBJID);
  ------------------
  |  |   43|    351|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 5802|    351|    }
 5803|       |
 5804|    352|    return res;
 5805|    352|}
mib.c:node_to_oid:
 5271|      2|{
 5272|      2|    size_t          numids, lenids;
 5273|      2|    oid            *op;
 5274|       |
 5275|      2|    if (!tp || !objid || !objidlen)
  ------------------
  |  Branch (5275:9): [True: 0, False: 2]
  |  Branch (5275:16): [True: 0, False: 2]
  |  Branch (5275:26): [True: 0, False: 2]
  ------------------
 5276|      0|        return 0;
 5277|       |
 5278|      2|    lenids = *objidlen;
 5279|      2|    op = objid + lenids;        /* points after the last element */
 5280|       |
 5281|      4|    for (numids = 0; tp; tp = tp->parent, numids++) {
  ------------------
  |  Branch (5281:22): [True: 2, False: 2]
  ------------------
 5282|      2|        if (numids >= lenids)
  ------------------
  |  Branch (5282:13): [True: 0, False: 2]
  ------------------
 5283|      0|            continue;
 5284|      2|        --op;
 5285|      2|        *op = tp->subid;
 5286|      2|    }
 5287|       |
 5288|      2|    *objidlen = numids;
 5289|      2|    if (numids > lenids) {
  ------------------
  |  Branch (5289:9): [True: 0, False: 2]
  ------------------
 5290|      0|        return 0;
 5291|      0|    }
 5292|       |
 5293|      2|    if (numids < lenids)
  ------------------
  |  Branch (5293:9): [True: 2, False: 0]
  ------------------
 5294|      2|        memmove(objid, op, numids * sizeof(oid));
 5295|       |
 5296|      2|    return numids;
 5297|      2|}
mib.c:_add_strings_to_oid:
 5341|    209|{
 5342|    209|    oid             subid;
 5343|    209|    char           *fcp, *ecp, *cp2 = NULL;
 5344|    209|    char            doingquote;
 5345|    209|    int             len = -1;
 5346|    209|#ifndef NETSNMP_DISABLE_MIB_LOADING
 5347|    209|    struct tree    *tp2 = NULL;
 5348|    209|    struct index_list *in_dices = NULL;
 5349|    209|    int             pos = -1;
 5350|    209|    int             check =
 5351|    209|        !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_CHECK_RANGE);
  ------------------
  |  |   48|    209|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                      !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_CHECK_RANGE);
  ------------------
  |  |   76|    209|#define NETSNMP_DS_LIB_DONT_CHECK_RANGE    16   /* don't check values for ranges on send */
  ------------------
 5352|    209|    int             do_hint = !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
  ------------------
  |  |   48|    209|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  int             do_hint = !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
  ------------------
  |  |   90|    209|#define NETSNMP_DS_LIB_NO_DISPLAY_HINT     30 /* don't apply DISPLAY-HINTs */
  ------------------
 5353|    209|    int             len_index = 1000000;
 5354|       |
 5355|    209|    while (cp && tp && tp->child_list) {
  ------------------
  |  Branch (5355:12): [True: 209, False: 0]
  |  Branch (5355:18): [True: 209, False: 0]
  |  Branch (5355:24): [True: 0, False: 209]
  ------------------
 5356|      0|        fcp = cp;
 5357|      0|        tp2 = tp->child_list;
 5358|       |        /*
 5359|       |         * Isolate the next entry 
 5360|       |         */
 5361|      0|        cp2 = strchr(cp, '.');
 5362|      0|        if (cp2)
  ------------------
  |  Branch (5362:13): [True: 0, False: 0]
  ------------------
 5363|      0|            *cp2++ = '\0';
 5364|       |
 5365|       |        /*
 5366|       |         * Search for the appropriate child 
 5367|       |         */
 5368|      0|        if (isdigit((unsigned char)(*cp))) {
  ------------------
  |  Branch (5368:13): [True: 0, False: 0]
  ------------------
 5369|      0|            subid = strtoul(cp, &ecp, 0);
 5370|      0|            if (*ecp)
  ------------------
  |  Branch (5370:17): [True: 0, False: 0]
  ------------------
 5371|      0|                goto bad_id;
 5372|      0|            while (tp2 && tp2->subid != subid)
  ------------------
  |  Branch (5372:20): [True: 0, False: 0]
  |  Branch (5372:27): [True: 0, False: 0]
  ------------------
 5373|      0|                tp2 = tp2->next_peer;
 5374|      0|        } else {
 5375|      0|            while (tp2 && strcmp(tp2->label, fcp))
  ------------------
  |  Branch (5375:20): [True: 0, False: 0]
  |  Branch (5375:27): [True: 0, False: 0]
  ------------------
 5376|      0|                tp2 = tp2->next_peer;
 5377|      0|            if (!tp2)
  ------------------
  |  Branch (5377:17): [True: 0, False: 0]
  ------------------
 5378|      0|                goto bad_id;
 5379|      0|            subid = tp2->subid;
 5380|      0|        }
 5381|      0|        if (*objidlen >= maxlen)
  ------------------
  |  Branch (5381:13): [True: 0, False: 0]
  ------------------
 5382|      0|            goto bad_id;
 5383|      0|	while (tp2 && tp2->next_peer && tp2->next_peer->subid == subid)
  ------------------
  |  Branch (5383:9): [True: 0, False: 0]
  |  Branch (5383:16): [True: 0, False: 0]
  |  Branch (5383:34): [True: 0, False: 0]
  ------------------
 5384|      0|	    tp2 = tp2->next_peer;
 5385|      0|        objid[*objidlen] = subid;
 5386|      0|        (*objidlen)++;
 5387|       |
 5388|      0|        cp = cp2;
 5389|      0|        if (!tp2)
  ------------------
  |  Branch (5389:13): [True: 0, False: 0]
  ------------------
 5390|      0|            break;
 5391|      0|        tp = tp2;
 5392|      0|    }
 5393|       |
 5394|    209|    if (tp && !tp->child_list) {
  ------------------
  |  Branch (5394:9): [True: 209, False: 0]
  |  Branch (5394:15): [True: 209, False: 0]
  ------------------
 5395|    209|        if ((tp2 = tp->parent)) {
  ------------------
  |  Branch (5395:13): [True: 0, False: 209]
  ------------------
 5396|      0|            if (tp2->indexes)
  ------------------
  |  Branch (5396:17): [True: 0, False: 0]
  ------------------
 5397|      0|                in_dices = tp2->indexes;
 5398|      0|            else if (tp2->augments) {
  ------------------
  |  Branch (5398:22): [True: 0, False: 0]
  ------------------
 5399|      0|                tp2 = find_tree_node(tp2->augments, -1);
 5400|      0|                if (tp2)
  ------------------
  |  Branch (5400:21): [True: 0, False: 0]
  ------------------
 5401|      0|                    in_dices = tp2->indexes;
 5402|      0|            }
 5403|      0|        }
 5404|    209|        tp = NULL;
 5405|    209|    }
 5406|       |
 5407|    209|    while (cp && in_dices) {
  ------------------
  |  Branch (5407:12): [True: 209, False: 0]
  |  Branch (5407:18): [True: 0, False: 209]
  ------------------
 5408|      0|        fcp = cp;
 5409|       |
 5410|      0|        tp = find_tree_node(in_dices->ilabel, -1);
 5411|      0|        if (!tp)
  ------------------
  |  Branch (5411:13): [True: 0, False: 0]
  ------------------
 5412|      0|            break;
 5413|      0|        switch (tp->type) {
 5414|      0|        case TYPE_INTEGER:
  ------------------
  |  |  157|      0|#define TYPE_INTEGER        3
  ------------------
  |  Branch (5414:9): [True: 0, False: 0]
  ------------------
 5415|      0|        case TYPE_INTEGER32:
  ------------------
  |  |  170|      0|#define TYPE_INTEGER32      16
  ------------------
  |  Branch (5415:9): [True: 0, False: 0]
  ------------------
 5416|      0|        case TYPE_UINTEGER:
  ------------------
  |  |  168|      0|#define TYPE_UINTEGER       14
  ------------------
  |  Branch (5416:9): [True: 0, False: 0]
  ------------------
 5417|      0|        case TYPE_UNSIGNED32:
  ------------------
  |  |  169|      0|#define TYPE_UNSIGNED32     15
  ------------------
  |  Branch (5417:9): [True: 0, False: 0]
  ------------------
 5418|      0|        case TYPE_TIMETICKS:
  ------------------
  |  |  162|      0|#define TYPE_TIMETICKS      8
  ------------------
  |  Branch (5418:9): [True: 0, False: 0]
  ------------------
 5419|       |            /*
 5420|       |             * Isolate the next entry 
 5421|       |             */
 5422|      0|            cp2 = strchr(cp, '.');
 5423|      0|            if (cp2)
  ------------------
  |  Branch (5423:17): [True: 0, False: 0]
  ------------------
 5424|      0|                *cp2++ = '\0';
 5425|      0|            if (isdigit((unsigned char)(*cp))) {
  ------------------
  |  Branch (5425:17): [True: 0, False: 0]
  ------------------
 5426|      0|                subid = strtoul(cp, &ecp, 0);
 5427|      0|                if (*ecp)
  ------------------
  |  Branch (5427:21): [True: 0, False: 0]
  ------------------
 5428|      0|                    goto bad_id;
 5429|      0|            } else {
 5430|      0|                if (tp->enums) {
  ------------------
  |  Branch (5430:21): [True: 0, False: 0]
  ------------------
 5431|      0|                    struct enum_list *ep = tp->enums;
 5432|      0|                    while (ep && strcmp(ep->label, cp))
  ------------------
  |  Branch (5432:28): [True: 0, False: 0]
  |  Branch (5432:34): [True: 0, False: 0]
  ------------------
 5433|      0|                        ep = ep->next;
 5434|      0|                    if (!ep)
  ------------------
  |  Branch (5434:25): [True: 0, False: 0]
  ------------------
 5435|      0|                        goto bad_id;
 5436|      0|                    subid = ep->value;
 5437|      0|                } else
 5438|      0|                    goto bad_id;
 5439|      0|            }
 5440|      0|            if (check && tp->ranges) {
  ------------------
  |  Branch (5440:17): [True: 0, False: 0]
  |  Branch (5440:26): [True: 0, False: 0]
  ------------------
 5441|      0|                struct range_list *rp = tp->ranges;
 5442|      0|                int             ok = 0;
 5443|      0|                if (tp->type == TYPE_INTEGER ||
  ------------------
  |  |  157|      0|#define TYPE_INTEGER        3
  ------------------
  |  Branch (5443:21): [True: 0, False: 0]
  ------------------
 5444|      0|                    tp->type == TYPE_INTEGER32) {
  ------------------
  |  |  170|      0|#define TYPE_INTEGER32      16
  ------------------
  |  Branch (5444:21): [True: 0, False: 0]
  ------------------
 5445|      0|                  while (!ok && rp) {
  ------------------
  |  Branch (5445:26): [True: 0, False: 0]
  |  Branch (5445:33): [True: 0, False: 0]
  ------------------
 5446|      0|                    if ((rp->low <= (int) subid)
  ------------------
  |  Branch (5446:25): [True: 0, False: 0]
  ------------------
 5447|      0|                        && ((int) subid <= rp->high))
  ------------------
  |  Branch (5447:28): [True: 0, False: 0]
  ------------------
 5448|      0|                        ok = 1;
 5449|      0|                    else
 5450|      0|                        rp = rp->next;
 5451|      0|                  }
 5452|      0|                } else { /* check unsigned range */
 5453|      0|                  while (!ok && rp) {
  ------------------
  |  Branch (5453:26): [True: 0, False: 0]
  |  Branch (5453:33): [True: 0, False: 0]
  ------------------
 5454|      0|                    if (((unsigned int)rp->low <= subid)
  ------------------
  |  Branch (5454:25): [True: 0, False: 0]
  ------------------
 5455|      0|                        && (subid <= (unsigned int)rp->high))
  ------------------
  |  Branch (5455:28): [True: 0, False: 0]
  ------------------
 5456|      0|                        ok = 1;
 5457|      0|                    else
 5458|      0|                        rp = rp->next;
 5459|      0|                  }
 5460|      0|                }
 5461|      0|                if (!ok)
  ------------------
  |  Branch (5461:21): [True: 0, False: 0]
  ------------------
 5462|      0|                    goto bad_id;
 5463|      0|            }
 5464|      0|            if (*objidlen >= maxlen)
  ------------------
  |  Branch (5464:17): [True: 0, False: 0]
  ------------------
 5465|      0|                goto bad_id;
 5466|      0|            objid[*objidlen] = subid;
 5467|      0|            (*objidlen)++;
 5468|      0|            break;
 5469|      0|        case TYPE_IPADDR:
  ------------------
  |  |  159|      0|#define TYPE_IPADDR         5
  ------------------
  |  Branch (5469:9): [True: 0, False: 0]
  ------------------
 5470|      0|            if (*objidlen + 4 > maxlen)
  ------------------
  |  Branch (5470:17): [True: 0, False: 0]
  ------------------
 5471|      0|                goto bad_id;
 5472|      0|            for (subid = 0; cp && subid < 4; subid++) {
  ------------------
  |  Branch (5472:29): [True: 0, False: 0]
  |  Branch (5472:35): [True: 0, False: 0]
  ------------------
 5473|      0|                fcp = cp;
 5474|      0|                cp2 = strchr(cp, '.');
 5475|      0|                if (cp2)
  ------------------
  |  Branch (5475:21): [True: 0, False: 0]
  ------------------
 5476|      0|                    *cp2++ = 0;
 5477|      0|                objid[*objidlen] = strtoul(cp, &ecp, 0);
 5478|      0|                if (*ecp)
  ------------------
  |  Branch (5478:21): [True: 0, False: 0]
  ------------------
 5479|      0|                    goto bad_id;
 5480|      0|                if (check && objid[*objidlen] > 255)
  ------------------
  |  Branch (5480:21): [True: 0, False: 0]
  |  Branch (5480:30): [True: 0, False: 0]
  ------------------
 5481|      0|                    goto bad_id;
 5482|      0|                (*objidlen)++;
 5483|      0|                cp = cp2;
 5484|      0|            }
 5485|      0|            break;
 5486|      0|        case TYPE_OCTETSTR:
  ------------------
  |  |  156|      0|#define TYPE_OCTETSTR       2
  ------------------
  |  Branch (5486:9): [True: 0, False: 0]
  ------------------
 5487|      0|            if (tp->ranges && !tp->ranges->next
  ------------------
  |  Branch (5487:17): [True: 0, False: 0]
  |  Branch (5487:31): [True: 0, False: 0]
  ------------------
 5488|      0|                && tp->ranges->low == tp->ranges->high)
  ------------------
  |  Branch (5488:20): [True: 0, False: 0]
  ------------------
 5489|      0|                len = tp->ranges->low;
 5490|      0|            else
 5491|      0|                len = -1;
 5492|      0|            pos = 0;
 5493|      0|            if (*cp == '"' || *cp == '\'') {
  ------------------
  |  Branch (5493:17): [True: 0, False: 0]
  |  Branch (5493:31): [True: 0, False: 0]
  ------------------
 5494|      0|                doingquote = *cp++;
 5495|       |                /*
 5496|       |                 * insert length if requested 
 5497|       |                 */
 5498|      0|                if (!in_dices->isimplied && len == -1) {
  ------------------
  |  Branch (5498:21): [True: 0, False: 0]
  |  Branch (5498:45): [True: 0, False: 0]
  ------------------
 5499|      0|                    if (doingquote == '\'') {
  ------------------
  |  Branch (5499:25): [True: 0, False: 0]
  ------------------
 5500|      0|                        snmp_set_detail
 5501|      0|                            ("'-quote is for fixed length strings");
 5502|      0|                        return 0;
 5503|      0|                    }
 5504|      0|                    if (*objidlen >= maxlen)
  ------------------
  |  Branch (5504:25): [True: 0, False: 0]
  ------------------
 5505|      0|                        goto bad_id;
 5506|      0|                    len_index = *objidlen;
 5507|      0|                    (*objidlen)++;
 5508|      0|                } else if (doingquote == '"') {
  ------------------
  |  Branch (5508:28): [True: 0, False: 0]
  ------------------
 5509|      0|                    snmp_set_detail
 5510|      0|                        ("\"-quote is for variable length strings");
 5511|      0|                    return 0;
 5512|      0|                }
 5513|       |
 5514|      0|		cp2 = _apply_escapes(cp, doingquote);
 5515|      0|		if (!cp2) goto bad_id;
  ------------------
  |  Branch (5515:7): [True: 0, False: 0]
  ------------------
 5516|      0|		else {
 5517|      0|		    unsigned char *new_val;
 5518|      0|		    int new_val_len;
 5519|      0|		    int parsed_hint = 0;
 5520|      0|		    const char *parsed_value;
 5521|       |
 5522|      0|		    if (do_hint && tp->hint) {
  ------------------
  |  Branch (5522:11): [True: 0, False: 0]
  |  Branch (5522:22): [True: 0, False: 0]
  ------------------
 5523|      0|			parsed_value = parse_octet_hint(tp->hint, cp,
 5524|      0|			                                &new_val, &new_val_len);
 5525|      0|			parsed_hint = parsed_value == NULL;
 5526|      0|		    }
 5527|      0|		    if (parsed_hint) {
  ------------------
  |  Branch (5527:11): [True: 0, False: 0]
  ------------------
 5528|      0|			int i;
 5529|      0|			for (i = 0; i < new_val_len; i++) {
  ------------------
  |  Branch (5529:16): [True: 0, False: 0]
  ------------------
 5530|      0|			    if (*objidlen >= maxlen) {
  ------------------
  |  Branch (5530:12): [True: 0, False: 0]
  ------------------
 5531|      0|				SNMP_FREE(new_val);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5532|      0|				goto bad_id;
 5533|      0|			    }
 5534|      0|			    objid[ *objidlen ] = new_val[i];
 5535|      0|			    (*objidlen)++;
 5536|      0|			    pos++;
 5537|      0|			}
 5538|      0|			SNMP_FREE(new_val);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5539|      0|		    } else {
 5540|      0|			while(*cp) {
  ------------------
  |  Branch (5540:10): [True: 0, False: 0]
  ------------------
 5541|      0|			    if (*objidlen >= maxlen) goto bad_id;
  ------------------
  |  Branch (5541:12): [True: 0, False: 0]
  ------------------
 5542|      0|			    objid[ *objidlen ] = *cp++;
 5543|      0|			    (*objidlen)++;
 5544|      0|			    pos++;
 5545|      0|			}
 5546|      0|		    }
 5547|      0|		}
 5548|       |		
 5549|      0|		cp2++;
 5550|      0|                if (!*cp2)
  ------------------
  |  Branch (5550:21): [True: 0, False: 0]
  ------------------
 5551|      0|                    cp2 = NULL;
 5552|      0|                else if (*cp2 != '.')
  ------------------
  |  Branch (5552:26): [True: 0, False: 0]
  ------------------
 5553|      0|                    goto bad_id;
 5554|      0|                else
 5555|      0|                    cp2++;
 5556|      0|		if (check) {
  ------------------
  |  Branch (5556:7): [True: 0, False: 0]
  ------------------
 5557|      0|                    if (len == -1) {
  ------------------
  |  Branch (5557:25): [True: 0, False: 0]
  ------------------
 5558|      0|                        struct range_list *rp = tp->ranges;
 5559|      0|                        int             ok = 0;
 5560|      0|                        while (rp && !ok)
  ------------------
  |  Branch (5560:32): [True: 0, False: 0]
  |  Branch (5560:38): [True: 0, False: 0]
  ------------------
 5561|      0|                            if (rp->low <= pos && pos <= rp->high)
  ------------------
  |  Branch (5561:33): [True: 0, False: 0]
  |  Branch (5561:51): [True: 0, False: 0]
  ------------------
 5562|      0|                                ok = 1;
 5563|      0|                            else
 5564|      0|                                rp = rp->next;
 5565|      0|                        if (!ok)
  ------------------
  |  Branch (5565:29): [True: 0, False: 0]
  ------------------
 5566|      0|                            goto bad_id;
 5567|      0|                        if (!in_dices->isimplied)
  ------------------
  |  Branch (5567:29): [True: 0, False: 0]
  ------------------
 5568|      0|                            objid[len_index] = pos;
 5569|      0|                    } else if (pos != len)
  ------------------
  |  Branch (5569:32): [True: 0, False: 0]
  ------------------
 5570|      0|                        goto bad_id;
 5571|      0|		}
 5572|      0|		else if (len == -1 && !in_dices->isimplied)
  ------------------
  |  Branch (5572:12): [True: 0, False: 0]
  |  Branch (5572:25): [True: 0, False: 0]
  ------------------
 5573|      0|		    objid[len_index] = pos;
 5574|      0|            } else {
 5575|      0|                if (!in_dices->isimplied && len == -1) {
  ------------------
  |  Branch (5575:21): [True: 0, False: 0]
  |  Branch (5575:45): [True: 0, False: 0]
  ------------------
 5576|      0|                    fcp = cp;
 5577|      0|                    cp2 = strchr(cp, '.');
 5578|      0|                    if (cp2)
  ------------------
  |  Branch (5578:25): [True: 0, False: 0]
  ------------------
 5579|      0|                        *cp2++ = 0;
 5580|      0|                    len = strtoul(cp, &ecp, 0);
 5581|      0|                    if (len < 0 || *ecp)
  ------------------
  |  Branch (5581:25): [True: 0, False: 0]
  |  Branch (5581:36): [True: 0, False: 0]
  ------------------
 5582|      0|                        goto bad_id;
 5583|      0|                    if (*objidlen + len + 1 >= maxlen)
  ------------------
  |  Branch (5583:25): [True: 0, False: 0]
  ------------------
 5584|      0|                        goto bad_id;
 5585|      0|                    objid[*objidlen] = len;
 5586|      0|                    (*objidlen)++;
 5587|      0|                    cp = cp2;
 5588|      0|                }
 5589|      0|                while (len && cp) {
  ------------------
  |  Branch (5589:24): [True: 0, False: 0]
  |  Branch (5589:31): [True: 0, False: 0]
  ------------------
 5590|      0|                    fcp = cp;
 5591|      0|                    cp2 = strchr(cp, '.');
 5592|      0|                    if (cp2)
  ------------------
  |  Branch (5592:25): [True: 0, False: 0]
  ------------------
 5593|      0|                        *cp2++ = 0;
 5594|      0|                    if (*objidlen >= maxlen)
  ------------------
  |  Branch (5594:25): [True: 0, False: 0]
  ------------------
 5595|      0|                        goto bad_id;
 5596|      0|                    objid[*objidlen] = strtoul(cp, &ecp, 0);
 5597|      0|                    if (*ecp)
  ------------------
  |  Branch (5597:25): [True: 0, False: 0]
  ------------------
 5598|      0|                        goto bad_id;
 5599|      0|                    if (check && objid[*objidlen] > 255)
  ------------------
  |  Branch (5599:25): [True: 0, False: 0]
  |  Branch (5599:34): [True: 0, False: 0]
  ------------------
 5600|      0|                        goto bad_id;
 5601|      0|                    (*objidlen)++;
 5602|      0|                    len--;
 5603|      0|                    cp = cp2;
 5604|      0|                }
 5605|      0|            }
 5606|      0|            break;
 5607|      0|        case TYPE_OBJID:
  ------------------
  |  |  155|      0|#define TYPE_OBJID          1
  ------------------
  |  Branch (5607:9): [True: 0, False: 0]
  ------------------
 5608|      0|            in_dices = NULL;
 5609|      0|            cp2 = cp;
 5610|      0|            break;
 5611|      0|	case TYPE_NETADDR:
  ------------------
  |  |  158|      0|#define TYPE_NETADDR        4
  ------------------
  |  Branch (5611:2): [True: 0, False: 0]
  ------------------
 5612|      0|	    fcp = cp;
 5613|      0|	    cp2 = strchr(cp, '.');
 5614|      0|	    if (cp2)
  ------------------
  |  Branch (5614:10): [True: 0, False: 0]
  ------------------
 5615|      0|		*cp2++ = 0;
 5616|      0|	    subid = strtoul(cp, &ecp, 0);
 5617|      0|	    if (*ecp)
  ------------------
  |  Branch (5617:10): [True: 0, False: 0]
  ------------------
 5618|      0|		goto bad_id;
 5619|      0|	    if (*objidlen + 1 >= maxlen)
  ------------------
  |  Branch (5619:10): [True: 0, False: 0]
  ------------------
 5620|      0|		goto bad_id;
 5621|      0|	    objid[*objidlen] = subid;
 5622|      0|	    (*objidlen)++;
 5623|      0|	    cp = cp2;
 5624|      0|	    if (subid == 1) {
  ------------------
  |  Branch (5624:10): [True: 0, False: 0]
  ------------------
 5625|      0|		for (len = 0; cp && len < 4; len++) {
  ------------------
  |  Branch (5625:17): [True: 0, False: 0]
  |  Branch (5625:23): [True: 0, False: 0]
  ------------------
 5626|      0|		    fcp = cp;
 5627|      0|		    cp2 = strchr(cp, '.');
 5628|      0|		    if (cp2)
  ------------------
  |  Branch (5628:11): [True: 0, False: 0]
  ------------------
 5629|      0|			*cp2++ = 0;
 5630|      0|		    subid = strtoul(cp, &ecp, 0);
 5631|      0|		    if (*ecp)
  ------------------
  |  Branch (5631:11): [True: 0, False: 0]
  ------------------
 5632|      0|			goto bad_id;
 5633|      0|		    if (*objidlen + 1 >= maxlen)
  ------------------
  |  Branch (5633:11): [True: 0, False: 0]
  ------------------
 5634|      0|			goto bad_id;
 5635|      0|		    if (check && subid > 255)
  ------------------
  |  Branch (5635:11): [True: 0, False: 0]
  |  Branch (5635:20): [True: 0, False: 0]
  ------------------
 5636|      0|			goto bad_id;
 5637|      0|		    objid[*objidlen] = subid;
 5638|      0|		    (*objidlen)++;
 5639|      0|		    cp = cp2;
 5640|      0|		}
 5641|      0|	    }
 5642|      0|	    else {
 5643|      0|		in_dices = NULL;
 5644|      0|	    }
 5645|      0|	    break;
 5646|      0|        default:
  ------------------
  |  Branch (5646:9): [True: 0, False: 0]
  ------------------
 5647|      0|            snmp_log(LOG_ERR, "Unexpected index type: %d %s %s\n",
 5648|      0|                     tp->type, in_dices->ilabel, cp);
 5649|      0|            in_dices = NULL;
 5650|      0|            cp2 = cp;
 5651|      0|            break;
 5652|      0|        }
 5653|      0|        cp = cp2;
 5654|      0|        if (in_dices)
  ------------------
  |  Branch (5654:13): [True: 0, False: 0]
  ------------------
 5655|      0|            in_dices = in_dices->next;
 5656|      0|    }
 5657|       |
 5658|    209|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 5659|  3.32k|    while (cp) {
  ------------------
  |  Branch (5659:12): [True: 3.23k, False: 94]
  ------------------
 5660|  3.23k|        fcp = cp;
 5661|  3.23k|        switch (*cp) {
 5662|    205|        case '0':
  ------------------
  |  Branch (5662:9): [True: 205, False: 3.02k]
  ------------------
 5663|    408|        case '1':
  ------------------
  |  Branch (5663:9): [True: 203, False: 3.02k]
  ------------------
 5664|    603|        case '2':
  ------------------
  |  Branch (5664:9): [True: 195, False: 3.03k]
  ------------------
 5665|    832|        case '3':
  ------------------
  |  Branch (5665:9): [True: 229, False: 3.00k]
  ------------------
 5666|  1.03k|        case '4':
  ------------------
  |  Branch (5666:9): [True: 198, False: 3.03k]
  ------------------
 5667|  1.33k|        case '5':
  ------------------
  |  Branch (5667:9): [True: 307, False: 2.92k]
  ------------------
 5668|  1.53k|        case '6':
  ------------------
  |  Branch (5668:9): [True: 198, False: 3.03k]
  ------------------
 5669|  1.73k|        case '7':
  ------------------
  |  Branch (5669:9): [True: 199, False: 3.03k]
  ------------------
 5670|  1.94k|        case '8':
  ------------------
  |  Branch (5670:9): [True: 214, False: 3.01k]
  ------------------
 5671|  2.16k|        case '9':
  ------------------
  |  Branch (5671:9): [True: 215, False: 3.01k]
  ------------------
 5672|  2.16k|            cp2 = strchr(cp, '.');
 5673|  2.16k|            if (cp2)
  ------------------
  |  Branch (5673:17): [True: 2.07k, False: 93]
  ------------------
 5674|  2.07k|                *cp2++ = 0;
 5675|  2.16k|            subid = strtoul(cp, &ecp, 0);
 5676|  2.16k|            if (*ecp)
  ------------------
  |  Branch (5676:17): [True: 8, False: 2.15k]
  ------------------
 5677|      8|                goto bad_id;
 5678|  2.15k|            if (*objidlen >= maxlen)
  ------------------
  |  Branch (5678:17): [True: 1, False: 2.15k]
  ------------------
 5679|      1|                goto bad_id;
 5680|  2.15k|            objid[*objidlen] = subid;
 5681|  2.15k|            (*objidlen)++;
 5682|  2.15k|            break;
 5683|    429|        case '"':
  ------------------
  |  Branch (5683:9): [True: 429, False: 2.80k]
  ------------------
 5684|  1.02k|        case '\'':
  ------------------
  |  Branch (5684:9): [True: 599, False: 2.63k]
  ------------------
 5685|  1.02k|            doingquote = *cp++;
 5686|  1.02k|            if (*cp == '\0')
  ------------------
  |  Branch (5686:17): [True: 14, False: 1.01k]
  ------------------
 5687|     14|                goto bad_id;
 5688|       |            /*
 5689|       |             * insert length if requested 
 5690|       |             */
 5691|  1.01k|            if (doingquote == '"') {
  ------------------
  |  Branch (5691:17): [True: 422, False: 592]
  ------------------
 5692|    422|                char *endq;
 5693|    422|                if (*objidlen >= maxlen)
  ------------------
  |  Branch (5693:21): [True: 1, False: 421]
  ------------------
 5694|      1|                    goto bad_id;
 5695|    421|                endq = strchr(cp, doingquote);
 5696|    421|                if (!endq)
  ------------------
  |  Branch (5696:21): [True: 9, False: 412]
  ------------------
 5697|      9|                    goto bad_id;
 5698|    412|                objid[*objidlen] = len = endq - cp;
 5699|    412|                (*objidlen)++;
 5700|    412|            }
 5701|       |
 5702|  2.08k|            while (*cp && *cp != doingquote) {
  ------------------
  |  Branch (5702:20): [True: 2.05k, False: 29]
  |  Branch (5702:27): [True: 1.07k, False: 974]
  ------------------
 5703|  1.07k|                if (*objidlen >= maxlen)
  ------------------
  |  Branch (5703:21): [True: 1, False: 1.07k]
  ------------------
 5704|      1|                    goto bad_id;
 5705|  1.07k|                objid[*objidlen] = *cp++;
 5706|  1.07k|                (*objidlen)++;
 5707|  1.07k|            }
 5708|  1.00k|            if (!*cp)
  ------------------
  |  Branch (5708:17): [True: 29, False: 974]
  ------------------
 5709|     29|                goto bad_id;
 5710|    974|            cp2 = cp + 1;
 5711|    974|            if (!*cp2)
  ------------------
  |  Branch (5711:17): [True: 10, False: 964]
  ------------------
 5712|     10|                cp2 = NULL;
 5713|    964|            else if (*cp2 == '.')
  ------------------
  |  Branch (5713:22): [True: 952, False: 12]
  ------------------
 5714|    952|                cp2++;
 5715|     12|            else
 5716|     12|                goto bad_id;
 5717|    962|            break;
 5718|    962|        default:
  ------------------
  |  Branch (5718:9): [True: 40, False: 3.19k]
  ------------------
 5719|     40|            goto bad_id;
 5720|  3.23k|        }
 5721|  3.11k|        cp = cp2;
 5722|  3.11k|    }
 5723|     94|    return 1;
 5724|       |
 5725|    115|  bad_id:
 5726|    115|    {
 5727|    115|        char            buf[256];
 5728|    115|#ifndef NETSNMP_DISABLE_MIB_LOADING
 5729|    115|        if (in_dices)
  ------------------
  |  Branch (5729:13): [True: 0, False: 115]
  ------------------
 5730|      0|            snprintf(buf, sizeof(buf), "Index out of range: %s (%s)",
 5731|      0|                    fcp, in_dices->ilabel);
 5732|    115|        else if (tp)
  ------------------
  |  Branch (5732:18): [True: 0, False: 115]
  ------------------
 5733|      0|            snprintf(buf, sizeof(buf), "Sub-id not found: %s -> %s", tp->label, fcp);
 5734|    115|        else
 5735|    115|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 5736|    115|            snprintf(buf, sizeof(buf), "%s", fcp);
 5737|       |
 5738|    115|        snmp_set_detail(buf);
 5739|    115|    }
 5740|    115|    return 0;
 5741|    209|}

netsnmp_init_mib_internals:
  701|    224|{
  702|    224|    register struct tok *tp;
  703|    224|    register int    b, i;
  704|    224|    int             max_modc;
  705|       |
  706|    224|    if (tree_head)
  ------------------
  |  Branch (706:9): [True: 223, False: 1]
  ------------------
  707|    223|        return;
  708|       |
  709|       |    /*
  710|       |     * Set up hash list of pre-defined tokens
  711|       |     */
  712|      1|    memset(buckets, 0, sizeof(buckets));
  713|     93|    for (tp = tokens; tp->name; tp++) {
  ------------------
  |  Branch (713:23): [True: 92, False: 1]
  ------------------
  714|     92|        tp->hash = name_hash(tp->name);
  715|     92|        b = BUCKET(tp->hash);
  ------------------
  |  |  527|     92|#define BUCKET(x)       (x & (HASHSIZE-1))
  |  |  ------------------
  |  |  |  |  526|     92|#define HASHSIZE        32
  |  |  ------------------
  ------------------
  716|     92|        if (buckets[b])
  ------------------
  |  Branch (716:13): [True: 60, False: 32]
  ------------------
  717|     60|            tp->next = buckets[b];      /* BUG ??? */
  718|     92|        buckets[b] = tp;
  719|     92|    }
  720|       |
  721|       |    /*
  722|       |     * Initialise other internal structures
  723|       |     */
  724|       |
  725|      1|    max_modc = sizeof(module_map) / sizeof(module_map[0]) - 1;
  726|     22|    for (i = 0; i < max_modc; ++i)
  ------------------
  |  Branch (726:17): [True: 21, False: 1]
  ------------------
  727|     21|        module_map[i].next = &(module_map[i + 1]);
  728|      1|    module_map[max_modc].next = NULL;
  729|      1|    module_map_head = module_map;
  730|       |
  731|      1|    memset(nbuckets, 0, sizeof(nbuckets));
  732|      1|    memset(tbuckets, 0, sizeof(tbuckets));
  733|      1|    free(tclist);
  734|      1|    tc_alloc = TC_INCR;
  ------------------
  |  |  134|      1|#define TC_INCR 100
  ------------------
  735|      1|    tclist = calloc(tc_alloc, sizeof(struct tc));
  736|      1|    build_translation_table();
  737|      1|    init_tree_roots();          /* Set up initial roots */
  738|       |    /*
  739|       |     * Relies on 'add_mibdir' having set up the modules 
  740|       |     */
  741|      1|}
find_tree_node:
 1244|    138|{
 1245|    138|    struct tree    *tp, *headtp;
 1246|    138|    int             count, *int_p;
 1247|       |
 1248|    138|    if (!name || !*name)
  ------------------
  |  Branch (1248:9): [True: 0, False: 138]
  |  Branch (1248:18): [True: 2, False: 136]
  ------------------
 1249|      2|        return (NULL);
 1250|       |
 1251|    136|    headtp = tbuckets[NBUCKET(name_hash(name))];
  ------------------
  |  |  530|    136|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|    136|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1252|    261|    for (tp = headtp; tp; tp = tp->next) {
  ------------------
  |  Branch (1252:23): [True: 127, False: 134]
  ------------------
 1253|    127|        if (tp->label && !label_compare(tp->label, name)) {
  ------------------
  |  | 1238|    127|#define	label_compare	strcmp
  ------------------
  |  Branch (1253:13): [True: 127, False: 0]
  |  Branch (1253:26): [True: 2, False: 125]
  ------------------
 1254|       |
 1255|      2|            if (modid == -1)    /* Any module */
  ------------------
  |  Branch (1255:17): [True: 2, False: 0]
  ------------------
 1256|      2|                return (tp);
 1257|       |
 1258|      0|            for (int_p = tp->module_list, count = 0;
 1259|      0|                 count < tp->number_modules; ++count, ++int_p)
  ------------------
  |  Branch (1259:18): [True: 0, False: 0]
  ------------------
 1260|      0|                if (*int_p == modid)
  ------------------
  |  Branch (1260:21): [True: 0, False: 0]
  ------------------
 1261|      0|                    return (tp);
 1262|      0|        }
 1263|    127|    }
 1264|       |
 1265|    134|    return (NULL);
 1266|    136|}
which_module:
 4248|    217|{
 4249|    217|    struct module  *mp;
 4250|       |
 4251|    217|    for (mp = module_head; mp; mp = mp->next)
  ------------------
  |  Branch (4251:28): [True: 0, False: 217]
  ------------------
 4252|      0|        if (!label_compare(mp->name, name))
  ------------------
  |  | 1238|      0|#define	label_compare	strcmp
  ------------------
  |  Branch (4252:13): [True: 0, False: 0]
  ------------------
 4253|      0|            return (mp->modid);
 4254|       |
 4255|    217|    DEBUGMSGTL(("parse-mibs", "Module %s not found\n", name));
  ------------------
  |  |   66|    217|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    217|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 217]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 217]
  |  |  ------------------
  ------------------
 4256|    217|    return (-1);
 4257|    217|}
netsnmp_read_module:
 4524|    224|{
 4525|    224|    int status = 0;
 4526|    224|    status = read_module_internal(name);
 4527|       |
 4528|    224|    if (status == MODULE_NOT_FOUND) {
  ------------------
  |  |  513|    224|#define MODULE_NOT_FOUND	0
  ------------------
  |  Branch (4528:9): [True: 224, False: 0]
  ------------------
 4529|    224|        if (!read_module_replacements(name))
  ------------------
  |  Branch (4529:13): [True: 214, False: 10]
  ------------------
 4530|    214|            print_module_not_found(name);
 4531|    224|    } else if (status == MODULE_SYNTAX_ERROR) {
  ------------------
  |  |  520|      0|#define MODULE_SYNTAX_ERROR     4
  ------------------
  |  Branch (4531:16): [True: 0, False: 0]
  ------------------
 4532|      0|        gMibError = 0;
 4533|      0|        gLoop = 1;
 4534|       |
 4535|      0|        strncat(gMibNames, " ", sizeof(gMibNames) - strlen(gMibNames) - 1);
 4536|      0|        strncat(gMibNames, name, sizeof(gMibNames) - strlen(gMibNames) - 1);
 4537|      0|    }
 4538|       |
 4539|    224|    return tree_head;
 4540|    224|}
parse.c:name_hash:
  688|    231|{
  689|    231|    int             hash = 0;
  690|    231|    const char     *cp;
  691|       |
  692|    231|    if (!name)
  ------------------
  |  Branch (692:9): [True: 0, False: 231]
  ------------------
  693|      0|        return 0;
  694|  2.40k|    for (cp = name; *cp; cp++)
  ------------------
  |  Branch (694:21): [True: 2.17k, False: 231]
  ------------------
  695|  2.17k|        hash += tolower((unsigned char)(*cp));
  ------------------
  |  Branch (695:17): [True: 0, False: 0]
  |  Branch (695:17): [True: 0, False: 0]
  |  Branch (695:17): [Folded, False: 2.17k]
  ------------------
  696|    231|    return (hash);
  697|    231|}
parse.c:build_translation_table:
 1073|      1|{
 1074|      1|    int             count;
 1075|       |
 1076|    257|    for (count = 0; count < 256; count++) {
  ------------------
  |  Branch (1076:21): [True: 256, False: 1]
  ------------------
 1077|    256|        switch (count) {
 1078|      1|        case OBJID:
  ------------------
  |  |  167|      1|#define OBJID       (4 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1078:9): [True: 1, False: 255]
  ------------------
 1079|      1|            translation_table[count] = TYPE_OBJID;
  ------------------
  |  |  155|      1|#define TYPE_OBJID          1
  ------------------
 1080|      1|            break;
 1081|      1|        case OCTETSTR:
  ------------------
  |  |  168|      1|#define OCTETSTR    (5 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1081:9): [True: 1, False: 255]
  ------------------
 1082|      1|            translation_table[count] = TYPE_OCTETSTR;
  ------------------
  |  |  156|      1|#define TYPE_OCTETSTR       2
  ------------------
 1083|      1|            break;
 1084|      1|        case INTEGER:
  ------------------
  |  |  169|      1|#define INTEGER     (6 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1084:9): [True: 1, False: 255]
  ------------------
 1085|      1|            translation_table[count] = TYPE_INTEGER;
  ------------------
  |  |  157|      1|#define TYPE_INTEGER        3
  ------------------
 1086|      1|            break;
 1087|      1|        case NETADDR:
  ------------------
  |  |  170|      1|#define NETADDR     (7 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1087:9): [True: 1, False: 255]
  ------------------
 1088|      1|            translation_table[count] = TYPE_NETADDR;
  ------------------
  |  |  158|      1|#define TYPE_NETADDR        4
  ------------------
 1089|      1|            break;
 1090|      1|        case IPADDR:
  ------------------
  |  |  171|      1|#define IPADDR      (8 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1090:9): [True: 1, False: 255]
  ------------------
 1091|      1|            translation_table[count] = TYPE_IPADDR;
  ------------------
  |  |  159|      1|#define TYPE_IPADDR         5
  ------------------
 1092|      1|            break;
 1093|      1|        case COUNTER:
  ------------------
  |  |  172|      1|#define COUNTER     (9 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1093:9): [True: 1, False: 255]
  ------------------
 1094|      1|            translation_table[count] = TYPE_COUNTER;
  ------------------
  |  |  160|      1|#define TYPE_COUNTER        6
  ------------------
 1095|      1|            break;
 1096|      1|        case GAUGE:
  ------------------
  |  |  173|      1|#define GAUGE       (10 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1096:9): [True: 1, False: 255]
  ------------------
 1097|      1|            translation_table[count] = TYPE_GAUGE;
  ------------------
  |  |  161|      1|#define TYPE_GAUGE          7
  ------------------
 1098|      1|            break;
 1099|      1|        case TIMETICKS:
  ------------------
  |  |  174|      1|#define TIMETICKS   (11 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1099:9): [True: 1, False: 255]
  ------------------
 1100|      1|            translation_table[count] = TYPE_TIMETICKS;
  ------------------
  |  |  162|      1|#define TYPE_TIMETICKS      8
  ------------------
 1101|      1|            break;
 1102|      1|        case KW_OPAQUE:
  ------------------
  |  |  175|      1|#define KW_OPAQUE   (12 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1102:9): [True: 1, False: 255]
  ------------------
 1103|      1|            translation_table[count] = TYPE_OPAQUE;
  ------------------
  |  |  163|      1|#define TYPE_OPAQUE         9
  ------------------
 1104|      1|            break;
 1105|      1|        case NUL:
  ------------------
  |  |  176|      1|#define NUL         (13 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1105:9): [True: 1, False: 255]
  ------------------
 1106|      1|            translation_table[count] = TYPE_NULL;
  ------------------
  |  |  164|      1|#define TYPE_NULL           10
  ------------------
 1107|      1|            break;
 1108|      1|        case COUNTER64:
  ------------------
  |  |  211|      1|#define COUNTER64   (43 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1108:9): [True: 1, False: 255]
  ------------------
 1109|      1|            translation_table[count] = TYPE_COUNTER64;
  ------------------
  |  |  165|      1|#define TYPE_COUNTER64      11
  ------------------
 1110|      1|            break;
 1111|      1|        case BITSTRING:
  ------------------
  |  |  209|      1|#define BITSTRING   (41 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1111:9): [True: 1, False: 255]
  ------------------
 1112|      1|            translation_table[count] = TYPE_BITSTRING;
  ------------------
  |  |  166|      1|#define TYPE_BITSTRING      12
  ------------------
 1113|      1|            break;
 1114|      1|        case NSAPADDRESS:
  ------------------
  |  |  210|      1|#define NSAPADDRESS (42 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1114:9): [True: 1, False: 255]
  ------------------
 1115|      1|            translation_table[count] = TYPE_NSAPADDRESS;
  ------------------
  |  |  167|      1|#define TYPE_NSAPADDRESS    13
  ------------------
 1116|      1|            break;
 1117|      1|        case INTEGER32:
  ------------------
  |  |  274|      1|#define INTEGER32	(105 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1117:9): [True: 1, False: 255]
  ------------------
 1118|      1|            translation_table[count] = TYPE_INTEGER32;
  ------------------
  |  |  170|      1|#define TYPE_INTEGER32      16
  ------------------
 1119|      1|            break;
 1120|      1|        case UINTEGER32:
  ------------------
  |  |  224|      1|#define UINTEGER32 (56 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1120:9): [True: 1, False: 255]
  ------------------
 1121|      1|            translation_table[count] = TYPE_UINTEGER;
  ------------------
  |  |  168|      1|#define TYPE_UINTEGER       14
  ------------------
 1122|      1|            break;
 1123|      1|        case UNSIGNED32:
  ------------------
  |  |  273|      1|#define UNSIGNED32	(104 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1123:9): [True: 1, False: 255]
  ------------------
 1124|      1|            translation_table[count] = TYPE_UNSIGNED32;
  ------------------
  |  |  169|      1|#define TYPE_UNSIGNED32     15
  ------------------
 1125|      1|            break;
 1126|      1|        case TRAPTYPE:
  ------------------
  |  |  229|      1|#define TRAPTYPE    61
  ------------------
  |  Branch (1126:9): [True: 1, False: 255]
  ------------------
 1127|      1|            translation_table[count] = TYPE_TRAPTYPE;
  ------------------
  |  |  174|      1|#define TYPE_TRAPTYPE	    20
  ------------------
 1128|      1|            break;
 1129|      1|        case NOTIFTYPE:
  ------------------
  |  |  213|      1|#define NOTIFTYPE   45
  ------------------
  |  Branch (1129:9): [True: 1, False: 255]
  ------------------
 1130|      1|            translation_table[count] = TYPE_NOTIFTYPE;
  ------------------
  |  |  175|      1|#define TYPE_NOTIFTYPE      21
  ------------------
 1131|      1|            break;
 1132|      1|        case NOTIFGROUP:
  ------------------
  |  |  258|      1|#define NOTIFGROUP  88
  ------------------
  |  Branch (1132:9): [True: 1, False: 255]
  ------------------
 1133|      1|            translation_table[count] = TYPE_NOTIFGROUP;
  ------------------
  |  |  177|      1|#define TYPE_NOTIFGROUP	    23
  ------------------
 1134|      1|            break;
 1135|      1|        case OBJGROUP:
  ------------------
  |  |  212|      1|#define OBJGROUP    44
  ------------------
  |  Branch (1135:9): [True: 1, False: 255]
  ------------------
 1136|      1|            translation_table[count] = TYPE_OBJGROUP;
  ------------------
  |  |  176|      1|#define TYPE_OBJGROUP	    22
  ------------------
 1137|      1|            break;
 1138|      1|        case MODULEIDENTITY:
  ------------------
  |  |  220|      1|#define MODULEIDENTITY 52
  ------------------
  |  Branch (1138:9): [True: 1, False: 255]
  ------------------
 1139|      1|            translation_table[count] = TYPE_MODID;
  ------------------
  |  |  178|      1|#define TYPE_MODID	    24
  ------------------
 1140|      1|            break;
 1141|      1|        case OBJIDENTITY:
  ------------------
  |  |  275|      1|#define OBJIDENTITY	106
  ------------------
  |  Branch (1141:9): [True: 1, False: 255]
  ------------------
 1142|      1|            translation_table[count] = TYPE_OBJIDENTITY;
  ------------------
  |  |  181|      1|#define TYPE_OBJIDENTITY    27
  ------------------
 1143|      1|            break;
 1144|      1|        case AGENTCAP:
  ------------------
  |  |  243|      1|#define AGENTCAP    73
  ------------------
  |  Branch (1144:9): [True: 1, False: 255]
  ------------------
 1145|      1|            translation_table[count] = TYPE_AGENTCAP;
  ------------------
  |  |  179|      1|#define TYPE_AGENTCAP       25
  ------------------
 1146|      1|            break;
 1147|      1|        case COMPLIANCE:
  ------------------
  |  |  215|      1|#define COMPLIANCE  47
  ------------------
  |  Branch (1147:9): [True: 1, False: 255]
  ------------------
 1148|      1|            translation_table[count] = TYPE_MODCOMP;
  ------------------
  |  |  180|      1|#define TYPE_MODCOMP        26
  ------------------
 1149|      1|            break;
 1150|    232|        default:
  ------------------
  |  Branch (1150:9): [True: 232, False: 24]
  ------------------
 1151|    232|            translation_table[count] = TYPE_OTHER;
  ------------------
  |  |  154|    232|#define TYPE_OTHER          0
  ------------------
 1152|    232|            break;
 1153|    256|        }
 1154|    256|    }
 1155|      1|}
parse.c:init_tree_roots:
 1159|      1|{
 1160|      1|    struct tree    *tp, *lasttp;
 1161|      1|    int             base_modid;
 1162|      1|    int             hash;
 1163|       |
 1164|      1|    base_modid = which_module("SNMPv2-SMI");
 1165|      1|    if (base_modid == -1)
  ------------------
  |  Branch (1165:9): [True: 1, False: 0]
  ------------------
 1166|      1|        base_modid = which_module("RFC1155-SMI");
 1167|      1|    if (base_modid == -1)
  ------------------
  |  Branch (1167:9): [True: 1, False: 0]
  ------------------
 1168|      1|        base_modid = which_module("RFC1213-MIB");
 1169|       |
 1170|       |    /*
 1171|       |     * build root node 
 1172|       |     */
 1173|      1|    tp = calloc(1, sizeof(struct tree));
 1174|      1|    if (tp == NULL)
  ------------------
  |  Branch (1174:9): [True: 0, False: 1]
  ------------------
 1175|      0|        return;
 1176|      1|    tp->label = strdup("joint-iso-ccitt");
 1177|      1|    tp->modid = base_modid;
 1178|      1|    tp->number_modules = 1;
 1179|      1|    tp->module_list = &(tp->modid);
 1180|      1|    tp->subid = 2;
 1181|      1|    tp->tc_index = -1;
 1182|      1|    set_function(tp);           /* from mib.c */
 1183|      1|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|      1|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|      1|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1184|      1|    tp->next = tbuckets[hash];
 1185|      1|    tbuckets[hash] = tp;
 1186|      1|    lasttp = tp;
 1187|      1|    root_imports[0].label = strdup(tp->label);
 1188|      1|    root_imports[0].modid = base_modid;
 1189|       |
 1190|       |    /*
 1191|       |     * build root node 
 1192|       |     */
 1193|      1|    tp = calloc(1, sizeof(struct tree));
 1194|      1|    if (tp == NULL)
  ------------------
  |  Branch (1194:9): [True: 0, False: 1]
  ------------------
 1195|      0|        return;
 1196|      1|    tp->next_peer = lasttp;
 1197|      1|    tp->label = strdup("ccitt");
 1198|      1|    tp->modid = base_modid;
 1199|      1|    tp->number_modules = 1;
 1200|      1|    tp->module_list = &(tp->modid);
 1201|      1|    tp->subid = 0;
 1202|      1|    tp->tc_index = -1;
 1203|      1|    set_function(tp);           /* from mib.c */
 1204|      1|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|      1|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|      1|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1205|      1|    tp->next = tbuckets[hash];
 1206|      1|    tbuckets[hash] = tp;
 1207|      1|    lasttp = tp;
 1208|      1|    root_imports[1].label = strdup(tp->label);
 1209|      1|    root_imports[1].modid = base_modid;
 1210|       |
 1211|       |    /*
 1212|       |     * build root node 
 1213|       |     */
 1214|      1|    tp = calloc(1, sizeof(struct tree));
 1215|      1|    if (tp == NULL)
  ------------------
  |  Branch (1215:9): [True: 0, False: 1]
  ------------------
 1216|      0|        return;
 1217|      1|    tp->next_peer = lasttp;
 1218|      1|    tp->label = strdup("iso");
 1219|      1|    tp->modid = base_modid;
 1220|      1|    tp->number_modules = 1;
 1221|      1|    tp->module_list = &(tp->modid);
 1222|      1|    tp->subid = 1;
 1223|      1|    tp->tc_index = -1;
 1224|      1|    set_function(tp);           /* from mib.c */
 1225|      1|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|      1|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|      1|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1226|      1|    tp->next = tbuckets[hash];
 1227|      1|    tbuckets[hash] = tp;
 1228|      1|    lasttp = tp;
 1229|      1|    root_imports[2].label = strdup(tp->label);
 1230|      1|    root_imports[2].modid = base_modid;
 1231|       |
 1232|      1|    tree_head = tp;
 1233|      1|}
parse.c:read_module_internal:
 4432|    224|{
 4433|    224|    struct module  *mp;
 4434|       |
 4435|    224|    netsnmp_init_mib_internals();
 4436|       |
 4437|    224|    for (mp = module_head; mp; mp = mp->next)
  ------------------
  |  Branch (4437:28): [True: 0, False: 224]
  ------------------
 4438|      0|        if (!label_compare(mp->name, name))
  ------------------
  |  | 1238|      0|#define	label_compare	strcmp
  ------------------
  |  Branch (4438:13): [True: 0, False: 0]
  ------------------
 4439|      0|            return read_from_file(mp, name);
 4440|       |
 4441|    224|    return MODULE_NOT_FOUND;
  ------------------
  |  |  513|    224|#define MODULE_NOT_FOUND	0
  ------------------
 4442|    224|}
parse.c:print_error:
  781|    210|{
  782|    210|    erroneousMibs++;
  783|    210|    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    210|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (783:9): [True: 210, False: 0]
  ------------------
  784|    210|                                NETSNMP_DS_LIB_MIB_ERRORS))
  ------------------
  |  |   59|    210|#define NETSNMP_DS_LIB_MIB_ERRORS          0
  ------------------
  785|    210|	return;
  786|      0|    DEBUGMSGTL(("parse-mibs", "\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  787|      0|    if (type == ENDOFFILE)
  ------------------
  |  |  163|      0|#define ENDOFFILE   0
  ------------------
  |  Branch (787:9): [True: 0, False: 0]
  ------------------
  788|      0|        snmp_log(LOG_ERR, "%s (EOF): At line %d in %s\n", str, mibLine,
  789|      0|                 File);
  790|      0|    else if (token && *token)
  ------------------
  |  Branch (790:14): [True: 0, False: 0]
  |  Branch (790:23): [True: 0, False: 0]
  ------------------
  791|      0|        snmp_log(LOG_ERR, "%s (%s): At line %d in %s\n", str, token,
  792|      0|                 mibLine, File);
  793|      0|    else
  794|      0|        snmp_log(LOG_ERR, "%s: At line %d in %s\n", str, mibLine, File);
  795|      0|}
parse.c:read_module_replacements:
 4312|    224|{
 4313|    224|    struct module_compatability *mcp;
 4314|       |
 4315|  4.99k|    for (mcp = module_map_head; mcp; mcp = mcp->next) {
  ------------------
  |  Branch (4315:33): [True: 4.78k, False: 214]
  ------------------
 4316|  4.78k|        if (!label_compare(mcp->old_module, name)) {
  ------------------
  |  | 1238|  4.78k|#define	label_compare	strcmp
  ------------------
  |  Branch (4316:13): [True: 10, False: 4.77k]
  ------------------
 4317|     10|            if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     10|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (4317:17): [True: 0, False: 10]
  ------------------
 4318|     10|				   NETSNMP_DS_LIB_MIB_WARNINGS)) {
  ------------------
  |  |  114|     10|#define NETSNMP_DS_LIB_MIB_WARNINGS         0
  ------------------
 4319|      0|                snmp_log(LOG_WARNING,
 4320|      0|                         "Loading replacement module %s for %s (%s)\n",
 4321|      0|                         mcp->new_module, name, File);
 4322|      0|	    }
 4323|     10|            (void) netsnmp_read_module(mcp->new_module);
 4324|     10|            return 1;
 4325|     10|        }
 4326|  4.78k|    }
 4327|    214|    return 0;
 4328|    224|}
parse.c:print_module_not_found:
  799|    214|{
  800|    214|    if (first_err_module) {
  ------------------
  |  Branch (800:9): [True: 1, False: 213]
  ------------------
  801|      1|        snmp_log(LOG_ERR, "MIB search path: %s\n",
  802|      1|                           netsnmp_get_mib_directory());
  803|      1|        first_err_module = 0;
  804|      1|    }
  805|    214|    if (!last_err_module || strcmp(cp, last_err_module))
  ------------------
  |  Branch (805:9): [True: 1, False: 213]
  |  Branch (805:29): [True: 209, False: 4]
  ------------------
  806|    210|        print_error("Cannot find module", cp, CONTINUE);
  ------------------
  |  |  162|    210|#define CONTINUE    -1
  ------------------
  807|    214|    if (last_err_module)
  ------------------
  |  Branch (807:9): [True: 213, False: 1]
  ------------------
  808|    213|        free(last_err_module);
  809|    214|    last_err_module = strdup(cp);
  810|    214|}

snmp_set_detail:
  529|    115|{
  530|    115|    if (detail_string != NULL) {
  ------------------
  |  Branch (530:9): [True: 115, False: 0]
  ------------------
  531|    115|        strlcpy(snmp_detail, detail_string, sizeof(snmp_detail));
  532|    115|        snmp_detail_f = 1;
  533|    115|    }
  534|    115|}

snmp_get_do_debugging:
  551|    224|{
  552|    224|    return dodebug;
  553|    224|}

netsnmp_set_line_buffering:
  187|      1|{
  188|       |#if defined(WIN32)
  189|       |    /*
  190|       |     * According to MSDN, the Microsoft Visual Studio C runtime library does
  191|       |     * not support line buffering, so turn off buffering completely.
  192|       |     * See also http://msdn.microsoft.com/en-us/library/86cebhfs(VS.71).aspx.
  193|       |     */
  194|       |    setvbuf(stream, NULL, _IONBF, BUFSIZ);
  195|       |#elif defined(HAVE_SETLINEBUF)
  196|       |    /* setlinefunction() is a function from the BSD Unix API. */
  197|       |    setlinebuf(stream);
  198|       |#else
  199|       |    /* See also the C89 or C99 standard for more information about setvbuf(). */
  200|      1|    setvbuf(stream, NULL, _IOLBF, BUFSIZ);
  201|      1|#endif
  202|      1|}
log_handler_stdouterr:
 1103|      1|{
 1104|      1|    static int      newline = 1;	 /* MTCRITICAL_RESOURCE */
 1105|      1|    const char     *newline_ptr;
 1106|      1|    char            sbuf[40];
 1107|       |
 1108|      1|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1108:9): [True: 0, False: 1]
  ------------------
 1109|      1|                               NETSNMP_DS_LIB_LOG_TIMESTAMP) && newline) {
  ------------------
  |  |   64|      1|#define NETSNMP_DS_LIB_LOG_TIMESTAMP       5
  ------------------
  |  Branch (1109:65): [True: 0, False: 0]
  ------------------
 1110|      0|        snprintf_stamp(NULL, sbuf, sizeof(sbuf));
 1111|      1|    } else {
 1112|      1|        strcpy(sbuf, "");
 1113|      1|    }
 1114|       |    /*
 1115|       |     * Remember whether or not the current line ends with a newline for the
 1116|       |     * next call of log_handler_stdouterr().
 1117|       |     */
 1118|      1|    newline_ptr = strrchr(str, '\n');
 1119|      1|    newline = newline_ptr && newline_ptr[1] == 0;
  ------------------
  |  Branch (1119:15): [True: 1, False: 0]
  |  Branch (1119:30): [True: 1, False: 0]
  ------------------
 1120|       |
 1121|      1|    if (logh->imagic)
  ------------------
  |  Branch (1121:9): [True: 0, False: 1]
  ------------------
 1122|      0|       printf(         "%s%s", sbuf, str);
 1123|      1|    else
 1124|      1|       fprintf(stderr, "%s%s", sbuf, str);
 1125|       |
 1126|      1|    return 1;
 1127|      1|}
snmp_log_string:
 1294|      1|{
 1295|      1|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1296|      1|    static int stderr_enabled = 0;
 1297|      1|    static netsnmp_log_handler lh = { 1, 0, 0, 0, "stderr",
 1298|      1|                                      log_handler_stdouterr, 0, NULL,  NULL,
 1299|      1|                                      NULL };
 1300|      1|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1301|      1|    netsnmp_log_handler *logh;
 1302|       |
 1303|       |    /*
 1304|       |     * We've got to be able to log messages *somewhere*!
 1305|       |     * If you don't want stderr logging, then enable something else.
 1306|       |     */
 1307|      1|    if (0 == logh_enabled) {
  ------------------
  |  Branch (1307:9): [True: 1, False: 0]
  ------------------
 1308|      1|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1309|      1|        if (!stderr_enabled) {
  ------------------
  |  Branch (1309:13): [True: 1, False: 0]
  ------------------
 1310|      1|            ++stderr_enabled;
 1311|      1|            netsnmp_set_line_buffering(stderr);
 1312|      1|        }
 1313|      1|        log_handler_stdouterr( &lh, priority, str );
 1314|      1|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1315|       |
 1316|      1|        return;
 1317|      1|    }
 1318|      0|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1319|      0|    else if (stderr_enabled) {
  ------------------
  |  Branch (1319:14): [True: 0, False: 0]
  ------------------
 1320|      0|        stderr_enabled = 0;
 1321|      0|        log_handler_stdouterr( &lh, LOG_INFO,
 1322|      0|                               "Log handling defined - disabling stderr\n" );
 1323|      0|    }
 1324|      0|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1325|       |        
 1326|       |
 1327|       |    /*
 1328|       |     * Start at the given priority, and work "upwards"....
 1329|       |     */
 1330|      0|    if (priority < LOG_EMERG)
  ------------------
  |  Branch (1330:9): [True: 0, False: 0]
  ------------------
 1331|      0|        priority = LOG_EMERG;
 1332|      0|    else if (priority > LOG_DEBUG)
  ------------------
  |  Branch (1332:14): [True: 0, False: 0]
  ------------------
 1333|      0|        priority = LOG_DEBUG;
 1334|      0|    logh = logh_priorities[priority];
 1335|      0|    for ( ; logh; logh = logh->next ) {
  ------------------
  |  Branch (1335:13): [True: 0, False: 0]
  ------------------
 1336|       |        /*
 1337|       |         * ... but skipping any handlers with a "maximum priority"
 1338|       |         *     that we have already exceeded. And don't forget to
 1339|       |         *     ensure this logging is turned on (see snmp_disable_stderrlog
 1340|       |         *     and its cohorts).
 1341|       |         */
 1342|      0|        if (logh->enabled && priority >= logh->pri_max)
  ------------------
  |  Branch (1342:13): [True: 0, False: 0]
  |  Branch (1342:30): [True: 0, False: 0]
  ------------------
 1343|      0|            logh->handler( logh, priority, str );
 1344|      0|    }
 1345|      0|}
snmp_vlog:
 1383|      1|{
 1384|      1|    char           *buffer = NULL;
 1385|      1|    int             length;
 1386|       |
 1387|      1|    length = vasprintf(&buffer, format, ap);
 1388|      1|    if (length < 0) {
  ------------------
  |  Branch (1388:9): [True: 0, False: 1]
  ------------------
 1389|      0|        snmp_log_string(LOG_ERR, "Could not format log-string\n");
 1390|      0|        return -1;
 1391|      0|    }
 1392|       |
 1393|      1|    snmp_log_string(priority, buffer);
 1394|      1|    free(buffer);
 1395|      1|    return 0;
 1396|      1|}
snmp_log:
 1407|      1|{
 1408|      1|    va_list         ap;
 1409|      1|    int             ret;
 1410|      1|    va_start(ap, format);
 1411|      1|    ret = snmp_vlog(priority, format, ap);
 1412|       |    va_end(ap);
 1413|      1|    return (ret);
 1414|      1|}

netsnmp_getenv:
 1186|      1|{
 1187|      1|#if !defined (WIN32) && !defined (cygwin)
 1188|      1|  return (getenv(name));
 1189|       |#else
 1190|       |  char *temp = NULL;  
 1191|       |  HKEY hKey;
 1192|       |  unsigned char * key_value = NULL;
 1193|       |  DWORD key_value_size = 0;
 1194|       |  DWORD key_value_type = 0;
 1195|       |  DWORD getenv_worked = 0;
 1196|       |
 1197|       |  DEBUGMSGTL(("read_config", "netsnmp_getenv called with name: %s\n",name));
 1198|       |
 1199|       |  if (!(name))
 1200|       |    return NULL;
 1201|       |  
 1202|       |  /* Try environment variable first */ 
 1203|       |  temp = getenv(name);
 1204|       |  if (temp) {
 1205|       |    getenv_worked = 1;
 1206|       |    DEBUGMSGTL(("read_config", "netsnmp_getenv will return from ENV: %s\n",temp));
 1207|       |  }
 1208|       |  
 1209|       |  /* Next try HKCU */
 1210|       |  if (temp == NULL)
 1211|       |  {
 1212|       |    if (getenv("SNMP_IGNORE_WINDOWS_REGISTRY"))
 1213|       |      return NULL;
 1214|       |
 1215|       |    if (RegOpenKeyExA(
 1216|       |          HKEY_CURRENT_USER, 
 1217|       |          "SOFTWARE\\Net-SNMP", 
 1218|       |          0, 
 1219|       |          KEY_QUERY_VALUE, 
 1220|       |          &hKey) == ERROR_SUCCESS) {   
 1221|       |      
 1222|       |      if (RegQueryValueExA(
 1223|       |            hKey, 
 1224|       |            name, 
 1225|       |            NULL, 
 1226|       |            &key_value_type, 
 1227|       |            NULL,               /* Just get the size */
 1228|       |            &key_value_size) == ERROR_SUCCESS) {
 1229|       |
 1230|       |        SNMP_FREE(key_value);
 1231|       |
 1232|       |        /* Allocate memory needed +1 to allow RegQueryValueExA to NULL terminate the
 1233|       |         * string data in registry is missing one (which is unlikely).
 1234|       |         */
 1235|       |        key_value = malloc((sizeof(char) * key_value_size)+sizeof(char));
 1236|       |        
 1237|       |        if (RegQueryValueExA(
 1238|       |              hKey, 
 1239|       |              name, 
 1240|       |              NULL, 
 1241|       |              &key_value_type, 
 1242|       |              key_value, 
 1243|       |              &key_value_size) == ERROR_SUCCESS) {
 1244|       |        }
 1245|       |        temp = (char *) key_value;
 1246|       |      }
 1247|       |      RegCloseKey(hKey);
 1248|       |      if (temp)
 1249|       |        DEBUGMSGTL(("read_config", "netsnmp_getenv will return from HKCU: %s\n",temp));
 1250|       |    }
 1251|       |  }
 1252|       |
 1253|       |  /* Next try HKLM */
 1254|       |  if (temp == NULL)
 1255|       |  {
 1256|       |    if (RegOpenKeyExA(
 1257|       |          HKEY_LOCAL_MACHINE, 
 1258|       |          "SOFTWARE\\Net-SNMP", 
 1259|       |          0, 
 1260|       |          KEY_QUERY_VALUE, 
 1261|       |          &hKey) == ERROR_SUCCESS) {   
 1262|       |      
 1263|       |      if (RegQueryValueExA(
 1264|       |            hKey, 
 1265|       |            name, 
 1266|       |            NULL, 
 1267|       |            &key_value_type, 
 1268|       |            NULL,               /* Just get the size */
 1269|       |            &key_value_size) == ERROR_SUCCESS) {
 1270|       |
 1271|       |        SNMP_FREE(key_value);
 1272|       |
 1273|       |        /* Allocate memory needed +1 to allow RegQueryValueExA to NULL terminate the
 1274|       |         * string data in registry is missing one (which is unlikely).
 1275|       |         */
 1276|       |        key_value = malloc((sizeof(char) * key_value_size)+sizeof(char));
 1277|       |        
 1278|       |        if (RegQueryValueExA(
 1279|       |              hKey, 
 1280|       |              name, 
 1281|       |              NULL, 
 1282|       |              &key_value_type, 
 1283|       |              key_value, 
 1284|       |              &key_value_size) == ERROR_SUCCESS) {
 1285|       |        }
 1286|       |        temp = (char *) key_value;
 1287|       |
 1288|       |      }
 1289|       |      RegCloseKey(hKey);
 1290|       |      if (temp)
 1291|       |        DEBUGMSGTL(("read_config", "netsnmp_getenv will return from HKLM: %s\n",temp));
 1292|       |    }
 1293|       |  }
 1294|       |  
 1295|       |  if (temp && !getenv_worked) {
 1296|       |    setenv(name, temp, 1);
 1297|       |    SNMP_FREE(temp);
 1298|       |  }
 1299|       |
 1300|       |  DEBUGMSGTL(("read_config", "netsnmp_getenv returning: %s\n",getenv(name)));
 1301|       |
 1302|       |  return(getenv(name));
 1303|       |#endif
 1304|      1|}

LLVMFuzzerInitialize:
   36|      2|int LLVMFuzzerInitialize(int *argc, char ***argv) {
   37|      2|    if (getenv("NETSNMP_DEBUGGING") != NULL) {
  ------------------
  |  Branch (37:9): [True: 0, False: 2]
  ------------------
   38|       |        /*
   39|       |         * Turn on all debugging, to help understand what
   40|       |         * bits of the parser are running.
   41|       |         */
   42|      0|        snmp_enable_stderrlog();
   43|      0|        snmp_set_do_debugging(1);
   44|      0|        debug_register_tokens("");
   45|      0|    }
   46|      2|    return 0;
   47|      2|}
LLVMFuzzerTestOneInput:
   49|    616|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   50|    616|    oid *objid = malloc(MAX_OID_LEN * sizeof(oid));
  ------------------
  |  |  120|    616|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
   51|    616|    size_t objidlen = MAX_OID_LEN;
  ------------------
  |  |  120|    616|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
   52|    616|    char *input;
   53|       |
   54|    616|    input = strndup((const char *)data, size);
   55|    616|    NETSNMP_IGNORE_RESULT(read_objid(input, objid, &objidlen));
  ------------------
  |  |  131|    616|#define NETSNMP_IGNORE_RESULT(e) do { if (e) { } } while (0)
  |  |  ------------------
  |  |  |  Branch (131:43): [True: 95, False: 521]
  |  |  |  Branch (131:59): [Folded, False: 616]
  |  |  ------------------
  ------------------
   56|    616|    free(objid);
   57|    616|    free(input);
   58|    616|    return 0;
   59|    616|}

