asn_parse_nlength:
  327|    246|{
  328|    246|    int len_len;
  329|       |
  330|    246|    if (pkt_len < 1)
  ------------------
  |  Branch (330:9): [True: 0, False: 246]
  ------------------
  331|      0|        return NULL;               /* always too short */
  332|       |
  333|    246|    if (NULL == pkt || NULL == data_len)
  ------------------
  |  Branch (333:9): [True: 0, False: 246]
  |  Branch (333:24): [True: 0, False: 246]
  ------------------
  334|      0|        return NULL;
  335|       |
  336|    246|    *data_len = 0;
  337|       |
  338|    246|    if (*pkt & 0x80) {
  ------------------
  |  Branch (338:9): [True: 17, False: 229]
  ------------------
  339|       |        /*
  340|       |         * long length; first byte is length of length (after masking high bit)
  341|       |         */
  342|     17|        len_len = (int) ((*pkt & ~0x80) + 1);
  343|     17|        if (pkt_len < len_len)
  ------------------
  |  Branch (343:13): [True: 6, False: 11]
  ------------------
  344|      6|            return NULL;           /* still too short for length and data */
  345|       |
  346|       |        /* now we know we have enough data to parse length */
  347|     11|        if (NULL == asn_parse_length(pkt, data_len))
  ------------------
  |  Branch (347:13): [True: 1, False: 10]
  ------------------
  348|      1|            return NULL;           /* propagate error from asn_parse_length */
  349|    229|    } else {
  350|       |        /*
  351|       |         * short length; first byte is the length
  352|       |         */
  353|    229|        len_len = 1;
  354|    229|        *data_len = *pkt;
  355|    229|    }
  356|       |
  357|    239|    if ((*data_len + len_len) > pkt_len)
  ------------------
  |  Branch (357:9): [True: 20, False: 219]
  ------------------
  358|     20|        return NULL;
  359|       |
  360|    219|    return (pkt + len_len);
  361|    239|}
asn_parse_int:
  563|     97|{
  564|       |    /*
  565|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  566|       |     */
  567|     97|    static const char *errpre = "parse int";
  568|     97|    register u_char *bufp = data;
  569|     97|    u_long          asn_length;
  570|     97|    int             i;
  571|     97|    union {
  572|     97|        long          l;
  573|     97|        unsigned char b[sizeof(long)];
  574|     97|    } value;
  575|       |
  576|     97|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (576:9): [True: 0, False: 97]
  |  Branch (576:25): [True: 0, False: 97]
  |  Branch (576:47): [True: 0, False: 97]
  |  Branch (576:63): [True: 0, False: 97]
  ------------------
  577|      0|        ERROR_MSG("parse int: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  578|      0|        return NULL;
  579|      0|    }
  580|       |
  581|     97|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (581:9): [True: 0, False: 97]
  ------------------
  582|      0|        _asn_size_err(errpre, intsize, sizeof(long));
  583|      0|        return NULL;
  584|      0|    }
  585|       |
  586|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
  587|     97|    if (*datalength < 2) {
  ------------------
  |  Branch (587:9): [True: 1, False: 96]
  ------------------
  588|      1|        _asn_short_err(errpre, *datalength, 2);
  589|      1|        return NULL;
  590|      1|    }
  591|       |
  592|     96|    *type = *bufp++;
  593|     96|    if (*type != ASN_INTEGER) {
  ------------------
  |  |   75|     96|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (593:9): [True: 2, False: 94]
  ------------------
  594|      2|        _asn_type_err(errpre, *type);
  595|      2|        return NULL;
  596|      2|    }
  597|       |
  598|     94|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  599|     94|    if (NULL == bufp) {
  ------------------
  |  Branch (599:9): [True: 4, False: 90]
  ------------------
  600|      4|        _asn_short_err(errpre, *datalength - 1, asn_length);
  601|      4|        return NULL;
  602|      4|    }
  603|       |
  604|     90|    if ((size_t) asn_length > intsize || (int) asn_length == 0) {
  ------------------
  |  Branch (604:9): [True: 0, False: 90]
  |  Branch (604:42): [True: 0, False: 90]
  ------------------
  605|      0|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  606|      0|        return NULL;
  607|      0|    }
  608|       |
  609|     90|    *datalength -= (int) asn_length + (bufp - data);
  610|       |
  611|     90|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|     90|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     90|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 90]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 90]
  |  |  ------------------
  ------------------
  612|       |
  613|     90|    memset(&value.b, *bufp & 0x80 ? 0xff : 0, sizeof(value.b));
  ------------------
  |  Branch (613:22): [True: 9, False: 81]
  ------------------
  614|     90|    if (NETSNMP_BIGENDIAN) {
  ------------------
  |  | 2390|     90|#  define NETSNMP_BIGENDIAN 0
  |  |  ------------------
  |  |  |  Branch (2390:29): [Folded, False: 90]
  |  |  ------------------
  ------------------
  615|      0|        for (i = sizeof(long) - asn_length; asn_length--; i++)
  ------------------
  |  Branch (615:45): [True: 0, False: 0]
  ------------------
  616|      0|            value.b[i] = *bufp++;
  617|     90|    } else {
  618|    308|        for (i = asn_length - 1; asn_length--; i--)
  ------------------
  |  Branch (618:34): [True: 218, False: 90]
  ------------------
  619|    218|            value.b[i] = *bufp++;
  620|     90|    }
  621|       |
  622|     90|    CHECK_OVERFLOW_S(value.l, 1);
  ------------------
  |  |  214|     90|#define CHECK_OVERFLOW_S(x,y) do {                                      \
  |  |  215|     90|        if (x > INT32_MAX) {                                            \
  |  |  ------------------
  |  |  |  Branch (215:13): [True: 2, False: 88]
  |  |  ------------------
  |  |  216|      2|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|      2|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  217|      2|            x &= 0xffffffff;                                            \
  |  |  218|     88|        } else if (x < INT32_MIN) {                                     \
  |  |  ------------------
  |  |  |  Branch (218:20): [True: 1, False: 87]
  |  |  ------------------
  |  |  219|      1|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|      1|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  220|      1|            x = 0 - (x & 0xffffffff);                                   \
  |  |  221|      1|        }                                                               \
  |  |  222|     90|    } while(0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded, False: 90]
  |  |  ------------------
  ------------------
  623|       |
  624|     90|    DEBUGMSG(("dumpv_recv", "  Integer:\t%ld (0x%.2lX)\n", value.l, value.l));
  ------------------
  |  |   61|     90|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     90|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 90]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 90]
  |  |  ------------------
  ------------------
  625|       |
  626|     90|    *intp = value.l;
  627|     90|    return bufp;
  628|     90|}
asn_parse_unsigned_int:
  656|      3|{
  657|       |    /*
  658|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  659|       |     */
  660|      3|    static const char *errpre = "parse uint";
  661|      3|    register u_char *bufp = data;
  662|      3|    u_long          asn_length;
  663|      3|    register u_long value = 0;
  664|       |
  665|      3|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (665:9): [True: 0, False: 3]
  |  Branch (665:25): [True: 0, False: 3]
  |  Branch (665:47): [True: 0, False: 3]
  |  Branch (665:63): [True: 0, False: 3]
  ------------------
  666|      0|        ERROR_MSG("parse uint: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  667|      0|        return NULL;
  668|      0|    }
  669|       |
  670|      3|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (670:9): [True: 0, False: 3]
  ------------------
  671|      0|        _asn_size_err(errpre, intsize, sizeof(long));
  672|      0|        return NULL;
  673|      0|    }
  674|       |
  675|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
  676|      3|    if (*datalength < 2) {
  ------------------
  |  Branch (676:9): [True: 0, False: 3]
  ------------------
  677|      0|        _asn_short_err(errpre, *datalength, 2);
  678|      0|        return NULL;
  679|      0|    }
  680|       |
  681|      3|    *type = *bufp++;
  682|      3|    if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   89|      6|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|      3|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   90|      6|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|      3|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   92|      6|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|      3|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (682:9): [True: 3, False: 0]
  |  Branch (682:33): [True: 3, False: 0]
  |  Branch (682:55): [True: 0, False: 3]
  ------------------
  683|      0|            && *type != ASN_UINTEGER) {
  ------------------
  |  |  100|      0|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (683:16): [True: 0, False: 0]
  ------------------
  684|      0|        _asn_type_err(errpre, *type);
  685|      0|        return NULL;
  686|      0|    }
  687|       |
  688|      3|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  689|      3|    if (NULL == bufp) {
  ------------------
  |  Branch (689:9): [True: 1, False: 2]
  ------------------
  690|      1|        _asn_short_err(errpre, *datalength - 1, asn_length);
  691|      1|        return NULL;
  692|      1|    }
  693|       |
  694|      2|    if ((asn_length > (intsize + 1)) || ((int) asn_length == 0) ||
  ------------------
  |  Branch (694:9): [True: 0, False: 2]
  |  Branch (694:41): [True: 0, False: 2]
  ------------------
  695|      2|        ((asn_length == intsize + 1) && *bufp != 0x00)) {
  ------------------
  |  Branch (695:10): [True: 2, False: 0]
  |  Branch (695:41): [True: 0, False: 2]
  ------------------
  696|      0|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  697|      0|        return NULL;
  698|      0|    }
  699|      2|    *datalength -= (int) asn_length + (bufp - data);
  700|       |
  701|      2|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|      2|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 2]
  |  |  ------------------
  ------------------
  702|       |
  703|     20|    while (asn_length--)
  ------------------
  |  Branch (703:12): [True: 18, False: 2]
  ------------------
  704|     18|        value = (value << 8) | *bufp++;
  705|       |
  706|      2|    CHECK_OVERFLOW_U(value,2);
  ------------------
  |  |  224|      2|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|      2|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 2, False: 0]
  |  |  ------------------
  |  |  226|      2|            x &= 0xffffffff;                                            \
  |  |  227|      2|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   61|      2|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|      2|        }                                                               \
  |  |  229|      2|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 2]
  |  |  ------------------
  ------------------
  707|       |
  708|      2|    DEBUGMSG(("dumpv_recv", "  UInteger:\t%ld (0x%.2lX)\n", value, value));
  ------------------
  |  |   61|      2|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 2]
  |  |  ------------------
  ------------------
  709|       |
  710|      2|    *intp = value;
  711|      2|    return bufp;
  712|      2|}
asn_parse_string:
  916|     47|{
  917|     47|    static const char *errpre = "parse string";
  918|     47|    u_char         *bufp = data;
  919|     47|    u_long          asn_length;
  920|       |
  921|     47|    if (NULL == data || NULL == datalength || NULL == type || NULL == str ||
  ------------------
  |  Branch (921:9): [True: 0, False: 47]
  |  Branch (921:25): [True: 0, False: 47]
  |  Branch (921:47): [True: 0, False: 47]
  |  Branch (921:63): [True: 0, False: 47]
  ------------------
  922|     47|        NULL == strlength) {
  ------------------
  |  Branch (922:9): [True: 0, False: 47]
  ------------------
  923|      0|        ERROR_MSG("parse string: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  924|      0|        return NULL;
  925|      0|    }
  926|       |
  927|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
  928|     47|    if (*datalength < 2) {
  ------------------
  |  Branch (928:9): [True: 1, False: 46]
  ------------------
  929|      1|        _asn_short_err(errpre, *datalength, 2);
  930|      1|        return NULL;
  931|      1|    }
  932|       |
  933|     46|    *type = *bufp++;
  934|     46|    if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   78|     92|#define ASN_OCTET_STR	    0x04U
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   88|     52|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|      6|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   93|     52|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|      6|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (934:9): [True: 6, False: 40]
  |  Branch (934:35): [True: 6, False: 0]
  |  Branch (934:61): [True: 2, False: 4]
  ------------------
  935|      2|            && *type != ASN_NSAP) {
  ------------------
  |  |   98|      2|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      2|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (935:16): [True: 2, False: 0]
  ------------------
  936|      2|        _asn_type_err(errpre, *type);
  937|      2|        return NULL;
  938|      2|    }
  939|       |
  940|     44|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  941|     44|    if (NULL == bufp) {
  ------------------
  |  Branch (941:9): [True: 4, False: 40]
  ------------------
  942|      4|        _asn_short_err(errpre, *datalength - 1, asn_length);
  943|      4|        return NULL;
  944|      4|    }
  945|       |
  946|     40|    if (asn_length > *strlength) {
  ------------------
  |  Branch (946:9): [True: 0, False: 40]
  ------------------
  947|      0|        _asn_length_err(errpre, (size_t) asn_length, *strlength);
  948|      0|        return NULL;
  949|      0|    }
  950|       |
  951|     40|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|     40|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     40|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 40]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 40]
  |  |  ------------------
  ------------------
  952|       |
  953|     40|    memmove(str, bufp, asn_length);
  954|     40|    if (*strlength > asn_length)
  ------------------
  |  Branch (954:9): [True: 40, False: 0]
  ------------------
  955|     40|        str[asn_length] = 0;
  956|     40|    *strlength = asn_length;
  957|     40|    *datalength -= asn_length + (bufp - data);
  958|       |
  959|     40|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|     40|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|     80|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 40]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  960|      0|        u_char         *buf = (u_char *) malloc(1 + asn_length);
  961|      0|        size_t          l = (buf != NULL) ? (1 + asn_length) : 0, ol = 0;
  ------------------
  |  Branch (961:29): [True: 0, False: 0]
  ------------------
  962|       |
  963|      0|        if (sprint_realloc_asciistring
  ------------------
  |  Branch (963:13): [True: 0, False: 0]
  ------------------
  964|      0|            (&buf, &l, &ol, 1, str, asn_length)) {
  965|      0|            DEBUGMSG(("dumpv_recv", "  String:\t%s\n", buf));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  966|      0|        } else {
  967|      0|            if (buf == NULL) {
  ------------------
  |  Branch (967:17): [True: 0, False: 0]
  ------------------
  968|      0|                DEBUGMSG(("dumpv_recv", "  String:\t[TRUNCATED]\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  969|      0|            } else {
  970|      0|                DEBUGMSG(("dumpv_recv", "  String:\t%s [TRUNCATED]\n",
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  971|      0|                          buf));
  972|      0|            }
  973|      0|        }
  974|      0|        if (buf != NULL) {
  ------------------
  |  Branch (974:13): [True: 0, False: 0]
  ------------------
  975|      0|            free(buf);
  976|      0|        }
  977|      0|    }
  978|       |
  979|     40|    return bufp + asn_length;
  980|     40|}
asn_parse_header:
 1077|    122|{
 1078|    122|    register u_char *bufp;
 1079|    122|    u_long          asn_length = 0;
 1080|    122|    const char      *errpre = "parse header";
 1081|       |
 1082|    122|    if (!data || !datalength || !type) {
  ------------------
  |  Branch (1082:9): [True: 0, False: 122]
  |  Branch (1082:18): [True: 0, False: 122]
  |  Branch (1082:33): [True: 0, False: 122]
  ------------------
 1083|      0|        ERROR_MSG("parse header: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1084|      0|        return NULL;
 1085|      0|    }
 1086|       |
 1087|       |    /** need at least 2 bytes to work with: type, length (which might be 0) */
 1088|    122|    if (*datalength < 2) {
  ------------------
  |  Branch (1088:9): [True: 18, False: 104]
  ------------------
 1089|     18|        _asn_short_err(errpre, *datalength, 2);
 1090|     18|        return NULL;
 1091|     18|    }
 1092|       |
 1093|    104|    bufp = data;
 1094|       |    /*
 1095|       |     * this only works on data types < 30, i.e. no extension octets 
 1096|       |     */
 1097|    104|    if (IS_EXTENSION_ID(*bufp)) {
  ------------------
  |  |  103|    104|#define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    104|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |               #define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    104|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |  |  Branch (103:31): [True: 3, False: 101]
  |  |  ------------------
  ------------------
 1098|      3|        ERROR_MSG("can't process ID >= 30");
  ------------------
  |  |  188|      3|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1099|      3|        return NULL;
 1100|      3|    }
 1101|    101|    *type = *bufp++;
 1102|       |
 1103|    101|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1104|    101|    if (NULL == bufp) {
  ------------------
  |  Branch (1104:9): [True: 18, False: 83]
  ------------------
 1105|     18|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1106|     18|        return NULL;
 1107|     18|    }
 1108|       |
 1109|       |#ifdef DUMP_PRINT_HEADERS
 1110|       |    DEBUGDUMPSETUP("recv", data, (bufp - data));
 1111|       |    DEBUGMSG(("dumpv_recv", "  Header: 0x%.2X, len = %d (0x%X)\n", *data,
 1112|       |              asn_length, asn_length));
 1113|       |#else
 1114|       |    /*
 1115|       |     * DEBUGMSGHEXTLI(("recv",data,(bufp-data)));
 1116|       |     * DEBUGMSG(("dumpH_recv","\n"));
 1117|       |     */
 1118|     83|#endif
 1119|       |
 1120|     83|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1121|       |
 1122|     83|    if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |   93|     76|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|     76|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |  131|      0|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|      0|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
  |  Branch (1122:9): [True: 76, False: 7]
  |  Branch (1122:29): [True: 0, False: 76]
  |  Branch (1122:54): [True: 0, False: 0]
  ------------------
 1123|       |
 1124|       |        /*
 1125|       |         * check if 64-but counter 
 1126|       |         */
 1127|      0|        switch (*(bufp + 1)) {
 1128|      0|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|      0|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|      0|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1128:9): [True: 0, False: 0]
  ------------------
 1129|      0|        case ASN_OPAQUE_U64:
  ------------------
  |  |  192|      0|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|      0|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1129:9): [True: 0, False: 0]
  ------------------
 1130|      0|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|      0|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|      0|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1130:9): [True: 0, False: 0]
  ------------------
 1131|      0|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|      0|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|      0|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1131:9): [True: 0, False: 0]
  ------------------
 1132|      0|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|      0|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|      0|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1132:9): [True: 0, False: 0]
  ------------------
 1133|      0|            *type = *(bufp + 1);
 1134|      0|            break;
 1135|       |
 1136|      0|        default:
  ------------------
  |  Branch (1136:9): [True: 0, False: 0]
  ------------------
 1137|       |            /*
 1138|       |             * just an Opaque 
 1139|       |             */
 1140|      0|            *datalength = (int) asn_length;
 1141|      0|            return bufp;
 1142|      0|        }
 1143|       |        /*
 1144|       |         * value is encoded as special format 
 1145|       |         */
 1146|      0|        *datalength = (int) asn_length;
 1147|      0|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 1148|      0|        if (NULL == bufp) {
  ------------------
  |  Branch (1148:13): [True: 0, False: 0]
  ------------------
 1149|      0|            _asn_short_err("parse opaque header", *datalength - 2, asn_length);
 1150|      0|            return NULL;
 1151|      0|        }
 1152|      0|    }
 1153|     83|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 1154|       |
 1155|     83|    *datalength = (int) asn_length;
 1156|       |
 1157|     83|    return bufp;
 1158|     83|}
asn_parse_sequence:
 1177|    117|{                               /* error message prefix */
 1178|    117|    data = asn_parse_header(data, datalength, type);
 1179|    117|    if (data && (*type != expected_type)) {
  ------------------
  |  Branch (1179:9): [True: 78, False: 39]
  |  Branch (1179:17): [True: 6, False: 72]
  ------------------
 1180|      6|        char            ebuf[128];
 1181|      6|        snprintf(ebuf, sizeof(ebuf),
 1182|      6|                 "%s header type %02X: s/b %02X", estr,
 1183|      6|                (u_char) * type, (u_char) expected_type);
 1184|      6|        ebuf[ sizeof(ebuf)-1 ] = 0;
 1185|      6|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|      6|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1186|      6|        return NULL;
 1187|      6|    }
 1188|    111|    return data;
 1189|    117|}
asn_parse_length:
 1302|     11|{
 1303|     11|    static const char *errpre = "parse length";
 1304|     11|    char            ebuf[128];
 1305|     11|    register u_char lengthbyte;
 1306|       |
 1307|     11|    if (!data || !length) {
  ------------------
  |  Branch (1307:9): [True: 0, False: 11]
  |  Branch (1307:18): [True: 0, False: 11]
  ------------------
 1308|      0|        ERROR_MSG("parse length: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1309|      0|        return NULL;
 1310|      0|    }
 1311|     11|    lengthbyte = *data;
 1312|       |
 1313|     11|    if (lengthbyte & ASN_LONG_LEN) {
  ------------------
  |  |   98|     11|#define ASN_LONG_LEN	    0x80U
  ------------------
  |  Branch (1313:9): [True: 11, False: 0]
  ------------------
 1314|     11|        lengthbyte &= ~ASN_LONG_LEN;    /* turn MSb off */
  ------------------
  |  |   98|     11|#define ASN_LONG_LEN	    0x80U
  ------------------
 1315|     11|        if (lengthbyte == 0) {
  ------------------
  |  Branch (1315:13): [True: 0, False: 11]
  ------------------
 1316|      0|            snprintf(ebuf, sizeof(ebuf),
 1317|      0|                     "%s: indefinite length not supported", errpre);
 1318|      0|            ebuf[ sizeof(ebuf)-1 ] = 0;
 1319|      0|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1320|      0|            return NULL;
 1321|      0|        }
 1322|     11|        if (lengthbyte > sizeof(long)) {
  ------------------
  |  Branch (1322:13): [True: 1, False: 10]
  ------------------
 1323|      1|            snprintf(ebuf, sizeof(ebuf),
 1324|      1|                    "%s: data length %d > %lu not supported", errpre,
 1325|      1|                    lengthbyte, (unsigned long)sizeof(long));
 1326|      1|            ebuf[ sizeof(ebuf)-1 ] = 0;
 1327|      1|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|      1|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1328|      1|            return NULL;
 1329|      1|        }
 1330|     10|        data++;
 1331|     10|        *length = 0;            /* protect against short lengths */
 1332|     58|        while (lengthbyte--) {
  ------------------
  |  Branch (1332:16): [True: 48, False: 10]
  ------------------
 1333|     48|            *length <<= 8;
 1334|     48|            *length |= *data++;
 1335|     48|        }
 1336|     10|        if ((long) *length < 0) {
  ------------------
  |  Branch (1336:13): [True: 0, False: 10]
  ------------------
 1337|      0|            snprintf(ebuf, sizeof(ebuf),
 1338|      0|                     "%s: negative data length %ld\n", errpre,
 1339|      0|                     (long) *length);
 1340|      0|            ebuf[ sizeof(ebuf)-1 ] = 0;
 1341|      0|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1342|      0|            return NULL;
 1343|      0|        }
 1344|     10|        return data;
 1345|     10|    } else {                    /* short asnlength */
 1346|      0|        *length = (long) lengthbyte;
 1347|      0|        return data + 1;
 1348|      0|    }
 1349|     11|}
asn_parse_objid:
 1450|      4|{
 1451|      4|    static const char *errpre = "parse objid";
 1452|       |    /*
 1453|       |     * ASN.1 objid ::= 0x06 asnlength subidentifier {subidentifier}*
 1454|       |     * subidentifier ::= {leadingbyte}* lastbyte
 1455|       |     * leadingbyte ::= 1 7bitvalue
 1456|       |     * lastbyte ::= 0 7bitvalue
 1457|       |     */
 1458|      4|    register u_char *bufp = data;
 1459|      4|    register oid   *oidp = objid + 1;
 1460|      4|    register u_long subidentifier;
 1461|      4|    register long   length;
 1462|      4|    u_long          asn_length;
 1463|      4|    size_t          original_length = *objidlength;
 1464|       |
 1465|      4|    if (NULL == data || NULL == datalength || NULL == type || NULL == objid) {
  ------------------
  |  Branch (1465:9): [True: 0, False: 4]
  |  Branch (1465:25): [True: 0, False: 4]
  |  Branch (1465:47): [True: 0, False: 4]
  |  Branch (1465:63): [True: 0, False: 4]
  ------------------
 1466|      0|        ERROR_MSG("parse objid: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1467|      0|        return NULL;
 1468|      0|    }
 1469|       |
 1470|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
 1471|      4|    if (*datalength < 2) {
  ------------------
  |  Branch (1471:9): [True: 0, False: 4]
  ------------------
 1472|      0|        _asn_short_err(errpre, *datalength, 2);
 1473|      0|        return NULL;
 1474|      0|    }
 1475|       |
 1476|      4|    *type = *bufp++;
 1477|      4|    if (*type != ASN_OBJECT_ID) {
  ------------------
  |  |   81|      4|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (1477:9): [True: 0, False: 4]
  ------------------
 1478|      0|        _asn_type_err(errpre, *type);
 1479|      0|        return NULL;
 1480|      0|    }
 1481|      4|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1482|      4|    if (NULL == bufp) {
  ------------------
  |  Branch (1482:9): [True: 0, False: 4]
  ------------------
 1483|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1484|      0|        return NULL;
 1485|      0|    }
 1486|       |
 1487|      4|    *datalength -= (int) asn_length + (bufp - data);
 1488|       |
 1489|      4|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|      4|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 4]
  |  |  ------------------
  ------------------
 1490|       |
 1491|       |    /*
 1492|       |     * Handle invalid object identifier encodings of the form 06 00 robustly 
 1493|       |     */
 1494|      4|    if (asn_length == 0)
  ------------------
  |  Branch (1494:9): [True: 0, False: 4]
  ------------------
 1495|      0|        objid[0] = objid[1] = 0;
 1496|       |
 1497|      4|    length = asn_length;
 1498|      4|    (*objidlength)--;           /* account for expansion of first byte */
 1499|       |
 1500|     28|    while (length > 0 && (*objidlength)-- > 0) {
  ------------------
  |  Branch (1500:12): [True: 24, False: 4]
  |  Branch (1500:26): [True: 24, False: 0]
  ------------------
 1501|     24|        subidentifier = 0;
 1502|     28|        do {                    /* shift and add in low order 7 bits */
 1503|     28|            subidentifier =
 1504|     28|                (subidentifier << 7) + (*(u_char *) bufp & ~ASN_BIT8);
  ------------------
  |  |  100|     28|#define ASN_BIT8	    0x80U
  ------------------
 1505|     28|            length--;
 1506|     28|        } while ((*(u_char *) bufp++ & ASN_BIT8) && (length > 0));        /* last byte has high bit clear */
  ------------------
  |  |  100|     28|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1506:18): [True: 4, False: 24]
  |  Branch (1506:53): [True: 4, False: 0]
  ------------------
 1507|       |
 1508|     24|	if (length == 0) {
  ------------------
  |  Branch (1508:6): [True: 4, False: 20]
  ------------------
 1509|      4|            u_char *last_byte = bufp - 1;
 1510|      4|            if (*last_byte & ASN_BIT8) {
  ------------------
  |  |  100|      4|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1510:17): [True: 0, False: 4]
  ------------------
 1511|       |                /* last byte has high bit set -> wrong BER encoded OID */
 1512|      0|                ERROR_MSG("subidentifier syntax error");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1513|      0|                return NULL;
 1514|      0|            }
 1515|      4|        }
 1516|     24|        if (subidentifier > MAX_SUBID) {
  ------------------
  |  |   18|     24|#define MAX_SUBID   0xFFFFFFFFUL
  ------------------
  |  Branch (1516:13): [True: 0, False: 24]
  ------------------
 1517|      0|            ERROR_MSG("subidentifier too large");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1518|      0|            return NULL;
 1519|      0|        }
 1520|     24|        *oidp++ = (oid) subidentifier;
 1521|     24|    }
 1522|       |
 1523|      4|    if (length || oidp < objid + 1) {
  ------------------
  |  Branch (1523:9): [True: 0, False: 4]
  |  Branch (1523:19): [True: 0, False: 4]
  ------------------
 1524|      0|        ERROR_MSG("OID length exceeds buffer size");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1525|      0|        *objidlength = original_length;
 1526|      0|        return NULL;
 1527|      0|    }
 1528|       |
 1529|       |    /*
 1530|       |     * The first two subidentifiers are encoded into the first component
 1531|       |     * with the value (X * 40) + Y, where:
 1532|       |     *  X is the value of the first subidentifier.
 1533|       |     *  Y is the value of the second subidentifier.
 1534|       |     */
 1535|      4|    subidentifier = oidp - objid >= 2 ? objid[1] : 0;
  ------------------
  |  Branch (1535:21): [True: 4, False: 0]
  ------------------
 1536|      4|    if (subidentifier == 0x2B) {
  ------------------
  |  Branch (1536:9): [True: 0, False: 4]
  ------------------
 1537|      0|        objid[0] = 1;
 1538|      0|        objid[1] = 3;
 1539|      4|    } else {
 1540|      4|        if (subidentifier < 40) {
  ------------------
  |  Branch (1540:13): [True: 0, False: 4]
  ------------------
 1541|      0|            objid[0] = 0;
 1542|      0|            objid[1] = subidentifier;
 1543|      4|        } else if (subidentifier < 80) {
  ------------------
  |  Branch (1543:20): [True: 0, False: 4]
  ------------------
 1544|      0|            objid[0] = 1;
 1545|      0|            objid[1] = subidentifier - 40;
 1546|      4|        } else {
 1547|      4|            objid[0] = 2;
 1548|      4|            objid[1] = subidentifier - 80;
 1549|      4|        }
 1550|      4|    }
 1551|       |
 1552|      4|    *objidlength = (int) (oidp - objid);
 1553|       |
 1554|      4|    DEBUGMSG(("dumpv_recv", "  ObjID: "));
  ------------------
  |  |   61|      4|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 4]
  |  |  ------------------
  ------------------
 1555|      4|    DEBUGMSGOID(("dumpv_recv", objid, *objidlength));
  ------------------
  |  |   67|      4|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 4]
  |  |  ------------------
  ------------------
 1556|      4|    DEBUGMSG(("dumpv_recv", "\n"));
  ------------------
  |  |   61|      4|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 4]
  |  |  ------------------
  ------------------
 1557|      4|    return bufp;
 1558|      4|}
asn_realloc_rbuild_length:
 2865|     78|{
 2866|     78|    static const char *errpre = "build length";
 2867|     78|    char            ebuf[128];
 2868|     78|    int             tmp_int;
 2869|     78|    size_t          start_offset = *offset;
 2870|       |
 2871|     78|    if (length <= 0x7f) {
  ------------------
  |  Branch (2871:9): [True: 78, False: 0]
  ------------------
 2872|     78|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (2872:13): [True: 0, False: 78]
  ------------------
 2873|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2873:18): [True: 0, False: 0]
  |  Branch (2873:23): [True: 0, False: 0]
  ------------------
 2874|      0|            snprintf(ebuf, sizeof(ebuf),
 2875|      0|                    "%s: bad length < 1 :%ld, %lu", errpre,
 2876|      0|                    (long)(*pkt_len - *offset), (unsigned long)length);
 2877|      0|            ebuf[ sizeof(ebuf)-1 ] = 0;
 2878|      0|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2879|      0|            return 0;
 2880|      0|        }
 2881|     78|        *(*pkt + *pkt_len - (++*offset)) = length;
 2882|     78|    } else {
 2883|      0|        while (length > 0xff) {
  ------------------
  |  Branch (2883:16): [True: 0, False: 0]
  ------------------
 2884|      0|            if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (2884:17): [True: 0, False: 0]
  ------------------
 2885|      0|                && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2885:22): [True: 0, False: 0]
  |  Branch (2885:27): [True: 0, False: 0]
  ------------------
 2886|      0|                snprintf(ebuf, sizeof(ebuf),
 2887|      0|                        "%s: bad length < 1 :%ld, %lu", errpre,
 2888|      0|                        (long)(*pkt_len - *offset), (unsigned long)length);
 2889|      0|                ebuf[ sizeof(ebuf)-1 ] = 0;
 2890|      0|                ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2891|      0|                return 0;
 2892|      0|            }
 2893|      0|            *(*pkt + *pkt_len - (++*offset)) = length & 0xff;
 2894|      0|            length >>= 8;
 2895|      0|        }
 2896|       |
 2897|      0|        while ((*pkt_len - *offset) < 2) {
  ------------------
  |  Branch (2897:16): [True: 0, False: 0]
  ------------------
 2898|      0|            if (!(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2898:19): [True: 0, False: 0]
  |  Branch (2898:24): [True: 0, False: 0]
  ------------------
 2899|      0|                snprintf(ebuf, sizeof(ebuf),
 2900|      0|                        "%s: bad length < 1 :%ld, %lu", errpre,
 2901|      0|                        (long)(*pkt_len - *offset), (unsigned long)length);
 2902|      0|                ebuf[ sizeof(ebuf)-1 ] = 0;
 2903|      0|                ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2904|      0|                return 0;
 2905|      0|            }
 2906|      0|        }
 2907|       |
 2908|      0|        *(*pkt + *pkt_len - (++*offset)) = length & 0xff;
 2909|      0|        tmp_int = *offset - start_offset;
 2910|      0|        *(*pkt + *pkt_len - (++*offset)) = tmp_int | 0x80;
 2911|      0|    }
 2912|       |
 2913|     78|    return 1;
 2914|     78|}
asn_realloc_rbuild_header:
 2937|     78|{
 2938|     78|    char            ebuf[128];
 2939|       |
 2940|     78|    if (asn_realloc_rbuild_length(pkt, pkt_len, offset, r, length)) {
  ------------------
  |  Branch (2940:9): [True: 78, False: 0]
  ------------------
 2941|     78|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (2941:13): [True: 0, False: 78]
  ------------------
 2942|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2942:18): [True: 0, False: 0]
  |  Branch (2942:23): [True: 0, False: 0]
  ------------------
 2943|      0|            snprintf(ebuf, sizeof(ebuf),
 2944|      0|                    "bad header length < 1 :%ld, %lu",
 2945|      0|                    (long)(*pkt_len - *offset), (unsigned long)length);
 2946|      0|            ebuf[ sizeof(ebuf)-1 ] = 0;
 2947|      0|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2948|      0|            return 0;
 2949|      0|        }
 2950|     78|        *(*pkt + *pkt_len - (++*offset)) = type;
 2951|     78|        return 1;
 2952|     78|    }
 2953|      0|    return 0;
 2954|     78|}
asn_realloc_rbuild_int:
 2977|     27|{
 2978|     27|    static const char *errpre = "build int";
 2979|     27|    register long   integer = *intp;
 2980|     27|    int             testvalue;
 2981|     27|    size_t          start_offset = *offset;
 2982|       |
 2983|     27|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (2983:9): [True: 0, False: 27]
  ------------------
 2984|      0|        _asn_size_err(errpre, intsize, sizeof(long));
 2985|      0|        return 0;
 2986|      0|    }
 2987|       |
 2988|     27|    CHECK_OVERFLOW_S(integer,10);
  ------------------
  |  |  214|     27|#define CHECK_OVERFLOW_S(x,y) do {                                      \
  |  |  215|     27|        if (x > INT32_MAX) {                                            \
  |  |  ------------------
  |  |  |  Branch (215:13): [True: 0, False: 27]
  |  |  ------------------
  |  |  216|      0|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  217|      0|            x &= 0xffffffff;                                            \
  |  |  218|     27|        } else if (x < INT32_MIN) {                                     \
  |  |  ------------------
  |  |  |  Branch (218:20): [True: 0, False: 27]
  |  |  ------------------
  |  |  219|      0|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  220|      0|            x = 0 - (x & 0xffffffff);                                   \
  |  |  221|      0|        }                                                               \
  |  |  222|     27|    } while(0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded, False: 27]
  |  |  ------------------
  ------------------
 2989|     27|    testvalue = (integer < 0) ? -1 : 0;
  ------------------
  |  Branch (2989:17): [True: 0, False: 27]
  ------------------
 2990|       |
 2991|     27|    if (((*pkt_len - *offset) < 1) && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2991:9): [True: 0, False: 27]
  |  Branch (2991:41): [True: 0, False: 0]
  |  Branch (2991:46): [True: 0, False: 0]
  ------------------
 2992|      0|        return 0;
 2993|      0|    }
 2994|     27|    *(*pkt + *pkt_len - (++*offset)) = (u_char) integer;
 2995|     27|    integer >>= 8;
 2996|       |
 2997|     36|    while (integer != testvalue) {
  ------------------
  |  Branch (2997:12): [True: 9, False: 27]
  ------------------
 2998|      9|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (2998:13): [True: 0, False: 9]
  ------------------
 2999|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2999:18): [True: 0, False: 0]
  |  Branch (2999:23): [True: 0, False: 0]
  ------------------
 3000|      0|            return 0;
 3001|      0|        }
 3002|      9|        *(*pkt + *pkt_len - (++*offset)) = (u_char) integer;
 3003|      9|        integer >>= 8;
 3004|      9|    }
 3005|       |
 3006|     27|    if ((*(*pkt + *pkt_len - *offset) & 0x80) != (testvalue & 0x80)) {
  ------------------
  |  Branch (3006:9): [True: 3, False: 24]
  ------------------
 3007|       |        /*
 3008|       |         * Make sure left most bit is representational of the rest of the bits
 3009|       |         * that aren't encoded.  
 3010|       |         */
 3011|      3|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (3011:13): [True: 0, False: 3]
  ------------------
 3012|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (3012:18): [True: 0, False: 0]
  |  Branch (3012:23): [True: 0, False: 0]
  ------------------
 3013|      0|            return 0;
 3014|      0|        }
 3015|      3|        *(*pkt + *pkt_len - (++*offset)) = testvalue & 0xff;
 3016|      3|    }
 3017|       |
 3018|     27|    if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r, type,
  ------------------
  |  Branch (3018:9): [True: 27, False: 0]
  ------------------
 3019|     27|                                  (*offset - start_offset))) {
 3020|     27|        if (_asn_realloc_build_header_check(errpre, pkt, pkt_len,
  ------------------
  |  Branch (3020:13): [True: 0, False: 27]
  ------------------
 3021|     27|                                            (*offset - start_offset))) {
 3022|      0|            return 0;
 3023|     27|        } else {
 3024|     27|            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset),
  ------------------
  |  |   83|     27|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     27|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 27]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 27]
  |  |  ------------------
  ------------------
 3025|     27|                           (*offset - start_offset));
 3026|     27|            DEBUGMSG(("dumpv_send", "  Integer:\t%ld (0x%.2lX)\n", *intp,
  ------------------
  |  |   61|     27|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     27|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 27]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 27]
  |  |  ------------------
  ------------------
 3027|     27|                      *intp));
 3028|     27|            return 1;
 3029|     27|        }
 3030|     27|    }
 3031|       |
 3032|      0|    return 0;
 3033|     27|}
asn_realloc_rbuild_string:
 3058|     21|{
 3059|     21|    static const char *errpre = "build string";
 3060|     21|    size_t          start_offset = *offset;
 3061|       |
 3062|     21|    while ((*pkt_len - *offset) < strlength) {
  ------------------
  |  Branch (3062:12): [True: 0, False: 21]
  ------------------
 3063|      0|        if (!(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (3063:15): [True: 0, False: 0]
  |  Branch (3063:20): [True: 0, False: 0]
  ------------------
 3064|      0|            return 0;
 3065|      0|        }
 3066|      0|    }
 3067|       |
 3068|     21|    *offset += strlength;
 3069|     21|    if (str)
  ------------------
  |  Branch (3069:9): [True: 21, False: 0]
  ------------------
 3070|     21|        memcpy(*pkt + *pkt_len - *offset, str, strlength);
 3071|       |
 3072|     21|    if (asn_realloc_rbuild_header
  ------------------
  |  Branch (3072:9): [True: 21, False: 0]
  ------------------
 3073|     21|        (pkt, pkt_len, offset, r, type, strlength)) {
 3074|     21|        if (_asn_realloc_build_header_check
  ------------------
  |  Branch (3074:13): [True: 0, False: 21]
  ------------------
 3075|     21|            (errpre, pkt, pkt_len, strlength)) {
 3076|      0|            return 0;
 3077|     21|        } else {
 3078|     21|            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset),
  ------------------
  |  |   83|     21|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     21|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 21]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 21]
  |  |  ------------------
  ------------------
 3079|     21|                           *offset - start_offset);
 3080|     21|            DEBUGIF("dumpv_send") {
  ------------------
  |  |  145|     21|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|     42|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 21]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3081|      0|                if (strlength == 0) {
  ------------------
  |  Branch (3081:21): [True: 0, False: 0]
  ------------------
 3082|      0|                    DEBUGMSG(("dumpv_send", "  String: [NULL]\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3083|      0|                } else {
 3084|      0|                    u_char         *buf = (u_char *) malloc(2 * strlength);
 3085|      0|                    size_t          l =
 3086|      0|                        (buf != NULL) ? (2 * strlength) : 0, ol = 0;
  ------------------
  |  Branch (3086:25): [True: 0, False: 0]
  ------------------
 3087|       |
 3088|      0|                    if (sprint_realloc_asciistring
  ------------------
  |  Branch (3088:25): [True: 0, False: 0]
  ------------------
 3089|      0|                        (&buf, &l, &ol, 1, str, strlength)) {
 3090|      0|                        DEBUGMSG(("dumpv_send", "  String:\t%s\n", buf));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3091|      0|                    } else {
 3092|      0|                        if (buf == NULL) {
  ------------------
  |  Branch (3092:29): [True: 0, False: 0]
  ------------------
 3093|      0|                            DEBUGMSG(("dumpv_send",
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3094|      0|                                      "  String:\t[TRUNCATED]\n"));
 3095|      0|                        } else {
 3096|      0|                            DEBUGMSG(("dumpv_send",
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3097|      0|                                      "  String:\t%s [TRUNCATED]\n", buf));
 3098|      0|                        }
 3099|      0|                    }
 3100|      0|                    if (buf != NULL) {
  ------------------
  |  Branch (3100:25): [True: 0, False: 0]
  ------------------
 3101|      0|                        free(buf);
 3102|      0|                    }
 3103|      0|                }
 3104|      0|            }
 3105|     21|        }
 3106|     21|        return 1;
 3107|     21|    }
 3108|       |
 3109|      0|    return 0;
 3110|     21|}
asn_realloc_rbuild_unsigned_int:
 3133|      3|{
 3134|      3|    static const char *errpre = "build uint";
 3135|      3|    register u_long integer = *intp;
 3136|      3|    size_t          start_offset = *offset;
 3137|       |
 3138|      3|    if (intsize != sizeof(unsigned long)) {
  ------------------
  |  Branch (3138:9): [True: 0, False: 3]
  ------------------
 3139|      0|        _asn_size_err(errpre, intsize, sizeof(unsigned long));
 3140|      0|        return 0;
 3141|      0|    }
 3142|       |
 3143|      3|    CHECK_OVERFLOW_U(integer,11);
  ------------------
  |  |  224|      3|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|      3|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 3]
  |  |  ------------------
  |  |  226|      0|            x &= 0xffffffff;                                            \
  |  |  227|      0|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|      0|        }                                                               \
  |  |  229|      3|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3144|       |
 3145|      3|    if (((*pkt_len - *offset) < 1) && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (3145:9): [True: 0, False: 3]
  |  Branch (3145:41): [True: 0, False: 0]
  |  Branch (3145:46): [True: 0, False: 0]
  ------------------
 3146|      0|        return 0;
 3147|      0|    }
 3148|      3|    *(*pkt + *pkt_len - (++*offset)) = (u_char) integer;
 3149|      3|    integer >>= 8;
 3150|       |
 3151|      3|    while (integer != 0) {
  ------------------
  |  Branch (3151:12): [True: 0, False: 3]
  ------------------
 3152|      0|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (3152:13): [True: 0, False: 0]
  ------------------
 3153|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (3153:18): [True: 0, False: 0]
  |  Branch (3153:23): [True: 0, False: 0]
  ------------------
 3154|      0|            return 0;
 3155|      0|        }
 3156|      0|        *(*pkt + *pkt_len - (++*offset)) = (u_char) integer;
 3157|      0|        integer >>= 8;
 3158|      0|    }
 3159|       |
 3160|      3|    if ((*(*pkt + *pkt_len - *offset) & 0x80) != (0 & 0x80)) {
  ------------------
  |  Branch (3160:9): [True: 0, False: 3]
  ------------------
 3161|       |        /*
 3162|       |         * Make sure left most bit is representational of the rest of the bits
 3163|       |         * that aren't encoded.  
 3164|       |         */
 3165|      0|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (3165:13): [True: 0, False: 0]
  ------------------
 3166|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (3166:18): [True: 0, False: 0]
  |  Branch (3166:23): [True: 0, False: 0]
  ------------------
 3167|      0|            return 0;
 3168|      0|        }
 3169|      0|        *(*pkt + *pkt_len - (++*offset)) = 0;
 3170|      0|    }
 3171|       |
 3172|      3|    if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r, type,
  ------------------
  |  Branch (3172:9): [True: 3, False: 0]
  ------------------
 3173|      3|                                  (*offset - start_offset))) {
 3174|      3|        if (_asn_realloc_build_header_check(errpre, pkt, pkt_len,
  ------------------
  |  Branch (3174:13): [True: 0, False: 3]
  ------------------
 3175|      3|                                            (*offset - start_offset))) {
 3176|      0|            return 0;
 3177|      3|        } else {
 3178|      3|            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset),
  ------------------
  |  |   83|      3|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3179|      3|                           (*offset - start_offset));
 3180|      3|            DEBUGMSG(("dumpv_send", "  UInteger:\t%lu (0x%.2lX)\n", *intp,
  ------------------
  |  |   61|      3|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3181|      3|                      *intp));
 3182|      3|            return 1;
 3183|      3|        }
 3184|      3|    }
 3185|       |
 3186|      0|    return 0;
 3187|      3|}
asn_realloc_rbuild_sequence:
 3210|     21|{
 3211|     21|    return asn_realloc_rbuild_header(pkt, pkt_len, offset, r, type,
 3212|     21|                                     length);
 3213|     21|}
asn_realloc_rbuild_objid:
 3284|      3|{
 3285|       |    /*
 3286|       |     * ASN.1 objid ::= 0x06 asnlength subidentifier {subidentifier}*
 3287|       |     * subidentifier ::= {leadingbyte}* lastbyte
 3288|       |     * leadingbyte ::= 1 7bitvalue
 3289|       |     * lastbyte ::= 0 7bitvalue
 3290|       |     */
 3291|      3|    register size_t i;
 3292|      3|    register oid    tmpint;
 3293|      3|    size_t          start_offset = *offset;
 3294|      3|    const char     *errpre = "build objid";
 3295|       |
 3296|       |    /*
 3297|       |     * Check if there are at least 2 sub-identifiers.  
 3298|       |     */
 3299|      3|    if (objidlength == 0) {
  ------------------
  |  Branch (3299:9): [True: 0, False: 3]
  ------------------
 3300|       |        /*
 3301|       |         * There are not, so make the OID have two sub-identifiers with value
 3302|       |         * zero. Encode both sub-identifiers as a single byte.
 3303|       |         */
 3304|      0|        if (!store_byte(pkt, pkt_len, offset, r, 0))
  ------------------
  |  Branch (3304:13): [True: 0, False: 0]
  ------------------
 3305|      0|            return 0;
 3306|      3|    } else if (objid[0] > 2) {
  ------------------
  |  Branch (3306:16): [True: 0, False: 3]
  ------------------
 3307|      0|        ERROR_MSG("build objid: bad first subidentifier");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3308|      0|        return 0;
 3309|      3|    } else if (objidlength == 1) {
  ------------------
  |  Branch (3309:16): [True: 0, False: 3]
  ------------------
 3310|       |        /*
 3311|       |         * Encode the first value.  
 3312|       |         */
 3313|      0|        if (!store_byte(pkt, pkt_len, offset, r, 40 * objid[0]))
  ------------------
  |  Branch (3313:13): [True: 0, False: 0]
  ------------------
 3314|      0|            return 0;
 3315|      3|    } else {
 3316|     30|        for (i = objidlength - 1; i >= 2; i--) {
  ------------------
  |  Branch (3316:35): [True: 27, False: 3]
  ------------------
 3317|     27|            tmpint = objid[i];
 3318|     27|            CHECK_OVERFLOW_U(tmpint, 12);
  ------------------
  |  |  224|     27|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|     27|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 27]
  |  |  ------------------
  |  |  226|      0|            x &= 0xffffffff;                                            \
  |  |  227|      0|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|      0|        }                                                               \
  |  |  229|     27|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 27]
  |  |  ------------------
  ------------------
 3319|     27|            if (!store_uint32(pkt, pkt_len, offset, r, tmpint))
  ------------------
  |  Branch (3319:17): [True: 0, False: 27]
  ------------------
 3320|      0|                return 0;
 3321|     27|        }
 3322|       |
 3323|       |        /*
 3324|       |         * Combine the first two values.  
 3325|       |         */
 3326|      3|        if ((objid[1] >= 40 && objid[0] < 2) ||
  ------------------
  |  Branch (3326:14): [True: 0, False: 3]
  |  Branch (3326:32): [True: 0, False: 0]
  ------------------
 3327|      3|            objid[1] > UINT32_MAX - objid[0] * 40) {
  ------------------
  |  Branch (3327:13): [True: 0, False: 3]
  ------------------
 3328|      0|            return 0;
 3329|      0|        }
 3330|      3|        if (!store_uint32(pkt, pkt_len, offset, r, objid[0] * 40 + objid[1]))
  ------------------
  |  Branch (3330:13): [True: 0, False: 3]
  ------------------
 3331|      0|            return 0;
 3332|      3|    }
 3333|       |
 3334|      3|    tmpint = *offset - start_offset;
 3335|      3|    if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r, type, tmpint)) {
  ------------------
  |  Branch (3335:9): [True: 3, False: 0]
  ------------------
 3336|      3|        if (_asn_realloc_build_header_check(errpre, pkt, pkt_len, tmpint)) {
  ------------------
  |  Branch (3336:13): [True: 0, False: 3]
  ------------------
 3337|      0|            return 0;
 3338|      3|        } else {
 3339|      3|            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset), tmpint);
  ------------------
  |  |   83|      3|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3340|      3|            DEBUGMSG(("dumpv_send", "  ObjID: "));
  ------------------
  |  |   61|      3|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3341|      3|            DEBUGMSGOID(("dumpv_send", objid, objidlength));
  ------------------
  |  |   67|      3|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3342|      3|            DEBUGMSG(("dumpv_send", "\n"));
  ------------------
  |  |   61|      3|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3343|      3|            return 1;
 3344|      3|        }
 3345|      3|    }
 3346|       |
 3347|      0|    return 0;
 3348|      3|}
asn1.c:_asn_short_err:
  301|     47|{
  302|     47|    char            ebuf[128];
  303|       |
  304|     47|    snprintf(ebuf, sizeof(ebuf), "%s length %lu too short: need %lu", str,
  305|     47|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  306|     47|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|     47|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  307|     47|}
asn1.c:_asn_type_err:
  262|      4|{
  263|      4|    char            ebuf[128];
  264|       |
  265|      4|    snprintf(ebuf, sizeof(ebuf), "%s type %d", str, wrongtype);
  266|      4|    ebuf[ sizeof(ebuf)-1 ] = 0;
  267|      4|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|      4|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  268|      4|}
asn1.c:_asn_realloc_build_header_check:
  457|     54|{
  458|     54|    char            ebuf[128];
  459|       |
  460|     54|    if (pkt == NULL || *pkt == NULL) {
  ------------------
  |  Branch (460:9): [True: 0, False: 54]
  |  Branch (460:24): [True: 0, False: 54]
  ------------------
  461|       |        /*
  462|       |         * Error message is set.  
  463|       |         */
  464|      0|        return 1;
  465|      0|    }
  466|       |
  467|     54|    if (*pkt_len < typedlen) {
  ------------------
  |  Branch (467:9): [True: 0, False: 54]
  ------------------
  468|      0|        snprintf(ebuf, sizeof(ebuf),
  469|      0|                "%s: bad header, length too short: %lu < %lu", str,
  470|      0|                (unsigned long)*pkt_len, (unsigned long)typedlen);
  471|      0|        ebuf[ sizeof(ebuf)-1 ] = 0;
  472|      0|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  473|      0|        return 1;
  474|      0|    }
  475|     54|    return 0;
  476|     54|}
asn1.c:store_byte:
 3228|     30|{
 3229|     30|    netsnmp_assert(*offset <= *pkt_len);
  ------------------
  |  |   47|     30|#      define netsnmp_assert(x)  do { \
  |  |   48|     30|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 30, False: 0]
  |  |  ------------------
  |  |   49|     30|                 ; \
  |  |   50|     30|              else \
  |  |   51|     30|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     30|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 30]
  |  |  ------------------
  ------------------
 3230|     30|    if (*offset >= *pkt_len && (!r || !asn_realloc(pkt, pkt_len)))
  ------------------
  |  Branch (3230:9): [True: 0, False: 30]
  |  Branch (3230:33): [True: 0, False: 0]
  |  Branch (3230:39): [True: 0, False: 0]
  ------------------
 3231|      0|        return 0;
 3232|     30|    netsnmp_assert(*offset < *pkt_len);
  ------------------
  |  |   47|     30|#      define netsnmp_assert(x)  do { \
  |  |   48|     30|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 30, False: 0]
  |  |  ------------------
  |  |   49|     30|                 ; \
  |  |   50|     30|              else \
  |  |   51|     30|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     30|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 30]
  |  |  ------------------
  ------------------
 3233|     30|    *(*pkt + *pkt_len - (++*offset)) = byte;
 3234|     30|    return 1;
 3235|     30|}
asn1.c:store_uint32:
 3250|     30|{
 3251|     30|    if (!store_byte(pkt, pkt_len, offset, r, subid & 0x7f))
  ------------------
  |  Branch (3251:9): [True: 0, False: 30]
  ------------------
 3252|      0|        return 0;
 3253|       |
 3254|     30|    for (subid >>= 7; subid; subid >>= 7)
  ------------------
  |  Branch (3254:23): [True: 0, False: 30]
  ------------------
 3255|      0|        if (!store_byte(pkt, pkt_len, offset, r, subid | 0x80))
  ------------------
  |  Branch (3255:13): [True: 0, False: 0]
  ------------------
 3256|      0|            return 0;
 3257|       |
 3258|     30|    return 1;
 3259|     30|}

init_callbacks:
  180|     67|{
  181|       |    /*
  182|       |     * (poses a problem if you put init_callbacks() inside of
  183|       |     * init_snmp() and then want the app to register a callback before
  184|       |     * init_snmp() is called in the first place.  -- Wes 
  185|       |     */
  186|     67|    if (0 == _callback_need_init)
  ------------------
  |  Branch (186:9): [True: 66, False: 1]
  ------------------
  187|     66|        return;
  188|       |    
  189|      1|    _callback_need_init = 0;
  190|       |    
  191|      1|    memset(thecallbacks, 0, sizeof(thecallbacks)); 
  192|      1|#ifdef LOCK_PER_CALLBACK_SUBID
  193|      1|    memset(_locks, 0, sizeof(_locks));
  194|       |#else
  195|       |    _lock = 0;
  196|       |#endif
  197|       |    
  198|      1|    DEBUGMSGTL(("callback", "initialized\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]
  |  |  ------------------
  ------------------
  199|      1|}
snmp_register_callback:
  240|    726|{
  241|    726|    return netsnmp_register_callback( major, minor, new_callback, arg,
  242|    726|                                      NETSNMP_CALLBACK_DEFAULT_PRIORITY);
  ------------------
  |  |   40|    726|#define NETSNMP_CALLBACK_DEFAULT_PRIORITY       0
  ------------------
  243|    726|}
netsnmp_register_callback:
  262|    726|{
  263|    726|    struct snmp_gen_callback *newscp = NULL, *scp = NULL;
  264|       |
  265|    726|    if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
  ------------------
  |  |   12|  1.45k|#define MAX_CALLBACK_IDS    2
  ------------------
                  if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
  ------------------
  |  |   13|    726|#define MAX_CALLBACK_SUBIDS 18
  ------------------
  |  Branch (265:9): [True: 0, False: 726]
  |  Branch (265:38): [True: 0, False: 726]
  ------------------
  266|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  267|      0|    }
  268|       |
  269|    726|    if (_callback_need_init)
  ------------------
  |  Branch (269:9): [True: 1, False: 725]
  ------------------
  270|      1|        init_callbacks();
  271|       |
  272|    726|    _callback_lock(major,minor, "netsnmp_register_callback", 1);
  273|       |    
  274|    726|    if ((newscp = SNMP_MALLOC_STRUCT(snmp_gen_callback)) == NULL) {
  ------------------
  |  |   69|    726|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  |  Branch (274:9): [True: 0, False: 726]
  ------------------
  275|      0|        _callback_unlock(major,minor);
  276|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  277|    726|    } else {
  278|    726|        struct snmp_gen_callback **prevNext = &(thecallbacks[major][minor]);
  279|       |
  280|    726|        newscp->priority = priority;
  281|    726|        newscp->sc_client_arg = arg;
  282|    726|        newscp->sc_callback = new_callback;
  283|    726|        newscp->next = NULL;
  284|       |
  285|  1.32k|        for (scp = thecallbacks[major][minor]; scp != NULL;
  ------------------
  |  Branch (285:48): [True: 594, False: 726]
  ------------------
  286|    726|             scp = scp->next) {
  287|    594|            if (newscp->priority < scp->priority) {
  ------------------
  |  Branch (287:17): [True: 0, False: 594]
  ------------------
  288|      0|                newscp->next = scp;
  289|      0|                break;
  290|      0|            }
  291|    594|            prevNext = &(scp->next);
  292|    594|        }
  293|       |
  294|    726|        *prevNext = newscp;
  295|       |
  296|    726|        DEBUGMSGTL(("callback", "registered (%d,%d) at %p with priority %d\n",
  ------------------
  |  |   66|    726|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    726|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 726]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 726]
  |  |  ------------------
  ------------------
  297|    726|                    major, minor, newscp, priority));
  298|    726|        _callback_unlock(major,minor);
  299|    726|        return SNMPERR_SUCCESS;
  ------------------
  |  |  217|    726|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  300|    726|    }
  301|    726|}
snmp_call_callbacks:
  322|    462|{
  323|    462|    struct snmp_gen_callback *scp;
  324|    462|    unsigned int    count = 0;
  325|       |    
  326|    462|    if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
  ------------------
  |  |   12|    924|#define MAX_CALLBACK_IDS    2
  ------------------
                  if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
  ------------------
  |  |   13|    462|#define MAX_CALLBACK_SUBIDS 18
  ------------------
  |  Branch (326:9): [True: 0, False: 462]
  |  Branch (326:38): [True: 0, False: 462]
  ------------------
  327|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  328|      0|    }
  329|       |    
  330|    462|    if (_callback_need_init)
  ------------------
  |  Branch (330:9): [True: 0, False: 462]
  ------------------
  331|      0|        init_callbacks();
  332|       |
  333|    462|#ifdef LOCK_PER_CALLBACK_SUBID
  334|    462|    _callback_lock(major,minor,"snmp_call_callbacks", 1);
  335|       |#else
  336|       |    /*
  337|       |     * Notes:
  338|       |     * - this gets hit the first time a trap is sent after a new trap
  339|       |     *   destination has been added (session init cb during send trap cb)
  340|       |     */
  341|       |    _callback_lock(major,minor, NULL, 0);
  342|       |#endif
  343|       |
  344|    462|    DEBUGMSGTL(("callback", "START calling callbacks for maj=%d min=%d\n",
  ------------------
  |  |   66|    462|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    462|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 462]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 462]
  |  |  ------------------
  ------------------
  345|    462|                major, minor));
  346|       |
  347|       |    /*
  348|       |     * for each registered callback of type major and minor 
  349|       |     */
  350|  1.18k|    for (scp = thecallbacks[major][minor]; scp != NULL; scp = scp->next) {
  ------------------
  |  Branch (350:44): [True: 726, False: 462]
  ------------------
  351|       |
  352|       |        /*
  353|       |         * skip unregistered callbacks
  354|       |         */
  355|    726|        if(NULL == scp->sc_callback)
  ------------------
  |  Branch (355:12): [True: 0, False: 726]
  ------------------
  356|      0|            continue;
  357|       |
  358|    726|        DEBUGMSGTL(("callback", "calling a callback for maj=%d min=%d\n",
  ------------------
  |  |   66|    726|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    726|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 726]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 726]
  |  |  ------------------
  ------------------
  359|    726|                    major, minor));
  360|       |
  361|       |        /*
  362|       |         * call them 
  363|       |         */
  364|    726|        (*(scp->sc_callback)) (major, minor, caller_arg,
  365|    726|                               scp->sc_client_arg);
  366|    726|        count++;
  367|    726|    }
  368|       |
  369|    462|    DEBUGMSGTL(("callback",
  ------------------
  |  |   66|    462|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    462|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 462]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 462]
  |  |  ------------------
  ------------------
  370|    462|                "END calling callbacks for maj=%d min=%d (%d called)\n",
  371|    462|                major, minor, count));
  372|       |
  373|    462|    _callback_unlock(major,minor);
  374|    462|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|    462|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  375|    462|}
netsnmp_callback_clear_client_arg:
  503|    132|{
  504|    132|    struct snmp_gen_callback *scp = NULL;
  505|    132|    int rc = 0;
  506|       |
  507|       |    /*
  508|       |     * don't init i and j before loop, since the caller specified
  509|       |     * the starting point explicitly. But *after* the i loop has
  510|       |     * finished executing once, init j to 0 for the next pass
  511|       |     * through the subids.
  512|       |     */
  513|    396|    for (; i < MAX_CALLBACK_IDS; i++,j=0) {
  ------------------
  |  |   12|    396|#define MAX_CALLBACK_IDS    2
  ------------------
  |  Branch (513:12): [True: 264, False: 132]
  ------------------
  514|  4.95k|        for (; j < MAX_CALLBACK_SUBIDS; j++) {
  ------------------
  |  |   13|  4.95k|#define MAX_CALLBACK_SUBIDS 18
  ------------------
  |  Branch (514:16): [True: 4.68k, False: 264]
  ------------------
  515|  4.68k|            scp = thecallbacks[i][j]; 
  516|  5.87k|            while (scp != NULL) {
  ------------------
  |  Branch (516:20): [True: 1.18k, False: 4.68k]
  ------------------
  517|  1.18k|                if ((NULL != scp->sc_callback) &&
  ------------------
  |  Branch (517:21): [True: 1.18k, False: 0]
  ------------------
  518|  1.18k|                    (scp->sc_client_arg != NULL) &&
  ------------------
  |  Branch (518:21): [True: 66, False: 1.12k]
  ------------------
  519|     66|                    (scp->sc_client_arg == ptr)) {
  ------------------
  |  Branch (519:21): [True: 0, False: 66]
  ------------------
  520|      0|                    DEBUGMSGTL(("9:callback", "  clearing %p at [%d,%d]\n", ptr, i, j));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  521|      0|                    scp->sc_client_arg = NULL;
  522|      0|                    ++rc;
  523|      0|                }
  524|  1.18k|                scp = scp->next;
  525|  1.18k|            }
  526|  4.68k|        }
  527|    264|    }
  528|       |
  529|    132|    if (0 != rc) {
  ------------------
  |  Branch (529:9): [True: 0, False: 132]
  ------------------
  530|      0|        DEBUGMSGTL(("callback", "removed %d client args\n", rc));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  531|      0|    }
  532|       |
  533|    132|    return rc;
  534|    132|}
clear_callback:
  538|     66|{
  539|     66|    unsigned int i = 0, j = 0;
  540|     66|    struct snmp_gen_callback *scp = NULL;
  541|       |
  542|     66|    if (_callback_need_init)
  ------------------
  |  Branch (542:9): [True: 0, False: 66]
  ------------------
  543|      0|        init_callbacks();
  544|       |
  545|     66|    DEBUGMSGTL(("callback", "clear callback\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  546|    198|    for (i = 0; i < MAX_CALLBACK_IDS; i++) {
  ------------------
  |  |   12|    198|#define MAX_CALLBACK_IDS    2
  ------------------
  |  Branch (546:17): [True: 132, False: 66]
  ------------------
  547|  2.50k|        for (j = 0; j < MAX_CALLBACK_SUBIDS; j++) {
  ------------------
  |  |   13|  2.50k|#define MAX_CALLBACK_SUBIDS 18
  ------------------
  |  Branch (547:21): [True: 2.37k, False: 132]
  ------------------
  548|  2.37k|            _callback_lock(i,j, "clear_callback", 1);
  549|  2.37k|            scp = thecallbacks[i][j];
  550|  3.10k|            while (scp != NULL) {
  ------------------
  |  Branch (550:20): [True: 726, False: 2.37k]
  ------------------
  551|    726|                thecallbacks[i][j] = scp->next;
  552|       |                /*
  553|       |                 * if there is a client arg, check for duplicates
  554|       |                 * and then free it.
  555|       |                 */
  556|    726|                if ((NULL != scp->sc_callback) &&
  ------------------
  |  Branch (556:21): [True: 726, False: 0]
  ------------------
  557|    726|                    (scp->sc_client_arg != NULL)) {
  ------------------
  |  Branch (557:21): [True: 66, False: 660]
  ------------------
  558|     66|                    void *tmp_arg;
  559|       |                    /*
  560|       |                     * save the client arg, then set it to null so that it
  561|       |                     * won't look like a duplicate, then check for duplicates
  562|       |                     * starting at the current i,j (earlier dups should have
  563|       |                     * already been found) and free the pointer.
  564|       |                     */
  565|     66|                    tmp_arg = scp->sc_client_arg;
  566|     66|                    scp->sc_client_arg = NULL;
  567|     66|                    DEBUGMSGTL(("9:callback", "  freeing %p at [%d,%d]\n", tmp_arg, i, j));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  568|     66|                    (void)netsnmp_callback_clear_client_arg(tmp_arg, i, j);
  569|     66|                    free(tmp_arg);
  570|     66|                }
  571|       |                SNMP_FREE(scp);
  ------------------
  |  |   62|    726|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 726, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 726]
  |  |  ------------------
  ------------------
  572|    726|                scp = thecallbacks[i][j];
  573|    726|            }
  574|  2.37k|            _callback_unlock(i,j);
  575|  2.37k|        }
  576|    132|    }
  577|     66|}
callback.c:_callback_lock:
  119|  3.56k|{
  120|  3.56k|    int lock_holded=0;
  121|  3.56k|    NETSNMP_SELECT_TIMEVAL lock_time;
  ------------------
  |  | 1749|  3.56k|#define NETSNMP_SELECT_TIMEVAL struct timeval
  ------------------
  122|       |
  123|       |#ifdef NETSNMP_PARANOID_LEVEL_HIGH
  124|       |    if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
  125|       |        netsnmp_assert("bad callback id");
  126|       |        return 1;
  127|       |    }
  128|       |#endif
  129|       |    
  130|  3.56k|#ifdef CALLBACK_NAME_LOGGING
  131|  3.56k|    DEBUGMSGTL(("9:callback:lock", "locked (%s,%s)\n",
  ------------------
  |  |   66|  3.56k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.56k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.56k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 3.56k]
  |  |  ------------------
  ------------------
  132|  3.56k|                types[major], (SNMP_CALLBACK_LIBRARY == major) ?
  133|  3.56k|                SNMP_STRORNULL(lib[minor]) : "null"));
  134|  3.56k|#endif
  135|  3.56k|    while (CALLBACK_LOCK_COUNT(major,minor) >= 1 && ++lock_holded < 100) {
  ------------------
  |  |  109|  3.56k|#define CALLBACK_LOCK_COUNT(maj,min) _locks[maj][min]
  ------------------
  |  Branch (135:12): [True: 0, False: 3.56k]
  |  Branch (135:53): [True: 0, False: 0]
  ------------------
  136|      0|	lock_time.tv_sec = 0;
  137|      0|	lock_time.tv_usec = 1000;
  138|      0|	select(0, NULL, NULL, NULL, &lock_time);
  139|      0|    }
  140|       |
  141|  3.56k|    if(lock_holded >= 100) {
  ------------------
  |  Branch (141:8): [True: 0, False: 3.56k]
  ------------------
  142|      0|        if (NULL != warn)
  ------------------
  |  Branch (142:13): [True: 0, False: 0]
  ------------------
  143|      0|            snmp_log(LOG_WARNING,
  144|      0|                     "lock in _callback_lock sleeps more than 100 milliseconds in %s\n", warn);
  145|      0|        if (do_assert)
  ------------------
  |  Branch (145:13): [True: 0, False: 0]
  ------------------
  146|      0|            netsnmp_assert(lock_holded < 100);
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  147|       |        
  148|      0|        return 1;
  149|      0|    }
  150|       |
  151|  3.56k|    CALLBACK_LOCK(major,minor);
  ------------------
  |  |  107|  3.56k|#define CALLBACK_LOCK(maj,min) ++_locks[maj][min]
  ------------------
  152|  3.56k|    return 0;
  153|  3.56k|}
callback.c:_callback_unlock:
  157|  3.56k|{
  158|       |#ifdef NETSNMP_PARANOID_LEVEL_HIGH
  159|       |    if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
  160|       |        netsnmp_assert("bad callback id");
  161|       |        return;
  162|       |    }
  163|       |#endif
  164|       |    
  165|  3.56k|    CALLBACK_UNLOCK(major,minor);
  ------------------
  |  |  108|  3.56k|#define CALLBACK_UNLOCK(maj,min) --_locks[maj][min]
  ------------------
  166|       |
  167|  3.56k|#ifdef CALLBACK_NAME_LOGGING
  168|  3.56k|    DEBUGMSGTL(("9:callback:lock", "unlocked (%s,%s)\n",
  ------------------
  |  |   66|  3.56k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.56k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.56k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 3.56k]
  |  |  ------------------
  ------------------
  169|  3.56k|                types[major], (SNMP_CALLBACK_LIBRARY == major) ?
  170|  3.56k|                SNMP_STRORNULL(lib[minor]) : "null"));
  171|  3.56k|#endif
  172|  3.56k|}

_netsnmp_release_trustcerts:
  175|    198|{
  176|    198|    if (NULL != _trusted_certs) {
  ------------------
  |  Branch (176:9): [True: 66, False: 132]
  ------------------
  177|     66|        CONTAINER_FREE_ALL(_trusted_certs, NULL);
  178|     66|        CONTAINER_FREE(_trusted_certs);
  179|       |        _trusted_certs = NULL;
  180|     66|    }
  181|    198|}
_setup_trusted_certs:
  185|     66|{
  186|     66|    _trusted_certs = netsnmp_container_find("trusted_certs:fifo");
  187|     66|    if (NULL == _trusted_certs) {
  ------------------
  |  Branch (187:9): [True: 0, False: 66]
  ------------------
  188|      0|        snmp_log(LOG_ERR, "could not create container for trusted certs\n");
  189|      0|        netsnmp_certs_shutdown();
  190|      0|        return;
  191|      0|    }
  192|     66|    _trusted_certs->container_name = strdup("trusted certificates");
  193|     66|    _trusted_certs->compare = netsnmp_str_compare;
  194|     66|}
netsnmp_certs_init:
  209|     66|{
  210|     66|    const char *trustCert_help = TRUSTCERT_CONFIG_TOKEN
  ------------------
  |  |  140|     66|#define TRUSTCERT_CONFIG_TOKEN "trustCert"
  ------------------
  211|     66|        " FINGERPRINT|FILENAME";
  212|       |
  213|     66|    register_config_handler("snmp", TRUSTCERT_CONFIG_TOKEN,
  ------------------
  |  |  140|     66|#define TRUSTCERT_CONFIG_TOKEN "trustCert"
  ------------------
  214|     66|                            _parse_trustcert, _netsnmp_release_trustcerts,
  215|     66|                            trustCert_help);
  216|     66|    _setup_containers();
  217|       |
  218|       |    /** add certificate type mapping */
  219|     66|    se_add_pair_to_slist("cert_types", strdup("pem"), NS_CERT_TYPE_PEM);
  220|     66|    se_add_pair_to_slist("cert_types", strdup("crt"), NS_CERT_TYPE_DER);
  221|     66|    se_add_pair_to_slist("cert_types", strdup("cer"), NS_CERT_TYPE_DER);
  222|     66|    se_add_pair_to_slist("cert_types", strdup("cert"), NS_CERT_TYPE_DER);
  223|     66|    se_add_pair_to_slist("cert_types", strdup("der"), NS_CERT_TYPE_DER);
  224|     66|    se_add_pair_to_slist("cert_types", strdup("key"), NS_CERT_TYPE_KEY);
  225|     66|    se_add_pair_to_slist("cert_types", strdup("private"), NS_CERT_TYPE_KEY);
  226|       |
  227|       |    /** hash algs */
  228|     66|    se_add_pair_to_slist("cert_hash_alg", strdup("sha1"), NS_HASH_SHA1);
  ------------------
  |  |   82|     66|#define NS_HASH_SHA1        2
  ------------------
  229|     66|    se_add_pair_to_slist("cert_hash_alg", strdup("md5"), NS_HASH_MD5);
  ------------------
  |  |   81|     66|#define NS_HASH_MD5         1
  ------------------
  230|     66|    se_add_pair_to_slist("cert_hash_alg", strdup("sha224"), NS_HASH_SHA224);
  ------------------
  |  |   83|     66|#define NS_HASH_SHA224      3
  ------------------
  231|     66|    se_add_pair_to_slist("cert_hash_alg", strdup("sha256"), NS_HASH_SHA256);
  ------------------
  |  |   84|     66|#define NS_HASH_SHA256      4
  ------------------
  232|     66|    se_add_pair_to_slist("cert_hash_alg", strdup("sha384"), NS_HASH_SHA384);
  ------------------
  |  |   85|     66|#define NS_HASH_SHA384      5
  ------------------
  233|     66|    se_add_pair_to_slist("cert_hash_alg", strdup("sha512"), NS_HASH_SHA512);
  ------------------
  |  |   86|     66|#define NS_HASH_SHA512      6
  ------------------
  234|       |
  235|       |    /** map types */
  236|     66|    se_add_pair_to_slist("cert_map_type", strdup("cn"),
  237|     66|                         TSNM_tlstmCertCommonName);
  ------------------
  |  |  126|     66|#define TSNM_tlstmCertCommonName                6
  ------------------
  238|     66|    se_add_pair_to_slist("cert_map_type", strdup("ip"),
  239|     66|                         TSNM_tlstmCertSANIpAddress);
  ------------------
  |  |  124|     66|#define TSNM_tlstmCertSANIpAddress              4
  ------------------
  240|     66|    se_add_pair_to_slist("cert_map_type", strdup("rfc822"),
  241|     66|                         TSNM_tlstmCertSANRFC822Name);
  ------------------
  |  |  122|     66|#define TSNM_tlstmCertSANRFC822Name             2
  ------------------
  242|     66|    se_add_pair_to_slist("cert_map_type", strdup("dns"),
  243|     66|                         TSNM_tlstmCertSANDNSName);
  ------------------
  |  |  123|     66|#define TSNM_tlstmCertSANDNSName                3
  ------------------
  244|     66|    se_add_pair_to_slist("cert_map_type", strdup("any"), TSNM_tlstmCertSANAny);
  ------------------
  |  |  125|     66|#define TSNM_tlstmCertSANAny                    5
  ------------------
  245|     66|    se_add_pair_to_slist("cert_map_type", strdup("sn"),
  246|     66|                         TSNM_tlstmCertSpecified);
  ------------------
  |  |  121|     66|#define TSNM_tlstmCertSpecified                 1
  ------------------
  247|       |
  248|     66|}
netsnmp_certs_shutdown:
  252|     66|{
  253|     66|    netsnmp_container ***c, **containers[] = {
  254|     66|        &_tlstmParams, &_tlstmAddr, &_maps, &_certs, &_keys, NULL
  255|     66|    };
  256|       |
  257|     66|    DEBUGMSGT(("cert:util:shutdown","shutdown\n"));
  ------------------
  |  |   62|     66|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 66]
  |  |  ------------------
  ------------------
  258|       |
  259|    396|    for (c = containers; *c; c++) {
  ------------------
  |  Branch (259:26): [True: 330, False: 66]
  ------------------
  260|    330|        if (!**c)
  ------------------
  |  Branch (260:13): [True: 198, False: 132]
  ------------------
  261|    198|            continue;
  262|    132|        CONTAINER_FREE_ALL(**c, NULL);
  263|    132|        CONTAINER_FREE(**c);
  264|       |        **c = NULL;
  265|    132|    }
  266|     66|    _netsnmp_release_trustcerts();
  267|     66|}
netsnmp_certs_load:
  271|      1|{
  272|      1|    netsnmp_iterator  *itr;
  273|      1|    netsnmp_key        *key;
  274|      1|    netsnmp_cert       *cert;
  275|       |
  276|      1|    DEBUGMSGT(("cert:util:init","init\n"));
  ------------------
  |  |   62|      1|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 1]
  |  |  ------------------
  ------------------
  277|       |
  278|      1|    if (NULL == _certs) {
  ------------------
  |  Branch (278:9): [True: 0, False: 1]
  ------------------
  279|      0|        snmp_log(LOG_ERR, "cant load certs without container\n");
  280|      0|        return;
  281|      0|    }
  282|       |
  283|      1|    if (CONTAINER_SIZE(_certs) != 0) {
  ------------------
  |  |  403|      1|#define CONTAINER_SIZE(x)           (x)->get_size(x)
  ------------------
  |  Branch (283:9): [True: 0, False: 1]
  ------------------
  284|      0|        DEBUGMSGT(("cert:util:init", "ignoring duplicate init\n"));
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  285|      0|        return;
  286|      0|    }
  287|       |
  288|      1|    netsnmp_init_openssl();
  289|       |
  290|       |    /** scan config dirs for certs */
  291|      1|    _cert_indexes_load();
  292|       |
  293|       |    /** match up keys w/certs */
  294|      1|    itr = CONTAINER_ITERATOR(_keys);
  ------------------
  |  |  404|      1|#define CONTAINER_ITERATOR(x)       (x)->get_iterator(x)
  ------------------
  295|      1|    if (NULL == itr) {
  ------------------
  |  Branch (295:9): [True: 0, False: 1]
  ------------------
  296|      0|        snmp_log(LOG_ERR, "could not get iterator for keys\n");
  297|      0|        netsnmp_certs_shutdown();
  298|      0|        return;
  299|      0|    }
  300|      1|    key = ITERATOR_FIRST(itr);
  ------------------
  |  |  546|      1|#define ITERATOR_FIRST(x)  x->first(x)
  ------------------
  301|      1|    for( ; key; key = ITERATOR_NEXT(itr))
  ------------------
  |  |  547|      0|#define ITERATOR_NEXT(x)   x->next(x)
  ------------------
  |  Branch (301:12): [True: 0, False: 1]
  ------------------
  302|      0|        _find_partner(NULL, key);
  303|      1|    ITERATOR_RELEASE(itr);
  ------------------
  |  |  550|      1|#define ITERATOR_RELEASE(x) do { x->release(x); x = NULL; } while(0)
  |  |  ------------------
  |  |  |  Branch (550:67): [Folded, False: 1]
  |  |  ------------------
  ------------------
  304|       |
  305|      1|    DEBUGIF("cert:dump") {
  ------------------
  |  |  145|      1|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  306|      0|        itr = CONTAINER_ITERATOR(_certs);
  ------------------
  |  |  404|      0|#define CONTAINER_ITERATOR(x)       (x)->get_iterator(x)
  ------------------
  307|      0|        if (NULL == itr) {
  ------------------
  |  Branch (307:13): [True: 0, False: 0]
  ------------------
  308|      0|            snmp_log(LOG_ERR, "could not get iterator for certs\n");
  309|      0|            netsnmp_certs_shutdown();
  310|      0|            return;
  311|      0|        }
  312|      0|        cert = ITERATOR_FIRST(itr);
  ------------------
  |  |  546|      0|#define ITERATOR_FIRST(x)  x->first(x)
  ------------------
  313|      0|        for( ; cert; cert = ITERATOR_NEXT(itr)) {
  ------------------
  |  |  547|      0|#define ITERATOR_NEXT(x)   x->next(x)
  ------------------
  |  Branch (313:16): [True: 0, False: 0]
  ------------------
  314|      0|            netsnmp_cert_load_x509(cert);
  315|      0|        }
  316|      0|        ITERATOR_RELEASE(itr);
  ------------------
  |  |  550|      0|#define ITERATOR_RELEASE(x) do { x->release(x); x = NULL; } while(0)
  |  |  ------------------
  |  |  |  Branch (550:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  317|      0|        DEBUGMSGT(("cert:dump",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  318|      0|                   "-------------------- Certificates -----------------\n"));
  319|      0|        netsnmp_cert_dump_all();
  320|      0|        DEBUGMSGT(("cert:dump",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  321|      0|                   "------------------------ End ----------------------\n"));
  322|      0|    }
  323|      1|}
cert_util.c:_setup_containers:
  353|     66|{
  354|     66|    netsnmp_container *additional_keys;
  355|       |
  356|     66|    int rc;
  357|       |
  358|     66|    _certs = _get_cert_container("netsnmp certificates");
  359|     66|    if (NULL == _certs)
  ------------------
  |  Branch (359:9): [True: 0, False: 66]
  ------------------
  360|      0|        return;
  361|       |
  362|       |    /** additional keys: common name */
  363|     66|    additional_keys = netsnmp_container_find("certs_cn:binary_array");
  364|     66|    if (NULL == additional_keys) {
  ------------------
  |  Branch (364:9): [True: 0, False: 66]
  ------------------
  365|      0|        snmp_log(LOG_ERR, "could not create CN container for certificates\n");
  366|      0|        netsnmp_certs_shutdown();
  367|      0|        return;
  368|      0|    }
  369|     66|    additional_keys->container_name = strdup("certs_cn");
  370|     66|    additional_keys->free_item = NULL;
  371|     66|    additional_keys->compare = _cert_cn_compare;
  372|     66|    CONTAINER_SET_OPTIONS(additional_keys, CONTAINER_KEY_ALLOW_DUPLICATES, rc);
  ------------------
  |  |  375|     66|#define CONTAINER_SET_OPTIONS(x,o,rc)  do {                             \
  |  |  376|     66|        if (NULL==(x)->options)                                         \
  |  |  ------------------
  |  |  |  Branch (376:13): [True: 0, False: 66]
  |  |  ------------------
  |  |  377|     66|            rc = -1;                                                    \
  |  |  378|     66|        else {                                                          \
  |  |  379|     66|            rc = (x)->options(x, 1, o);                                 \
  |  |  380|     66|            if (rc != -1 )                                              \
  |  |  ------------------
  |  |  |  Branch (380:17): [True: 66, False: 0]
  |  |  ------------------
  |  |  381|     66|                (x)->flags |= o;                                        \
  |  |  382|     66|        }                                                               \
  |  |  383|     66|    } while(0)
  |  |  ------------------
  |  |  |  Branch (383:13): [Folded, False: 66]
  |  |  ------------------
  ------------------
  373|     66|    netsnmp_container_add_index(_certs, additional_keys);
  374|       |
  375|       |    /** additional keys: subject name */
  376|     66|    additional_keys = netsnmp_container_find("certs_sn:binary_array");
  377|     66|    if (NULL == additional_keys) {
  ------------------
  |  Branch (377:9): [True: 0, False: 66]
  ------------------
  378|      0|        snmp_log(LOG_ERR, "could not create SN container for certificates\n");
  379|      0|        netsnmp_certs_shutdown();
  380|      0|        return;
  381|      0|    }
  382|     66|    additional_keys->container_name = strdup("certs_sn");
  383|     66|    additional_keys->free_item = NULL;
  384|     66|    additional_keys->compare = _cert_sn_compare;
  385|     66|    additional_keys->ncompare = _cert_sn_ncompare;
  386|     66|    CONTAINER_SET_OPTIONS(additional_keys, CONTAINER_KEY_ALLOW_DUPLICATES, rc);
  ------------------
  |  |  375|     66|#define CONTAINER_SET_OPTIONS(x,o,rc)  do {                             \
  |  |  376|     66|        if (NULL==(x)->options)                                         \
  |  |  ------------------
  |  |  |  Branch (376:13): [True: 0, False: 66]
  |  |  ------------------
  |  |  377|     66|            rc = -1;                                                    \
  |  |  378|     66|        else {                                                          \
  |  |  379|     66|            rc = (x)->options(x, 1, o);                                 \
  |  |  380|     66|            if (rc != -1 )                                              \
  |  |  ------------------
  |  |  |  Branch (380:17): [True: 66, False: 0]
  |  |  ------------------
  |  |  381|     66|                (x)->flags |= o;                                        \
  |  |  382|     66|        }                                                               \
  |  |  383|     66|    } while(0)
  |  |  ------------------
  |  |  |  Branch (383:13): [Folded, False: 66]
  |  |  ------------------
  ------------------
  387|     66|    netsnmp_container_add_index(_certs, additional_keys);
  388|       |
  389|       |    /** additional keys: file name */
  390|     66|    additional_keys = netsnmp_container_find("certs_fn:binary_array");
  391|     66|    if (NULL == additional_keys) {
  ------------------
  |  Branch (391:9): [True: 0, False: 66]
  ------------------
  392|      0|        snmp_log(LOG_ERR, "could not create FN container for certificates\n");
  393|      0|        netsnmp_certs_shutdown();
  394|      0|        return;
  395|      0|    }
  396|     66|    additional_keys->container_name = strdup("certs_fn");
  397|     66|    additional_keys->free_item = NULL;
  398|     66|    additional_keys->compare = _cert_fn_compare;
  399|     66|    additional_keys->ncompare = _cert_fn_ncompare;
  400|     66|    CONTAINER_SET_OPTIONS(additional_keys, CONTAINER_KEY_ALLOW_DUPLICATES, rc);
  ------------------
  |  |  375|     66|#define CONTAINER_SET_OPTIONS(x,o,rc)  do {                             \
  |  |  376|     66|        if (NULL==(x)->options)                                         \
  |  |  ------------------
  |  |  |  Branch (376:13): [True: 0, False: 66]
  |  |  ------------------
  |  |  377|     66|            rc = -1;                                                    \
  |  |  378|     66|        else {                                                          \
  |  |  379|     66|            rc = (x)->options(x, 1, o);                                 \
  |  |  380|     66|            if (rc != -1 )                                              \
  |  |  ------------------
  |  |  |  Branch (380:17): [True: 66, False: 0]
  |  |  ------------------
  |  |  381|     66|                (x)->flags |= o;                                        \
  |  |  382|     66|        }                                                               \
  |  |  383|     66|    } while(0)
  |  |  ------------------
  |  |  |  Branch (383:13): [Folded, False: 66]
  |  |  ------------------
  ------------------
  401|     66|    netsnmp_container_add_index(_certs, additional_keys);
  402|       |
  403|     66|    _keys = netsnmp_container_find("cert_keys:binary_array");
  404|     66|    if (NULL == _keys) {
  ------------------
  |  Branch (404:9): [True: 0, False: 66]
  ------------------
  405|      0|        snmp_log(LOG_ERR, "could not create container for certificate keys\n");
  406|      0|        netsnmp_certs_shutdown();
  407|      0|        return;
  408|      0|    }
  409|     66|    _keys->container_name = strdup("netsnmp certificate keys");
  410|     66|    _keys->free_item = _key_free;
  411|     66|    _keys->compare = _cert_fn_compare;
  412|       |
  413|     66|    _setup_trusted_certs();
  414|     66|}
cert_util.c:_get_cert_container:
  332|     66|{
  333|     66|    netsnmp_container *c;
  334|       |
  335|     66|    int rc;
  336|       |
  337|     66|    c = netsnmp_container_find("certs:binary_array");
  338|     66|    if (NULL == c) {
  ------------------
  |  Branch (338:9): [True: 0, False: 66]
  ------------------
  339|      0|        snmp_log(LOG_ERR, "could not create container for %s\n", use);
  340|      0|        return NULL;
  341|      0|    }
  342|     66|    c->container_name = strdup(use);
  343|     66|    c->free_item = _cert_free;
  344|     66|    c->compare = _cert_compare;
  345|       |
  346|     66|    CONTAINER_SET_OPTIONS(c, CONTAINER_KEY_ALLOW_DUPLICATES, rc);
  ------------------
  |  |  375|     66|#define CONTAINER_SET_OPTIONS(x,o,rc)  do {                             \
  |  |  376|     66|        if (NULL==(x)->options)                                         \
  |  |  ------------------
  |  |  |  Branch (376:13): [True: 0, False: 66]
  |  |  ------------------
  |  |  377|     66|            rc = -1;                                                    \
  |  |  378|     66|        else {                                                          \
  |  |  379|     66|            rc = (x)->options(x, 1, o);                                 \
  |  |  380|     66|            if (rc != -1 )                                              \
  |  |  ------------------
  |  |  |  Branch (380:17): [True: 66, False: 0]
  |  |  ------------------
  |  |  381|     66|                (x)->flags |= o;                                        \
  |  |  382|     66|        }                                                               \
  |  |  383|     66|    } while(0)
  |  |  ------------------
  |  |  |  Branch (383:13): [Folded, False: 66]
  |  |  ------------------
  ------------------
  347|       |
  348|     66|    return c;
  349|     66|}
cert_util.c:_cert_indexes_load:
 1725|      1|{
 1726|      1|    const char     *confpath;
 1727|      1|    char           *confpath_copy, *dir, *st = NULL;
 1728|      1|    char            certdir[SNMP_MAXPATH];
 1729|      1|    const char     *subdirs[] = { NULL, "ca-certs", "certs", "private", NULL };
 1730|      1|    int             i = 0;
 1731|       |
 1732|       |    /*
 1733|       |     * load indexes from persistent dir
 1734|       |     */
 1735|      1|    _certindexes_load();
 1736|       |
 1737|       |    /*
 1738|       |     * duplicate path building from read_config_files_of_type() in
 1739|       |     * read_config.c. That is, use SNMPCONFPATH environment variable if
 1740|       |     * it is defined, otherwise use configuration directory.
 1741|       |     */
 1742|      1|    confpath = netsnmp_getenv("SNMPCONFPATH");
 1743|      1|    if (NULL == confpath)
  ------------------
  |  Branch (1743:9): [True: 1, False: 0]
  ------------------
 1744|      1|        confpath = get_configuration_directory();
 1745|       |
 1746|      1|    subdirs[0] = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1747|      1|                                       NETSNMP_DS_LIB_CERT_EXTRA_SUBDIR);
  ------------------
  |  |  177|      1|#define NETSNMP_DS_LIB_CERT_EXTRA_SUBDIR 26
  ------------------
 1748|      1|    confpath_copy = strdup(confpath);
 1749|      1|    if (!confpath_copy)
  ------------------
  |  Branch (1749:9): [True: 0, False: 1]
  ------------------
 1750|      0|        return;
 1751|      1|    for ( dir = strtok_r(confpath_copy, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      1|#define ENV_SEPARATOR ":"
  ------------------
 1752|      5|          dir; dir = strtok_r(NULL, ENV_SEPARATOR, &st)) {
  ------------------
  |  |   67|      4|#define ENV_SEPARATOR ":"
  ------------------
  |  Branch (1752:11): [True: 4, False: 1]
  ------------------
 1753|       |
 1754|      4|        i = (NULL == subdirs[0]) ? 1 : 0;
  ------------------
  |  Branch (1754:13): [True: 4, False: 0]
  ------------------
 1755|     16|        for ( ; subdirs[i] ; ++i ) {
  ------------------
  |  Branch (1755:17): [True: 12, False: 4]
  ------------------
 1756|       |            /** check tls subdir */
 1757|     12|            snprintf(certdir, sizeof(certdir), "%s/tls/%s", dir, subdirs[i]);
 1758|     12|            _add_certdir(certdir);
 1759|     12|        } /* for subdirs */
 1760|      4|    } /* for conf path dirs */
 1761|       |    SNMP_FREE(confpath_copy);
  ------------------
  |  |   62|      1|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 1, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 1]
  |  |  ------------------
  ------------------
 1762|      1|}
cert_util.c:_certindexes_load:
  779|      1|{
  780|      1|    DIR *dir;
  781|      1|    struct dirent *file;
  782|      1|    FILE *fp;
  783|      1|    char filename[SNMP_MAXPATH], line[300];
  784|      1|    int  i;
  785|      1|    char *cp, *pos;
  786|       |
  787|       |    /*
  788|       |     * Open the CERT index directory, or create it (empty)
  789|       |     */
  790|      1|    snprintf( filename, sizeof(filename), "%s/cert_indexes",
  791|      1|              get_persistent_directory());
  792|      1|    filename[sizeof(filename)-1] = 0;
  793|      1|    dir = opendir( filename );
  794|      1|    if ( dir == NULL ) {
  ------------------
  |  Branch (794:10): [True: 1, False: 0]
  ------------------
  795|      1|        DEBUGMSGT(("cert:index:load",
  ------------------
  |  |   62|      1|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 1]
  |  |  ------------------
  ------------------
  796|      1|                   "creating new cert_indexes directory\n"));
  797|      1|        mkdirhier( filename, NETSNMP_AGENT_DIRECTORY_MODE, 0);
  ------------------
  |  | 2002|      1|#define NETSNMP_AGENT_DIRECTORY_MODE 0700
  ------------------
  798|      1|        return;
  799|      1|    }
  800|       |
  801|       |    /*
  802|       |     * Create a list of which directory each file refers to
  803|       |     */
  804|      0|    while ((file = readdir( dir ))) {
  ------------------
  |  Branch (804:12): [True: 0, False: 0]
  ------------------
  805|      0|        if ( !isdigit(0xFF & file->d_name[0]))
  ------------------
  |  Branch (805:14): [True: 0, False: 0]
  ------------------
  806|      0|            continue;
  807|      0|        i = atoi( file->d_name );
  808|       |
  809|      0|        snprintf( filename, sizeof(filename), "%s/cert_indexes/%d",
  810|      0|              get_persistent_directory(), i );
  811|      0|        filename[sizeof(filename)-1] = 0;
  812|      0|        fp = fopen( filename, "r" );
  813|      0|        if ( !fp ) {
  ------------------
  |  Branch (813:14): [True: 0, False: 0]
  ------------------
  814|      0|            DEBUGMSGT(("cert:index:load", "error opening index (%d)\n", i));
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  815|      0|            continue;
  816|      0|        }
  817|      0|        cp = fgets( line, sizeof(line), fp );
  818|      0|        if ( cp ) {
  ------------------
  |  Branch (818:14): [True: 0, False: 0]
  ------------------
  819|      0|            line[strlen(line)-1] = 0;
  820|      0|            pos = strrchr(line, ' ');
  821|      0|            if (pos)
  ------------------
  |  Branch (821:17): [True: 0, False: 0]
  ------------------
  822|      0|                *pos = '\0';
  823|      0|            DEBUGMSGT(("9:cert:index:load","adding (%d) %s\n", i, line));
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  824|      0|            (void)_certindex_add( line+4, i );  /* Skip 'DIR ' */
  825|      0|        } else {
  826|      0|            DEBUGMSGT(("cert:index:load", "Empty index (%d)\n", i));
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  827|      0|        }
  828|      0|        fclose( fp );
  829|      0|    }
  830|      0|    closedir( dir );
  831|      0|}
cert_util.c:_add_certdir:
 1634|     12|{
 1635|     12|    FILE           *index;
 1636|     12|    char           *file;
 1637|     12|    int             count = 0;
 1638|     12|    netsnmp_container *cert_container;
 1639|     12|    netsnmp_iterator  *it;
 1640|     12|    struct stat     statbuf;
 1641|       |
 1642|     12|    netsnmp_assert(NULL != dirname);
  ------------------
  |  |   47|     12|#      define netsnmp_assert(x)  do { \
  |  |   48|     12|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 12, False: 0]
  |  |  ------------------
  |  |   49|     12|                 ; \
  |  |   50|     12|              else \
  |  |   51|     12|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     12|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 12]
  |  |  ------------------
  ------------------
 1643|       |
 1644|     12|    DEBUGMSGT(("9:cert:dir:add", " config dir: %s\n", dirname ));
  ------------------
  |  |   62|     12|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     12|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 12]
  |  |  ------------------
  ------------------
 1645|       |
 1646|     12|    if (stat(dirname, &statbuf) != 0) {
  ------------------
  |  Branch (1646:9): [True: 12, False: 0]
  ------------------
 1647|     12|        DEBUGMSGT(("9:cert:dir:add", " dir not present: %s\n",
  ------------------
  |  |   62|     12|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     12|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 12]
  |  |  ------------------
  ------------------
 1648|     12|                   dirname ));
 1649|     12|        return -1;
 1650|     12|    }
 1651|      0|#ifdef S_ISDIR
 1652|      0|    if (!S_ISDIR(statbuf.st_mode)) {
  ------------------
  |  Branch (1652:9): [True: 0, False: 0]
  ------------------
 1653|      0|        DEBUGMSGT(("9:cert:dir:add", " not a dir: %s\n", dirname ));
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1654|      0|        return -1;
 1655|      0|    }
 1656|      0|#endif
 1657|       |
 1658|      0|    DEBUGMSGT(("cert:index:dir", "Scanning directory %s\n", dirname));
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1659|       |
 1660|       |    /*
 1661|       |     * look for existing index
 1662|       |     */
 1663|      0|    count = _cert_read_index(dirname, &statbuf);
 1664|      0|    if (count >= 0)
  ------------------
  |  Branch (1664:9): [True: 0, False: 0]
  ------------------
 1665|      0|        return count;
 1666|       |
 1667|      0|    index = _certindex_new( dirname );
 1668|      0|    if (NULL == index) {
  ------------------
  |  Branch (1668:9): [True: 0, False: 0]
  ------------------
 1669|      0|        DEBUGMSGT(("9:cert:index:dir",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1670|      0|                    "error opening index for cert directory\n"));
 1671|      0|        DEBUGMSGTL(("cert:index", "could not open certificate index file\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]
  |  |  ------------------
  ------------------
 1672|      0|    }
 1673|       |
 1674|       |    /*
 1675|       |     * index was missing, out of date or bad. rescan directory.
 1676|       |     */
 1677|      0|    cert_container =
 1678|      0|        netsnmp_directory_container_read_some(NULL, dirname,
 1679|      0|                                              _cert_cert_filter, NULL,
 1680|      0|                                              NETSNMP_DIR_RELATIVE_PATH |
  ------------------
  |  |   48|      0|#define NETSNMP_DIR_RELATIVE_PATH                     0x0002
  ------------------
 1681|      0|                                              NETSNMP_DIR_EMPTY_OK |
  ------------------
  |  |   51|      0|#define NETSNMP_DIR_EMPTY_OK                          0x0008
  ------------------
 1682|      0|                                              NETSNMP_DIR_ALLOW_DUPLICATES);
  ------------------
  |  |   57|      0|#define NETSNMP_DIR_ALLOW_DUPLICATES                  0x0040
  ------------------
 1683|      0|    if (NULL == cert_container) {
  ------------------
  |  Branch (1683:9): [True: 0, False: 0]
  ------------------
 1684|      0|        DEBUGMSGT(("cert:index:dir",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1685|      0|                    "error creating container for cert files\n"));
 1686|      0|        goto err_index;
 1687|      0|    }
 1688|       |
 1689|       |    /*
 1690|       |     * iterate through the found files and add them to index
 1691|       |     */
 1692|      0|    it = CONTAINER_ITERATOR(cert_container);
  ------------------
  |  |  404|      0|#define CONTAINER_ITERATOR(x)       (x)->get_iterator(x)
  ------------------
 1693|      0|    if (NULL == it) {
  ------------------
  |  Branch (1693:9): [True: 0, False: 0]
  ------------------
 1694|      0|        DEBUGMSGT(("cert:index:dir",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1695|      0|                    "error creating iterator for cert files\n"));
 1696|      0|        goto err_container;
 1697|      0|    }
 1698|       |
 1699|      0|    for (file = ITERATOR_FIRST(it); file; file = ITERATOR_NEXT(it)) {
  ------------------
  |  |  546|      0|#define ITERATOR_FIRST(x)  x->first(x)
  ------------------
                  for (file = ITERATOR_FIRST(it); file; file = ITERATOR_NEXT(it)) {
  ------------------
  |  |  547|      0|#define ITERATOR_NEXT(x)   x->next(x)
  ------------------
  |  Branch (1699:37): [True: 0, False: 0]
  ------------------
 1700|      0|        DEBUGMSGT(("cert:index:dir", "adding %s to index\n", file));
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1701|      0|        if ( 0 == _add_certfile( dirname, file, index ))
  ------------------
  |  Branch (1701:14): [True: 0, False: 0]
  ------------------
 1702|      0|            count++;
 1703|      0|        else
 1704|      0|            DEBUGMSGT(("cert:index:dir", "error adding %s to index\n",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1705|      0|                        file));
 1706|      0|    }
 1707|       |
 1708|       |    /*
 1709|       |     * clean up and return
 1710|       |     */
 1711|      0|    ITERATOR_RELEASE(it);
  ------------------
  |  |  550|      0|#define ITERATOR_RELEASE(x) do { x->release(x); x = NULL; } while(0)
  |  |  ------------------
  |  |  |  Branch (550:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1712|       |
 1713|      0|  err_container:
 1714|      0|    netsnmp_directory_container_free(cert_container);
 1715|       |
 1716|      0|  err_index:
 1717|      0|    if (index)
  ------------------
  |  Branch (1717:9): [True: 0, False: 0]
  ------------------
 1718|      0|        fclose(index);
 1719|       |
 1720|      0|    return count;
 1721|      0|}

netsnmp_container_init_list:
   82|     66|{
   83|     66|    if (NULL != containers)
  ------------------
  |  Branch (83:9): [True: 0, False: 66]
  ------------------
   84|      0|        return;
   85|       |
   86|       |    /*
   87|       |     * create a binary array container to hold container
   88|       |     * factories
   89|       |     */
   90|     66|    containers = netsnmp_container_get_binary_array();
   91|     66|    containers->compare = netsnmp_compare_cstring;
   92|     66|    containers->container_name = strdup("container list");
   93|       |
   94|       |    /*
   95|       |     * register containers
   96|       |     */
   97|     66|    netsnmp_container_binary_array_init();
   98|     66|#ifndef NETSNMP_FEATURE_REMOVE_CONTAINER_LINKED_LIST
   99|     66|    netsnmp_container_ssll_init();
  100|     66|#endif /* NETSNMP_FEATURE_REMOVE_CONTAINER_LINKED_LIST */
  101|     66|#ifndef NETSNMP_FEATURE_REMOVE_CONTAINER_NULL
  102|     66|    netsnmp_container_null_init();
  103|     66|#endif /* NETSNMP_FEATURE_REMOVE_CONTAINER_NULL */
  104|       |
  105|       |    /*
  106|       |     * default aliases for some containers
  107|       |     */
  108|     66|    netsnmp_container_register("table_container",
  109|     66|                               netsnmp_container_get_factory("binary_array"));
  110|       |
  111|     66|#ifndef NETSNMP_FEATURE_REMOVE_CONTAINER_LINKED_LIST
  112|     66|    netsnmp_container_register("linked_list",
  113|     66|                               netsnmp_container_get_factory("sorted_singly_linked_list"));
  114|     66|    netsnmp_container_register("ssll_container",
  115|     66|                               netsnmp_container_get_factory("sorted_singly_linked_list"));
  116|     66|#endif /* NETSNMP_FEATURE_REMOVE_CONTAINER_LINKED_LIST */
  117|       |
  118|     66|    netsnmp_container_register_with_compare
  119|     66|        ("cstring", netsnmp_container_get_factory("binary_array"),
  120|     66|         netsnmp_compare_direct_cstring);
  121|       |
  122|     66|    netsnmp_container_register_with_compare
  123|     66|        ("string", netsnmp_container_get_factory("binary_array"),
  124|     66|         netsnmp_compare_cstring);
  125|     66|    netsnmp_container_register_with_compare
  126|     66|        ("string_binary_array", netsnmp_container_get_factory("binary_array"),
  127|     66|         netsnmp_compare_cstring);
  128|       |
  129|     66|}
netsnmp_container_free_list:
  133|     66|{
  134|     66|    DEBUGMSGTL(("container", "netsnmp_container_free_list() called\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  135|     66|    if (containers == NULL)
  ------------------
  |  Branch (135:9): [True: 0, False: 66]
  ------------------
  136|      0|	return;
  137|       |
  138|       |    /*
  139|       |     * free memory used by each factory entry
  140|       |     */
  141|     66|    CONTAINER_FOR_EACH(containers, _factory_free, NULL);
  ------------------
  |  |  406|     66|#define CONTAINER_FOR_EACH(x,f,c)   (x)->for_each(x,f,c)
  ------------------
  142|       |
  143|       |    /*
  144|       |     * free factory container
  145|       |     */
  146|     66|    CONTAINER_FREE(containers);
  147|       |    containers = NULL;
  148|     66|}
netsnmp_container_register_with_compare:
  153|    792|{
  154|    792|    container_type *ct, tmp;
  155|       |
  156|    792|    if (NULL==containers)
  ------------------
  |  Branch (156:9): [True: 0, False: 792]
  ------------------
  157|      0|        return -1;
  158|       |
  159|    792|    tmp.name = name;
  160|    792|    ct = (container_type *)CONTAINER_FIND(containers, &tmp);
  ------------------
  |  |  394|    792|#define CONTAINER_FIND(x,k)         (x)->find(x,k)
  ------------------
  161|    792|    if (NULL!=ct) {
  ------------------
  |  Branch (161:9): [True: 0, False: 792]
  ------------------
  162|      0|        DEBUGMSGT(("container_registry",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  163|      0|                   "replacing previous container factory\n"));
  164|      0|        ct->factory = f;
  165|      0|    }
  166|    792|    else {
  167|    792|        ct = SNMP_MALLOC_TYPEDEF(container_type);
  ------------------
  |  |   73|    792|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  168|    792|        if (NULL == ct)
  ------------------
  |  Branch (168:13): [True: 0, False: 792]
  ------------------
  169|      0|            return -1;
  170|    792|        ct->name = strdup(name);
  171|    792|        ct->factory = f;
  172|    792|        ct->compare = c;
  173|    792|        CONTAINER_INSERT(containers, ct);
  174|    792|    }
  175|    792|    DEBUGMSGT(("container_registry", "registered container factory %s (%s)\n",
  ------------------
  |  |   62|    792|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    792|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 792]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 792]
  |  |  ------------------
  ------------------
  176|    792|               ct->name, f->product));
  177|       |
  178|    792|    return 0;
  179|    792|}
netsnmp_container_register:
  183|    594|{
  184|       |    return netsnmp_container_register_with_compare(name, f, NULL);
  185|    594|}
netsnmp_container_get_factory:
  191|    396|{
  192|    396|    container_type ct, *found;
  193|       |    
  194|    396|    if (NULL==containers)
  ------------------
  |  Branch (194:9): [True: 0, False: 396]
  ------------------
  195|      0|        return NULL;
  196|       |
  197|    396|    ct.name = type;
  198|    396|    found = (container_type *)CONTAINER_FIND(containers, &ct);
  ------------------
  |  |  394|    396|#define CONTAINER_FIND(x,k)         (x)->find(x,k)
  ------------------
  199|       |
  200|    396|    return found ? found->factory : NULL;
  ------------------
  |  Branch (200:12): [True: 396, False: 0]
  ------------------
  201|    396|}
netsnmp_container_find:
  300|    396|{
  301|    396|    container_type *ct = netsnmp_container_find_ct(type);
  302|    396|    netsnmp_container *c = ct ? (netsnmp_container *)(ct->factory->produce()) : NULL;
  ------------------
  |  Branch (302:28): [True: 396, False: 0]
  ------------------
  303|       |
  304|       |    /*
  305|       |     * provide default compare and ncompare
  306|       |     */
  307|    396|    if (c) {
  ------------------
  |  Branch (307:9): [True: 396, False: 0]
  ------------------
  308|    396|        if (ct->compare)
  ------------------
  |  Branch (308:13): [True: 0, False: 396]
  ------------------
  309|      0|            c->compare = ct->compare;
  310|    396|        else if (NULL == c->compare)
  ------------------
  |  Branch (310:18): [True: 396, False: 0]
  ------------------
  311|    396|            c->compare = netsnmp_compare_netsnmp_index;
  312|       |
  313|    396|        if (NULL == c->ncompare)
  ------------------
  |  Branch (313:13): [True: 396, False: 0]
  ------------------
  314|    396|            c->ncompare = netsnmp_ncompare_netsnmp_index;
  315|    396|    }
  316|       |
  317|    396|    return c;
  318|    396|}
netsnmp_container_add_index:
  325|    198|{
  326|    198|    netsnmp_container *curr = primary;
  327|       |
  328|    198|    if((NULL == new_index) || (NULL == primary)) {
  ------------------
  |  Branch (328:8): [True: 0, False: 198]
  |  Branch (328:31): [True: 0, False: 198]
  ------------------
  329|      0|        snmp_log(LOG_ERR, "add index called with null pointer\n");
  330|      0|        return;
  331|      0|    }
  332|       |
  333|    396|    while(curr->next)
  ------------------
  |  Branch (333:11): [True: 198, False: 198]
  ------------------
  334|    198|        curr = curr->next;
  335|       |
  336|    198|    curr->next = new_index;
  337|    198|    new_index->prev = curr;
  338|    198|}
CONTAINER_INSERT_HELPER:
  341|  1.58k|{
  342|  1.58k|    while(x && x->insert_filter && x->insert_filter(x,k) == 1)
  ------------------
  |  Branch (342:11): [True: 792, False: 792]
  |  Branch (342:16): [True: 0, False: 792]
  |  Branch (342:36): [True: 0, False: 0]
  ------------------
  343|      0|        x = x->next;
  344|  1.58k|    if(x) {
  ------------------
  |  Branch (344:8): [True: 792, False: 792]
  ------------------
  345|    792|        int rc = x->insert(x,k);
  346|    792|        if(rc)
  ------------------
  |  Branch (346:12): [True: 0, False: 792]
  ------------------
  347|      0|            snmp_log(LOG_DEBUG,"error on subcontainer '%s' insert (%d)\n",
  348|      0|                     x->container_name ? x->container_name : "", rc);
  ------------------
  |  Branch (348:22): [True: 0, False: 0]
  ------------------
  349|    792|        else {
  350|    792|            rc = CONTAINER_INSERT_HELPER(x->next, k);
  351|    792|            if(rc)
  ------------------
  |  Branch (351:16): [True: 0, False: 792]
  ------------------
  352|      0|                x->remove(x,k);
  353|    792|        }
  354|    792|        return rc;
  355|    792|    }
  356|    792|    return 0;
  357|  1.58k|}
CONTAINER_INSERT:
  360|    792|{
  361|       |    /** start at first container */
  362|    792|    while(x->prev)
  ------------------
  |  Branch (362:11): [True: 0, False: 792]
  ------------------
  363|      0|        x = x->prev;
  364|    792|    return CONTAINER_INSERT_HELPER(x, k);
  365|    792|}
CONTAINER_FREE:
  469|    264|{
  470|    264|    int  rc2, rc = 0;
  471|       |
  472|    264|    if (!x)
  ------------------
  |  Branch (472:9): [True: 0, False: 264]
  ------------------
  473|      0|        return rc;
  474|       |
  475|       |    /** start at last container */
  476|    462|    while(x->next)
  ------------------
  |  Branch (476:11): [True: 198, False: 264]
  ------------------
  477|    198|        x = x->next;
  478|    726|    while(x) {
  ------------------
  |  Branch (478:11): [True: 462, False: 264]
  ------------------
  479|    462|        netsnmp_container *tmp;
  480|    462|        char *name;
  481|    462|        tmp = x->prev;
  482|    462|        name = x->container_name;
  483|    462|        x->container_name = NULL;
  484|    462|        rc2 = x->cfree(x);
  485|    462|        if (rc2) {
  ------------------
  |  Branch (485:13): [True: 0, False: 462]
  ------------------
  486|      0|            snmp_log(LOG_ERR,"error on subcontainer '%s' cfree (%d)\n",
  487|      0|                     name ? name : "", rc2);
  ------------------
  |  Branch (487:22): [True: 0, False: 0]
  ------------------
  488|      0|            rc = rc2;
  489|      0|        }
  490|       |        SNMP_FREE(name);
  ------------------
  |  |   62|    462|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 462, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 462]
  |  |  ------------------
  ------------------
  491|    462|        x = tmp;
  492|    462|    }
  493|    264|    return rc;
  494|    264|}
CONTAINER_CLEAR:
  503|    198|{
  504|       |    /** start at last container */
  505|    396|    while(x->next)
  ------------------
  |  Branch (505:11): [True: 198, False: 198]
  ------------------
  506|    198|        x = x->next;
  507|    396|    while(x->prev) {
  ------------------
  |  Branch (507:11): [True: 198, False: 198]
  ------------------
  508|       |        x->clear(x, NULL, c);
  509|    198|        x = x->prev;
  510|    198|    }
  511|    198|    x->clear(x, f, c);
  512|    198|#ifdef HAVE_MALLOC_TRIM
  513|    198|    malloc_trim(0);
  514|    198|#endif
  515|    198|}
CONTAINER_FREE_ALL:
  524|    198|{
  525|    198|    CONTAINER_CLEAR(x, x->free_item, c);
  526|    198|}
netsnmp_init_container:
  563|    462|{
  564|    462|    if (c == NULL)
  ------------------
  |  Branch (564:9): [True: 0, False: 462]
  ------------------
  565|      0|        return;
  566|       |
  567|    462|    c->init = init;
  568|    462|    c->cfree = cfree;
  569|    462|    c->get_size = size;
  570|    462|    c->compare = cmp;
  571|    462|    c->insert = ins;
  572|    462|    c->remove = rem;
  573|    462|    c->find = fnd;
  574|    462|    c->free_item = netsnmp_container_simple_free;
  575|    462|}
netsnmp_compare_cstring:
  643|  9.83k|{
  644|  9.83k|    const container_type *lhs = lhs_arg;
  645|  9.83k|    const container_type *rhs = rhs_arg;
  646|       |
  647|  9.83k|    return strcmp(lhs->name, rhs->name);
  648|  9.83k|}
container.c:_factory_free:
   65|    792|{
   66|    792|    container_type *data = (container_type *)dat;
   67|    792|    if (data == NULL)
  ------------------
  |  Branch (67:9): [True: 0, False: 792]
  ------------------
   68|      0|	return;
   69|       |    
   70|    792|    if (data->name != NULL) {
  ------------------
  |  Branch (70:9): [True: 792, False: 0]
  ------------------
   71|    792|        DEBUGMSGTL(("container", "  _factory_free_list() called for %s\n",
  ------------------
  |  |   66|    792|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    792|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 792]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 792]
  |  |  ------------------
  ------------------
   72|    792|                    data->name));
   73|    792|	free(NETSNMP_REMOVE_CONST(void *, data->name)); /* SNMP_FREE wasted on object about to be freed */
  ------------------
  |  |   91|    792|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
   74|    792|    }
   75|    792|    free(data); /* SNMP_FREE wasted on param */
   76|    792|}
container.c:netsnmp_container_get_ct:
  234|    792|{
  235|    792|    container_type ct;
  236|       |
  237|    792|    if (NULL == containers)
  ------------------
  |  Branch (237:9): [True: 0, False: 792]
  ------------------
  238|      0|        return NULL;
  239|       |    
  240|    792|    ct.name = type;
  241|    792|    return (container_type *)CONTAINER_FIND(containers, &ct);
  ------------------
  |  |  394|    792|#define CONTAINER_FIND(x,k)         (x)->find(x,k)
  ------------------
  242|    792|}
container.c:netsnmp_container_find_ct:
  246|    396|{
  247|    396|    container_type    *ct = NULL;
  248|    396|    char              *list, *entry;
  249|    396|    char              *st = NULL;
  250|       |
  251|    396|    if (NULL==type_list)
  ------------------
  |  Branch (251:9): [True: 0, False: 396]
  ------------------
  252|      0|        return NULL;
  253|       |
  254|    396|    list = strdup(type_list);
  255|    396|    if (!list)
  ------------------
  |  Branch (255:9): [True: 0, False: 396]
  ------------------
  256|      0|        return NULL;
  257|    396|    entry = strtok_r(list, ":", &st);
  258|    792|    while (entry) {
  ------------------
  |  Branch (258:12): [True: 792, False: 0]
  ------------------
  259|    792|        ct = netsnmp_container_get_ct(entry);
  260|    792|        if (NULL != ct)
  ------------------
  |  Branch (260:13): [True: 396, False: 396]
  ------------------
  261|    396|            break;
  262|    396|        entry = strtok_r(NULL, ":", &st);
  263|    396|    }
  264|       |
  265|    396|    free(list);
  266|    396|    return ct;
  267|    396|}

netsnmp_binary_array_release:
  204|    396|{
  205|    396|    binary_array_table *t = (binary_array_table*)c->container_data;
  206|    396|    SNMP_FREE(t->data);
  ------------------
  |  |   62|    396|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 330]
  |  |  |  Branch (62:66): [Folded, False: 396]
  |  |  ------------------
  ------------------
  207|    396|    SNMP_FREE(t);
  ------------------
  |  |   62|    396|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 396, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 396]
  |  |  ------------------
  ------------------
  208|    396|    SNMP_FREE(c->container_name);
  ------------------
  |  |   62|    396|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 396]
  |  |  |  Branch (62:66): [Folded, False: 396]
  |  |  ------------------
  ------------------
  209|       |    SNMP_FREE(c);
  ------------------
  |  |   62|    396|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 396, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 396]
  |  |  ------------------
  ------------------
  210|    396|}
netsnmp_binary_array_options_set:
  220|    264|{
  221|    264|#define BA_FLAGS (CONTAINER_KEY_ALLOW_DUPLICATES|CONTAINER_KEY_UNSORTED)
  222|       |
  223|    264|    if (set) {
  ------------------
  |  Branch (223:9): [True: 264, False: 0]
  ------------------
  224|    264|        if ((flags & BA_FLAGS) == flags) {
  ------------------
  |  |  221|    264|#define BA_FLAGS (CONTAINER_KEY_ALLOW_DUPLICATES|CONTAINER_KEY_UNSORTED)
  |  |  ------------------
  |  |  |  |  370|    264|#define CONTAINER_KEY_ALLOW_DUPLICATES             0x00000001
  |  |  ------------------
  |  |               #define BA_FLAGS (CONTAINER_KEY_ALLOW_DUPLICATES|CONTAINER_KEY_UNSORTED)
  |  |  ------------------
  |  |  |  |  371|    264|#define CONTAINER_KEY_UNSORTED                     0x00000002
  |  |  ------------------
  ------------------
  |  Branch (224:13): [True: 264, False: 0]
  ------------------
  225|       |            /** if turning off unsorted, do sort */
  226|    264|            int sort = ((c->flags & CONTAINER_KEY_UNSORTED) &&
  ------------------
  |  |  371|    264|#define CONTAINER_KEY_UNSORTED                     0x00000002
  ------------------
  |  Branch (226:25): [True: 0, False: 264]
  ------------------
  227|      0|                        ! (flags & CONTAINER_KEY_UNSORTED));
  ------------------
  |  |  371|      0|#define CONTAINER_KEY_UNSORTED                     0x00000002
  ------------------
  |  Branch (227:25): [True: 0, False: 0]
  ------------------
  228|    264|            c->flags = flags;
  229|    264|            if (sort) {
  ------------------
  |  Branch (229:17): [True: 0, False: 264]
  ------------------
  230|      0|                binary_array_table *t = (binary_array_table*)c->container_data;
  231|      0|                t->dirty = 1; /* force sort */
  232|      0|                Sort_Array(c);
  233|      0|            }
  234|    264|            return flags;
  235|    264|        } else {
  236|      0|            return -1; /* unsupported flag */
  237|      0|        }
  238|    264|    } else {
  239|      0|        return ((c->flags & flags) == flags);
  240|      0|    }
  241|    264|}
netsnmp_container_get_binary_array:
  804|    396|{
  805|       |    /*
  806|       |     * allocate memory
  807|       |     */
  808|    396|    netsnmp_container *c = SNMP_MALLOC_TYPEDEF(netsnmp_container);
  ------------------
  |  |   73|    396|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  809|    396|    if (NULL==c) {
  ------------------
  |  Branch (809:9): [True: 0, False: 396]
  ------------------
  810|      0|        snmp_log(LOG_ERR, "couldn't allocate memory\n");
  811|      0|        return NULL;
  812|      0|    }
  813|       |
  814|    396|    c->container_data = netsnmp_binary_array_initialize();
  815|    396|    if (NULL == c->container_data) {
  ------------------
  |  Branch (815:9): [True: 0, False: 396]
  ------------------
  816|      0|        free(c);
  817|      0|        snmp_log(LOG_ERR, "couldn't allocate memory for container_data\n");
  818|      0|        return NULL;
  819|      0|    }
  820|       |
  821|       |    /*
  822|       |     * NOTE: CHANGES HERE MUST BE DUPLICATED IN duplicate AS WELL!!
  823|       |     */
  824|    396|    netsnmp_init_container(c, NULL, _ba_free, _ba_size, NULL, _ba_insert,
  825|    396|                           _ba_remove, _ba_find);
  826|    396|    c->find_next = _ba_find_next;
  827|    396|    c->get_subset = _ba_get_subset;
  828|    396|    c->get_iterator = _ba_iterator_get;
  829|    396|    c->for_each = _ba_for_each;
  830|    396|    c->clear = _ba_clear;
  831|    396|    c->options = _ba_options;
  832|    396|    c->duplicate = _ba_duplicate;
  833|    396|    c->get_at = netsnmp_binary_array_get_at;
  834|    396|    c->remove_at = netsnmp_binary_array_remove_at;
  835|    396|    c->insert_before = _ba_insert_before;
  836|       |
  837|    396|    return c;
  838|    396|}
netsnmp_container_get_binary_array_factory:
  842|     66|{
  843|     66|    static netsnmp_factory f = { "binary_array",
  844|     66|                                 netsnmp_container_get_binary_array };
  845|       |    
  846|     66|    return &f;
  847|     66|}
netsnmp_container_binary_array_init:
  851|     66|{
  852|     66|    netsnmp_container_register("binary_array",
  853|     66|                               netsnmp_container_get_binary_array_factory());
  854|     66|}
container_binary_array.c:_ba_is_sorted:
  324|    792|{
  325|       |    /*
  326|       |     * The code below has been commented out because it negatively affects
  327|       |     * performance.
  328|       |     */
  329|       |#if 0
  330|       |    const binary_array_table *t = c->container_data;
  331|       |    int i;
  332|       |
  333|       |    for (i = 0; i + 1 < t->count; ++i)
  334|       |        if (c->compare(t->data[i], t->data[i + 1]) > 0)
  335|       |            return 0;
  336|       |#endif
  337|       |
  338|    792|    return 1;
  339|    792|}
container_binary_array.c:binary_search:
  113|  2.64k|{
  114|  2.64k|    binary_array_table *t = (binary_array_table*)c->container_data;
  115|  2.64k|    size_t             len = t->count;
  116|  2.64k|    size_t             half;
  117|  2.64k|    size_t             first = 0;
  118|  2.64k|    size_t             middle = 0; /* init not needed; keeps compiler happy */
  119|  2.64k|    int                result = 0; /* init not needed; keeps compiler happy */
  120|       |
  121|  2.64k|    if (!len) {
  ------------------
  |  Branch (121:9): [True: 0, False: 2.64k]
  ------------------
  122|      0|        if (NULL != next)
  ------------------
  |  Branch (122:13): [True: 0, False: 0]
  ------------------
  123|      0|            *next = 0;
  124|      0|        return -1;
  125|      0|    }
  126|       |
  127|  2.64k|    if (c->flags & CONTAINER_KEY_UNSORTED) {
  ------------------
  |  |  371|  2.64k|#define CONTAINER_KEY_UNSORTED                     0x00000002
  ------------------
  |  Branch (127:9): [True: 0, False: 2.64k]
  ------------------
  128|      0|        if (!exact) {
  ------------------
  |  Branch (128:13): [True: 0, False: 0]
  ------------------
  129|      0|            snmp_log(LOG_ERR, "non-exact search on unsorted container %s?!?\n",
  130|      0|                     c->container_name);
  131|      0|            return -1;
  132|      0|        }
  133|      0|        return linear_search(val, c);
  134|      0|    }
  135|       |
  136|  2.64k|    if (t->dirty)
  ------------------
  |  Branch (136:9): [True: 0, False: 2.64k]
  ------------------
  137|      0|        Sort_Array(c);
  138|       |
  139|  10.3k|    while (len > 0) {
  ------------------
  |  Branch (139:12): [True: 8.51k, False: 1.84k]
  ------------------
  140|  8.51k|        half = len >> 1;
  141|  8.51k|        middle = first + half;
  142|  8.51k|        if ((result = c->compare(t->data[middle], val)) < 0) {
  ------------------
  |  Branch (142:13): [True: 2.83k, False: 5.67k]
  ------------------
  143|  2.83k|            first = middle + 1;
  144|  2.83k|            len = len - half - 1;
  145|  5.67k|        } else if (result == 0) {
  ------------------
  |  Branch (145:20): [True: 792, False: 4.88k]
  ------------------
  146|    792|            first = middle;
  147|    792|            break;
  148|  4.88k|        } else {
  149|  4.88k|            len = half;
  150|  4.88k|        }
  151|  8.51k|    }
  152|       |
  153|  2.64k|    if (first >= t->count) {
  ------------------
  |  Branch (153:9): [True: 264, False: 2.37k]
  ------------------
  154|    264|        if (exact && NULL != next)
  ------------------
  |  Branch (154:13): [True: 264, False: 0]
  |  Branch (154:22): [True: 132, False: 132]
  ------------------
  155|    132|            *next = t->count;
  156|    264|        return -1;
  157|    264|    }
  158|       |
  159|  2.37k|    if (first != middle) {
  ------------------
  |  Branch (159:9): [True: 1.32k, False: 1.05k]
  ------------------
  160|       |        /* last compare wasn't against first, so get actual result */
  161|  1.32k|        result = c->compare(t->data[first], val);
  162|  1.32k|    }
  163|       |
  164|  2.37k|    if(result == 0) {
  ------------------
  |  Branch (164:8): [True: 792, False: 1.58k]
  ------------------
  165|    792|        if (exact && NULL != next)
  ------------------
  |  Branch (165:13): [True: 792, False: 0]
  |  Branch (165:22): [True: 0, False: 792]
  ------------------
  166|      0|            *next = first+1;
  167|    792|        else if (!exact && ++first == t->count) {
  ------------------
  |  Branch (167:18): [True: 0, False: 792]
  |  Branch (167:28): [True: 0, False: 0]
  ------------------
  168|      0|            if (NULL != next)
  ------------------
  |  Branch (168:17): [True: 0, False: 0]
  ------------------
  169|      0|                *next = first;
  170|      0|            first = -1;
  171|      0|        }
  172|  1.58k|    } else if(exact) {
  ------------------
  |  Branch (172:15): [True: 1.58k, False: 0]
  ------------------
  173|  1.58k|        if (NULL != next) {
  ------------------
  |  Branch (173:13): [True: 594, False: 990]
  ------------------
  174|    594|            if (result > 0)
  ------------------
  |  Branch (174:17): [True: 594, False: 0]
  ------------------
  175|    594|                *next = first;
  176|      0|            else
  177|      0|                *next = t->count;
  178|    594|        }
  179|  1.58k|        first = -1;
  180|  1.58k|    }
  181|       |
  182|  2.37k|    return first;
  183|  2.64k|}
container_binary_array.c:netsnmp_binary_array_initialize:
  187|    396|{
  188|    396|    binary_array_table *t;
  189|       |
  190|    396|    t = SNMP_MALLOC_TYPEDEF(binary_array_table);
  ------------------
  |  |   73|    396|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  191|    396|    if (t == NULL)
  ------------------
  |  Branch (191:9): [True: 0, False: 396]
  ------------------
  192|      0|        return NULL;
  193|       |
  194|    396|    t->max_size = 0;
  195|    396|    t->count = 0;
  196|    396|    t->dirty = 0;
  197|    396|    t->data = NULL;
  198|       |
  199|    396|    return t;
  200|    396|}
container_binary_array.c:_ba_free:
  700|    396|{
  701|    396|    netsnmp_binary_array_release(container);
  702|    396|    return 0;
  703|    396|}
container_binary_array.c:_ba_size:
  707|      1|{
  708|      1|    return netsnmp_binary_array_count(container);
  709|      1|}
container_binary_array.c:netsnmp_binary_array_count:
  245|      1|{
  246|      1|    binary_array_table *t = (binary_array_table*)c->container_data;
  247|       |    /*
  248|       |     * return count
  249|       |     */
  250|      1|    return t ? t->count : 0;
  ------------------
  |  Branch (250:12): [True: 1, False: 0]
  ------------------
  251|      1|}
container_binary_array.c:_ba_insert:
  681|    792|{
  682|    792|    return netsnmp_binary_array_insert(container, data);
  683|    792|}
container_binary_array.c:netsnmp_binary_array_insert:
  520|    792|{
  521|    792|    binary_array_table *t = (binary_array_table*)c->container_data;
  522|    792|    const int duplicates_allowed = c->flags & CONTAINER_KEY_ALLOW_DUPLICATES;
  ------------------
  |  |  370|    792|#define CONTAINER_KEY_ALLOW_DUPLICATES             0x00000001
  ------------------
  523|    792|    const int sorted = !(c->flags & CONTAINER_KEY_UNSORTED);
  ------------------
  |  |  371|    792|#define CONTAINER_KEY_UNSORTED                     0x00000002
  ------------------
  524|    792|    int             i = -2;
  525|    792|    size_t          next, pos;
  526|    792|    void           *entry = NETSNMP_REMOVE_CONST(void *, const_entry);
  ------------------
  |  |   91|    792|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  527|       |
  528|    792|    if (NULL == entry)
  ------------------
  |  Branch (528:9): [True: 0, False: 792]
  ------------------
  529|      0|        return -1;
  530|       |
  531|       |    /*
  532|       |     * check key if we have at least 1 item and duplicates aren't allowed
  533|       |     */
  534|    792|    if (!duplicates_allowed && t->count) {
  ------------------
  |  Branch (534:9): [True: 792, False: 0]
  |  Branch (534:32): [True: 726, False: 66]
  ------------------
  535|    726|        i = binary_search(entry, c, 1, &next);
  536|    726|        if (i >= 0) {
  ------------------
  |  Branch (536:13): [True: 0, False: 726]
  ------------------
  537|      0|            DEBUGMSGTL(("container","not inserting duplicate key\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]
  |  |  ------------------
  ------------------
  538|      0|            return -1;
  539|      0|        }
  540|    726|    }
  541|       | 
  542|       |    /*
  543|       |     * if unsorted, just add at the end
  544|       |     */
  545|    792|    if (!sorted) {
  ------------------
  |  Branch (545:9): [True: 0, False: 792]
  ------------------
  546|      0|        pos = t->count;
  547|    792|    } else {
  548|       |        /** if we haven't searched for key yet, do it now */
  549|    792|        if (-2 == i) {
  ------------------
  |  Branch (549:13): [True: 66, False: 726]
  ------------------
  550|     66|            if (0 == t->count) {
  ------------------
  |  Branch (550:17): [True: 66, False: 0]
  ------------------
  551|     66|                next = 0;
  552|     66|                i = -1;
  553|     66|            } else {
  554|      0|                i = binary_search(entry, c, 1, &next);
  555|      0|            }
  556|     66|        }
  557|       |
  558|    792|        pos = next;
  559|       |        /* if key found, advance past any duplicates */
  560|    792|        if (duplicates_allowed && i >= 0)
  ------------------
  |  Branch (560:13): [True: 0, False: 792]
  |  Branch (560:35): [True: 0, False: 0]
  ------------------
  561|      0|            while (pos < t->count && c->compare(t->data[pos], entry) == 0)
  ------------------
  |  Branch (561:20): [True: 0, False: 0]
  |  Branch (561:38): [True: 0, False: 0]
  ------------------
  562|      0|                ++pos;
  563|    792|    }
  564|       |
  565|    792|    return netsnmp_binary_array_insert_before(c, pos, entry, !sorted);
  566|    792|}
container_binary_array.c:netsnmp_binary_array_insert_before:
  475|    792|{
  476|    792|    binary_array_table *t = (binary_array_table*)c->container_data;
  477|       |
  478|    792|    if (NULL == entry)
  ------------------
  |  Branch (478:9): [True: 0, False: 792]
  ------------------
  479|      0|        return -1;
  480|       |
  481|    792|    if (index > t->count) {
  ------------------
  |  Branch (481:9): [True: 0, False: 792]
  ------------------
  482|      0|        DEBUGMSGTL(("container:insert:before", "index out of range\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]
  |  |  ------------------
  ------------------
  483|      0|        return -1;
  484|      0|    }
  485|       |
  486|       |     /*
  487|       |      * check if we need to resize the array
  488|       |      */
  489|    792|    _ba_resize_check(t);
  490|       |
  491|    792|    netsnmp_assert(t->count < t->max_size);
  ------------------
  |  |   47|    792|#      define netsnmp_assert(x)  do { \
  |  |   48|    792|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 792, False: 0]
  |  |  ------------------
  |  |   49|    792|                 ; \
  |  |   50|    792|              else \
  |  |   51|    792|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    792|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 792]
  |  |  ------------------
  ------------------
  492|       |
  493|       |    /*
  494|       |     * shift array
  495|       |     */
  496|    792|    memmove(&t->data[index+1], &t->data[index],
  497|    792|            sizeof(void*) * (t->count - index));
  498|       |
  499|       |    /*
  500|       |     * Insert the new entry into the data array
  501|       |     */
  502|    792|    t->data[index] = NETSNMP_REMOVE_CONST(void *, entry);
  ------------------
  |  |   91|    792|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  503|    792|    ++t->count;
  504|       |
  505|    792|    netsnmp_assert(index < t->count);
  ------------------
  |  |   47|    792|#      define netsnmp_assert(x)  do { \
  |  |   48|    792|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 792, False: 0]
  |  |  ------------------
  |  |   49|    792|                 ; \
  |  |   50|    792|              else \
  |  |   51|    792|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    792|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 792]
  |  |  ------------------
  ------------------
  506|    792|    netsnmp_assert(t->count <= t->max_size);
  ------------------
  |  |   47|    792|#      define netsnmp_assert(x)  do { \
  |  |   48|    792|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 792, False: 0]
  |  |  ------------------
  |  |   49|    792|                 ; \
  |  |   50|    792|              else \
  |  |   51|    792|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    792|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 792]
  |  |  ------------------
  ------------------
  507|       |
  508|    792|    if (dirty)
  ------------------
  |  Branch (508:9): [True: 0, False: 792]
  ------------------
  509|      0|        t->dirty = 1;
  510|       |
  511|    792|    netsnmp_assert(t->dirty || _ba_is_sorted(c));
  ------------------
  |  |   47|    792|#      define netsnmp_assert(x)  do { \
  |  |   48|  2.37k|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 792]
  |  |  |  Branch (48:20): [True: 792, False: 0]
  |  |  ------------------
  |  |   49|    792|                 ; \
  |  |   50|    792|              else \
  |  |   51|    792|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    792|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 792]
  |  |  ------------------
  ------------------
  512|       |
  513|    792|    ++c->sync;
  514|       |
  515|    792|    return 0;
  516|    792|}
container_binary_array.c:_ba_resize_check:
  446|    792|{
  447|    792|    size_t new_max;
  448|    792|    void ** new_data;
  449|    792|    if (t->max_size > t->count)
  ------------------
  |  Branch (449:9): [True: 660, False: 132]
  ------------------
  450|    660|        return 0; /* resize not needed */
  451|       |
  452|       |    /*
  453|       |     * Table is full, so extend it to double the size, or use 10 elements
  454|       |     * if it is empty.
  455|       |     */
  456|    132|    new_max = t->max_size > 0 ? 2 * t->max_size : 10;
  ------------------
  |  Branch (456:15): [True: 66, False: 66]
  ------------------
  457|    132|    new_data = (void**) realloc(t->data, new_max * sizeof(void*));
  458|    132|    if (new_data == NULL) {
  ------------------
  |  Branch (458:9): [True: 0, False: 132]
  ------------------
  459|      0|        snmp_log(LOG_ERR, "malloc failed in _ba_resize_check\n");
  460|      0|        return -1; /* error */
  461|      0|    }
  462|       |
  463|    132|    memset(new_data + t->max_size, 0x0,
  464|    132|           (new_max - t->max_size) * sizeof(void*));
  465|       |
  466|    132|    t->data = new_data;
  467|    132|    t->max_size = new_max;
  468|       |
  469|    132|    return 1; /* resized */
  470|    132|}
container_binary_array.c:_ba_find:
  669|  1.98k|{
  670|  1.98k|    return netsnmp_binary_array_get(container, data, 1);
  671|  1.98k|}
container_binary_array.c:netsnmp_binary_array_get:
  255|  1.98k|{
  256|  1.98k|    binary_array_table *t = (binary_array_table*)c->container_data;
  257|  1.98k|    int             index = 0;
  258|       |
  259|       |    /*
  260|       |     * if there is no data, return NULL;
  261|       |     */
  262|  1.98k|    if (!t->count)
  ------------------
  |  Branch (262:9): [True: 66, False: 1.91k]
  ------------------
  263|     66|        return NULL;
  264|       |
  265|       |    /*
  266|       |     * if the table is dirty, sort it.
  267|       |     */
  268|  1.91k|    if (t->dirty)
  ------------------
  |  Branch (268:9): [True: 0, False: 1.91k]
  ------------------
  269|      0|        Sort_Array(c);
  270|       |
  271|       |    /*
  272|       |     * if there is a key, search. Otherwise default is 0;
  273|       |     */
  274|  1.91k|    if (key) {
  ------------------
  |  Branch (274:9): [True: 1.91k, False: 0]
  ------------------
  275|  1.91k|        if ((index = binary_search(key, c, exact, NULL)) == -1)
  ------------------
  |  Branch (275:13): [True: 1.12k, False: 792]
  ------------------
  276|  1.12k|            return NULL;
  277|    792|        if (!exact &&
  ------------------
  |  Branch (277:13): [True: 0, False: 792]
  ------------------
  278|      0|            c->flags & CONTAINER_KEY_ALLOW_DUPLICATES) {
  ------------------
  |  |  370|      0|#define CONTAINER_KEY_ALLOW_DUPLICATES             0x00000001
  ------------------
  |  Branch (278:13): [True: 0, False: 0]
  ------------------
  279|      0|            int result;
  280|       |
  281|       |            /*
  282|       |             * If duplicates are allowed, we have to be extra
  283|       |             * sure that we didn't just increment to a duplicate,
  284|       |             * thus causing a getnext loop.
  285|       |             */
  286|      0|            result = c->compare(t->data[index], key);
  287|      0|            while (result == 0) {
  ------------------
  |  Branch (287:20): [True: 0, False: 0]
  ------------------
  288|      0|		DEBUGMSGTL(("container","skipping duplicate key in %s\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]
  |  |  ------------------
  ------------------
  289|      0|					    c->container_name));
  290|      0|                if (++index == t->count)
  ------------------
  |  Branch (290:21): [True: 0, False: 0]
  ------------------
  291|      0|                   return NULL;
  292|      0|                result = c->compare(t->data[index], key);
  293|      0|            }
  294|      0|        }
  295|    792|    }
  296|       |
  297|    792|    return t->data[index];
  298|  1.91k|}
container_binary_array.c:_ba_for_each:
  714|     66|{
  715|     66|    netsnmp_binary_array_for_each(container, f, context, 1);
  716|     66|}
container_binary_array.c:netsnmp_binary_array_for_each:
  414|     66|{
  415|     66|    binary_array_table *t = (binary_array_table*)c->container_data;
  416|     66|    size_t             i;
  417|       |
  418|     66|    if (sort && t->dirty)
  ------------------
  |  Branch (418:9): [True: 66, False: 0]
  |  Branch (418:17): [True: 0, False: 66]
  ------------------
  419|      0|        Sort_Array(c);
  420|       |
  421|    858|    for (i = 0; i < t->count; ++i)
  ------------------
  |  Branch (421:17): [True: 792, False: 66]
  ------------------
  422|    792|        (*fe) (t->data[i], context);
  423|     66|}
container_binary_array.c:_ba_clear:
  721|    330|{
  722|    330|    netsnmp_binary_array_clear(container, f, context);
  723|    330|}
container_binary_array.c:netsnmp_binary_array_clear:
  429|    330|{
  430|    330|    binary_array_table *t = (binary_array_table*)c->container_data;
  431|       |
  432|    330|    if( NULL != fe ) {
  ------------------
  |  Branch (432:9): [True: 132, False: 198]
  ------------------
  433|    132|        size_t             i;
  434|       |
  435|    132|        for (i = 0; i < t->count; ++i)
  ------------------
  |  Branch (435:21): [True: 0, False: 132]
  ------------------
  436|      0|            (*fe) (t->data[i], context);
  437|    132|    }
  438|       |
  439|    330|    t->count = 0;
  440|    330|    t->dirty = 0;
  441|    330|    ++c->sync;
  442|    330|}
container_binary_array.c:_ba_options:
  749|    264|{
  750|    264|    return netsnmp_binary_array_options_set(c, set, flags);
  751|    264|}
container_binary_array.c:_ba_iterator_get:
 1008|      1|{
 1009|      1|    binary_array_iterator* it;
 1010|       |
 1011|      1|    if(NULL == c)
  ------------------
  |  Branch (1011:8): [True: 0, False: 1]
  ------------------
 1012|      0|        return NULL;
 1013|       |
 1014|      1|    it = SNMP_MALLOC_TYPEDEF(binary_array_iterator);
  ------------------
  |  |   73|      1|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 1015|      1|    if(NULL == it)
  ------------------
  |  Branch (1015:8): [True: 0, False: 1]
  ------------------
 1016|      0|        return NULL;
 1017|       |
 1018|      1|    it->base.container = c;
 1019|       |    
 1020|      1|    it->base.first = _ba_iterator_first;
 1021|      1|    it->base.next = _ba_iterator_next;
 1022|      1|    it->base.curr = _ba_iterator_curr;
 1023|      1|    it->base.last = _ba_iterator_last;
 1024|      1|    it->base.remove = _ba_iterator_remove;
 1025|      1|    it->base.reset = _ba_iterator_reset;
 1026|      1|    it->base.release = _ba_iterator_release;
 1027|       |
 1028|      1|    (void)_ba_iterator_reset(&it->base);
 1029|       |
 1030|      1|    return &it->base;
 1031|      1|}
container_binary_array.c:_ba_iterator_first:
  919|      1|{
  920|      1|    binary_array_iterator *it = (void *)nit;
  921|       |
  922|      1|    return _ba_iterator_position(it, 0);
  923|      1|}
container_binary_array.c:_ba_iterator_position:
  882|      1|{
  883|      1|    binary_array_table *t = _ba_it2cont(it);
  884|      1|    if (NULL == t)
  ------------------
  |  Branch (884:9): [True: 0, False: 1]
  ------------------
  885|      0|        return t; /* msg already logged */
  886|       |
  887|      1|    if(it->base.container->sync != it->base.sync) {
  ------------------
  |  Branch (887:8): [True: 0, False: 1]
  ------------------
  888|      0|        DEBUGMSGTL(("container:iterator", "out of sync\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]
  |  |  ------------------
  ------------------
  889|      0|        return NULL;
  890|      0|    }
  891|       |    
  892|      1|    if(0 == t->count) {
  ------------------
  |  Branch (892:8): [True: 1, False: 0]
  ------------------
  893|      1|        DEBUGMSGTL(("container:iterator", "empty\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]
  |  |  ------------------
  ------------------
  894|      1|        return NULL;
  895|      1|    }
  896|      0|    else if(pos >= t->count) {
  ------------------
  |  Branch (896:13): [True: 0, False: 0]
  ------------------
  897|      0|        DEBUGMSGTL(("container:iterator", "end of container\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]
  |  |  ------------------
  ------------------
  898|      0|        return NULL;
  899|      0|    }
  900|       |
  901|      0|    return t->data[ pos ];
  902|      1|}
container_binary_array.c:_ba_it2cont:
  863|      2|{
  864|      2|    if(NULL == it) {
  ------------------
  |  Branch (864:8): [True: 0, False: 2]
  ------------------
  865|      0|        netsnmp_assert(NULL != it);
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  866|      0|        return NULL;
  867|      0|    }
  868|      2|    if(NULL == it->base.container) {
  ------------------
  |  Branch (868:8): [True: 0, False: 2]
  ------------------
  869|      0|        netsnmp_assert(NULL != it->base.container);
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  870|      0|        return NULL;
  871|      0|    }
  872|      2|    if(NULL == it->base.container->container_data) {
  ------------------
  |  Branch (872:8): [True: 0, False: 2]
  ------------------
  873|      0|        netsnmp_assert(NULL != it->base.container->container_data);
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  874|      0|        return NULL;
  875|      0|    }
  876|       |
  877|      2|    return (binary_array_table*)(it->base.container->container_data);
  878|      2|}
container_binary_array.c:_ba_iterator_reset:
  976|      1|{
  977|      1|    binary_array_iterator *it = (void *)nit;
  978|      1|    binary_array_table* t = _ba_it2cont(it);
  979|      1|    if(NULL == t) {
  ------------------
  |  Branch (979:8): [True: 0, False: 1]
  ------------------
  980|      0|        netsnmp_assert(NULL != t);
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  981|      0|        return -1;
  982|      0|    }
  983|       |
  984|      1|    if (t->dirty)
  ------------------
  |  Branch (984:9): [True: 0, False: 1]
  ------------------
  985|      0|        Sort_Array(it->base.container);
  986|       |
  987|       |    /*
  988|       |     * save sync count, to make sure container doesn't change while
  989|       |     * iterator is in use.
  990|       |     */
  991|      1|    it->base.sync = it->base.container->sync;
  992|       |
  993|      1|    it->pos = 0;
  994|       |
  995|      1|    return 0;
  996|      1|}
container_binary_array.c:_ba_iterator_release:
 1000|      1|{
 1001|      1|    free(it);
 1002|       |
 1003|      1|    return 0;
 1004|      1|}

netsnmp_container_get_usll:
  386|     66|{
  387|       |    /*
  388|       |     * allocate memory
  389|       |     */
  390|     66|    sl_container *sl = (sl_container *)netsnmp_container_get_ssll();
  391|     66|    if (NULL==sl)
  ------------------
  |  Branch (391:9): [True: 0, False: 66]
  ------------------
  392|      0|        return NULL; /* msg already logged */
  393|       |
  394|     66|    sl->unsorted = 1;
  395|       |
  396|     66|    return (netsnmp_container*)sl;
  397|     66|}
netsnmp_container_get_singly_linked_list:
  401|     66|{
  402|     66|    sl_container *sl = (sl_container *)netsnmp_container_get_usll();
  403|     66|    if (NULL == sl)
  ------------------
  |  Branch (403:9): [True: 0, False: 66]
  ------------------
  404|      0|        return NULL; /* error already logged */
  405|       |
  406|     66|    sl->fifo = fifo;
  407|       |
  408|     66|    return (netsnmp_container *)sl;
  409|     66|}
netsnmp_container_get_fifo:
  413|     66|{
  414|     66|    return netsnmp_container_get_singly_linked_list(1);
  415|     66|}
netsnmp_container_ssll_init:
  419|     66|{
  420|     66|    static netsnmp_factory ssll = {
  421|     66|        "sorted_singly_linked_list",
  422|     66|        netsnmp_container_get_ssll
  423|     66|    };
  424|     66|    static netsnmp_factory usll = {
  425|     66|        "unsorted_singly_linked_list-lifo",
  426|     66|        netsnmp_container_get_usll
  427|     66|    };
  428|     66|    static netsnmp_factory fifo = {
  429|     66|        "unsorted_singly_linked_list-fifo",
  430|     66|        netsnmp_container_get_fifo
  431|     66|    };
  432|       |
  433|     66|    netsnmp_container_register("sorted_singly_linked_list", &ssll);
  434|     66|    netsnmp_container_register("unsorted_singly_linked_list", &usll);
  435|     66|    netsnmp_container_register("lifo", &usll);
  436|     66|    netsnmp_container_register("fifo", &fifo);
  437|     66|}
container_list_ssll.c:netsnmp_container_get_ssll:
  361|     66|{
  362|       |    /*
  363|       |     * allocate memory
  364|       |     */
  365|     66|    sl_container *sl = SNMP_MALLOC_TYPEDEF(sl_container);
  ------------------
  |  |   73|     66|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  366|     66|    if (NULL==sl) {
  ------------------
  |  Branch (366:9): [True: 0, False: 66]
  ------------------
  367|      0|        snmp_log(LOG_ERR, "couldn't allocate memory\n");
  368|      0|        return NULL;
  369|      0|    }
  370|       |
  371|     66|    netsnmp_init_container((netsnmp_container *)sl, NULL, _ssll_free,
  372|     66|                           _ssll_size, NULL, _ssll_insert, _ssll_remove,
  373|     66|                           _ssll_find);
  374|     66|    sl->c.find_next = _ssll_find_next;
  375|     66|    sl->c.get_subset = NULL;
  376|     66|    sl->c.get_iterator =_ssll_iterator_get;
  377|     66|    sl->c.for_each = _ssll_for_each;
  378|     66|    sl->c.clear = _ssll_clear;
  379|     66|    sl->c.duplicate = _ssll_duplicate;
  380|       |
  381|     66|    return &sl->c;
  382|     66|}
container_list_ssll.c:_ssll_free:
  110|     66|{
  111|     66|    if(c) {
  ------------------
  |  Branch (111:8): [True: 66, False: 0]
  ------------------
  112|     66|        free(c);
  113|     66|    }
  114|     66|    return 0;
  115|     66|}
container_list_ssll.c:_ssll_clear:
  287|     66|{
  288|     66|    sl_container *sl = (sl_container*)c;
  289|     66|    sl_node  *curr, *next;
  290|       |    
  291|     66|    if(NULL == c)
  ------------------
  |  Branch (291:8): [True: 0, False: 66]
  ------------------
  292|      0|        return;
  293|       |    
  294|     66|    for(curr = sl->head; curr; curr = next) {
  ------------------
  |  Branch (294:26): [True: 0, False: 66]
  ------------------
  295|       |
  296|      0|        next = curr->next;
  297|       |
  298|      0|        if( NULL != f ) {
  ------------------
  |  Branch (298:13): [True: 0, False: 0]
  ------------------
  299|      0|            curr->next = NULL;
  300|      0|            (*f) ((void *)curr->data, context);
  301|      0|        }
  302|       |
  303|       |        /*
  304|       |         * free our node structure, but not the data
  305|       |         */
  306|      0|        free(curr);
  307|      0|    }
  308|       |    sl->head = NULL;
  309|     66|    sl->count = 0;
  310|     66|    ++c->sync;
  311|     66|}

netsnmp_container_get_null_factory:
  173|     66|{
  174|     66|    static netsnmp_factory f = { "null",
  175|     66|                                 netsnmp_container_get_null};
  176|       |    
  177|     66|    DEBUGMSGTL(("container:null:get_null_factory","in\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  178|     66|    return &f;
  179|     66|}
netsnmp_container_null_init:
  183|     66|{
  184|     66|    netsnmp_container_register("null",
  185|     66|                               netsnmp_container_get_null_factory());
  186|     66|}

netsnmp_free_all_list_data:
   49|    198|{
   50|    198|    netsnmp_data_list *tmpptr;
   51|    198|    for (; head;) {
  ------------------
  |  Branch (51:12): [True: 0, False: 198]
  ------------------
   52|      0|        netsnmp_free_list_data(head);
   53|      0|        tmpptr = head;
   54|      0|        head = head->next;
   55|       |        SNMP_FREE(tmpptr);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
   56|      0|    }
   57|    198|}
shutdown_data_list:
  395|     66|{
  396|     66|    netsnmp_free_all_list_data(saveHead);
  397|     66|}

netsnmp_ds_set_boolean:
  201|    330|{
  202|    330|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|    660|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (202:9): [True: 0, False: 330]
  |  Branch (202:24): [True: 0, False: 330]
  ------------------
  203|    330|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|    330|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (203:2): [True: 0, False: 330]
  |  Branch (203:17): [True: 0, False: 330]
  ------------------
  204|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  205|      0|    }
  206|       |
  207|    330|    DEBUGMSGTL(("netsnmp_ds_set_boolean", "Setting %s:%d = %d/%s\n",
  ------------------
  |  |   66|    330|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    330|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 330]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 330]
  |  |  ------------------
  ------------------
  208|    330|                stores[storeid], which, value, ((value) ? "True" : "False")));
  209|       |
  210|    330|    if (value > 0) {
  ------------------
  |  Branch (210:9): [True: 330, False: 0]
  ------------------
  211|    330|        netsnmp_ds_booleans[storeid][which/8] |= (1 << (which % 8));
  212|    330|    } else {
  213|      0|        netsnmp_ds_booleans[storeid][which/8] &= (0xff7f >> (7 - (which % 8)));
  214|      0|    }
  215|       |
  216|    330|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|    330|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  217|    330|}
netsnmp_ds_get_boolean:
  242|  7.10k|{
  243|  7.10k|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|  14.2k|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (243:9): [True: 0, False: 7.10k]
  |  Branch (243:24): [True: 0, False: 7.10k]
  ------------------
  244|  7.10k|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|  7.10k|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (244:2): [True: 0, False: 7.10k]
  |  Branch (244:17): [True: 0, False: 7.10k]
  ------------------
  245|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  246|      0|    }
  247|       |
  248|  7.10k|    return (netsnmp_ds_booleans[storeid][which/8] & (1 << (which % 8))) ? 1:0;
  ------------------
  |  Branch (248:12): [True: 3.63k, False: 3.47k]
  ------------------
  249|  7.10k|}
netsnmp_ds_set_int:
  253|    132|{
  254|    132|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|    264|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (254:9): [True: 0, False: 132]
  |  Branch (254:24): [True: 0, False: 132]
  ------------------
  255|    132|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|    132|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (255:2): [True: 0, False: 132]
  |  Branch (255:17): [True: 0, False: 132]
  ------------------
  256|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  257|      0|    }
  258|       |
  259|    132|    DEBUGMSGTL(("netsnmp_ds_set_int", "Setting %s:%d = %d\n",
  ------------------
  |  |   66|    132|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    132|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 132]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 132]
  |  |  ------------------
  ------------------
  260|    132|                stores[storeid], which, value));
  261|       |
  262|    132|    netsnmp_ds_integers[storeid][which] = value;
  263|    132|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|    132|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  264|    132|}
netsnmp_ds_get_int:
  268|    596|{
  269|    596|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|  1.19k|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (269:9): [True: 0, False: 596]
  |  Branch (269:24): [True: 0, False: 596]
  ------------------
  270|    596|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|    596|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (270:2): [True: 0, False: 596]
  |  Branch (270:17): [True: 0, False: 596]
  ------------------
  271|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  272|      0|    }
  273|       |
  274|    596|    return netsnmp_ds_integers[storeid][which];
  275|    596|}
netsnmp_ds_set_string:
  279|    265|{
  280|    265|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|    530|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (280:9): [True: 0, False: 265]
  |  Branch (280:24): [True: 0, False: 265]
  ------------------
  281|    265|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|    265|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (281:2): [True: 0, False: 265]
  |  Branch (281:17): [True: 0, False: 265]
  ------------------
  282|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  283|      0|    }
  284|       |
  285|    265|    DEBUGMSGTL(("netsnmp_ds_set_string", "Setting %s:%d = \"%s\"\n",
  ------------------
  |  |   66|    265|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    265|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 265]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 265]
  |  |  ------------------
  ------------------
  286|    265|                stores[storeid], which, (value ? value : "(null)")));
  287|       |
  288|       |    /*
  289|       |     * is some silly person is calling us with our own pointer?
  290|       |     */
  291|    265|    if (netsnmp_ds_strings[storeid][which] == value)
  ------------------
  |  Branch (291:9): [True: 66, False: 199]
  ------------------
  292|     66|        return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  293|       |
  294|    199|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|    199|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 199]
  |  |  ------------------
  ------------------
  295|    199|    if (netsnmp_ds_strings[storeid][which] != NULL) {
  ------------------
  |  Branch (295:9): [True: 0, False: 199]
  ------------------
  296|      0|        free(netsnmp_ds_strings[storeid][which]);
  297|      0|	netsnmp_ds_strings[storeid][which] = NULL;
  298|      0|    }
  299|    199|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|    199|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 199]
  |  |  ------------------
  ------------------
  300|       |
  301|    199|    if (value) {
  ------------------
  |  Branch (301:9): [True: 199, False: 0]
  ------------------
  302|    199|        netsnmp_ds_strings[storeid][which] = strdup(value);
  303|    199|    } else {
  304|      0|        netsnmp_ds_strings[storeid][which] = NULL;
  305|      0|    }
  306|       |
  307|    199|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|    199|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  308|    265|}
netsnmp_ds_get_string:
  312|  1.39k|{
  313|  1.39k|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|  2.78k|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (313:9): [True: 0, False: 1.39k]
  |  Branch (313:24): [True: 0, False: 1.39k]
  ------------------
  314|  1.39k|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|  1.39k|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (314:2): [True: 0, False: 1.39k]
  |  Branch (314:17): [True: 0, False: 1.39k]
  ------------------
  315|      0|        return NULL;
  316|      0|    }
  317|       |
  318|  1.39k|    return netsnmp_ds_strings[storeid][which];
  319|  1.39k|}
netsnmp_ds_register_config:
  447|  2.83k|{
  448|  2.83k|    netsnmp_ds_read_config *drsp;
  449|       |
  450|  2.83k|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS    || 
  ------------------
  |  |   38|  5.67k|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (450:9): [True: 0, False: 2.83k]
  |  Branch (450:24): [True: 0, False: 2.83k]
  ------------------
  451|  2.83k|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS || token == NULL) {
  ------------------
  |  |   39|  5.67k|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (451:2): [True: 0, False: 2.83k]
  |  Branch (451:17): [True: 0, False: 2.83k]
  |  Branch (451:53): [True: 0, False: 2.83k]
  ------------------
  452|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  453|      0|    }
  454|       |
  455|  2.83k|    if (netsnmp_ds_configs == NULL) {
  ------------------
  |  Branch (455:9): [True: 66, False: 2.77k]
  ------------------
  456|     66|        netsnmp_ds_configs = SNMP_MALLOC_TYPEDEF(netsnmp_ds_read_config);
  ------------------
  |  |   73|     66|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  457|     66|        if (netsnmp_ds_configs == NULL)
  ------------------
  |  Branch (457:13): [True: 0, False: 66]
  ------------------
  458|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  459|     66|        drsp = netsnmp_ds_configs;
  460|  2.77k|    } else {
  461|   111k|        for (drsp = netsnmp_ds_configs; drsp->next != NULL; drsp = drsp->next);
  ------------------
  |  Branch (461:41): [True: 109k, False: 2.77k]
  ------------------
  462|  2.77k|        drsp->next = SNMP_MALLOC_TYPEDEF(netsnmp_ds_read_config);
  ------------------
  |  |   73|  2.77k|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  463|  2.77k|        if (drsp->next == NULL)
  ------------------
  |  Branch (463:13): [True: 0, False: 2.77k]
  ------------------
  464|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  465|  2.77k|        drsp = drsp->next;
  466|  2.77k|    }
  467|       |
  468|  2.83k|    drsp->type    = type;
  469|  2.83k|    drsp->ftype   = strdup(ftype);
  470|  2.83k|    drsp->token   = strdup(token);
  471|  2.83k|    drsp->storeid = storeid;
  472|  2.83k|    drsp->which   = which;
  473|       |
  474|  2.83k|    switch (type) {
  ------------------
  |  Branch (474:13): [True: 2.83k, False: 0]
  ------------------
  475|    858|    case ASN_BOOLEAN:
  ------------------
  |  |   72|    858|#define ASN_BOOLEAN	    0x01U
  ------------------
  |  Branch (475:5): [True: 858, False: 1.98k]
  ------------------
  476|    858|        register_config_handler(ftype, token, netsnmp_ds_handle_config, NULL,
  477|    858|                                "(1|yes|true|0|no|false)");
  478|    858|        break;
  479|       |
  480|    528|    case ASN_INTEGER:
  ------------------
  |  |   75|    528|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (480:5): [True: 528, False: 2.31k]
  ------------------
  481|    528|        register_config_handler(ftype, token, netsnmp_ds_handle_config, NULL,
  482|    528|                                "integerValue");
  483|    528|        break;
  484|       |
  485|  1.45k|    case ASN_OCTET_STR:
  ------------------
  |  |   78|  1.45k|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (485:5): [True: 1.45k, False: 1.38k]
  ------------------
  486|  1.45k|        register_config_handler(ftype, token, netsnmp_ds_handle_config, NULL,
  487|  1.45k|                                "string");
  488|  1.45k|        break;
  489|       |
  490|  2.83k|    }
  491|  2.83k|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|  2.83k|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  492|  2.83k|}
netsnmp_ds_register_premib:
  497|  1.51k|{
  498|  1.51k|    netsnmp_ds_read_config *drsp;
  499|       |
  500|  1.51k|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS    || 
  ------------------
  |  |   38|  3.03k|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (500:9): [True: 0, False: 1.51k]
  |  Branch (500:24): [True: 0, False: 1.51k]
  ------------------
  501|  1.51k|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS || token == NULL) {
  ------------------
  |  |   39|  3.03k|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (501:2): [True: 0, False: 1.51k]
  |  Branch (501:17): [True: 0, False: 1.51k]
  |  Branch (501:53): [True: 0, False: 1.51k]
  ------------------
  502|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  503|      0|    }
  504|       |
  505|  1.51k|    if (netsnmp_ds_configs == NULL) {
  ------------------
  |  Branch (505:9): [True: 0, False: 1.51k]
  ------------------
  506|      0|        netsnmp_ds_configs = SNMP_MALLOC_TYPEDEF(netsnmp_ds_read_config);
  ------------------
  |  |   73|      0|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  507|      0|        if (netsnmp_ds_configs == NULL)
  ------------------
  |  Branch (507:13): [True: 0, False: 0]
  ------------------
  508|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  509|      0|        drsp = netsnmp_ds_configs;
  510|  1.51k|    } else {
  511|  29.7k|        for (drsp = netsnmp_ds_configs; drsp->next != NULL; drsp = drsp->next);
  ------------------
  |  Branch (511:41): [True: 28.2k, False: 1.51k]
  ------------------
  512|  1.51k|        drsp->next = SNMP_MALLOC_TYPEDEF(netsnmp_ds_read_config);
  ------------------
  |  |   73|  1.51k|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  513|  1.51k|        if (drsp->next == NULL)
  ------------------
  |  Branch (513:13): [True: 0, False: 1.51k]
  ------------------
  514|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  515|  1.51k|        drsp = drsp->next;
  516|  1.51k|    }
  517|       |
  518|  1.51k|    drsp->type    = type;
  519|  1.51k|    drsp->ftype   = strdup(ftype);
  520|  1.51k|    drsp->token   = strdup(token);
  521|  1.51k|    drsp->storeid = storeid;
  522|  1.51k|    drsp->which   = which;
  523|       |
  524|  1.51k|    switch (type) {
  ------------------
  |  Branch (524:13): [True: 1.51k, False: 0]
  ------------------
  525|  1.12k|    case ASN_BOOLEAN:
  ------------------
  |  |   72|  1.12k|#define ASN_BOOLEAN	    0x01U
  ------------------
  |  Branch (525:5): [True: 1.12k, False: 396]
  ------------------
  526|  1.12k|        register_prenetsnmp_mib_handler(ftype, token, netsnmp_ds_handle_config,
  527|  1.12k|                                        NULL, "(1|yes|true|0|no|false)");
  528|  1.12k|        break;
  529|       |
  530|    264|    case ASN_INTEGER:
  ------------------
  |  |   75|    264|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (530:5): [True: 264, False: 1.25k]
  ------------------
  531|    264|        register_prenetsnmp_mib_handler(ftype, token, netsnmp_ds_handle_config,
  532|    264|                                        NULL, "integerValue");
  533|    264|        break;
  534|       |
  535|    132|    case ASN_OCTET_STR:
  ------------------
  |  |   78|    132|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (535:5): [True: 132, False: 1.38k]
  ------------------
  536|    132|        register_prenetsnmp_mib_handler(ftype, token, netsnmp_ds_handle_config,
  537|    132|                                        NULL, "string");
  538|    132|        break;
  539|       |
  540|  1.51k|    }
  541|  1.51k|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|  1.51k|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  542|  1.51k|}
netsnmp_ds_shutdown:
  546|     66|{
  547|     66|    netsnmp_ds_read_config *drsp;
  548|     66|    int             i, j;
  549|       |
  550|     66|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     66|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 66]
  |  |  ------------------
  ------------------
  551|  4.42k|    for (drsp = netsnmp_ds_configs; drsp; drsp = netsnmp_ds_configs) {
  ------------------
  |  Branch (551:37): [True: 4.35k, False: 66]
  ------------------
  552|  4.35k|        netsnmp_ds_configs = drsp->next;
  553|       |
  554|  4.35k|        if (drsp->ftype && drsp->token) {
  ------------------
  |  Branch (554:13): [True: 4.35k, False: 0]
  |  Branch (554:28): [True: 4.35k, False: 0]
  ------------------
  555|  4.35k|            unregister_config_handler(drsp->ftype, drsp->token);
  556|  4.35k|        }
  557|  4.35k|	if (drsp->ftype != NULL) {
  ------------------
  |  Branch (557:6): [True: 4.35k, False: 0]
  ------------------
  558|  4.35k|	    free(drsp->ftype);
  559|  4.35k|	}
  560|  4.35k|	if (drsp->token != NULL) {
  ------------------
  |  Branch (560:6): [True: 4.35k, False: 0]
  ------------------
  561|  4.35k|	    free(drsp->token);
  562|  4.35k|	}
  563|  4.35k|        free(drsp);
  564|  4.35k|    }
  565|       |
  566|    264|    for (i = 0; i < NETSNMP_DS_MAX_IDS; i++) {
  ------------------
  |  |   38|    264|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (566:17): [True: 198, False: 66]
  ------------------
  567|  12.8k|        for (j = 0; j < NETSNMP_DS_MAX_SUBIDS; j++) {
  ------------------
  |  |   39|  12.8k|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (567:21): [True: 12.6k, False: 198]
  ------------------
  568|  12.6k|            if (netsnmp_ds_strings[i][j] != NULL) {
  ------------------
  |  Branch (568:17): [True: 199, False: 12.4k]
  ------------------
  569|    199|                free(netsnmp_ds_strings[i][j]);
  570|    199|                netsnmp_ds_strings[i][j] = NULL;
  571|    199|            }
  572|  12.6k|        }
  573|    198|    }
  574|     66|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     66|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 66]
  |  |  ------------------
  ------------------
  575|     66|}

netsnmp_large_fd_setfd:
  120|     65|{
  121|     65|    netsnmp_assert(fd >= 0);
  ------------------
  |  |   47|     65|#      define netsnmp_assert(x)  do { \
  |  |   48|     65|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 65, False: 0]
  |  |  ------------------
  |  |   49|     65|                 ; \
  |  |   50|     65|              else \
  |  |   51|     65|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     65|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 65]
  |  |  ------------------
  ------------------
  122|       |
  123|     65|    while (fd >= (int)fdset->lfs_setsize)
  ------------------
  |  Branch (123:12): [True: 0, False: 65]
  ------------------
  124|      0|        netsnmp_large_fd_set_resize(fdset, 2 * (fdset->lfs_setsize + 1));
  125|       |
  126|     65|    LFD_SET(fd, fdset->lfs_setptr);
  127|     65|}
netsnmp_large_fd_clr:
  131|     65|{
  132|     65|    netsnmp_assert(fd >= 0);
  ------------------
  |  |   47|     65|#      define netsnmp_assert(x)  do { \
  |  |   48|     65|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 65, False: 0]
  |  |  ------------------
  |  |   49|     65|                 ; \
  |  |   50|     65|              else \
  |  |   51|     65|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     65|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 65]
  |  |  ------------------
  ------------------
  133|       |
  134|     65|    if ((unsigned)fd < fdset->lfs_setsize)
  ------------------
  |  Branch (134:9): [True: 65, False: 0]
  ------------------
  135|     65|        LFD_CLR(fd, fdset->lfs_setptr);
  136|     65|}
netsnmp_large_fd_is_set:
  140|     65|{
  141|     65|    netsnmp_assert(fd >= 0);
  ------------------
  |  |   47|     65|#      define netsnmp_assert(x)  do { \
  |  |   48|     65|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 65, False: 0]
  |  |  ------------------
  |  |   49|     65|                 ; \
  |  |   50|     65|              else \
  |  |   51|     65|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     65|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 65]
  |  |  ------------------
  ------------------
  142|       |
  143|     65|    return ((unsigned)fd < fdset->lfs_setsize &&
  ------------------
  |  Branch (143:13): [True: 65, False: 0]
  ------------------
  144|     65|            LFD_ISSET(fd, fdset->lfs_setptr));
  ------------------
  |  Branch (144:13): [True: 65, False: 0]
  ------------------
  145|     65|}
netsnmp_large_fd_set_init:
  151|    130|{
  152|    130|    fdset->lfs_setsize = 0;
  153|    130|    fdset->lfs_setptr  = NULL;
  154|       |#if !defined(cygwin) && defined(HAVE_WINSOCK_H)
  155|       |    fdset->lfs_set.fd_count = 0;
  156|       |#endif
  157|    130|    netsnmp_large_fd_set_resize(fdset, setsize);
  158|    130|}
netsnmp_large_fd_set_resize:
  192|    390|{
  193|    390|    int             fd_set_bytes;
  194|       |
  195|    390|    if (fdset->lfs_setsize == setsize)
  ------------------
  |  Branch (195:9): [True: 130, False: 260]
  ------------------
  196|    130|        goto success;
  197|       |
  198|    260|    if (setsize > FD_SETSIZE) {
  ------------------
  |  Branch (198:9): [True: 0, False: 260]
  ------------------
  199|      0|        fd_set_bytes = NETSNMP_FD_SET_BYTES(setsize);
  ------------------
  |  |   99|      0|    (sizeof(fd_set) + ((setsize) > FD_SETSIZE ?                          \
  |  |  ------------------
  |  |  |  Branch (99:24): [True: 0, False: 0]
  |  |  ------------------
  |  |  100|      0|                       NETSNMP_FD_SET_ELEM_COUNT((setsize) - FD_SETSIZE) \
  |  |  ------------------
  |  |  |  |   92|      0|    (setsize + NETSNMP_BITS_PER_FD_MASK - 1) / NETSNMP_BITS_PER_FD_MASK
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|#define NETSNMP_BITS_PER_FD_MASK (8 * NETSNMP_FD_MASK_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   85|      0|#define NETSNMP_FD_MASK_SIZE sizeof(((fd_set*)0)->fds_bits[0])
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   (setsize + NETSNMP_BITS_PER_FD_MASK - 1) / NETSNMP_BITS_PER_FD_MASK
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|#define NETSNMP_BITS_PER_FD_MASK (8 * NETSNMP_FD_MASK_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   85|      0|#define NETSNMP_FD_MASK_SIZE sizeof(((fd_set*)0)->fds_bits[0])
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  101|      0|                       * NETSNMP_FD_MASK_SIZE : 0))
  |  |  ------------------
  |  |  |  |   85|      0|#define NETSNMP_FD_MASK_SIZE sizeof(((fd_set*)0)->fds_bits[0])
  |  |  ------------------
  ------------------
  200|      0|        if (fdset->lfs_setsize > FD_SETSIZE) {
  ------------------
  |  Branch (200:13): [True: 0, False: 0]
  ------------------
  201|      0|            fdset->lfs_setptr = realloc(fdset->lfs_setptr, fd_set_bytes);
  202|      0|            if (!fdset->lfs_setptr)
  ------------------
  |  Branch (202:17): [True: 0, False: 0]
  ------------------
  203|      0|                goto out_of_mem;
  204|      0|        } else {
  205|      0|            fdset->lfs_setptr = malloc(fd_set_bytes);
  206|      0|            if (!fdset->lfs_setptr)
  ------------------
  |  Branch (206:17): [True: 0, False: 0]
  ------------------
  207|      0|                goto out_of_mem;
  208|      0|            *fdset->lfs_setptr = fdset->lfs_set;
  209|      0|        }
  210|    260|    } else {
  211|    260|        if (fdset->lfs_setsize > FD_SETSIZE) {
  ------------------
  |  Branch (211:13): [True: 0, False: 260]
  ------------------
  212|      0|            fdset->lfs_set = *fdset->lfs_setptr;
  213|      0|            free(fdset->lfs_setptr);
  214|      0|        }
  215|    260|        fdset->lfs_setptr = &fdset->lfs_set;
  216|    260|    }
  217|       |
  218|    260|#if defined(cygwin) || !defined(HAVE_WINSOCK_H)
  219|       |    /*
  220|       |     * Unix: when enlarging, clear the file descriptors defined in the
  221|       |     * resized *fdset but that were not defined in the original *fdset.
  222|       |     */
  223|    260|    if ( fdset->lfs_setsize == 0 && setsize == FD_SETSIZE ) {
  ------------------
  |  Branch (223:10): [True: 130, False: 130]
  |  Branch (223:37): [True: 130, False: 0]
  ------------------
  224|       |        /* In this case we can use the OS's FD_ZERO */
  225|    130|        FD_ZERO(fdset->lfs_setptr);
  ------------------
  |  Branch (225:9): [Folded, False: 130]
  ------------------
  226|    130|    } else {
  227|    130|        int             i;
  228|       |
  229|    130|        for (i = fdset->lfs_setsize; i < setsize; i++)
  ------------------
  |  Branch (229:38): [True: 0, False: 130]
  ------------------
  230|      0|            LFD_CLR(i, fdset->lfs_setptr);
  231|    130|    }
  232|    260|#endif
  233|       |
  234|    260|    fdset->lfs_setsize = setsize;
  235|       |#if !defined(cygwin) && defined(HAVE_WINSOCK_H)
  236|       |    if (setsize < fdset->lfs_setptr->fd_count)
  237|       |        fdset->lfs_setptr->fd_count = setsize;
  238|       |#endif
  239|    390|success:
  240|    390|    return 1;
  241|       |
  242|      0|out_of_mem:
  243|      0|    fdset->lfs_setsize = 0;
  244|       |#if !defined(cygwin) && defined(HAVE_WINSOCK_H)
  245|       |    fdset->lfs_setptr->fd_count = 0;
  246|       |#endif
  247|      0|    return 0;
  248|    260|}
netsnmp_large_fd_set_cleanup:
  252|    130|{
  253|    130|    netsnmp_large_fd_set_resize(fdset, 0);
  254|    130|    fdset->lfs_setsize = 0;
  255|       |    fdset->lfs_setptr  = NULL;
  256|    130|}
netsnmp_copy_fd_set_to_large_fd_set:
  261|    130|{
  262|       |    netsnmp_large_fd_set_resize(dst, FD_SETSIZE);
  263|    130|    *dst->lfs_setptr = *src;
  264|    130|}
netsnmp_copy_large_fd_set_to_fd_set:
  269|     65|{
  270|       |    /* Report failure if *src is larger than FD_SETSIZE. */
  271|     65|    if (src->lfs_setsize > FD_SETSIZE) {
  ------------------
  |  Branch (271:9): [True: 0, False: 65]
  ------------------
  272|      0|        FD_ZERO(dst);
  ------------------
  |  Branch (272:9): [Folded, False: 0]
  ------------------
  273|      0|        return -1;
  274|      0|    }
  275|       |
  276|     65|    *dst = *src->lfs_setptr;
  277|       |
  278|     65|#if !(!defined(cygwin) && defined(HAVE_WINSOCK_H))
  279|     65|    {
  280|     65|        int             i;
  281|       |
  282|       |        /* Unix: clear any file descriptors defined in *dst but not in *src. */
  283|     65|        for (i = src->lfs_setsize; i < FD_SETSIZE; ++i)
  ------------------
  |  Branch (283:36): [True: 0, False: 65]
  ------------------
  284|     65|            FD_CLR(i, dst);
  285|     65|    }
  286|     65|#endif
  287|       |
  288|     65|    return 0;
  289|     65|}
large_fd_set.c:LFD_SET:
   95|     65|{
   96|     65|    enum { nfdbits = 8 * sizeof(p->fds_bits[0]) };
   97|     65|    NETSNMP_FD_MASK_TYPE *fds_array = p->fds_bits;
  ------------------
  |  | 1693|     65|#define NETSNMP_FD_MASK_TYPE __fd_mask
  ------------------
   98|       |
   99|     65|    fds_array[n / nfdbits] |= (1ULL << (n % nfdbits));
  100|     65|}
large_fd_set.c:LFD_CLR:
  103|     65|{
  104|     65|    enum { nfdbits = 8 * sizeof(p->fds_bits[0]) };
  105|     65|    NETSNMP_FD_MASK_TYPE *fds_array = p->fds_bits;
  ------------------
  |  | 1693|     65|#define NETSNMP_FD_MASK_TYPE __fd_mask
  ------------------
  106|       |
  107|     65|    fds_array[n / nfdbits] &= ~(1ULL << (n % nfdbits));
  108|     65|}
large_fd_set.c:LFD_ISSET:
  111|     65|{
  112|     65|    enum { nfdbits = 8 * sizeof(p->fds_bits[0]) };
  113|     65|    const NETSNMP_FD_MASK_TYPE *fds_array = p->fds_bits;
  114|       |
  115|     65|    return (fds_array[n / nfdbits] & (1ULL << (n % nfdbits))) != 0;
  116|     65|}

get_enginetime:
   98|      7|{
   99|      7|    int             rval = SNMPERR_SUCCESS;
  ------------------
  |  |  217|      7|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  100|      7|    int             timediff = 0;
  101|      7|    Enginetime      e = NULL;
  102|       |
  103|       |
  104|       |
  105|       |    /*
  106|       |     * Sanity check.
  107|       |     */
  108|      7|    if (!engine_time || !engineboot) {
  ------------------
  |  Branch (108:9): [True: 0, False: 7]
  |  Branch (108:25): [True: 0, False: 7]
  ------------------
  109|      0|        QUITFUN(SNMPERR_GENERR, get_enginetime_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  110|      0|    }
  111|       |
  112|       |
  113|       |    /*
  114|       |     * Compute estimated current engine_time tuple at engineID if
  115|       |     * a record is cached for it.
  116|       |     */
  117|      7|    *engine_time = *engineboot = 0;
  118|       |
  119|      7|    if (!engineID || (engineID_len <= 0)) {
  ------------------
  |  Branch (119:9): [True: 0, False: 7]
  |  Branch (119:22): [True: 0, False: 7]
  ------------------
  120|      0|        QUITFUN(SNMPERR_GENERR, get_enginetime_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  121|      0|    }
  122|       |
  123|      7|    if (!(e = search_enginetime_list(engineID, engineID_len))) {
  ------------------
  |  Branch (123:9): [True: 4, False: 3]
  ------------------
  124|      4|        QUITFUN(SNMPERR_GENERR, get_enginetime_quit);
  ------------------
  |  |  143|      4|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  217|      4|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 4, Folded]
  |  |  ------------------
  |  |  144|      4|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  218|      4|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      4|		goto l ;		\
  |  |  146|      4|	}
  ------------------
  125|      0|    }
  126|      3|#ifdef LCD_TIME_SYNC_OPT
  127|      3|    if (!authenticated || e->authenticatedFlag) {
  ------------------
  |  Branch (127:9): [True: 3, False: 0]
  |  Branch (127:27): [True: 0, False: 0]
  ------------------
  128|      3|#endif
  129|      3|        *engine_time = e->engineTime;
  130|      3|        *engineboot = e->engineBoot;
  131|       |
  132|      3|       timediff = (int) (snmpv3_local_snmpEngineTime() - e->lastReceivedEngineTime);
  133|       |
  134|      3|#ifdef LCD_TIME_SYNC_OPT
  135|      3|    }
  136|      3|#endif
  137|       |
  138|      3|    if (timediff > (int) (ENGINETIME_MAX - *engine_time)) {
  ------------------
  |  |  182|      3|#define ENGINETIME_MAX	2147483647      /* ((2^31)-1) */
  ------------------
  |  Branch (138:9): [True: 0, False: 3]
  ------------------
  139|      0|        *engine_time = (timediff - (ENGINETIME_MAX - *engine_time));
  ------------------
  |  |  182|      0|#define ENGINETIME_MAX	2147483647      /* ((2^31)-1) */
  ------------------
  140|       |
  141|       |        /*
  142|       |         * FIX -- move this check up... should not change anything
  143|       |         * * if engineboot is already locked.  ???
  144|       |         */
  145|      0|        if (*engineboot < ENGINEBOOT_MAX) {
  ------------------
  |  |  183|      0|#define ENGINEBOOT_MAX	2147483647      /* ((2^31)-1) */
  ------------------
  |  Branch (145:13): [True: 0, False: 0]
  ------------------
  146|      0|            *engineboot += 1;
  147|      0|        }
  148|       |
  149|      3|    } else {
  150|      3|        *engine_time += timediff;
  151|      3|    }
  152|       |
  153|      3|    DEBUGMSGTL(("lcd_get_enginetime", "engineID "));
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 3]
  |  |  ------------------
  ------------------
  154|      3|    DEBUGMSGHEX(("lcd_get_enginetime", engineID, engineID_len));
  ------------------
  |  |   71|      3|#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  ------------------
  |  |  |  Branch (71:71): [Folded, False: 3]
  |  |  ------------------
  ------------------
  155|      3|    DEBUGMSG(("lcd_get_enginetime", ": boots=%d, time=%d\n", *engineboot,
  ------------------
  |  |   61|      3|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 3]
  |  |  ------------------
  ------------------
  156|      3|              *engine_time));
  157|       |
  158|      7|  get_enginetime_quit:
  159|      7|    return rval;
  160|       |
  161|      3|}                               /* end get_enginetime() */
free_etimelist:
  295|     66|{
  296|     66|     int index = 0;
  297|     66|     Enginetime e = NULL;
  298|     66|     Enginetime nextE = NULL;
  299|       |
  300|  1.58k|     for( ; index < ETIMELIST_SIZE; ++index)
  ------------------
  |  |   21|  1.58k|#define ETIMELIST_SIZE	23
  ------------------
  |  Branch (300:13): [True: 1.51k, False: 66]
  ------------------
  301|  1.51k|     {
  302|  1.51k|           e = etimelist[index];
  303|       |
  304|  1.58k|           while(e != NULL)
  ------------------
  |  Branch (304:18): [True: 66, False: 1.51k]
  ------------------
  305|     66|           {
  306|     66|                 nextE = e->next;
  307|     66|                 SNMP_FREE(e->engineID);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  308|     66|                 SNMP_FREE(e);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  309|     66|                 e = nextE;
  310|     66|           }
  311|       |
  312|       |           etimelist[index] = NULL;
  313|  1.51k|     }
  314|     66|     return;
  315|     66|}
set_enginetime:
  344|     66|{
  345|     66|    int             rval = SNMPERR_SUCCESS, iindex;
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  346|     66|    Enginetime      e = NULL;
  347|       |
  348|       |
  349|       |
  350|       |    /*
  351|       |     * Sanity check.
  352|       |     */
  353|     66|    if (!engineID || (engineID_len <= 0)) {
  ------------------
  |  Branch (353:9): [True: 0, False: 66]
  |  Branch (353:22): [True: 0, False: 66]
  ------------------
  354|      0|        return rval;
  355|      0|    }
  356|       |
  357|       |
  358|       |    /*
  359|       |     * Store the given <engine_time, engineboot> tuple in the record
  360|       |     * for engineID.  Create a new record if necessary.
  361|       |     */
  362|     66|    if (!(e = search_enginetime_list(engineID, engineID_len))) {
  ------------------
  |  Branch (362:9): [True: 66, False: 0]
  ------------------
  363|     66|        if ((iindex = hash_engineID(engineID, engineID_len)) < 0) {
  ------------------
  |  Branch (363:13): [True: 0, False: 66]
  ------------------
  364|      0|            QUITFUN(SNMPERR_GENERR, set_enginetime_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  365|      0|        }
  366|       |
  367|     66|        e = calloc(1, sizeof(*e));
  368|       |
  369|     66|        e->next = etimelist[iindex];
  370|     66|        etimelist[iindex] = e;
  371|       |
  372|     66|        e->engineID = calloc(1, engineID_len);
  373|     66|        memcpy(e->engineID, engineID, engineID_len);
  374|       |
  375|     66|        e->engineID_len = engineID_len;
  376|     66|    }
  377|     66|#ifdef LCD_TIME_SYNC_OPT
  378|     66|    if (authenticated || !e->authenticatedFlag) {
  ------------------
  |  Branch (378:9): [True: 66, False: 0]
  |  Branch (378:26): [True: 0, False: 0]
  ------------------
  379|     66|        e->authenticatedFlag = authenticated;
  380|       |#else
  381|       |    if (authenticated) {
  382|       |#endif
  383|     66|        e->engineTime = engine_time;
  384|     66|        e->engineBoot = engineboot;
  385|     66|        e->lastReceivedEngineTime = snmpv3_local_snmpEngineTime();
  386|     66|    }
  387|       |
  388|     66|    e = NULL;                   /* Indicates a successful update. */
  389|       |
  390|     66|    DEBUGMSGTL(("lcd_set_enginetime", "engineID "));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  391|     66|    DEBUGMSGHEX(("lcd_set_enginetime", engineID, engineID_len));
  ------------------
  |  |   71|     66|#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  ------------------
  |  |  |  Branch (71:71): [Folded, False: 66]
  |  |  ------------------
  ------------------
  392|     66|    DEBUGMSG(("lcd_set_enginetime", ": boots=%d, time=%d\n", engineboot,
  ------------------
  |  |   61|     66|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 66]
  |  |  ------------------
  ------------------
  393|     66|              engine_time));
  394|       |
  395|     66|  set_enginetime_quit:
  396|     66|    SNMP_FREE(e);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  397|       |
  398|     66|    return rval;
  399|       |
  400|     66|}                               /* end set_enginetime() */
search_enginetime_list:
  423|     73|{
  424|     73|    int             rval = SNMPERR_SUCCESS;
  ------------------
  |  |  217|     73|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  425|     73|    Enginetime      e = NULL;
  426|       |
  427|       |
  428|       |    /*
  429|       |     * Sanity check.
  430|       |     */
  431|     73|    if (!engineID || (engineID_len <= 0)) {
  ------------------
  |  Branch (431:9): [True: 0, False: 73]
  |  Branch (431:22): [True: 0, False: 73]
  ------------------
  432|      0|        QUITFUN(SNMPERR_GENERR, search_enginetime_list_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  433|      0|    }
  434|       |
  435|       |
  436|       |    /*
  437|       |     * Find the entry for engineID if there be one.
  438|       |     */
  439|     73|    rval = hash_engineID(engineID, engineID_len);
  440|     73|    if (rval < 0) {
  ------------------
  |  Branch (440:9): [True: 0, False: 73]
  ------------------
  441|      0|        QUITFUN(SNMPERR_GENERR, search_enginetime_list_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  442|      0|    }
  443|     73|    e = etimelist[rval];
  444|       |
  445|     73|    for ( /*EMPTY*/; e; e = e->next) {
  ------------------
  |  Branch (445:22): [True: 3, False: 70]
  ------------------
  446|      3|        if ((engineID_len == e->engineID_len)
  ------------------
  |  Branch (446:13): [True: 3, False: 0]
  ------------------
  447|      3|            && !memcmp(e->engineID, engineID, engineID_len)) {
  ------------------
  |  Branch (447:16): [True: 3, False: 0]
  ------------------
  448|      3|            break;
  449|      3|        }
  450|      3|    }
  451|       |
  452|       |
  453|     73|  search_enginetime_list_quit:
  454|     73|    return e;
  455|       |
  456|     73|}                               /* end search_enginetime_list() */
hash_engineID:
  481|    139|{
  482|    139|    int             rval = SNMPERR_GENERR;
  ------------------
  |  |  218|    139|#define SNMPERR_GENERR			(-1)
  ------------------
  483|    139|    size_t          buf_len = SNMP_MAXBUF;
  ------------------
  |  |   43|    139|#define SNMP_MAXBUF		(1024 * 4)
  ------------------
  484|    139|    u_int           additive = 0;
  485|    139|    u_char         *bufp, buf[SNMP_MAXBUF];
  486|    139|    void           *context = NULL;
  487|       |
  488|       |
  489|       |
  490|       |    /*
  491|       |     * Sanity check.
  492|       |     */
  493|    139|    if (!engineID || (engineID_len <= 0)) {
  ------------------
  |  Branch (493:9): [True: 0, False: 139]
  |  Branch (493:22): [True: 0, False: 139]
  ------------------
  494|      0|        QUITFUN(SNMPERR_GENERR, hash_engineID_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  495|      0|    }
  496|       |
  497|       |
  498|       |    /*
  499|       |     * Hash engineID into a list index.
  500|       |     */
  501|    139|#ifndef NETSNMP_DISABLE_MD5
  502|    139|    rval = sc_hash(usmHMACMD5AuthProtocol,
  503|    139|                   OID_LENGTH(usmHMACMD5AuthProtocol),
  ------------------
  |  |   64|    139|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|    139|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  504|    139|                   engineID, engineID_len, buf, &buf_len);
  505|    139|    if (rval == SNMPERR_SC_NOT_CONFIGURED) {
  ------------------
  |  |  256|    139|#define SNMPERR_SC_NOT_CONFIGURED	(-39)
  ------------------
  |  Branch (505:9): [True: 0, False: 139]
  ------------------
  506|       |        /* fall back to sha1 */
  507|      0|        rval = sc_hash(usmHMACSHA1AuthProtocol,
  508|      0|                   OID_LENGTH(usmHMACSHA1AuthProtocol),
  ------------------
  |  |   64|      0|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      0|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  509|      0|                   engineID, engineID_len, buf, &buf_len);
  510|      0|    }
  511|       |#else
  512|       |    rval = sc_hash(usmHMACSHA1AuthProtocol,
  513|       |                   OID_LENGTH(usmHMACSHA1AuthProtocol),
  514|       |                   engineID, engineID_len, buf, &buf_len);
  515|       |#endif
  516|    139|    QUITFUN(rval, hash_engineID_quit);
  ------------------
  |  |  143|    139|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  217|    139|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, False: 139]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  517|       |
  518|    695|    for (bufp = buf; (bufp - buf) < (int) buf_len; bufp += 4) {
  ------------------
  |  Branch (518:22): [True: 556, False: 139]
  ------------------
  519|    556|        additive += (u_int) * bufp;
  520|    556|    }
  521|       |
  522|    139|  hash_engineID_quit:
  523|    139|    SNMP_FREE(context);
  ------------------
  |  |   62|    139|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 139]
  |  |  |  Branch (62:66): [Folded, False: 139]
  |  |  ------------------
  ------------------
  524|    139|    memset(buf, 0, SNMP_MAXBUF);
  ------------------
  |  |   43|    139|#define SNMP_MAXBUF		(1024 * 4)
  ------------------
  525|       |
  526|    139|    return (rval < 0) ? rval : (int)(additive % ETIMELIST_SIZE);
  ------------------
  |  |   21|    139|#define ETIMELIST_SIZE	23
  ------------------
  |  Branch (526:12): [True: 0, False: 139]
  ------------------
  527|       |
  528|    139|}                               /* end hash_engineID() */

register_mib_handlers:
 2452|     66|{
 2453|     66|#ifndef NETSNMP_DISABLE_MIB_LOADING
 2454|     66|    register_prenetsnmp_mib_handler("snmp", "mibdirs",
 2455|     66|                                    handle_mibdirs_conf, NULL,
 2456|     66|                                    "[mib-dirs|+mib-dirs|-mib-dirs]");
 2457|     66|    register_prenetsnmp_mib_handler("snmp", "mibs",
 2458|     66|                                    handle_mibs_conf, NULL,
 2459|     66|                                    "[mib-tokens|+mib-tokens|-mib-tokens]");
 2460|     66|    register_config_handler("snmp", "mibfile",
 2461|     66|                            handle_mibfile_conf, NULL, "mibfile-to-read");
 2462|       |    /*
 2463|       |     * register the snmp.conf configuration handlers for default
 2464|       |     * parsing behaviour 
 2465|       |     */
 2466|       |
 2467|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "showMibErrors",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2468|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_ERRORS);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_ERRORS);
  ------------------
  |  |   59|     66|#define NETSNMP_DS_LIB_MIB_ERRORS          0
  ------------------
 2469|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "commentToEOL",     /* Describes actual behaviour */
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2470|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_COMMENT_TERM);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_COMMENT_TERM);
  ------------------
  |  |   61|     66|#define NETSNMP_DS_LIB_MIB_COMMENT_TERM    2
  ------------------
 2471|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "strictCommentTerm",    /* Backward compatibility */
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2472|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_COMMENT_TERM);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_COMMENT_TERM);
  ------------------
  |  |   61|     66|#define NETSNMP_DS_LIB_MIB_COMMENT_TERM    2
  ------------------
 2473|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "mibAllowUnderline",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2474|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_PARSE_LABEL);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_PARSE_LABEL);
  ------------------
  |  |   62|     66|#define NETSNMP_DS_LIB_MIB_PARSE_LABEL     3
  ------------------
 2475|     66|    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "mibWarningLevel",
  ------------------
  |  |   75|     66|#define ASN_INTEGER	    0x02U
  ------------------
 2476|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_WARNINGS);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_WARNINGS);
  ------------------
  |  |  114|     66|#define NETSNMP_DS_LIB_MIB_WARNINGS         0
  ------------------
 2477|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "mibReplaceWithLatest",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2478|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_REPLACE);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_REPLACE);
  ------------------
  |  |   67|     66|#define NETSNMP_DS_LIB_MIB_REPLACE         7    /* replace objects from latest module */
  ------------------
 2479|     66|#endif
 2480|       |
 2481|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "printNumericEnums",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2482|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM);
  ------------------
  |  |   68|     66|#define NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM  8    /* print only numeric enum values */
  ------------------
 2483|     66|    register_prenetsnmp_mib_handler("snmp", "printNumericOids",
 2484|     66|                       handle_print_numeric, NULL, "(1|yes|true|0|no|false)");
 2485|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "escapeQuotes",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2486|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_ESCAPE_QUOTES);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_ESCAPE_QUOTES);
  ------------------
  |  |   79|     66|#define NETSNMP_DS_LIB_ESCAPE_QUOTES       19   /* shell escape quote marks in oids */
  ------------------
 2487|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "dontBreakdownOids",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2488|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS);
  ------------------
  |  |   70|     66|#define NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS 10   /* dont print oid indexes specially */
  ------------------
 2489|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "quickPrinting",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2490|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT);
  ------------------
  |  |   73|     66|#define NETSNMP_DS_LIB_QUICK_PRINT         13   /* print very brief output for parsing */
  ------------------
 2491|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "numericTimeticks",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2492|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NUMERIC_TIMETICKS);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NUMERIC_TIMETICKS);
  ------------------
  |  |   78|     66|#define NETSNMP_DS_LIB_NUMERIC_TIMETICKS   18   /* print timeticks as a number */
  ------------------
 2493|     66|    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "oidOutputFormat",
  ------------------
  |  |   75|     66|#define ASN_INTEGER	    0x02U
  ------------------
 2494|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
  ------------------
  |  |  118|     66|#define NETSNMP_DS_LIB_OID_OUTPUT_FORMAT    4
  ------------------
 2495|     66|    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "suffixPrinting",
  ------------------
  |  |   75|     66|#define ASN_INTEGER	    0x02U
  ------------------
 2496|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
  ------------------
  |  |  118|     66|#define NETSNMP_DS_LIB_OID_OUTPUT_FORMAT    4
  ------------------
 2497|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "extendedIndex",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2498|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_EXTENDED_INDEX);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_EXTENDED_INDEX);
  ------------------
  |  |   82|     66|#define NETSNMP_DS_LIB_EXTENDED_INDEX	   22   /* print extended index format [x1][x2] */
  ------------------
 2499|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "printHexText",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2500|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_HEX_TEXT);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_HEX_TEXT);
  ------------------
  |  |   83|     66|#define NETSNMP_DS_LIB_PRINT_HEX_TEXT      23   /* print ASCII text along with hex strings */
  ------------------
 2501|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "printValueOnly",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2502|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_BARE_VALUE);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_BARE_VALUE);
  ------------------
  |  |   81|     66|#define NETSNMP_DS_LIB_PRINT_BARE_VALUE	   21   /* just print value (not OID = value) */
  ------------------
 2503|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "dontPrintUnits",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2504|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_PRINT_UNITS);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_PRINT_UNITS);
  ------------------
  |  |   89|     66|#define NETSNMP_DS_LIB_DONT_PRINT_UNITS    29 /* don't print UNITS suffix */
  ------------------
 2505|     66|    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "hexOutputLength",
  ------------------
  |  |   75|     66|#define ASN_INTEGER	    0x02U
  ------------------
 2506|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH);
  ------------------
  |  |  121|     66|#define NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH    6
  ------------------
 2507|     66|}
netsnmp_set_mib_directory:
 2522|     66|{
 2523|     66|    const char *newdir;
 2524|     66|    char *olddir, *tmpdir = NULL;
 2525|       |
 2526|     66|    DEBUGTRACE;
  ------------------
  |  |   63|     66|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 2527|     66|    if (NULL == dir) {
  ------------------
  |  Branch (2527:9): [True: 0, False: 66]
  ------------------
 2528|      0|        return;
 2529|      0|    }
 2530|       |    
 2531|     66|    olddir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 2532|     66|				   NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|     66|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2533|     66|    if (olddir) {
  ------------------
  |  Branch (2533:9): [True: 66, False: 0]
  ------------------
 2534|     66|        if ((*dir == '+') || (*dir == '-')) {
  ------------------
  |  Branch (2534:13): [True: 0, False: 66]
  |  Branch (2534:30): [True: 0, False: 66]
  ------------------
 2535|       |            /** New dir starts with '+', thus we add it. */
 2536|      0|            tmpdir = (char *)malloc(strlen(dir) + strlen(olddir) + 2);
 2537|      0|            if (!tmpdir) {
  ------------------
  |  Branch (2537:17): [True: 0, False: 0]
  ------------------
 2538|      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]
  |  |  ------------------
  ------------------
 2539|      0|                return;
 2540|      0|            }
 2541|      0|            if (*dir++ == '+')
  ------------------
  |  Branch (2541:17): [True: 0, False: 0]
  ------------------
 2542|      0|                sprintf(tmpdir, "%s%c%s", olddir, ENV_SEPARATOR_CHAR, dir);
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 2543|      0|            else
 2544|      0|                sprintf(tmpdir, "%s%c%s", dir, ENV_SEPARATOR_CHAR, olddir);
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 2545|      0|            newdir = tmpdir;
 2546|     66|        } else {
 2547|     66|            newdir = dir;
 2548|     66|        }
 2549|     66|    } else {
 2550|       |        /** If dir starts with '+' skip '+' it. */
 2551|      0|        newdir = ((*dir == '+') ? ++dir : dir);
  ------------------
  |  Branch (2551:19): [True: 0, False: 0]
  ------------------
 2552|      0|    }
 2553|     66|    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS,
  ------------------
  |  |  162|     66|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2554|     66|                          newdir);
 2555|       |
 2556|       |    /** set_string calls strdup, so if we allocated memory, free it */
 2557|     66|    if (tmpdir == newdir) {
  ------------------
  |  Branch (2557:9): [True: 0, False: 66]
  ------------------
 2558|       |        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]
  |  |  ------------------
  ------------------
 2559|      0|    }
 2560|     66|}
netsnmp_get_mib_directory:
 2577|    133|{
 2578|    133|    char *dir;
 2579|       |
 2580|    133|    DEBUGTRACE;
  ------------------
  |  |   63|    133|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    133|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 133]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 133]
  |  |  ------------------
  ------------------
 2581|    133|    dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |   48|    133|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|    133|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2582|    133|    if (dir == NULL) {
  ------------------
  |  Branch (2582:9): [True: 0, False: 133]
  ------------------
 2583|      0|        DEBUGMSGTL(("get_mib_directory", "no mib directories set\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]
  |  |  ------------------
  ------------------
 2584|       |
 2585|       |        /** Check if the environment variable is set */
 2586|      0|        dir = netsnmp_getenv("MIBDIRS");
 2587|      0|        if (dir == NULL) {
  ------------------
  |  Branch (2587:13): [True: 0, False: 0]
  ------------------
 2588|      0|            DEBUGMSGTL(("get_mib_directory", "no 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]
  |  |  ------------------
  ------------------
 2589|       |            /** Not set use hard coded path */
 2590|      0|            if (confmibdir == NULL) {
  ------------------
  |  Branch (2590:17): [True: 0, False: 0]
  ------------------
 2591|      0|                DEBUGMSGTL(("get_mib_directory", "no 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]
  |  |  ------------------
  ------------------
 2592|      0|                netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1641|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2593|      0|            }
 2594|      0|            else if ((*confmibdir == '+') || (*confmibdir == '-')) {
  ------------------
  |  Branch (2594:22): [True: 0, False: 0]
  |  Branch (2594:46): [True: 0, False: 0]
  ------------------
 2595|      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]
  |  |  ------------------
  ------------------
 2596|      0|                netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1641|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2597|      0|                netsnmp_set_mib_directory(confmibdir);
 2598|      0|            }
 2599|      0|            else {
 2600|      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]
  |  |  ------------------
  ------------------
 2601|      0|                netsnmp_set_mib_directory(confmibdir);
 2602|      0|            }
 2603|      0|        } else if ((*dir == '+') || (*dir == '-')) {
  ------------------
  |  Branch (2603:20): [True: 0, False: 0]
  |  Branch (2603:37): [True: 0, False: 0]
  ------------------
 2604|      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]
  |  |  ------------------
  ------------------
 2605|      0|            netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1641|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2606|      0|            netsnmp_set_mib_directory(dir);
 2607|      0|        } else {
 2608|      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]
  |  |  ------------------
  ------------------
 2609|      0|            netsnmp_set_mib_directory(dir);
 2610|      0|        }
 2611|      0|        dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                      dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|      0|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2612|      0|    }
 2613|    133|    DEBUGMSGTL(("get_mib_directory", "mib directories set '%s'\n", dir));
  ------------------
  |  |   66|    133|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    133|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 133]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 133]
  |  |  ------------------
  ------------------
 2614|    133|    return(dir);
 2615|    133|}
netsnmp_fixup_mib_directory:
 2624|     66|{
 2625|     66|    const char *homepath = netsnmp_gethomedir();
 2626|     66|    char *mibpath = netsnmp_get_mib_directory();
 2627|     66|    char *oldmibpath = NULL;
 2628|     66|    char *ptr_home;
 2629|     66|    char *new_mibpath;
 2630|       |
 2631|     66|    DEBUGTRACE;
  ------------------
  |  |   63|     66|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 2632|     66|    if (homepath && mibpath) {
  ------------------
  |  Branch (2632:9): [True: 66, False: 0]
  |  Branch (2632:21): [True: 66, False: 0]
  ------------------
 2633|     66|        DEBUGMSGTL(("fixup_mib_directory", "mib directories '%s'\n", mibpath));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 2634|     66|        while ((ptr_home = strstr(mibpath, "$HOME"))) {
  ------------------
  |  Branch (2634:16): [True: 0, False: 66]
  ------------------
 2635|      0|            new_mibpath = (char *)malloc(strlen(mibpath) - strlen("$HOME") +
 2636|      0|					 strlen(homepath)+1);
 2637|      0|            if (new_mibpath) {
  ------------------
  |  Branch (2637:17): [True: 0, False: 0]
  ------------------
 2638|      0|                *ptr_home = 0; /* null out the spot where we stop copying */
 2639|      0|                sprintf(new_mibpath, "%s%s%s", mibpath, homepath,
 2640|      0|			ptr_home + strlen("$HOME"));
 2641|       |                /** swap in the new value and repeat */
 2642|      0|                mibpath = new_mibpath;
 2643|      0|		if (oldmibpath != NULL) {
  ------------------
  |  Branch (2643:7): [True: 0, False: 0]
  ------------------
 2644|      0|		    SNMP_FREE(oldmibpath);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2645|      0|		}
 2646|      0|		oldmibpath = new_mibpath;
 2647|      0|            } else {
 2648|      0|                break;
 2649|      0|            }
 2650|      0|        }
 2651|       |
 2652|     66|        netsnmp_set_mib_directory(mibpath);
 2653|       |	
 2654|       |	/*  The above copies the mibpath for us, so...  */
 2655|       |
 2656|     66|	if (oldmibpath != NULL) {
  ------------------
  |  Branch (2656:6): [True: 0, False: 66]
  ------------------
 2657|      0|	    SNMP_FREE(oldmibpath);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2658|      0|	}
 2659|       |
 2660|     66|    }
 2661|       |
 2662|     66|}
netsnmp_init_mib:
 2671|     66|{
 2672|     66|    const char     *prefix;
 2673|     66|    char           *env_var, *entry;
 2674|     66|    PrefixListPtr   pp = &mib_prefixes[0];
 2675|     66|    char           *st = NULL;
 2676|       |
 2677|     66|    if (Mib)
  ------------------
  |  Branch (2677:9): [True: 0, False: 66]
  ------------------
 2678|      0|        return;
 2679|     66|    netsnmp_init_mib_internals();
 2680|       |
 2681|       |    /*
 2682|       |     * Initialise the MIB directory/ies 
 2683|       |     */
 2684|     66|    netsnmp_fixup_mib_directory();
 2685|     66|    env_var = strdup(netsnmp_get_mib_directory());
 2686|     66|    if (!env_var)
  ------------------
  |  Branch (2686:9): [True: 0, False: 66]
  ------------------
 2687|      0|        return;
 2688|       |
 2689|     66|    DEBUGMSGTL(("init_mib",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 2690|     66|                "Seen MIBDIRS: Looking in '%s' for mib dirs ...\n",
 2691|     66|                env_var));
 2692|       |
 2693|     66|    entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|     66|#define ENV_SEPARATOR ":"
  ------------------
 2694|    132|    while (entry) {
  ------------------
  |  Branch (2694:12): [True: 66, False: 66]
  ------------------
 2695|     66|        add_mibdir(entry);
 2696|     66|        entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|     66|#define ENV_SEPARATOR ":"
  ------------------
 2697|     66|    }
 2698|     66|    SNMP_FREE(env_var);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2699|       |
 2700|     66|    env_var = netsnmp_getenv("MIBFILES");
 2701|     66|    if (env_var != NULL) {
  ------------------
  |  Branch (2701:9): [True: 0, False: 66]
  ------------------
 2702|      0|        if (*env_var == '+')
  ------------------
  |  Branch (2702:13): [True: 0, False: 0]
  ------------------
 2703|      0|            entry = strtok_r(env_var+1, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2704|      0|        else
 2705|      0|            entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2706|      0|        while (entry) {
  ------------------
  |  Branch (2706:16): [True: 0, False: 0]
  ------------------
 2707|      0|            add_mibfile(entry, NULL);
 2708|      0|            entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2709|      0|        }
 2710|      0|    }
 2711|       |
 2712|     66|    netsnmp_init_mib_internals();
 2713|       |
 2714|       |    /*
 2715|       |     * Read in any modules or mibs requested 
 2716|       |     */
 2717|       |
 2718|     66|    env_var = netsnmp_getenv("MIBS");
 2719|     66|    if (env_var == NULL) {
  ------------------
  |  Branch (2719:9): [True: 66, False: 0]
  ------------------
 2720|     66|        if (confmibs != NULL)
  ------------------
  |  Branch (2720:13): [True: 0, False: 66]
  ------------------
 2721|      0|            env_var = strdup(confmibs);
 2722|     66|        else
 2723|     66|            env_var = strdup(NETSNMP_DEFAULT_MIBS);
  ------------------
  |  | 1982|     66|#define NETSNMP_DEFAULT_MIBS ":NET-SNMP-EXTEND-MIB:SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:HOST-RESOURCES-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB:NET-SNMP-PERIODIC-NOTIFY-MIB:DISMAN-NSLOOKUP-MIB:DISMAN-PING-MIB:DISMAN-TRACEROUTE-MIB:EtherLike-MIB:NET-SNMP-EXAMPLES-MIB:HOST-RESOURCES-TYPES:IP-FORWARD-MIB:MTA-MIB:NETWORK-SERVICES-MIB:UCD-IPFWACC-MIB:RMON-MIB:SCTP-MIB:SNMP-USM-DH-OBJECTS-MIB:SNMP-TLS-TM-MIB:SNMP-TSM-MIB:TUNNEL-MIB:IPV6-FLOW-LABEL-MIB:UCD-DISKIO-MIB:UCD-SNMP-MIB:UCD-DEMO-MIB:SNMP-TARGET-MIB:NET-SNMP-AGENT-MIB:SNMP-NOTIFICATION-MIB:NET-SNMP-PASS-MIB:SNMP-FRAMEWORK-MIB:SNMP-MPD-MIB:SNMP-USER-BASED-SM-MIB:SNMP-VIEW-BASED-ACM-MIB:SNMP-COMMUNITY-MIB:IPV6-ICMP-MIB:IPV6-MIB:IPV6-TCP-MIB:IPV6-UDP-MIB:UCD-DLMOD-MIB:SNMPv2-TM:NET-SNMP-VACM-MIB"
  ------------------
 2724|     66|    } else {
 2725|      0|        env_var = strdup(env_var);
 2726|      0|    }
 2727|     66|    if (env_var && ((*env_var == '+') || (*env_var == '-'))) {
  ------------------
  |  Branch (2727:9): [True: 66, False: 0]
  |  Branch (2727:21): [True: 0, False: 66]
  |  Branch (2727:42): [True: 0, False: 66]
  ------------------
 2728|      0|        int res;
 2729|       |
 2730|      0|        if (*env_var == '+')
  ------------------
  |  Branch (2730:13): [True: 0, False: 0]
  ------------------
 2731|      0|            res = asprintf(&entry, "%s%c%s", NETSNMP_DEFAULT_MIBS,
  ------------------
  |  | 1982|      0|#define NETSNMP_DEFAULT_MIBS ":NET-SNMP-EXTEND-MIB:SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:HOST-RESOURCES-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB:NET-SNMP-PERIODIC-NOTIFY-MIB:DISMAN-NSLOOKUP-MIB:DISMAN-PING-MIB:DISMAN-TRACEROUTE-MIB:EtherLike-MIB:NET-SNMP-EXAMPLES-MIB:HOST-RESOURCES-TYPES:IP-FORWARD-MIB:MTA-MIB:NETWORK-SERVICES-MIB:UCD-IPFWACC-MIB:RMON-MIB:SCTP-MIB:SNMP-USM-DH-OBJECTS-MIB:SNMP-TLS-TM-MIB:SNMP-TSM-MIB:TUNNEL-MIB:IPV6-FLOW-LABEL-MIB:UCD-DISKIO-MIB:UCD-SNMP-MIB:UCD-DEMO-MIB:SNMP-TARGET-MIB:NET-SNMP-AGENT-MIB:SNMP-NOTIFICATION-MIB:NET-SNMP-PASS-MIB:SNMP-FRAMEWORK-MIB:SNMP-MPD-MIB:SNMP-USER-BASED-SM-MIB:SNMP-VIEW-BASED-ACM-MIB:SNMP-COMMUNITY-MIB:IPV6-ICMP-MIB:IPV6-MIB:IPV6-TCP-MIB:IPV6-UDP-MIB:UCD-DLMOD-MIB:SNMPv2-TM:NET-SNMP-VACM-MIB"
  ------------------
 2732|      0|                           ENV_SEPARATOR_CHAR, env_var + 1);
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 2733|      0|        else
 2734|      0|            res = asprintf(&entry, "%s%c%s", env_var + 1, ENV_SEPARATOR_CHAR,
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 2735|      0|                           NETSNMP_DEFAULT_MIBS);
  ------------------
  |  | 1982|      0|#define NETSNMP_DEFAULT_MIBS ":NET-SNMP-EXTEND-MIB:SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:HOST-RESOURCES-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB:NET-SNMP-PERIODIC-NOTIFY-MIB:DISMAN-NSLOOKUP-MIB:DISMAN-PING-MIB:DISMAN-TRACEROUTE-MIB:EtherLike-MIB:NET-SNMP-EXAMPLES-MIB:HOST-RESOURCES-TYPES:IP-FORWARD-MIB:MTA-MIB:NETWORK-SERVICES-MIB:UCD-IPFWACC-MIB:RMON-MIB:SCTP-MIB:SNMP-USM-DH-OBJECTS-MIB:SNMP-TLS-TM-MIB:SNMP-TSM-MIB:TUNNEL-MIB:IPV6-FLOW-LABEL-MIB:UCD-DISKIO-MIB:UCD-SNMP-MIB:UCD-DEMO-MIB:SNMP-TARGET-MIB:NET-SNMP-AGENT-MIB:SNMP-NOTIFICATION-MIB:NET-SNMP-PASS-MIB:SNMP-FRAMEWORK-MIB:SNMP-MPD-MIB:SNMP-USER-BASED-SM-MIB:SNMP-VIEW-BASED-ACM-MIB:SNMP-COMMUNITY-MIB:IPV6-ICMP-MIB:IPV6-MIB:IPV6-TCP-MIB:IPV6-UDP-MIB:UCD-DLMOD-MIB:SNMPv2-TM:NET-SNMP-VACM-MIB"
  ------------------
 2736|      0|        SNMP_FREE(env_var);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2737|      0|        if (res < 0) {
  ------------------
  |  Branch (2737:13): [True: 0, False: 0]
  ------------------
 2738|      0|            DEBUGMSGTL(("init_mib", "env mibs 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]
  |  |  ------------------
  ------------------
 2739|      0|            return;
 2740|      0|        }
 2741|      0|        env_var = entry;
 2742|      0|    }
 2743|       |
 2744|     66|    if (env_var != NULL) {
  ------------------
  |  Branch (2744:9): [True: 66, False: 0]
  ------------------
 2745|     66|        DEBUGMSGTL(("init_mib",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 2746|     66|                    "Seen MIBS: Looking in '%s' for mib files ...\n",
 2747|     66|                    env_var));
 2748|     66|        entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|     66|#define ENV_SEPARATOR ":"
  ------------------
 2749|  3.16k|        while (entry) {
  ------------------
  |  Branch (2749:16): [True: 3.10k, False: 66]
  ------------------
 2750|  3.10k|            if (strcasecmp(entry, DEBUG_ALWAYS_TOKEN) == 0) {
  ------------------
  |  |  227|  3.10k|#define DEBUG_ALWAYS_TOKEN "all"
  ------------------
  |  Branch (2750:17): [True: 0, False: 3.10k]
  ------------------
 2751|      0|                read_all_mibs();
 2752|  3.10k|            } else if (strstr(entry, "/") != NULL) {
  ------------------
  |  Branch (2752:24): [True: 0, False: 3.10k]
  ------------------
 2753|      0|                read_mib(entry);
 2754|  3.10k|            } else {
 2755|  3.10k|                netsnmp_read_module(entry);
 2756|  3.10k|            }
 2757|  3.10k|            entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|  3.10k|#define ENV_SEPARATOR ":"
  ------------------
 2758|  3.10k|        }
 2759|     66|        adopt_orphans();
 2760|     66|        SNMP_FREE(env_var);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2761|     66|    }
 2762|       |
 2763|     66|    env_var = netsnmp_getenv("MIBFILES");
 2764|     66|    if (env_var != NULL) {
  ------------------
  |  Branch (2764:9): [True: 0, False: 66]
  ------------------
 2765|      0|        if ((*env_var == '+') || (*env_var == '-')) {
  ------------------
  |  Branch (2765:13): [True: 0, False: 0]
  |  Branch (2765:34): [True: 0, False: 0]
  ------------------
 2766|       |#ifdef NETSNMP_DEFAULT_MIBFILES
 2767|       |            entry =
 2768|       |                (char *) malloc(strlen(NETSNMP_DEFAULT_MIBFILES) +
 2769|       |                                strlen(env_var) + 2);
 2770|       |            if (!entry) {
 2771|       |                DEBUGMSGTL(("init_mib", "env mibfiles malloc failed"));
 2772|       |            } else {
 2773|       |                if (*env_var++ == '+')
 2774|       |                    sprintf(entry, "%s%c%s", NETSNMP_DEFAULT_MIBFILES, ENV_SEPARATOR_CHAR,
 2775|       |                            env_var );
 2776|       |                else
 2777|       |                    sprintf(entry, "%s%c%s", env_var, ENV_SEPARATOR_CHAR,
 2778|       |                            NETSNMP_DEFAULT_MIBFILES );
 2779|       |            }
 2780|       |            SNMP_FREE(env_var);
 2781|       |            env_var = entry;
 2782|       |#else
 2783|      0|            env_var = strdup(env_var + 1);
 2784|      0|#endif
 2785|      0|        } else {
 2786|      0|            env_var = strdup(env_var);
 2787|      0|        }
 2788|     66|    } else {
 2789|       |#ifdef NETSNMP_DEFAULT_MIBFILES
 2790|       |        env_var = strdup(NETSNMP_DEFAULT_MIBFILES);
 2791|       |#endif
 2792|     66|    }
 2793|       |
 2794|     66|    if (env_var != NULL) {
  ------------------
  |  Branch (2794:9): [True: 0, False: 66]
  ------------------
 2795|      0|        DEBUGMSGTL(("init_mib",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2796|      0|                    "Seen MIBFILES: Looking in '%s' for mib files ...\n",
 2797|      0|                    env_var));
 2798|      0|        entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2799|      0|        while (entry) {
  ------------------
  |  Branch (2799:16): [True: 0, False: 0]
  ------------------
 2800|      0|            read_mib(entry);
 2801|      0|            entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2802|      0|        }
 2803|      0|        SNMP_FREE(env_var);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2804|      0|    }
 2805|       |
 2806|     66|    prefix = netsnmp_getenv("PREFIX");
 2807|       |
 2808|     66|    if (!prefix)
  ------------------
  |  Branch (2808:9): [True: 66, False: 0]
  ------------------
 2809|     66|        prefix = Standard_Prefix;
 2810|       |
 2811|     66|    Prefix = (char *) malloc(strlen(prefix) + 2);
 2812|     66|    if (!Prefix)
  ------------------
  |  Branch (2812:9): [True: 0, False: 66]
  ------------------
 2813|      0|        DEBUGMSGTL(("init_mib", "Prefix 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]
  |  |  ------------------
  ------------------
 2814|     66|    else
 2815|     66|        strcpy(Prefix, prefix);
 2816|       |
 2817|     66|    DEBUGMSGTL(("init_mib",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 2818|     66|                "Seen PREFIX: Looking in '%s' for prefix ...\n", Prefix));
 2819|       |
 2820|       |    /*
 2821|       |     * remove trailing dot 
 2822|       |     */
 2823|     66|    if (Prefix) {
  ------------------
  |  Branch (2823:9): [True: 66, False: 0]
  ------------------
 2824|     66|        env_var = &Prefix[strlen(Prefix) - 1];
 2825|     66|        if (*env_var == '.')
  ------------------
  |  Branch (2825:13): [True: 0, False: 66]
  ------------------
 2826|      0|            *env_var = '\0';
 2827|     66|    }
 2828|       |
 2829|     66|    pp->str = Prefix;           /* fixup first mib_prefix entry */
 2830|       |    /*
 2831|       |     * now that the list of prefixes is built, save each string length. 
 2832|       |     */
 2833|    462|    while (pp->str) {
  ------------------
  |  Branch (2833:12): [True: 396, False: 66]
  ------------------
 2834|    396|        pp->len = strlen(pp->str);
 2835|    396|        pp++;
 2836|    396|    }
 2837|       |
 2838|     66|    Mib = tree_head;            /* Backwards compatibility */
 2839|     66|    tree_top = calloc(1, sizeof(struct tree));
 2840|       |    /*
 2841|       |     * XX error check ? 
 2842|       |     */
 2843|     66|    if (tree_top) {
  ------------------
  |  Branch (2843:9): [True: 66, False: 0]
  ------------------
 2844|     66|        tree_top->label = strdup("(top)");
 2845|     66|        tree_top->child_list = tree_head;
 2846|     66|    }
 2847|     66|}
shutdown_mib:
 2863|     66|{
 2864|     66|    unload_all_mibs();
 2865|     66|    if (tree_top) {
  ------------------
  |  Branch (2865:9): [True: 66, False: 0]
  ------------------
 2866|     66|        if (tree_top->label)
  ------------------
  |  Branch (2866:13): [True: 66, False: 0]
  ------------------
 2867|     66|            SNMP_FREE(tree_top->label);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2868|     66|        SNMP_FREE(tree_top);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2869|     66|    }
 2870|     66|    tree_head = NULL;
 2871|     66|    Mib = NULL;
 2872|     66|    if (Prefix != NULL && Prefix != &Standard_Prefix[0])
  ------------------
  |  Branch (2872:9): [True: 66, False: 0]
  |  Branch (2872:27): [True: 66, False: 0]
  ------------------
 2873|     66|        SNMP_FREE(Prefix);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2874|     66|    if (Prefix)
  ------------------
  |  Branch (2874:9): [True: 0, False: 66]
  ------------------
 2875|      0|        Prefix = NULL;
 2876|     66|    SNMP_FREE(confmibs);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2877|       |    SNMP_FREE(confmibdir);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2878|     66|}
set_function:
 2910|    198|{
 2911|    198|    subtree->printer = NULL;
 2912|    198|    switch (subtree->type) {
 2913|      0|    case TYPE_OBJID:
  ------------------
  |  |  155|      0|#define TYPE_OBJID          1
  ------------------
  |  Branch (2913:5): [True: 0, False: 198]
  ------------------
 2914|      0|        subtree->printomat = sprint_realloc_object_identifier;
 2915|      0|        break;
 2916|      0|    case TYPE_OCTETSTR:
  ------------------
  |  |  156|      0|#define TYPE_OCTETSTR       2
  ------------------
  |  Branch (2916:5): [True: 0, False: 198]
  ------------------
 2917|      0|        subtree->printomat = sprint_realloc_octet_string;
 2918|      0|        break;
 2919|      0|    case TYPE_INTEGER:
  ------------------
  |  |  157|      0|#define TYPE_INTEGER        3
  ------------------
  |  Branch (2919:5): [True: 0, False: 198]
  ------------------
 2920|      0|        subtree->printomat = sprint_realloc_integer;
 2921|      0|        break;
 2922|      0|    case TYPE_INTEGER32:
  ------------------
  |  |  170|      0|#define TYPE_INTEGER32      16
  ------------------
  |  Branch (2922:5): [True: 0, False: 198]
  ------------------
 2923|      0|        subtree->printomat = sprint_realloc_integer;
 2924|      0|        break;
 2925|      0|    case TYPE_NETADDR:
  ------------------
  |  |  158|      0|#define TYPE_NETADDR        4
  ------------------
  |  Branch (2925:5): [True: 0, False: 198]
  ------------------
 2926|      0|        subtree->printomat = sprint_realloc_networkaddress;
 2927|      0|        break;
 2928|      0|    case TYPE_IPADDR:
  ------------------
  |  |  159|      0|#define TYPE_IPADDR         5
  ------------------
  |  Branch (2928:5): [True: 0, False: 198]
  ------------------
 2929|      0|        subtree->printomat = sprint_realloc_ipaddress;
 2930|      0|        break;
 2931|      0|    case TYPE_COUNTER:
  ------------------
  |  |  160|      0|#define TYPE_COUNTER        6
  ------------------
  |  Branch (2931:5): [True: 0, False: 198]
  ------------------
 2932|      0|        subtree->printomat = sprint_realloc_counter;
 2933|      0|        break;
 2934|      0|    case TYPE_GAUGE:
  ------------------
  |  |  161|      0|#define TYPE_GAUGE          7
  ------------------
  |  Branch (2934:5): [True: 0, False: 198]
  ------------------
 2935|      0|        subtree->printomat = sprint_realloc_gauge;
 2936|      0|        break;
 2937|      0|    case TYPE_TIMETICKS:
  ------------------
  |  |  162|      0|#define TYPE_TIMETICKS      8
  ------------------
  |  Branch (2937:5): [True: 0, False: 198]
  ------------------
 2938|      0|        subtree->printomat = sprint_realloc_timeticks;
 2939|      0|        break;
 2940|      0|    case TYPE_OPAQUE:
  ------------------
  |  |  163|      0|#define TYPE_OPAQUE         9
  ------------------
  |  Branch (2940:5): [True: 0, False: 198]
  ------------------
 2941|      0|        subtree->printomat = sprint_realloc_opaque;
 2942|      0|        break;
 2943|      0|    case TYPE_NULL:
  ------------------
  |  |  164|      0|#define TYPE_NULL           10
  ------------------
  |  Branch (2943:5): [True: 0, False: 198]
  ------------------
 2944|      0|        subtree->printomat = sprint_realloc_null;
 2945|      0|        break;
 2946|      0|    case TYPE_BITSTRING:
  ------------------
  |  |  166|      0|#define TYPE_BITSTRING      12
  ------------------
  |  Branch (2946:5): [True: 0, False: 198]
  ------------------
 2947|      0|        subtree->printomat = sprint_realloc_bitstring;
 2948|      0|        break;
 2949|      0|    case TYPE_NSAPADDRESS:
  ------------------
  |  |  167|      0|#define TYPE_NSAPADDRESS    13
  ------------------
  |  Branch (2949:5): [True: 0, False: 198]
  ------------------
 2950|      0|        subtree->printomat = sprint_realloc_nsapaddress;
 2951|      0|        break;
 2952|      0|    case TYPE_COUNTER64:
  ------------------
  |  |  165|      0|#define TYPE_COUNTER64      11
  ------------------
  |  Branch (2952:5): [True: 0, False: 198]
  ------------------
 2953|      0|        subtree->printomat = sprint_realloc_counter64;
 2954|      0|        break;
 2955|      0|    case TYPE_UINTEGER:
  ------------------
  |  |  168|      0|#define TYPE_UINTEGER       14
  ------------------
  |  Branch (2955:5): [True: 0, False: 198]
  ------------------
 2956|      0|        subtree->printomat = sprint_realloc_uinteger;
 2957|      0|        break;
 2958|      0|    case TYPE_UNSIGNED32:
  ------------------
  |  |  169|      0|#define TYPE_UNSIGNED32     15
  ------------------
  |  Branch (2958:5): [True: 0, False: 198]
  ------------------
 2959|      0|        subtree->printomat = sprint_realloc_gauge;
 2960|      0|        break;
 2961|    198|    case TYPE_OTHER:
  ------------------
  |  |  154|    198|#define TYPE_OTHER          0
  ------------------
  |  Branch (2961:5): [True: 198, False: 0]
  ------------------
 2962|    198|    default:
  ------------------
  |  Branch (2962:5): [True: 0, False: 198]
  ------------------
 2963|    198|        subtree->printomat = sprint_realloc_by_type;
 2964|    198|        break;
 2965|    198|    }
 2966|    198|}

netsnmp_init_mib_internals:
  700|  3.30k|{
  701|  3.30k|    register struct tok *tp;
  702|  3.30k|    register int    b, i;
  703|  3.30k|    int             max_modc;
  704|       |
  705|  3.30k|    if (tree_head)
  ------------------
  |  Branch (705:9): [True: 3.23k, False: 66]
  ------------------
  706|  3.23k|        return;
  707|       |
  708|       |    /*
  709|       |     * Set up hash list of pre-defined tokens
  710|       |     */
  711|     66|    memset(buckets, 0, sizeof(buckets));
  712|  6.13k|    for (tp = tokens; tp->name; tp++) {
  ------------------
  |  Branch (712:23): [True: 6.07k, False: 66]
  ------------------
  713|  6.07k|        tp->hash = name_hash(tp->name);
  714|  6.07k|        b = BUCKET(tp->hash);
  ------------------
  |  |  527|  6.07k|#define BUCKET(x)       (x & (HASHSIZE-1))
  |  |  ------------------
  |  |  |  |  526|  6.07k|#define HASHSIZE        32
  |  |  ------------------
  ------------------
  715|  6.07k|        if (buckets[b])
  ------------------
  |  Branch (715:13): [True: 3.96k, False: 2.11k]
  ------------------
  716|  3.96k|            tp->next = buckets[b];      /* BUG ??? */
  717|  6.07k|        buckets[b] = tp;
  718|  6.07k|    }
  719|       |
  720|       |    /*
  721|       |     * Initialise other internal structures
  722|       |     */
  723|       |
  724|     66|    max_modc = sizeof(module_map) / sizeof(module_map[0]) - 1;
  725|  1.45k|    for (i = 0; i < max_modc; ++i)
  ------------------
  |  Branch (725:17): [True: 1.38k, False: 66]
  ------------------
  726|  1.38k|        module_map[i].next = &(module_map[i + 1]);
  727|     66|    module_map[max_modc].next = NULL;
  728|     66|    module_map_head = module_map;
  729|       |
  730|     66|    memset(nbuckets, 0, sizeof(nbuckets));
  731|     66|    memset(tbuckets, 0, sizeof(tbuckets));
  732|     66|    free(tclist);
  733|     66|    tc_alloc = TC_INCR;
  ------------------
  |  |  134|     66|#define TC_INCR 100
  ------------------
  734|     66|    tclist = calloc(tc_alloc, sizeof(struct tc));
  735|     66|    build_translation_table();
  736|     66|    init_tree_roots();          /* Set up initial roots */
  737|       |    /*
  738|       |     * Relies on 'add_mibdir' having set up the modules 
  739|       |     */
  740|     66|}
which_module:
 3801|    198|{
 3802|    198|    struct module  *mp;
 3803|       |
 3804|    198|    for (mp = module_head; mp; mp = mp->next)
  ------------------
  |  Branch (3804:28): [True: 0, False: 198]
  ------------------
 3805|      0|        if (!label_compare(mp->name, name))
  ------------------
  |  | 1236|      0|#define	label_compare	strcmp
  ------------------
  |  Branch (3805:13): [True: 0, False: 0]
  ------------------
 3806|      0|            return (mp->modid);
 3807|       |
 3808|    198|    DEBUGMSGTL(("parse-mibs", "Module %s not found\n", name));
  ------------------
  |  |   66|    198|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    198|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 198]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 198]
  |  |  ------------------
  ------------------
 3809|    198|    return (-1);
 3810|    198|}
adopt_orphans:
 3999|     66|{
 4000|     66|    struct node    *np = NULL, *onp;
 4001|     66|    struct tree    *tp;
 4002|     66|    int             i, adopted = 1;
 4003|       |
 4004|     66|    if (!orphan_nodes)
  ------------------
  |  Branch (4004:9): [True: 66, False: 0]
  ------------------
 4005|     66|        return;
 4006|      0|    init_node_hash(orphan_nodes);
 4007|      0|    orphan_nodes = NULL;
 4008|       |
 4009|      0|    while (adopted) {
  ------------------
  |  Branch (4009:12): [True: 0, False: 0]
  ------------------
 4010|      0|        adopted = 0;
 4011|      0|        for (i = 0; i < NHASHSIZE; i++)
  ------------------
  |  |  529|      0|#define NHASHSIZE    128
  ------------------
  |  Branch (4011:21): [True: 0, False: 0]
  ------------------
 4012|      0|            if (nbuckets[i]) {
  ------------------
  |  Branch (4012:17): [True: 0, False: 0]
  ------------------
 4013|      0|                for (np = nbuckets[i]; np != NULL; np = np->next) {
  ------------------
  |  Branch (4013:40): [True: 0, False: 0]
  ------------------
 4014|      0|                    tp = find_tree_node(np->parent, -1);
 4015|      0|		    if (tp) {
  ------------------
  |  Branch (4015:11): [True: 0, False: 0]
  ------------------
 4016|      0|			do_subtree(tp, &np);
 4017|      0|			adopted = 1;
 4018|       |                        /*
 4019|       |                         * if do_subtree adopted the entire bucket, stop
 4020|       |                         */
 4021|      0|                        if(NULL == nbuckets[i])
  ------------------
  |  Branch (4021:28): [True: 0, False: 0]
  ------------------
 4022|      0|                            break;
 4023|       |
 4024|       |                        /*
 4025|       |                         * do_subtree may modify nbuckets, and if np
 4026|       |                         * was adopted, np->next probably isn't an orphan
 4027|       |                         * anymore. if np is still in the bucket (do_subtree
 4028|       |                         * didn't adopt it) keep on plugging. otherwise
 4029|       |                         * start over, at the top of the bucket.
 4030|       |                         */
 4031|      0|                        for(onp = nbuckets[i]; onp; onp = onp->next)
  ------------------
  |  Branch (4031:48): [True: 0, False: 0]
  ------------------
 4032|      0|                            if(onp == np)
  ------------------
  |  Branch (4032:32): [True: 0, False: 0]
  ------------------
 4033|      0|                                break;
 4034|      0|                        if(NULL == onp) { /* not in the list */
  ------------------
  |  Branch (4034:28): [True: 0, False: 0]
  ------------------
 4035|      0|                            np = nbuckets[i]; /* start over */
 4036|      0|                        }
 4037|      0|		    }
 4038|      0|		}
 4039|      0|            }
 4040|      0|    }
 4041|       |
 4042|       |    /*
 4043|       |     * Report on outstanding orphans
 4044|       |     *    and link them back into the orphan list
 4045|       |     */
 4046|      0|    for (i = 0; i < NHASHSIZE; i++)
  ------------------
  |  |  529|      0|#define NHASHSIZE    128
  ------------------
  |  Branch (4046:17): [True: 0, False: 0]
  ------------------
 4047|      0|        if (nbuckets[i]) {
  ------------------
  |  Branch (4047:13): [True: 0, False: 0]
  ------------------
 4048|      0|            if (orphan_nodes)
  ------------------
  |  Branch (4048:17): [True: 0, False: 0]
  ------------------
 4049|      0|                onp = np->next = nbuckets[i];
 4050|      0|            else
 4051|      0|                onp = orphan_nodes = nbuckets[i];
 4052|      0|            nbuckets[i] = NULL;
 4053|      0|            while (onp) {
  ------------------
  |  Branch (4053:20): [True: 0, False: 0]
  ------------------
 4054|      0|                char            modbuf[256];
 4055|      0|                snmp_log(LOG_WARNING,
 4056|      0|                         "Cannot resolve OID in %s: %s ::= { %s %ld } at line %d in %s\n",
 4057|      0|                         module_name(onp->modid, modbuf),
 4058|      0|                         (onp->label ? onp->label : "<no label>"),
  ------------------
  |  Branch (4058:27): [True: 0, False: 0]
  ------------------
 4059|      0|                         (onp->parent ? onp->parent : "<no parent>"),
  ------------------
  |  Branch (4059:27): [True: 0, False: 0]
  ------------------
 4060|      0|                         onp->subid, onp->lineno, onp->filename);
 4061|      0|                np = onp;
 4062|      0|                onp = onp->next;
 4063|      0|            }
 4064|      0|        }
 4065|      0|}
netsnmp_read_module:
 4077|  3.10k|{
 4078|  3.10k|    int status = 0;
 4079|  3.10k|    status = read_module_internal(name);
 4080|       |
 4081|  3.10k|    if (status == MODULE_NOT_FOUND) {
  ------------------
  |  |  513|  3.10k|#define MODULE_NOT_FOUND	0
  ------------------
  |  Branch (4081:9): [True: 3.10k, False: 0]
  ------------------
 4082|  3.10k|        if (!read_module_replacements(name))
  ------------------
  |  Branch (4082:13): [True: 3.10k, False: 0]
  ------------------
 4083|  3.10k|            print_module_not_found(name);
 4084|  3.10k|    } else if (status == MODULE_SYNTAX_ERROR) {
  ------------------
  |  |  520|      0|#define MODULE_SYNTAX_ERROR     4
  ------------------
  |  Branch (4084:16): [True: 0, False: 0]
  ------------------
 4085|      0|        gMibError = 0;
 4086|      0|        gLoop = 1;
 4087|       |
 4088|      0|        strncat(gMibNames, " ", sizeof(gMibNames) - strlen(gMibNames) - 1);
 4089|      0|        strncat(gMibNames, name, sizeof(gMibNames) - strlen(gMibNames) - 1);
 4090|      0|    }
 4091|       |
 4092|  3.10k|    return tree_head;
 4093|  3.10k|}
unload_module_by_ID:
 4102|     66|{
 4103|     66|    struct tree    *tp, *next;
 4104|     66|    int             i;
 4105|       |
 4106|    264|    for (tp = tree_top; tp; tp = next) {
  ------------------
  |  Branch (4106:25): [True: 198, False: 66]
  ------------------
 4107|       |        /*
 4108|       |         * Essentially, this is equivalent to the code fragment:
 4109|       |         *      if (tp->modID == modID)
 4110|       |         *        tp->number_modules--;
 4111|       |         * but handles one tree node being part of several modules,
 4112|       |         * and possible multiple copies of the same module ID.
 4113|       |         */
 4114|    198|        int             nmod = tp->number_modules;
 4115|    198|        if (nmod > 0) {         /* in some module */
  ------------------
  |  Branch (4115:13): [True: 198, False: 0]
  ------------------
 4116|       |            /*
 4117|       |             * Remove all copies of this module ID
 4118|       |             */
 4119|    198|            int             cnt = 0, *pi1, *pi2 = tp->module_list;
 4120|    396|            for (i = 0, pi1 = pi2; i < nmod; i++, pi2++) {
  ------------------
  |  Branch (4120:36): [True: 198, False: 198]
  ------------------
 4121|    198|                if (*pi2 == modID)
  ------------------
  |  Branch (4121:21): [True: 198, False: 0]
  ------------------
 4122|    198|                    continue;
 4123|      0|                cnt++;
 4124|      0|                *pi1++ = *pi2;
 4125|      0|            }
 4126|    198|            if (nmod != cnt) {  /* in this module */
  ------------------
  |  Branch (4126:17): [True: 198, False: 0]
  ------------------
 4127|       |                /*
 4128|       |                 * if ( (nmod - cnt) > 1)
 4129|       |                 * printf("Dup modid %d,  %d times, '%s'\n", tp->modid, (nmod-cnt), tp->label); fflush(stdout); ?* XXDEBUG 
 4130|       |                 */
 4131|    198|                tp->number_modules = cnt;
 4132|    198|                switch (cnt) {
 4133|    198|                case 0:
  ------------------
  |  Branch (4133:17): [True: 198, False: 0]
  ------------------
 4134|    198|                    tp->module_list[0] = -1;    /* Mark unused, */
 4135|    198|		    NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|    198|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4136|       |
 4137|    198|                case 1:        /* save the remaining module */
  ------------------
  |  Branch (4137:17): [True: 0, False: 198]
  ------------------
 4138|    198|                    if (&(tp->modid) != tp->module_list) {
  ------------------
  |  Branch (4138:25): [True: 0, False: 198]
  ------------------
 4139|      0|                        tp->modid = tp->module_list[0];
 4140|      0|                        free(tp->module_list);
 4141|      0|                        tp->module_list = &(tp->modid);
 4142|      0|                    }
 4143|    198|                    break;
 4144|       |
 4145|      0|                default:
  ------------------
  |  Branch (4145:17): [True: 0, False: 198]
  ------------------
 4146|      0|                    break;
 4147|    198|                }
 4148|    198|            }                   /* if tree node is in this module */
 4149|    198|        }
 4150|       |        /*
 4151|       |         * if tree node is in some module 
 4152|       |         */
 4153|    198|        next = tp->next_peer;
 4154|       |
 4155|       |
 4156|       |        /*
 4157|       |         *  OK - that's dealt with *this* node.
 4158|       |         *    Now let's look at the children.
 4159|       |         *    (Isn't recursion wonderful!)
 4160|       |         */
 4161|    198|        if (tp->child_list)
  ------------------
  |  Branch (4161:13): [True: 0, False: 198]
  ------------------
 4162|      0|            unload_module_by_ID(modID, tp->child_list);
 4163|       |
 4164|       |
 4165|    198|        if (tp->number_modules == 0) {
  ------------------
  |  Branch (4165:13): [True: 198, False: 0]
  ------------------
 4166|       |            /*
 4167|       |             * This node isn't needed any more (except perhaps
 4168|       |             * for the sake of the children) 
 4169|       |             */
 4170|    198|            if (tp->child_list == NULL) {
  ------------------
  |  Branch (4170:17): [True: 198, False: 0]
  ------------------
 4171|    198|                unlink_tree(tp);
 4172|    198|                free_tree(tp);
 4173|    198|            } else {
 4174|      0|                free_partial_tree(tp, TRUE);
  ------------------
  |  |  128|      0|#define TRUE  1
  ------------------
 4175|      0|            }
 4176|    198|        }
 4177|    198|    }
 4178|     66|}
unload_all_mibs:
 4215|     66|{
 4216|     66|    struct module  *mp;
 4217|     66|    struct module_compatability *mcp;
 4218|     66|    struct tc      *ptc;
 4219|     66|    unsigned int    i;
 4220|       |
 4221|     66|    for (mcp = module_map_head; mcp; mcp = module_map_head) {
  ------------------
  |  Branch (4221:33): [True: 66, False: 0]
  ------------------
 4222|     66|        if (mcp == module_map)
  ------------------
  |  Branch (4222:13): [True: 66, False: 0]
  ------------------
 4223|     66|            break;
 4224|      0|        module_map_head = mcp->next;
 4225|      0|        if (mcp->tag) free(NETSNMP_REMOVE_CONST(char *, mcp->tag));
  ------------------
  |  |   91|      0|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  |  Branch (4225:13): [True: 0, False: 0]
  ------------------
 4226|      0|        free(NETSNMP_REMOVE_CONST(char *, mcp->old_module));
  ------------------
  |  |   91|      0|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
 4227|      0|        free(NETSNMP_REMOVE_CONST(char *, mcp->new_module));
  ------------------
  |  |   91|      0|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
 4228|      0|        free(mcp);
 4229|      0|    }
 4230|       |
 4231|     66|    for (mp = module_head; mp; mp = module_head) {
  ------------------
  |  Branch (4231:28): [True: 0, False: 66]
  ------------------
 4232|      0|        struct module_import *mi = mp->imports;
 4233|      0|        if (mi) {
  ------------------
  |  Branch (4233:13): [True: 0, False: 0]
  ------------------
 4234|      0|            for (i = 0; i < (unsigned int)mp->no_imports; ++i) {
  ------------------
  |  Branch (4234:25): [True: 0, False: 0]
  ------------------
 4235|      0|                SNMP_FREE((mi + i)->label);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 4236|      0|            }
 4237|      0|            mp->no_imports = 0;
 4238|      0|            if (mi == root_imports)
  ------------------
  |  Branch (4238:17): [True: 0, False: 0]
  ------------------
 4239|      0|                memset(mi, 0, sizeof(*mi));
 4240|      0|            else
 4241|      0|                free(mi);
 4242|      0|        }
 4243|       |
 4244|      0|        unload_module_by_ID(mp->modid, tree_head);
 4245|      0|        module_head = mp->next;
 4246|      0|        free(mp->name);
 4247|      0|        free(mp->file);
 4248|      0|        free(mp);
 4249|      0|    }
 4250|     66|    unload_module_by_ID(-1, tree_head);
 4251|       |    /*
 4252|       |     * tree nodes are cleared 
 4253|       |     */
 4254|       |
 4255|  6.66k|    for (i = 0, ptc = tclist; i < tc_alloc; i++, ptc++) {
  ------------------
  |  Branch (4255:31): [True: 6.60k, False: 66]
  ------------------
 4256|  6.60k|        if (ptc->type == 0)
  ------------------
  |  Branch (4256:13): [True: 6.60k, False: 0]
  ------------------
 4257|  6.60k|            continue;
 4258|      0|        free_enums(&ptc->enums);
 4259|      0|        free_ranges(&ptc->ranges);
 4260|      0|        free(ptc->descriptor);
 4261|      0|        if (ptc->hint)
  ------------------
  |  Branch (4261:13): [True: 0, False: 0]
  ------------------
 4262|      0|            free(ptc->hint);
 4263|      0|        if (ptc->description)
  ------------------
  |  Branch (4263:13): [True: 0, False: 0]
  ------------------
 4264|      0|            free(ptc->description);
 4265|      0|    }
 4266|     66|    SNMP_FREE(tclist);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 4267|     66|    tc_alloc = 0;
 4268|       |
 4269|     66|    memset(buckets, 0, sizeof(buckets));
 4270|     66|    memset(nbuckets, 0, sizeof(nbuckets));
 4271|     66|    memset(tbuckets, 0, sizeof(tbuckets));
 4272|       |
 4273|    264|    for (i = 0; i < sizeof(root_imports) / sizeof(root_imports[0]); i++) {
  ------------------
  |  Branch (4273:17): [True: 198, False: 66]
  ------------------
 4274|    198|        SNMP_FREE(root_imports[i].label);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 198, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
 4275|    198|    }
 4276|       |
 4277|     66|    max_module = 0;
 4278|     66|    current_module = 0;
 4279|     66|    module_map_head = NULL;
 4280|       |    SNMP_FREE(last_err_module);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 4281|     66|}
add_mibdir:
 5064|     66|{
 5065|     66|    const char     *oldFile = File;
 5066|     66|    char          **filenames;
 5067|     66|    int             count = 0;
 5068|     66|    int             filename_count, i;
 5069|       |
 5070|     66|    DEBUGMSGTL(("parse-mibs", "Scanning directory %s\n", dirname));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 5071|       |
 5072|     66|    filename_count = scan_directory(&filenames, dirname);
 5073|       |
 5074|     66|    if (filename_count >= 0) {
  ------------------
  |  Branch (5074:9): [True: 0, False: 66]
  ------------------
 5075|      0|        for (i = 0; i < filename_count; i++) {
  ------------------
  |  Branch (5075:21): [True: 0, False: 0]
  ------------------
 5076|      0|            if (add_mibfile(filenames[i], strrchr(filenames[i], '/')) == 0)
  ------------------
  |  Branch (5076:17): [True: 0, False: 0]
  ------------------
 5077|      0|                count++;
 5078|      0|	    free(filenames[i]);
 5079|      0|        }
 5080|      0|        File = oldFile;
 5081|      0|        free(filenames);
 5082|      0|        return (count);
 5083|      0|    }
 5084|     66|    else
 5085|     66|        DEBUGMSGTL(("parse-mibs","cannot open MIB directory %s\n", dirname));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 5086|       |
 5087|     66|    return (-1);
 5088|     66|}
parse.c:name_hash:
  687|  6.46k|{
  688|  6.46k|    int             hash = 0;
  689|  6.46k|    const char     *cp;
  690|       |
  691|  6.46k|    if (!name)
  ------------------
  |  Branch (691:9): [True: 0, False: 6.46k]
  ------------------
  692|      0|        return 0;
  693|  67.8k|    for (cp = name; *cp; cp++)
  ------------------
  |  Branch (693:21): [True: 61.3k, False: 6.46k]
  ------------------
  694|  61.3k|        hash += tolower((unsigned char)(*cp));
  ------------------
  |  Branch (694:17): [True: 0, False: 0]
  |  Branch (694:17): [True: 0, False: 0]
  |  Branch (694:17): [Folded, False: 61.3k]
  ------------------
  695|  6.46k|    return (hash);
  696|  6.46k|}
parse.c:build_translation_table:
 1071|     66|{
 1072|     66|    int             count;
 1073|       |
 1074|  16.9k|    for (count = 0; count < 256; count++) {
  ------------------
  |  Branch (1074:21): [True: 16.8k, False: 66]
  ------------------
 1075|  16.8k|        switch (count) {
 1076|     66|        case OBJID:
  ------------------
  |  |  167|     66|#define OBJID       (4 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1076:9): [True: 66, False: 16.8k]
  ------------------
 1077|     66|            translation_table[count] = TYPE_OBJID;
  ------------------
  |  |  155|     66|#define TYPE_OBJID          1
  ------------------
 1078|     66|            break;
 1079|     66|        case OCTETSTR:
  ------------------
  |  |  168|     66|#define OCTETSTR    (5 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1079:9): [True: 66, False: 16.8k]
  ------------------
 1080|     66|            translation_table[count] = TYPE_OCTETSTR;
  ------------------
  |  |  156|     66|#define TYPE_OCTETSTR       2
  ------------------
 1081|     66|            break;
 1082|     66|        case INTEGER:
  ------------------
  |  |  169|     66|#define INTEGER     (6 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1082:9): [True: 66, False: 16.8k]
  ------------------
 1083|     66|            translation_table[count] = TYPE_INTEGER;
  ------------------
  |  |  157|     66|#define TYPE_INTEGER        3
  ------------------
 1084|     66|            break;
 1085|     66|        case NETADDR:
  ------------------
  |  |  170|     66|#define NETADDR     (7 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1085:9): [True: 66, False: 16.8k]
  ------------------
 1086|     66|            translation_table[count] = TYPE_NETADDR;
  ------------------
  |  |  158|     66|#define TYPE_NETADDR        4
  ------------------
 1087|     66|            break;
 1088|     66|        case IPADDR:
  ------------------
  |  |  171|     66|#define IPADDR      (8 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1088:9): [True: 66, False: 16.8k]
  ------------------
 1089|     66|            translation_table[count] = TYPE_IPADDR;
  ------------------
  |  |  159|     66|#define TYPE_IPADDR         5
  ------------------
 1090|     66|            break;
 1091|     66|        case COUNTER:
  ------------------
  |  |  172|     66|#define COUNTER     (9 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1091:9): [True: 66, False: 16.8k]
  ------------------
 1092|     66|            translation_table[count] = TYPE_COUNTER;
  ------------------
  |  |  160|     66|#define TYPE_COUNTER        6
  ------------------
 1093|     66|            break;
 1094|     66|        case GAUGE:
  ------------------
  |  |  173|     66|#define GAUGE       (10 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1094:9): [True: 66, False: 16.8k]
  ------------------
 1095|     66|            translation_table[count] = TYPE_GAUGE;
  ------------------
  |  |  161|     66|#define TYPE_GAUGE          7
  ------------------
 1096|     66|            break;
 1097|     66|        case TIMETICKS:
  ------------------
  |  |  174|     66|#define TIMETICKS   (11 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1097:9): [True: 66, False: 16.8k]
  ------------------
 1098|     66|            translation_table[count] = TYPE_TIMETICKS;
  ------------------
  |  |  162|     66|#define TYPE_TIMETICKS      8
  ------------------
 1099|     66|            break;
 1100|     66|        case KW_OPAQUE:
  ------------------
  |  |  175|     66|#define KW_OPAQUE   (12 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1100:9): [True: 66, False: 16.8k]
  ------------------
 1101|     66|            translation_table[count] = TYPE_OPAQUE;
  ------------------
  |  |  163|     66|#define TYPE_OPAQUE         9
  ------------------
 1102|     66|            break;
 1103|     66|        case NUL:
  ------------------
  |  |  176|     66|#define NUL         (13 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1103:9): [True: 66, False: 16.8k]
  ------------------
 1104|     66|            translation_table[count] = TYPE_NULL;
  ------------------
  |  |  164|     66|#define TYPE_NULL           10
  ------------------
 1105|     66|            break;
 1106|     66|        case COUNTER64:
  ------------------
  |  |  211|     66|#define COUNTER64   (43 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1106:9): [True: 66, False: 16.8k]
  ------------------
 1107|     66|            translation_table[count] = TYPE_COUNTER64;
  ------------------
  |  |  165|     66|#define TYPE_COUNTER64      11
  ------------------
 1108|     66|            break;
 1109|     66|        case BITSTRING:
  ------------------
  |  |  209|     66|#define BITSTRING   (41 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1109:9): [True: 66, False: 16.8k]
  ------------------
 1110|     66|            translation_table[count] = TYPE_BITSTRING;
  ------------------
  |  |  166|     66|#define TYPE_BITSTRING      12
  ------------------
 1111|     66|            break;
 1112|     66|        case NSAPADDRESS:
  ------------------
  |  |  210|     66|#define NSAPADDRESS (42 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1112:9): [True: 66, False: 16.8k]
  ------------------
 1113|     66|            translation_table[count] = TYPE_NSAPADDRESS;
  ------------------
  |  |  167|     66|#define TYPE_NSAPADDRESS    13
  ------------------
 1114|     66|            break;
 1115|     66|        case INTEGER32:
  ------------------
  |  |  274|     66|#define INTEGER32	(105 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1115:9): [True: 66, False: 16.8k]
  ------------------
 1116|     66|            translation_table[count] = TYPE_INTEGER32;
  ------------------
  |  |  170|     66|#define TYPE_INTEGER32      16
  ------------------
 1117|     66|            break;
 1118|     66|        case UINTEGER32:
  ------------------
  |  |  224|     66|#define UINTEGER32 (56 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1118:9): [True: 66, False: 16.8k]
  ------------------
 1119|     66|            translation_table[count] = TYPE_UINTEGER;
  ------------------
  |  |  168|     66|#define TYPE_UINTEGER       14
  ------------------
 1120|     66|            break;
 1121|     66|        case UNSIGNED32:
  ------------------
  |  |  273|     66|#define UNSIGNED32	(104 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1121:9): [True: 66, False: 16.8k]
  ------------------
 1122|     66|            translation_table[count] = TYPE_UNSIGNED32;
  ------------------
  |  |  169|     66|#define TYPE_UNSIGNED32     15
  ------------------
 1123|     66|            break;
 1124|     66|        case TRAPTYPE:
  ------------------
  |  |  229|     66|#define TRAPTYPE    61
  ------------------
  |  Branch (1124:9): [True: 66, False: 16.8k]
  ------------------
 1125|     66|            translation_table[count] = TYPE_TRAPTYPE;
  ------------------
  |  |  174|     66|#define TYPE_TRAPTYPE	    20
  ------------------
 1126|     66|            break;
 1127|     66|        case NOTIFTYPE:
  ------------------
  |  |  213|     66|#define NOTIFTYPE   45
  ------------------
  |  Branch (1127:9): [True: 66, False: 16.8k]
  ------------------
 1128|     66|            translation_table[count] = TYPE_NOTIFTYPE;
  ------------------
  |  |  175|     66|#define TYPE_NOTIFTYPE      21
  ------------------
 1129|     66|            break;
 1130|     66|        case NOTIFGROUP:
  ------------------
  |  |  258|     66|#define NOTIFGROUP  88
  ------------------
  |  Branch (1130:9): [True: 66, False: 16.8k]
  ------------------
 1131|     66|            translation_table[count] = TYPE_NOTIFGROUP;
  ------------------
  |  |  177|     66|#define TYPE_NOTIFGROUP	    23
  ------------------
 1132|     66|            break;
 1133|     66|        case OBJGROUP:
  ------------------
  |  |  212|     66|#define OBJGROUP    44
  ------------------
  |  Branch (1133:9): [True: 66, False: 16.8k]
  ------------------
 1134|     66|            translation_table[count] = TYPE_OBJGROUP;
  ------------------
  |  |  176|     66|#define TYPE_OBJGROUP	    22
  ------------------
 1135|     66|            break;
 1136|     66|        case MODULEIDENTITY:
  ------------------
  |  |  220|     66|#define MODULEIDENTITY 52
  ------------------
  |  Branch (1136:9): [True: 66, False: 16.8k]
  ------------------
 1137|     66|            translation_table[count] = TYPE_MODID;
  ------------------
  |  |  178|     66|#define TYPE_MODID	    24
  ------------------
 1138|     66|            break;
 1139|     66|        case OBJIDENTITY:
  ------------------
  |  |  275|     66|#define OBJIDENTITY	106
  ------------------
  |  Branch (1139:9): [True: 66, False: 16.8k]
  ------------------
 1140|     66|            translation_table[count] = TYPE_OBJIDENTITY;
  ------------------
  |  |  181|     66|#define TYPE_OBJIDENTITY    27
  ------------------
 1141|     66|            break;
 1142|     66|        case AGENTCAP:
  ------------------
  |  |  243|     66|#define AGENTCAP    73
  ------------------
  |  Branch (1142:9): [True: 66, False: 16.8k]
  ------------------
 1143|     66|            translation_table[count] = TYPE_AGENTCAP;
  ------------------
  |  |  179|     66|#define TYPE_AGENTCAP       25
  ------------------
 1144|     66|            break;
 1145|     66|        case COMPLIANCE:
  ------------------
  |  |  215|     66|#define COMPLIANCE  47
  ------------------
  |  Branch (1145:9): [True: 66, False: 16.8k]
  ------------------
 1146|     66|            translation_table[count] = TYPE_MODCOMP;
  ------------------
  |  |  180|     66|#define TYPE_MODCOMP        26
  ------------------
 1147|     66|            break;
 1148|  15.3k|        default:
  ------------------
  |  Branch (1148:9): [True: 15.3k, False: 1.58k]
  ------------------
 1149|  15.3k|            translation_table[count] = TYPE_OTHER;
  ------------------
  |  |  154|  15.3k|#define TYPE_OTHER          0
  ------------------
 1150|  15.3k|            break;
 1151|  16.8k|        }
 1152|  16.8k|    }
 1153|     66|}
parse.c:init_tree_roots:
 1157|     66|{
 1158|     66|    struct tree    *tp, *lasttp;
 1159|     66|    int             base_modid;
 1160|     66|    int             hash;
 1161|       |
 1162|     66|    base_modid = which_module("SNMPv2-SMI");
 1163|     66|    if (base_modid == -1)
  ------------------
  |  Branch (1163:9): [True: 66, False: 0]
  ------------------
 1164|     66|        base_modid = which_module("RFC1155-SMI");
 1165|     66|    if (base_modid == -1)
  ------------------
  |  Branch (1165:9): [True: 66, False: 0]
  ------------------
 1166|     66|        base_modid = which_module("RFC1213-MIB");
 1167|       |
 1168|       |    /*
 1169|       |     * build root node 
 1170|       |     */
 1171|     66|    tp = calloc(1, sizeof(struct tree));
 1172|     66|    if (tp == NULL)
  ------------------
  |  Branch (1172:9): [True: 0, False: 66]
  ------------------
 1173|      0|        return;
 1174|     66|    tp->label = strdup("joint-iso-ccitt");
 1175|     66|    tp->modid = base_modid;
 1176|     66|    tp->number_modules = 1;
 1177|     66|    tp->module_list = &(tp->modid);
 1178|     66|    tp->subid = 2;
 1179|     66|    tp->tc_index = -1;
 1180|     66|    set_function(tp);           /* from mib.c */
 1181|     66|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|     66|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|     66|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1182|     66|    tp->next = tbuckets[hash];
 1183|     66|    tbuckets[hash] = tp;
 1184|     66|    lasttp = tp;
 1185|     66|    root_imports[0].label = strdup(tp->label);
 1186|     66|    root_imports[0].modid = base_modid;
 1187|       |
 1188|       |    /*
 1189|       |     * build root node 
 1190|       |     */
 1191|     66|    tp = calloc(1, sizeof(struct tree));
 1192|     66|    if (tp == NULL)
  ------------------
  |  Branch (1192:9): [True: 0, False: 66]
  ------------------
 1193|      0|        return;
 1194|     66|    tp->next_peer = lasttp;
 1195|     66|    tp->label = strdup("ccitt");
 1196|     66|    tp->modid = base_modid;
 1197|     66|    tp->number_modules = 1;
 1198|     66|    tp->module_list = &(tp->modid);
 1199|     66|    tp->subid = 0;
 1200|     66|    tp->tc_index = -1;
 1201|     66|    set_function(tp);           /* from mib.c */
 1202|     66|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|     66|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|     66|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1203|     66|    tp->next = tbuckets[hash];
 1204|     66|    tbuckets[hash] = tp;
 1205|     66|    lasttp = tp;
 1206|     66|    root_imports[1].label = strdup(tp->label);
 1207|     66|    root_imports[1].modid = base_modid;
 1208|       |
 1209|       |    /*
 1210|       |     * build root node 
 1211|       |     */
 1212|     66|    tp = calloc(1, sizeof(struct tree));
 1213|     66|    if (tp == NULL)
  ------------------
  |  Branch (1213:9): [True: 0, False: 66]
  ------------------
 1214|      0|        return;
 1215|     66|    tp->next_peer = lasttp;
 1216|     66|    tp->label = strdup("iso");
 1217|     66|    tp->modid = base_modid;
 1218|     66|    tp->number_modules = 1;
 1219|     66|    tp->module_list = &(tp->modid);
 1220|     66|    tp->subid = 1;
 1221|     66|    tp->tc_index = -1;
 1222|     66|    set_function(tp);           /* from mib.c */
 1223|     66|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|     66|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|     66|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1224|     66|    tp->next = tbuckets[hash];
 1225|     66|    tbuckets[hash] = tp;
 1226|     66|    lasttp = tp;
 1227|     66|    root_imports[2].label = strdup(tp->label);
 1228|     66|    root_imports[2].modid = base_modid;
 1229|       |
 1230|     66|    tree_head = tp;
 1231|     66|}
parse.c:unlink_tbucket:
  830|    198|{
  831|    198|    int             hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|    198|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|    198|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
  832|    198|    struct tree    *otp = NULL, *ntp = tbuckets[hash];
  833|       |
  834|    198|    while (ntp && ntp != tp) {
  ------------------
  |  Branch (834:12): [True: 198, False: 0]
  |  Branch (834:19): [True: 0, False: 198]
  ------------------
  835|      0|        otp = ntp;
  836|      0|        ntp = ntp->next;
  837|      0|    }
  838|    198|    if (!ntp)
  ------------------
  |  Branch (838:9): [True: 0, False: 198]
  ------------------
  839|      0|        snmp_log(LOG_EMERG, "Can't find %s in tbuckets\n", tp->label);
  840|    198|    else if (otp)
  ------------------
  |  Branch (840:14): [True: 0, False: 198]
  ------------------
  841|      0|        otp->next = ntp->next;
  842|    198|    else
  843|    198|        tbuckets[hash] = tp->next;
  844|    198|}
parse.c:free_indexes:
 5298|    198|{
 5299|    198|    if (spp && *spp) {
  ------------------
  |  Branch (5299:9): [True: 198, False: 0]
  |  Branch (5299:16): [True: 0, False: 198]
  ------------------
 5300|      0|        struct index_list *pp, *npp;
 5301|       |
 5302|      0|        pp = *spp;
 5303|      0|        *spp = NULL;
 5304|       |
 5305|      0|        while (pp) {
  ------------------
  |  Branch (5305:16): [True: 0, False: 0]
  ------------------
 5306|      0|            npp = pp->next;
 5307|      0|            if (pp->ilabel)
  ------------------
  |  Branch (5307:17): [True: 0, False: 0]
  ------------------
 5308|      0|                free(pp->ilabel);
 5309|      0|            free(pp);
 5310|      0|            pp = npp;
 5311|      0|        }
 5312|      0|    }
 5313|    198|}
parse.c:free_varbinds:
 5317|    198|{
 5318|    198|    if (spp && *spp) {
  ------------------
  |  Branch (5318:9): [True: 198, False: 0]
  |  Branch (5318:16): [True: 0, False: 198]
  ------------------
 5319|      0|        struct varbind_list *pp, *npp;
 5320|       |
 5321|      0|        pp = *spp;
 5322|      0|        *spp = NULL;
 5323|       |
 5324|      0|        while (pp) {
  ------------------
  |  Branch (5324:16): [True: 0, False: 0]
  ------------------
 5325|      0|            npp = pp->next;
 5326|      0|            if (pp->vblabel)
  ------------------
  |  Branch (5326:17): [True: 0, False: 0]
  ------------------
 5327|      0|                free(pp->vblabel);
 5328|      0|            free(pp);
 5329|      0|            pp = npp;
 5330|      0|        }
 5331|      0|    }
 5332|    198|}
parse.c:read_module_internal:
 3985|  3.10k|{
 3986|  3.10k|    struct module  *mp;
 3987|       |
 3988|  3.10k|    netsnmp_init_mib_internals();
 3989|       |
 3990|  3.10k|    for (mp = module_head; mp; mp = mp->next)
  ------------------
  |  Branch (3990:28): [True: 0, False: 3.10k]
  ------------------
 3991|      0|        if (!label_compare(mp->name, name))
  ------------------
  |  | 1236|      0|#define	label_compare	strcmp
  ------------------
  |  Branch (3991:13): [True: 0, False: 0]
  ------------------
 3992|      0|            return read_from_file(mp, name);
 3993|       |
 3994|  3.10k|    return MODULE_NOT_FOUND;
  ------------------
  |  |  513|  3.10k|#define MODULE_NOT_FOUND	0
  ------------------
 3995|  3.10k|}
parse.c:print_error:
  780|  3.10k|{
  781|  3.10k|    erroneousMibs++;
  782|  3.10k|    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|  3.10k|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (782:9): [True: 0, False: 3.10k]
  ------------------
  783|  3.10k|                                NETSNMP_DS_LIB_MIB_ERRORS))
  ------------------
  |  |   59|  3.10k|#define NETSNMP_DS_LIB_MIB_ERRORS          0
  ------------------
  784|      0|	return;
  785|  3.10k|    DEBUGMSGTL(("parse-mibs", "\n"));
  ------------------
  |  |   66|  3.10k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.10k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.10k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 3.10k]
  |  |  ------------------
  ------------------
  786|  3.10k|    if (type == ENDOFFILE)
  ------------------
  |  |  163|  3.10k|#define ENDOFFILE   0
  ------------------
  |  Branch (786:9): [True: 0, False: 3.10k]
  ------------------
  787|      0|        snmp_log(LOG_ERR, "%s (EOF): At line %d in %s\n", str, mibLine,
  788|      0|                 File);
  789|  3.10k|    else if (token && *token)
  ------------------
  |  Branch (789:14): [True: 3.10k, False: 0]
  |  Branch (789:23): [True: 3.10k, False: 0]
  ------------------
  790|  3.10k|        snmp_log(LOG_ERR, "%s (%s): At line %d in %s\n", str, token,
  791|  3.10k|                 mibLine, File);
  792|      0|    else
  793|      0|        snmp_log(LOG_ERR, "%s: At line %d in %s\n", str, mibLine, File);
  794|  3.10k|}
parse.c:read_module_replacements:
 3865|  3.10k|{
 3866|  3.10k|    struct module_compatability *mcp;
 3867|       |
 3868|  71.3k|    for (mcp = module_map_head; mcp; mcp = mcp->next) {
  ------------------
  |  Branch (3868:33): [True: 68.2k, False: 3.10k]
  ------------------
 3869|  68.2k|        if (!label_compare(mcp->old_module, name)) {
  ------------------
  |  | 1236|  68.2k|#define	label_compare	strcmp
  ------------------
  |  Branch (3869:13): [True: 0, False: 68.2k]
  ------------------
 3870|      0|            if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3870:17): [True: 0, False: 0]
  ------------------
 3871|      0|				   NETSNMP_DS_LIB_MIB_WARNINGS)) {
  ------------------
  |  |  114|      0|#define NETSNMP_DS_LIB_MIB_WARNINGS         0
  ------------------
 3872|      0|                snmp_log(LOG_WARNING,
 3873|      0|                         "Loading replacement module %s for %s (%s)\n",
 3874|      0|                         mcp->new_module, name, File);
 3875|      0|	    }
 3876|      0|            (void) netsnmp_read_module(mcp->new_module);
 3877|      0|            return 1;
 3878|      0|        }
 3879|  68.2k|    }
 3880|  3.10k|    return 0;
 3881|  3.10k|}
parse.c:print_module_not_found:
  798|  3.10k|{
  799|  3.10k|    if (first_err_module) {
  ------------------
  |  Branch (799:9): [True: 1, False: 3.10k]
  ------------------
  800|      1|        snmp_log(LOG_ERR, "MIB search path: %s\n",
  801|      1|                           netsnmp_get_mib_directory());
  802|      1|        first_err_module = 0;
  803|      1|    }
  804|  3.10k|    if (!last_err_module || strcmp(cp, last_err_module))
  ------------------
  |  Branch (804:9): [True: 66, False: 3.03k]
  |  Branch (804:29): [True: 3.03k, False: 0]
  ------------------
  805|  3.10k|        print_error("Cannot find module", cp, CONTINUE);
  ------------------
  |  |  162|  3.10k|#define CONTINUE    -1
  ------------------
  806|  3.10k|    if (last_err_module)
  ------------------
  |  Branch (806:9): [True: 3.03k, False: 66]
  ------------------
  807|  3.03k|        free(last_err_module);
  808|  3.10k|    last_err_module = strdup(cp);
  809|  3.10k|}
parse.c:unlink_tree:
  848|    198|{
  849|    198|    struct tree    *otp = NULL, *ntp = tp->parent;
  850|       |
  851|    198|    if (!ntp) {                 /* this tree has no parent */
  ------------------
  |  Branch (851:9): [True: 198, False: 0]
  ------------------
  852|    198|        DEBUGMSGTL(("unlink_tree", "Tree node %s has no parent\n",
  ------------------
  |  |   66|    198|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    198|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 198]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 198]
  |  |  ------------------
  ------------------
  853|    198|                    tp->label));
  854|    198|    } else {
  855|      0|        ntp = ntp->child_list;
  856|       |
  857|      0|        while (ntp && ntp != tp) {
  ------------------
  |  Branch (857:16): [True: 0, False: 0]
  |  Branch (857:23): [True: 0, False: 0]
  ------------------
  858|      0|            otp = ntp;
  859|      0|            ntp = ntp->next_peer;
  860|      0|        }
  861|      0|        if (!ntp)
  ------------------
  |  Branch (861:13): [True: 0, False: 0]
  ------------------
  862|      0|            snmp_log(LOG_EMERG, "Can't find %s in %s's children\n",
  863|      0|                     tp->label, tp->parent->label);
  864|      0|        else if (otp)
  ------------------
  |  Branch (864:18): [True: 0, False: 0]
  ------------------
  865|      0|            otp->next_peer = ntp->next_peer;
  866|      0|        else
  867|      0|            tp->parent->child_list = tp->next_peer;
  868|      0|    }
  869|       |
  870|    198|    if (tree_head == tp)
  ------------------
  |  Branch (870:9): [True: 198, False: 0]
  ------------------
  871|    198|        tree_head = tp->next_peer;
  872|    198|}
parse.c:free_tree:
  903|    198|{
  904|    198|    if (!Tree)
  ------------------
  |  Branch (904:9): [True: 0, False: 198]
  ------------------
  905|      0|        return;
  906|       |
  907|    198|    unlink_tbucket(Tree);
  908|    198|    free_partial_tree(Tree, FALSE);
  ------------------
  |  |  125|    198|#define FALSE 0
  ------------------
  909|    198|    if (Tree->module_list != &Tree->modid)
  ------------------
  |  Branch (909:9): [True: 0, False: 198]
  ------------------
  910|      0|        free(Tree->module_list);
  911|    198|    free(Tree);
  912|    198|}
parse.c:free_partial_tree:
  876|    198|{
  877|    198|    if (!tp)
  ------------------
  |  Branch (877:9): [True: 0, False: 198]
  ------------------
  878|      0|        return;
  879|       |
  880|       |    /*
  881|       |     * remove the data from this tree node 
  882|       |     */
  883|    198|    free_enums(&tp->enums);
  884|    198|    free_ranges(&tp->ranges);
  885|    198|    free_indexes(&tp->indexes);
  886|    198|    free_varbinds(&tp->varbinds);
  887|    198|    if (!keep_label)
  ------------------
  |  Branch (887:9): [True: 198, False: 0]
  ------------------
  888|    198|        SNMP_FREE(tp->label);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 198, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
  889|    198|    SNMP_FREE(tp->hint);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 198]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
  890|    198|    SNMP_FREE(tp->units);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 198]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
  891|    198|    SNMP_FREE(tp->description);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 198]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
  892|    198|    SNMP_FREE(tp->reference);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 198]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
  893|    198|    SNMP_FREE(tp->augments);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 198]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
  894|       |    SNMP_FREE(tp->defaultValue);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 198]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
  895|    198|}
parse.c:scan_directory:
 4994|     66|{
 4995|     66|    DIR            *dir, *dir2;
 4996|     66|    struct dirent  *file;
 4997|     66|    char          **filenames = NULL;
 4998|     66|    int             fname_len, i, filename_count = 0, array_size = 0;
 4999|     66|    char           *tmpstr;
 5000|       |
 5001|     66|    *result = NULL;
 5002|       |
 5003|     66|    dir = opendir(dirname);
 5004|     66|    if (!dir)
  ------------------
  |  Branch (5004:9): [True: 66, False: 0]
  ------------------
 5005|     66|        return -1;
 5006|       |
 5007|      0|    while ((file = readdir(dir))) {
  ------------------
  |  Branch (5007:12): [True: 0, False: 0]
  ------------------
 5008|       |        /*
 5009|       |         * Only parse file names that don't begin with a '.'
 5010|       |         * Also skip files ending in '~', or starting/ending
 5011|       |         * with '#' which are typically editor backup files.
 5012|       |         */
 5013|      0|        fname_len = strlen(file->d_name);
 5014|      0|        if (fname_len > 0 && file->d_name[0] != '.'
  ------------------
  |  Branch (5014:13): [True: 0, False: 0]
  |  Branch (5014:30): [True: 0, False: 0]
  ------------------
 5015|      0|            && file->d_name[0] != '#'
  ------------------
  |  Branch (5015:16): [True: 0, False: 0]
  ------------------
 5016|      0|            && file->d_name[fname_len-1] != '#'
  ------------------
  |  Branch (5016:16): [True: 0, False: 0]
  ------------------
 5017|      0|            && file->d_name[fname_len-1] != '~') {
  ------------------
  |  Branch (5017:16): [True: 0, False: 0]
  ------------------
 5018|      0|            if (asprintf(&tmpstr, "%s/%s", dirname, file->d_name) < 0)
  ------------------
  |  Branch (5018:17): [True: 0, False: 0]
  ------------------
 5019|      0|                continue;
 5020|      0|            dir2 = opendir(tmpstr);
 5021|      0|            if (dir2) {
  ------------------
  |  Branch (5021:17): [True: 0, False: 0]
  ------------------
 5022|       |                /* file is a directory, don't read it */
 5023|      0|                closedir(dir2);
 5024|      0|            } else {
 5025|      0|                if (filename_count >= array_size) {
  ------------------
  |  Branch (5025:21): [True: 0, False: 0]
  ------------------
 5026|      0|                    char **new_filenames;
 5027|       |
 5028|      0|                    array_size = (array_size + 16) * 2;
 5029|      0|                    new_filenames = realloc(filenames,
 5030|      0|                                        array_size * sizeof(filenames[0]));
 5031|      0|                    if (!new_filenames) {
  ------------------
  |  Branch (5031:25): [True: 0, False: 0]
  ------------------
 5032|      0|                        free(tmpstr);
 5033|      0|                        for (i = 0; i < filename_count; i++)
  ------------------
  |  Branch (5033:37): [True: 0, False: 0]
  ------------------
 5034|      0|                            free(filenames[i]);
 5035|      0|                        free(filenames);
 5036|      0|                        closedir(dir);
 5037|      0|                        return -1;
 5038|      0|                    }
 5039|      0|                    filenames = new_filenames;
 5040|      0|                }
 5041|      0|                filenames[filename_count++] = tmpstr;
 5042|      0|                tmpstr = NULL;
 5043|      0|            }
 5044|      0|            free(tmpstr);
 5045|      0|        }
 5046|      0|    }
 5047|      0|    closedir(dir);
 5048|       |
 5049|      0|    if (filenames)
  ------------------
  |  Branch (5049:9): [True: 0, False: 0]
  ------------------
 5050|      0|        qsort(filenames, filename_count, sizeof(filenames[0]), elemcmp);
 5051|      0|    *result = filenames;
 5052|       |
 5053|      0|    return filename_count;
 5054|      0|}
parse.c:free_ranges:
 5336|    198|{
 5337|    198|    if (spp && *spp) {
  ------------------
  |  Branch (5337:9): [True: 198, False: 0]
  |  Branch (5337:16): [True: 0, False: 198]
  ------------------
 5338|      0|        struct range_list *pp, *npp;
 5339|       |
 5340|      0|        pp = *spp;
 5341|      0|        *spp = NULL;
 5342|       |
 5343|      0|        while (pp) {
  ------------------
  |  Branch (5343:16): [True: 0, False: 0]
  ------------------
 5344|      0|            npp = pp->next;
 5345|      0|            free(pp);
 5346|      0|            pp = npp;
 5347|      0|        }
 5348|      0|    }
 5349|    198|}
parse.c:free_enums:
 5353|    198|{
 5354|    198|    if (spp && *spp) {
  ------------------
  |  Branch (5354:9): [True: 198, False: 0]
  |  Branch (5354:16): [True: 0, False: 198]
  ------------------
 5355|      0|        struct enum_list *pp, *npp;
 5356|       |
 5357|      0|        pp = *spp;
 5358|      0|        *spp = NULL;
 5359|       |
 5360|      0|        while (pp) {
  ------------------
  |  Branch (5360:16): [True: 0, False: 0]
  ------------------
 5361|      0|            npp = pp->next;
 5362|      0|            if (pp->label)
  ------------------
  |  Branch (5362:17): [True: 0, False: 0]
  ------------------
 5363|      0|                free(pp->label);
 5364|      0|            free(pp);
 5365|      0|            pp = npp;
 5366|      0|        }
 5367|      0|    }
 5368|    198|}

register_prenetsnmp_mib_handler:
  255|  2.31k|{
  256|  2.31k|    return internal_register_config_handler(type, token, parser, NULL, releaser,
  257|  2.31k|					    help, PREMIB_CONFIG);
  ------------------
  |  |   15|  2.31k|#define PREMIB_CONFIG 1
  ------------------
  258|  2.31k|}
register_config_handler:
  310|  4.15k|{
  311|  4.15k|    return internal_register_config_handler(type, token, parser, NULL, releaser,
  312|  4.15k|					    help, NORMAL_CONFIG);
  ------------------
  |  |   14|  4.15k|#define NORMAL_CONFIG 0
  ------------------
  313|  4.15k|}
register_const_config_handler:
  320|     66|{
  321|     66|    return internal_register_config_handler(type, token, NULL, parser, releaser,
  322|     66|					    help, NORMAL_CONFIG);
  ------------------
  |  |   14|     66|#define NORMAL_CONFIG 0
  ------------------
  323|     66|}
register_app_config_handler:
  329|    132|{
  330|       |    return register_config_handler(NULL, token, parser, releaser, help);
  331|    132|}
unregister_config_handler:
  355|  11.0k|{
  356|  11.0k|    struct config_files **ctmp = &config_files;
  357|  11.0k|    struct config_line  **ltmp;
  358|  11.0k|    const char           *type = type_param;
  359|       |
  360|  11.0k|    if (type == NULL || *type == '\0') {
  ------------------
  |  Branch (360:9): [True: 0, False: 11.0k]
  |  Branch (360:25): [True: 0, False: 11.0k]
  ------------------
  361|      0|        type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  362|      0|				     NETSNMP_DS_LIB_APPTYPE);
  ------------------
  |  |  157|      0|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
  363|      0|    }
  364|       |
  365|       |    /*
  366|       |     * Handle multiple types (recursively)
  367|       |     */
  368|  11.0k|    if (strchr(type, ':')) {
  ------------------
  |  Branch (368:9): [True: 0, False: 11.0k]
  ------------------
  369|      0|        char                buf[STRINGMAX];
  370|      0|        char               *cptr = buf;
  371|       |
  372|      0|        strlcpy(buf, type, STRINGMAX);
  ------------------
  |  |   12|      0|#define STRINGMAX 1024
  ------------------
  373|      0|        while (cptr) {
  ------------------
  |  Branch (373:16): [True: 0, False: 0]
  ------------------
  374|      0|            char* c = cptr;
  375|      0|            cptr = strchr(cptr, ':');
  376|      0|            if(cptr) {
  ------------------
  |  Branch (376:16): [True: 0, False: 0]
  ------------------
  377|      0|                *cptr = '\0';
  378|      0|                ++cptr;
  379|      0|            }
  380|      0|            unregister_config_handler(c, token);
  381|      0|        }
  382|      0|        return;
  383|      0|    }
  384|       |    
  385|       |    /*
  386|       |     * find type in current list 
  387|       |     */
  388|  11.0k|    while (*ctmp != NULL && strcmp((*ctmp)->fileHeader, type)) {
  ------------------
  |  Branch (388:12): [True: 6.66k, False: 4.35k]
  |  Branch (388:29): [True: 0, False: 6.66k]
  ------------------
  389|      0|        ctmp = &((*ctmp)->next);
  390|      0|    }
  391|       |
  392|  11.0k|    if (*ctmp == NULL) {
  ------------------
  |  Branch (392:9): [True: 4.35k, False: 6.66k]
  ------------------
  393|       |        /*
  394|       |         * Not found, return. 
  395|       |         */
  396|  4.35k|        return;
  397|  4.35k|    }
  398|       |
  399|  6.66k|    ltmp = &((*ctmp)->start);
  400|  6.66k|    if (*ltmp == NULL) {
  ------------------
  |  Branch (400:9): [True: 0, False: 6.66k]
  ------------------
  401|       |        /*
  402|       |         * Not found, return. 
  403|       |         */
  404|      0|        return;
  405|      0|    }
  406|  6.66k|    if (strcmp((*ltmp)->config_token, token) == 0) {
  ------------------
  |  Branch (406:9): [True: 6.66k, False: 0]
  ------------------
  407|       |        /*
  408|       |         * found it at the top of the list 
  409|       |         */
  410|  6.66k|        struct config_line *ltmp2 = (*ltmp)->next;
  411|  6.66k|        if ((*ltmp)->free_func)
  ------------------
  |  Branch (411:13): [True: 462, False: 6.20k]
  ------------------
  412|    462|            (*ltmp)->free_func();
  413|  6.66k|        SNMP_FREE((*ltmp)->config_token);
  ------------------
  |  |   62|  6.66k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 6.66k, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 6.66k]
  |  |  ------------------
  ------------------
  414|  6.66k|        SNMP_FREE((*ltmp)->help);
  ------------------
  |  |   62|  6.66k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 5.87k, False: 792]
  |  |  |  Branch (62:66): [Folded, False: 6.66k]
  |  |  ------------------
  ------------------
  415|  6.66k|        SNMP_FREE(*ltmp);
  ------------------
  |  |   62|  6.66k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 6.66k, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 6.66k]
  |  |  ------------------
  ------------------
  416|  6.66k|        (*ctmp)->start = ltmp2;
  417|  6.66k|        return;
  418|  6.66k|    }
  419|      0|    while ((*ltmp)->next != NULL
  ------------------
  |  Branch (419:12): [True: 0, False: 0]
  ------------------
  420|      0|           && strcmp((*ltmp)->next->config_token, token)) {
  ------------------
  |  Branch (420:15): [True: 0, False: 0]
  ------------------
  421|      0|        ltmp = &((*ltmp)->next);
  422|      0|    }
  423|      0|    if ((*ltmp)->next != NULL) {
  ------------------
  |  Branch (423:9): [True: 0, False: 0]
  ------------------
  424|      0|        struct config_line *ltmp2 = (*ltmp)->next->next;
  425|      0|        if ((*ltmp)->next->free_func)
  ------------------
  |  Branch (425:13): [True: 0, False: 0]
  ------------------
  426|      0|            (*ltmp)->next->free_func();
  427|      0|        SNMP_FREE((*ltmp)->next->config_token);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  428|      0|        SNMP_FREE((*ltmp)->next->help);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  429|       |        SNMP_FREE((*ltmp)->next);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  430|      0|        (*ltmp)->next = ltmp2;
  431|      0|    }
  432|      0|}
unregister_all_config_handlers:
  444|     66|{
  445|     66|    struct config_files *ctmp, *save;
  446|     66|    struct config_line *ltmp;
  447|       |
  448|       |    /*
  449|       |     * Keep using config_files until there are no more! 
  450|       |     */
  451|    198|    for (ctmp = config_files; ctmp;) {
  ------------------
  |  Branch (451:31): [True: 132, False: 66]
  ------------------
  452|  6.79k|        for (ltmp = ctmp->start; ltmp; ltmp = ctmp->start) {
  ------------------
  |  Branch (452:34): [True: 6.66k, False: 132]
  ------------------
  453|  6.66k|            unregister_config_handler(ctmp->fileHeader,
  454|  6.66k|                                      ltmp->config_token);
  455|  6.66k|        }
  456|    132|        SNMP_FREE(ctmp->fileHeader);
  ------------------
  |  |   62|    132|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 132, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 132]
  |  |  ------------------
  ------------------
  457|    132|        save = ctmp->next;
  458|       |        SNMP_FREE(ctmp);
  ------------------
  |  |   62|    132|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 132, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 132]
  |  |  ------------------
  ------------------
  459|    132|        ctmp = save;
  460|    132|        config_files = save;
  461|    132|    }
  462|     66|}
netsnmp_config_remember_free_list:
  690|     66|{
  691|     66|    struct read_config_memory *tmpmem;
  692|     66|    while (*mem) {
  ------------------
  |  Branch (692:12): [True: 0, False: 66]
  ------------------
  693|      0|        SNMP_FREE((*mem)->line);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  694|      0|        tmpmem = (*mem)->next;
  695|       |        SNMP_FREE(*mem);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  696|      0|        *mem = tmpmem;
  697|      0|    }
  698|     66|}
netsnmp_config_process_memory_list:
  703|    132|{
  704|       |
  705|    132|    struct read_config_memory *mem;
  706|       |
  707|    132|    if (!memp)
  ------------------
  |  Branch (707:9): [True: 0, False: 132]
  ------------------
  708|      0|        return;
  709|       |
  710|    132|    mem = *memp;
  711|       |
  712|    132|    while (mem) {
  ------------------
  |  Branch (712:12): [True: 0, False: 132]
  ------------------
  713|      0|        DEBUGMSGTL(("read_config:mem", "processing memory: %s\n", mem->line));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  714|      0|        snmp_config_when(mem->line, when);
  715|      0|        mem = mem->next;
  716|      0|    }
  717|       |
  718|    132|    if (clear)
  ------------------
  |  Branch (718:9): [True: 66, False: 66]
  ------------------
  719|     66|        netsnmp_config_remember_free_list(memp);
  720|    132|}
netsnmp_config_process_memories_when:
  741|    132|{
  742|    132|    netsnmp_config_process_memory_list(&memorylist, when, clear);
  743|    132|}
free_config:
 1018|     66|{
 1019|     66|    struct config_files *ctmp = config_files;
 1020|     66|    struct config_line *ltmp;
 1021|       |
 1022|    198|    for (; ctmp != NULL; ctmp = ctmp->next)
  ------------------
  |  Branch (1022:12): [True: 132, False: 66]
  ------------------
 1023|  6.79k|        for (ltmp = ctmp->start; ltmp != NULL; ltmp = ltmp->next)
  ------------------
  |  Branch (1023:34): [True: 6.66k, False: 132]
  ------------------
 1024|  6.66k|            if (ltmp->free_func)
  ------------------
  |  Branch (1024:17): [True: 462, False: 6.20k]
  ------------------
 1025|    462|                (*(ltmp->free_func)) ();
 1026|     66|}
read_configs:
 1071|     66|{
 1072|     66|    char *optional_config = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1073|     66|					       NETSNMP_DS_LIB_OPTIONALCONFIG);
  ------------------
  |  |  156|     66|#define NETSNMP_DS_LIB_OPTIONALCONFIG    5
  ------------------
 1074|       |
 1075|     66|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1076|     66|                        SNMP_CALLBACK_PRE_READ_CONFIG, NULL);
  ------------------
  |  |   30|     66|#define SNMP_CALLBACK_PRE_READ_CONFIG	        7
  ------------------
 1077|       |
 1078|     66|    DEBUGMSGTL(("read_config", "reading normal configuration tokens\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 1079|       |
 1080|     66|    if ((NULL != optional_config) && (*optional_config == '-')) {
  ------------------
  |  Branch (1080:9): [True: 0, False: 66]
  |  Branch (1080:38): [True: 0, False: 0]
  ------------------
 1081|      0|        (void)read_configs_optional(++optional_config, NORMAL_CONFIG);
  ------------------
  |  |   14|      0|#define NORMAL_CONFIG 0
  ------------------
 1082|      0|        optional_config = NULL; /* clear, so we don't read them twice */
 1083|      0|    }
 1084|       |
 1085|     66|    (void)read_config_files(NORMAL_CONFIG);
  ------------------
  |  |   14|     66|#define NORMAL_CONFIG 0
  ------------------
 1086|       |
 1087|       |    /*
 1088|       |     * do this even when the normal above wasn't done 
 1089|       |     */
 1090|     66|    if (NULL != optional_config)
  ------------------
  |  Branch (1090:9): [True: 0, False: 66]
  ------------------
 1091|      0|        (void)read_configs_optional(optional_config, NORMAL_CONFIG);
  ------------------
  |  |   14|      0|#define NORMAL_CONFIG 0
  ------------------
 1092|       |
 1093|     66|    netsnmp_config_process_memories_when(NORMAL_CONFIG, 1);
  ------------------
  |  |   14|     66|#define NORMAL_CONFIG 0
  ------------------
 1094|       |
 1095|     66|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1096|     66|			   NETSNMP_DS_LIB_HAVE_READ_CONFIG, 1);
  ------------------
  |  |   87|     66|#define NETSNMP_DS_LIB_HAVE_READ_CONFIG    27   /* have the config tokens been processed */
  ------------------
 1097|     66|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1098|     66|                        SNMP_CALLBACK_POST_READ_CONFIG, NULL);
  ------------------
  |  |   24|     66|#define SNMP_CALLBACK_POST_READ_CONFIG	        0
  ------------------
 1099|     66|}
read_premib_configs:
 1103|     66|{
 1104|     66|    char *optional_config = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1105|     66|					       NETSNMP_DS_LIB_OPTIONALCONFIG);
  ------------------
  |  |  156|     66|#define NETSNMP_DS_LIB_OPTIONALCONFIG    5
  ------------------
 1106|       |
 1107|     66|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1108|     66|                        SNMP_CALLBACK_PRE_PREMIB_READ_CONFIG, NULL);
  ------------------
  |  |   31|     66|#define SNMP_CALLBACK_PRE_PREMIB_READ_CONFIG	8
  ------------------
 1109|       |
 1110|     66|    DEBUGMSGTL(("read_config", "reading premib configuration tokens\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 1111|       |
 1112|     66|    if ((NULL != optional_config) && (*optional_config == '-')) {
  ------------------
  |  Branch (1112:9): [True: 0, False: 66]
  |  Branch (1112:38): [True: 0, False: 0]
  ------------------
 1113|      0|        (void)read_configs_optional(++optional_config, PREMIB_CONFIG);
  ------------------
  |  |   15|      0|#define PREMIB_CONFIG 1
  ------------------
 1114|      0|        optional_config = NULL; /* clear, so we don't read them twice */
 1115|      0|    }
 1116|       |
 1117|     66|    (void)read_config_files(PREMIB_CONFIG);
  ------------------
  |  |   15|     66|#define PREMIB_CONFIG 1
  ------------------
 1118|       |
 1119|     66|    if (NULL != optional_config)
  ------------------
  |  Branch (1119:9): [True: 0, False: 66]
  ------------------
 1120|      0|        (void)read_configs_optional(optional_config, PREMIB_CONFIG);
  ------------------
  |  |   15|      0|#define PREMIB_CONFIG 1
  ------------------
 1121|       |
 1122|     66|    netsnmp_config_process_memories_when(PREMIB_CONFIG, 0);
  ------------------
  |  |   15|     66|#define PREMIB_CONFIG 1
  ------------------
 1123|       |
 1124|     66|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1125|     66|			   NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG, 1);
  ------------------
  |  |   86|     66|#define NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG 26       /* have the pre-mib parsing config tokens been processed */
  ------------------
 1126|     66|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1127|     66|                        SNMP_CALLBACK_POST_PREMIB_READ_CONFIG, NULL);
  ------------------
  |  |   27|     66|#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG	3
  ------------------
 1128|     66|}
set_configuration_directory:
 1140|      1|{
 1141|      1|    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1142|      1|			  NETSNMP_DS_LIB_CONFIGURATION_DIR, dir);
  ------------------
  |  |  160|      1|#define NETSNMP_DS_LIB_CONFIGURATION_DIR 9
  ------------------
 1143|      1|}
get_configuration_directory:
 1159|      1|{
 1160|      1|    char            defaultPath[SPRINT_MAX_LEN];
 1161|      1|    const char     *homepath;
 1162|       |
 1163|      1|    if (NULL == netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1163:9): [True: 1, False: 0]
  ------------------
 1164|      1|				      NETSNMP_DS_LIB_CONFIGURATION_DIR)) {
  ------------------
  |  |  160|      1|#define NETSNMP_DS_LIB_CONFIGURATION_DIR 9
  ------------------
 1165|      1|        homepath = netsnmp_gethomedir();
 1166|      1|        snprintf(defaultPath, sizeof(defaultPath), "%s%c%s%c%s%s%s%s",
 1167|      1|                SNMPCONFPATH, ENV_SEPARATOR_CHAR,
  ------------------
  |  | 2027|      1|#define SNMPCONFPATH "/usr/local/net-snmp-master/etc/snmp"
  ------------------
                              SNMPCONFPATH, ENV_SEPARATOR_CHAR,
  ------------------
  |  |   70|      1|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 1168|      1|                SNMPSHAREPATH, ENV_SEPARATOR_CHAR, SNMPLIBPATH,
  ------------------
  |  | 2026|      1|#define SNMPSHAREPATH "/usr/local/net-snmp-master/share/snmp"
  ------------------
                              SNMPSHAREPATH, ENV_SEPARATOR_CHAR, SNMPLIBPATH,
  ------------------
  |  |   70|      1|#define ENV_SEPARATOR_CHAR ':'
  ------------------
                              SNMPSHAREPATH, ENV_SEPARATOR_CHAR, SNMPLIBPATH,
  ------------------
  |  | 2025|      1|#define SNMPLIBPATH "/usr/local/net-snmp-master/lib/snmp"
  ------------------
 1169|      1|                ((homepath == NULL) ? "" : ENV_SEPARATOR),
  ------------------
  |  |   67|      1|#define ENV_SEPARATOR ":"
  ------------------
  |  Branch (1169:18): [True: 0, False: 1]
  ------------------
 1170|      1|                ((homepath == NULL) ? "" : homepath),
  ------------------
  |  Branch (1170:18): [True: 0, False: 1]
  ------------------
 1171|      1|                ((homepath == NULL) ? "" : "/.snmp"));
  ------------------
  |  Branch (1171:18): [True: 0, False: 1]
  ------------------
 1172|      1|        defaultPath[ sizeof(defaultPath)-1 ] = 0;
 1173|      1|        set_configuration_directory(defaultPath);
 1174|      1|    }
 1175|      1|    return (netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1176|      1|				  NETSNMP_DS_LIB_CONFIGURATION_DIR));
  ------------------
  |  |  160|      1|#define NETSNMP_DS_LIB_CONFIGURATION_DIR 9
  ------------------
 1177|      1|}
get_persistent_directory:
 1207|      1|{
 1208|      1|    if (NULL == netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1208:9): [True: 0, False: 1]
  ------------------
 1209|      1|				      NETSNMP_DS_LIB_PERSISTENT_DIR)) {
  ------------------
  |  |  159|      1|#define NETSNMP_DS_LIB_PERSISTENT_DIR    8
  ------------------
 1210|      0|        const char *persdir = netsnmp_getenv("SNMP_PERSISTENT_DIR");
 1211|      0|        if (NULL == persdir)
  ------------------
  |  Branch (1211:13): [True: 0, False: 0]
  ------------------
 1212|      0|            persdir = NETSNMP_PERSISTENT_DIRECTORY;
  ------------------
  |  | 1997|      0|#define NETSNMP_PERSISTENT_DIRECTORY "/var/net-snmp"
  ------------------
 1213|      0|        set_persistent_directory(persdir);
 1214|      0|    }
 1215|      1|    return (netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1216|      1|				  NETSNMP_DS_LIB_PERSISTENT_DIR));
  ------------------
  |  |  159|      1|#define NETSNMP_DS_LIB_PERSISTENT_DIR    8
  ------------------
 1217|      1|}
read_config_files_of_type:
 1404|    264|{
 1405|    264|    const char     *confpath, *persfile, *envconfpath;
 1406|    264|    char           *perspath;
 1407|    264|    int             ret = SNMPERR_GENERR;
  ------------------
  |  |  218|    264|#define SNMPERR_GENERR			(-1)
  ------------------
 1408|       |
 1409|    264|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    264|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1409:9): [True: 264, False: 0]
  ------------------
 1410|    264|                               NETSNMP_DS_LIB_DONT_PERSIST_STATE)
  ------------------
  |  |   92|    264|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
 1411|      0|        || netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1411:12): [True: 0, False: 0]
  ------------------
 1412|      0|                                  NETSNMP_DS_LIB_DISABLE_CONFIG_LOAD)
  ------------------
  |  |   66|      0|#define NETSNMP_DS_LIB_DISABLE_CONFIG_LOAD      NETSNMP_DS_LIB_DONT_READ_CONFIGS
  |  |  ------------------
  |  |  |  |   65|      0|#define NETSNMP_DS_LIB_DONT_READ_CONFIGS   6    /* don't read normal config files */
  |  |  ------------------
  ------------------
 1413|    264|        || (NULL == ctmp)) return ret;
  ------------------
  |  Branch (1413:12): [True: 0, False: 0]
  ------------------
 1414|       |
 1415|       |    /*
 1416|       |     * these shouldn't change
 1417|       |     */
 1418|      0|    confpath = get_configuration_directory();
 1419|      0|    persfile = netsnmp_getenv("SNMP_PERSISTENT_FILE");
 1420|      0|    envconfpath = netsnmp_getenv("SNMPCONFPATH");
 1421|       |
 1422|       |
 1423|       |        /*
 1424|       |         * read the config files. strdup() the result of
 1425|       |         * get_persistent_directory() to avoid that parsing the "persistentDir"
 1426|       |         * keyword transforms the perspath pointer into a dangling pointer.
 1427|       |         */
 1428|      0|        perspath = strdup(get_persistent_directory());
 1429|      0|        if (perspath == NULL) {
  ------------------
  |  Branch (1429:13): [True: 0, False: 0]
  ------------------
 1430|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1431|      0|        }
 1432|      0|        if (envconfpath == NULL) {
  ------------------
  |  Branch (1432:13): [True: 0, False: 0]
  ------------------
 1433|       |            /*
 1434|       |             * read just the config files (no persistent stuff), since
 1435|       |             * persistent path can change via conf file. Then get the
 1436|       |             * current persistent directory, and read files there.
 1437|       |             */
 1438|      0|            if ( read_config_files_in_path(confpath, ctmp, when, perspath,
  ------------------
  |  Branch (1438:18): [True: 0, False: 0]
  ------------------
 1439|      0|                                      persfile) == SNMPERR_SUCCESS )
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1440|      0|                ret = SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1441|      0|            free(perspath);
 1442|      0|            perspath = strdup(get_persistent_directory());
 1443|      0|            if (perspath == NULL) {
  ------------------
  |  Branch (1443:17): [True: 0, False: 0]
  ------------------
 1444|      0|                return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1445|      0|            }
 1446|      0|            if ( read_config_files_in_path(perspath, ctmp, when, perspath,
  ------------------
  |  Branch (1446:18): [True: 0, False: 0]
  ------------------
 1447|      0|                                      persfile) == SNMPERR_SUCCESS )
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1448|      0|                ret = SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1449|      0|        }
 1450|      0|        else {
 1451|       |            /*
 1452|       |             * only read path specified by user
 1453|       |             */
 1454|      0|            if ( read_config_files_in_path(envconfpath, ctmp, when, perspath,
  ------------------
  |  Branch (1454:18): [True: 0, False: 0]
  ------------------
 1455|      0|                                      persfile) == SNMPERR_SUCCESS )
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1456|      0|                ret = SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1457|      0|        }
 1458|      0|        free(perspath);
 1459|      0|        return ret;
 1460|      0|}
read_config_files:
 1468|    132|read_config_files(int when) {
 1469|       |
 1470|    132|    struct config_files *ctmp = config_files;
 1471|    132|    int                  ret  = SNMPERR_GENERR;
  ------------------
  |  |  218|    132|#define SNMPERR_GENERR			(-1)
  ------------------
 1472|       |
 1473|    132|    config_errors = 0;
 1474|       |
 1475|    132|    if (when == PREMIB_CONFIG)
  ------------------
  |  |   15|    132|#define PREMIB_CONFIG 1
  ------------------
  |  Branch (1475:9): [True: 66, False: 66]
  ------------------
 1476|     66|        free_config();
 1477|       |
 1478|       |    /*
 1479|       |     * read all config file types 
 1480|       |     */
 1481|    396|    for (; ctmp != NULL; ctmp = ctmp->next) {
  ------------------
  |  Branch (1481:12): [True: 264, False: 132]
  ------------------
 1482|    264|        if ( read_config_files_of_type(when, ctmp) == SNMPERR_SUCCESS )
  ------------------
  |  |  217|    264|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (1482:14): [True: 0, False: 264]
  ------------------
 1483|      0|            ret = SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1484|    264|    }
 1485|       |
 1486|    132|    if (config_errors) {
  ------------------
  |  Branch (1486:9): [True: 0, False: 132]
  ------------------
 1487|       |        snmp_log(LOG_ERR, "net-snmp: %d error(s) in config file(s)\n",
 1488|      0|                 config_errors);
 1489|      0|    }
 1490|    132|    return ret;
 1491|    132|}
read_config_store:
 1540|    132|{
 1541|    132|#ifdef NETSNMP_PERSISTENT_DIRECTORY
 1542|    132|    char            file[512], *filep;
 1543|    132|    FILE           *fout;
 1544|    132|#ifdef NETSNMP_PERSISTENT_MASK
 1545|    132|    mode_t          oldmask;
 1546|    132|#endif
 1547|       |
 1548|    132|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    132|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1548:9): [True: 132, False: 0]
  ------------------
 1549|    132|                               NETSNMP_DS_LIB_DONT_PERSIST_STATE)
  ------------------
  |  |   92|    132|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
 1550|      0|     || netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1550:9): [True: 0, False: 0]
  ------------------
 1551|    132|                               NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD)) return;
  ------------------
  |  |   95|      0|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD  35 /* don't load persistent file */
  ------------------
 1552|       |
 1553|       |    /*
 1554|       |     * store configuration directives in the following order of preference:
 1555|       |     * 1. ENV variable SNMP_PERSISTENT_FILE
 1556|       |     * 2. configured <NETSNMP_PERSISTENT_DIRECTORY>/<type>.conf
 1557|       |     */
 1558|      0|    if ((filep = netsnmp_getenv("SNMP_PERSISTENT_FILE")) == NULL) {
  ------------------
  |  Branch (1558:9): [True: 0, False: 0]
  ------------------
 1559|      0|        snprintf(file, sizeof(file),
 1560|      0|                 "%s/%s.conf", get_persistent_directory(), type);
 1561|      0|        file[ sizeof(file)-1 ] = 0;
 1562|      0|        filep = file;
 1563|      0|    }
 1564|      0|#ifdef NETSNMP_PERSISTENT_MASK
 1565|      0|    oldmask = umask(NETSNMP_PERSISTENT_MASK);
  ------------------
  |  | 1739|      0|#define NETSNMP_PERSISTENT_MASK 077
  ------------------
 1566|      0|#endif
 1567|      0|    if (mkdirhier(filep, NETSNMP_AGENT_DIRECTORY_MODE, 1)) {
  ------------------
  |  | 2002|      0|#define NETSNMP_AGENT_DIRECTORY_MODE 0700
  ------------------
  |  Branch (1567:9): [True: 0, False: 0]
  ------------------
 1568|      0|        snmp_log(LOG_ERR,
 1569|      0|                 "Failed to create the persistent directory for %s\n",
 1570|      0|                 file);
 1571|      0|    }
 1572|      0|    if ((fout = fopen(filep, "a")) != NULL) {
  ------------------
  |  Branch (1572:9): [True: 0, False: 0]
  ------------------
 1573|      0|        fprintf(fout, "%s", line);
 1574|      0|        if (line[strlen(line)] != '\n')
  ------------------
  |  Branch (1574:13): [True: 0, False: 0]
  ------------------
 1575|      0|            fprintf(fout, "\n");
 1576|      0|        DEBUGMSGTL(("read_config:store", "storing: %s\n", line));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1577|      0|        fflush(fout);
 1578|      0|#if defined(HAVE_FSYNC)
 1579|      0|        fsync(fileno(fout));
 1580|       |#elif defined(HAVE__GET_OSFHANDLE)
 1581|       |        {
 1582|       |            int fd;
 1583|       |            HANDLE h;
 1584|       |
 1585|       |            fd = fileno(fout);
 1586|       |            netsnmp_assert(fd != -1);
 1587|       |            /*
 1588|       |             * Use size_t instead of uintptr_t because not all supported
 1589|       |             * Windows compilers support uintptr_t.
 1590|       |             */
 1591|       |            h = (HANDLE)(size_t)_get_osfhandle(fd);
 1592|       |            netsnmp_assert(h != INVALID_HANDLE_VALUE);
 1593|       |            FlushFileBuffers(h);
 1594|       |        }
 1595|       |#endif
 1596|      0|        fclose(fout);
 1597|      0|    } else {
 1598|      0|        if (strcmp(NETSNMP_APPLICATION_CONFIG_TYPE, type) != 0) {
  ------------------
  |  |   22|      0|#define NETSNMP_APPLICATION_CONFIG_TYPE "snmpapp"
  ------------------
  |  Branch (1598:13): [True: 0, False: 0]
  ------------------
 1599|       |            /*
 1600|       |             * Ignore this error in client utilities, they can run with random
 1601|       |             * UID/GID and typically cannot write to /var. Error message just
 1602|       |             * confuses people.
 1603|       |             */
 1604|      0|            snmp_log(LOG_ERR, "read_config_store open failure on %s\n", filep);
 1605|      0|        }
 1606|      0|    }
 1607|      0|#ifdef NETSNMP_PERSISTENT_MASK
 1608|      0|    umask(oldmask);
 1609|      0|#endif
 1610|       |
 1611|      0|#endif
 1612|      0|}                               /* end read_config_store() */
snmp_save_persistent:
 1645|     66|{
 1646|     66|    char            file[512], fileold[SPRINT_MAX_LEN];
 1647|     66|    struct stat     statbuf;
 1648|     66|    int             j;
 1649|       |
 1650|     66|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1650:9): [True: 66, False: 0]
  ------------------
 1651|     66|                               NETSNMP_DS_LIB_DONT_PERSIST_STATE)
  ------------------
  |  |   92|     66|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
 1652|      0|     || netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1652:9): [True: 0, False: 0]
  ------------------
 1653|     66|                               NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE)) return;
  ------------------
  |  |   96|      0|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE  36 /* don't save persistent file */
  ------------------
 1654|       |
 1655|      0|    DEBUGMSGTL(("snmp_save_persistent", "saving %s files...\n", type));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1656|      0|    snprintf(file, sizeof(file),
 1657|      0|             "%s/%s.conf", get_persistent_directory(), type);
 1658|      0|    file[ sizeof(file)-1 ] = 0;
 1659|      0|    if (stat(file, &statbuf) == 0) {
  ------------------
  |  Branch (1659:9): [True: 0, False: 0]
  ------------------
 1660|      0|        for (j = 0; j <= NETSNMP_MAX_PERSISTENT_BACKUPS; j++) {
  ------------------
  |  | 2009|      0|#define NETSNMP_MAX_PERSISTENT_BACKUPS 10
  ------------------
  |  Branch (1660:21): [True: 0, False: 0]
  ------------------
 1661|      0|            snprintf(fileold, sizeof(fileold),
 1662|      0|                     "%s/%s.%d.conf", get_persistent_directory(), type, j);
 1663|      0|            fileold[ sizeof(fileold)-1 ] = 0;
 1664|      0|            if (stat(fileold, &statbuf) != 0) {
  ------------------
  |  Branch (1664:17): [True: 0, False: 0]
  ------------------
 1665|      0|                DEBUGMSGTL(("snmp_save_persistent",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1666|      0|                            " saving old config file: %s -> %s.\n", file,
 1667|      0|                            fileold));
 1668|      0|                if (rename(file, fileold)) {
  ------------------
  |  Branch (1668:21): [True: 0, False: 0]
  ------------------
 1669|      0|                    snmp_log(LOG_ERR, "Cannot rename %s to %s\n", file, fileold);
 1670|       |                     /* moving it failed, try nuking it, as leaving
 1671|       |                      * it around is very bad. */
 1672|      0|                    if (unlink(file) == -1)
  ------------------
  |  Branch (1672:25): [True: 0, False: 0]
  ------------------
 1673|      0|                        snmp_log(LOG_ERR, "Cannot unlink %s\n", file);
 1674|      0|                }
 1675|      0|                break;
 1676|      0|            }
 1677|      0|        }
 1678|      0|    }
 1679|       |    /*
 1680|       |     * save a warning header to the top of the new file 
 1681|       |     */
 1682|      0|    snprintf(fileold, sizeof(fileold),
 1683|      0|            "%s%s# Please save normal configuration tokens for %s in SNMPCONFPATH/%s.conf.\n# Only \"createUser\" tokens should be placed here by %s administrators.\n%s",
 1684|      0|            "#\n# net-snmp (or ucd-snmp) persistent data file.\n#\n############################################################################\n# STOP STOP STOP STOP STOP STOP STOP STOP STOP \n",
 1685|      0|            "#\n#          **** DO NOT EDIT THIS FILE ****\n#\n# STOP STOP STOP STOP STOP STOP STOP STOP STOP \n############################################################################\n#\n# DO NOT STORE CONFIGURATION ENTRIES HERE.\n",
 1686|      0|            type, type, type,
 1687|      0|	    "# (Did I mention: do not edit this file?)\n#\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
 1688|      0|    fileold[ sizeof(fileold)-1 ] = 0;
 1689|      0|    read_config_store(type, fileold);
 1690|      0|}
snmp_clean_persistent:
 1712|     66|{
 1713|     66|    char            file[512];
 1714|     66|    struct stat     statbuf;
 1715|     66|    int             j;
 1716|       |
 1717|     66|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1717:9): [True: 66, False: 0]
  ------------------
 1718|     66|                               NETSNMP_DS_LIB_DONT_PERSIST_STATE)
  ------------------
  |  |   92|     66|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
 1719|      0|     || netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1719:9): [True: 0, False: 0]
  ------------------
 1720|     66|                               NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE)) return;
  ------------------
  |  |   96|      0|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE  36 /* don't save persistent file */
  ------------------
 1721|       |
 1722|      0|    DEBUGMSGTL(("snmp_clean_persistent", "cleaning %s files...\n", type));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1723|      0|    snprintf(file, sizeof(file),
 1724|      0|             "%s/%s.conf", get_persistent_directory(), type);
 1725|      0|    file[ sizeof(file)-1 ] = 0;
 1726|      0|    if (stat(file, &statbuf) == 0) {
  ------------------
  |  Branch (1726:9): [True: 0, False: 0]
  ------------------
 1727|      0|        for (j = 0; j <= NETSNMP_MAX_PERSISTENT_BACKUPS; j++) {
  ------------------
  |  | 2009|      0|#define NETSNMP_MAX_PERSISTENT_BACKUPS 10
  ------------------
  |  Branch (1727:21): [True: 0, False: 0]
  ------------------
 1728|      0|            snprintf(file, sizeof(file),
 1729|      0|                     "%s/%s.%d.conf", get_persistent_directory(), type, j);
 1730|      0|            file[ sizeof(file)-1 ] = 0;
 1731|      0|            if (stat(file, &statbuf) == 0) {
  ------------------
  |  Branch (1731:17): [True: 0, False: 0]
  ------------------
 1732|      0|                DEBUGMSGTL(("snmp_clean_persistent",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1733|      0|                            " removing old config file: %s\n", file));
 1734|      0|                if (unlink(file) == -1)
  ------------------
  |  Branch (1734:21): [True: 0, False: 0]
  ------------------
 1735|      0|                    snmp_log(LOG_ERR, "Cannot unlink %s\n", file);
 1736|      0|            }
 1737|      0|        }
 1738|      0|    }
 1739|      0|}
skip_white_const:
 1808|    264|{
 1809|    264|    if (ptr == NULL)
  ------------------
  |  Branch (1809:9): [True: 0, False: 264]
  ------------------
 1810|      0|        return (NULL);
 1811|    396|    while (*ptr != 0 && isspace((unsigned char)*ptr))
  ------------------
  |  Branch (1811:12): [True: 264, False: 132]
  |  Branch (1811:25): [True: 132, False: 132]
  ------------------
 1812|    132|        ptr++;
 1813|    264|    if (*ptr == 0 || *ptr == '#')
  ------------------
  |  Branch (1813:9): [True: 132, False: 132]
  |  Branch (1813:22): [True: 0, False: 132]
  ------------------
 1814|    132|        return (NULL);
 1815|    132|    return (ptr);
 1816|    264|}
copy_nword_const:
 1873|    264|{
 1874|    264|    char            quote;
 1875|    264|    if (!from || !to)
  ------------------
  |  Branch (1875:9): [True: 0, False: 264]
  |  Branch (1875:18): [True: 0, False: 264]
  ------------------
 1876|      0|        return NULL;
 1877|    264|    if ((*from == '\"') || (*from == '\'')) {
  ------------------
  |  Branch (1877:9): [True: 0, False: 264]
  |  Branch (1877:28): [True: 0, False: 264]
  ------------------
 1878|      0|        quote = *(from++);
 1879|      0|        while ((*from != quote) && (*from != 0)) {
  ------------------
  |  Branch (1879:16): [True: 0, False: 0]
  |  Branch (1879:36): [True: 0, False: 0]
  ------------------
 1880|      0|            if ((*from == '\\') && (*(from + 1) != 0)) {
  ------------------
  |  Branch (1880:17): [True: 0, False: 0]
  |  Branch (1880:36): [True: 0, False: 0]
  ------------------
 1881|      0|                if (len > 0) {  /* don't copy beyond len bytes */
  ------------------
  |  Branch (1881:21): [True: 0, False: 0]
  ------------------
 1882|      0|                    *to++ = *(from + 1);
 1883|      0|                    if (--len == 0)
  ------------------
  |  Branch (1883:25): [True: 0, False: 0]
  ------------------
 1884|      0|                        *(to - 1) = '\0';       /* null protect the last spot */
 1885|      0|                }
 1886|      0|                from = from + 2;
 1887|      0|            } else {
 1888|      0|                if (len > 0) {  /* don't copy beyond len bytes */
  ------------------
  |  Branch (1888:21): [True: 0, False: 0]
  ------------------
 1889|      0|                    *to++ = *from++;
 1890|      0|                    if (--len == 0)
  ------------------
  |  Branch (1890:25): [True: 0, False: 0]
  ------------------
 1891|      0|                        *(to - 1) = '\0';       /* null protect the last spot */
 1892|      0|                } else
 1893|      0|                    from++;
 1894|      0|            }
 1895|      0|        }
 1896|      0|        if (*from == 0) {
  ------------------
  |  Branch (1896:13): [True: 0, False: 0]
  ------------------
 1897|      0|            DEBUGMSGTL(("read_config_copy_word",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1898|      0|                        "no end quote found in config string\n"));
 1899|      0|        } else
 1900|      0|            from++;
 1901|    264|    } else {
 1902|  1.18k|        while (*from != 0 && !isspace((unsigned char)(*from))) {
  ------------------
  |  Branch (1902:16): [True: 1.05k, False: 132]
  |  Branch (1902:30): [True: 924, False: 132]
  ------------------
 1903|    924|            if ((*from == '\\') && (*(from + 1) != 0)) {
  ------------------
  |  Branch (1903:17): [True: 0, False: 924]
  |  Branch (1903:36): [True: 0, False: 0]
  ------------------
 1904|      0|                if (len > 0) {  /* don't copy beyond len bytes */
  ------------------
  |  Branch (1904:21): [True: 0, False: 0]
  ------------------
 1905|      0|                    *to++ = *(from + 1);
 1906|      0|                    if (--len == 0)
  ------------------
  |  Branch (1906:25): [True: 0, False: 0]
  ------------------
 1907|      0|                        *(to - 1) = '\0';       /* null protect the last spot */
 1908|      0|                }
 1909|      0|                from = from + 2;
 1910|    924|            } else {
 1911|    924|                if (len > 0) {  /* don't copy beyond len bytes */
  ------------------
  |  Branch (1911:21): [True: 924, False: 0]
  ------------------
 1912|    924|                    *to++ = *from++;
 1913|    924|                    if (--len == 0)
  ------------------
  |  Branch (1913:25): [True: 0, False: 924]
  ------------------
 1914|      0|                        *(to - 1) = '\0';       /* null protect the last spot */
 1915|    924|                } else
 1916|      0|                    from++;
 1917|    924|            }
 1918|    924|        }
 1919|    264|    }
 1920|    264|    if (len > 0)
  ------------------
  |  Branch (1920:9): [True: 264, False: 0]
  ------------------
 1921|    264|        *to = 0;
 1922|    264|    from = skip_white_const(from);
 1923|    264|    return (from);
 1924|    264|}                               /* copy_nword */
read_config_save_octet_string:
 1965|     66|{
 1966|     66|    size_t          i;
 1967|     66|    const u_char   *cp;
 1968|       |
 1969|       |    /*
 1970|       |     * is everything easily printable
 1971|       |     */
 1972|     66|    for (i = 0, cp = str; i < len && cp &&
  ------------------
  |  Branch (1972:27): [True: 66, False: 0]
  |  Branch (1972:38): [True: 66, False: 0]
  ------------------
 1973|     66|         (isalpha(*cp) || isdigit(*cp) || *cp == ' '); cp++, i++);
  ------------------
  |  Branch (1973:11): [True: 0, False: 66]
  |  Branch (1973:27): [True: 0, False: 66]
  |  Branch (1973:43): [True: 0, False: 66]
  ------------------
 1974|       |
 1975|     66|    if (len != 0 && i == len) {
  ------------------
  |  Branch (1975:9): [True: 66, False: 0]
  |  Branch (1975:21): [True: 0, False: 66]
  ------------------
 1976|      0|        *saveto++ = '"';
 1977|      0|        memcpy(saveto, str, len);
 1978|      0|        saveto += len;
 1979|      0|        *saveto++ = '"';
 1980|      0|        *saveto = '\0';
 1981|     66|    } else {
 1982|     66|        if (str != NULL) {
  ------------------
  |  Branch (1982:13): [True: 66, False: 0]
  ------------------
 1983|     66|            sprintf(saveto, "0x");
 1984|     66|            saveto += 2;
 1985|  1.18k|            for (i = 0; i < len; i++) {
  ------------------
  |  Branch (1985:25): [True: 1.12k, False: 66]
  ------------------
 1986|  1.12k|                sprintf(saveto, "%02x", str[i]);
 1987|  1.12k|                saveto = saveto + 2;
 1988|  1.12k|            }
 1989|     66|        } else {
 1990|      0|            sprintf(saveto, "\"\"");
 1991|      0|            saveto += 2;
 1992|      0|        }
 1993|     66|    }
 1994|     66|    return saveto;
 1995|     66|}
read_config.c:internal_register_config_handler:
  152|  6.79k|{
  153|  6.79k|    struct config_files **ctmp = &config_files;
  154|  6.79k|    struct config_line  **ltmp;
  155|  6.79k|    const char           *type = type_param;
  156|       |
  157|  6.79k|    if (type == NULL || *type == '\0') {
  ------------------
  |  Branch (157:9): [True: 132, False: 6.66k]
  |  Branch (157:25): [True: 132, False: 6.53k]
  ------------------
  158|    264|        type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|    264|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  159|    264|				     NETSNMP_DS_LIB_APPTYPE);
  ------------------
  |  |  157|    264|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
  160|    264|    }
  161|       |
  162|       |    /*
  163|       |     * Handle multiple types (recursively)
  164|       |     */
  165|  6.79k|    if (strchr(type, ':')) {
  ------------------
  |  Branch (165:9): [True: 132, False: 6.66k]
  ------------------
  166|    132|        struct config_line *ltmp2 = NULL;
  167|    132|        char                buf[STRINGMAX];
  168|    132|        char               *cptr = buf;
  169|       |
  170|    132|        strlcpy(buf, type, STRINGMAX);
  ------------------
  |  |   12|    132|#define STRINGMAX 1024
  ------------------
  171|    396|        while (cptr) {
  ------------------
  |  Branch (171:16): [True: 264, False: 132]
  ------------------
  172|    264|            char* c = cptr;
  173|    264|            cptr = strchr(cptr, ':');
  174|    264|            if(cptr) {
  ------------------
  |  Branch (174:16): [True: 132, False: 132]
  ------------------
  175|    132|                *cptr = '\0';
  176|    132|                ++cptr;
  177|    132|            }
  178|    264|            ltmp2 = internal_register_config_handler(c, token, parser1, parser2,
  179|    264|                                                     releaser, help, when);
  180|    264|        }
  181|    132|        return ltmp2;
  182|    132|    }
  183|       |    
  184|       |    /*
  185|       |     * Find type in current list  -OR-  create a new file type.
  186|       |     */
  187|  7.78k|    while (*ctmp != NULL && strcmp((*ctmp)->fileHeader, type)) {
  ------------------
  |  Branch (187:12): [True: 7.65k, False: 132]
  |  Branch (187:29): [True: 1.12k, False: 6.53k]
  ------------------
  188|  1.12k|        ctmp = &((*ctmp)->next);
  189|  1.12k|    }
  190|       |
  191|  6.66k|    if (*ctmp == NULL) {
  ------------------
  |  Branch (191:9): [True: 132, False: 6.53k]
  ------------------
  192|    132|        *ctmp = (struct config_files *)
  193|    132|            calloc(1, sizeof(struct config_files));
  194|    132|        if (!*ctmp) {
  ------------------
  |  Branch (194:13): [True: 0, False: 132]
  ------------------
  195|      0|            return NULL;
  196|      0|        }
  197|       |
  198|    132|        (*ctmp)->fileHeader = strdup(type);
  199|    132|        if (!(*ctmp)->fileHeader) {
  ------------------
  |  Branch (199:13): [True: 0, False: 132]
  ------------------
  200|      0|            free(*ctmp);
  201|      0|            *ctmp = NULL;
  202|      0|            return NULL;
  203|      0|        }
  204|    132|        DEBUGMSGTL(("9:read_config:type", "new type %s\n", type));
  ------------------
  |  |   66|    132|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    132|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 132]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 132]
  |  |  ------------------
  ------------------
  205|    132|    }
  206|       |
  207|  6.66k|    DEBUGMSGTL(("9:read_config:register_handler", "registering %s %s\n",
  ------------------
  |  |   66|  6.66k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  6.66k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 6.66k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 6.66k]
  |  |  ------------------
  ------------------
  208|  6.66k|                type, token));
  209|       |    /*
  210|       |     * Find parser type in current list  -OR-  create a new
  211|       |     * line parser entry.
  212|       |     */
  213|  6.66k|    ltmp = &((*ctmp)->start);
  214|       |
  215|   245k|    while (*ltmp != NULL && strcmp((*ltmp)->config_token, token)) {
  ------------------
  |  Branch (215:12): [True: 239k, False: 6.66k]
  |  Branch (215:29): [True: 239k, False: 0]
  ------------------
  216|   239k|        ltmp = &((*ltmp)->next);
  217|   239k|    }
  218|       |
  219|  6.66k|    if (*ltmp == NULL) {
  ------------------
  |  Branch (219:9): [True: 6.66k, False: 0]
  ------------------
  220|  6.66k|        *ltmp = (struct config_line *)
  221|  6.66k|            calloc(1, sizeof(struct config_line));
  222|  6.66k|        if (!*ltmp) {
  ------------------
  |  Branch (222:13): [True: 0, False: 6.66k]
  ------------------
  223|      0|            return NULL;
  224|      0|        }
  225|       |
  226|  6.66k|        (*ltmp)->config_time = when;
  227|  6.66k|        (*ltmp)->config_token = strdup(token);
  228|  6.66k|        if (!(*ltmp)->config_token) {
  ------------------
  |  Branch (228:13): [True: 0, False: 6.66k]
  ------------------
  229|      0|            free(*ltmp);
  230|      0|            *ltmp = NULL;
  231|      0|            return NULL;
  232|      0|        }
  233|       |
  234|  6.66k|        if (help != NULL)
  ------------------
  |  Branch (234:13): [True: 5.87k, False: 792]
  ------------------
  235|  5.87k|            (*ltmp)->help = strdup(help);
  236|  6.66k|    }
  237|       |
  238|       |    /*
  239|       |     * Add/Replace the parse/free functions for the given line type
  240|       |     * in the given file type.
  241|       |     */
  242|  6.66k|    (*ltmp)->parse_line1 = parser1;
  243|  6.66k|    (*ltmp)->parse_line2 = parser2;
  244|  6.66k|    (*ltmp)->free_func = releaser;
  245|       |
  246|  6.66k|    return (*ltmp);
  247|       |
  248|  6.66k|}                               /* end register_config_handler() */

sc_find_auth_alg_byoid:
  266|    139|{
  267|    139|    int i = 0;
  268|       |
  269|    139|    DEBUGTRACE;
  ------------------
  |  |   63|    139|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    139|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 139]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 139]
  |  |  ------------------
  ------------------
  270|       |
  271|    139|    if ((NULL == authoid) || (0 == len))
  ------------------
  |  Branch (271:9): [True: 0, False: 139]
  |  Branch (271:30): [True: 0, False: 139]
  ------------------
  272|      0|        return NULL;
  273|       |
  274|    417|    for( ; _auth_alg_info[i].type != -1; ++i) {
  ------------------
  |  Branch (274:12): [True: 417, False: 0]
  ------------------
  275|    417|        if (len != _auth_alg_info[i].oid_len)
  ------------------
  |  Branch (275:13): [True: 0, False: 417]
  ------------------
  276|      0|            continue;
  277|    417|        if (snmp_oid_compare(_auth_alg_info[i].alg_oid,
  ------------------
  |  Branch (277:13): [True: 139, False: 278]
  ------------------
  278|    417|                             _auth_alg_info[i].oid_len,
  279|    417|                             authoid, len) == 0 )
  280|    139|            return(&_auth_alg_info[i]);
  281|    417|    }
  282|       |
  283|       |/*    DEBUGMSGTL(("scapi", "No auth alg found for"));
  284|       |      DEBUGMSGOID(("scapi", authoid, len ));*/
  285|       |
  286|      0|    return NULL;
  287|    139|}
sc_find_auth_alg_bytype:
  313|    139|{
  314|    139|    int i = 0;
  315|       |
  316|    139|    DEBUGTRACE;
  ------------------
  |  |   63|    139|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    139|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 139]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 139]
  |  |  ------------------
  ------------------
  317|       |
  318|    417|    for( ; _auth_alg_info[i].type != -1; ++i) {
  ------------------
  |  Branch (318:12): [True: 417, False: 0]
  ------------------
  319|    417|        if (type != _auth_alg_info[i].type)
  ------------------
  |  Branch (319:13): [True: 278, False: 139]
  ------------------
  320|    278|            continue;
  321|    139|        return(&_auth_alg_info[i]);
  322|    417|    }
  323|       |
  324|      0|    return NULL;
  325|    139|}
sc_get_authtype:
  338|    139|{
  339|    139|    const netsnmp_auth_alg_info *aai;
  340|       |
  341|    139|    DEBUGTRACE;
  ------------------
  |  |   63|    139|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    139|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 139]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 139]
  |  |  ------------------
  ------------------
  342|       |
  343|    139|    aai = sc_find_auth_alg_byoid(hashtype, hashtype_len);
  344|    139|    if (NULL == aai)
  ------------------
  |  Branch (344:9): [True: 0, False: 139]
  ------------------
  345|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  346|       |
  347|    139|    return aai->type;
  348|    139|}
sc_get_proper_auth_length_bytype:
  395|    139|{
  396|    139|    const netsnmp_auth_alg_info *aai;
  397|       |
  398|    139|    DEBUGTRACE;
  ------------------
  |  |   63|    139|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    139|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 139]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 139]
  |  |  ------------------
  ------------------
  399|       |
  400|    139|    aai = sc_find_auth_alg_bytype(hashtype);
  401|    139|    if (NULL == aai)
  ------------------
  |  Branch (401:9): [True: 0, False: 139]
  ------------------
  402|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  403|       |
  404|    139|    return aai->proper_length;
  405|    139|}
sc_init:
  546|     66|{
  547|     66|    int             rval = SNMPERR_SUCCESS;
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  548|       |
  549|       |#if !defined(NETSNMP_USE_OPENSSL)
  550|       |#if defined(NETSNMP_USE_INTERNAL_MD5) || defined(NETSNMP_USE_INTERNAL_CRYPTO)
  551|       |    struct timeval  tv;
  552|       |
  553|       |    DEBUGTRACE;
  554|       |
  555|       |    gettimeofday(&tv, (struct timezone *) 0);
  556|       |
  557|       |    netsnmp_srandom((unsigned)(tv.tv_sec ^ tv.tv_usec));
  558|       |#elif defined(NETSNMP_USE_PKCS11)
  559|       |    DEBUGTRACE;
  560|       |    rval = pkcs_init();
  561|       |#else
  562|       |    rval = SNMPERR_SC_NOT_CONFIGURED;
  563|       |#endif                           /* NETSNMP_USE_INTERNAL_MD5 */
  564|       |    /*
  565|       |     * XXX ogud: The only reason to do anything here with openssl is to 
  566|       |     * * XXX ogud: seed random number generator 
  567|       |     */
  568|       |#endif                          /* ifndef NETSNMP_USE_OPENSSL */
  569|       |
  570|     66|    return rval;
  571|     66|}                               /* end sc_init() */
sc_random:
  586|    198|{
  587|    198|    int             rval = SNMPERR_SUCCESS;
  ------------------
  |  |  217|    198|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  588|       |#if !defined(NETSNMP_USE_OPENSSL) && !defined(NETSNMP_USE_PKCS11)
  589|       |    int             i;
  590|       |    int             rndval;
  591|       |    u_char         *ucp = buf;
  592|       |#endif
  593|       |
  594|    198|    DEBUGTRACE;
  ------------------
  |  |   63|    198|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    198|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 198]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 198]
  |  |  ------------------
  ------------------
  595|       |
  596|    198|#ifdef NETSNMP_USE_OPENSSL
  597|    198|    RAND_bytes(buf, *buflen);   /* will never fail */
  598|    198|    MAKE_MEM_DEFINED(buf, *buflen);
  ------------------
  |  |    8|    198|#define MAKE_MEM_DEFINED(ptr, len) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (8:50): [Folded, False: 198]
  |  |  ------------------
  ------------------
  599|       |#elif defined(NETSNMP_USE_PKCS11)  /* NETSNMP_USE_PKCS11 */
  600|       |    pkcs_random(buf, *buflen);
  601|       |#else                           /* NETSNMP_USE_INTERNAL_MD5 */
  602|       |    /*
  603|       |     * fill the buffer with random integers.  Note that random()
  604|       |     * is defined in config.h and may not be truly the random()
  605|       |     * system call if something better existed 
  606|       |     */
  607|       |    rval = *buflen - *buflen % sizeof(rndval);
  608|       |    for (i = 0; i < rval; i += sizeof(rndval)) {
  609|       |        rndval = netsnmp_random();
  610|       |        memcpy(ucp, &rndval, sizeof(rndval));
  611|       |        ucp += sizeof(rndval);
  612|       |    }
  613|       |
  614|       |    rndval = netsnmp_random();
  615|       |    memcpy(ucp, &rndval, *buflen % sizeof(rndval));
  616|       |
  617|       |    rval = SNMPERR_SUCCESS;
  618|       |#endif                          /* NETSNMP_USE_OPENSSL */
  619|    198|    return rval;
  620|       |
  621|    198|}                               /* end sc_random() */
sc_get_openssl_hashfn:
  631|    139|{
  632|    139|    const EVP_MD   *hashfn = NULL;
  633|       |
  634|    139|    DEBUGTRACE;
  ------------------
  |  |   63|    139|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    139|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 139]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 139]
  |  |  ------------------
  ------------------
  635|       |
  636|    139|    switch (auth_type) {
  ------------------
  |  Branch (636:13): [True: 139, False: 0]
  ------------------
  637|      0|#ifndef NETSNMP_DISABLE_MD5
  638|    139|        case NETSNMP_USMAUTH_HMACMD5:
  ------------------
  |  |   21|    139|#define NETSNMP_USMAUTH_HMACMD5           2
  ------------------
  |  Branch (638:9): [True: 139, False: 0]
  ------------------
  639|    139|            hashfn = (const EVP_MD *) EVP_md5();
  640|    139|            break;
  641|      0|#endif
  642|      0|        case NETSNMP_USMAUTH_HMACSHA1:
  ------------------
  |  |   22|      0|#define NETSNMP_USMAUTH_HMACSHA1          3
  ------------------
  |  Branch (642:9): [True: 0, False: 139]
  ------------------
  643|      0|            hashfn = (const EVP_MD *) EVP_sha1();
  644|      0|            break;
  645|       |
  646|      0|#ifdef HAVE_EVP_SHA224
  647|      0|        case NETSNMP_USMAUTH_HMAC128SHA224:
  ------------------
  |  |   24|      0|#define NETSNMP_USMAUTH_HMAC128SHA224     4 /* RFC 7860; OPTIONAL */
  ------------------
  |  Branch (647:9): [True: 0, False: 139]
  ------------------
  648|      0|            hashfn = (const EVP_MD *) EVP_sha224();
  649|      0|            break;
  650|       |
  651|      0|        case NETSNMP_USMAUTH_HMAC192SHA256:
  ------------------
  |  |   25|      0|#define NETSNMP_USMAUTH_HMAC192SHA256     5 /* RFC 7860; MUST */
  ------------------
  |  Branch (651:9): [True: 0, False: 139]
  ------------------
  652|      0|            hashfn = (const EVP_MD *) EVP_sha256();
  653|      0|            break;
  654|      0|#endif /* HAVE_EVP_SHA224 */
  655|       |
  656|      0|#ifdef HAVE_EVP_SHA384
  657|      0|        case NETSNMP_USMAUTH_HMAC256SHA384:
  ------------------
  |  |   26|      0|#define NETSNMP_USMAUTH_HMAC256SHA384     6 /* RFC 7860; OPTIONAL */
  ------------------
  |  Branch (657:9): [True: 0, False: 139]
  ------------------
  658|      0|            hashfn = (const EVP_MD *) EVP_sha384();
  659|      0|            break;
  660|       |
  661|      0|        case NETSNMP_USMAUTH_HMAC384SHA512:
  ------------------
  |  |   27|      0|#define NETSNMP_USMAUTH_HMAC384SHA512     7 /* RFC 7860; SHOULD */
  ------------------
  |  Branch (661:9): [True: 0, False: 139]
  ------------------
  662|      0|            hashfn = (const EVP_MD *) EVP_sha512();
  663|      0|            break;
  664|    139|#endif /* HAVE_EVP_SHA384 */
  665|    139|    }
  666|       |
  667|    139|    return hashfn;
  668|    139|}
sc_hash:
  886|    139|{
  887|    139|    int auth_type;
  888|       |
  889|    139|    DEBUGTRACE;
  ------------------
  |  |   63|    139|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    139|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 139]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 139]
  |  |  ------------------
  ------------------
  890|       |
  891|    139|    if (hashtype == NULL)
  ------------------
  |  Branch (891:9): [True: 0, False: 139]
  ------------------
  892|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  893|       |
  894|    139|    auth_type = sc_get_authtype(hashtype, hashtypelen);
  895|    139|    if (auth_type < 0 )
  ------------------
  |  Branch (895:9): [True: 0, False: 139]
  ------------------
  896|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  897|       |
  898|    139|    return sc_hash_type(auth_type, buf, buf_len, MAC, MAC_len);
  899|    139|}
sc_hash_type:
  925|    139|{
  926|    139|#if defined(NETSNMP_USE_OPENSSL) || defined(NETSNMP_USE_PKCS11) || defined(NETSNMP_USE_INTERNAL_CRYPTO)
  927|    139|    int            rval = SNMPERR_SUCCESS;
  ------------------
  |  |  217|    139|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  928|    139|#endif
  929|    139|#if defined(NETSNMP_USE_OPENSSL) || defined(NETSNMP_USE_PKCS11)
  930|    139|    unsigned int   tmp_len;
  931|    139|#endif
  932|    139|    int            ret;
  933|       |
  934|    139|#ifdef NETSNMP_USE_OPENSSL
  935|    139|    const EVP_MD   *hashfn;
  936|    139|    EVP_MD_CTX     *cptr;
  937|    139|#endif
  938|       |#ifdef NETSNMP_USE_INTERNAL_CRYPTO
  939|       |    MD5_CTX        cmd5;
  940|       |    SHA_CTX        csha1;
  941|       |#endif
  942|    139|    DEBUGTRACE;
  ------------------
  |  |   63|    139|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    139|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 139]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 139]
  |  |  ------------------
  ------------------
  943|       |
  944|    139|    if (buf == NULL || buf_len <= 0 || MAC == NULL || MAC_len == NULL )
  ------------------
  |  Branch (944:9): [True: 0, False: 139]
  |  Branch (944:24): [True: 0, False: 139]
  |  Branch (944:40): [True: 0, False: 139]
  |  Branch (944:55): [True: 0, False: 139]
  ------------------
  945|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  946|       |
  947|    139|    ret = sc_get_proper_auth_length_bytype(auth_type);
  948|    139|    if (( ret < 0 ) || (*MAC_len < (size_t)ret ))
  ------------------
  |  Branch (948:9): [True: 0, False: 139]
  |  Branch (948:24): [True: 0, False: 139]
  ------------------
  949|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  950|       |
  951|    139|#ifdef NETSNMP_USE_OPENSSL
  952|       |    /*
  953|       |     * Determine transform type.
  954|       |     */
  955|    139|    hashfn = sc_get_openssl_hashfn(auth_type);
  956|    139|    if (NULL == hashfn)
  ------------------
  |  Branch (956:9): [True: 0, False: 139]
  ------------------
  957|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  958|       |
  959|       |/** initialize the pointer */
  960|    139|#if defined(HAVE_EVP_MD_CTX_NEW)
  961|    139|    cptr = EVP_MD_CTX_new();
  962|       |#elif defined(HAVE_EVP_MD_CTX_CREATE)
  963|       |    cptr = EVP_MD_CTX_create();
  964|       |#else
  965|       |    cptr = malloc(sizeof(*cptr));
  966|       |#if defined(OLD_DES)
  967|       |    memset(cptr, 0, sizeof(*cptr));
  968|       |#else
  969|       |    EVP_MD_CTX_init(cptr);
  970|       |#endif
  971|       |#endif
  972|    139|    if (!EVP_DigestInit(cptr, hashfn)) {
  ------------------
  |  Branch (972:9): [True: 0, False: 139]
  ------------------
  973|       |        /* requested hash function is not available */
  974|      0|        rval = SNMPERR_SC_NOT_CONFIGURED;
  ------------------
  |  |  256|      0|#define SNMPERR_SC_NOT_CONFIGURED	(-39)
  ------------------
  975|      0|        goto sc_hash_type_quit;
  976|      0|    }
  977|       |
  978|       |/** pass the data */
  979|    139|    EVP_DigestUpdate(cptr, buf, buf_len);
  980|       |
  981|       |/** do the final pass */
  982|    139|    EVP_DigestFinal(cptr, MAC, &tmp_len);
  983|    139|    *MAC_len = tmp_len;
  984|       |
  985|    139|sc_hash_type_quit:
  986|    139|#if defined(HAVE_EVP_MD_CTX_FREE)
  987|    139|    EVP_MD_CTX_free(cptr);
  988|       |#elif defined(HAVE_EVP_MD_CTX_DESTROY)
  989|       |    EVP_MD_CTX_destroy(cptr);
  990|       |#else
  991|       |#if !defined(OLD_DES)
  992|       |    EVP_MD_CTX_cleanup(cptr);
  993|       |#endif
  994|       |    free(cptr);
  995|       |#endif
  996|    139|    return (rval);
  997|       |
  998|       |#elif defined(NETSNMP_USE_INTERNAL_CRYPTO)
  999|       |#ifndef NETSNMP_DISABLE_MD5
 1000|       |    if (NETSNMP_USMAUTH_HMACMD5 == auth_type) {
 1001|       |        if (*MAC_len < MD5_DIGEST_LENGTH)
 1002|       |            return (SNMPERR_GENERR);      /* the buffer isn't big enough */
 1003|       |        MD5_Init(&cmd5);
 1004|       |        ret = !MD5_Update(&cmd5, buf, buf_len);
 1005|       |        if (ret != 0)
 1006|       |            return SNMPERR_GENERR;
 1007|       |        MD5_Final(MAC, &cmd5);
 1008|       |        *MAC_len = MD5_DIGEST_LENGTH;
 1009|       |    } else 
 1010|       |#endif
 1011|       |    if (NETSNMP_USMAUTH_HMACSHA1 == auth_type) {
 1012|       |        if (*MAC_len < SHA_DIGEST_LENGTH)
 1013|       |            return (SNMPERR_GENERR);      /* the buffer isn't big enough */
 1014|       |        SHA1_Init(&csha1);
 1015|       |        ret = !SHA1_Update(&csha1, buf, buf_len);
 1016|       |        if (ret != 0)
 1017|       |            return SNMPERR_GENERR;
 1018|       |        SHA1_Final(MAC, &csha1);
 1019|       |        *MAC_len = SHA_DIGEST_LENGTH;
 1020|       |            
 1021|       |    } else {
 1022|       |        return (SNMPERR_GENERR);
 1023|       |    }
 1024|       |    return (rval);
 1025|       |#elif defined(NETSNMP_USE_PKCS11)        /* NETSNMP_USE_PKCS11 */
 1026|       |
 1027|       |#ifndef NETSNMP_DISABLE_MD5
 1028|       |    if (NETSNMP_USMAUTH_HMACMD5 == auth_type) {
 1029|       |        rval = pkcs_digest(CKM_MD5, buf, buf_len, MAC, &tmp_len);
 1030|       |        *MAC_len = tmp_len;
 1031|       |    } else
 1032|       |#endif
 1033|       |    if (NETSNMP_USMAUTH_HMACSHA1 == auth_type) {
 1034|       |       rval = pkcs_digest(CKM_SHA_1, buf, buf_len, MAC, &tmp_len);
 1035|       |        *MAC_len = tmp_len;
 1036|       |    } else {
 1037|       |        return (SNMPERR_GENERR);
 1038|       |    }
 1039|       |
 1040|       |     return (rval);
 1041|       |
 1042|       |#else                           /* NETSNMP_USE_INTERNAL_MD5 */
 1043|       |
 1044|       |    if (MDchecksum(buf, buf_len, MAC, *MAC_len)) {
 1045|       |        return SNMPERR_GENERR;
 1046|       |    }
 1047|       |    if (*MAC_len > 16)
 1048|       |        *MAC_len = 16;
 1049|       |    return SNMPERR_SUCCESS;
 1050|       |
 1051|       |#endif                          /* NETSNMP_USE_OPENSSL */
 1052|    139|}

netsnmp_sd_listen_fds:
   72|     66|int netsnmp_sd_listen_fds(int unset_environment) {
   73|       |
   74|     66|        int r, fd;
   75|     66|        const char *e;
   76|     66|        char *p = NULL;
   77|     66|        unsigned long l;
   78|       |
   79|     66|        if (!(e = getenv("LISTEN_PID"))) {
  ------------------
  |  Branch (79:13): [True: 66, False: 0]
  ------------------
   80|     66|                r = 0;
   81|     66|                goto finish;
   82|     66|        }
   83|       |
   84|     66|        errno = 0;
   85|      0|        l = strtoul(e, &p, 10);
   86|       |
   87|      0|        if (errno != 0) {
  ------------------
  |  Branch (87:13): [True: 0, False: 0]
  ------------------
   88|      0|                r = -errno;
   89|      0|                goto finish;
   90|      0|        }
   91|       |
   92|      0|        if (!p || *p || l <= 0) {
  ------------------
  |  Branch (92:13): [True: 0, False: 0]
  |  Branch (92:19): [True: 0, False: 0]
  |  Branch (92:25): [True: 0, False: 0]
  ------------------
   93|      0|                r = -EINVAL;
   94|      0|                goto finish;
   95|      0|        }
   96|       |
   97|       |        /* Is this for us? */
   98|      0|        if (getpid() != (pid_t) l) {
  ------------------
  |  Branch (98:13): [True: 0, False: 0]
  ------------------
   99|      0|                r = 0;
  100|      0|                goto finish;
  101|      0|        }
  102|       |
  103|      0|        if (!(e = getenv("LISTEN_FDS"))) {
  ------------------
  |  Branch (103:13): [True: 0, False: 0]
  ------------------
  104|      0|                r = 0;
  105|      0|                goto finish;
  106|      0|        }
  107|       |
  108|      0|        errno = 0;
  109|      0|        l = strtoul(e, &p, 10);
  110|       |
  111|      0|        if (errno != 0 || l != (int)l) {
  ------------------
  |  Branch (111:13): [True: 0, False: 0]
  |  Branch (111:27): [True: 0, False: 0]
  ------------------
  112|      0|                r = errno ? -errno : -EINVAL;
  ------------------
  |  Branch (112:21): [True: 0, False: 0]
  ------------------
  113|      0|                goto finish;
  114|      0|        }
  115|       |
  116|      0|        if (!p || *p) {
  ------------------
  |  Branch (116:13): [True: 0, False: 0]
  |  Branch (116:19): [True: 0, False: 0]
  ------------------
  117|      0|                r = -EINVAL;
  118|      0|                goto finish;
  119|      0|        }
  120|       |
  121|      0|        for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd ++) {
  ------------------
  |  |   70|      0|#define SD_LISTEN_FDS_START 3
  ------------------
                      for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd ++) {
  ------------------
  |  |   70|      0|#define SD_LISTEN_FDS_START 3
  ------------------
  |  Branch (121:40): [True: 0, False: 0]
  ------------------
  122|      0|                int flags;
  123|       |
  124|      0|                if ((flags = fcntl(fd, F_GETFD)) < 0) {
  ------------------
  |  Branch (124:21): [True: 0, False: 0]
  ------------------
  125|      0|                        r = -errno;
  126|      0|                        goto finish;
  127|      0|                }
  128|       |
  129|      0|                if (flags & FD_CLOEXEC)
  ------------------
  |  Branch (129:21): [True: 0, False: 0]
  ------------------
  130|      0|                        continue;
  131|       |
  132|      0|                if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) {
  ------------------
  |  Branch (132:21): [True: 0, False: 0]
  ------------------
  133|      0|                        r = -errno;
  134|      0|                        goto finish;
  135|      0|                }
  136|      0|        }
  137|       |
  138|      0|        r = (int) l;
  139|       |
  140|     66|finish:
  141|     66|        if (unset_environment) {
  ------------------
  |  Branch (141:13): [True: 0, False: 66]
  ------------------
  142|      0|                unsetenv("LISTEN_PID");
  143|      0|                unsetenv("LISTEN_FDS");
  144|      0|        }
  145|       |
  146|     66|        return r;
  147|      0|}
netsnmp_sd_find_inet_socket:
  356|     66|{
  357|     66|    int count, fd;
  358|       |
  359|     66|    count = netsnmp_sd_listen_fds(0);
  360|     66|    if (count <= 0) {
  ------------------
  |  Branch (360:9): [True: 66, False: 0]
  ------------------
  361|     66|        DEBUGMSGTL(("systemd:find_inet_socket", "No LISTEN_FDS found.\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  362|     66|        return -1;
  363|     66|    }
  364|      0|    DEBUGMSGTL(("systemd:find_inet_socket", "LISTEN_FDS reports %d sockets.\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]
  |  |  ------------------
  ------------------
  365|      0|            count));
  366|       |
  367|      0|    for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + count; fd++) {
  ------------------
  |  |   70|      0|#define SD_LISTEN_FDS_START 3
  ------------------
                  for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + count; fd++) {
  ------------------
  |  |   70|      0|#define SD_LISTEN_FDS_START 3
  ------------------
  |  Branch (367:36): [True: 0, False: 0]
  ------------------
  368|      0|        int rc = sd_is_socket_inet(fd, family, type, listening, port);
  369|      0|        if (rc < 0)
  ------------------
  |  Branch (369:13): [True: 0, False: 0]
  ------------------
  370|      0|            DEBUGMSGTL(("systemd:find_inet_socket",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  371|      0|                    "sd_is_socket_inet error: %d\n", rc));
  372|      0|        if (rc > 0) {
  ------------------
  |  Branch (372:13): [True: 0, False: 0]
  ------------------
  373|      0|            DEBUGMSGTL(("systemd:find_inet_socket",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  374|      0|                    "Found the socket in LISTEN_FDS\n"));
  375|      0|            return fd;
  376|      0|        }
  377|      0|    }
  378|      0|    DEBUGMSGTL(("systemd:find_inet_socket", "Socket not found in LISTEN_FDS\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]
  |  |  ------------------
  ------------------
  379|      0|    return -1;
  380|      0|}

snmp_realloc_rbuild_var_op:
  320|      3|{
  321|      3|    size_t          start_offset = *offset;
  322|      3|    int             rc = 0;
  323|       |
  324|       |    /*
  325|       |     * Encode the value.  
  326|       |     */
  327|      3|    DEBUGDUMPHEADER("send", "Value");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
  328|       |
  329|      3|    switch (var_val_type) {
  330|      0|    case ASN_INTEGER:
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (330:5): [True: 0, False: 3]
  ------------------
  331|      0|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, allow_realloc,
  332|      0|                                    var_val_type, (long *) var_val,
  333|      0|                                    var_val_len);
  334|      0|        break;
  335|       |
  336|      0|    case ASN_GAUGE:
  ------------------
  |  |   90|      0|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (336:5): [True: 0, False: 3]
  ------------------
  337|      3|    case ASN_COUNTER:
  ------------------
  |  |   89|      3|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|      3|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (337:5): [True: 3, False: 0]
  ------------------
  338|      3|    case ASN_TIMETICKS:
  ------------------
  |  |   92|      3|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|      3|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (338:5): [True: 0, False: 3]
  ------------------
  339|      3|    case ASN_UINTEGER:
  ------------------
  |  |  100|      3|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      3|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (339:5): [True: 0, False: 3]
  ------------------
  340|      3|        rc = asn_realloc_rbuild_unsigned_int(pkt, pkt_len, offset,
  341|      3|                                             allow_realloc, var_val_type,
  342|      3|                                             (u_long *) var_val,
  343|      3|                                             var_val_len);
  344|      3|        break;
  345|       |
  346|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
  347|      0|    case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|      0|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|      0|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (347:5): [True: 0, False: 3]
  ------------------
  348|      0|    case ASN_OPAQUE_U64:
  ------------------
  |  |  192|      0|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|      0|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (348:5): [True: 0, False: 3]
  ------------------
  349|      0|#endif
  350|      0|    case ASN_COUNTER64:
  ------------------
  |  |   99|      0|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (350:5): [True: 0, False: 3]
  ------------------
  351|      0|        rc = asn_realloc_rbuild_unsigned_int64(pkt, pkt_len, offset,
  352|      0|                                               allow_realloc, var_val_type,
  353|      0|                                               (struct counter64 *)
  354|      0|                                               var_val, var_val_len);
  355|      0|        break;
  356|       |
  357|      0|    case ASN_OCTET_STR:
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (357:5): [True: 0, False: 3]
  ------------------
  358|      0|    case ASN_IPADDRESS:
  ------------------
  |  |   88|      0|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (358:5): [True: 0, False: 3]
  ------------------
  359|      0|    case ASN_OPAQUE:
  ------------------
  |  |   93|      0|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (359:5): [True: 0, False: 3]
  ------------------
  360|      0|    case ASN_NSAP:
  ------------------
  |  |   98|      0|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (360:5): [True: 0, False: 3]
  ------------------
  361|      0|        rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, allow_realloc,
  362|      0|                                       var_val_type, var_val, var_val_len);
  363|      0|        break;
  364|       |
  365|      0|    case ASN_OBJECT_ID:
  ------------------
  |  |   81|      0|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (365:5): [True: 0, False: 3]
  ------------------
  366|      0|        rc = asn_realloc_rbuild_objid(pkt, pkt_len, offset, allow_realloc,
  367|      0|                                      var_val_type, (oid *) var_val,
  368|      0|                                      var_val_len / sizeof(oid));
  369|      0|        break;
  370|       |
  371|      0|    case ASN_NULL:
  ------------------
  |  |   79|      0|#define ASN_NULL	    0x05U
  ------------------
  |  Branch (371:5): [True: 0, False: 3]
  ------------------
  372|      0|        rc = asn_realloc_rbuild_null(pkt, pkt_len, offset, allow_realloc,
  373|      0|                                     var_val_type);
  374|      0|        break;
  375|       |
  376|      0|    case ASN_BIT_STR:
  ------------------
  |  |   77|      0|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (376:5): [True: 0, False: 3]
  ------------------
  377|      0|        rc = asn_realloc_rbuild_bitstring(pkt, pkt_len, offset,
  378|      0|                                          allow_realloc, var_val_type,
  379|      0|                                          var_val, var_val_len);
  380|      0|        break;
  381|       |
  382|      0|    case SNMP_NOSUCHOBJECT:
  ------------------
  |  |  201|      0|#define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (382:5): [True: 0, False: 3]
  ------------------
  383|      0|    case SNMP_NOSUCHINSTANCE:
  ------------------
  |  |  202|      0|#define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (383:5): [True: 0, False: 3]
  ------------------
  384|      0|    case SNMP_ENDOFMIBVIEW:
  ------------------
  |  |  203|      0|#define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (384:5): [True: 0, False: 3]
  ------------------
  385|      0|        rc = asn_realloc_rbuild_null(pkt, pkt_len, offset, allow_realloc,
  386|      0|                                     var_val_type);
  387|      0|        break;
  388|       |
  389|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
  390|      0|    case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|      0|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|      0|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (390:5): [True: 0, False: 3]
  ------------------
  391|      0|        rc = asn_realloc_rbuild_float(pkt, pkt_len, offset, allow_realloc,
  392|      0|                                      var_val_type, (float *) var_val,
  393|      0|                                      var_val_len);
  394|      0|        break;
  395|       |
  396|      0|    case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|      0|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|      0|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (396:5): [True: 0, False: 3]
  ------------------
  397|      0|        rc = asn_realloc_rbuild_double(pkt, pkt_len, offset, allow_realloc,
  398|      0|                                       var_val_type, (double *) var_val,
  399|      0|                                       var_val_len);
  400|      0|        break;
  401|       |
  402|      0|    case ASN_OPAQUE_I64:
  ------------------
  |  |  183|      0|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|      0|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (402:5): [True: 0, False: 3]
  ------------------
  403|      0|        rc = asn_realloc_rbuild_signed_int64(pkt, pkt_len, offset,
  404|      0|                                             allow_realloc, var_val_type,
  405|      0|                                             (struct counter64 *) var_val,
  406|      0|                                             var_val_len);
  407|      0|        break;
  408|      0|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
  409|      0|    default:
  ------------------
  |  Branch (409:5): [True: 0, False: 3]
  ------------------
  410|      0|	{
  411|      0|	char error_buf[64];
  412|      0|	snprintf(error_buf, sizeof(error_buf),
  413|      0|		"wrong type in snmp_realloc_rbuild_var_op: %d", var_val_type);
  414|      0|        ERROR_MSG(error_buf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  415|      0|        rc = 0;
  416|      0|	}
  417|      3|    }
  418|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
  419|       |
  420|      3|    if (rc == 0) {
  ------------------
  |  Branch (420:9): [True: 0, False: 3]
  ------------------
  421|      0|        return 0;
  422|      0|    }
  423|       |
  424|       |    /*
  425|       |     * Build the OID.  
  426|       |     */
  427|       |
  428|      3|    DEBUGDUMPHEADER("send", "Name");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
  429|      3|    rc = asn_realloc_rbuild_objid(pkt, pkt_len, offset, allow_realloc,
  430|      3|                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
  431|      3|                                            ASN_OBJECT_ID), var_name,
  ------------------
  |  |   81|      3|#define ASN_OBJECT_ID	    0x06U
  ------------------
  432|      3|                                  *var_name_len);
  433|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
  434|      3|    if (rc == 0) {
  ------------------
  |  Branch (434:9): [True: 0, False: 3]
  ------------------
  435|      0|        ERROR_MSG("Can't build OID for variable");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  436|      0|        return 0;
  437|      0|    }
  438|       |
  439|       |    /*
  440|       |     * Build the sequence header.  
  441|       |     */
  442|       |
  443|      3|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, allow_realloc,
  444|      3|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      3|#define ASN_SEQUENCE	    0x10U
  ------------------
  445|      3|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
  446|      3|                                     *offset - start_offset);
  447|      3|    return rc;
  448|      3|}

init_alarm_post_config:
   63|     66|{
   64|     66|    start_alarms = 1;
   65|     66|    set_an_alarm();
   66|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
   67|     66|}
init_snmp_alarm:
   71|     66|{
   72|     66|    start_alarms = 0;
   73|     66|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
   74|     66|                           SNMP_CALLBACK_POST_READ_CONFIG,
  ------------------
  |  |   24|     66|#define SNMP_CALLBACK_POST_READ_CONFIG	        0
  ------------------
   75|       |                           init_alarm_post_config, NULL);
   76|     66|}
snmp_alarm_unregister_all:
  156|     66|{
  157|     66|  struct snmp_alarm *sa_ptr, *sa_tmp;
  158|       |
  159|     66|  for (sa_ptr = thealarms; sa_ptr != NULL; sa_ptr = sa_tmp) {
  ------------------
  |  Branch (159:28): [True: 0, False: 66]
  ------------------
  160|      0|    sa_tmp = sa_ptr->next;
  161|      0|    free(sa_ptr);
  162|      0|  }
  163|     66|  DEBUGMSGTL(("snmp_alarm", "ALL alarms unregistered\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  164|       |  thealarms = NULL;
  165|     66|}  
sa_find_next:
  169|     66|{
  170|     66|    struct snmp_alarm *a, *lowest = NULL;
  171|       |
  172|     66|    for (a = thealarms; a != NULL; a = a->next)
  ------------------
  |  Branch (172:25): [True: 0, False: 66]
  ------------------
  173|      0|        if (!(a->flags & SA_FIRED)
  ------------------
  |  |   29|      0|#define SA_FIRED 0x10          /* Being processed in run_alarms */
  ------------------
  |  Branch (173:13): [True: 0, False: 0]
  ------------------
  174|      0|            && (lowest == NULL || timercmp(&a->t_nextM, &lowest->t_nextM, <)))
  ------------------
  |  Branch (174:17): [True: 0, False: 0]
  |  Branch (174:35): [True: 0, False: 0]
  |  Branch (174:35): [True: 0, False: 0]
  ------------------
  175|      0|            lowest = a;
  176|       |
  177|     66|    return lowest;
  178|     66|}
netsnmp_get_next_alarm_time:
  253|     66|{
  254|     66|    struct snmp_alarm *sa_ptr;
  255|       |
  256|     66|    sa_ptr = sa_find_next();
  257|       |
  258|     66|    if (sa_ptr) {
  ------------------
  |  Branch (258:9): [True: 0, False: 66]
  ------------------
  259|      0|        netsnmp_assert(alarm_tm);
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  260|      0|        netsnmp_assert(timerisset(&sa_ptr->t_nextM));
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  261|      0|        if (timercmp(&sa_ptr->t_nextM, now, >))
  ------------------
  |  Branch (261:13): [True: 0, False: 0]
  |  Branch (261:13): [True: 0, False: 0]
  ------------------
  262|      0|            *alarm_tm = sa_ptr->t_nextM;
  263|      0|        else
  264|      0|            *alarm_tm = *now;
  265|      0|        return sa_ptr->clientreg;
  266|     66|    } else {
  267|     66|        return 0;
  268|     66|    }
  269|     66|}
get_next_alarm_delay_time:
  282|     66|{
  283|     66|    struct timeval t_now, alarm_tm;
  284|     66|    int res;
  285|       |
  286|     66|    netsnmp_get_monotonic_clock(&t_now);
  287|     66|    res = netsnmp_get_next_alarm_time(&alarm_tm, &t_now);
  288|     66|    if (res)
  ------------------
  |  Branch (288:9): [True: 0, False: 66]
  ------------------
  289|      0|        NETSNMP_TIMERSUB(&alarm_tm, &t_now, delta);
  ------------------
  |  |  173|      0|#define NETSNMP_TIMERSUB(a, b, res) do {                        \
  |  |  174|      0|    (res)->tv_sec  = (a)->tv_sec  - (b)->tv_sec - 1;            \
  |  |  175|      0|    (res)->tv_usec = (a)->tv_usec - (b)->tv_usec + 1000000L;    \
  |  |  176|      0|    if ((res)->tv_usec >= 1000000L) {                           \
  |  |  ------------------
  |  |  |  Branch (176:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  177|      0|        (res)->tv_usec -= 1000000L;                             \
  |  |  178|      0|        (res)->tv_sec++;                                        \
  |  |  179|      0|    }                                                           \
  |  |  180|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (180:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  290|     66|    return res;
  291|     66|}
set_an_alarm:
  296|     66|{
  297|     66|    struct timeval  delta;
  298|     66|    int             nextalarm = get_next_alarm_delay_time(&delta);
  299|       |
  300|       |    /*
  301|       |     * We don't use signals if they asked us nicely not to.  It's expected
  302|       |     * they'll check the next alarm time and do their own calling of
  303|       |     * run_alarms().  
  304|       |     */
  305|       |
  306|     66|    if (nextalarm && !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (306:9): [True: 0, False: 66]
  |  Branch (306:22): [True: 0, False: 0]
  ------------------
  307|      0|					NETSNMP_DS_LIB_ALARM_DONT_USE_SIG)) {
  ------------------
  |  |   71|      0|#define NETSNMP_DS_LIB_ALARM_DONT_USE_SIG  11   /* don't use the alarm() signal */
  ------------------
  308|      0|#if defined(HAVE_SETITIMER)
  309|      0|        struct itimerval it;
  310|       |
  311|      0|        it.it_value = delta;
  312|      0|        timerclear(&it.it_interval);
  313|       |
  314|      0|        signal(SIGALRM, alarm_handler);
  315|      0|        setitimer(ITIMER_REAL, &it, NULL);
  316|      0|        DEBUGMSGTL(("snmp_alarm", "schedule alarm %d in %ld.%03ld seconds\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]
  |  |  ------------------
  ------------------
  317|      0|                    nextalarm, (long) delta.tv_sec, (long)(delta.tv_usec / 1000)));
  318|       |#elif defined(SIGALRM)
  319|       |        signal(SIGALRM, alarm_handler);
  320|       |        alarm(delta.tv_sec);
  321|       |        DEBUGMSGTL(("snmp_alarm",
  322|       |                    "schedule alarm %d in roughly %ld seconds\n", nextalarm,
  323|       |                    delta.tv_sec));
  324|       |#endif
  325|     66|    } else {
  326|     66|        DEBUGMSGTL(("snmp_alarm", "no alarms found to schedule\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  327|     66|    }
  328|     66|}

netsnmp_max_send_msg_size:
  360|    135|{
  361|    135|    u_int max = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    135|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  362|    135|                                   NETSNMP_DS_LIB_MSG_SEND_MAX);
  ------------------
  |  |  132|    135|#define NETSNMP_DS_LIB_MSG_SEND_MAX        16 /* global max response size */
  ------------------
  363|    135|    if (0 == max)
  ------------------
  |  Branch (363:9): [True: 135, False: 0]
  ------------------
  364|    135|        max = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|    135|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  365|      0|    else if (max < SNMP_MIN_MAX_LEN)
  ------------------
  |  |   48|      0|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (365:14): [True: 0, False: 0]
  ------------------
  366|      0|        max = SNMP_MIN_MAX_LEN; /* minimum max size per SNMP specs */
  ------------------
  |  |   48|      0|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  367|      0|    else if (max > SNMP_MAX_PACKET_LEN)
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (367:14): [True: 0, False: 0]
  ------------------
  368|      0|        max = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  369|       |
  370|    135|    return max;
  371|    135|}
snmp_get_next_sessid:
  464|     66|{
  465|     66|    long            retVal;
  466|     66|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSIONID);
  ------------------
  |  |   79|     66|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 66]
  |  |  ------------------
  ------------------
  467|     66|    retVal = 1 + Sessid;        /*MTCRITICAL_RESOURCE */
  468|     66|    if (!retVal)
  ------------------
  |  Branch (468:9): [True: 0, False: 66]
  ------------------
  469|      0|        retVal = 2;
  470|     66|    Sessid = retVal;
  471|     66|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   91|     66|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  |  Branch (471:9): [True: 0, False: 66]
  ------------------
  472|      0|        retVal &= 0x7fff;	/* mask to 15 bits */
  473|     66|    else
  474|     66|        retVal &= 0x7fffffff;	/* mask to 31 bits */
  475|       |
  476|     66|    if (!retVal) {
  ------------------
  |  Branch (476:9): [True: 0, False: 66]
  ------------------
  477|      0|        Sessid = retVal = 2;
  478|      0|    }
  479|     66|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSIONID);
  ------------------
  |  |   80|     66|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 66]
  |  |  ------------------
  ------------------
  480|     66|    return retVal;
  481|     66|}
snmp_get_next_transid:
  485|     65|{
  486|     65|    long            retVal;
  487|     65|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   79|     65|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 65]
  |  |  ------------------
  ------------------
  488|     65|    retVal = 1 + Transid;       /*MTCRITICAL_RESOURCE */
  489|     65|    if (!retVal)
  ------------------
  |  Branch (489:9): [True: 0, False: 65]
  ------------------
  490|      0|        retVal = 2;
  491|     65|    Transid = retVal;
  492|     65|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   48|     65|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   91|     65|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  |  Branch (492:9): [True: 0, False: 65]
  ------------------
  493|      0|        retVal &= 0x7fff;	/* mask to 15 bits */
  494|     65|    else
  495|     65|        retVal &= 0x7fffffff;	/* mask to 31 bits */
  496|       |
  497|     65|    if (!retVal) {
  ------------------
  |  Branch (497:9): [True: 0, False: 65]
  ------------------
  498|      0|        Transid = retVal = 2;
  499|      0|    }
  500|     65|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   80|     65|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 65]
  |  |  ------------------
  ------------------
  501|     65|    return retVal;
  502|     65|}
snmp_set_detail:
  516|    118|{
  517|    118|    if (detail_string != NULL) {
  ------------------
  |  Branch (517:9): [True: 118, False: 0]
  ------------------
  518|    118|        strlcpy(snmp_detail, detail_string, sizeof(snmp_detail));
  519|    118|        snmp_detail_f = 1;
  520|    118|    }
  521|    118|}
snmp_api_errstring:
  531|      2|{
  532|      2|    const char     *msg = "";
  533|      2|    static char     msg_buf[SPRINT_MAX_LEN];
  534|       |
  535|      2|    if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <= SNMPERR_GENERR) {
  ------------------
  |  |  288|      4|#define SNMPERR_MAX			(-69)
  ------------------
                  if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <= SNMPERR_GENERR) {
  ------------------
  |  |  218|      2|#define SNMPERR_GENERR			(-1)
  ------------------
  |  Branch (535:9): [True: 2, False: 0]
  |  Branch (535:42): [True: 0, False: 2]
  ------------------
  536|      0|        msg = api_errors[-snmp_errnumber];
  537|      2|    } else if (snmp_errnumber != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|      2|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (537:16): [True: 0, False: 2]
  ------------------
  538|      0|        msg = NULL;
  539|      0|    }
  540|      2|    if (!msg) {
  ------------------
  |  Branch (540:9): [True: 0, False: 2]
  ------------------
  541|      0|	snprintf(msg_buf, sizeof(msg_buf), "Unknown error: %d", snmp_errnumber);
  542|      0|        msg_buf[sizeof(msg_buf)-1] = '\0';
  543|      2|    } else if (snmp_detail_f) {
  ------------------
  |  Branch (543:16): [True: 2, False: 0]
  ------------------
  544|      2|        snprintf(msg_buf, sizeof(msg_buf), "%s (%s)", msg, snmp_detail);
  545|      2|        msg_buf[sizeof(msg_buf)-1] = '\0';
  546|      2|        snmp_detail_f = 0;
  547|      2|    } else {
  548|      0|        strlcpy(msg_buf, msg, sizeof(msg_buf));
  549|      0|    }
  550|       |
  551|      2|    return (msg_buf);
  552|      2|}
netsnmp_random:
  639|    198|{
  640|    198|#if defined(HAVE_RANDOM)
  641|       |    /*
  642|       |     * The function random() is a more sophisticated random number generator
  643|       |     * which uses nonlinear feedback and an internal table that is 124 bytes
  644|       |     * (992 bits) long. The function returns random values that are 32 bits in
  645|       |     * length. All of the bits generated by random() are usable. The random()
  646|       |     * function is adequate for simulations and games, but should not be used
  647|       |     * for security related applications such as picking cryptographic keys or
  648|       |     * simulating one-time pads.
  649|       |     */
  650|    198|    return random();
  651|       |#elif defined(HAVE_LRAND48)
  652|       |    /*
  653|       |     * As with random(), lrand48() provides excellent random numbers for
  654|       |     * simulations and games, but should not be used for security-related
  655|       |     * applications such as picking cryptographic keys or simulating one-time
  656|       |     * pads; linear congruential algorithms are too easy to break.
  657|       |     */
  658|       |    return lrand48();
  659|       |#elif defined(HAVE_RAND)
  660|       |    /*
  661|       |     * The original UNIX random number generator, rand(), is not a very good
  662|       |     * random number generator. It uses a 32-bit seed and maintains a 32-bit
  663|       |     * internal state.
  664|       |     */
  665|       |    return rand();
  666|       |#else
  667|       |#error "Neither random(), nor lrand48() nor rand() are available"
  668|       |#endif
  669|    198|}
netsnmp_srandom:
  672|     66|{
  673|     66|#if defined(HAVE_SRANDOM)
  674|     66|    srandom(seed);
  675|       |#elif defined(HAVE_SRAND48)
  676|       |    srand48(seed);
  677|       |#elif defined(HAVE_SRAND)
  678|       |    srand(seed);
  679|       |#else
  680|       |#error "Neither srandom(), nor srand48() nor srand() are available"
  681|       |#endif
  682|     66|}
snmp_sess_init:
  775|     66|{
  776|     66|    _init_snmp();
  777|       |
  778|       |    /*
  779|       |     * initialize session to default values 
  780|       |     */
  781|       |
  782|     66|    memset(session, 0, sizeof(netsnmp_session));
  783|     66|    session->timeout = SNMP_DEFAULT_TIMEOUT;
  ------------------
  |  |  113|     66|#define SNMP_DEFAULT_TIMEOUT	    -1
  ------------------
  784|     66|    session->retries = SNMP_DEFAULT_RETRIES;
  ------------------
  |  |  112|     66|#define SNMP_DEFAULT_RETRIES	    -1
  ------------------
  785|     66|    session->version = SNMP_DEFAULT_VERSION;
  ------------------
  |  |  123|     66|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  786|     66|    session->securityModel = SNMP_DEFAULT_SECMODEL;
  ------------------
  |  |  124|     66|#define SNMP_DEFAULT_SECMODEL	    -1
  ------------------
  787|     66|    session->rcvMsgMaxSize = netsnmp_max_send_msg_size();
  788|     66|    session->sndMsgMaxSize = netsnmp_max_send_msg_size();
  789|     66|    session->flags |= SNMP_FLAGS_DONT_PROBE;
  ------------------
  |  |  188|     66|#define SNMP_FLAGS_DONT_PROBE      0x100      /* don't probe for an engineID */
  ------------------
  790|     66|}
init_snmp:
  879|     66|{
  880|     66|    if (init_snmp_init_done) {
  ------------------
  |  Branch (880:9): [True: 0, False: 66]
  ------------------
  881|      0|        return;
  882|      0|    }
  883|       |
  884|     66|    init_snmp_init_done = 1;
  885|       |
  886|       |    /*
  887|       |     * make the type available everywhere else 
  888|       |     */
  889|     66|    if (type && !netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (889:9): [True: 66, False: 0]
  |  Branch (889:17): [True: 66, False: 0]
  ------------------
  890|     66|				       NETSNMP_DS_LIB_APPTYPE)) {
  ------------------
  |  |  157|     66|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
  891|     66|        netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  892|     66|			      NETSNMP_DS_LIB_APPTYPE, type);
  ------------------
  |  |  157|     66|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
  893|     66|    }
  894|       |
  895|     66|    _init_snmp();
  896|       |
  897|       |    /*
  898|       |     * set our current locale properly to initialize isprint() type functions 
  899|       |     *
  900|       |     * Do not use setlocale on qnx, it is buggy 
  901|       |     * https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.lib_ref/topic/s/setlocale.html
  902|       |     */
  903|     66|#if defined(HAVE_SETLOCALE) && !defined(__QNX__)
  904|     66|    setlocale(LC_CTYPE, "");
  905|     66|#endif
  906|       |
  907|     66|    snmp_debug_init();    /* should be done first, to turn on debugging ASAP */
  908|     66|    netsnmp_container_init_list();
  909|     66|    init_callbacks();
  910|     66|    init_snmp_logging();
  911|     66|    snmp_init_statistics();
  912|     66|    register_mib_handlers();
  913|     66|    register_default_handlers();
  914|     66|    init_snmp_transport();
  915|     66|    init_snmpv3(type);
  916|     66|    init_snmp_alarm();
  917|     66|    init_snmp_enum(type);
  918|     66|    init_vacm();
  919|     66|#if defined(NETSNMP_USE_OPENSSL) && defined(HAVE_LIBSSL) && NETSNMP_TRANSPORT_TLSBASE_DOMAIN
  920|     66|    netsnmp_certs_init();
  921|     66|#endif
  922|       |#ifdef DNSSEC_LOCAL_VALIDATION
  923|       |    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "dnssecWarnOnly",
  924|       |                               NETSNMP_DS_LIBRARY_ID,
  925|       |                               NETSNMP_DS_LIB_DNSSEC_WARN_ONLY);
  926|       |#endif
  927|       |
  928|     66|    read_premib_configs();
  929|     66|#ifndef NETSNMP_DISABLE_MIB_LOADING
  930|     66|    netsnmp_init_mib();
  931|     66|#endif /* NETSNMP_DISABLE_MIB_LOADING */
  932|       |
  933|     66|    read_configs();
  934|       |
  935|     66|}                               /* end init_snmp() */
snmp_store:
  961|     66|{
  962|     66|    DEBUGMSGTL(("snmp_store", "storing stuff...\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  963|     66|    snmp_save_persistent(type);
  964|     66|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA, NULL);
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
                  snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA, NULL);
  ------------------
  |  |   25|     66|#define SNMP_CALLBACK_STORE_DATA	        1
  ------------------
  965|     66|    snmp_clean_persistent(type);
  966|     66|}
snmp_shutdown:
  979|     66|{
  980|     66|    snmp_store(type);
  981|     66|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN, NULL);
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
                  snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN, NULL);
  ------------------
  |  |   26|     66|#define SNMP_CALLBACK_SHUTDOWN		        2
  ------------------
  982|     66|    shutdown_snmp_logging();
  983|     66|    snmp_alarm_unregister_all();
  984|     66|    snmp_close_sessions();
  985|     66|#ifndef NETSNMP_DISABLE_MIB_LOADING
  986|     66|    shutdown_mib();
  987|     66|#endif /* NETSNMP_DISABLE_MIB_LOADING */
  988|     66|#if defined(NETSNMP_USE_OPENSSL) && defined(HAVE_LIBSSL) && NETSNMP_TRANSPORT_TLSBASE_DOMAIN
  989|     66|    netsnmp_certs_shutdown();
  990|     66|#endif
  991|     66|#if !defined(NETSNMP_FEATURE_REMOVE_FILTER_SOURCE)
  992|     66|    netsnmp_transport_filter_cleanup();
  993|     66|#endif
  994|     66|    unregister_all_config_handlers();
  995|     66|    netsnmp_container_free_list();
  996|     66|    clear_sec_mod();
  997|     66|    clear_snmp_enum();
  998|     66|    netsnmp_clear_tdomain_list();
  999|     66|    clear_callback();
 1000|     66|    netsnmp_ds_shutdown();
 1001|     66|    netsnmp_clear_default_target();
 1002|     66|    netsnmp_clear_default_domain();
 1003|     66|    shutdown_secmod();
 1004|     66|    shutdown_snmp_transport();
 1005|     66|    shutdown_data_list();
 1006|     66|    snmp_debug_shutdown();    /* should be done last */
 1007|       |
 1008|     66|    init_snmp_init_done  = 0;
 1009|     66|    _init_snmp_init_done = 0;
 1010|     66|}
snmp_session_insert:
 1016|     66|{
 1017|     66|    if (NULL == slp)
  ------------------
  |  Branch (1017:9): [True: 0, False: 66]
  ------------------
 1018|      0|        return;
 1019|       |
 1020|     66|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     66|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 66]
  |  |  ------------------
  ------------------
 1021|     66|    slp->next = Sessions;
 1022|     66|    Sessions = slp;
 1023|     66|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     66|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 66]
  |  |  ------------------
  ------------------
 1024|     66|}
netsnmp_sess_config_transport:
 1580|     66|{
 1581|       |    /* Optional supplemental transport configuration information and
 1582|       |       final call to actually open the transport */
 1583|     66|    if (transport_configuration) {
  ------------------
  |  Branch (1583:9): [True: 0, False: 66]
  ------------------
 1584|      0|        DEBUGMSGTL(("snmp_sess", "configuring transport\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]
  |  |  ------------------
  ------------------
 1585|      0|        if (transport->f_config) {
  ------------------
  |  Branch (1585:13): [True: 0, False: 0]
  ------------------
 1586|      0|            netsnmp_iterator *iter;
 1587|      0|            netsnmp_transport_config *config_data;
 1588|      0|            int ret = 0;
 1589|       |
 1590|      0|            iter = CONTAINER_ITERATOR(transport_configuration);
  ------------------
  |  |  404|      0|#define CONTAINER_ITERATOR(x)       (x)->get_iterator(x)
  ------------------
 1591|      0|            if (NULL == iter) {
  ------------------
  |  Branch (1591:17): [True: 0, False: 0]
  ------------------
 1592|      0|                return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1593|      0|            }
 1594|       |
 1595|      0|            for(config_data = (netsnmp_transport_config*)ITERATOR_FIRST(iter); config_data;
  ------------------
  |  |  546|      0|#define ITERATOR_FIRST(x)  x->first(x)
  ------------------
  |  Branch (1595:80): [True: 0, False: 0]
  ------------------
 1596|      0|                config_data = (netsnmp_transport_config*)ITERATOR_NEXT(iter)) {
  ------------------
  |  |  547|      0|#define ITERATOR_NEXT(x)   x->next(x)
  ------------------
 1597|      0|                ret = transport->f_config(transport, config_data->key,
 1598|      0|                                          config_data->value);
 1599|      0|                if (ret)
  ------------------
  |  Branch (1599:21): [True: 0, False: 0]
  ------------------
 1600|      0|                    break;
 1601|      0|            }
 1602|      0|            ITERATOR_RELEASE(iter);
  ------------------
  |  |  550|      0|#define ITERATOR_RELEASE(x) do { x->release(x); x = NULL; } while(0)
  |  |  ------------------
  |  |  |  Branch (550:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1603|      0|            if (ret)
  ------------------
  |  Branch (1603:17): [True: 0, False: 0]
  ------------------
 1604|      0|                return SNMPERR_TRANSPORT_CONFIG_ERROR;
  ------------------
  |  |  285|      0|#define SNMPERR_TRANSPORT_CONFIG_ERROR  (-68)
  ------------------
 1605|      0|        } else {
 1606|      0|            return SNMPERR_TRANSPORT_NO_CONFIG;
  ------------------
  |  |  284|      0|#define SNMPERR_TRANSPORT_NO_CONFIG     (-67)
  ------------------
 1607|      0|        }
 1608|      0|    }
 1609|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1610|     66|}
netsnmp_sess_config_and_open_transport:
 1642|     66|{
 1643|     66|    int rc;
 1644|       |    
 1645|     66|    DEBUGMSGTL(("snmp_sess", "opening transport: %x\n", transport->flags & NETSNMP_TRANSPORT_FLAG_OPENED));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 1646|       |
 1647|       |    /* don't double open */
 1648|     66|    if (transport->flags & NETSNMP_TRANSPORT_FLAG_OPENED)
  ------------------
  |  |   57|     66|#define		NETSNMP_TRANSPORT_FLAG_OPENED	 0x20  /* f_open called */
  ------------------
  |  Branch (1648:9): [True: 0, False: 66]
  ------------------
 1649|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1650|       |
 1651|     66|    if ((rc = netsnmp_sess_config_transport(in_session->transport_configuration,
  ------------------
  |  Branch (1651:9): [True: 0, False: 66]
  ------------------
 1652|     66|                                            transport)) != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1653|      0|        in_session->s_snmp_errno = rc;
 1654|      0|        in_session->s_errno = 0;
 1655|      0|        return rc;
 1656|      0|    }
 1657|       |        
 1658|     66|    if (transport->f_open)
  ------------------
  |  Branch (1658:9): [True: 0, False: 66]
  ------------------
 1659|      0|        transport = transport->f_open(transport);
 1660|       |
 1661|     66|    if (transport == NULL) {
  ------------------
  |  Branch (1661:9): [True: 0, False: 66]
  ------------------
 1662|      0|        DEBUGMSGTL(("snmp_sess", "couldn't open transport connection\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]
  |  |  ------------------
  ------------------
 1663|      0|        in_session->s_snmp_errno = SNMPERR_BAD_ADDRESS;
  ------------------
  |  |  220|      0|#define SNMPERR_BAD_ADDRESS		(-3)
  ------------------
 1664|      0|        in_session->s_errno = errno;
 1665|      0|        snmp_set_detail(in_session->peername);
 1666|      0|        return SNMPERR_BAD_ADDRESS;
  ------------------
  |  |  220|      0|#define SNMPERR_BAD_ADDRESS		(-3)
  ------------------
 1667|      0|    }
 1668|       |
 1669|       |    /** if transport has a max size, make sure session is the same (or less) */
 1670|     66|    if (in_session->rcvMsgMaxSize > transport->msgMaxSize) {
  ------------------
  |  Branch (1670:9): [True: 66, False: 0]
  ------------------
 1671|     66|        DEBUGMSGTL(("snmp_sess",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 1672|     66|                    "limiting session rcv size (%" NETSNMP_PRIz "d) to transport max (%" NETSNMP_PRIz "d)\n",
 1673|     66|                    in_session->rcvMsgMaxSize, transport->msgMaxSize));
 1674|     66|        in_session->rcvMsgMaxSize = transport->msgMaxSize;
 1675|     66|    }
 1676|       |
 1677|     66|    if (in_session->sndMsgMaxSize > transport->msgMaxSize) {
  ------------------
  |  Branch (1677:9): [True: 66, False: 0]
  ------------------
 1678|     66|        DEBUGMSGTL(("snmp_sess",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 1679|     66|                    "limiting session snd size (%" NETSNMP_PRIz "d) to transport max (%" NETSNMP_PRIz "d)\n",
 1680|     66|                    in_session->sndMsgMaxSize, transport->msgMaxSize));
 1681|     66|        in_session->sndMsgMaxSize = transport->msgMaxSize;
 1682|     66|    }
 1683|       |
 1684|     66|    transport->flags |= NETSNMP_TRANSPORT_FLAG_OPENED;
  ------------------
  |  |   57|     66|#define		NETSNMP_TRANSPORT_FLAG_OPENED	 0x20  /* f_open called */
  ------------------
 1685|     66|    DEBUGMSGTL(("snmp_sess", "done opening transport: %x\n", transport->flags & NETSNMP_TRANSPORT_FLAG_OPENED));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 1686|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1687|     66|}
snmp_add:
 1800|     66|{
 1801|     66|    struct session_list *slp;
 1802|       |
 1803|     66|    slp = snmp_sess_add_ex(in_session, transport, fpre_parse, NULL,
 1804|     66|                           fpost_parse, NULL, NULL, NULL, NULL);
 1805|     66|    if (slp == NULL) {
  ------------------
  |  Branch (1805:9): [True: 0, False: 66]
  ------------------
 1806|      0|        return NULL;
 1807|      0|    }
 1808|       |
 1809|     66|    snmp_session_insert(slp);
 1810|       |
 1811|     66|    return (slp->session);
 1812|     66|}
snmp_sess_add_ex:
 1861|     66|{
 1862|     66|    struct session_list *slp;
 1863|     66|    int rc;
 1864|       |    
 1865|     66|    _init_snmp();
 1866|       |
 1867|     66|    if (transport == NULL)
  ------------------
  |  Branch (1867:9): [True: 0, False: 66]
  ------------------
 1868|      0|        return NULL;
 1869|       |
 1870|     66|    if (NULL != in_session && (in_session->rcvMsgMaxSize < SNMP_MIN_MAX_LEN ||
  ------------------
  |  |   48|    132|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (1870:9): [True: 66, False: 0]
  |  Branch (1870:32): [True: 0, False: 66]
  ------------------
 1871|     66|                               in_session->sndMsgMaxSize < SNMP_MIN_MAX_LEN)) {
  ------------------
  |  |   48|     66|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (1871:32): [True: 0, False: 66]
  ------------------
 1872|      0|        DEBUGMSGTL(("snmp_sess_add",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1873|      0|                    "invalid session (msg sizes). need snmp_sess_init"));
 1874|      0|        in_session = NULL; /* force transport cleanup below */
 1875|      0|    }
 1876|       |
 1877|     66|    if (in_session == NULL) {
  ------------------
  |  Branch (1877:9): [True: 0, False: 66]
  ------------------
 1878|      0|        transport->f_close(transport);
 1879|      0|        netsnmp_transport_free(transport);
 1880|      0|        return NULL;
 1881|      0|    }
 1882|       |
 1883|       |    /* if the transport hasn't been fully opened yet, open it now */
 1884|     66|    if ((rc = netsnmp_sess_config_and_open_transport(in_session, transport))
  ------------------
  |  Branch (1884:9): [True: 0, False: 66]
  ------------------
 1885|     66|        != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1886|      0|        return NULL;
 1887|      0|    }
 1888|       |
 1889|     66|    DEBUGMSGTL(("snmp_sess_add", "fd %d\n", transport->sock));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 1890|       |
 1891|     66|    if ((slp = snmp_sess_copy(in_session)) == NULL) {
  ------------------
  |  Branch (1891:9): [True: 0, False: 66]
  ------------------
 1892|      0|        transport->f_close(transport);
 1893|      0|        netsnmp_transport_free(transport);
 1894|      0|        return (NULL);
 1895|      0|    }
 1896|       |
 1897|     66|    slp->transport = transport;
 1898|     66|    slp->internal->hook_pre = fpre_parse;
 1899|     66|    slp->internal->hook_parse = fparse;
 1900|     66|    slp->internal->hook_post = fpost_parse;
 1901|     66|    slp->internal->hook_build = fbuild;
 1902|     66|    slp->internal->hook_realloc_build = frbuild;
 1903|     66|    slp->internal->check_packet = fcheck;
 1904|     66|    slp->internal->hook_create_pdu = fcreate_pdu;
 1905|       |
 1906|       |    /** don't let session max exceed transport max */
 1907|     66|    if (slp->session->rcvMsgMaxSize > transport->msgMaxSize) {
  ------------------
  |  Branch (1907:9): [True: 0, False: 66]
  ------------------
 1908|      0|        DEBUGMSGTL(("snmp_sess_add",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1909|      0|                    "limiting session rcv size (%" NETSNMP_PRIz "d) to transport max (%" NETSNMP_PRIz "d)\n",
 1910|      0|                    slp->session->rcvMsgMaxSize, transport->msgMaxSize));
 1911|      0|        slp->session->rcvMsgMaxSize = transport->msgMaxSize;
 1912|      0|    }
 1913|     66|    if (slp->session->sndMsgMaxSize > transport->msgMaxSize) {
  ------------------
  |  Branch (1913:9): [True: 0, False: 66]
  ------------------
 1914|      0|        DEBUGMSGTL(("snmp_sess_add",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1915|      0|                    "limiting session snd size (%" NETSNMP_PRIz "d) to transport max (%" NETSNMP_PRIz "d)\n",
 1916|      0|                    slp->session->sndMsgMaxSize, transport->msgMaxSize));
 1917|      0|        slp->session->sndMsgMaxSize = transport->msgMaxSize;
 1918|      0|    }
 1919|       |
 1920|     66|    if (slp->session->version == SNMP_VERSION_3) {
  ------------------
  |  |  113|     66|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (1920:9): [True: 0, False: 66]
  ------------------
 1921|      0|        DEBUGMSGTL(("snmp_sess_add",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1922|      0|                    "adding v3 session -- maybe engineID probe now\n"));
 1923|      0|        if (!snmpv3_engineID_probe(slp, slp->session)) {
  ------------------
  |  Branch (1923:13): [True: 0, False: 0]
  ------------------
 1924|      0|            DEBUGMSGTL(("snmp_sess_add", "engine ID probe failed\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]
  |  |  ------------------
  ------------------
 1925|      0|            goto close_session;
 1926|      0|        }
 1927|      0|    }
 1928|       |
 1929|     66|    slp->session->flags &= ~SNMP_FLAGS_DONT_PROBE;
  ------------------
  |  |  188|     66|#define SNMP_FLAGS_DONT_PROBE      0x100      /* don't probe for an engineID */
  ------------------
 1930|       |
 1931|     66|    if (transport->f_setup_session &&
  ------------------
  |  Branch (1931:9): [True: 66, False: 0]
  ------------------
 1932|     66|        transport->f_setup_session(transport, slp->session) != SNMPERR_SUCCESS)
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (1932:9): [True: 0, False: 66]
  ------------------
 1933|      0|        goto close_session;
 1934|       |
 1935|     66|    return slp;
 1936|       |
 1937|      0|close_session:
 1938|      0|    snmp_sess_close(slp);
 1939|       |    return NULL;
 1940|     66|}                               /*  end snmp_sess_add_ex()  */
netsnmp_cleanup_session:
 2000|     66|{
 2001|     66|    free(s->localname);
 2002|     66|    free(s->peername);
 2003|     66|    free(s->community);
 2004|     66|    free(s->contextEngineID);
 2005|     66|    free(s->contextName);
 2006|     66|    free(s->securityEngineID);
 2007|     66|    free(s->securityName);
 2008|     66|    free(s->securityAuthProto);
 2009|     66|    free(s->securityAuthLocalKey);
 2010|     66|    free(s->securityPrivProto);
 2011|     66|    free(s->securityPrivLocalKey);
 2012|     66|    free(s->paramName);
 2013|     66|#ifndef NETSNMP_NO_TRAP_STATS
 2014|     66|    free(s->trap_stats);
 2015|     66|#endif /* NETSNMP_NO_TRAP_STATS */
 2016|     66|    usm_free_user(s->sessUser);
 2017|     66|    netsnmp_free_transport_config(s->transport_configuration);
 2018|     66|    memset(s, 0, sizeof(*s));
 2019|     66|}
snmp_sess_close:
 2050|     66|{
 2051|     66|    netsnmp_transport *transport;
 2052|     66|    struct snmp_internal_session *isp;
 2053|     66|    netsnmp_session *sesp = NULL;
 2054|     66|    struct snmp_secmod_def *sptr;
 2055|       |
 2056|     66|    if (slp == NULL) {
  ------------------
  |  Branch (2056:9): [True: 0, False: 66]
  ------------------
 2057|      0|        return 0;
 2058|      0|    }
 2059|       |
 2060|     66|    if (slp->session != NULL &&
  ------------------
  |  Branch (2060:9): [True: 66, False: 0]
  ------------------
 2061|     66|        (sptr = find_sec_mod(slp->session->securityModel)) != NULL &&
  ------------------
  |  Branch (2061:9): [True: 66, False: 0]
  ------------------
 2062|     66|        sptr->session_close != NULL) {
  ------------------
  |  Branch (2062:9): [True: 0, False: 66]
  ------------------
 2063|      0|        (*sptr->session_close) (slp->session);
 2064|      0|    }
 2065|       |
 2066|     66|    isp = slp->internal;
 2067|     66|    slp->internal = NULL;
 2068|       |
 2069|     66|    if (isp) {
  ------------------
  |  Branch (2069:9): [True: 66, False: 0]
  ------------------
 2070|     66|        netsnmp_request_list *rp, *orp;
 2071|       |
 2072|     66|        SNMP_FREE(isp->packet);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2073|       |
 2074|       |        /*
 2075|       |         * Free each element in the input request list.  
 2076|       |         */
 2077|     66|        rp = isp->requests;
 2078|     66|        while (rp) {
  ------------------
  |  Branch (2078:16): [True: 0, False: 66]
  ------------------
 2079|      0|            orp = rp;
 2080|      0|            rp = rp->next_request;
 2081|      0|            if (orp->callback) {
  ------------------
  |  Branch (2081:17): [True: 0, False: 0]
  ------------------
 2082|      0|                orp->callback(NETSNMP_CALLBACK_OP_TIMED_OUT,
  ------------------
  |  |  353|      0|#define NETSNMP_CALLBACK_OP_TIMED_OUT		2
  ------------------
 2083|      0|                              slp->session, orp->pdu->reqid,
 2084|      0|                              orp->pdu, orp->cb_data);
 2085|      0|            }
 2086|      0|            snmp_free_pdu(orp->pdu);
 2087|      0|            free(orp);
 2088|      0|        }
 2089|       |
 2090|     66|        free(isp);
 2091|     66|    }
 2092|       |
 2093|     66|    transport = slp->transport;
 2094|     66|    slp->transport = NULL;
 2095|       |
 2096|     66|    if (transport) {
  ------------------
  |  Branch (2096:9): [True: 66, False: 0]
  ------------------
 2097|     66|        transport->f_close(transport);
 2098|     66|        netsnmp_transport_free(transport);
 2099|     66|    }
 2100|       |
 2101|     66|    sesp = slp->session;
 2102|     66|    slp->session = NULL;
 2103|       |
 2104|       |    /*
 2105|       |     * The following is necessary to avoid memory leakage when closing AgentX 
 2106|       |     * sessions that may have multiple subsessions.  These hang off the main
 2107|       |     * session at ->subsession, and chain through ->next.  
 2108|       |     */
 2109|       |
 2110|     66|    if (sesp != NULL && sesp->subsession != NULL) {
  ------------------
  |  Branch (2110:9): [True: 66, False: 0]
  |  Branch (2110:25): [True: 0, False: 66]
  ------------------
 2111|      0|        netsnmp_session *subsession = sesp->subsession, *tmpsub;
 2112|       |
 2113|      0|        while (subsession != NULL) {
  ------------------
  |  Branch (2113:16): [True: 0, False: 0]
  ------------------
 2114|      0|            DEBUGMSGTL(("snmp_sess_close",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2115|      0|                        "closing session %p, subsession %p\n", sesp,
 2116|      0|                        subsession));
 2117|      0|            tmpsub = subsession->next;
 2118|      0|            snmp_free_session(subsession);
 2119|      0|            subsession = tmpsub;
 2120|      0|        }
 2121|      0|    }
 2122|       |
 2123|     66|    snmp_free_session(sesp);
 2124|     66|    free(slp);
 2125|     66|    return 1;
 2126|     66|}
snmp_close:
 2130|     66|{
 2131|     66|    struct session_list *slp = NULL, *oslp = NULL;
 2132|       |
 2133|     66|    {                           /*MTCRITICAL_RESOURCE */
 2134|     66|        snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     66|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2135|     66|        if (Sessions && Sessions->session == session) { /* If first entry */
  ------------------
  |  Branch (2135:13): [True: 0, False: 66]
  |  Branch (2135:25): [True: 0, False: 0]
  ------------------
 2136|      0|            slp = Sessions;
 2137|      0|            Sessions = slp->next;
 2138|     66|        } else {
 2139|     66|            for (slp = Sessions; slp; slp = slp->next) {
  ------------------
  |  Branch (2139:34): [True: 0, False: 66]
  ------------------
 2140|      0|                if (slp->session == session) {
  ------------------
  |  Branch (2140:21): [True: 0, False: 0]
  ------------------
 2141|      0|                    if (oslp)   /* if we found entry that points here */
  ------------------
  |  Branch (2141:25): [True: 0, False: 0]
  ------------------
 2142|      0|                        oslp->next = slp->next; /* link around this entry */
 2143|      0|                    break;
 2144|      0|                }
 2145|      0|                oslp = slp;
 2146|      0|            }
 2147|     66|        }
 2148|     66|        snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     66|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2149|     66|    }                           /*END MTCRITICAL_RESOURCE */
 2150|     66|    if (slp == NULL) {
  ------------------
  |  Branch (2150:9): [True: 66, False: 0]
  ------------------
 2151|     66|        return 0;
 2152|     66|    }
 2153|      0|    return snmp_sess_close(slp);
 2154|     66|}
snmp_close_sessions:
 2158|     66|{
 2159|     66|    struct session_list *slp;
 2160|       |
 2161|     66|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     66|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2162|    132|    while (Sessions) {
  ------------------
  |  Branch (2162:12): [True: 66, False: 66]
  ------------------
 2163|     66|        slp = Sessions;
 2164|     66|        Sessions = Sessions->next;
 2165|     66|        snmp_sess_close(slp);
 2166|     66|    }
 2167|     66|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     66|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2168|     66|    return 1;
 2169|     66|}
snmpv3_header_realloc_rbuild:
 2534|      3|{
 2535|      3|    size_t          start_offset = *offset;
 2536|      3|    u_char          msg_flags;
 2537|      3|    long            max_size, sec_model;
 2538|      3|    int             rc = 0;
 2539|       |
 2540|       |    /*
 2541|       |     * msgSecurityModel.  
 2542|       |     */
 2543|      3|    sec_model = pdu->securityModel;
 2544|      3|    DEBUGDUMPHEADER("send", "msgSecurityModel");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2545|      3|    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 2546|      3|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2547|      3|                                          ASN_INTEGER), &sec_model,
  ------------------
  |  |   75|      3|#define ASN_INTEGER	    0x02U
  ------------------
 2548|      3|                                sizeof(sec_model));
 2549|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2550|      3|    if (rc == 0) {
  ------------------
  |  Branch (2550:9): [True: 0, False: 3]
  ------------------
 2551|      0|        return 0;
 2552|      0|    }
 2553|       |
 2554|       |    /*
 2555|       |     * msgFlags.  
 2556|       |     */
 2557|      3|    snmpv3_calc_msg_flags(pdu->securityLevel, pdu->command, &msg_flags);
 2558|      3|    DEBUGDUMPHEADER("send", "msgFlags");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2559|      3|    rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 2560|      3|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2561|      3|                                             | ASN_OCTET_STR), &msg_flags,
  ------------------
  |  |   78|      3|#define ASN_OCTET_STR	    0x04U
  ------------------
 2562|      3|                                   sizeof(msg_flags));
 2563|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2564|      3|    if (rc == 0) {
  ------------------
  |  Branch (2564:9): [True: 0, False: 3]
  ------------------
 2565|      0|        return 0;
 2566|      0|    }
 2567|       |
 2568|       |    /*
 2569|       |     * msgMaxSize.  
 2570|       |     */
 2571|      3|    max_size = netsnmp_max_send_msg_size();
 2572|      3|    if (session->rcvMsgMaxSize < max_size)
  ------------------
  |  Branch (2572:9): [True: 3, False: 0]
  ------------------
 2573|      3|        max_size = session->rcvMsgMaxSize;
 2574|      3|    DEBUGDUMPHEADER("send:msgMaxSize2", "msgMaxSize");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2575|      3|    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 2576|      3|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2577|      3|                                          ASN_INTEGER), &max_size,
  ------------------
  |  |   75|      3|#define ASN_INTEGER	    0x02U
  ------------------
 2578|      3|                                sizeof(max_size));
 2579|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2580|      3|    if (rc == 0) {
  ------------------
  |  Branch (2580:9): [True: 0, False: 3]
  ------------------
 2581|      0|        return 0;
 2582|      0|    }
 2583|       |
 2584|       |    /*
 2585|       |     * msgID.  
 2586|       |     */
 2587|      3|    DEBUGDUMPHEADER("send", "msgID");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2588|      3|    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 2589|      3|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2590|      3|                                          ASN_INTEGER), &pdu->msgid,
  ------------------
  |  |   75|      3|#define ASN_INTEGER	    0x02U
  ------------------
 2591|      3|                                sizeof(pdu->msgid));
 2592|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2593|      3|    if (rc == 0) {
  ------------------
  |  Branch (2593:9): [True: 0, False: 3]
  ------------------
 2594|      0|        return 0;
 2595|      0|    }
 2596|       |
 2597|       |    /*
 2598|       |     * Global data sequence.  
 2599|       |     */
 2600|      3|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 2601|      3|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      3|#define ASN_SEQUENCE	    0x10U
  ------------------
 2602|      3|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2603|      3|                                     *offset - start_offset);
 2604|      3|    if (rc == 0) {
  ------------------
  |  Branch (2604:9): [True: 0, False: 3]
  ------------------
 2605|      0|        return 0;
 2606|      0|    }
 2607|       |
 2608|       |    /*
 2609|       |     * Store the version field - msgVersion.  
 2610|       |     */
 2611|      3|    DEBUGDUMPHEADER("send", "SNMP Version Number");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2612|      3|    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 2613|      3|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2614|      3|                                          ASN_INTEGER),
  ------------------
  |  |   75|      3|#define ASN_INTEGER	    0x02U
  ------------------
 2615|      3|                                (long *) &pdu->version,
 2616|      3|                                sizeof(pdu->version));
 2617|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2618|      3|    return rc;
 2619|      3|}                               /* end snmpv3_header_realloc_rbuild() */
snmpv3_scopedPDU_header_realloc_rbuild:
 2664|      3|{
 2665|      3|    size_t          start_offset = *offset;
 2666|      3|    int             rc = 0;
 2667|       |
 2668|       |    /*
 2669|       |     * contextName.  
 2670|       |     */
 2671|      3|    DEBUGDUMPHEADER("send", "contextName");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2672|      3|    rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 2673|      3|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2674|      3|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|      3|#define ASN_OCTET_STR	    0x04U
  ------------------
 2675|      3|                                   (u_char *) pdu->contextName,
 2676|      3|                                   pdu->contextNameLen);
 2677|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2678|      3|    if (rc == 0) {
  ------------------
  |  Branch (2678:9): [True: 0, False: 3]
  ------------------
 2679|      0|        return 0;
 2680|      0|    }
 2681|       |
 2682|       |    /*
 2683|       |     * contextEngineID.  
 2684|       |     */
 2685|      3|    DEBUGDUMPHEADER("send", "contextEngineID");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2686|      3|    rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 2687|      3|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2688|      3|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|      3|#define ASN_OCTET_STR	    0x04U
  ------------------
 2689|      3|                                   pdu->contextEngineID,
 2690|      3|                                   pdu->contextEngineIDLen);
 2691|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2692|      3|    if (rc == 0) {
  ------------------
  |  Branch (2692:9): [True: 0, False: 3]
  ------------------
 2693|      0|        return 0;
 2694|      0|    }
 2695|       |
 2696|      3|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 2697|      3|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      3|#define ASN_SEQUENCE	    0x10U
  ------------------
 2698|      3|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2699|      3|                                     *offset - start_offset + body_len);
 2700|       |
 2701|      3|    return rc;
 2702|      3|}                               /* end snmpv3_scopedPDU_header_realloc_rbuild() */
snmpv3_packet_realloc_rbuild:
 2714|      3|{
 2715|      3|    u_char         *scoped_pdu, *hdrbuf = NULL, *hdr = NULL;
 2716|      3|    size_t          hdrbuf_len = SNMP_MAX_MSG_V3_HDRS, hdr_offset =
  ------------------
  |  |  143|      3|#define SNMP_MAX_MSG_V3_HDRS       (4+3+4+7+7+3+7+16)   /* fudge factor=16 */
  ------------------
 2717|      3|        0, spdu_offset = 0;
 2718|      3|    size_t          body_end_offset = *offset, body_len = 0;
 2719|      3|    struct snmp_secmod_def *sptr = NULL;
 2720|      3|    int             rc = 0;
 2721|       |
 2722|       |    /*
 2723|       |     * Build a scopedPDU structure into the packet buffer.  
 2724|       |     */
 2725|      3|    DEBUGPRINTPDUTYPE("send", pdu->command);
  ------------------
  |  |  418|      3|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   81|      3|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (81:56): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2726|      3|    if (pdu_data) {
  ------------------
  |  Branch (2726:9): [True: 0, False: 3]
  ------------------
 2727|      0|        while ((*pkt_len - *offset) < pdu_data_len) {
  ------------------
  |  Branch (2727:16): [True: 0, False: 0]
  ------------------
 2728|      0|            if (!asn_realloc(pkt, pkt_len)) {
  ------------------
  |  Branch (2728:17): [True: 0, False: 0]
  ------------------
 2729|      0|                return -1;
 2730|      0|            }
 2731|      0|        }
 2732|       |
 2733|      0|        *offset += pdu_data_len;
 2734|      0|        memcpy(*pkt + *pkt_len - *offset, pdu_data, pdu_data_len);
 2735|      3|    } else {
 2736|      3|        rc = snmp_pdu_realloc_rbuild(pkt, pkt_len, offset, pdu);
 2737|      3|        if (rc == 0) {
  ------------------
  |  Branch (2737:13): [True: 0, False: 3]
  ------------------
 2738|      0|            return -1;
 2739|      0|        }
 2740|      3|    }
 2741|      3|    body_len = *offset - body_end_offset;
 2742|       |
 2743|      3|    DEBUGDUMPSECTION("send", "ScopedPdu");
  ------------------
  |  |   81|      3|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2744|      3|    rc = snmpv3_scopedPDU_header_realloc_rbuild(pkt, pkt_len, offset,
 2745|      3|                                                pdu, body_len);
 2746|      3|    if (rc == 0) {
  ------------------
  |  Branch (2746:9): [True: 0, False: 3]
  ------------------
 2747|      0|        return -1;
 2748|      0|    }
 2749|      3|    spdu_offset = *offset;
 2750|      3|    DEBUGINDENTADD(-4);         /*  Return from Scoped PDU.  */
  ------------------
  |  |   73|      3|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2751|       |
 2752|      3|    if ((hdrbuf = (u_char *) malloc(hdrbuf_len)) == NULL) {
  ------------------
  |  Branch (2752:9): [True: 0, False: 3]
  ------------------
 2753|      0|        return -1;
 2754|      0|    }
 2755|       |
 2756|      3|    rc = snmpv3_header_realloc_rbuild(&hdrbuf, &hdrbuf_len, &hdr_offset,
 2757|      3|                                      session, pdu);
 2758|      3|    if (rc == 0) {
  ------------------
  |  Branch (2758:9): [True: 0, False: 3]
  ------------------
 2759|      0|        SNMP_FREE(hdrbuf);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2760|      0|        return -1;
 2761|      0|    }
 2762|      3|    hdr = hdrbuf + hdrbuf_len - hdr_offset;
 2763|      3|    scoped_pdu = *pkt + *pkt_len - spdu_offset;
 2764|       |
 2765|       |    /*
 2766|       |     * Call the security module to possibly encrypt and authenticate the
 2767|       |     * message---the entire message to transmitted on the wire is returned.  
 2768|       |     */
 2769|       |
 2770|      3|    sptr = find_sec_mod(pdu->securityModel);
 2771|      3|    DEBUGDUMPSECTION("send", "SM msgSecurityParameters");
  ------------------
  |  |   81|      3|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2772|      3|    if (sptr && sptr->encode_reverse) {
  ------------------
  |  Branch (2772:9): [True: 3, False: 0]
  |  Branch (2772:17): [True: 3, False: 0]
  ------------------
 2773|      3|        struct snmp_secmod_outgoing_params parms;
 2774|       |
 2775|      3|        parms.msgProcModel = pdu->msgParseModel;
 2776|      3|        parms.globalData = hdr;
 2777|      3|        parms.globalDataLen = hdr_offset;
 2778|      3|        parms.maxMsgSize = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  142|      3|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 2779|      3|        parms.secModel = pdu->securityModel;
 2780|      3|        parms.secEngineID = pdu->securityEngineID;
 2781|      3|        parms.secEngineIDLen = pdu->securityEngineIDLen;
 2782|      3|        parms.secName = pdu->securityName;
 2783|      3|        parms.secNameLen = pdu->securityNameLen;
 2784|      3|        parms.secLevel = pdu->securityLevel;
 2785|      3|        parms.scopedPdu = scoped_pdu;
 2786|      3|        parms.scopedPduLen = spdu_offset;
 2787|      3|        parms.secStateRef = pdu->securityStateRef;
 2788|      3|        parms.wholeMsg = pkt;
 2789|      3|        parms.wholeMsgLen = pkt_len;
 2790|      3|        parms.wholeMsgOffset = offset;
 2791|      3|        parms.session = session;
 2792|      3|        parms.pdu = pdu;
 2793|       |
 2794|      3|        rc = (*sptr->encode_reverse) (&parms);
 2795|      3|    } else {
 2796|      0|        if (!sptr) {
  ------------------
  |  Branch (2796:13): [True: 0, False: 0]
  ------------------
 2797|      0|            snmp_log(LOG_ERR,
 2798|      0|                     "no such security service available: %d\n",
 2799|      0|                     pdu->securityModel);
 2800|      0|        } else if (!sptr->encode_reverse) {
  ------------------
  |  Branch (2800:20): [True: 0, False: 0]
  ------------------
 2801|      0|            snmp_log(LOG_ERR,
 2802|      0|                     "security service %d doesn't support reverse encoding.\n",
 2803|      0|                     pdu->securityModel);
 2804|      0|        }
 2805|      0|        rc = -1;
 2806|      0|    }
 2807|       |
 2808|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2809|       |    SNMP_FREE(hdrbuf);
  ------------------
  |  |   62|      3|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 3, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2810|      3|    return rc;
 2811|      3|}                               /* end snmpv3_packet_realloc_rbuild() */
snmp_build:
 3315|      3|{
 3316|      3|    int             rc;
 3317|       |
 3318|      3|    rc = _snmp_build(pkt, pkt_len, offset, pss, pdu);
 3319|      3|    if (rc) {
  ------------------
  |  Branch (3319:9): [True: 0, False: 3]
  ------------------
 3320|      0|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (3320:13): [True: 0, False: 0]
  ------------------
 3321|      0|            snmp_log(LOG_ERR, "snmp_build: unknown failure\n");
 3322|      0|            pss->s_snmp_errno = SNMPERR_BAD_ASN1_BUILD;
  ------------------
  |  |  228|      0|#define SNMPERR_BAD_ASN1_BUILD		(-11)
  ------------------
 3323|      0|        }
 3324|      0|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   56|      0|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 3325|      0|        rc = -1;
 3326|      0|    }
 3327|      3|    return rc;
 3328|      3|}
snmp_pdu_realloc_rbuild:
 3547|      3|{
 3548|      3|#ifndef VPCACHE_SIZE
 3549|      3|#define VPCACHE_SIZE 50
 3550|      3|#endif
 3551|      3|    netsnmp_variable_list *vpcache[VPCACHE_SIZE];
 3552|      3|    netsnmp_variable_list *vp, *tmpvp;
 3553|      3|    size_t          start_offset = *offset;
 3554|      3|    int             i, wrapped = 0, notdone, final, rc = 0;
 3555|       |
 3556|      3|    DEBUGMSGTL(("snmp_pdu_realloc_rbuild", "starting\n"));
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 3]
  |  |  ------------------
  ------------------
 3557|      6|    for (vp = pdu->variables, i = VPCACHE_SIZE - 1; vp;
  ------------------
  |  | 3549|      3|#define VPCACHE_SIZE 50
  ------------------
  |  Branch (3557:53): [True: 3, False: 3]
  ------------------
 3558|      3|         vp = vp->next_variable, i--) {
 3559|       |        /*
 3560|       |         * if estimated getbulk response size exceeded packet max size,
 3561|       |         * processing was stopped before bulk cache was filled and type
 3562|       |         * was set to ASN_PRIV_STOP, indicating that the rest of the varbinds
 3563|       |         * in the cache are empty and we can stop encoding them.
 3564|       |         */
 3565|      3|        if (ASN_PRIV_STOP == vp->type)
  ------------------
  |  |  207|      3|#define ASN_PRIV_STOP       (ASN_PRIVATE | 8)   /* 200 */
  |  |  ------------------
  |  |  |  |   93|      3|#define ASN_PRIVATE	    0xC0U
  |  |  ------------------
  ------------------
  |  Branch (3565:13): [True: 0, False: 3]
  ------------------
 3566|      0|            break;
 3567|      3|        if (i < 0) {
  ------------------
  |  Branch (3567:13): [True: 0, False: 3]
  ------------------
 3568|      0|            wrapped = notdone = 1;
 3569|      0|            i = VPCACHE_SIZE - 1;
  ------------------
  |  | 3549|      0|#define VPCACHE_SIZE 50
  ------------------
 3570|      0|            DEBUGMSGTL(("snmp_pdu_realloc_rbuild", "wrapped\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]
  |  |  ------------------
  ------------------
 3571|      0|        }
 3572|      3|        vpcache[i] = vp;
 3573|      3|    }
 3574|      3|    final = i + 1;
 3575|       |
 3576|      3|    do {
 3577|      6|        for (i = final; i < VPCACHE_SIZE; i++) {
  ------------------
  |  | 3549|      6|#define VPCACHE_SIZE 50
  ------------------
  |  Branch (3577:25): [True: 3, False: 3]
  ------------------
 3578|      3|            vp = vpcache[i];
 3579|      3|            DEBUGDUMPSECTION("send", "VarBind");
  ------------------
  |  |   81|      3|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3580|      3|            rc = snmp_realloc_rbuild_var_op(pkt, pkt_len, offset, 1,
 3581|      3|                                            vp->name, &vp->name_length,
 3582|      3|                                            vp->type,
 3583|      3|                                            (u_char *) vp->val.string,
 3584|      3|                                            vp->val_len);
 3585|      3|            DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3586|      3|            if (rc == 0) {
  ------------------
  |  Branch (3586:17): [True: 0, False: 3]
  ------------------
 3587|      0|                return 0;
 3588|      0|            }
 3589|      3|        }
 3590|       |
 3591|      3|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3592|      3|        if (wrapped) {
  ------------------
  |  Branch (3592:13): [True: 0, False: 3]
  ------------------
 3593|      0|            notdone = 1;
 3594|      0|            for (i = 0; i < final; i++) {
  ------------------
  |  Branch (3594:25): [True: 0, False: 0]
  ------------------
 3595|      0|                vp = vpcache[i];
 3596|      0|                DEBUGDUMPSECTION("send", "VarBind");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3597|      0|                rc = snmp_realloc_rbuild_var_op(pkt, pkt_len, offset, 1,
 3598|      0|                                                vp->name, &vp->name_length,
 3599|      0|                                                vp->type,
 3600|      0|                                                (u_char *) vp->val.string,
 3601|      0|                                                vp->val_len);
 3602|      0|                DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3603|      0|                if (rc == 0) {
  ------------------
  |  Branch (3603:21): [True: 0, False: 0]
  ------------------
 3604|      0|                    return 0;
 3605|      0|                }
 3606|      0|            }
 3607|       |
 3608|      0|            if (final == 0) {
  ------------------
  |  Branch (3608:17): [True: 0, False: 0]
  ------------------
 3609|      0|                tmpvp = vpcache[VPCACHE_SIZE - 1];
  ------------------
  |  | 3549|      0|#define VPCACHE_SIZE 50
  ------------------
 3610|      0|            } else {
 3611|      0|                tmpvp = vpcache[final - 1];
 3612|      0|            }
 3613|      0|            wrapped = 0;
 3614|       |
 3615|      0|            for (vp = pdu->variables, i = VPCACHE_SIZE - 1;
  ------------------
  |  | 3549|      0|#define VPCACHE_SIZE 50
  ------------------
 3616|      0|                 vp && vp != tmpvp; vp = vp->next_variable, i--) {
  ------------------
  |  Branch (3616:18): [True: 0, False: 0]
  |  Branch (3616:24): [True: 0, False: 0]
  ------------------
 3617|      0|                if (i < 0) {
  ------------------
  |  Branch (3617:21): [True: 0, False: 0]
  ------------------
 3618|      0|                    wrapped = 1;
 3619|      0|                    i = VPCACHE_SIZE - 1;
  ------------------
  |  | 3549|      0|#define VPCACHE_SIZE 50
  ------------------
 3620|      0|                    DEBUGMSGTL(("snmp_pdu_realloc_rbuild", "wrapped\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]
  |  |  ------------------
  ------------------
 3621|      0|                }
 3622|      0|                vpcache[i] = vp;
 3623|      0|            }
 3624|      0|            final = i + 1;
 3625|      3|        } else {
 3626|      3|            notdone = 0;
 3627|      3|        }
 3628|      3|    } while (notdone);
  ------------------
  |  Branch (3628:14): [True: 0, False: 3]
  ------------------
 3629|       |
 3630|       |    /*
 3631|       |     * Save current location and build SEQUENCE tag and length placeholder for
 3632|       |     * variable-bindings sequence (actual length will be inserted later).  
 3633|       |     */
 3634|       |
 3635|      3|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 3636|      3|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      3|#define ASN_SEQUENCE	    0x10U
  ------------------
 3637|      3|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3638|      3|                                     *offset - start_offset);
 3639|       |
 3640|       |    /*
 3641|       |     * Store fields in the PDU preceding the variable-bindings sequence.
 3642|       |     */
 3643|      3|    if (pdu->command != SNMP_MSG_TRAP) {
  ------------------
  |  |  135|      3|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|      3|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3643:9): [True: 3, False: 0]
  ------------------
 3644|       |        /*
 3645|       |         * Error index (getbulk max-repetitions).  
 3646|       |         */
 3647|      3|        DEBUGDUMPHEADER("send", "error index");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3648|      3|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3649|      3|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3650|      3|                                              | ASN_INTEGER),
  ------------------
  |  |   75|      3|#define ASN_INTEGER	    0x02U
  ------------------
 3651|      3|                                    &pdu->errindex, sizeof(pdu->errindex));
 3652|      3|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3653|      3|        if (rc == 0) {
  ------------------
  |  Branch (3653:13): [True: 0, False: 3]
  ------------------
 3654|      0|            return 0;
 3655|      0|        }
 3656|       |
 3657|       |        /*
 3658|       |         * Error status (getbulk non-repeaters).  
 3659|       |         */
 3660|      3|        DEBUGDUMPHEADER("send", "error status");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3661|      3|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3662|      3|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3663|      3|                                              | ASN_INTEGER),
  ------------------
  |  |   75|      3|#define ASN_INTEGER	    0x02U
  ------------------
 3664|      3|                                    &pdu->errstat, sizeof(pdu->errstat));
 3665|      3|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3666|      3|        if (rc == 0) {
  ------------------
  |  Branch (3666:13): [True: 0, False: 3]
  ------------------
 3667|      0|            return 0;
 3668|      0|        }
 3669|       |
 3670|       |        /*
 3671|       |         * Request ID.  
 3672|       |         */
 3673|      3|        DEBUGDUMPHEADER("send", "request_id");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3674|      3|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3675|      3|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3676|      3|                                              | ASN_INTEGER), &pdu->reqid,
  ------------------
  |  |   75|      3|#define ASN_INTEGER	    0x02U
  ------------------
 3677|      3|                                    sizeof(pdu->reqid));
 3678|      3|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3679|      3|        if (rc == 0) {
  ------------------
  |  Branch (3679:13): [True: 0, False: 3]
  ------------------
 3680|      0|            return 0;
 3681|      0|        }
 3682|      3|    } else {
 3683|       |        /*
 3684|       |         * An SNMPv1 trap PDU.  
 3685|       |         */
 3686|       |
 3687|       |        /*
 3688|       |         * Timestamp.  
 3689|       |         */
 3690|      0|        DEBUGDUMPHEADER("send", "timestamp");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3691|      0|        rc = asn_realloc_rbuild_unsigned_int(pkt, pkt_len, offset, 1,
 3692|      0|                                             (u_char) (ASN_TIMETICKS |
  ------------------
  |  |   92|      0|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
 3693|      0|                                                       ASN_PRIMITIVE),
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3694|      0|                                             &pdu->time,
 3695|      0|                                             sizeof(pdu->time));
 3696|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3697|      0|        if (rc == 0) {
  ------------------
  |  Branch (3697:13): [True: 0, False: 0]
  ------------------
 3698|      0|            return 0;
 3699|      0|        }
 3700|       |
 3701|       |        /*
 3702|       |         * Specific trap.  
 3703|       |         */
 3704|      0|        DEBUGDUMPHEADER("send", "specific trap number");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3705|      0|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3706|      0|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3707|      0|                                              | ASN_INTEGER),
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
 3708|      0|                                    (const long *) &pdu->specific_type,
 3709|      0|                                    sizeof(pdu->specific_type));
 3710|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3711|      0|        if (rc == 0) {
  ------------------
  |  Branch (3711:13): [True: 0, False: 0]
  ------------------
 3712|      0|            return 0;
 3713|      0|        }
 3714|       |
 3715|       |        /*
 3716|       |         * Generic trap.  
 3717|       |         */
 3718|      0|        DEBUGDUMPHEADER("send", "generic trap number");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3719|      0|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3720|      0|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3721|      0|                                              | ASN_INTEGER),
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
 3722|      0|                                    (const long *) &pdu->trap_type,
 3723|      0|                                    sizeof(pdu->trap_type));
 3724|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3725|      0|        if (rc == 0) {
  ------------------
  |  Branch (3725:13): [True: 0, False: 0]
  ------------------
 3726|      0|            return 0;
 3727|      0|        }
 3728|       |
 3729|       |        /*
 3730|       |         * Agent-addr.  
 3731|       |         */
 3732|      0|        DEBUGDUMPHEADER("send", "agent Address");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3733|      0|        rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 3734|      0|                                       (u_char) (ASN_IPADDRESS |
  ------------------
  |  |   88|      0|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
 3735|      0|                                                 ASN_PRIMITIVE),
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3736|      0|                                       (const u_char *) pdu->agent_addr, 4);
 3737|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3738|      0|        if (rc == 0) {
  ------------------
  |  Branch (3738:13): [True: 0, False: 0]
  ------------------
 3739|      0|            return 0;
 3740|      0|        }
 3741|       |
 3742|       |        /*
 3743|       |         * Enterprise.  
 3744|       |         */
 3745|      0|        DEBUGDUMPHEADER("send", "enterprise OBJID");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3746|      0|        rc = asn_realloc_rbuild_objid(pkt, pkt_len, offset, 1,
 3747|      0|                                      (u_char) (ASN_UNIVERSAL |
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
 3748|      0|                                                ASN_PRIMITIVE |
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3749|      0|                                                ASN_OBJECT_ID),
  ------------------
  |  |   81|      0|#define ASN_OBJECT_ID	    0x06U
  ------------------
 3750|      0|                                      (oid *) pdu->enterprise,
 3751|      0|                                      pdu->enterprise_length);
 3752|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3753|      0|        if (rc == 0) {
  ------------------
  |  Branch (3753:13): [True: 0, False: 0]
  ------------------
 3754|      0|            return 0;
 3755|      0|        }
 3756|      0|    }
 3757|       |
 3758|       |    /*
 3759|       |     * Build the PDU sequence.  
 3760|       |     */
 3761|      3|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 3762|      3|                                     (u_char) pdu->command,
 3763|      3|                                     *offset - start_offset);
 3764|      3|    return rc;
 3765|      3|}
snmpv3_parse:
 3798|     14|{
 3799|     14|    u_char          type, msg_flags;
 3800|     14|    long            ver, msg_sec_model;
 3801|     14|    size_t          max_size_response;
 3802|     14|    u_char          tmp_buf[SNMP_MAX_MSG_SIZE];
 3803|     14|    size_t          tmp_buf_len;
 3804|     14|    u_char          pdu_buf[SNMP_MAX_MSG_SIZE];
 3805|     14|    u_char         *mallocbuf = NULL;
 3806|     14|    size_t          pdu_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  142|     14|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 3807|     14|    u_char         *sec_params;
 3808|     14|    u_char         *msg_data;
 3809|     14|    u_char         *cp;
 3810|     14|    size_t          asn_len, msg_len;
 3811|     14|    int             ret, ret_val;
 3812|     14|    struct snmp_secmod_def *sptr;
 3813|       |
 3814|       |
 3815|     14|    msg_data = data;
 3816|     14|    msg_len = *length;
 3817|       |
 3818|       |
 3819|       |    /*
 3820|       |     * message is an ASN.1 SEQUENCE  
 3821|       |     */
 3822|     14|    DEBUGDUMPSECTION("recv", "SNMPv3 Message");
  ------------------
  |  |   81|     14|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     14|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 14]
  |  |  ------------------
  ------------------
 3823|     14|    data = asn_parse_sequence(data, length, &type,
 3824|     14|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   84|     14|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   96|     14|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3825|     14|    if (data == NULL) {
  ------------------
  |  Branch (3825:9): [True: 0, False: 14]
  ------------------
 3826|       |        /*
 3827|       |         * error msg detail is set 
 3828|       |         */
 3829|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3830|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3831|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3832|      0|    }
 3833|       |
 3834|       |    /*
 3835|       |     * parse msgVersion  
 3836|       |     */
 3837|     14|    DEBUGDUMPHEADER("recv", "SNMP Version Number");
  ------------------
  |  |   79|     14|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     14|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 14]
  |  |  ------------------
  ------------------
 3838|     14|    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
 3839|     14|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     14|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     14|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 14]
  |  |  ------------------
  ------------------
 3840|     14|    if (data == NULL) {
  ------------------
  |  Branch (3840:9): [True: 0, False: 14]
  ------------------
 3841|      0|        ERROR_MSG("bad parse of version");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3842|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3843|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3844|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3845|      0|    }
 3846|     14|    pdu->version = ver;
 3847|       |
 3848|       |    /*
 3849|       |     * parse msgGlobalData sequence  
 3850|       |     */
 3851|     14|    cp = data;
 3852|     14|    asn_len = *length;
 3853|     14|    DEBUGDUMPSECTION("recv", "msgGlobalData");
  ------------------
  |  |   81|     14|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     14|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 14]
  |  |  ------------------
  ------------------
 3854|     14|    data = asn_parse_sequence(data, &asn_len, &type,
 3855|     14|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|     14|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|     14|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3856|     14|                              "msgGlobalData");
 3857|     14|    if (data == NULL) {
  ------------------
  |  Branch (3857:9): [True: 0, False: 14]
  ------------------
 3858|       |        /*
 3859|       |         * error msg detail is set 
 3860|       |         */
 3861|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3862|      0|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3863|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3864|      0|    }
 3865|     14|    *length -= data - cp;       /* subtract off the length of the header */
 3866|       |
 3867|       |    /*
 3868|       |     * msgID 
 3869|       |     */
 3870|     14|    DEBUGDUMPHEADER("recv", "msgID");
  ------------------
  |  |   79|     14|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     14|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 14]
  |  |  ------------------
  ------------------
 3871|     14|    data =
 3872|     14|        asn_parse_int(data, length, &type, &pdu->msgid,
 3873|     14|                      sizeof(pdu->msgid));
 3874|     14|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     14|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     14|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 14]
  |  |  ------------------
  ------------------
 3875|     14|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|     14|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3875:9): [True: 0, False: 14]
  |  Branch (3875:25): [True: 0, False: 14]
  ------------------
 3876|      0|        ERROR_MSG("error parsing msgID");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3877|      0|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3878|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3879|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3880|      0|    }
 3881|       |
 3882|       |    /*
 3883|       |     * Check the msgID we received is a legal value.  If not, then increment
 3884|       |     * snmpInASNParseErrs and return the appropriate error (see RFC 2572,
 3885|       |     * para. 7.2, section 2 -- note that a bad msgID means that the received
 3886|       |     * message is NOT a serialization of an SNMPv3Message, since the msgID
 3887|       |     * field is out of bounds).  
 3888|       |     */
 3889|       |
 3890|     14|    if (pdu->msgid < 0 || pdu->msgid > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|     14|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3890:9): [True: 0, False: 14]
  |  Branch (3890:27): [True: 0, False: 14]
  ------------------
 3891|      0|        snmp_log(LOG_ERR, "Received bad msgID (%ld %s %s).\n", pdu->msgid,
 3892|      0|                 (pdu->msgid < 0) ? "<" : ">",
  ------------------
  |  Branch (3892:18): [True: 0, False: 0]
  ------------------
 3893|      0|                 (pdu->msgid < 0) ? "0" : "2^31 - 1");
  ------------------
  |  Branch (3893:18): [True: 0, False: 0]
  ------------------
 3894|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3895|      0|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3896|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3897|      0|    }
 3898|       |
 3899|       |    /*
 3900|       |     * msgMaxSize 
 3901|       |     */
 3902|     14|    DEBUGDUMPHEADER("recv:msgMaxSize", "msgMaxSize");
  ------------------
  |  |   79|     14|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     14|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 14]
  |  |  ------------------
  ------------------
 3903|     14|    data = asn_parse_int(data, length, &type, &pdu->msgMaxSize,
 3904|     14|                         sizeof(pdu->msgMaxSize));
 3905|     14|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     14|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     14|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 14]
  |  |  ------------------
  ------------------
 3906|     14|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|     13|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3906:9): [True: 1, False: 13]
  |  Branch (3906:25): [True: 0, False: 13]
  ------------------
 3907|      1|        ERROR_MSG("error parsing msgMaxSize");
  ------------------
  |  |  188|      1|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3908|      1|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      1|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3909|      1|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      1|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 1]
  |  |  ------------------
  ------------------
 3910|      1|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      1|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3911|      1|    }
 3912|       |
 3913|       |    /*
 3914|       |     * Check the msgMaxSize we received is a legal value.  If not, then
 3915|       |     * increment snmpInASNParseErrs and return the appropriate error (see RFC
 3916|       |     * 2572, para. 7.2, section 2 -- note that a bad msgMaxSize means that the
 3917|       |     * received message is NOT a serialization of an SNMPv3Message, since the
 3918|       |     * msgMaxSize field is out of bounds).
 3919|       |     */
 3920|       |
 3921|     13|    if (pdu->msgMaxSize < SNMP_MIN_MAX_LEN) {
  ------------------
  |  |   48|     13|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (3921:9): [True: 2, False: 11]
  ------------------
 3922|      2|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu < 484).\n",
 3923|      2|                 pdu->msgMaxSize);
 3924|      2|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      2|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3925|      2|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      2|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 2]
  |  |  ------------------
  ------------------
 3926|      2|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      2|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3927|     11|    } else if (pdu->msgMaxSize > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|     11|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3927:16): [True: 0, False: 11]
  ------------------
 3928|      0|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu > 2^31 - 1).\n",
 3929|      0|                 pdu->msgMaxSize);
 3930|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3931|      0|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3932|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3933|     11|    } else {
 3934|     11|        DEBUGMSGTL(("snmpv3_parse:msgMaxSize", "msgMaxSize %lu received\n",
  ------------------
  |  |   66|     11|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     11|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 11]
  |  |  ------------------
  ------------------
 3935|     11|                    pdu->msgMaxSize));
 3936|       |        /** don't increase max msg size if we've already got one */
 3937|     11|        if (sess->sndMsgMaxSize < pdu->msgMaxSize) {
  ------------------
  |  Branch (3937:13): [True: 11, False: 0]
  ------------------
 3938|     11|            DEBUGMSGTL(("snmpv3_parse:msgMaxSize",
  ------------------
  |  |   66|     11|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     11|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 11]
  |  |  ------------------
  ------------------
 3939|     11|                        "msgMaxSize %" NETSNMP_PRIz "d greater than session max %ld; reducing\n",
 3940|     11|                        sess->sndMsgMaxSize, pdu->msgMaxSize));
 3941|     11|            pdu->msgMaxSize = sess->sndMsgMaxSize;
 3942|     11|        }
 3943|     11|    }
 3944|       |
 3945|       |    /*
 3946|       |     * msgFlags 
 3947|       |     */
 3948|     11|    tmp_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  142|     11|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 3949|     11|    DEBUGDUMPHEADER("recv", "msgFlags");
  ------------------
  |  |   79|     11|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     11|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 11]
  |  |  ------------------
  ------------------
 3950|     11|    data = asn_parse_string(data, length, &type, tmp_buf, &tmp_buf_len);
 3951|     11|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     11|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     11|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 11]
  |  |  ------------------
  ------------------
 3952|     11|    if (data == NULL || type != ASN_OCTET_STR || tmp_buf_len != 1) {
  ------------------
  |  |   78|     20|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (3952:9): [True: 2, False: 9]
  |  Branch (3952:25): [True: 1, False: 8]
  |  Branch (3952:50): [True: 0, False: 8]
  ------------------
 3953|      3|        ERROR_MSG("error parsing msgFlags");
  ------------------
  |  |  188|      3|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3954|      3|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      3|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3955|      3|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      3|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3956|      3|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      3|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3957|      3|    }
 3958|      8|    msg_flags = *tmp_buf;
 3959|      8|    if (msg_flags & SNMP_MSG_FLAG_RPRT_BIT)
  ------------------
  |  |  305|      8|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3959:9): [True: 7, False: 1]
  ------------------
 3960|      7|        pdu->flags |= SNMP_MSG_FLAG_RPRT_BIT;
  ------------------
  |  |  305|      7|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 3961|      1|    else
 3962|      1|        pdu->flags &= (~SNMP_MSG_FLAG_RPRT_BIT);
  ------------------
  |  |  305|      1|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 3963|       |
 3964|       |    /*
 3965|       |     * msgSecurityModel 
 3966|       |     */
 3967|      8|    DEBUGDUMPHEADER("recv", "msgSecurityModel");
  ------------------
  |  |   79|      8|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      8|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 8]
  |  |  ------------------
  ------------------
 3968|      8|    data = asn_parse_int(data, length, &type, &msg_sec_model,
 3969|      8|                         sizeof(msg_sec_model));
 3970|      8|    DEBUGINDENTADD(-4);         /* return from global data indent */
  ------------------
  |  |   73|      8|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      8|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 8]
  |  |  ------------------
  ------------------
 3971|      8|    if (data == NULL || type != ASN_INTEGER ||
  ------------------
  |  |   75|     16|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3971:9): [True: 0, False: 8]
  |  Branch (3971:25): [True: 0, False: 8]
  ------------------
 3972|      8|        msg_sec_model < 1 || msg_sec_model > 0x7fffffff) {
  ------------------
  |  Branch (3972:9): [True: 2, False: 6]
  |  Branch (3972:30): [True: 0, False: 6]
  ------------------
 3973|      2|        ERROR_MSG("error parsing msgSecurityModel");
  ------------------
  |  |  188|      2|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3974|      2|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      2|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3975|      2|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      2|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 2]
  |  |  ------------------
  ------------------
 3976|      2|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      2|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3977|      2|    }
 3978|      6|    sptr = find_sec_mod(msg_sec_model);
 3979|      6|    if (!sptr) {
  ------------------
  |  Branch (3979:9): [True: 0, False: 6]
  ------------------
 3980|      0|        snmp_log(LOG_WARNING, "unknown security model: %ld\n",
 3981|      0|                 msg_sec_model);
 3982|      0|        snmp_increment_statistic(STAT_SNMPUNKNOWNSECURITYMODELS);
  ------------------
  |  |  644|      0|#define   STAT_SNMPUNKNOWNSECURITYMODELS     0
  ------------------
 3983|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3984|      0|        return SNMPERR_UNKNOWN_SEC_MODEL;
  ------------------
  |  |  247|      0|#define SNMPERR_UNKNOWN_SEC_MODEL 	(-30)
  ------------------
 3985|      0|    }
 3986|      6|    pdu->securityModel = msg_sec_model;
 3987|       |
 3988|      6|    if (msg_flags & SNMP_MSG_FLAG_PRIV_BIT &&
  ------------------
  |  |  304|     12|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (3988:9): [True: 1, False: 5]
  ------------------
 3989|      1|        !(msg_flags & SNMP_MSG_FLAG_AUTH_BIT)) {
  ------------------
  |  |  303|      1|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (3989:9): [True: 0, False: 1]
  ------------------
 3990|      0|        ERROR_MSG("invalid message, illegal msgFlags");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3991|      0|        snmp_increment_statistic(STAT_SNMPINVALIDMSGS);
  ------------------
  |  |  645|      0|#define   STAT_SNMPINVALIDMSGS               1
  ------------------
 3992|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3993|      0|        return SNMPERR_INVALID_MSG;
  ------------------
  |  |  248|      0|#define SNMPERR_INVALID_MSG             (-31)
  ------------------
 3994|      0|    }
 3995|      6|    pdu->securityLevel = ((msg_flags & SNMP_MSG_FLAG_AUTH_BIT)
  ------------------
  |  |  303|      6|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (3995:27): [True: 6, False: 0]
  ------------------
 3996|      6|                          ? ((msg_flags & SNMP_MSG_FLAG_PRIV_BIT)
  ------------------
  |  |  304|      6|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (3996:30): [True: 1, False: 5]
  ------------------
 3997|      6|                             ? SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|      1|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
 3998|      6|                             : SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|      5|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
 3999|      6|                          : SNMP_SEC_LEVEL_NOAUTH);
  ------------------
  |  |  299|      0|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4000|       |    /*
 4001|       |     * end of msgGlobalData 
 4002|       |     */
 4003|       |
 4004|       |    /*
 4005|       |     * securtityParameters OCTET STRING begins after msgGlobalData 
 4006|       |     */
 4007|      6|    sec_params = data;
 4008|      6|    pdu->contextEngineID = calloc(1, SNMP_MAX_ENG_SIZE);
  ------------------
  |  |  144|      6|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4009|      6|    pdu->contextEngineIDLen = SNMP_MAX_ENG_SIZE;
  ------------------
  |  |  144|      6|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4010|       |
 4011|       |    /*
 4012|       |     * Note: there is no length limit on the msgAuthoritativeEngineID field,
 4013|       |     * although we would EXPECT it to be limited to 32 (the SnmpEngineID TC
 4014|       |     * limit).  We'll use double that here to be on the safe side.  
 4015|       |     */
 4016|       |
 4017|      6|    pdu->securityEngineID = calloc(1, SNMP_MAX_ENG_SIZE * 2);
  ------------------
  |  |  144|      6|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4018|      6|    pdu->securityEngineIDLen = SNMP_MAX_ENG_SIZE * 2;
  ------------------
  |  |  144|      6|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4019|      6|    pdu->securityName = calloc(1, SNMP_MAX_SEC_NAME_SIZE);
  ------------------
  |  |  145|      6|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 4020|      6|    pdu->securityNameLen = SNMP_MAX_SEC_NAME_SIZE;
  ------------------
  |  |  145|      6|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 4021|       |
 4022|      6|    if ((pdu->securityName == NULL) ||
  ------------------
  |  Branch (4022:9): [True: 0, False: 6]
  ------------------
 4023|      6|        (pdu->securityEngineID == NULL) ||
  ------------------
  |  Branch (4023:9): [True: 0, False: 6]
  ------------------
 4024|      6|        (pdu->contextEngineID == NULL)) {
  ------------------
  |  Branch (4024:9): [True: 0, False: 6]
  ------------------
 4025|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4026|      0|    }
 4027|       |
 4028|      6|    if (pdu_buf_len < msg_len
  ------------------
  |  Branch (4028:9): [True: 4, False: 2]
  ------------------
 4029|      4|        && pdu->securityLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      4|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (4029:12): [True: 0, False: 4]
  ------------------
 4030|       |        /*
 4031|       |         * space needed is larger than we have in the default buffer 
 4032|       |         */
 4033|      0|        mallocbuf = calloc(1, msg_len);
 4034|      0|        pdu_buf_len = msg_len;
 4035|      0|        cp = mallocbuf;
 4036|      6|    } else {
 4037|      6|        memset(pdu_buf, 0, pdu_buf_len);
 4038|      6|        cp = pdu_buf;
 4039|      6|    }
 4040|       |
 4041|      6|    DEBUGDUMPSECTION("recv", "SM msgSecurityParameters");
  ------------------
  |  |   81|      6|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      6|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 6]
  |  |  ------------------
  ------------------
 4042|      6|    if (sptr->decode) {
  ------------------
  |  Branch (4042:9): [True: 6, False: 0]
  ------------------
 4043|      6|        struct snmp_secmod_incoming_params parms;
 4044|      6|        parms.msgProcModel = pdu->msgParseModel;
 4045|      6|        parms.maxMsgSize = pdu->msgMaxSize;
 4046|      6|        parms.secParams = sec_params;
 4047|      6|        parms.secModel = msg_sec_model;
 4048|      6|        parms.secLevel = pdu->securityLevel;
 4049|      6|        parms.wholeMsg = msg_data;
 4050|      6|        parms.wholeMsgLen = msg_len;
 4051|      6|        parms.secEngineID = pdu->securityEngineID;
 4052|      6|        parms.secEngineIDLen = &pdu->securityEngineIDLen;
 4053|      6|        parms.secName = pdu->securityName;
 4054|      6|        parms.secNameLen = &pdu->securityNameLen;
 4055|      6|        parms.scopedPdu = &cp;
 4056|      6|        parms.scopedPduLen = &pdu_buf_len;
 4057|      6|        parms.maxSizeResponse = &max_size_response;
 4058|      6|        parms.secStateRef = &pdu->securityStateRef;
 4059|      6|        parms.sess = sess;
 4060|      6|        parms.pdu = pdu;
 4061|      6|        parms.msg_flags = msg_flags;
 4062|      6|        ret_val = (*sptr->decode) (&parms);
 4063|      6|    } else {
 4064|      0|        SNMP_FREE(mallocbuf);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 4065|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4066|      0|        snmp_log(LOG_WARNING, "security service %ld can't decode packets\n",
 4067|      0|                 msg_sec_model);
 4068|      0|        return (-1);
 4069|      0|    }
 4070|       |
 4071|      6|    if (ret_val != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|      6|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (4071:9): [True: 6, False: 0]
  ------------------
 4072|      6|        DEBUGDUMPSECTION("recv", "ScopedPDU");
  ------------------
  |  |   81|      6|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      6|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 6]
  |  |  ------------------
  ------------------
 4073|       |        /*
 4074|       |         * Parse as much as possible -- though I don't see the point? [jbpn].  
 4075|       |         */
 4076|      6|        if (cp) {
  ------------------
  |  Branch (4076:13): [True: 6, False: 0]
  ------------------
 4077|      6|            cp = snmpv3_scopedPDU_parse(pdu, cp, &pdu_buf_len);
 4078|      6|        }
 4079|      6|        if (cp) {
  ------------------
  |  Branch (4079:13): [True: 1, False: 5]
  ------------------
 4080|      1|            DEBUGPRINTPDUTYPE("recv", *cp);
  ------------------
  |  |  418|      1|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   81|      1|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (81:56): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4081|      1|            snmp_pdu_parse(pdu, cp, &pdu_buf_len);
 4082|      1|            DEBUGINDENTADD(-8);
  ------------------
  |  |   73|      1|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 1]
  |  |  ------------------
  ------------------
 4083|      5|        } else {
 4084|      5|            DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      5|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      5|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 5]
  |  |  ------------------
  ------------------
 4085|      5|        }
 4086|       |
 4087|      6|        SNMP_FREE(mallocbuf);
  ------------------
  |  |   62|      6|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 6]
  |  |  |  Branch (62:66): [Folded, False: 6]
  |  |  ------------------
  ------------------
 4088|      6|        return ret_val;
 4089|      6|    }
 4090|       |
 4091|       |    /*
 4092|       |     * parse plaintext ScopedPDU sequence 
 4093|       |     */
 4094|      0|    *length = pdu_buf_len;
 4095|      0|    DEBUGDUMPSECTION("recv", "ScopedPDU");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4096|      0|    data = snmpv3_scopedPDU_parse(pdu, cp, length);
 4097|      0|    if (data == NULL) {
  ------------------
  |  Branch (4097:9): [True: 0, False: 0]
  ------------------
 4098|      0|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4099|      0|                 msg_sec_model);
 4100|      0|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4101|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4102|      0|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4103|      0|        SNMP_FREE(mallocbuf);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 4104|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4105|      0|    }
 4106|       |
 4107|       |    /*
 4108|       |     * parse the PDU.  
 4109|       |     */
 4110|      0|    if (after_header != NULL) {
  ------------------
  |  Branch (4110:9): [True: 0, False: 0]
  ------------------
 4111|      0|        *after_header = data;
 4112|      0|        tmp_buf_len = *length;
 4113|      0|    }
 4114|       |
 4115|      0|    DEBUGPRINTPDUTYPE("recv", *data);
  ------------------
  |  |  418|      0|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4116|      0|    ret = snmp_pdu_parse(pdu, data, length);
 4117|      0|    DEBUGINDENTADD(-8);
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4118|       |
 4119|      0|    if (after_header != NULL) {
  ------------------
  |  Branch (4119:9): [True: 0, False: 0]
  ------------------
 4120|      0|        *length = tmp_buf_len;
 4121|      0|    }
 4122|       |
 4123|      0|    if (ret != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (4123:9): [True: 0, False: 0]
  ------------------
 4124|      0|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4125|      0|                 msg_sec_model);
 4126|      0|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4127|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4128|      0|        SNMP_FREE(mallocbuf);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 4129|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4130|      0|    }
 4131|       |
 4132|      0|    SNMP_FREE(mallocbuf);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 4133|      0|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4134|      0|}                               /* end snmpv3_parse() */
snmpv3_make_report:
 4165|      3|{
 4166|       |
 4167|      3|    long            ltmp;
 4168|      3|    static const oid unknownSecurityLevel[] =
 4169|      3|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 1, 0 };
 4170|      3|    static const oid notInTimeWindow[] =
 4171|      3|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 2, 0 };
 4172|      3|    static const oid unknownUserName[] =
 4173|      3|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 3, 0 };
 4174|      3|    static const oid unknownEngineID[] =
 4175|      3|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 4, 0 };
 4176|      3|    static const oid wrongDigest[] = { 1, 3, 6, 1, 6, 3, 15, 1, 1, 5, 0 };
 4177|      3|    static const oid decryptionError[] =
 4178|      3|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 6, 0 };
 4179|      3|    const oid      *err_var;
 4180|      3|    int             err_var_len;
 4181|      3|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4182|      3|    int             stat_ind;
 4183|      3|#endif
 4184|       |
 4185|      3|    switch (error) {
 4186|      3|    case SNMPERR_USM_UNKNOWNENGINEID:
  ------------------
  |  |  265|      3|#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
  ------------------
  |  Branch (4186:5): [True: 3, False: 0]
  ------------------
 4187|      3|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4188|      3|        stat_ind = STAT_USMSTATSUNKNOWNENGINEIDS;
  ------------------
  |  |  656|      3|#define   STAT_USMSTATSUNKNOWNENGINEIDS      6
  ------------------
 4189|      3|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4190|      3|        err_var = unknownEngineID;
 4191|      3|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4161|      3|#define ERROR_STAT_LENGTH 11
  ------------------
 4192|      3|        break;
 4193|      0|    case SNMPERR_USM_UNKNOWNSECURITYNAME:
  ------------------
  |  |  260|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (4193:5): [True: 0, False: 3]
  ------------------
 4194|      0|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4195|      0|        stat_ind = STAT_USMSTATSUNKNOWNUSERNAMES;
  ------------------
  |  |  655|      0|#define   STAT_USMSTATSUNKNOWNUSERNAMES      5
  ------------------
 4196|      0|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4197|      0|        err_var = unknownUserName;
 4198|      0|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4161|      0|#define ERROR_STAT_LENGTH 11
  ------------------
 4199|      0|        break;
 4200|      0|    case SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL:
  ------------------
  |  |  261|      0|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
  |  Branch (4200:5): [True: 0, False: 3]
  ------------------
 4201|      0|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4202|      0|        stat_ind = STAT_USMSTATSUNSUPPORTEDSECLEVELS;
  ------------------
  |  |  653|      0|#define   STAT_USMSTATSUNSUPPORTEDSECLEVELS  3
  ------------------
 4203|      0|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4204|      0|        err_var = unknownSecurityLevel;
 4205|      0|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4161|      0|#define ERROR_STAT_LENGTH 11
  ------------------
 4206|      0|        break;
 4207|      0|    case SNMPERR_USM_AUTHENTICATIONFAILURE:
  ------------------
  |  |  263|      0|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
  |  Branch (4207:5): [True: 0, False: 3]
  ------------------
 4208|      0|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4209|      0|        stat_ind = STAT_USMSTATSWRONGDIGESTS;
  ------------------
  |  |  657|      0|#define   STAT_USMSTATSWRONGDIGESTS          7
  ------------------
 4210|      0|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4211|      0|        err_var = wrongDigest;
 4212|      0|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4161|      0|#define ERROR_STAT_LENGTH 11
  ------------------
 4213|      0|        break;
 4214|      0|    case SNMPERR_USM_NOTINTIMEWINDOW:
  ------------------
  |  |  266|      0|#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
  ------------------
  |  Branch (4214:5): [True: 0, False: 3]
  ------------------
 4215|      0|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4216|      0|        stat_ind = STAT_USMSTATSNOTINTIMEWINDOWS;
  ------------------
  |  |  654|      0|#define   STAT_USMSTATSNOTINTIMEWINDOWS      4
  ------------------
 4217|      0|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4218|      0|        err_var = notInTimeWindow;
 4219|      0|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4161|      0|#define ERROR_STAT_LENGTH 11
  ------------------
 4220|      0|        break;
 4221|      0|    case SNMPERR_USM_DECRYPTIONERROR:
  ------------------
  |  |  267|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
  |  Branch (4221:5): [True: 0, False: 3]
  ------------------
 4222|      0|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4223|      0|        stat_ind = STAT_USMSTATSDECRYPTIONERRORS;
  ------------------
  |  |  658|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 4224|      0|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4225|      0|        err_var = decryptionError;
 4226|      0|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4161|      0|#define ERROR_STAT_LENGTH 11
  ------------------
 4227|      0|        break;
 4228|      0|    default:
  ------------------
  |  Branch (4228:5): [True: 0, False: 3]
  ------------------
 4229|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 4230|      3|    }
 4231|       |
 4232|      3|    snmp_free_varbind(pdu->variables);  /* free the current varbind */
 4233|       |
 4234|      3|    pdu->variables = NULL;
 4235|      3|    SNMP_FREE(pdu->securityEngineID);
  ------------------
  |  |   62|      3|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 3, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 3]
  |  |  ------------------
  ------------------
 4236|      3|    pdu->securityEngineID =
 4237|      3|        snmpv3_generate_engineID(&pdu->securityEngineIDLen);
 4238|      3|    SNMP_FREE(pdu->contextEngineID);
  ------------------
  |  |   62|      3|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 3, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 3]
  |  |  ------------------
  ------------------
 4239|      3|    pdu->contextEngineID =
 4240|      3|        snmpv3_generate_engineID(&pdu->contextEngineIDLen);
 4241|      3|    pdu->command = SNMP_MSG_REPORT;
  ------------------
  |  |  147|      3|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|      3|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
 4242|      3|    pdu->errstat = 0;
 4243|      3|    pdu->errindex = 0;
 4244|      3|    SNMP_FREE(pdu->contextName);
  ------------------
  |  |   62|      3|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 3]
  |  |  |  Branch (62:66): [Folded, False: 3]
  |  |  ------------------
  ------------------
 4245|      3|    pdu->contextName = strdup("");
 4246|      3|    pdu->contextNameLen = strlen(pdu->contextName);
 4247|       |
 4248|       |    /*
 4249|       |     * reports shouldn't cache previous data. 
 4250|       |     */
 4251|       |    /*
 4252|       |     * FIX - yes they should but USM needs to follow new EoP to determine
 4253|       |     * which cached values to use 
 4254|       |     */
 4255|      3|    free_securityStateRef(pdu);
 4256|       |
 4257|      3|    if (error == SNMPERR_USM_NOTINTIMEWINDOW) {
  ------------------
  |  |  266|      3|#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
  ------------------
  |  Branch (4257:9): [True: 0, False: 3]
  ------------------
 4258|      0|        pdu->securityLevel = SNMP_SEC_LEVEL_AUTHNOPRIV;
  ------------------
  |  |  300|      0|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
 4259|      3|    } else {
 4260|      3|        pdu->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|      3|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4261|      3|    }
 4262|       |
 4263|       |    /*
 4264|       |     * find the appropriate error counter  
 4265|       |     */
 4266|      3|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4267|      3|    ltmp = snmp_get_statistic(stat_ind);
 4268|       |#else /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4269|       |    ltmp = 1;
 4270|       |#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4271|       |
 4272|       |    /*
 4273|       |     * return the appropriate error counter  
 4274|       |     */
 4275|      3|    snmp_pdu_add_variable(pdu, err_var, err_var_len,
 4276|      3|                          ASN_COUNTER, & ltmp, sizeof(ltmp));
  ------------------
  |  |   89|      3|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|      3|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
 4277|       |
 4278|      3|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      3|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4279|      3|}                               /* end snmpv3_make_report() */
snmp_parse:
 4659|     65|{
 4660|     65|    int             rc;
 4661|       |
 4662|     65|    rc = _snmp_parse(slp, pss, pdu, data, length);
 4663|     65|    if (rc) {
  ------------------
  |  Branch (4663:9): [True: 65, False: 0]
  ------------------
 4664|     65|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (4664:13): [True: 18, False: 47]
  ------------------
 4665|     18|            pss->s_snmp_errno = SNMPERR_BAD_PARSE;
  ------------------
  |  |  230|     18|#define SNMPERR_BAD_PARSE		(-13)
  ------------------
 4666|     18|        }
 4667|     65|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   56|     65|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 4668|     65|    }
 4669|       |
 4670|     65|    return rc;
 4671|     65|}
snmp_pdu_parse:
 4675|      4|{
 4676|      4|    u_char          type;
 4677|      4|    u_char          msg_type;
 4678|      4|    u_char         *var_val;
 4679|      4|    size_t          len;
 4680|      4|    size_t          four;
 4681|      4|    netsnmp_variable_list *vp = NULL, *vplast = NULL;
 4682|      4|    oid             objid[MAX_OID_LEN];
 4683|      4|    u_char         *p;
 4684|       |
 4685|       |    /*
 4686|       |     * Get the PDU type 
 4687|       |     */
 4688|      4|    data = asn_parse_header(data, length, &msg_type);
 4689|      4|    if (data == NULL)
  ------------------
  |  Branch (4689:9): [True: 0, False: 4]
  ------------------
 4690|      0|        return -1;
 4691|      4|    DEBUGMSGTL(("dumpv_recv","    Command %s\n", snmp_pdu_type(msg_type)));
  ------------------
  |  |   66|      4|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 4]
  |  |  ------------------
  ------------------
 4692|      4|    pdu->command = msg_type;
 4693|      4|    pdu->flags &= (~UCD_MSG_FLAG_RESPONSE_PDU);
  ------------------
  |  |  311|      4|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4694|       |
 4695|       |    /*
 4696|       |     * get the fields in the PDU preceding the variable-bindings sequence
 4697|       |     */
 4698|      4|    switch (pdu->command) {
 4699|      4|    case SNMP_MSG_TRAP:
  ------------------
  |  |  135|      4|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4699:5): [True: 4, False: 0]
  ------------------
 4700|       |        /*
 4701|       |         * enterprise 
 4702|       |         */
 4703|      4|        pdu->enterprise_length = MAX_OID_LEN;
  ------------------
  |  |  106|      4|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4704|      4|        data = asn_parse_objid(data, length, &type, objid,
 4705|      4|                               &pdu->enterprise_length);
 4706|      4|        if (data == NULL)
  ------------------
  |  Branch (4706:13): [True: 0, False: 4]
  ------------------
 4707|      0|            return -1;
 4708|      4|        pdu->enterprise = netsnmp_memdup(objid,
 4709|      4|                                         pdu->enterprise_length * sizeof(oid));
 4710|      4|        if (pdu->enterprise == NULL) {
  ------------------
  |  Branch (4710:13): [True: 0, False: 4]
  ------------------
 4711|      0|            return -1;
 4712|      0|        }
 4713|       |
 4714|       |        /*
 4715|       |         * agent-addr 
 4716|       |         */
 4717|      4|        four = 4;
 4718|      4|        data = asn_parse_string(data, length, &type,
 4719|      4|                                (u_char *) pdu->agent_addr, &four);
 4720|      4|        if (data == NULL)
  ------------------
  |  Branch (4720:13): [True: 0, False: 4]
  ------------------
 4721|      0|            return -1;
 4722|       |
 4723|       |        /*
 4724|       |         * generic trap 
 4725|       |         */
 4726|      4|        data = asn_parse_int(data, length, &type, (long *) &pdu->trap_type,
 4727|      4|                             sizeof(pdu->trap_type));
 4728|      4|        if (data == NULL)
  ------------------
  |  Branch (4728:13): [True: 1, False: 3]
  ------------------
 4729|      1|            return -1;
 4730|       |        /*
 4731|       |         * specific trap 
 4732|       |         */
 4733|      3|        data =
 4734|      3|            asn_parse_int(data, length, &type,
 4735|      3|                          (long *) &pdu->specific_type,
 4736|      3|                          sizeof(pdu->specific_type));
 4737|      3|        if (data == NULL)
  ------------------
  |  Branch (4737:13): [True: 0, False: 3]
  ------------------
 4738|      0|            return -1;
 4739|       |
 4740|       |        /*
 4741|       |         * timestamp  
 4742|       |         */
 4743|      3|        data = asn_parse_unsigned_int(data, length, &type, &pdu->time,
 4744|      3|                                      sizeof(pdu->time));
 4745|      3|        if (data == NULL)
  ------------------
  |  Branch (4745:13): [True: 1, False: 2]
  ------------------
 4746|      1|            return -1;
 4747|       |
 4748|      2|        break;
 4749|       |
 4750|      2|    case SNMP_MSG_RESPONSE:
  ------------------
  |  |  127|      0|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4750:5): [True: 0, False: 4]
  ------------------
 4751|      0|    case SNMP_MSG_REPORT:
  ------------------
  |  |  147|      0|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4751:5): [True: 0, False: 4]
  ------------------
 4752|      0|        pdu->flags |= UCD_MSG_FLAG_RESPONSE_PDU;
  ------------------
  |  |  311|      0|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4753|      0|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4754|       |
 4755|      0|    case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|      0|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4755:5): [True: 0, False: 4]
  ------------------
 4756|      0|    case SNMP_MSG_INFORM:
  ------------------
  |  |  141|      0|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4756:5): [True: 0, False: 4]
  ------------------
 4757|      0|#ifndef NETSNMP_NOTIFY_ONLY
 4758|      0|    case SNMP_MSG_GET:
  ------------------
  |  |  125|      0|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4758:5): [True: 0, False: 4]
  ------------------
 4759|      0|    case SNMP_MSG_GETNEXT:
  ------------------
  |  |  126|      0|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4759:5): [True: 0, False: 4]
  ------------------
 4760|      0|    case SNMP_MSG_GETBULK:
  ------------------
  |  |  140|      0|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4760:5): [True: 0, False: 4]
  ------------------
 4761|      0|#endif /* ! NETSNMP_NOTIFY_ONLY */
 4762|      0|#ifndef NETSNMP_NO_WRITE_SUPPORT
 4763|      0|    case SNMP_MSG_SET:
  ------------------
  |  |  129|      0|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4763:5): [True: 0, False: 4]
  ------------------
 4764|      0|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 4765|       |        /*
 4766|       |         * PDU is not an SNMPv1 TRAP 
 4767|       |         */
 4768|       |
 4769|       |        /*
 4770|       |         * request id 
 4771|       |         */
 4772|      0|        DEBUGDUMPHEADER("recv", "request_id");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4773|      0|        data = asn_parse_int(data, length, &type, &pdu->reqid,
 4774|      0|                             sizeof(pdu->reqid));
 4775|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4776|      0|        if (data == NULL) {
  ------------------
  |  Branch (4776:13): [True: 0, False: 0]
  ------------------
 4777|      0|            return -1;
 4778|      0|        }
 4779|       |
 4780|       |        /*
 4781|       |         * error status (getbulk non-repeaters) 
 4782|       |         */
 4783|      0|        DEBUGDUMPHEADER("recv", "error status");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4784|      0|        data = asn_parse_int(data, length, &type, &pdu->errstat,
 4785|      0|                             sizeof(pdu->errstat));
 4786|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4787|      0|        if (data == NULL) {
  ------------------
  |  Branch (4787:13): [True: 0, False: 0]
  ------------------
 4788|      0|            return -1;
 4789|      0|        }
 4790|       |
 4791|       |        /*
 4792|       |         * error index (getbulk max-repetitions) 
 4793|       |         */
 4794|      0|        DEBUGDUMPHEADER("recv", "error index");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4795|      0|        data = asn_parse_int(data, length, &type, &pdu->errindex,
 4796|      0|                             sizeof(pdu->errindex));
 4797|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4798|      0|        if (data == NULL) {
  ------------------
  |  Branch (4798:13): [True: 0, False: 0]
  ------------------
 4799|      0|            return -1;
 4800|      0|        }
 4801|      0|	break;
 4802|       |
 4803|      0|    default:
  ------------------
  |  Branch (4803:5): [True: 0, False: 4]
  ------------------
 4804|      0|        snmp_log(LOG_ERR, "Bad PDU type received: 0x%.2x\n", pdu->command);
 4805|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4806|      0|        return -1;
 4807|      4|    }
 4808|       |
 4809|       |    /*
 4810|       |     * get header for variable-bindings sequence 
 4811|       |     */
 4812|      2|    DEBUGDUMPSECTION("recv", "VarBindList");
  ------------------
  |  |   81|      2|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 2]
  |  |  ------------------
  ------------------
 4813|      2|    data = asn_parse_sequence(data, length, &type,
 4814|      2|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|      2|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      2|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 4815|      2|                              "varbinds");
 4816|      2|    if (data == NULL)
  ------------------
  |  Branch (4816:9): [True: 2, False: 0]
  ------------------
 4817|      2|        goto fail;
 4818|       |
 4819|       |    /*
 4820|       |     * get each varBind sequence 
 4821|       |     */
 4822|      0|    while ((int) *length > 0) {
  ------------------
  |  Branch (4822:12): [True: 0, False: 0]
  ------------------
 4823|      0|        vp = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
  ------------------
  |  |   73|      0|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 4824|      0|        if (NULL == vp)
  ------------------
  |  Branch (4824:13): [True: 0, False: 0]
  ------------------
 4825|      0|            goto fail;
 4826|       |
 4827|      0|        vp->name_length = MAX_OID_LEN;
  ------------------
  |  |  106|      0|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4828|      0|        DEBUGDUMPSECTION("recv", "VarBind");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4829|      0|        data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type,
 4830|      0|                                 &vp->val_len, &var_val, length);
 4831|      0|        if (data == NULL)
  ------------------
  |  Branch (4831:13): [True: 0, False: 0]
  ------------------
 4832|      0|            goto fail;
 4833|      0|        if (snmp_set_var_objid(vp, objid, vp->name_length))
  ------------------
  |  Branch (4833:13): [True: 0, False: 0]
  ------------------
 4834|      0|            goto fail;
 4835|       |
 4836|      0|        len = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
 4837|      0|        DEBUGDUMPHEADER("recv", "Value");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4838|      0|        switch ((short) vp->type) {
 4839|      0|        case ASN_INTEGER:
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4839:9): [True: 0, False: 0]
  ------------------
 4840|      0|            vp->val.integer = (long *) vp->buf;
 4841|      0|            vp->val_len = sizeof(long);
 4842|      0|            p = asn_parse_int(var_val, &len, &vp->type,
 4843|      0|                          (long *) vp->val.integer,
 4844|      0|                          sizeof(*vp->val.integer));
 4845|      0|            if (!p)
  ------------------
  |  Branch (4845:17): [True: 0, False: 0]
  ------------------
 4846|      0|                goto fail;
 4847|      0|            break;
 4848|      0|        case ASN_COUNTER:
  ------------------
  |  |   89|      0|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4848:9): [True: 0, False: 0]
  ------------------
 4849|      0|        case ASN_GAUGE:
  ------------------
  |  |   90|      0|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4849:9): [True: 0, False: 0]
  ------------------
 4850|      0|        case ASN_TIMETICKS:
  ------------------
  |  |   92|      0|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4850:9): [True: 0, False: 0]
  ------------------
 4851|      0|        case ASN_UINTEGER:
  ------------------
  |  |  100|      0|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4851:9): [True: 0, False: 0]
  ------------------
 4852|      0|            vp->val.integer = (long *) vp->buf;
 4853|      0|            vp->val_len = sizeof(u_long);
 4854|      0|            p = asn_parse_unsigned_int(var_val, &len, &vp->type,
 4855|      0|                                   (u_long *) vp->val.integer,
 4856|      0|                                   vp->val_len);
 4857|      0|            if (!p)
  ------------------
  |  Branch (4857:17): [True: 0, False: 0]
  ------------------
 4858|      0|                goto fail;
 4859|      0|            break;
 4860|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4861|      0|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|      0|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|      0|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4861:9): [True: 0, False: 0]
  ------------------
 4862|      0|        case ASN_OPAQUE_U64:
  ------------------
  |  |  192|      0|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|      0|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4862:9): [True: 0, False: 0]
  ------------------
 4863|      0|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4864|      0|        case ASN_COUNTER64:
  ------------------
  |  |   99|      0|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4864:9): [True: 0, False: 0]
  ------------------
 4865|      0|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4866|      0|            vp->val_len = sizeof(struct counter64);
 4867|      0|            p = asn_parse_unsigned_int64(var_val, &len, &vp->type,
 4868|      0|                                     (struct counter64 *) vp->val.
 4869|      0|                                     counter64, vp->val_len);
 4870|      0|            if (!p)
  ------------------
  |  Branch (4870:17): [True: 0, False: 0]
  ------------------
 4871|      0|                goto fail;
 4872|      0|            break;
 4873|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4874|      0|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|      0|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|      0|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4874:9): [True: 0, False: 0]
  ------------------
 4875|      0|            vp->val.floatVal = (float *) vp->buf;
 4876|      0|            vp->val_len = sizeof(float);
 4877|      0|            p = asn_parse_float(var_val, &len, &vp->type,
 4878|      0|                            vp->val.floatVal, vp->val_len);
 4879|      0|            if (!p)
  ------------------
  |  Branch (4879:17): [True: 0, False: 0]
  ------------------
 4880|      0|                goto fail;
 4881|      0|            break;
 4882|      0|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|      0|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|      0|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4882:9): [True: 0, False: 0]
  ------------------
 4883|      0|            vp->val.doubleVal = (double *) vp->buf;
 4884|      0|            vp->val_len = sizeof(double);
 4885|      0|            p = asn_parse_double(var_val, &len, &vp->type,
 4886|      0|                             vp->val.doubleVal, vp->val_len);
 4887|      0|            if (!p)
  ------------------
  |  Branch (4887:17): [True: 0, False: 0]
  ------------------
 4888|      0|                goto fail;
 4889|      0|            break;
 4890|      0|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|      0|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|      0|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4890:9): [True: 0, False: 0]
  ------------------
 4891|      0|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4892|      0|            vp->val_len = sizeof(struct counter64);
 4893|      0|            p = asn_parse_signed_int64(var_val, &len, &vp->type,
 4894|      0|                                   (struct counter64 *) vp->val.counter64,
 4895|      0|                                   sizeof(*vp->val.counter64));
 4896|       |
 4897|      0|            if (!p)
  ------------------
  |  Branch (4897:17): [True: 0, False: 0]
  ------------------
 4898|      0|                goto fail;
 4899|      0|            break;
 4900|      0|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4901|      0|        case ASN_IPADDRESS:
  ------------------
  |  |   88|      0|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4901:9): [True: 0, False: 0]
  ------------------
 4902|      0|            if (vp->val_len != 4)
  ------------------
  |  Branch (4902:17): [True: 0, False: 0]
  ------------------
 4903|      0|                goto fail;
 4904|      0|            NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4905|      0|        case ASN_OCTET_STR:
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (4905:9): [True: 0, False: 0]
  ------------------
 4906|      0|        case ASN_OPAQUE:
  ------------------
  |  |   93|      0|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4906:9): [True: 0, False: 0]
  ------------------
 4907|      0|        case ASN_NSAP:
  ------------------
  |  |   98|      0|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4907:9): [True: 0, False: 0]
  ------------------
 4908|      0|            if (vp->val_len < sizeof(vp->buf)) {
  ------------------
  |  Branch (4908:17): [True: 0, False: 0]
  ------------------
 4909|      0|                vp->val.string = (u_char *) vp->buf;
 4910|      0|            } else {
 4911|      0|                vp->val.string = (u_char *) malloc(vp->val_len);
 4912|      0|            }
 4913|      0|            if (vp->val.string == NULL) {
  ------------------
  |  Branch (4913:17): [True: 0, False: 0]
  ------------------
 4914|      0|                goto fail;
 4915|      0|            }
 4916|      0|            p = asn_parse_string(var_val, &len, &vp->type, vp->val.string,
 4917|      0|                             &vp->val_len);
 4918|      0|            if (!p)
  ------------------
  |  Branch (4918:17): [True: 0, False: 0]
  ------------------
 4919|      0|                goto fail;
 4920|      0|            break;
 4921|      0|        case ASN_OBJECT_ID:
  ------------------
  |  |   81|      0|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (4921:9): [True: 0, False: 0]
  ------------------
 4922|      0|            vp->val_len = MAX_OID_LEN;
  ------------------
  |  |  106|      0|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4923|      0|            p = asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len);
 4924|      0|            if (!p)
  ------------------
  |  Branch (4924:17): [True: 0, False: 0]
  ------------------
 4925|      0|                goto fail;
 4926|      0|            vp->val_len *= sizeof(oid);
 4927|      0|            vp->val.objid = netsnmp_memdup(objid, vp->val_len);
 4928|      0|            if (vp->val.objid == NULL)
  ------------------
  |  Branch (4928:17): [True: 0, False: 0]
  ------------------
 4929|      0|                goto fail;
 4930|      0|            break;
 4931|      0|        case SNMP_NOSUCHOBJECT:
  ------------------
  |  |  201|      0|#define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4931:9): [True: 0, False: 0]
  ------------------
 4932|      0|        case SNMP_NOSUCHINSTANCE:
  ------------------
  |  |  202|      0|#define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4932:9): [True: 0, False: 0]
  ------------------
 4933|      0|        case SNMP_ENDOFMIBVIEW:
  ------------------
  |  |  203|      0|#define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4933:9): [True: 0, False: 0]
  ------------------
 4934|      0|        case ASN_NULL:
  ------------------
  |  |   79|      0|#define ASN_NULL	    0x05U
  ------------------
  |  Branch (4934:9): [True: 0, False: 0]
  ------------------
 4935|      0|            break;
 4936|      0|        case ASN_BIT_STR:
  ------------------
  |  |   77|      0|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (4936:9): [True: 0, False: 0]
  ------------------
 4937|      0|            vp->val.bitstring = (u_char *) malloc(vp->val_len);
 4938|      0|            if (vp->val.bitstring == NULL) {
  ------------------
  |  Branch (4938:17): [True: 0, False: 0]
  ------------------
 4939|      0|                goto fail;
 4940|      0|            }
 4941|      0|            p = asn_parse_bitstring(var_val, &len, &vp->type,
 4942|      0|                                vp->val.bitstring, &vp->val_len);
 4943|      0|            if (!p)
  ------------------
  |  Branch (4943:17): [True: 0, False: 0]
  ------------------
 4944|      0|                goto fail;
 4945|      0|            break;
 4946|      0|        default:
  ------------------
  |  Branch (4946:9): [True: 0, False: 0]
  ------------------
 4947|      0|            snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type);
 4948|      0|            goto fail;
 4949|      0|            break;
 4950|      0|        }
 4951|      0|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4952|       |
 4953|      0|        if (NULL == vplast) {
  ------------------
  |  Branch (4953:13): [True: 0, False: 0]
  ------------------
 4954|      0|            pdu->variables = vp;
 4955|      0|        } else {
 4956|      0|            vplast->next_variable = vp;
 4957|      0|        }
 4958|      0|        vplast = vp;
 4959|      0|        vp = NULL;
 4960|      0|    }
 4961|      0|    return 0;
 4962|       |
 4963|      2|  fail:
 4964|      2|    {
 4965|      2|        const char *errstr = snmp_api_errstring(SNMPERR_SUCCESS);
  ------------------
  |  |  217|      2|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4966|      2|        DEBUGMSGTL(("recv", "error while parsing VarBindList:%s\n", errstr));
  ------------------
  |  |   66|      2|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 2]
  |  |  ------------------
  ------------------
 4967|      2|    }
 4968|       |    /** if we were parsing a var, remove it from the pdu and free it */
 4969|      2|    if (vp)
  ------------------
  |  Branch (4969:9): [True: 0, False: 2]
  ------------------
 4970|      0|        snmp_free_var(vp);
 4971|       |
 4972|      2|    return -1;
 4973|      0|}
snmpv3_scopedPDU_parse:
 4984|      6|{
 4985|      6|    u_char          tmp_buf[SNMP_MAX_MSG_SIZE];
 4986|      6|    size_t          tmp_buf_len;
 4987|      6|    u_char          type;
 4988|      6|    size_t          asn_len;
 4989|      6|    u_char         *data;
 4990|       |
 4991|      6|    pdu->command = 0;           /* initialize so we know if it got parsed */
 4992|      6|    asn_len = *length;
 4993|      6|    data = asn_parse_sequence(cp, &asn_len, &type,
 4994|      6|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|      6|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      6|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 4995|      6|                              "plaintext scopedPDU");
 4996|      6|    if (data == NULL) {
  ------------------
  |  Branch (4996:9): [True: 2, False: 4]
  ------------------
 4997|      2|        return NULL;
 4998|      2|    }
 4999|      4|    *length -= data - cp;
 5000|       |
 5001|       |    /*
 5002|       |     * contextEngineID from scopedPdu  
 5003|       |     */
 5004|      4|    DEBUGDUMPHEADER("recv", "contextEngineID");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 5005|      4|    data = asn_parse_string(data, length, &type, pdu->contextEngineID,
 5006|      4|                            &pdu->contextEngineIDLen);
 5007|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 5008|      4|    if (data == NULL) {
  ------------------
  |  Branch (5008:9): [True: 0, False: 4]
  ------------------
 5009|      0|        ERROR_MSG("error parsing contextEngineID from scopedPdu");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 5010|      0|        return NULL;
 5011|      0|    }
 5012|       |
 5013|       |    /*
 5014|       |     * parse contextName from scopedPdu
 5015|       |     */
 5016|      4|    tmp_buf_len = SNMP_MAX_CONTEXT_SIZE;
  ------------------
  |  |  146|      4|#define SNMP_MAX_CONTEXT_SIZE      256
  ------------------
 5017|      4|    DEBUGDUMPHEADER("recv", "contextName");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 5018|      4|    data = asn_parse_string(data, length, &type, tmp_buf, &tmp_buf_len);
 5019|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 5020|      4|    if (data == NULL) {
  ------------------
  |  Branch (5020:9): [True: 3, False: 1]
  ------------------
 5021|      3|        ERROR_MSG("error parsing contextName from scopedPdu");
  ------------------
  |  |  188|      3|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 5022|      3|        return NULL;
 5023|      3|    }
 5024|       |
 5025|      1|    if (tmp_buf_len) {
  ------------------
  |  Branch (5025:9): [True: 1, False: 0]
  ------------------
 5026|      1|        pdu->contextName = netsnmp_memdup(tmp_buf, tmp_buf_len);
 5027|      1|        pdu->contextNameLen = tmp_buf_len;
 5028|      1|    } else {
 5029|      0|        pdu->contextName = strdup("");
 5030|      0|        pdu->contextNameLen = 0;
 5031|      0|    }
 5032|      1|    if (pdu->contextName == NULL) {
  ------------------
  |  Branch (5032:9): [True: 0, False: 1]
  ------------------
 5033|      0|        ERROR_MSG("error copying contextName from scopedPdu");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 5034|      0|        return NULL;
 5035|      0|    }
 5036|       |
 5037|       |    /*
 5038|       |     * Get the PDU type 
 5039|       |     */
 5040|      1|    asn_len = *length;
 5041|      1|    cp = asn_parse_header(data, &asn_len, &type);
 5042|      1|    if (cp == NULL)
  ------------------
  |  Branch (5042:9): [True: 0, False: 1]
  ------------------
 5043|      0|        return NULL;
 5044|       |
 5045|      1|    pdu->command = type;
 5046|       |
 5047|      1|    return data;
 5048|      1|}
_build_initial_pdu_packet:
 5094|      3|{
 5095|      3|    netsnmp_session *session;
 5096|      3|    struct snmp_internal_session *isp;
 5097|      3|    netsnmp_transport *transport = NULL;
 5098|      3|    u_char         *pktbuf = NULL, *packet = NULL;
 5099|      3|    size_t          pktbuf_len = 0, length = 0, orig_length = 0;
 5100|      3|    int             result, orig_count = 0, curr_count = 0;
 5101|       |
 5102|      3|    if (slp == NULL) {
  ------------------
  |  Branch (5102:9): [True: 0, False: 3]
  ------------------
 5103|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5104|      0|    }
 5105|      3|    session = slp->session;
 5106|       |
 5107|      3|    isp = slp->internal;
 5108|      3|    transport = slp->transport;
 5109|      3|    if (!session || !isp || !transport) {
  ------------------
  |  Branch (5109:9): [True: 0, False: 3]
  |  Branch (5109:21): [True: 0, False: 3]
  |  Branch (5109:29): [True: 0, False: 3]
  ------------------
 5110|      0|        DEBUGMSGTL(("sess_async_send", "send fail: closing...\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]
  |  |  ------------------
  ------------------
 5111|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5112|      0|    }
 5113|       |
 5114|      3|    if (pdu == NULL) {
  ------------------
  |  Branch (5114:9): [True: 0, False: 3]
  ------------------
 5115|      0|        session->s_snmp_errno = SNMPERR_NULL_PDU;
  ------------------
  |  |  276|      0|#define SNMPERR_NULL_PDU		(-59)
  ------------------
 5116|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5117|      0|    }
 5118|       |
 5119|      3|    SNMP_FREE(isp->obuf); /* should already be NULL */
  ------------------
  |  |   62|      3|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 3]
  |  |  |  Branch (62:66): [Folded, False: 3]
  |  |  ------------------
  ------------------
 5120|       |
 5121|      3|    session->s_snmp_errno = 0;
 5122|      3|    session->s_errno = 0;
 5123|       |
 5124|       |    /*
 5125|       |     * Check/setup the version.  
 5126|       |     */
 5127|      3|    if (pdu->version == SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|      3|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (5127:9): [True: 0, False: 3]
  ------------------
 5128|      0|        if (session->version == SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|      0|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (5128:13): [True: 0, False: 0]
  ------------------
 5129|      0|            session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 5130|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5131|      0|        }
 5132|      0|        pdu->version = session->version;
 5133|      3|    } else if (session->version == SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|      3|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (5133:16): [True: 3, False: 0]
  ------------------
 5134|       |        /*
 5135|       |         * It's OK  
 5136|       |         */
 5137|      3|    } else if (pdu->version != session->version) {
  ------------------
  |  Branch (5137:16): [True: 0, False: 0]
  ------------------
 5138|       |        /*
 5139|       |         * ENHANCE: we should support multi-lingual sessions  
 5140|       |         */
 5141|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 5142|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5143|      0|    }
 5144|      3|    if (NETSNMP_RUNTIME_PROTOCOL_SKIP(pdu->version)) {
  ------------------
  |  |  246|      3|    (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||        \
  |  |  ------------------
  |  |  |  |  205|      6|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|      6|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  206|      6|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (206:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  207|      0|                            NETSNMP_DS_LIB_DISABLE_V1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|      0|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  247|      3|     NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver) ||        \
  |  |  ------------------
  |  |  |  |  215|      6|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|      6|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  216|      6|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (216:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  217|      0|                            NETSNMP_DS_LIB_DISABLE_V2c))
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|#define NETSNMP_DS_LIB_DISABLE_V2c         44 /* disable SNMPv2c */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  248|      3|     NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver))
  |  |  ------------------
  |  |  |  |  229|      3|    ((pc_ver == SNMP_VERSION_3) &&                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|      3|#define SNMP_VERSION_3     3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (229:6): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  230|      3|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      3|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (230:6): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  231|      3|                            NETSNMP_DS_LIB_DISABLE_V3))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|      3|#define NETSNMP_DS_LIB_DISABLE_V3          45 /* disable SNMPv3 */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5145|      0|        DEBUGMSGTL(("sess_async_send", "version disabled at runtime\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]
  |  |  ------------------
  ------------------
 5146|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 5147|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5148|      0|    }
 5149|       |
 5150|       |    /*
 5151|       |     * do we expect a response?
 5152|       |     */
 5153|      3|    switch (pdu->command) {
 5154|       |
 5155|      0|        case SNMP_MSG_RESPONSE:
  ------------------
  |  |  127|      0|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (5155:9): [True: 0, False: 3]
  ------------------
 5156|      0|        case SNMP_MSG_TRAP:
  ------------------
  |  |  135|      0|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (5156:9): [True: 0, False: 3]
  ------------------
 5157|      0|        case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|      0|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (5157:9): [True: 0, False: 3]
  ------------------
 5158|      3|        case SNMP_MSG_REPORT:
  ------------------
  |  |  147|      3|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|      3|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (5158:9): [True: 3, False: 0]
  ------------------
 5159|      3|        case AGENTX_MSG_CLEANUPSET:
  ------------------
  |  |   45|      3|#define AGENTX_MSG_CLEANUPSET ((u_char)11)
  ------------------
  |  Branch (5159:9): [True: 0, False: 3]
  ------------------
 5160|      3|        case AGENTX_MSG_RESPONSE:
  ------------------
  |  |   52|      3|#define AGENTX_MSG_RESPONSE    ((u_char)18)
  ------------------
  |  Branch (5160:9): [True: 0, False: 3]
  ------------------
 5161|      3|            pdu->flags &= ~UCD_MSG_FLAG_EXPECT_RESPONSE;
  ------------------
  |  |  312|      3|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
 5162|      3|            break;
 5163|       |            
 5164|      0|        default:
  ------------------
  |  Branch (5164:9): [True: 0, False: 3]
  ------------------
 5165|      0|            pdu->flags |= UCD_MSG_FLAG_EXPECT_RESPONSE;
  ------------------
  |  |  312|      0|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
 5166|      0|            break;
 5167|      3|    }
 5168|       |
 5169|       |    /*
 5170|       |     * Check if we need to perform a v3 engineID probe. Call post probe hook to
 5171|       |     * create user from information in a session even if SNMP_FLAGS_DONT_PROBE
 5172|       |     * is set, as this may indicate that probe was already sent by other means
 5173|       |     * for example asynchronously.
 5174|       |     */
 5175|      3|    if ((pdu->version == SNMP_VERSION_3) &&
  ------------------
  |  |  113|      3|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (5175:9): [True: 3, False: 0]
  ------------------
 5176|      3|        (pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE)) {
  ------------------
  |  |  312|      3|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
  |  Branch (5176:9): [True: 0, False: 3]
  ------------------
 5177|      0|        int rc;
 5178|      0|        DEBUGMSGTL(("snmpv3_build", "delayed probe for engineID\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]
  |  |  ------------------
  ------------------
 5179|      0|        rc = snmpv3_engineID_probe(slp, session);
 5180|      0|        if (rc == 0)
  ------------------
  |  Branch (5180:13): [True: 0, False: 0]
  ------------------
 5181|      0|            return 0; /* s_snmp_errno already set */
 5182|      0|    }
 5183|       |
 5184|       |    /*
 5185|       |     * determine max packet size
 5186|       |     */
 5187|      3|    if (pdu->msgMaxSize == 0) {
  ------------------
  |  Branch (5187:9): [True: 0, False: 3]
  ------------------
 5188|      0|        pdu->msgMaxSize = netsnmp_max_send_msg_size();
 5189|      0|        if (pdu->msgMaxSize > transport->msgMaxSize)
  ------------------
  |  Branch (5189:13): [True: 0, False: 0]
  ------------------
 5190|      0|            pdu->msgMaxSize = transport->msgMaxSize;
 5191|      0|        if (pdu->msgMaxSize > session->sndMsgMaxSize)
  ------------------
  |  Branch (5191:13): [True: 0, False: 0]
  ------------------
 5192|      0|            pdu->msgMaxSize = session->sndMsgMaxSize;
 5193|      0|        DEBUGMSGTL(("sess_async_send", "max PDU size: %ld\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]
  |  |  ------------------
  ------------------
 5194|      0|                    pdu->msgMaxSize));
 5195|      0|    }
 5196|      3|    netsnmp_assert(pdu->msgMaxSize > 0);
  ------------------
  |  |   47|      3|#      define netsnmp_assert(x)  do { \
  |  |   48|      3|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 3, False: 0]
  |  |  ------------------
  |  |   49|      3|                 ; \
  |  |   50|      3|              else \
  |  |   51|      3|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      3|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 3]
  |  |  ------------------
  ------------------
 5197|       |
 5198|       |    /*
 5199|       |     * allocate initial packet buffer. Buffer will be grown as needed
 5200|       |     * while building the packet.
 5201|       |     */
 5202|      3|    pktbuf_len = SNMP_MIN_MAX_LEN;
  ------------------
  |  |   48|      3|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
 5203|      3|    if ((pktbuf = (u_char *)malloc(pktbuf_len)) == NULL) {
  ------------------
  |  Branch (5203:9): [True: 0, False: 3]
  ------------------
 5204|      0|        DEBUGMSGTL(("sess_async_send",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 5205|      0|                    "couldn't malloc initial packet buffer\n"));
 5206|      0|        session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 5207|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 5208|      0|    }
 5209|       |
 5210|       |#ifdef TEMPORARILY_DISABLED
 5211|       |    /*
 5212|       |     *  NULL variable are allowed in certain PDU types.
 5213|       |     *  In particular, SNMPv3 engineID probes are of this form.
 5214|       |     *  There is an internal PDU flag to indicate that this
 5215|       |     *    is acceptable, but until the construction of engineID
 5216|       |     *    probes can be amended to set this flag, we'll simply
 5217|       |     *    skip this test altogether.
 5218|       |     */
 5219|       |    if (pdu->variables == NULL) {
 5220|       |        switch (pdu->command) {
 5221|       |#ifndef NETSNMP_NO_WRITE_SUPPORT
 5222|       |        case SNMP_MSG_SET:
 5223|       |#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 5224|       |        case SNMP_MSG_GET:
 5225|       |        case SNMP_MSG_GETNEXT:
 5226|       |        case SNMP_MSG_GETBULK:
 5227|       |        case SNMP_MSG_RESPONSE:
 5228|       |        case SNMP_MSG_TRAP2:
 5229|       |        case SNMP_MSG_REPORT:
 5230|       |        case SNMP_MSG_INFORM:
 5231|       |            session->s_snmp_errno = snmp_errno = SNMPERR_NO_VARS;
 5232|       |            return SNMPERR_NO_VARS;
 5233|       |        case SNMP_MSG_TRAP:
 5234|       |            break;
 5235|       |        }
 5236|       |    }
 5237|       |#endif
 5238|       |
 5239|       |
 5240|       |    /*
 5241|       |     * Build the message to send. If a bulk response is too big, switch to
 5242|       |     * forward encoding and set a flag to drop varbinds to make it fit.
 5243|       |     */
 5244|      3|    do {
 5245|      3|        packet = NULL;
 5246|      3|        length = 0;
 5247|      3|        result = netsnmp_build_packet(isp, session, pdu, &pktbuf, &pktbuf_len,
 5248|      3|                                      &packet, &length);
 5249|      3|        if (0 != result)
  ------------------
  |  Branch (5249:13): [True: 0, False: 3]
  ------------------
 5250|      0|            break;
 5251|       |
 5252|      3|        if (orig_count) { /* 2nd pass, see how many varbinds remain */
  ------------------
  |  Branch (5252:13): [True: 0, False: 3]
  ------------------
 5253|      0|            curr_count = count_varbinds(pdu->variables);
 5254|      0|            DEBUGMSGTL(("sess_async_send", " vb count: %d -> %d\n", orig_count,
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 5255|      0|                        curr_count));
 5256|      0|            DEBUGMSGTL(("sess_async_send", " pdu_len: %" NETSNMP_PRIz "d -> %" NETSNMP_PRIz "d (max %ld)\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]
  |  |  ------------------
  ------------------
 5257|      0|                        orig_length, length, pdu->msgMaxSize));
 5258|      0|        }
 5259|       |
 5260|       |        /** if length is less than max size, we're done (success). */
 5261|      3|        if (length <= pdu->msgMaxSize)
  ------------------
  |  Branch (5261:13): [True: 3, False: 0]
  ------------------
 5262|      3|            break;
 5263|       |
 5264|      0|        DEBUGMSGTL(("sess_async_send", "length %" NETSNMP_PRIz "d exceeds maximum %ld\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]
  |  |  ------------------
  ------------------
 5265|      0|                    length, pdu->msgMaxSize));
 5266|       |
 5267|       |        /** packet too big. if this is not a bulk request, we're done (err). */
 5268|      0|        if (!bulk) {
  ------------------
  |  Branch (5268:13): [True: 0, False: 0]
  ------------------
 5269|      0|           session->s_snmp_errno = SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 5270|      0|           break;
 5271|      0|        }
 5272|       |
 5273|       |        /** rebuild bulk response with truncation and fixed size */
 5274|      0|        pdu->flags |= UCD_MSG_FLAG_FORWARD_ENCODE | UCD_MSG_FLAG_BULK_TOOBIG;
  ------------------
  |  |  319|      0|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
                      pdu->flags |= UCD_MSG_FLAG_FORWARD_ENCODE | UCD_MSG_FLAG_BULK_TOOBIG;
  ------------------
  |  |  321|      0|#define UCD_MSG_FLAG_BULK_TOOBIG          0x010000
  ------------------
 5275|      0|        pktbuf_len = pdu->msgMaxSize;
 5276|       |
 5277|       |        /** save original number of varbinds & length */
 5278|      0|        if (0 == orig_count) {
  ------------------
  |  Branch (5278:13): [True: 0, False: 0]
  ------------------
 5279|      0|            curr_count = orig_count = count_varbinds(pdu->variables);
 5280|      0|            orig_length = length;
 5281|      0|        }
 5282|       |
 5283|      0|    } while(1);
  ------------------
  |  Branch (5283:13): [True: 0, Folded]
  ------------------
 5284|       |
 5285|      3|    DEBUGMSGTL(("sess_async_send",
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 3]
  |  |  ------------------
  ------------------
 5286|      3|                "final pktbuf_len after building packet %" NETSNMP_PRIz "u\n",
 5287|      3|                pktbuf_len));
 5288|      3|    if (curr_count != orig_count)
  ------------------
  |  Branch (5288:9): [True: 0, False: 3]
  ------------------
 5289|      0|        DEBUGMSGTL(("sess_async_send",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 5290|      3|                    "sending %d of %d varbinds (-%d) from bulk response\n",
 5291|      3|                    curr_count, orig_count, orig_count - curr_count));
 5292|       |
 5293|      3|    if (length > pdu->msgMaxSize) {
  ------------------
  |  Branch (5293:9): [True: 0, False: 3]
  ------------------
 5294|      0|        DEBUGMSGTL(("sess_async_send",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 5295|      0|                    "length of packet (%" NETSNMP_PRIz "u) exceeded pdu maximum (%lu)\n",
 5296|      0|                    length, pdu->msgMaxSize));
 5297|      0|        netsnmp_assert(SNMPERR_TOO_LONG == session->s_snmp_errno);
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5298|      0|    }
 5299|       |
 5300|      3|    if ((SNMPERR_TOO_LONG == session->s_snmp_errno) || (result < 0)) {
  ------------------
  |  |  222|      3|#define SNMPERR_TOO_LONG		(-5)
  ------------------
  |  Branch (5300:9): [True: 0, False: 3]
  |  Branch (5300:56): [True: 0, False: 3]
  ------------------
 5301|      0|        DEBUGMSGTL(("sess_async_send", "encoding failure\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]
  |  |  ------------------
  ------------------
 5302|      0|        SNMP_FREE(pktbuf);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 5303|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5304|      0|    }
 5305|       |
 5306|      3|    isp->obuf = pktbuf;
 5307|      3|    isp->obuf_size = pktbuf_len;
 5308|      3|    isp->opacket = packet;
 5309|      3|    isp->opacket_len = length;
 5310|       |
 5311|      3|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      3|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5312|      3|}
snmp_sess_send:
 5344|      3|{
 5345|      3|    return snmp_sess_async_send(slp, pdu, NULL, NULL);
 5346|      3|}
snmp_sess_async_send:
 5547|      3|{
 5548|      3|    int             rc;
 5549|       |
 5550|      3|    if (slp == NULL) {
  ------------------
  |  Branch (5550:9): [True: 0, False: 3]
  ------------------
 5551|      0|        snmp_errno = SNMPERR_BAD_SESSION;       /*MTCRITICAL_RESOURCE */
  ------------------
  |  |  221|      0|#define SNMPERR_BAD_SESSION		(-4)
  ------------------
 5552|      0|        return (0);
 5553|      0|    }
 5554|       |    /*
 5555|       |     * send pdu
 5556|       |     */
 5557|      3|    rc = _sess_async_send(slp, pdu, callback, cb_data);
 5558|      3|    if (rc == 0)
  ------------------
  |  Branch (5558:9): [True: 0, False: 3]
  ------------------
 5559|      0|        SET_SNMP_ERROR(slp->session->s_snmp_errno);
  ------------------
  |  |   56|      0|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 5560|      3|    return rc;
 5561|      3|}
snmp_free_var_internals:
 5569|      3|{
 5570|      3|    if (!var)
  ------------------
  |  Branch (5570:9): [True: 0, False: 3]
  ------------------
 5571|      0|        return;
 5572|       |
 5573|      3|    if (var->name != var->name_loc)
  ------------------
  |  Branch (5573:9): [True: 0, False: 3]
  ------------------
 5574|      0|        SNMP_FREE(var->name);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 5575|      3|    if (var->val.string != var->buf)
  ------------------
  |  Branch (5575:9): [True: 0, False: 3]
  ------------------
 5576|      0|        SNMP_FREE(var->val.string);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 5577|      3|    if (var->data) {
  ------------------
  |  Branch (5577:9): [True: 0, False: 3]
  ------------------
 5578|      0|        if (var->dataFreeHook) {
  ------------------
  |  Branch (5578:13): [True: 0, False: 0]
  ------------------
 5579|      0|            var->dataFreeHook(var->data);
 5580|      0|            var->data = NULL;
 5581|      0|        } else {
 5582|       |            SNMP_FREE(var->data);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 5583|      0|        }
 5584|      0|    }
 5585|      3|}
snmp_free_var:
 5589|      3|{
 5590|      3|    snmp_free_var_internals(var);
 5591|      3|    free(var);
 5592|      3|}
snmp_free_varbind:
 5596|     71|{
 5597|     71|    netsnmp_variable_list *ptr;
 5598|     74|    while (var) {
  ------------------
  |  Branch (5598:12): [True: 3, False: 71]
  ------------------
 5599|      3|        ptr = var->next_variable;
 5600|      3|        snmp_free_var(var);
 5601|      3|        var = ptr;
 5602|      3|    }
 5603|     71|}
snmp_free_pdu:
 5610|     68|{
 5611|     68|    struct snmp_secmod_def *sptr;
 5612|       |
 5613|     68|    if (!pdu)
  ------------------
  |  Branch (5613:9): [True: 0, False: 68]
  ------------------
 5614|      0|        return;
 5615|       |
 5616|     68|    free_securityStateRef(pdu);
 5617|       |
 5618|     68|    sptr = find_sec_mod(pdu->securityModel);
 5619|     68|    if (sptr && sptr->pdu_free)
  ------------------
  |  Branch (5619:9): [True: 9, False: 59]
  |  Branch (5619:17): [True: 0, False: 9]
  ------------------
 5620|      0|        (*sptr->pdu_free)(pdu);
 5621|       |
 5622|     68|    snmp_free_varbind(pdu->variables);
 5623|     68|    free(pdu->enterprise);
 5624|     68|    free(pdu->community);
 5625|     68|    free(pdu->contextEngineID);
 5626|     68|    free(pdu->securityEngineID);
 5627|     68|    free(pdu->contextName);
 5628|     68|    free(pdu->securityName);
 5629|     68|    free(pdu->transport_data);
 5630|     68|    free(pdu);
 5631|     68|}
snmp_create_sess_pdu:
 5636|     65|{
 5637|     65|    netsnmp_pdu *pdu = calloc(1, sizeof(netsnmp_pdu));
 5638|     65|    if (pdu == NULL) {
  ------------------
  |  Branch (5638:9): [True: 0, False: 65]
  ------------------
 5639|      0|        DEBUGMSGTL(("sess_process_packet", "can't malloc space for PDU\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]
  |  |  ------------------
  ------------------
 5640|      0|        return NULL;
 5641|      0|    }
 5642|       |
 5643|       |    /*
 5644|       |     * Save the transport-level data specific to this reception (e.g. UDP
 5645|       |     * source address).  
 5646|       |     */
 5647|       |
 5648|     65|    pdu->transport_data = opaque;
 5649|     65|    pdu->transport_data_length = olength;
 5650|     65|    pdu->tDomain = transport->domain;
 5651|     65|    pdu->tDomainLen = transport->domain_length;
 5652|     65|    return pdu;
 5653|     65|}
snmp_read:
 6025|     65|{
 6026|     65|    netsnmp_large_fd_set lfdset;
 6027|       |
 6028|       |    netsnmp_large_fd_set_init(&lfdset, FD_SETSIZE);
 6029|     65|    netsnmp_copy_fd_set_to_large_fd_set(&lfdset, fdset);
 6030|     65|    snmp_read2(&lfdset);
 6031|     65|    netsnmp_large_fd_set_cleanup(&lfdset);
 6032|     65|}
snmp_read2:
 6036|     65|{
 6037|     65|    struct session_list *slp;
 6038|     65|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     65|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 65]
  |  |  ------------------
  ------------------
 6039|    130|    for (slp = Sessions; slp; slp = slp->next) {
  ------------------
  |  Branch (6039:26): [True: 65, False: 65]
  ------------------
 6040|     65|        snmp_sess_read2(slp, fdset);
 6041|     65|    }
 6042|     65|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     65|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 65]
  |  |  ------------------
  ------------------
 6043|     65|}
_sess_read:
 6202|     65|{
 6203|     65|    netsnmp_session *sp = slp ? slp->session : NULL;
  ------------------
  |  Branch (6203:27): [True: 65, False: 0]
  ------------------
 6204|     65|    struct snmp_internal_session *isp = slp ? slp->internal : NULL;
  ------------------
  |  Branch (6204:41): [True: 65, False: 0]
  ------------------
 6205|     65|    netsnmp_transport *transport = slp ? slp->transport : NULL;
  ------------------
  |  Branch (6205:36): [True: 65, False: 0]
  ------------------
 6206|     65|    size_t          pdulen = 0, rxbuf_len = SNMP_MAX_RCV_MSG_SIZE;
  ------------------
  |  |  141|     65|#define SNMP_MAX_RCV_MSG_SIZE      65536
  ------------------
 6207|     65|    u_char         *rxbuf = NULL;
 6208|     65|    int             length = 0, olength = 0, rc = 0;
 6209|     65|    void           *opaque = NULL;
 6210|       |
 6211|     65|    if (NULL == slp || NULL == sp || NULL == isp || NULL == transport) {
  ------------------
  |  Branch (6211:9): [True: 0, False: 65]
  |  Branch (6211:24): [True: 0, False: 65]
  |  Branch (6211:38): [True: 0, False: 65]
  |  Branch (6211:53): [True: 0, False: 65]
  ------------------
 6212|      0|        snmp_log(LOG_ERR, "bad parameters to _sess_read\n");
 6213|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 6214|      0|    }
 6215|       |
 6216|       |    /* to avoid subagent crash */ 
 6217|     65|    if (transport->sock < 0) { 
  ------------------
  |  Branch (6217:9): [True: 0, False: 65]
  ------------------
 6218|      0|        snmp_log (LOG_INFO, "transport->sock got negative fd value %d\n",
 6219|      0|                  transport->sock);
 6220|      0|        return 0; 
 6221|      0|    }
 6222|       |
 6223|     65|    if (!fdset || !(NETSNMP_LARGE_FD_ISSET(transport->sock, fdset))) {
  ------------------
  |  |   50|     65|                    netsnmp_large_fd_is_set(fd, fdset)
  ------------------
  |  Branch (6223:9): [True: 0, False: 65]
  |  Branch (6223:19): [True: 0, False: 65]
  ------------------
 6224|      0|        DEBUGMSGTL(("sess_read", "not reading %d (fdset %p set %d)\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 (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6225|      0|                    transport->sock, fdset,
 6226|      0|                    fdset ? NETSNMP_LARGE_FD_ISSET(transport->sock, fdset)
 6227|      0|		    : -9));
 6228|      0|        return 0;
 6229|      0|    }
 6230|       |
 6231|     65|    sp->s_snmp_errno = 0;
 6232|     65|    sp->s_errno = 0;
 6233|       |
 6234|     65|    if (transport->flags & NETSNMP_TRANSPORT_FLAG_LISTEN)
  ------------------
  |  |   52|     65|#define		NETSNMP_TRANSPORT_FLAG_LISTEN	 0x02
  ------------------
  |  Branch (6234:9): [True: 0, False: 65]
  ------------------
 6235|      0|        return _sess_read_accept(slp);
 6236|       |
 6237|     65|    if (!(transport->flags & NETSNMP_TRANSPORT_FLAG_STREAM)) {
  ------------------
  |  |   51|     65|#define		NETSNMP_TRANSPORT_FLAG_STREAM	 0x01
  ------------------
  |  Branch (6237:9): [True: 65, False: 0]
  ------------------
 6238|     65|        snmp_rcv_packet rcvp;
 6239|     65|        memset(&rcvp, 0x0, sizeof(rcvp));
 6240|       |
 6241|       |        /** read the packet */
 6242|     65|        rc = _sess_read_dgram_packet(slp, fdset, &rcvp);
 6243|     65|        if (-1 == rc) /* protocol error */
  ------------------
  |  Branch (6243:13): [True: 0, False: 65]
  ------------------
 6244|      0|            return -1;
 6245|     65|        else if (-2 == rc) /* no packet to process */
  ------------------
  |  Branch (6245:18): [True: 0, False: 65]
  ------------------
 6246|      0|            return 0;
 6247|       |
 6248|     65|        rc = _sess_process_packet(slp, sp, isp, transport,
 6249|     65|                                  rcvp.opaque, rcvp.olength,
 6250|     65|                                  rcvp.packet, rcvp.packet_len);
 6251|     65|        SNMP_FREE(rcvp.packet);
  ------------------
  |  |   62|     65|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 65, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 65]
  |  |  ------------------
  ------------------
 6252|       |        /** opaque is freed in _sess_process_packet */
 6253|     65|        return rc;
 6254|     65|    }
 6255|       |
 6256|       |    /** stream transport */
 6257|       |
 6258|      0|        if (isp->packet == NULL) {
  ------------------
  |  Branch (6258:13): [True: 0, False: 0]
  ------------------
 6259|       |            /*
 6260|       |             * We have no saved packet.  Allocate one.  
 6261|       |             */
 6262|      0|            if ((isp->packet = (u_char *) malloc(rxbuf_len)) == NULL) {
  ------------------
  |  Branch (6262:17): [True: 0, False: 0]
  ------------------
 6263|      0|                DEBUGMSGTL(("sess_read", "can't malloc %" NETSNMP_PRIz
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6264|      0|                            "u bytes for rxbuf\n", rxbuf_len));
 6265|      0|                return 0;
 6266|      0|            } else {
 6267|      0|                rxbuf = isp->packet;
 6268|      0|                isp->packet_size = rxbuf_len;
 6269|      0|                isp->packet_len = 0;
 6270|      0|            }
 6271|      0|        } else {
 6272|       |            /*
 6273|       |             * We have saved a partial packet from last time.  Extend that, if
 6274|       |             * necessary, and receive new data after the old data.  
 6275|       |             */
 6276|      0|            u_char         *newbuf;
 6277|       |
 6278|      0|            if (isp->packet_size < isp->packet_len + rxbuf_len) {
  ------------------
  |  Branch (6278:17): [True: 0, False: 0]
  ------------------
 6279|      0|                newbuf =
 6280|      0|                    (u_char *) realloc(isp->packet,
 6281|      0|                                       isp->packet_len + rxbuf_len);
 6282|      0|                if (newbuf == NULL) {
  ------------------
  |  Branch (6282:21): [True: 0, False: 0]
  ------------------
 6283|      0|                    DEBUGMSGTL(("sess_read",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6284|      0|                                "can't malloc %" NETSNMP_PRIz
 6285|      0|                                "u more for rxbuf (%" NETSNMP_PRIz "u tot)\n",
 6286|      0|                                rxbuf_len, isp->packet_len + rxbuf_len));
 6287|      0|                    return 0;
 6288|      0|                } else {
 6289|      0|                    isp->packet = newbuf;
 6290|      0|                    isp->packet_size = isp->packet_len + rxbuf_len;
 6291|      0|                    rxbuf = isp->packet + isp->packet_len;
 6292|      0|                }
 6293|      0|            } else {
 6294|      0|                rxbuf = isp->packet + isp->packet_len;
 6295|      0|                rxbuf_len = isp->packet_size - isp->packet_len;
 6296|      0|            }
 6297|      0|        }
 6298|       |
 6299|      0|    length = netsnmp_transport_recv(transport, rxbuf, rxbuf_len, &opaque,
 6300|      0|                                    &olength);
 6301|       |
 6302|      0|    if (0 == length && transport->flags & NETSNMP_TRANSPORT_FLAG_EMPTY_PKT) {
  ------------------
  |  |   56|      0|#define		NETSNMP_TRANSPORT_FLAG_EMPTY_PKT 0x10
  ------------------
  |  Branch (6302:9): [True: 0, False: 0]
  |  Branch (6302:24): [True: 0, False: 0]
  ------------------
 6303|       |        /* this allows for a transport that needs to return from
 6304|       |         * packet processing that doesn't necessarily have any
 6305|       |         * consumable data in it. */
 6306|       |
 6307|       |        /* reset the flag since it's a per-message flag */
 6308|      0|        transport->flags &= (~NETSNMP_TRANSPORT_FLAG_EMPTY_PKT);
  ------------------
  |  |   56|      0|#define		NETSNMP_TRANSPORT_FLAG_EMPTY_PKT 0x10
  ------------------
 6309|       |
 6310|      0|        return 0;
 6311|      0|    }
 6312|       |
 6313|       |    /*
 6314|       |     * Remote end closed connection.  
 6315|       |     */
 6316|      0|    if (length <= 0) {
  ------------------
  |  Branch (6316:9): [True: 0, False: 0]
  ------------------
 6317|       |        /*
 6318|       |         * Alert the application if possible.  
 6319|       |         */
 6320|      0|        if (sp->callback != NULL) {
  ------------------
  |  Branch (6320:13): [True: 0, False: 0]
  ------------------
 6321|      0|            DEBUGMSGTL(("sess_read", "perform callback with op=DISCONNECT\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]
  |  |  ------------------
  ------------------
 6322|      0|            (void) sp->callback(NETSNMP_CALLBACK_OP_DISCONNECT, sp, 0,
  ------------------
  |  |  356|      0|#define NETSNMP_CALLBACK_OP_DISCONNECT		5
  ------------------
 6323|      0|                                NULL, sp->callback_magic);
 6324|      0|        }
 6325|       |        /*
 6326|       |         * Close socket and mark session for deletion.  
 6327|       |         */
 6328|      0|        DEBUGMSGTL(("sess_read", "fd %d closed\n", transport->sock));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6329|      0|        transport->f_close(transport);
 6330|      0|        SNMP_FREE(isp->packet);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6331|      0|        SNMP_FREE(opaque);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6332|      0|        return -1;
 6333|      0|    }
 6334|       |
 6335|      0|    {
 6336|      0|        u_char *pptr = isp->packet;
 6337|      0|	void *ocopy = NULL;
 6338|       |
 6339|      0|        isp->packet_len += length;
 6340|       |
 6341|      0|        while (isp->packet_len > 0) {
  ------------------
  |  Branch (6341:16): [True: 0, False: 0]
  ------------------
 6342|       |
 6343|       |            /*
 6344|       |             * Get the total data length we're expecting (and need to wait
 6345|       |             * for).
 6346|       |             */
 6347|      0|            if (isp->check_packet) {
  ------------------
  |  Branch (6347:17): [True: 0, False: 0]
  ------------------
 6348|      0|                pdulen = isp->check_packet(pptr, isp->packet_len);
 6349|      0|            } else {
 6350|      0|                pdulen = asn_check_packet(pptr, isp->packet_len);
 6351|      0|            }
 6352|       |
 6353|      0|            DEBUGMSGTL(("sess_read",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6354|      0|                        "  loop packet_len %" NETSNMP_PRIz "u, PDU length %"
 6355|      0|                        NETSNMP_PRIz "u\n", isp->packet_len, pdulen));
 6356|       |
 6357|      0|            if (pdulen > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (6357:17): [True: 0, False: 0]
  ------------------
 6358|       |                /*
 6359|       |                 * Illegal length, drop the connection.  
 6360|       |                 */
 6361|      0|                snmp_log(LOG_ERR, 
 6362|      0|			 "Received broken packet. Closing session.\n");
 6363|      0|		if (sp->callback != NULL) {
  ------------------
  |  Branch (6363:7): [True: 0, False: 0]
  ------------------
 6364|      0|		  DEBUGMSGTL(("sess_read",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6365|      0|			      "perform callback with op=DISCONNECT\n"));
 6366|      0|		  (void)sp->callback(NETSNMP_CALLBACK_OP_DISCONNECT,
  ------------------
  |  |  356|      0|#define NETSNMP_CALLBACK_OP_DISCONNECT		5
  ------------------
 6367|      0|				     sp, 0, NULL, sp->callback_magic);
 6368|      0|		}
 6369|      0|		DEBUGMSGTL(("sess_read", "fd %d closed\n", transport->sock));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6370|      0|                transport->f_close(transport);
 6371|      0|                SNMP_FREE(opaque);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6372|       |                /** XXX-rks: why no SNMP_FREE(isp->packet); ?? */
 6373|      0|                return -1;
 6374|      0|            }
 6375|       |
 6376|      0|            if (pdulen > isp->packet_len || pdulen == 0) {
  ------------------
  |  Branch (6376:17): [True: 0, False: 0]
  |  Branch (6376:45): [True: 0, False: 0]
  ------------------
 6377|       |                /*
 6378|       |                 * We don't have a complete packet yet.  If we've already
 6379|       |                 * processed a packet, break out so we'll shift this packet
 6380|       |                 * to the start of the buffer. If we're already at the
 6381|       |                 * start, simply return and wait for more data to arrive.
 6382|       |                 */
 6383|      0|                DEBUGMSGTL(("sess_read",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6384|      0|                            "pkt not complete (need %" NETSNMP_PRIz "u got %"
 6385|      0|                            NETSNMP_PRIz "u so far)\n", pdulen,
 6386|      0|                            isp->packet_len));
 6387|       |
 6388|      0|                if (pptr != isp->packet)
  ------------------
  |  Branch (6388:21): [True: 0, False: 0]
  ------------------
 6389|      0|                    break; /* opaque freed for us outside of loop. */
 6390|       |
 6391|      0|                SNMP_FREE(opaque);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6392|      0|                return 0;
 6393|      0|            }
 6394|       |
 6395|       |            /*  We have *at least* one complete packet in the buffer now.  If
 6396|       |		we have possibly more than one packet, we must copy the opaque
 6397|       |		pointer because we may need to reuse it for a later packet.  */
 6398|       |
 6399|      0|	    if (pdulen < isp->packet_len) {
  ------------------
  |  Branch (6399:10): [True: 0, False: 0]
  ------------------
 6400|      0|		if (olength > 0 && opaque != NULL) {
  ------------------
  |  Branch (6400:7): [True: 0, False: 0]
  |  Branch (6400:22): [True: 0, False: 0]
  ------------------
 6401|      0|		    ocopy = malloc(olength);
 6402|      0|		    if (ocopy != NULL) {
  ------------------
  |  Branch (6402:11): [True: 0, False: 0]
  ------------------
 6403|      0|			memcpy(ocopy, opaque, olength);
 6404|      0|		    }
 6405|      0|		}
 6406|      0|	    } else if (pdulen == isp->packet_len) {
  ------------------
  |  Branch (6406:17): [True: 0, False: 0]
  ------------------
 6407|       |		/*  Common case -- exactly one packet.  No need to copy the
 6408|       |		    opaque pointer.  */
 6409|      0|		ocopy = opaque;
 6410|      0|		opaque = NULL;
 6411|      0|	    }
 6412|       |
 6413|      0|            if ((rc = _sess_process_packet(slp, sp, isp, transport,
  ------------------
  |  Branch (6413:17): [True: 0, False: 0]
  ------------------
 6414|      0|                                           ocopy, ocopy?olength:0, pptr,
  ------------------
  |  Branch (6414:51): [True: 0, False: 0]
  ------------------
 6415|      0|                                           pdulen))) {
 6416|       |                /*
 6417|       |                 * Something went wrong while processing this packet -- set the
 6418|       |                 * errno.  
 6419|       |                 */
 6420|      0|                if (sp->s_snmp_errno != 0) {
  ------------------
  |  Branch (6420:21): [True: 0, False: 0]
  ------------------
 6421|      0|                    SET_SNMP_ERROR(sp->s_snmp_errno);
  ------------------
  |  |   56|      0|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 6422|      0|                }
 6423|      0|            }
 6424|       |
 6425|       |	    /*  ocopy has been free()d by _sess_process_packet by this point,
 6426|       |		so set it to NULL.  */
 6427|       |
 6428|      0|	    ocopy = NULL;
 6429|       |
 6430|       |	    /*  Step past the packet we've just dealt with.  */
 6431|       |
 6432|      0|            pptr += pdulen;
 6433|      0|            isp->packet_len -= pdulen;
 6434|      0|        }
 6435|       |
 6436|       |	/*  If we had more than one packet, then we were working with copies
 6437|       |	    of the opaque pointer, so we still need to free() the opaque
 6438|       |	    pointer itself.  */
 6439|       |
 6440|      0|	SNMP_FREE(opaque);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6441|       |
 6442|      0|        if (isp->packet_len >= SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (6442:13): [True: 0, False: 0]
  ------------------
 6443|       |            /*
 6444|       |             * Obviously this should never happen!  
 6445|       |             */
 6446|      0|            snmp_log(LOG_ERR,
 6447|      0|                     "too large packet_len = %" NETSNMP_PRIz
 6448|      0|                     "u, dropping connection %d\n",
 6449|      0|                     isp->packet_len, transport->sock);
 6450|      0|            transport->f_close(transport);
 6451|       |            /** XXX-rks: why no SNMP_FREE(isp->packet); ?? */
 6452|      0|            return -1;
 6453|      0|        } else if (isp->packet_len == 0) {
  ------------------
  |  Branch (6453:20): [True: 0, False: 0]
  ------------------
 6454|       |            /*
 6455|       |             * This is good: it means the packet buffer contained an integral
 6456|       |             * number of PDUs, so we don't have to save any data for next
 6457|       |             * time.  We can free() the buffer now to keep the memory
 6458|       |             * footprint down.
 6459|       |             */
 6460|      0|            SNMP_FREE(isp->packet);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6461|      0|            isp->packet_size = 0;
 6462|      0|            isp->packet_len = 0;
 6463|      0|            return rc;
 6464|      0|        }
 6465|       |
 6466|       |        /*
 6467|       |         * If we get here, then there is a partial packet of length
 6468|       |         * isp->packet_len bytes starting at pptr left over.  Move that to the
 6469|       |         * start of the buffer, and then realloc() the buffer down to size to
 6470|       |         * reduce the memory footprint.  
 6471|       |         */
 6472|       |
 6473|      0|        memmove(isp->packet, pptr, isp->packet_len);
 6474|      0|        DEBUGMSGTL(("sess_read",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6475|      0|                    "end: memmove(%p, %p, %" NETSNMP_PRIz "u); realloc(%p, %"
 6476|      0|                    NETSNMP_PRIz "u)\n",
 6477|      0|                    isp->packet, pptr, isp->packet_len,
 6478|      0|		    isp->packet, isp->packet_len));
 6479|       |
 6480|      0|        if ((rxbuf = (u_char *)realloc(isp->packet, isp->packet_len)) == NULL) {
  ------------------
  |  Branch (6480:13): [True: 0, False: 0]
  ------------------
 6481|       |            /*
 6482|       |             * I don't see why this should ever fail, but it's not a big deal.
 6483|       |             */
 6484|      0|            DEBUGMSGTL(("sess_read", "realloc() failed\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]
  |  |  ------------------
  ------------------
 6485|      0|        } else {
 6486|      0|            DEBUGMSGTL(("sess_read", "realloc() okay, old buffer %p, new %p\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]
  |  |  ------------------
  ------------------
 6487|      0|                        isp->packet, rxbuf));
 6488|      0|            isp->packet = rxbuf;
 6489|      0|            isp->packet_size = isp->packet_len;
 6490|      0|        }
 6491|      0|    }
 6492|       |
 6493|      0|    return rc;
 6494|      0|}
snmp_sess_read2:
 6516|     65|{
 6517|     65|    netsnmp_session *pss;
 6518|     65|    int             rc;
 6519|       |
 6520|     65|    rc = _sess_read(slp, fdset);
 6521|     65|    pss = slp->session;
 6522|     65|    if (rc && pss->s_snmp_errno) {
  ------------------
  |  Branch (6522:9): [True: 65, False: 0]
  |  Branch (6522:15): [True: 65, False: 0]
  ------------------
 6523|     65|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   56|     65|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 6524|     65|    }
 6525|     65|    return rc;
 6526|     65|}
snmp_select_info:
 6556|     65|{
 6557|       |    return snmp_sess_select_info(NULL, numfds, fdset, timeout, block);
 6558|     65|}
snmp_sess_select_info:
 6576|     65|{
 6577|     65|    return snmp_sess_select_info_flags(slp, numfds, fdset, timeout, block,
 6578|     65|                                       NETSNMP_SELECT_NOFLAGS);
  ------------------
  |  |  170|     65|#define NETSNMP_SELECT_NOFLAGS  0x00
  ------------------
 6579|     65|}
snmp_sess_select_info_flags:
 6587|     65|{
 6588|     65|  int rc;
 6589|     65|  netsnmp_large_fd_set lfdset;
 6590|       |
 6591|     65|  netsnmp_large_fd_set_init(&lfdset, FD_SETSIZE);
 6592|     65|  netsnmp_copy_fd_set_to_large_fd_set(&lfdset, fdset);
 6593|     65|  rc = snmp_sess_select_info2_flags(slp, numfds, &lfdset, timeout,
 6594|     65|                                    block, flags);
 6595|     65|  if (netsnmp_copy_large_fd_set_to_fd_set(fdset, &lfdset) < 0) {
  ------------------
  |  Branch (6595:7): [True: 0, False: 65]
  ------------------
 6596|       |      snmp_log(LOG_ERR,
 6597|      0|	     "Use snmp_sess_select_info2() for processing"
 6598|      0|	     " large file descriptors\n");
 6599|      0|  }
 6600|     65|  netsnmp_large_fd_set_cleanup(&lfdset);
 6601|     65|  return rc;
 6602|     65|}
snmp_sess_select_info2_flags:
 6646|     65|{
 6647|     65|    struct session_list *slp, *next = NULL;
 6648|     65|    netsnmp_request_list *rp;
 6649|     65|    struct timeval  now, earliest, alarm_tm;
 6650|     65|    int             active = 0, requests = 0;
 6651|     65|    int             next_alarm = 0;
 6652|       |
 6653|     65|    timerclear(&earliest);
 6654|       |
 6655|       |    /*
 6656|       |     * For each session examined, add its socket to the fdset,
 6657|       |     * and if it is the earliest timeout to expire, mark it as lowest.
 6658|       |     * If a single session is specified, do just for that session.
 6659|       |     */
 6660|       |
 6661|     65|    DEBUGMSGTL(("sess_select", "for %s session%s: ",
  ------------------
  |  |   66|     65|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 65]
  |  |  ------------------
  ------------------
 6662|     65|                sessp ? "single" : "all", sessp ? "" : "s"));
 6663|       |
 6664|    130|    for (slp = sessp ? sessp : Sessions; slp; slp = next) {
  ------------------
  |  Branch (6664:16): [True: 0, False: 65]
  |  Branch (6664:42): [True: 65, False: 65]
  ------------------
 6665|     65|        next = slp->next;
 6666|       |
 6667|     65|        if (slp->transport == NULL) {
  ------------------
  |  Branch (6667:13): [True: 0, False: 65]
  ------------------
 6668|       |            /*
 6669|       |             * Close in progress -- skip this one.  
 6670|       |             */
 6671|      0|            DEBUGMSG(("sess_select", "skip "));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6672|      0|            continue;
 6673|      0|        }
 6674|       |
 6675|     65|        if (slp->transport->sock == -1) {
  ------------------
  |  Branch (6675:13): [True: 0, False: 65]
  ------------------
 6676|       |            /*
 6677|       |             * This session was marked for deletion.  
 6678|       |             */
 6679|      0|            DEBUGMSG(("sess_select", "delete\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6680|      0|            if (sessp == NULL) {
  ------------------
  |  Branch (6680:17): [True: 0, False: 0]
  ------------------
 6681|      0|                snmp_close(slp->session);
 6682|      0|            } else {
 6683|      0|                snmp_sess_close(slp);
 6684|      0|            }
 6685|      0|            DEBUGMSGTL(("sess_select", "for %s session%s: ",
  ------------------
  |  |   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 (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6686|      0|                        sessp ? "single" : "all", sessp ? "" : "s"));
 6687|      0|            continue;
 6688|      0|        }
 6689|       |
 6690|     65|        DEBUGMSG(("sess_select", "%d ", slp->transport->sock));
  ------------------
  |  |   61|     65|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 65]
  |  |  ------------------
  ------------------
 6691|     65|        if ((slp->transport->sock + 1) > *numfds) {
  ------------------
  |  Branch (6691:13): [True: 65, False: 0]
  ------------------
 6692|     65|            *numfds = (slp->transport->sock + 1);
 6693|     65|        }
 6694|       |
 6695|     65|        NETSNMP_LARGE_FD_SET(slp->transport->sock, fdset);
  ------------------
  |  |   35|     65|                    netsnmp_large_fd_setfd(fd, fdset)
  ------------------
 6696|     65|        if (slp->internal != NULL && slp->internal->requests) {
  ------------------
  |  Branch (6696:13): [True: 65, False: 0]
  |  Branch (6696:38): [True: 0, False: 65]
  ------------------
 6697|       |            /*
 6698|       |             * Found another session with outstanding requests.  
 6699|       |             */
 6700|      0|            requests++;
 6701|      0|            for (rp = slp->internal->requests; rp; rp = rp->next_request) {
  ------------------
  |  Branch (6701:48): [True: 0, False: 0]
  ------------------
 6702|      0|                if (!timerisset(&earliest)
  ------------------
  |  Branch (6702:21): [True: 0, False: 0]
  ------------------
 6703|      0|                    || (timerisset(&rp->expireM)
  ------------------
  |  Branch (6703:25): [True: 0, False: 0]
  ------------------
 6704|      0|                        && timercmp(&rp->expireM, &earliest, <))) {
  ------------------
  |  Branch (6704:28): [True: 0, False: 0]
  |  Branch (6704:28): [True: 0, False: 0]
  ------------------
 6705|      0|                    earliest = rp->expireM;
 6706|      0|                    DEBUGMSG(("verbose:sess_select","(to in %d.%06d sec) ",
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6707|      0|                               (int)earliest.tv_sec, (int)earliest.tv_usec));
 6708|      0|                }
 6709|      0|            }
 6710|      0|        }
 6711|       |
 6712|     65|        active++;
 6713|     65|        if (sessp) {
  ------------------
  |  Branch (6713:13): [True: 0, False: 65]
  ------------------
 6714|       |            /*
 6715|       |             * Single session processing.  
 6716|       |             */
 6717|      0|            break;
 6718|      0|        }
 6719|     65|    }
 6720|     65|    DEBUGMSG(("sess_select", "\n"));
  ------------------
  |  |   61|     65|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 65]
  |  |  ------------------
  ------------------
 6721|       |
 6722|     65|    netsnmp_get_monotonic_clock(&now);
 6723|       |
 6724|     65|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     65|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (6724:9): [True: 0, False: 65]
  ------------------
 6725|     65|                               NETSNMP_DS_LIB_ALARM_DONT_USE_SIG) &&
  ------------------
  |  |   71|     65|#define NETSNMP_DS_LIB_ALARM_DONT_USE_SIG  11   /* don't use the alarm() signal */
  ------------------
 6726|      0|        !(flags & NETSNMP_SELECT_NOALARMS)) {
  ------------------
  |  |  171|      0|#define NETSNMP_SELECT_NOALARMS 0x01
  ------------------
  |  Branch (6726:9): [True: 0, False: 0]
  ------------------
 6727|      0|        next_alarm = netsnmp_get_next_alarm_time(&alarm_tm, &now);
 6728|      0|        if (next_alarm)
  ------------------
  |  Branch (6728:13): [True: 0, False: 0]
  ------------------
 6729|      0|            DEBUGMSGT(("sess_select","next alarm at %ld.%06ld sec\n",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6730|      0|                       (long)alarm_tm.tv_sec, (long)alarm_tm.tv_usec));
 6731|      0|    }
 6732|     65|    if (next_alarm == 0 && requests == 0) {
  ------------------
  |  Branch (6732:9): [True: 65, False: 0]
  |  Branch (6732:28): [True: 65, False: 0]
  ------------------
 6733|       |        /*
 6734|       |         * If none are active, skip arithmetic.  
 6735|       |         */
 6736|     65|        DEBUGMSGT(("sess_select","blocking:no session requests or alarms.\n"));
  ------------------
  |  |   62|     65|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 65]
  |  |  ------------------
  ------------------
 6737|     65|        *block = 1; /* can block - timeout value is undefined if no requests */
 6738|     65|        return active;
 6739|     65|    }
 6740|       |
 6741|      0|    if (next_alarm &&
  ------------------
  |  Branch (6741:9): [True: 0, False: 0]
  ------------------
 6742|      0|        (!timerisset(&earliest) || timercmp(&alarm_tm, &earliest, <)))
  ------------------
  |  Branch (6742:10): [True: 0, False: 0]
  |  Branch (6742:36): [True: 0, False: 0]
  |  Branch (6742:36): [True: 0, False: 0]
  ------------------
 6743|      0|        earliest = alarm_tm;
 6744|       |
 6745|      0|    NETSNMP_TIMERSUB(&earliest, &now, &earliest);
  ------------------
  |  |  173|      0|#define NETSNMP_TIMERSUB(a, b, res) do {                        \
  |  |  174|      0|    (res)->tv_sec  = (a)->tv_sec  - (b)->tv_sec - 1;            \
  |  |  175|      0|    (res)->tv_usec = (a)->tv_usec - (b)->tv_usec + 1000000L;    \
  |  |  176|      0|    if ((res)->tv_usec >= 1000000L) {                           \
  |  |  ------------------
  |  |  |  Branch (176:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  177|      0|        (res)->tv_usec -= 1000000L;                             \
  |  |  178|      0|        (res)->tv_sec++;                                        \
  |  |  179|      0|    }                                                           \
  |  |  180|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (180:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6746|      0|    if (earliest.tv_sec < 0) {
  ------------------
  |  Branch (6746:9): [True: 0, False: 0]
  ------------------
 6747|      0|        time_t overdue_ms = -(earliest.tv_sec * 1000 + earliest.tv_usec / 1000);
 6748|      0|        if (overdue_ms >= 10)
  ------------------
  |  Branch (6748:13): [True: 0, False: 0]
  ------------------
 6749|      0|            DEBUGMSGT(("verbose:sess_select","timer overdue by %ld ms\n",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6750|      0|                       (long) overdue_ms));
 6751|      0|        timerclear(&earliest);
 6752|      0|    } else {
 6753|      0|        DEBUGMSGT(("verbose:sess_select","timer due in %d.%06d sec\n",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6754|      0|                   (int)earliest.tv_sec, (int)earliest.tv_usec));
 6755|      0|    }
 6756|       |
 6757|       |    /*
 6758|       |     * if it was blocking before or our delta time is less, reset timeout 
 6759|       |     */
 6760|      0|    if ((*block || (timercmp(&earliest, timeout, <)))) {
  ------------------
  |  Branch (6760:10): [True: 0, False: 0]
  |  Branch (6760:20): [True: 0, False: 0]
  |  Branch (6760:21): [True: 0, False: 0]
  ------------------
 6761|      0|        DEBUGMSGT(("verbose:sess_select",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6762|      0|                   "setting timer to %d.%06d sec, clear block (was %d)\n",
 6763|      0|                   (int)earliest.tv_sec, (int)earliest.tv_usec, *block));
 6764|      0|        *timeout = earliest;
 6765|      0|        *block = 0;
 6766|      0|    }
 6767|      0|    return active;
 6768|     65|}
snmp_oid_compare:
 7039|    417|{
 7040|    417|    register int    len;
 7041|    417|    register const oid *name1 = in_name1;
 7042|    417|    register const oid *name2 = in_name2;
 7043|       |
 7044|       |    /*
 7045|       |     * len = minimum of len1 and len2 
 7046|       |     */
 7047|    417|    if (len1 < len2)
  ------------------
  |  Branch (7047:9): [True: 0, False: 417]
  ------------------
 7048|      0|        len = len1;
 7049|    417|    else
 7050|    417|        len = len2;
 7051|       |    /*
 7052|       |     * find first non-matching OID 
 7053|       |     */
 7054|  4.30k|    while (len-- > 0) {
  ------------------
  |  Branch (7054:12): [True: 4.17k, False: 139]
  ------------------
 7055|       |        /*
 7056|       |         * these must be done in separate comparisons, since
 7057|       |         * subtracting them and using that result has problems with
 7058|       |         * subids > 2^31. 
 7059|       |         */
 7060|  4.17k|        if (*(name1) != *(name2)) {
  ------------------
  |  Branch (7060:13): [True: 278, False: 3.89k]
  ------------------
 7061|    278|            if (*(name1) < *(name2))
  ------------------
  |  Branch (7061:17): [True: 139, False: 139]
  ------------------
 7062|    139|                return -1;
 7063|    139|            return 1;
 7064|    278|        }
 7065|  3.89k|        name1++;
 7066|  3.89k|        name2++;
 7067|  3.89k|    }
 7068|       |    /*
 7069|       |     * both OIDs equal up to length of shorter OID 
 7070|       |     */
 7071|    139|    if (len1 < len2)
  ------------------
  |  Branch (7071:9): [True: 0, False: 139]
  ------------------
 7072|      0|        return -1;
 7073|    139|    if (len2 < len1)
  ------------------
  |  Branch (7073:9): [True: 0, False: 139]
  ------------------
 7074|      0|        return 1;
 7075|    139|    return 0;
 7076|    139|}
netsnmp_oid_equals:
 7176|  3.64k|{
 7177|  3.64k|    register const oid *name1 = in_name1;
 7178|  3.64k|    register const oid *name2 = in_name2;
 7179|  3.64k|    register int    len = len1;
 7180|       |
 7181|       |    /*
 7182|       |     * len = minimum of len1 and len2 
 7183|       |     */
 7184|  3.64k|    if (len1 != len2)
  ------------------
  |  Branch (7184:9): [True: 2.51k, False: 1.12k]
  ------------------
 7185|  2.51k|        return 1;
 7186|       |    /*
 7187|       |     * Handle 'null' OIDs
 7188|       |     */
 7189|  1.12k|    if (len1 == 0)
  ------------------
  |  Branch (7189:9): [True: 0, False: 1.12k]
  ------------------
 7190|      0|        return 0;   /* Two null OIDs are (trivially) the same */
 7191|  1.12k|    if (!name1 || !name2)
  ------------------
  |  Branch (7191:9): [True: 0, False: 1.12k]
  |  Branch (7191:19): [True: 0, False: 1.12k]
  ------------------
 7192|      0|        return 1;   /* Otherwise something's wrong, so report a non-match */
 7193|       |    /*
 7194|       |     * find first non-matching OID 
 7195|       |     */
 7196|  9.41k|    while (len-- > 0) {
  ------------------
  |  Branch (7196:12): [True: 9.41k, False: 0]
  ------------------
 7197|       |        /*
 7198|       |         * these must be done in separate comparisons, since
 7199|       |         * subtracting them and using that result has problems with
 7200|       |         * subids > 2^31. 
 7201|       |         */
 7202|  9.41k|        if (*(name1++) != *(name2++))
  ------------------
  |  Branch (7202:13): [True: 1.12k, False: 8.29k]
  ------------------
 7203|  1.12k|            return 1;
 7204|  9.41k|    }
 7205|      0|    return 0;
 7206|  1.12k|}
snmp_pdu_add_variable:
 7316|      3|{
 7317|      3|    return snmp_varlist_add_variable(&pdu->variables, name, name_length,
 7318|      3|                                     type, value, len);
 7319|      3|}
snmp_varlist_add_variable:
 7330|      3|{
 7331|      3|    netsnmp_variable_list *vars, *vtmp;
 7332|      3|    int rc;
 7333|       |
 7334|      3|    if (varlist == NULL)
  ------------------
  |  Branch (7334:9): [True: 0, False: 3]
  ------------------
 7335|      0|        return NULL;
 7336|       |
 7337|      3|    vars = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
  ------------------
  |  |   73|      3|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 7338|      3|    if (vars == NULL)
  ------------------
  |  Branch (7338:9): [True: 0, False: 3]
  ------------------
 7339|      0|        return NULL;
 7340|       |
 7341|      3|    vars->type = type;
 7342|       |
 7343|      3|    rc = snmp_set_var_value( vars, value, len );
 7344|      3|    if (( 0 != rc ) ||
  ------------------
  |  Branch (7344:9): [True: 0, False: 3]
  ------------------
 7345|      3|        (name != NULL && snmp_set_var_objid(vars, name, name_length))) {
  ------------------
  |  Branch (7345:10): [True: 3, False: 0]
  |  Branch (7345:26): [True: 0, False: 3]
  ------------------
 7346|      0|        snmp_free_var(vars);
 7347|      0|        return NULL;
 7348|      0|    }
 7349|       |
 7350|       |    /*
 7351|       |     * put only qualified variable onto varlist 
 7352|       |     */
 7353|      3|    if (*varlist == NULL) {
  ------------------
  |  Branch (7353:9): [True: 3, False: 0]
  ------------------
 7354|      3|        *varlist = vars;
 7355|      3|    } else {
 7356|      0|        for (vtmp = *varlist; vtmp->next_variable;
  ------------------
  |  Branch (7356:31): [True: 0, False: 0]
  ------------------
 7357|      0|             vtmp = vtmp->next_variable);
 7358|       |
 7359|      0|        vtmp->next_variable = vars;
 7360|      0|    }
 7361|       |
 7362|      3|    return vars;
 7363|      3|}
snmp_duplicate_objid:
 8002|    396|{
 8003|    396|    oid            *returnOid;
 8004|    396|    if (objToCopy != NULL && objToCopyLen != 0) {
  ------------------
  |  Branch (8004:9): [True: 396, False: 0]
  |  Branch (8004:30): [True: 396, False: 0]
  ------------------
 8005|    396|        returnOid = (oid *) malloc(objToCopyLen * sizeof(oid));
 8006|    396|        if (returnOid) {
  ------------------
  |  Branch (8006:13): [True: 396, False: 0]
  ------------------
 8007|    396|            memcpy(returnOid, objToCopy, objToCopyLen * sizeof(oid));
 8008|    396|        }
 8009|    396|    } else
 8010|      0|        returnOid = NULL;
 8011|    396|    return returnOid;
 8012|    396|}
snmp_increment_statistic:
 8022|     64|{
 8023|     64|    if (which >= 0 && which < NETSNMP_STAT_MAX_STATS) {
  ------------------
  |  |  743|     64|#define  NETSNMP_STAT_MAX_STATS              (STAT_TLSTM_STATS_END+1)
  |  |  ------------------
  |  |  |  |  739|     64|#define  STAT_TLSTM_STATS_END          STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES
  |  |  |  |  ------------------
  |  |  |  |  |  |  736|     64|#define  STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES              56
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (8023:9): [True: 64, False: 0]
  |  Branch (8023:23): [True: 64, False: 0]
  ------------------
 8024|     64|        statistics[which]++;
 8025|     64|        return statistics[which];
 8026|     64|    }
 8027|      0|    return 0;
 8028|     64|}
snmp_get_statistic:
 8042|      3|{
 8043|      3|    if (which >= 0 && which < NETSNMP_STAT_MAX_STATS)
  ------------------
  |  |  743|      3|#define  NETSNMP_STAT_MAX_STATS              (STAT_TLSTM_STATS_END+1)
  |  |  ------------------
  |  |  |  |  739|      3|#define  STAT_TLSTM_STATS_END          STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES
  |  |  |  |  ------------------
  |  |  |  |  |  |  736|      3|#define  STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES              56
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (8043:9): [True: 3, False: 0]
  |  Branch (8043:23): [True: 3, False: 0]
  ------------------
 8044|      3|        return statistics[which];
 8045|      0|    return 0;
 8046|      3|}
snmp_init_statistics:
 8050|     66|{
 8051|     66|    memset(statistics, 0, sizeof(statistics));
 8052|     66|}
snmp_api.c:_init_snmp:
  697|    198|{
  698|       |
  699|    198|    struct timeval  tv;
  700|    198|    long            tmpReqid, tmpMsgid;
  701|       |
  702|    198|    if (_init_snmp_init_done)
  ------------------
  |  Branch (702:9): [True: 132, False: 66]
  ------------------
  703|    132|        return;
  704|     66|    _init_snmp_init_done = 1;
  705|     66|    Reqid = 1;
  706|       |
  707|     66|    snmp_res_init();            /* initialize the mt locking structures */
  ------------------
  |  |   78|     66|#define snmp_res_init() do {} while (0)
  |  |  ------------------
  |  |  |  Branch (78:38): [Folded, False: 66]
  |  |  ------------------
  ------------------
  708|     66|#ifndef NETSNMP_DISABLE_MIB_LOADING
  709|     66|    netsnmp_init_mib_internals();
  710|     66|#endif /* NETSNMP_DISABLE_MIB_LOADING */
  711|     66|    netsnmp_tdomain_init();
  712|       |
  713|     66|    gettimeofday(&tv, (struct timezone *) 0);
  714|       |    /*
  715|       |     * Now = tv;
  716|       |     */
  717|       |
  718|       |    /*
  719|       |     * get pseudo-random values for request ID and message ID 
  720|       |     */
  721|     66|    netsnmp_srandom((unsigned)(tv.tv_sec ^ tv.tv_usec));
  722|     66|    tmpReqid = netsnmp_random();
  723|     66|    tmpMsgid = netsnmp_random();
  724|       |
  725|       |    /*
  726|       |     * don't allow zero value to repeat init 
  727|       |     */
  728|     66|    if (tmpReqid == 0)
  ------------------
  |  Branch (728:9): [True: 0, False: 66]
  ------------------
  729|      0|        tmpReqid = 1;
  730|     66|    if (tmpMsgid == 0)
  ------------------
  |  Branch (730:9): [True: 0, False: 66]
  ------------------
  731|      0|        tmpMsgid = 1;
  732|     66|    Reqid = tmpReqid;
  733|     66|    Msgid = tmpMsgid;
  734|       |
  735|     66|    netsnmp_register_default_domain("snmp", "udp udp6");
  736|     66|    netsnmp_register_default_domain("snmptrap", "udp udp6");
  737|       |
  738|     66|    netsnmp_register_default_target("snmp", "udp", ":161");
  739|     66|    netsnmp_register_default_target("snmp", "tcp", ":161");
  740|     66|    netsnmp_register_default_target("snmp", "udp6", ":161");
  741|     66|    netsnmp_register_default_target("snmp", "tcp6", ":161");
  742|     66|    netsnmp_register_default_target("snmp", "dtlsudp", ":10161");
  743|     66|    netsnmp_register_default_target("snmp", "tlstcp", ":10161");
  744|     66|    netsnmp_register_default_target("snmp", "ipx", "/36879");
  745|       |
  746|     66|    netsnmp_register_default_target("snmptrap", "udp", ":162");
  747|     66|    netsnmp_register_default_target("snmptrap", "tcp", ":162");
  748|     66|    netsnmp_register_default_target("snmptrap", "udp6", ":162");
  749|     66|    netsnmp_register_default_target("snmptrap", "tcp6", ":162");
  750|     66|    netsnmp_register_default_target("snmptrap", "dtlsudp", ":10162");
  751|     66|    netsnmp_register_default_target("snmptrap", "tlstcp", ":10162");
  752|     66|    netsnmp_register_default_target("snmptrap", "ipx", "/36880");
  753|       |
  754|     66|    netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  755|     66|                       NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH, 16);
  ------------------
  |  |  121|     66|#define NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH    6
  ------------------
  756|     66|    netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES,
  ------------------
  |  |  131|     66|#define NETSNMP_DS_LIB_RETRIES             15
  ------------------
  757|     66|                       DEFAULT_RETRIES);
  ------------------
  |  |  185|     66|#define DEFAULT_RETRIES	    5
  ------------------
  758|     66|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  759|     66|			   NETSNMP_DS_LIB_MIB_ERRORS, 1);
  ------------------
  |  |   59|     66|#define NETSNMP_DS_LIB_MIB_ERRORS          0
  ------------------
  760|       |
  761|     66|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
  762|     66|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  763|     66|			   NETSNMP_DS_LIB_REVERSE_ENCODE,
  ------------------
  |  |   80|     66|#define NETSNMP_DS_LIB_REVERSE_ENCODE      20   /* encode packets from back to front */
  ------------------
  764|     66|			   NETSNMP_DEFAULT_ASNENCODING_DIRECTION);
  ------------------
  |  | 1992|     66|#define NETSNMP_DEFAULT_ASNENCODING_DIRECTION 1 /* 1 = reverse, 0 = forwards */
  ------------------
  765|     66|#endif
  766|     66|}
snmp_api.c:register_default_handlers:
  795|     66|{
  796|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "dumpPacket",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  797|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DUMP_PACKET);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DUMP_PACKET);
  ------------------
  |  |   63|     66|#define NETSNMP_DS_LIB_DUMP_PACKET         4
  ------------------
  798|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "reverseEncodeBER",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  799|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_REVERSE_ENCODE);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_REVERSE_ENCODE);
  ------------------
  |  |   80|     66|#define NETSNMP_DS_LIB_REVERSE_ENCODE      20   /* encode packets from back to front */
  ------------------
  800|     66|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "defaultPort",
  ------------------
  |  |   75|     66|#define ASN_INTEGER	    0x02U
  ------------------
  801|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DEFAULT_PORT);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DEFAULT_PORT);
  ------------------
  |  |  117|     66|#define NETSNMP_DS_LIB_DEFAULT_PORT         3
  ------------------
  802|     66|#ifndef NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION
  803|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "disableSNMPv3",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  804|     66|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V3);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V3);
  ------------------
  |  |  105|     66|#define NETSNMP_DS_LIB_DISABLE_V3          45 /* disable SNMPv3 */
  ------------------
  805|     66|#endif /* NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION */
  806|     66|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
  807|     66|#ifndef NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION
  808|     66|#if !defined(NETSNMP_DISABLE_SNMPV1)
  809|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "disableSNMPv1",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  810|     66|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V1);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V1);
  ------------------
  |  |  103|     66|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  ------------------
  811|     66|#endif
  812|     66|#if !defined(NETSNMP_DISABLE_SNMPV2C)
  813|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "disableSNMPv2c",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  814|     66|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V2c);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V2c);
  ------------------
  |  |  104|     66|#define NETSNMP_DS_LIB_DISABLE_V2c         44 /* disable SNMPv2c */
  ------------------
  815|     66|#endif
  816|     66|#endif /* NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION */
  817|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defCommunity",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  818|     66|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_COMMUNITY);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_COMMUNITY);
  ------------------
  |  |  158|     66|#define NETSNMP_DS_LIB_COMMUNITY         7
  ------------------
  819|     66|#endif /* !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C) */
  820|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "noTokenWarnings",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  821|     66|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_TOKEN_WARNINGS);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_TOKEN_WARNINGS);
  ------------------
  |  |   77|     66|#define NETSNMP_DS_LIB_NO_TOKEN_WARNINGS   17   /* no warn about unknown config tokens */
  ------------------
  822|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noRangeCheck",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  823|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_CHECK_RANGE);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_CHECK_RANGE);
  ------------------
  |  |   76|     66|#define NETSNMP_DS_LIB_DONT_CHECK_RANGE    16   /* don't check values for ranges on send */
  ------------------
  824|     66|    netsnmp_ds_register_premib(ASN_OCTET_STR, "snmp", "persistentDir",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  825|     66|	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PERSISTENT_DIR);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PERSISTENT_DIR);
  ------------------
  |  |  159|     66|#define NETSNMP_DS_LIB_PERSISTENT_DIR    8
  ------------------
  826|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "tempFilePattern",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  827|     66|	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_TEMP_FILE_PATTERN);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_TEMP_FILE_PATTERN);
  ------------------
  |  |  166|     66|#define NETSNMP_DS_LIB_TEMP_FILE_PATTERN 15
  ------------------
  828|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noDisplayHint",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  829|     66|	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
  ------------------
  |  |   90|     66|#define NETSNMP_DS_LIB_NO_DISPLAY_HINT     30 /* don't apply DISPLAY-HINTs */
  ------------------
  830|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "16bitIDs",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  831|     66|	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS);
  ------------------
  |  |   91|     66|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  832|     66|    netsnmp_ds_register_premib(ASN_OCTET_STR, "snmp", "clientaddr",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  833|     66|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENT_ADDR);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENT_ADDR);
  ------------------
  |  |  165|     66|#define NETSNMP_DS_LIB_CLIENT_ADDR       14
  ------------------
  834|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "clientaddrUsesPort",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  835|     66|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT);
  ------------------
  |  |  102|     66|#define NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT 42 /* NETSNMP_DS_LIB_CLIENT_ADDR includes address and also port */
  ------------------
  836|     66|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "serverSendBuf",
  ------------------
  |  |   75|     66|#define ASN_INTEGER	    0x02U
  ------------------
  837|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SERVERSENDBUF);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SERVERSENDBUF);
  ------------------
  |  |  122|     66|#define NETSNMP_DS_LIB_SERVERSENDBUF        7 /* send buffer (server) */
  ------------------
  838|     66|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "serverRecvBuf",
  ------------------
  |  |   75|     66|#define ASN_INTEGER	    0x02U
  ------------------
  839|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SERVERRECVBUF);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SERVERRECVBUF);
  ------------------
  |  |  123|     66|#define NETSNMP_DS_LIB_SERVERRECVBUF        8 /* receive buffer (server) */
  ------------------
  840|     66|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "clientSendBuf",
  ------------------
  |  |   75|     66|#define ASN_INTEGER	    0x02U
  ------------------
  841|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENTSENDBUF);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENTSENDBUF);
  ------------------
  |  |  124|     66|#define NETSNMP_DS_LIB_CLIENTSENDBUF        9 /* send buffer (client) */
  ------------------
  842|     66|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "clientRecvBuf",
  ------------------
  |  |   75|     66|#define ASN_INTEGER	    0x02U
  ------------------
  843|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENTRECVBUF);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENTRECVBUF);
  ------------------
  |  |  125|     66|#define NETSNMP_DS_LIB_CLIENTRECVBUF       10 /* receive buffer (client) */
  ------------------
  844|     66|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "sendMessageMaxSize",
  ------------------
  |  |   75|     66|#define ASN_INTEGER	    0x02U
  ------------------
  845|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  846|     66|                               NETSNMP_DS_LIB_MSG_SEND_MAX);
  ------------------
  |  |  132|     66|#define NETSNMP_DS_LIB_MSG_SEND_MAX        16 /* global max response size */
  ------------------
  847|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noPersistentLoad",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  848|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD);
  ------------------
  |  |   95|     66|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD  35 /* don't load persistent file */
  ------------------
  849|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noPersistentSave",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  850|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE);
  ------------------
  |  |   96|     66|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE  36 /* don't save persistent file */
  ------------------
  851|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  852|     66|                               "noContextEngineIDDiscovery",
  853|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  854|     66|                               NETSNMP_DS_LIB_NO_DISCOVERY);
  ------------------
  |  |   98|     66|#define NETSNMP_DS_LIB_NO_DISCOVERY        38 /* don't support RFC5343 contextEngineID discovery */
  ------------------
  855|     66|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "timeout",
  ------------------
  |  |   75|     66|#define ASN_INTEGER	    0x02U
  ------------------
  856|     66|		               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_TIMEOUT);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_TIMEOUT);
  ------------------
  |  |  130|     66|#define NETSNMP_DS_LIB_TIMEOUT             14
  ------------------
  857|     66|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "retries",
  ------------------
  |  |   75|     66|#define ASN_INTEGER	    0x02U
  ------------------
  858|     66|		               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES);
  ------------------
  |  |  131|     66|#define NETSNMP_DS_LIB_RETRIES             15
  ------------------
  859|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "outputPrecision",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  860|     66|                               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OUTPUT_PRECISION);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                             NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OUTPUT_PRECISION);
  ------------------
  |  |  186|     66|#define NETSNMP_DS_LIB_OUTPUT_PRECISION  35
  ------------------
  861|       |
  862|       |
  863|     66|    netsnmp_register_service_handlers();
  864|     66|}
snmp_api.c:snmp_sess_copy:
 1366|     66|{
 1367|     66|    struct session_list *psl;
 1368|     66|    psl = _sess_copy(pss);
 1369|     66|    if (!psl) {
  ------------------
  |  Branch (1369:9): [True: 0, False: 66]
  ------------------
 1370|      0|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (1370:13): [True: 0, False: 0]
  ------------------
 1371|      0|            pss->s_snmp_errno = SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1372|      0|        }
 1373|      0|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   56|      0|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 1374|      0|    }
 1375|     66|    return psl;
 1376|     66|}
snmp_api.c:_sess_copy:
 1093|     66|{
 1094|     66|    struct session_list *slp;
 1095|     66|    struct snmp_internal_session *isp;
 1096|     66|    netsnmp_session *session;
 1097|     66|    struct snmp_secmod_def *sptr;
 1098|     66|    char           *cp;
 1099|     66|    u_char         *ucp;
 1100|       |
 1101|     66|    in_session->s_snmp_errno = 0;
 1102|     66|    in_session->s_errno = 0;
 1103|       |
 1104|       |    /*
 1105|       |     * Copy session structure and link into list 
 1106|       |     */
 1107|     66|    slp = calloc(1, sizeof(struct session_list));
 1108|     66|    if (slp == NULL) {
  ------------------
  |  Branch (1108:9): [True: 0, False: 66]
  ------------------
 1109|      0|        in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1110|      0|        return (NULL);
 1111|      0|    }
 1112|       |
 1113|     66|    slp->transport = NULL;
 1114|       |
 1115|     66|    isp = calloc(1, sizeof(struct snmp_internal_session));
 1116|       |
 1117|     66|    if (isp == NULL) {
  ------------------
  |  Branch (1117:9): [True: 0, False: 66]
  ------------------
 1118|      0|        snmp_sess_close(slp);
 1119|      0|        in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1120|      0|        return (NULL);
 1121|      0|    }
 1122|       |
 1123|     66|    slp->internal = isp;
 1124|     66|    slp->session = netsnmp_memdup(in_session, sizeof(netsnmp_session));
 1125|     66|    if (slp->session == NULL) {
  ------------------
  |  Branch (1125:9): [True: 0, False: 66]
  ------------------
 1126|      0|        snmp_sess_close(slp);
 1127|      0|        in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1128|      0|        return (NULL);
 1129|      0|    }
 1130|     66|    session = slp->session;
 1131|       |
 1132|       |    /*
 1133|       |     * zero out pointers so if we have to free the session we wont free mem
 1134|       |     * owned by in_session 
 1135|       |     */
 1136|     66|    session->localname = NULL;
 1137|     66|    session->peername = NULL;
 1138|     66|    session->community = NULL;
 1139|     66|    session->contextEngineID = NULL;
 1140|     66|    session->contextName = NULL;
 1141|     66|    session->securityEngineID = NULL;
 1142|     66|    session->securityName = NULL;
 1143|     66|    session->securityAuthProto = NULL;
 1144|     66|    session->securityAuthLocalKey = NULL;
 1145|     66|    session->securityPrivProto = NULL;
 1146|     66|    session->securityPrivLocalKey = NULL;
 1147|     66|    session->sessUser = NULL;
 1148|       |    /*
 1149|       |     * session now points to the new structure that still contains pointers to
 1150|       |     * data allocated elsewhere.  Some of this data is copied to space malloc'd
 1151|       |     * here, and the pointer replaced with the new one.
 1152|       |     */
 1153|       |
 1154|     66|    if (in_session->peername != NULL) {
  ------------------
  |  Branch (1154:9): [True: 0, False: 66]
  ------------------
 1155|      0|        session->peername =
 1156|      0|            netsnmp_strdup_and_null((u_char*)in_session->peername,
 1157|      0|                                    strlen(in_session->peername));
 1158|      0|        if (session->peername == NULL) {
  ------------------
  |  Branch (1158:13): [True: 0, False: 0]
  ------------------
 1159|      0|            snmp_sess_close(slp);
 1160|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1161|      0|            return (NULL);
 1162|      0|        }
 1163|      0|    }
 1164|       |
 1165|       |    /*
 1166|       |     * Fill in defaults if necessary 
 1167|       |     */
 1168|     66|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 1169|     66|    if (in_session->community_len != SNMP_DEFAULT_COMMUNITY_LEN) {
  ------------------
  |  |  111|     66|#define SNMP_DEFAULT_COMMUNITY_LEN  0   /* to get a default community name */
  ------------------
  |  Branch (1169:9): [True: 0, False: 66]
  ------------------
 1170|      0|        ucp = netsnmp_memdup(in_session->community, in_session->community_len);
 1171|     66|    } else {
 1172|     66|        if ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1172:13): [True: 0, False: 66]
  ------------------
 1173|     66|					NETSNMP_DS_LIB_COMMUNITY)) != NULL) {
  ------------------
  |  |  158|     66|#define NETSNMP_DS_LIB_COMMUNITY         7
  ------------------
 1174|      0|            session->community_len = strlen(cp);
 1175|      0|            ucp = (u_char *) strdup(cp);
 1176|     66|        } else {
 1177|       |#ifdef NETSNMP_NO_ZEROLENGTH_COMMUNITY
 1178|       |            session->community_len = strlen(DEFAULT_COMMUNITY);
 1179|       |            ucp = netsnmp_memdup(DEFAULT_COMMUNITY, session->community_len);
 1180|       |#else
 1181|     66|            ucp = (u_char *) strdup("");
 1182|     66|#endif
 1183|     66|        }
 1184|     66|    }
 1185|       |
 1186|     66|    if (ucp == NULL) {
  ------------------
  |  Branch (1186:9): [True: 0, False: 66]
  ------------------
 1187|      0|        snmp_sess_close(slp);
 1188|      0|        in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1189|      0|        return (NULL);
 1190|      0|    }
 1191|     66|    session->community = ucp;   /* replace pointer with pointer to new data */
 1192|     66|#endif
 1193|       |
 1194|     66|    if (session->securityLevel <= 0) {
  ------------------
  |  Branch (1194:9): [True: 66, False: 0]
  ------------------
 1195|     66|        session->securityLevel =
 1196|     66|            netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECLEVEL);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                          netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECLEVEL);
  ------------------
  |  |  115|     66|#define NETSNMP_DS_LIB_SECLEVEL             1
  ------------------
 1197|     66|    }
 1198|       |
 1199|     66|    if (in_session->securityEngineIDLen > 0) {
  ------------------
  |  Branch (1199:9): [True: 0, False: 66]
  ------------------
 1200|      0|        ucp = netsnmp_memdup(in_session->securityEngineID,
 1201|      0|                             in_session->securityEngineIDLen);
 1202|      0|        if (ucp == NULL) {
  ------------------
  |  Branch (1202:13): [True: 0, False: 0]
  ------------------
 1203|      0|            snmp_sess_close(slp);
 1204|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1205|      0|            return (NULL);
 1206|      0|        }
 1207|      0|        session->securityEngineID = ucp;
 1208|       |
 1209|      0|    }
 1210|       |
 1211|     66|    if (in_session->contextEngineIDLen > 0) {
  ------------------
  |  Branch (1211:9): [True: 0, False: 66]
  ------------------
 1212|      0|        ucp = netsnmp_memdup(in_session->contextEngineID,
 1213|      0|                             in_session->contextEngineIDLen);
 1214|      0|        if (ucp == NULL) {
  ------------------
  |  Branch (1214:13): [True: 0, False: 0]
  ------------------
 1215|      0|            snmp_sess_close(slp);
 1216|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1217|      0|            return (NULL);
 1218|      0|        }
 1219|      0|        session->contextEngineID = ucp;
 1220|     66|    } else if (in_session->securityEngineIDLen > 0) {
  ------------------
  |  Branch (1220:16): [True: 0, False: 66]
  ------------------
 1221|       |        /*
 1222|       |         * default contextEngineID to securityEngineIDLen if defined 
 1223|       |         */
 1224|      0|        ucp = netsnmp_memdup(in_session->securityEngineID,
 1225|      0|                             in_session->securityEngineIDLen);
 1226|      0|        if (ucp == NULL) {
  ------------------
  |  Branch (1226:13): [True: 0, False: 0]
  ------------------
 1227|      0|            snmp_sess_close(slp);
 1228|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1229|      0|            return (NULL);
 1230|      0|        }
 1231|      0|        session->contextEngineID = ucp;
 1232|      0|        session->contextEngineIDLen = in_session->securityEngineIDLen;
 1233|      0|    }
 1234|       |
 1235|     66|    if (in_session->contextName) {
  ------------------
  |  Branch (1235:9): [True: 0, False: 66]
  ------------------
 1236|      0|        session->contextName = strdup(in_session->contextName);
 1237|      0|        if (session->contextName == NULL) {
  ------------------
  |  Branch (1237:13): [True: 0, False: 0]
  ------------------
 1238|      0|            snmp_sess_close(slp);
 1239|      0|            return (NULL);
 1240|      0|        }
 1241|      0|        session->contextNameLen = in_session->contextNameLen;
 1242|     66|    } else {
 1243|     66|        if ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1243:13): [True: 0, False: 66]
  ------------------
 1244|     66|                                        NETSNMP_DS_LIB_CONTEXT)) != NULL)
  ------------------
  |  |  152|     66|#define NETSNMP_DS_LIB_CONTEXT           1
  ------------------
 1245|      0|            cp = strdup(cp);
 1246|     66|        else
 1247|     66|            cp = strdup(SNMP_DEFAULT_CONTEXT);
  ------------------
  |  |  125|     66|#define SNMP_DEFAULT_CONTEXT        ""
  ------------------
 1248|     66|        if (cp == NULL) {
  ------------------
  |  Branch (1248:13): [True: 0, False: 66]
  ------------------
 1249|      0|            snmp_sess_close(slp);
 1250|      0|            return (NULL);
 1251|      0|        }
 1252|     66|        session->contextName = cp;
 1253|     66|        session->contextNameLen = strlen(cp);
 1254|     66|    }
 1255|       |
 1256|     66|    if (in_session->securityName) {
  ------------------
  |  Branch (1256:9): [True: 0, False: 66]
  ------------------
 1257|      0|        session->securityName = strdup(in_session->securityName);
 1258|      0|        if (session->securityName == NULL) {
  ------------------
  |  Branch (1258:13): [True: 0, False: 0]
  ------------------
 1259|      0|            snmp_sess_close(slp);
 1260|      0|            return (NULL);
 1261|      0|        }
 1262|     66|    } else if ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1262:16): [True: 0, False: 66]
  ------------------
 1263|     66|					   NETSNMP_DS_LIB_SECNAME)) != NULL) {
  ------------------
  |  |  151|     66|#define NETSNMP_DS_LIB_SECNAME           0
  ------------------
 1264|      0|        cp = strdup(cp);
 1265|      0|        if (cp == NULL) {
  ------------------
  |  Branch (1265:13): [True: 0, False: 0]
  ------------------
 1266|      0|            snmp_sess_close(slp);
 1267|      0|            return (NULL);
 1268|      0|        }
 1269|      0|        session->securityName = cp;
 1270|      0|        session->securityNameLen = strlen(cp);
 1271|      0|    }
 1272|       |
 1273|     66|    if (in_session->securityAuthLocalKey) {
  ------------------
  |  Branch (1273:9): [True: 0, False: 66]
  ------------------
 1274|      0|            session->securityAuthLocalKey =
 1275|      0|                netsnmp_memdup(in_session->securityAuthLocalKey,
 1276|      0|                               in_session->securityAuthLocalKeyLen);
 1277|      0|            session->securityAuthLocalKeyLen =
 1278|      0|                in_session->securityAuthLocalKeyLen;
 1279|      0|    }
 1280|       |
 1281|     66|    if (in_session->securityPrivLocalKey) {
  ------------------
  |  Branch (1281:9): [True: 0, False: 66]
  ------------------
 1282|      0|            session->securityPrivLocalKey =
 1283|      0|                netsnmp_memdup(in_session->securityPrivLocalKey,
 1284|      0|                               in_session->securityPrivLocalKeyLen);
 1285|      0|            session->securityPrivLocalKeyLen =
 1286|      0|                in_session->securityPrivLocalKeyLen;
 1287|      0|    }
 1288|       |
 1289|     66|    if (session->transport_configuration) {
  ------------------
  |  Branch (1289:9): [True: 0, False: 66]
  ------------------
 1290|      0|        session->transport_configuration =
 1291|      0|            CONTAINER_DUP(session->transport_configuration, NULL, 0);
 1292|      0|        if (!session->transport_configuration) {
  ------------------
  |  Branch (1292:13): [True: 0, False: 0]
  ------------------
 1293|      0|            snmp_sess_close(slp);
 1294|      0|            return NULL;
 1295|      0|        }
 1296|      0|    }
 1297|       |
 1298|     66|    if (session->retries == SNMP_DEFAULT_RETRIES) {
  ------------------
  |  |  112|     66|#define SNMP_DEFAULT_RETRIES	    -1
  ------------------
  |  Branch (1298:9): [True: 66, False: 0]
  ------------------
 1299|     66|        int retry = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1300|     66|                                       NETSNMP_DS_LIB_RETRIES);
  ------------------
  |  |  131|     66|#define NETSNMP_DS_LIB_RETRIES             15
  ------------------
 1301|     66|        if (retry < 0)
  ------------------
  |  Branch (1301:13): [True: 0, False: 66]
  ------------------
 1302|      0|            session->retries = DEFAULT_RETRIES;
  ------------------
  |  |  185|      0|#define DEFAULT_RETRIES	    5
  ------------------
 1303|     66|        else
 1304|     66|            session->retries = retry;
 1305|     66|    }
 1306|     66|    if (session->timeout == SNMP_DEFAULT_TIMEOUT) {
  ------------------
  |  |  113|     66|#define SNMP_DEFAULT_TIMEOUT	    -1
  ------------------
  |  Branch (1306:9): [True: 66, False: 0]
  ------------------
 1307|     66|        int timeout = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1308|     66|                                         NETSNMP_DS_LIB_TIMEOUT);
  ------------------
  |  |  130|     66|#define NETSNMP_DS_LIB_TIMEOUT             14
  ------------------
 1309|     66|        if (timeout <= 0)
  ------------------
  |  Branch (1309:13): [True: 66, False: 0]
  ------------------
 1310|     66|            session->timeout = DEFAULT_TIMEOUT;
  ------------------
  |  |  186|     66|#define DEFAULT_TIMEOUT	    (1000L * 1000L)
  ------------------
 1311|      0|        else
 1312|      0|            session->timeout = timeout * 1000L * 1000L;
 1313|     66|    }
 1314|     66|    session->sessid = snmp_get_next_sessid();
 1315|       |
 1316|     66|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SESSION_INIT,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
                  snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SESSION_INIT,
  ------------------
  |  |   29|     66|#define SNMP_CALLBACK_SESSION_INIT		5
  ------------------
 1317|     66|                        session);
 1318|       |
 1319|     66|    if ((sptr = find_sec_mod(session->securityModel)) != NULL) {
  ------------------
  |  Branch (1319:9): [True: 66, False: 0]
  ------------------
 1320|       |        /*
 1321|       |         * security module specific copying 
 1322|       |         */
 1323|     66|        if (sptr->session_setup) {
  ------------------
  |  Branch (1323:13): [True: 66, False: 0]
  ------------------
 1324|     66|            int ret = (*sptr->session_setup) (in_session, session);
 1325|     66|            if (ret != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (1325:17): [True: 0, False: 66]
  ------------------
 1326|      0|                snmp_sess_close(slp);
 1327|      0|                return NULL;
 1328|      0|            }
 1329|     66|        }
 1330|       |
 1331|       |        /*
 1332|       |         * security module specific opening
 1333|       |         */
 1334|     66|        if (sptr->session_open) {
  ------------------
  |  Branch (1334:13): [True: 0, False: 66]
  ------------------
 1335|      0|            int ret = (*sptr->session_open) (session);
 1336|      0|            if (ret != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (1336:17): [True: 0, False: 0]
  ------------------
 1337|      0|                snmp_sess_close(slp);
 1338|      0|                return NULL;
 1339|      0|            }
 1340|      0|        }
 1341|     66|    }
 1342|       |
 1343|     66|#ifndef NETSNMP_NO_WRITE_SUPPORT
 1344|     66|    if (in_session->sessUser) {
  ------------------
  |  Branch (1344:9): [True: 0, False: 66]
  ------------------
 1345|      0|        struct usmUser *user;
 1346|       |
 1347|      0|        user = calloc(1, sizeof(struct usmUser));
 1348|      0|        if (user == NULL) {
  ------------------
  |  Branch (1348:13): [True: 0, False: 0]
  ------------------
 1349|      0|            snmp_sess_close(slp);
 1350|      0|            return NULL;
 1351|      0|        }
 1352|      0|        session->sessUser = usm_cloneFrom_user(in_session->sessUser, user);
 1353|      0|    }
 1354|     66|#endif /* NETSNMP_NO_WRITE_SUPPORT */
 1355|       |
 1356|       |    /* Anything below this point should only be done if the transport
 1357|       |       had no say in the matter */
 1358|     66|    if (session->securityLevel == 0)
  ------------------
  |  Branch (1358:9): [True: 66, False: 0]
  ------------------
 1359|     66|        session->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|     66|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 1360|       |
 1361|     66|    return (slp);
 1362|     66|}
snmp_api.c:netsnmp_free_transport_config:
 1990|     66|{
 1991|     66|    if (!tc)
  ------------------
  |  Branch (1991:9): [True: 66, False: 0]
  ------------------
 1992|     66|        return;
 1993|       |
 1994|      0|    CONTAINER_CLEAR(tc, netsnmp_free_one_tr_cfg, NULL);
 1995|      0|    CONTAINER_FREE(tc);
 1996|      0|}
snmp_api.c:snmp_free_session:
 2029|     66|{
 2030|     66|    if (!s)
  ------------------
  |  Branch (2030:9): [True: 0, False: 66]
  ------------------
 2031|      0|        return;
 2032|       |
 2033|     66|    netsnmp_cleanup_session(s);
 2034|       |
 2035|       |    /*
 2036|       |     * clear session from any callbacks
 2037|       |     */
 2038|     66|    netsnmp_callback_clear_client_arg(s, 0, 0);
 2039|       |
 2040|     66|    free(s);
 2041|     66|}
snmp_api.c:snmpv3_calc_msg_flags:
 2173|      3|{
 2174|      3|    *flags = 0;
 2175|      3|    if (sec_level == SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|      3|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (2175:9): [True: 0, False: 3]
  ------------------
 2176|      0|        *flags = SNMP_MSG_FLAG_AUTH_BIT;
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
 2177|      3|    else if (sec_level == SNMP_SEC_LEVEL_AUTHPRIV)
  ------------------
  |  |  301|      3|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2177:14): [True: 0, False: 3]
  ------------------
 2178|      0|        *flags = SNMP_MSG_FLAG_AUTH_BIT | SNMP_MSG_FLAG_PRIV_BIT;
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
                      *flags = SNMP_MSG_FLAG_AUTH_BIT | SNMP_MSG_FLAG_PRIV_BIT;
  ------------------
  |  |  304|      0|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
 2179|       |
 2180|      3|    if (SNMP_CMD_CONFIRMED(msg_command))
  ------------------
  |  |  193|      3|#define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
  |  |  ------------------
  |  |  |  |  141|      6|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      3|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
  |  |  ------------------
  |  |  |  |  140|      6|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      3|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (193:32): [True: 0, False: 3]
  |  |  |  Branch (193:56): [True: 0, False: 3]
  |  |  ------------------
  |  |  194|      3|                               c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
  |  |  ------------------
  |  |  |  |  126|      6|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      3|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                              c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
  |  |  ------------------
  |  |  |  |  125|      6|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      3|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (194:32): [True: 0, False: 3]
  |  |  |  Branch (194:57): [True: 0, False: 3]
  |  |  ------------------
  |  |  195|      3|                               c == SNMP_MSG_SET )
  |  |  ------------------
  |  |  |  |  129|      6|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      3|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (195:32): [True: 0, False: 3]
  |  |  ------------------
  ------------------
 2181|      0|        *flags |= SNMP_MSG_FLAG_RPRT_BIT;
  ------------------
  |  |  305|      0|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 2182|       |
 2183|      3|    return;
 2184|      3|}
snmp_api.c:_snmp_build:
 2941|      3|{
 2942|      3|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 2943|      3|    u_char         *h0e = NULL;
 2944|      3|    size_t          start_offset = *offset;
 2945|      3|    long            version;
 2946|      3|    int             rc = 0;
 2947|      3|    size_t          length;
 2948|      3|#endif /* support for community based SNMP */
 2949|       |
 2950|      3|    u_char         *cp;
 2951|       |
 2952|      3|    if (NETSNMP_RUNTIME_PROTOCOL_SKIP(pdu->version)) {
  ------------------
  |  |  246|      3|    (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||        \
  |  |  ------------------
  |  |  |  |  205|      6|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|      6|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  206|      6|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (206:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  207|      0|                            NETSNMP_DS_LIB_DISABLE_V1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|      0|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  247|      3|     NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver) ||        \
  |  |  ------------------
  |  |  |  |  215|      6|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|      6|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  216|      6|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (216:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  217|      0|                            NETSNMP_DS_LIB_DISABLE_V2c))
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|#define NETSNMP_DS_LIB_DISABLE_V2c         44 /* disable SNMPv2c */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  248|      3|     NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver))
  |  |  ------------------
  |  |  |  |  229|      3|    ((pc_ver == SNMP_VERSION_3) &&                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|      3|#define SNMP_VERSION_3     3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (229:6): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  230|      3|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      3|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (230:6): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  231|      3|                            NETSNMP_DS_LIB_DISABLE_V3))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|      3|#define NETSNMP_DS_LIB_DISABLE_V3          45 /* disable SNMPv3 */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2953|      0|        DEBUGMSGTL(("snmp_send", "build packet (version 0x%02x disabled)\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]
  |  |  ------------------
  ------------------
 2954|      0|                    (u_int)pdu->version));
 2955|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 2956|      0|        return -1;
 2957|      0|    }
 2958|       |
 2959|      3|    session->s_snmp_errno = 0;
 2960|      3|    session->s_errno = 0;
 2961|       |
 2962|      3|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 2963|      3|    if ((pdu->flags & UCD_MSG_FLAG_BULK_TOOBIG) ||
  ------------------
  |  |  321|      3|#define UCD_MSG_FLAG_BULK_TOOBIG          0x010000
  ------------------
  |  Branch (2963:9): [True: 0, False: 3]
  ------------------
 2964|      3|        (0 == netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      3|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (2964:9): [True: 0, False: 3]
  ------------------
 2965|      3|                                     NETSNMP_DS_LIB_REVERSE_ENCODE))) {
  ------------------
  |  |   80|      3|#define NETSNMP_DS_LIB_REVERSE_ENCODE      20   /* encode packets from back to front */
  ------------------
 2966|      0|        pdu->flags |= UCD_MSG_FLAG_FORWARD_ENCODE;
  ------------------
  |  |  319|      0|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
 2967|      0|    }
 2968|      3|#endif /* NETSNMP_USE_REVERSE_ASNENCODING */
 2969|       |
 2970|      3|    if (pdu->version == SNMP_VERSION_3) {
  ------------------
  |  |  113|      3|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (2970:9): [True: 3, False: 0]
  ------------------
 2971|      3|        return snmpv3_build(pkt, pkt_len, offset, session, pdu);
 2972|      3|    }
 2973|       |
 2974|      0|    switch (pdu->command) {
 2975|      0|    case SNMP_MSG_RESPONSE:
  ------------------
  |  |  127|      0|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2975:5): [True: 0, False: 0]
  ------------------
 2976|      0|        netsnmp_assert(0 == (pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE));
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2977|      0|#ifndef NETSNMP_NOTIFY_ONLY
 2978|      0|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 2979|      0|    case SNMP_MSG_GET:
  ------------------
  |  |  125|      0|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2979:5): [True: 0, False: 0]
  ------------------
 2980|      0|    case SNMP_MSG_GETNEXT:
  ------------------
  |  |  126|      0|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2980:5): [True: 0, False: 0]
  ------------------
 2981|      0|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 2982|      0|#endif /* ! NETSNMP_NOTIFY_ONLY */
 2983|      0|#ifndef NETSNMP_NO_WRITE_SUPPORT
 2984|      0|    case SNMP_MSG_SET:
  ------------------
  |  |  129|      0|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2984:5): [True: 0, False: 0]
  ------------------
 2985|      0|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 2986|       |        /*
 2987|       |         * all versions support these PDU types 
 2988|       |         */
 2989|       |        /*
 2990|       |         * initialize defaulted PDU fields 
 2991|       |         */
 2992|       |
 2993|      0|        if (pdu->errstat == SNMP_DEFAULT_ERRSTAT)
  ------------------
  |  |  117|      0|#define SNMP_DEFAULT_ERRSTAT	    -1
  ------------------
  |  Branch (2993:13): [True: 0, False: 0]
  ------------------
 2994|      0|            pdu->errstat = 0;
 2995|      0|        if (pdu->errindex == SNMP_DEFAULT_ERRINDEX)
  ------------------
  |  |  118|      0|#define SNMP_DEFAULT_ERRINDEX	    -1
  ------------------
  |  Branch (2995:13): [True: 0, False: 0]
  ------------------
 2996|      0|            pdu->errindex = 0;
 2997|      0|        break;
 2998|       |
 2999|      0|    case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|      0|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2999:5): [True: 0, False: 0]
  ------------------
 3000|      0|        netsnmp_assert(0 == (pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE));
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3001|      0|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 3002|      0|    case SNMP_MSG_INFORM:
  ------------------
  |  |  141|      0|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3002:5): [True: 0, False: 0]
  ------------------
 3003|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3004|       |        /*
 3005|       |         * not supported in SNMPv1 and SNMPsec 
 3006|       |         */
 3007|      0|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3007:13): [True: 0, False: 0]
  ------------------
 3008|      0|            session->s_snmp_errno = SNMPERR_V2_IN_V1;
  ------------------
  |  |  224|      0|#define SNMPERR_V2_IN_V1		(-7)
  ------------------
 3009|      0|            return -1;
 3010|      0|        }
 3011|      0|#endif
 3012|      0|        if (pdu->errstat == SNMP_DEFAULT_ERRSTAT)
  ------------------
  |  |  117|      0|#define SNMP_DEFAULT_ERRSTAT	    -1
  ------------------
  |  Branch (3012:13): [True: 0, False: 0]
  ------------------
 3013|      0|            pdu->errstat = 0;
 3014|      0|        if (pdu->errindex == SNMP_DEFAULT_ERRINDEX)
  ------------------
  |  |  118|      0|#define SNMP_DEFAULT_ERRINDEX	    -1
  ------------------
  |  Branch (3014:13): [True: 0, False: 0]
  ------------------
 3015|      0|            pdu->errindex = 0;
 3016|      0|        break;
 3017|       |
 3018|      0|#ifndef NETSNMP_NOTIFY_ONLY
 3019|      0|    case SNMP_MSG_GETBULK:
  ------------------
  |  |  140|      0|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3019:5): [True: 0, False: 0]
  ------------------
 3020|       |        /*
 3021|       |         * not supported in SNMPv1 and SNMPsec 
 3022|       |         */
 3023|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3024|      0|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3024:13): [True: 0, False: 0]
  ------------------
 3025|      0|            session->s_snmp_errno = SNMPERR_V2_IN_V1;
  ------------------
  |  |  224|      0|#define SNMPERR_V2_IN_V1		(-7)
  ------------------
 3026|      0|            return -1;
 3027|      0|        }
 3028|      0|#endif
 3029|      0|        if (pdu->max_repetitions < 0) {
  ------------------
  |  |  147|      0|#define max_repetitions errindex
  ------------------
  |  Branch (3029:13): [True: 0, False: 0]
  ------------------
 3030|      0|            session->s_snmp_errno = SNMPERR_BAD_REPETITIONS;
  ------------------
  |  |  227|      0|#define SNMPERR_BAD_REPETITIONS		(-10)
  ------------------
 3031|      0|            return -1;
 3032|      0|        }
 3033|      0|        if (pdu->non_repeaters < 0) {
  ------------------
  |  |  146|      0|#define non_repeaters	errstat
  ------------------
  |  Branch (3033:13): [True: 0, False: 0]
  ------------------
 3034|      0|            session->s_snmp_errno = SNMPERR_BAD_REPEATERS;
  ------------------
  |  |  226|      0|#define SNMPERR_BAD_REPEATERS		(-9)
  ------------------
 3035|      0|            return -1;
 3036|      0|        }
 3037|      0|        break;
 3038|      0|#endif /* ! NETSNMP_NOTIFY_ONLY */
 3039|       |
 3040|      0|    case SNMP_MSG_TRAP:
  ------------------
  |  |  135|      0|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3040:5): [True: 0, False: 0]
  ------------------
 3041|       |        /*
 3042|       |         * *only* supported in SNMPv1 and SNMPsec 
 3043|       |         */
 3044|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3045|      0|        if (pdu->version != SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3045:13): [True: 0, False: 0]
  ------------------
 3046|      0|            session->s_snmp_errno = SNMPERR_V1_IN_V2;
  ------------------
  |  |  225|      0|#define SNMPERR_V1_IN_V2		(-8)
  ------------------
 3047|      0|            return -1;
 3048|      0|        }
 3049|      0|#endif
 3050|       |        /*
 3051|       |         * initialize defaulted Trap PDU fields 
 3052|       |         */
 3053|      0|        pdu->reqid = 1;         /* give a bogus non-error reqid for traps */
 3054|      0|        if (pdu->enterprise_length == SNMP_DEFAULT_ENTERPRISE_LENGTH) {
  ------------------
  |  |  121|      0|#define SNMP_DEFAULT_ENTERPRISE_LENGTH	0
  ------------------
  |  Branch (3054:13): [True: 0, False: 0]
  ------------------
 3055|      0|            pdu->enterprise = netsnmp_memdup(DEFAULT_ENTERPRISE,
  ------------------
  |  |  188|      0|#define DEFAULT_ENTERPRISE  default_enterprise
  ------------------
 3056|      0|                                             sizeof(DEFAULT_ENTERPRISE));
  ------------------
  |  |  188|      0|#define DEFAULT_ENTERPRISE  default_enterprise
  ------------------
 3057|      0|            if (pdu->enterprise == NULL) {
  ------------------
  |  Branch (3057:17): [True: 0, False: 0]
  ------------------
 3058|      0|                session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3059|      0|                return -1;
 3060|      0|            }
 3061|      0|            pdu->enterprise_length =
 3062|      0|                OID_LENGTH(DEFAULT_ENTERPRISE);
  ------------------
  |  |   64|      0|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      0|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 3063|      0|        }
 3064|      0|        if (pdu->time == SNMP_DEFAULT_TIME)
  ------------------
  |  |  122|      0|#define SNMP_DEFAULT_TIME	    0
  ------------------
  |  Branch (3064:13): [True: 0, False: 0]
  ------------------
 3065|      0|            pdu->time = DEFAULT_TIME;
  ------------------
  |  |  189|      0|#define DEFAULT_TIME	    0
  ------------------
 3066|       |        /*
 3067|       |         * don't expect a response 
 3068|       |         */
 3069|      0|        pdu->flags &= (~UCD_MSG_FLAG_EXPECT_RESPONSE);
  ------------------
  |  |  312|      0|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
 3070|      0|        break;
 3071|       |
 3072|      0|    case SNMP_MSG_REPORT:      /* SNMPv3 only */
  ------------------
  |  |  147|      0|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3072:5): [True: 0, False: 0]
  ------------------
 3073|      0|    default:
  ------------------
  |  Branch (3073:5): [True: 0, False: 0]
  ------------------
 3074|      0|        session->s_snmp_errno = SNMPERR_UNKNOWN_PDU;
  ------------------
  |  |  240|      0|#define SNMPERR_UNKNOWN_PDU		(-23)
  ------------------
 3075|      0|        return -1;
 3076|      0|    }
 3077|       |
 3078|       |    /*
 3079|       |     * save length 
 3080|       |     */
 3081|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 3082|      0|    length = *pkt_len;
 3083|      0|#endif
 3084|       |
 3085|       |    /*
 3086|       |     * setup administrative fields based on version 
 3087|       |     */
 3088|       |    /*
 3089|       |     * build the message wrapper and all the administrative fields
 3090|       |     * upto the PDU sequence
 3091|       |     * (note that actual length of message will be inserted later) 
 3092|       |     */
 3093|      0|    switch (pdu->version) {
 3094|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3095|      0|    case SNMP_VERSION_1:
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3095:5): [True: 0, False: 0]
  ------------------
 3096|      0|#endif
 3097|      0|#ifndef NETSNMP_DISABLE_SNMPV2C
 3098|      0|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|      0|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (3098:5): [True: 0, False: 0]
  ------------------
 3099|      0|#endif
 3100|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 3101|       |#ifdef NETSNMP_NO_ZEROLENGTH_COMMUNITY
 3102|       |        if (pdu->community_len == 0) {
 3103|       |            if (session->community_len == 0) {
 3104|       |                session->s_snmp_errno = SNMPERR_BAD_COMMUNITY;
 3105|       |                return -1;
 3106|       |            }
 3107|       |            pdu->community = netsnmp_memdup(session->community,
 3108|       |                                            session->community_len);
 3109|       |            if (pdu->community == NULL) {
 3110|       |                session->s_snmp_errno = SNMPERR_MALLOC;
 3111|       |                return -1;
 3112|       |            }
 3113|       |            pdu->community_len = session->community_len;
 3114|       |        }
 3115|       |#else                           /* !NETSNMP_NO_ZEROLENGTH_COMMUNITY */
 3116|      0|        if (pdu->community_len == 0 && pdu->command != SNMP_MSG_RESPONSE) {
  ------------------
  |  |  127|      0|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3116:13): [True: 0, False: 0]
  |  Branch (3116:40): [True: 0, False: 0]
  ------------------
 3117|       |            /*
 3118|       |             * copy session community exactly to pdu community 
 3119|       |             */
 3120|      0|            if (0 == session->community_len) {
  ------------------
  |  Branch (3120:17): [True: 0, False: 0]
  ------------------
 3121|      0|                SNMP_FREE(pdu->community);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 3122|      0|            } else if (pdu->community_len == session->community_len) {
  ------------------
  |  Branch (3122:24): [True: 0, False: 0]
  ------------------
 3123|      0|                memmove(pdu->community,
 3124|      0|                        session->community, session->community_len);
 3125|      0|            } else {
 3126|      0|                SNMP_FREE(pdu->community);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 3127|      0|                pdu->community = netsnmp_memdup(session->community,
 3128|      0|                                                session->community_len);
 3129|      0|                if (pdu->community == NULL) {
  ------------------
  |  Branch (3129:21): [True: 0, False: 0]
  ------------------
 3130|      0|                    session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3131|      0|                    return -1;
 3132|      0|                }
 3133|      0|            }
 3134|      0|            pdu->community_len = session->community_len;
 3135|      0|        }
 3136|      0|#endif                          /* !NETSNMP_NO_ZEROLENGTH_COMMUNITY */
 3137|       |
 3138|      0|        DEBUGMSGTL(("snmp_send", "Building SNMPv%ld message...\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]
  |  |  ------------------
  ------------------
 3139|      0|                    (1 + pdu->version)));
 3140|      0|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 3141|      0|        if (!(pdu->flags & UCD_MSG_FLAG_FORWARD_ENCODE)) {
  ------------------
  |  |  319|      0|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
  |  Branch (3141:13): [True: 0, False: 0]
  ------------------
 3142|      0|            DEBUGPRINTPDUTYPE("send", pdu->command);
  ------------------
  |  |  418|      0|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3143|      0|            rc = snmp_pdu_realloc_rbuild(pkt, pkt_len, offset, pdu);
 3144|      0|            if (rc == 0) {
  ------------------
  |  Branch (3144:17): [True: 0, False: 0]
  ------------------
 3145|      0|                return -1;
 3146|      0|            }
 3147|       |
 3148|      0|            DEBUGDUMPHEADER("send", "Community String");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3149|      0|            rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 3150|      0|                                           (u_char) (ASN_UNIVERSAL |
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
 3151|      0|                                                     ASN_PRIMITIVE |
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3152|      0|                                                     ASN_OCTET_STR),
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 3153|      0|                                           pdu->community,
 3154|      0|                                           pdu->community_len);
 3155|      0|            DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3156|      0|            if (rc == 0) {
  ------------------
  |  Branch (3156:17): [True: 0, False: 0]
  ------------------
 3157|      0|                return -1;
 3158|      0|            }
 3159|       |
 3160|       |
 3161|       |            /*
 3162|       |             * Store the version field.  
 3163|       |             */
 3164|      0|            DEBUGDUMPHEADER("send", "SNMP Version Number");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3165|       |
 3166|      0|            version = pdu->version;
 3167|      0|            rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3168|      0|                                        (u_char) (ASN_UNIVERSAL |
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
 3169|      0|                                                  ASN_PRIMITIVE |
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3170|      0|                                                  ASN_INTEGER),
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
 3171|      0|                                        (long *) &version,
 3172|      0|                                        sizeof(version));
 3173|      0|            DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3174|      0|            if (rc == 0) {
  ------------------
  |  Branch (3174:17): [True: 0, False: 0]
  ------------------
 3175|      0|                return -1;
 3176|      0|            }
 3177|       |
 3178|       |            /*
 3179|       |             * Build the final sequence.  
 3180|       |             */
 3181|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3182|      0|            if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3182:17): [True: 0, False: 0]
  ------------------
 3183|      0|                DEBUGDUMPSECTION("send", "SNMPv1 Message");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3184|      0|            } else {
 3185|      0|#endif
 3186|      0|                DEBUGDUMPSECTION("send", "SNMPv2c Message");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3187|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3188|      0|            }
 3189|      0|#endif
 3190|      0|            rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 3191|      0|                                             (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      0|#define ASN_SEQUENCE	    0x10U
  ------------------
 3192|      0|                                                       ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3193|      0|                                             *offset - start_offset);
 3194|      0|            DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3195|       |
 3196|      0|            if (rc == 0) {
  ------------------
  |  Branch (3196:17): [True: 0, False: 0]
  ------------------
 3197|      0|                return -1;
 3198|      0|            }
 3199|      0|            return 0;
 3200|      0|        } else {
 3201|       |
 3202|      0|#endif                          /* NETSNMP_USE_REVERSE_ASNENCODING */
 3203|       |            /*
 3204|       |             * Save current location and build SEQUENCE tag and length
 3205|       |             * placeholder for SNMP message sequence
 3206|       |             * (actual length will be inserted later) 
 3207|       |             */
 3208|      0|            cp = asn_build_sequence(*pkt, pkt_len,
 3209|      0|                                    (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      0|#define ASN_SEQUENCE	    0x10U
  ------------------
 3210|      0|                                              ASN_CONSTRUCTOR), 0);
  ------------------
  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3211|      0|            if (cp == NULL) {
  ------------------
  |  Branch (3211:17): [True: 0, False: 0]
  ------------------
 3212|      0|                return -1;
 3213|      0|            }
 3214|      0|            h0e = cp;
 3215|       |
 3216|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3217|      0|            if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3217:17): [True: 0, False: 0]
  ------------------
 3218|      0|                DEBUGDUMPSECTION("send", "SNMPv1 Message");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3219|      0|            } else {
 3220|      0|#endif
 3221|      0|                DEBUGDUMPSECTION("send", "SNMPv2c Message");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3222|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3223|      0|            }
 3224|      0|#endif
 3225|       |
 3226|       |            /*
 3227|       |             * store the version field 
 3228|       |             */
 3229|      0|            DEBUGDUMPHEADER("send", "SNMP Version Number");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3230|       |
 3231|      0|            version = pdu->version;
 3232|      0|            cp = asn_build_int(cp, pkt_len,
 3233|      0|                               (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                             (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3234|      0|                                         ASN_INTEGER), (long *) &version,
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
 3235|      0|                               sizeof(version));
 3236|      0|            DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3237|      0|            if (cp == NULL)
  ------------------
  |  Branch (3237:17): [True: 0, False: 0]
  ------------------
 3238|      0|                return -1;
 3239|       |
 3240|       |            /*
 3241|       |             * store the community string 
 3242|       |             */
 3243|      0|            DEBUGDUMPHEADER("send", "Community String");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3244|      0|            cp = asn_build_string(cp, pkt_len,
 3245|      0|                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3246|      0|                                            ASN_OCTET_STR), pdu->community,
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 3247|      0|                                  pdu->community_len);
 3248|      0|            DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3249|      0|            if (cp == NULL)
  ------------------
  |  Branch (3249:17): [True: 0, False: 0]
  ------------------
 3250|      0|                return -1;
 3251|      0|            break;
 3252|       |
 3253|      0|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 3254|      0|        }
 3255|      0|#endif                          /* NETSNMP_USE_REVERSE_ASNENCODING */
 3256|      0|        break;
 3257|      0|#endif /* support for community based SNMP */
 3258|      0|    case SNMP_VERSION_2p:
  ------------------
  |  |  119|      0|#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
  ------------------
  |  Branch (3258:5): [True: 0, False: 0]
  ------------------
 3259|      0|    case SNMP_VERSION_sec:
  ------------------
  |  |  118|      0|#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
  ------------------
  |  Branch (3259:5): [True: 0, False: 0]
  ------------------
 3260|      0|    case SNMP_VERSION_2u:
  ------------------
  |  |  112|      0|#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
  ------------------
  |  Branch (3260:5): [True: 0, False: 0]
  ------------------
 3261|      0|    case SNMP_VERSION_2star:
  ------------------
  |  |  120|      0|#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
  ------------------
  |  Branch (3261:5): [True: 0, False: 0]
  ------------------
 3262|      0|    default:
  ------------------
  |  Branch (3262:5): [True: 0, False: 0]
  ------------------
 3263|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3264|      0|        return -1;
 3265|      0|    }
 3266|       |
 3267|      0|    DEBUGPRINTPDUTYPE("send", pdu->command);
  ------------------
  |  |  418|      0|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3268|      0|    cp = snmp_pdu_build(pdu, cp, pkt_len);
 3269|      0|    DEBUGINDENTADD(-4);         /* return from entire v1/v2c message */
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3270|      0|    if (cp == NULL)
  ------------------
  |  Branch (3270:9): [True: 0, False: 0]
  ------------------
 3271|      0|        return -1;
 3272|       |
 3273|       |    /*
 3274|       |     * insert the actual length of the message sequence 
 3275|       |     */
 3276|      0|    switch (pdu->version) {
 3277|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3278|      0|    case SNMP_VERSION_1:
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3278:5): [True: 0, False: 0]
  ------------------
 3279|      0|#endif
 3280|      0|#ifndef NETSNMP_DISABLE_SNMPV2C
 3281|      0|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|      0|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (3281:5): [True: 0, False: 0]
  ------------------
 3282|      0|#endif
 3283|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 3284|      0|        asn_build_sequence(*pkt, &length,
 3285|      0|                           (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|      0|#define ASN_SEQUENCE	    0x10U
  ------------------
                                         (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3286|      0|                           cp - h0e);
 3287|      0|        break;
 3288|      0|#endif /* support for community based SNMP */
 3289|       |
 3290|      0|    case SNMP_VERSION_2p:
  ------------------
  |  |  119|      0|#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
  ------------------
  |  Branch (3290:5): [True: 0, False: 0]
  ------------------
 3291|      0|    case SNMP_VERSION_sec:
  ------------------
  |  |  118|      0|#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
  ------------------
  |  Branch (3291:5): [True: 0, False: 0]
  ------------------
 3292|      0|    case SNMP_VERSION_2u:
  ------------------
  |  |  112|      0|#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
  ------------------
  |  Branch (3292:5): [True: 0, False: 0]
  ------------------
 3293|      0|    case SNMP_VERSION_2star:
  ------------------
  |  |  120|      0|#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
  ------------------
  |  Branch (3293:5): [True: 0, False: 0]
  ------------------
 3294|      0|    default:
  ------------------
  |  Branch (3294:5): [True: 0, False: 0]
  ------------------
 3295|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3296|      0|        return -1;
 3297|      0|    }
 3298|      0|    *pkt_len = cp - *pkt;
 3299|      0|    return 0;
 3300|      0|}
snmp_api.c:snmpv3_build:
 2249|      3|{
 2250|      3|    int             ret;
 2251|       |
 2252|      3|    session->s_snmp_errno = 0;
 2253|      3|    session->s_errno = 0;
 2254|       |
 2255|       |    /*
 2256|       |     * do validation for PDU types 
 2257|       |     */
 2258|      3|    switch (pdu->command) {
 2259|      0|    case SNMP_MSG_RESPONSE:
  ------------------
  |  |  127|      0|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2259:5): [True: 0, False: 3]
  ------------------
 2260|      0|    case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|      0|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2260:5): [True: 0, False: 3]
  ------------------
 2261|      3|    case SNMP_MSG_REPORT:
  ------------------
  |  |  147|      3|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|      3|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2261:5): [True: 3, False: 0]
  ------------------
 2262|      3|        netsnmp_assert(0 == (pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE));
  ------------------
  |  |   47|      3|#      define netsnmp_assert(x)  do { \
  |  |   48|      3|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 3, False: 0]
  |  |  ------------------
  |  |   49|      3|                 ; \
  |  |   50|      3|              else \
  |  |   51|      3|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      3|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2263|      3|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|      3|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 2264|      3|    case SNMP_MSG_INFORM:
  ------------------
  |  |  141|      3|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   92|      3|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2264:5): [True: 0, False: 3]
  ------------------
 2265|      3|#ifndef NETSNMP_NOTIFY_ONLY
 2266|      3|    case SNMP_MSG_GET:
  ------------------
  |  |  125|      3|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   92|      3|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2266:5): [True: 0, False: 3]
  ------------------
 2267|      3|    case SNMP_MSG_GETNEXT:
  ------------------
  |  |  126|      3|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   92|      3|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2267:5): [True: 0, False: 3]
  ------------------
 2268|      3|#endif /* ! NETSNMP_NOTIFY_ONLY */
 2269|      3|#ifndef NETSNMP_NO_WRITE_SUPPORT
 2270|      3|    case SNMP_MSG_SET:
  ------------------
  |  |  129|      3|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   92|      3|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2270:5): [True: 0, False: 3]
  ------------------
 2271|      3|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 2272|      3|        if (pdu->errstat == SNMP_DEFAULT_ERRSTAT)
  ------------------
  |  |  117|      3|#define SNMP_DEFAULT_ERRSTAT	    -1
  ------------------
  |  Branch (2272:13): [True: 0, False: 3]
  ------------------
 2273|      0|            pdu->errstat = 0;
 2274|      3|        if (pdu->errindex == SNMP_DEFAULT_ERRINDEX)
  ------------------
  |  |  118|      3|#define SNMP_DEFAULT_ERRINDEX	    -1
  ------------------
  |  Branch (2274:13): [True: 0, False: 3]
  ------------------
 2275|      0|            pdu->errindex = 0;
 2276|      3|        break;
 2277|       |
 2278|      0|#ifndef NETSNMP_NOTIFY_ONLY
 2279|      0|    case SNMP_MSG_GETBULK:
  ------------------
  |  |  140|      0|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2279:5): [True: 0, False: 3]
  ------------------
 2280|      0|        if (pdu->max_repetitions < 0) {
  ------------------
  |  |  147|      0|#define max_repetitions errindex
  ------------------
  |  Branch (2280:13): [True: 0, False: 0]
  ------------------
 2281|      0|            session->s_snmp_errno = SNMPERR_BAD_REPETITIONS;
  ------------------
  |  |  227|      0|#define SNMPERR_BAD_REPETITIONS		(-10)
  ------------------
 2282|      0|            return -1;
 2283|      0|        }
 2284|      0|        if (pdu->non_repeaters < 0) {
  ------------------
  |  |  146|      0|#define non_repeaters	errstat
  ------------------
  |  Branch (2284:13): [True: 0, False: 0]
  ------------------
 2285|      0|            session->s_snmp_errno = SNMPERR_BAD_REPEATERS;
  ------------------
  |  |  226|      0|#define SNMPERR_BAD_REPEATERS		(-9)
  ------------------
 2286|      0|            return -1;
 2287|      0|        }
 2288|      0|        break;
 2289|      0|#endif /* ! NETSNMP_NOTIFY_ONLY */
 2290|       |
 2291|      0|    case SNMP_MSG_TRAP:
  ------------------
  |  |  135|      0|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2291:5): [True: 0, False: 3]
  ------------------
 2292|      0|        session->s_snmp_errno = SNMPERR_V1_IN_V2;
  ------------------
  |  |  225|      0|#define SNMPERR_V1_IN_V2		(-8)
  ------------------
 2293|      0|        return -1;
 2294|       |
 2295|      0|    default:
  ------------------
  |  Branch (2295:5): [True: 0, False: 3]
  ------------------
 2296|      0|        session->s_snmp_errno = SNMPERR_UNKNOWN_PDU;
  ------------------
  |  |  240|      0|#define SNMPERR_UNKNOWN_PDU		(-23)
  ------------------
 2297|      0|        return -1;
 2298|      3|    }
 2299|       |
 2300|       |    /* Do we need to set the session security engineid? */
 2301|      3|    if (pdu->securityEngineIDLen == 0) {
  ------------------
  |  Branch (2301:9): [True: 0, False: 3]
  ------------------
 2302|      0|        if (session->securityEngineIDLen) {
  ------------------
  |  Branch (2302:13): [True: 0, False: 0]
  ------------------
 2303|      0|            snmpv3_clone_engineID(&pdu->securityEngineID,
 2304|      0|                                  &pdu->securityEngineIDLen,
 2305|      0|                                  session->securityEngineID,
 2306|      0|                                  session->securityEngineIDLen);
 2307|      0|        }
 2308|      0|    }
 2309|       |    
 2310|       |    /* Do we need to set the session context engineid? */
 2311|      3|    if (pdu->contextEngineIDLen == 0) {
  ------------------
  |  Branch (2311:9): [True: 0, False: 3]
  ------------------
 2312|      0|        if (session->contextEngineIDLen) {
  ------------------
  |  Branch (2312:13): [True: 0, False: 0]
  ------------------
 2313|      0|            snmpv3_clone_engineID(&pdu->contextEngineID,
 2314|      0|                                  &pdu->contextEngineIDLen,
 2315|      0|                                  session->contextEngineID,
 2316|      0|                                  session->contextEngineIDLen);
 2317|      0|        } else if (pdu->securityEngineIDLen) {
  ------------------
  |  Branch (2317:20): [True: 0, False: 0]
  ------------------
 2318|      0|            snmpv3_clone_engineID(&pdu->contextEngineID,
 2319|      0|                                  &pdu->contextEngineIDLen,
 2320|      0|                                  pdu->securityEngineID,
 2321|      0|                                  pdu->securityEngineIDLen);
 2322|      0|        }
 2323|      0|    }
 2324|       |
 2325|      3|    if (pdu->contextName == NULL) {
  ------------------
  |  Branch (2325:9): [True: 0, False: 3]
  ------------------
 2326|      0|        if (!session->contextName) {
  ------------------
  |  Branch (2326:13): [True: 0, False: 0]
  ------------------
 2327|      0|            session->s_snmp_errno = SNMPERR_BAD_CONTEXT;
  ------------------
  |  |  234|      0|#define SNMPERR_BAD_CONTEXT		(-17)
  ------------------
 2328|      0|            return -1;
 2329|      0|        }
 2330|      0|        pdu->contextName = strdup(session->contextName);
 2331|      0|        if (pdu->contextName == NULL) {
  ------------------
  |  Branch (2331:13): [True: 0, False: 0]
  ------------------
 2332|      0|            session->s_snmp_errno = SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 2333|      0|            return -1;
 2334|      0|        }
 2335|      0|        pdu->contextNameLen = session->contextNameLen;
 2336|      0|    }
 2337|      3|    if (pdu->securityModel == SNMP_DEFAULT_SECMODEL) {
  ------------------
  |  |  124|      3|#define SNMP_DEFAULT_SECMODEL	    -1
  ------------------
  |  Branch (2337:9): [True: 0, False: 3]
  ------------------
 2338|      0|        pdu->securityModel = session->securityModel;
 2339|      0|        if (pdu->securityModel == SNMP_DEFAULT_SECMODEL) {
  ------------------
  |  |  124|      0|#define SNMP_DEFAULT_SECMODEL	    -1
  ------------------
  |  Branch (2339:13): [True: 0, False: 0]
  ------------------
 2340|      0|            pdu->securityModel = se_find_value_in_slist("snmp_secmods", netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECMODEL));
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                          pdu->securityModel = se_find_value_in_slist("snmp_secmods", netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECMODEL));
  ------------------
  |  |  161|      0|#define NETSNMP_DS_LIB_SECMODEL          10
  ------------------
 2341|       |            
 2342|      0|            if (pdu->securityModel <= 0) {
  ------------------
  |  Branch (2342:17): [True: 0, False: 0]
  ------------------
 2343|      0|                pdu->securityModel = SNMP_SEC_MODEL_USM;
  ------------------
  |  |  295|      0|#define SNMP_SEC_MODEL_USM		3
  ------------------
 2344|      0|            }
 2345|      0|        }
 2346|      0|    }
 2347|      3|    if (pdu->securityNameLen == 0 && pdu->securityName == NULL) {
  ------------------
  |  Branch (2347:9): [True: 0, False: 3]
  |  Branch (2347:38): [True: 0, False: 0]
  ------------------
 2348|      0|        if (session->securityModel != SNMP_SEC_MODEL_TSM &&
  ------------------
  |  |  296|      0|#define SNMP_SEC_MODEL_TSM              4
  ------------------
  |  Branch (2348:13): [True: 0, False: 0]
  ------------------
 2349|      0|            session->securityNameLen == 0) {
  ------------------
  |  Branch (2349:13): [True: 0, False: 0]
  ------------------
 2350|      0|            session->s_snmp_errno = SNMPERR_BAD_SEC_NAME;
  ------------------
  |  |  244|      0|#define SNMPERR_BAD_SEC_NAME 		(-27)
  ------------------
 2351|      0|            return -1;
 2352|      0|        }
 2353|      0|        if (session->securityName) {
  ------------------
  |  Branch (2353:13): [True: 0, False: 0]
  ------------------
 2354|      0|            pdu->securityName = strdup(session->securityName);
 2355|      0|            if (pdu->securityName == NULL) {
  ------------------
  |  Branch (2355:17): [True: 0, False: 0]
  ------------------
 2356|      0|                session->s_snmp_errno = SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 2357|      0|                return -1;
 2358|      0|            }
 2359|      0|            pdu->securityNameLen = session->securityNameLen;
 2360|      0|        } else {
 2361|      0|            pdu->securityName = strdup("");
 2362|      0|            session->securityName = strdup("");
 2363|      0|        }
 2364|      0|    }
 2365|      3|    if (pdu->securityLevel == 0) {
  ------------------
  |  Branch (2365:9): [True: 0, False: 3]
  ------------------
 2366|      0|        if (session->securityLevel == 0) {
  ------------------
  |  Branch (2366:13): [True: 0, False: 0]
  ------------------
 2367|      0|            session->s_snmp_errno = SNMPERR_BAD_SEC_LEVEL;
  ------------------
  |  |  245|      0|#define SNMPERR_BAD_SEC_LEVEL 		(-28)
  ------------------
 2368|      0|            return -1;
 2369|      0|        }
 2370|      0|        pdu->securityLevel = session->securityLevel;
 2371|      0|    }
 2372|      3|    DEBUGMSGTL(("snmp_build",
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2373|      3|                "Building SNMPv3 message (secName:\"%s\", secLevel:%s)...\n",
 2374|      3|                ((session->securityName) ? (char *) session->securityName :
 2375|      3|                 ((pdu->securityName) ? (char *) pdu->securityName :
 2376|      3|                  "ERROR: undefined")), secLevelName[pdu->securityLevel]));
 2377|       |
 2378|      3|    DEBUGDUMPSECTION("send", "SNMPv3 Message");
  ------------------
  |  |   81|      3|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2379|      3|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 2380|      3|    if (!(pdu->flags & UCD_MSG_FLAG_FORWARD_ENCODE)) {
  ------------------
  |  |  319|      3|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
  |  Branch (2380:9): [True: 3, False: 0]
  ------------------
 2381|      3|        ret = snmpv3_packet_realloc_rbuild(pkt, pkt_len, offset,
 2382|      3|                                           session, pdu, NULL, 0);
 2383|      3|    } else {
 2384|      0|#endif
 2385|      0|        ret = snmpv3_packet_build(session, pdu, *pkt, pkt_len, NULL, 0);
 2386|      0|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 2387|      0|    }
 2388|      3|#endif
 2389|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2390|      3|    if (-1 != ret) {
  ------------------
  |  Branch (2390:9): [True: 3, False: 0]
  ------------------
 2391|      3|        session->s_snmp_errno = ret;
 2392|      3|    }
 2393|       |
 2394|      3|    return ret;
 2395|       |
 2396|      3|}                               /* end snmpv3_build() */
snmp_api.c:free_securityStateRef:
 4138|     85|{
 4139|     85|    struct snmp_secmod_def *sptr;
 4140|       |
 4141|     85|    if (!pdu->securityStateRef)
  ------------------
  |  Branch (4141:9): [True: 85, False: 0]
  ------------------
 4142|     85|        return;
 4143|       |
 4144|      0|    sptr = find_sec_mod(pdu->securityModel);
 4145|      0|    if (sptr) {
  ------------------
  |  Branch (4145:9): [True: 0, False: 0]
  ------------------
 4146|      0|        if (sptr->pdu_free_state_ref) {
  ------------------
  |  Branch (4146:13): [True: 0, False: 0]
  ------------------
 4147|      0|            (*sptr->pdu_free_state_ref) (pdu->securityStateRef);
 4148|      0|        } else {
 4149|      0|            snmp_log(LOG_ERR,
 4150|      0|                     "Security Model %d can't free state references\n",
 4151|      0|                     pdu->securityModel);
 4152|      0|	}
 4153|      0|    } else {
 4154|      0|	snmp_log(LOG_ERR,
 4155|      0|		 "Can't find security model to free ptr: %d\n",
 4156|      0|		 pdu->securityModel);
 4157|      0|    }
 4158|       |    pdu->securityStateRef = NULL;
 4159|      0|}
snmp_api.c:_snmp_parse:
 4364|     65|{
 4365|     65|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4366|     65|    u_char          community[COMMUNITY_MAX_LEN];
 4367|     65|    size_t          community_length = COMMUNITY_MAX_LEN;
  ------------------
  |  |   41|     65|#define COMMUNITY_MAX_LEN	256
  ------------------
 4368|     65|#endif
 4369|     65|    int             result = -1;
 4370|       |
 4371|     65|    static const oid snmpEngineIDoid[]   = { 1,3,6,1,6,3,10,2,1,1,0};
 4372|     65|    static size_t   snmpEngineIDoid_len = 11;
 4373|       |
 4374|     65|    static char     ourEngineID[SNMP_SEC_PARAM_BUF_SIZE];
 4375|     65|    static size_t   ourEngineID_len = sizeof(ourEngineID);
 4376|       |
 4377|     65|    netsnmp_pdu    *pdu2 = NULL;
 4378|       |
 4379|     65|    session->s_snmp_errno = 0;
 4380|     65|    session->s_errno = 0;
 4381|       |
 4382|       |    /*
 4383|       |     * Ensure all incoming PDUs have a unique means of identification 
 4384|       |     * (This is not restricted to AgentX handling,
 4385|       |     * though that is where the need becomes visible)   
 4386|       |     */
 4387|     65|    pdu->transid = snmp_get_next_transid();
 4388|       |
 4389|     65|    if (session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|     65|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4389:9): [True: 0, False: 65]
  ------------------
 4390|      0|        pdu->version = session->version;
 4391|     65|    } else {
 4392|     65|        pdu->version = snmp_parse_version(data, length);
 4393|     65|    }
 4394|       |
 4395|     65|    switch (pdu->version) {
 4396|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4397|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4398|      4|    case SNMP_VERSION_1:
  ------------------
  |  |  107|      4|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4398:5): [True: 4, False: 61]
  ------------------
 4399|      4|#endif
 4400|      4|#ifndef NETSNMP_DISABLE_SNMPV2C
 4401|      4|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|      4|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (4401:5): [True: 0, False: 65]
  ------------------
 4402|      4|#endif
 4403|      4|        NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pdu->version,unsupported_version);
  ------------------
  |  |  220|      4|#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pc_ver, pc_target) do {    \
  |  |  221|      4|        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||                \
  |  |  ------------------
  |  |  |  |  205|      8|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|      8|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  206|      8|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      4|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (206:6): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  |  |  207|      4|                            NETSNMP_DS_LIB_DISABLE_V1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|      4|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  222|      4|            NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver)) {                \
  |  |  ------------------
  |  |  |  |  215|      4|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|      8|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  |  |  216|      4|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (216:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  217|      0|                            NETSNMP_DS_LIB_DISABLE_V2c))
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|#define NETSNMP_DS_LIB_DISABLE_V2c         44 /* disable SNMPv2c */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  223|      0|            DEBUGMSGTL(("snmp:protocol:disabled", "enforced\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]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  224|      0|            goto pc_target;                                            \
  |  |  225|      0|        }                                                              \
  |  |  226|      4|    } while(0)
  |  |  ------------------
  |  |  |  Branch (226:13): [Folded, False: 4]
  |  |  ------------------
  ------------------
 4404|      4|        DEBUGMSGTL(("snmp_api", "Parsing SNMPv%ld message...\n",
  ------------------
  |  |   66|      4|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 4]
  |  |  ------------------
  ------------------
 4405|      4|                    (1 + pdu->version)));
 4406|       |
 4407|       |        /*
 4408|       |         * authenticates message and returns length if valid 
 4409|       |         */
 4410|      4|#ifndef NETSNMP_DISABLE_SNMPV1
 4411|      4|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      4|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4411:13): [True: 4, False: 0]
  ------------------
 4412|      4|            DEBUGDUMPSECTION("recv", "SNMPv1 message\n");
  ------------------
  |  |   81|      4|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 4]
  |  |  ------------------
  ------------------
 4413|      4|        } else {
 4414|      0|#endif
 4415|      0|            DEBUGDUMPSECTION("recv", "SNMPv2c message\n");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4416|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4417|      0|        }
 4418|      4|#endif
 4419|      4|        data = snmp_comstr_parse(data, &length,
 4420|      4|                                 community, &community_length,
 4421|      4|                                 &pdu->version);
 4422|      4|        if (data == NULL)
  ------------------
  |  Branch (4422:13): [True: 1, False: 3]
  ------------------
 4423|      1|            return -1;
 4424|       |
 4425|      3|        if (pdu->version != session->version &&
  ------------------
  |  Branch (4425:13): [True: 3, False: 0]
  ------------------
 4426|      3|            session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|      3|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4426:13): [True: 0, False: 3]
  ------------------
 4427|      0|            session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4428|      0|            return -1;
 4429|      0|        }
 4430|       |
 4431|       |        /*
 4432|       |         * maybe get the community string. 
 4433|       |         */
 4434|      3|        pdu->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|      3|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4435|      3|        pdu->securityModel = 
 4436|      3|#ifndef NETSNMP_DISABLE_SNMPV1
 4437|      3|            (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  107|      3|#define SNMP_VERSION_1	   0
  ------------------
                          (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  293|      3|#define SNMP_SEC_MODEL_SNMPv1		1
  ------------------
  |  Branch (4437:13): [True: 3, False: 0]
  ------------------
 4438|      3|#endif
 4439|      3|                                               SNMP_SEC_MODEL_SNMPv2c;
  ------------------
  |  |  294|      3|#define SNMP_SEC_MODEL_SNMPv2c		2
  ------------------
 4440|      3|        SNMP_FREE(pdu->community);
  ------------------
  |  |   62|      3|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 3]
  |  |  |  Branch (62:66): [Folded, False: 3]
  |  |  ------------------
  ------------------
 4441|      3|        pdu->community_len = 0;
 4442|      3|        pdu->community = (u_char *) 0;
 4443|      3|        if (community_length) {
  ------------------
  |  Branch (4443:13): [True: 0, False: 3]
  ------------------
 4444|      0|            pdu->community_len = community_length;
 4445|      0|            pdu->community = netsnmp_memdup(community, community_length);
 4446|      0|            if (pdu->community == NULL) {
  ------------------
  |  Branch (4446:17): [True: 0, False: 0]
  ------------------
 4447|      0|                session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4448|      0|                return -1;
 4449|      0|            }
 4450|      0|        }
 4451|      3|        if (session->authenticator) {
  ------------------
  |  Branch (4451:13): [True: 0, False: 3]
  ------------------
 4452|      0|            data = session->authenticator(data, &length,
 4453|      0|                                          community, community_length);
 4454|      0|            if (data == NULL) {
  ------------------
  |  Branch (4454:17): [True: 0, False: 0]
  ------------------
 4455|      0|                session->s_snmp_errno = SNMPERR_AUTHENTICATION_FAILURE;
  ------------------
  |  |  252|      0|#define SNMPERR_AUTHENTICATION_FAILURE 	(-35)
  ------------------
 4456|      0|                return -1;
 4457|      0|            }
 4458|      0|        }
 4459|       |
 4460|      3|        DEBUGDUMPSECTION("recv", "PDU");
  ------------------
  |  |   81|      3|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 3]
  |  |  ------------------
  ------------------
 4461|      3|        result = snmp_pdu_parse(pdu, data, &length);
 4462|      3|        if (result < 0) {
  ------------------
  |  Branch (4462:13): [True: 3, False: 0]
  ------------------
 4463|       |            /*
 4464|       |             * This indicates a parse error.  
 4465|       |             */
 4466|      3|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      3|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4467|      3|        }
 4468|      3|        DEBUGINDENTADD(-6);
  ------------------
  |  |   73|      3|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 4469|      3|        break;
 4470|      0|#endif /* support for community based SNMP */
 4471|       |
 4472|     14|    case SNMP_VERSION_3:
  ------------------
  |  |  113|     14|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (4472:5): [True: 14, False: 51]
  ------------------
 4473|     14|        NETSNMP_RUNTIME_PROTOCOL_CHECK_V3(SNMP_VERSION_3,unsupported_version);
  ------------------
  |  |  233|     14|#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V3(pc_ver, pc_target) do {      \
  |  |  234|     14|        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver)) {                \
  |  |  ------------------
  |  |  |  |  229|     14|    ((pc_ver == SNMP_VERSION_3) &&                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|     14|#define SNMP_VERSION_3     3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (229:6): [True: 14, Folded]
  |  |  |  |  ------------------
  |  |  |  |  230|     14|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|     14|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (230:6): [True: 0, False: 14]
  |  |  |  |  ------------------
  |  |  |  |  231|     14|                            NETSNMP_DS_LIB_DISABLE_V3))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|     14|#define NETSNMP_DS_LIB_DISABLE_V3          45 /* disable SNMPv3 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  235|      0|            DEBUGMSGTL(("snmp:protocol:disabled", "enforced\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]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  236|      0|            goto pc_target;                                            \
  |  |  237|      0|        }                                                              \
  |  |  238|     14|    } while(0)
  |  |  ------------------
  |  |  |  Branch (238:13): [Folded, False: 14]
  |  |  ------------------
  ------------------
 4474|     14|        result = snmpv3_parse(pdu, data, &length, NULL, session);
 4475|     14|        DEBUGMSGTL(("snmp_parse",
  ------------------
  |  |   66|     14|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     14|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 14]
  |  |  ------------------
  ------------------
 4476|     14|                    "Parsed SNMPv3 message (secName:%s, secLevel:%s): %s\n",
 4477|     14|                    pdu->securityName, secLevelName[pdu->securityLevel],
 4478|     14|                    snmp_api_errstring(result)));
 4479|       |
 4480|     14|        if (result == SNMPERR_USM_UNKNOWNSECURITYNAME) {
  ------------------
  |  |  260|     14|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (4480:13): [True: 0, False: 14]
  ------------------
 4481|      0|            snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
  ------------------
  |  |   19|      0|#define SNMP_CALLBACK_APPLICATION 1
  ------------------
 4482|      0|                                SNMPD_CALLBACK_AUTH_FAILURE, pdu);
  ------------------
  |  |   21|      0|#define SNMPD_CALLBACK_AUTH_FAILURE             17
  ------------------
 4483|      0|        }
 4484|       |        
 4485|     14|        if (result) {
  ------------------
  |  Branch (4485:13): [True: 14, False: 0]
  ------------------
 4486|     14|            struct snmp_secmod_def *secmod =
 4487|     14|                find_sec_mod(pdu->securityModel);
 4488|     14|            if (!slp) {
  ------------------
  |  Branch (4488:17): [True: 0, False: 14]
  ------------------
 4489|      0|                session->s_snmp_errno = result;
 4490|     14|            } else {
 4491|       |                /*
 4492|       |                 * Call the security model to special handle any errors
 4493|       |                 */
 4494|       |
 4495|     14|                if (secmod && secmod->handle_report) {
  ------------------
  |  Branch (4495:21): [True: 6, False: 8]
  |  Branch (4495:31): [True: 6, False: 0]
  ------------------
 4496|      6|                    (*secmod->handle_report)(slp, slp->transport, session,
 4497|      6|                                             result, pdu);
 4498|      6|                }
 4499|     14|            }
 4500|     14|            free_securityStateRef(pdu);
 4501|     14|        }
 4502|       |
 4503|       |        /* Implement RFC5343 here for two reasons:
 4504|       |           1) From a security perspective it handles this otherwise
 4505|       |              always approved request earlier.  It bypasses the need
 4506|       |              for authorization to the snmpEngineID scalar, which is
 4507|       |              what is what RFC3415 appendix A species as ok.  Note
 4508|       |              that we haven't bypassed authentication since if there
 4509|       |              was an authentication error it would have been handled
 4510|       |              above in the if(result) part at the latest.
 4511|       |           2) From an application point of view if we let this request
 4512|       |              get all the way to the application, it'd require that
 4513|       |              all application types supporting discovery also fire up
 4514|       |              a minimal agent in order to handle just this request
 4515|       |              which seems like overkill.  Though there is no other
 4516|       |              application types that currently need discovery (NRs
 4517|       |              accept notifications from contextEngineIDs that derive
 4518|       |              from the NO not the NR).  Also a lame excuse for doing
 4519|       |              it here.
 4520|       |           3) Less important technically, but the net-snmp agent
 4521|       |              doesn't currently handle registrations of different
 4522|       |              engineIDs either and it would have been a lot more work
 4523|       |              to implement there since we'd need to support that
 4524|       |              first. :-/ Supporting multiple context engineIDs should
 4525|       |              be done anyway, so it's not a valid excuse here.
 4526|       |           4) There is a lot less to do if we trump the agent at this
 4527|       |              point; IE, the agent does a lot more unnecessary
 4528|       |              processing when the only thing that should ever be in
 4529|       |              this context by definition is the single scalar.
 4530|       |        */
 4531|       |
 4532|       |        /* special RFC5343 engineID discovery engineID check */
 4533|     14|        if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     14|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (4533:13): [True: 14, False: 0]
  ------------------
 4534|     14|                                    NETSNMP_DS_LIB_NO_DISCOVERY) &&
  ------------------
  |  |   98|     14|#define NETSNMP_DS_LIB_NO_DISCOVERY        38 /* don't support RFC5343 contextEngineID discovery */
  ------------------
 4535|     14|            SNMP_MSG_RESPONSE       != pdu->command &&
  ------------------
  |  |  127|     14|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   92|     14|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   96|     14|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4535:13): [True: 14, False: 0]
  ------------------
 4536|     14|            NULL                    != pdu->contextEngineID &&
  ------------------
  |  Branch (4536:13): [True: 6, False: 8]
  ------------------
 4537|      6|            pdu->contextEngineIDLen == 5 &&
  ------------------
  |  Branch (4537:13): [True: 0, False: 6]
  ------------------
 4538|      0|            pdu->contextEngineID[0] == 0x80 &&
  ------------------
  |  Branch (4538:13): [True: 0, False: 0]
  ------------------
 4539|      0|            pdu->contextEngineID[1] == 0x00 &&
  ------------------
  |  Branch (4539:13): [True: 0, False: 0]
  ------------------
 4540|      0|            pdu->contextEngineID[2] == 0x00 &&
  ------------------
  |  Branch (4540:13): [True: 0, False: 0]
  ------------------
 4541|      0|            pdu->contextEngineID[3] == 0x00 &&
  ------------------
  |  Branch (4541:13): [True: 0, False: 0]
  ------------------
 4542|      0|            pdu->contextEngineID[4] == 0x06) {
  ------------------
  |  Branch (4542:13): [True: 0, False: 0]
  ------------------
 4543|       |
 4544|       |            /* define a result so it doesn't get past us at this point
 4545|       |               and gets dropped by future parts of the stack */
 4546|      0|            result = SNMPERR_JUST_A_CONTEXT_PROBE;
  ------------------
  |  |  283|      0|#define SNMPERR_JUST_A_CONTEXT_PROBE    (-66)
  ------------------
 4547|       |
 4548|      0|            DEBUGMSGTL(("snmpv3_contextid", "starting context ID discovery\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]
  |  |  ------------------
  ------------------
 4549|       |            /* ensure exactly one variable */
 4550|      0|            if (NULL != pdu->variables &&
  ------------------
  |  Branch (4550:17): [True: 0, False: 0]
  ------------------
 4551|      0|                NULL == pdu->variables->next_variable &&
  ------------------
  |  Branch (4551:17): [True: 0, False: 0]
  ------------------
 4552|       |
 4553|       |                /* if it's a GET, match it exactly */
 4554|      0|                ((SNMP_MSG_GET == pdu->command &&
  ------------------
  |  |  125|      0|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4554:19): [True: 0, False: 0]
  ------------------
 4555|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4555:19): [True: 0, False: 0]
  ------------------
 4556|      0|                                   snmpEngineIDoid_len,
 4557|      0|                                   pdu->variables->name,
 4558|      0|                                   pdu->variables->name_length) == 0)
 4559|       |                 /* if it's a GETNEXT ensure it's less than the engineID oid */
 4560|      0|                 ||
 4561|      0|                 (SNMP_MSG_GETNEXT == pdu->command &&
  ------------------
  |  |  126|      0|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4561:19): [True: 0, False: 0]
  ------------------
 4562|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4562:19): [True: 0, False: 0]
  ------------------
 4563|      0|                                   snmpEngineIDoid_len,
 4564|      0|                                   pdu->variables->name,
 4565|      0|                                   pdu->variables->name_length) > 0)
 4566|      0|                    )) {
 4567|       |
 4568|      0|                DEBUGMSGTL(("snmpv3_contextid",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 4569|      0|                            "  One correct variable found\n"));
 4570|       |
 4571|       |                /* Note: we're explicitly not handling a GETBULK.  Deal. */
 4572|       |
 4573|       |                /* set up the response */
 4574|      0|                pdu2 = snmp_clone_pdu(pdu);
 4575|       |
 4576|       |                /* free the current varbind */
 4577|      0|                snmp_free_varbind(pdu2->variables);
 4578|       |
 4579|       |                /* set the variables */
 4580|      0|                pdu2->variables = NULL;
 4581|      0|                pdu2->command = SNMP_MSG_RESPONSE;
  ------------------
  |  |  127|      0|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
 4582|      0|                pdu2->errstat = 0;
 4583|      0|                pdu2->errindex = 0;
 4584|       |
 4585|      0|                ourEngineID_len =
 4586|      0|                    snmpv3_get_engineID((u_char*)ourEngineID, ourEngineID_len);
 4587|      0|                if (0 != ourEngineID_len) {
  ------------------
  |  Branch (4587:21): [True: 0, False: 0]
  ------------------
 4588|       |
 4589|      0|                    DEBUGMSGTL(("snmpv3_contextid",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 4590|      0|                                "  responding with our engineID\n"));
 4591|       |
 4592|      0|                    snmp_pdu_add_variable(pdu2,
 4593|      0|                                          snmpEngineIDoid, snmpEngineIDoid_len,
 4594|      0|                                          ASN_OCTET_STR,
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 4595|      0|                                          ourEngineID, ourEngineID_len);
 4596|       |                    
 4597|       |                    /* send the response */
 4598|      0|                    if (0 == snmp_sess_send(slp, pdu2)) {
  ------------------
  |  Branch (4598:25): [True: 0, False: 0]
  ------------------
 4599|       |
 4600|      0|                        DEBUGMSGTL(("snmpv3_contextid",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 4601|      0|                                    "  sent it off!\n"));
 4602|       |
 4603|      0|                        snmp_free_pdu(pdu2);
 4604|       |                        
 4605|      0|                        snmp_log(LOG_ERR, "sending a response to the context engineID probe failed\n");
 4606|      0|                    }
 4607|      0|                } else {
 4608|      0|                    snmp_log(LOG_ERR, "failed to get our own engineID!\n");
 4609|      0|                }
 4610|      0|            } else {
 4611|      0|                snmp_log(LOG_WARNING,
 4612|      0|                         "received an odd context engineID probe\n");
 4613|      0|            }
 4614|      0|        }
 4615|       |
 4616|     14|        break;
 4617|     46|    case SNMPERR_BAD_VERSION:
  ------------------
  |  |  231|     46|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
  |  Branch (4617:5): [True: 46, False: 19]
  ------------------
 4618|     46|        ERROR_MSG("error parsing snmp message version");
  ------------------
  |  |  188|     46|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4619|     46|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|     46|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4620|     46|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|     46|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4621|     46|        break;
 4622|       |
 4623|      0|        unsupported_version:  /* goto label */
 4624|      0|    case SNMP_VERSION_sec:
  ------------------
  |  |  118|      0|#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4624:5): [True: 0, False: 65]
  ------------------
 4625|      0|    case SNMP_VERSION_2u:
  ------------------
  |  |  112|      0|#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
  ------------------
  |  Branch (4625:5): [True: 0, False: 65]
  ------------------
 4626|      0|    case SNMP_VERSION_2star:
  ------------------
  |  |  120|      0|#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4626:5): [True: 0, False: 65]
  ------------------
 4627|      0|    case SNMP_VERSION_2p:
  ------------------
  |  |  119|      0|#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
  ------------------
  |  Branch (4627:5): [True: 0, False: 65]
  ------------------
 4628|      1|    default:
  ------------------
  |  Branch (4628:5): [True: 1, False: 64]
  ------------------
 4629|      1|        ERROR_MSG("unsupported snmp message version");
  ------------------
  |  |  188|      1|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4630|      1|        snmp_increment_statistic(STAT_SNMPINBADVERSIONS);
  ------------------
  |  |  667|      1|#define  STAT_SNMPINBADVERSIONS              11
  ------------------
 4631|       |
 4632|       |        /*
 4633|       |         * need better way to determine OS independent
 4634|       |         * INT32_MAX value, for now hardcode
 4635|       |         */
 4636|      1|        if (pdu->version < 0 || pdu->version > 2147483647) {
  ------------------
  |  Branch (4636:13): [True: 0, False: 1]
  |  Branch (4636:33): [True: 0, False: 1]
  ------------------
 4637|      0|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4638|      0|        }
 4639|      1|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      1|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4640|      1|        break;
 4641|     65|    }
 4642|       |
 4643|     64|    return result;
 4644|     65|}
snmp_api.c:snmp_parse_version:
 3774|     65|{
 3775|     65|    u_char          type;
 3776|     65|    long            version = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|     65|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3777|       |
 3778|     65|    data = asn_parse_sequence(data, &length, &type,
 3779|     65|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "version");
  ------------------
  |  |   84|     65|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "version");
  ------------------
  |  |   96|     65|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3780|     65|    if (data) {
  ------------------
  |  Branch (3780:9): [True: 24, False: 41]
  ------------------
 3781|     24|        DEBUGDUMPHEADER("recv", "SNMP Version");
  ------------------
  |  |   79|     24|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     24|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 24]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 24]
  |  |  ------------------
  ------------------
 3782|     24|        data =
 3783|     24|            asn_parse_int(data, &length, &type, &version, sizeof(version));
 3784|     24|        DEBUGINDENTLESS();
  ------------------
  |  |   75|     24|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     24|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 24]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 24]
  |  |  ------------------
  ------------------
 3785|     24|        if (!data || type != ASN_INTEGER) {
  ------------------
  |  |   75|     19|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3785:13): [True: 5, False: 19]
  |  Branch (3785:22): [True: 0, False: 19]
  ------------------
 3786|      5|            return SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      5|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3787|      5|        }
 3788|     24|    }
 3789|     60|    return version;
 3790|     65|}
snmp_api.c:netsnmp_build_packet:
 5059|      3|{
 5060|      3|    size_t offset = 0;
 5061|      3|    int    result;
 5062|       |
 5063|      3|    if (isp && isp->hook_realloc_build) {
  ------------------
  |  Branch (5063:9): [True: 3, False: 0]
  |  Branch (5063:16): [True: 0, False: 3]
  ------------------
 5064|      0|        result = isp->hook_realloc_build(sp, pdu, pktbuf_p, pktbuf_len_p,
 5065|      0|                                         &offset);
 5066|       |
 5067|      0|        *pkt_p = *pktbuf_p;
 5068|      0|        *len_p = offset;
 5069|      3|    } else if (isp && isp->hook_build) {
  ------------------
  |  Branch (5069:16): [True: 3, False: 0]
  |  Branch (5069:23): [True: 0, False: 3]
  ------------------
 5070|      0|        *pkt_p = *pktbuf_p;
 5071|      0|        *len_p = *pktbuf_len_p;
 5072|      0|        result = isp->hook_build(sp, pdu, *pktbuf_p, len_p);
 5073|      3|    } else {
 5074|      3|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 5075|      3|        if (!(pdu->flags & UCD_MSG_FLAG_FORWARD_ENCODE)) {
  ------------------
  |  |  319|      3|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
  |  Branch (5075:13): [True: 3, False: 0]
  ------------------
 5076|      3|            result = snmp_build(pktbuf_p, pktbuf_len_p, &offset, sp, pdu);
 5077|      3|            *pkt_p = *pktbuf_p + *pktbuf_len_p - offset;
 5078|      3|            *len_p = offset;
 5079|      3|        } else {
 5080|      0|#endif
 5081|      0|            *pkt_p = *pktbuf_p;
 5082|      0|            *len_p = *pktbuf_len_p;
 5083|      0|            result = snmp_build(pktbuf_p, len_p, &offset, sp, pdu);
 5084|      0|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 5085|      0|        }
 5086|      3|#endif
 5087|      3|    }
 5088|       |
 5089|      3|    return result;
 5090|      3|}
snmp_api.c:_sess_async_send:
 5373|      3|{
 5374|      3|    netsnmp_session *session;
 5375|      3|    struct snmp_internal_session *isp;
 5376|      3|    netsnmp_transport *transport = NULL;
 5377|      3|    int             result;
 5378|      3|    long            reqid;
 5379|       |
 5380|      3|    if (slp == NULL || NULL == slp->session || NULL ==slp->internal ||
  ------------------
  |  Branch (5380:9): [True: 0, False: 3]
  |  Branch (5380:24): [True: 0, False: 3]
  |  Branch (5380:48): [True: 0, False: 3]
  ------------------
 5381|      3|                NULL == slp->transport) {
  ------------------
  |  Branch (5381:17): [True: 0, False: 3]
  ------------------
 5382|      0|        return 0;
 5383|      0|    }
 5384|       |
 5385|      3|    session = slp->session;
 5386|      3|    isp = slp->internal;
 5387|      3|    transport = slp->transport;
 5388|       |
 5389|      3|    if (NULL == isp->opacket) {
  ------------------
  |  Branch (5389:9): [True: 3, False: 0]
  ------------------
 5390|      3|        result = _build_initial_pdu_packet(slp, pdu, 0);
 5391|      3|        if ((SNMPERR_SUCCESS != result) || (NULL == isp->opacket)) {
  ------------------
  |  |  217|      3|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (5391:13): [True: 0, False: 3]
  |  Branch (5391:44): [True: 0, False: 3]
  ------------------
 5392|      0|            if (callback) {
  ------------------
  |  Branch (5392:17): [True: 0, False: 0]
  ------------------
 5393|      0|                switch (session->s_snmp_errno) {
 5394|       |                    /*
 5395|       |                     * some of these probably don't make sense here, but
 5396|       |                     * it's a rough first cut.
 5397|       |                     */
 5398|      0|                    case SNMPERR_BAD_ENG_ID:
  ------------------
  |  |  243|      0|#define SNMPERR_BAD_ENG_ID 		(-26)
  ------------------
  |  Branch (5398:21): [True: 0, False: 0]
  ------------------
 5399|      0|                    case SNMPERR_BAD_SEC_LEVEL:
  ------------------
  |  |  245|      0|#define SNMPERR_BAD_SEC_LEVEL 		(-28)
  ------------------
  |  Branch (5399:21): [True: 0, False: 0]
  ------------------
 5400|      0|                    case SNMPERR_UNKNOWN_SEC_MODEL:
  ------------------
  |  |  247|      0|#define SNMPERR_UNKNOWN_SEC_MODEL 	(-30)
  ------------------
  |  Branch (5400:21): [True: 0, False: 0]
  ------------------
 5401|      0|                    case SNMPERR_UNKNOWN_ENG_ID:
  ------------------
  |  |  249|      0|#define SNMPERR_UNKNOWN_ENG_ID          (-32)
  ------------------
  |  Branch (5401:21): [True: 0, False: 0]
  ------------------
 5402|      0|                    case SNMPERR_UNKNOWN_USER_NAME:
  ------------------
  |  |  250|      0|#define SNMPERR_UNKNOWN_USER_NAME 	(-33)
  ------------------
  |  Branch (5402:21): [True: 0, False: 0]
  ------------------
 5403|      0|                    case SNMPERR_UNSUPPORTED_SEC_LEVEL:
  ------------------
  |  |  251|      0|#define SNMPERR_UNSUPPORTED_SEC_LEVEL 	(-34)
  ------------------
  |  Branch (5403:21): [True: 0, False: 0]
  ------------------
 5404|      0|                    case SNMPERR_AUTHENTICATION_FAILURE:
  ------------------
  |  |  252|      0|#define SNMPERR_AUTHENTICATION_FAILURE 	(-35)
  ------------------
  |  Branch (5404:21): [True: 0, False: 0]
  ------------------
 5405|      0|                    case SNMPERR_NOT_IN_TIME_WINDOW:
  ------------------
  |  |  253|      0|#define SNMPERR_NOT_IN_TIME_WINDOW 	(-36)
  ------------------
  |  Branch (5405:21): [True: 0, False: 0]
  ------------------
 5406|      0|                    case SNMPERR_USM_GENERICERROR:
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
  |  Branch (5406:21): [True: 0, False: 0]
  ------------------
 5407|      0|                    case SNMPERR_USM_UNKNOWNSECURITYNAME:
  ------------------
  |  |  260|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (5407:21): [True: 0, False: 0]
  ------------------
 5408|      0|                    case SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL:
  ------------------
  |  |  261|      0|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
  |  Branch (5408:21): [True: 0, False: 0]
  ------------------
 5409|      0|                    case SNMPERR_USM_ENCRYPTIONERROR:
  ------------------
  |  |  262|      0|#define SNMPERR_USM_ENCRYPTIONERROR		(-45)
  ------------------
  |  Branch (5409:21): [True: 0, False: 0]
  ------------------
 5410|      0|                    case SNMPERR_USM_AUTHENTICATIONFAILURE:
  ------------------
  |  |  263|      0|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
  |  Branch (5410:21): [True: 0, False: 0]
  ------------------
 5411|      0|                    case SNMPERR_USM_PARSEERROR:
  ------------------
  |  |  264|      0|#define SNMPERR_USM_PARSEERROR			(-47)
  ------------------
  |  Branch (5411:21): [True: 0, False: 0]
  ------------------
 5412|      0|                    case SNMPERR_USM_UNKNOWNENGINEID:
  ------------------
  |  |  265|      0|#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
  ------------------
  |  Branch (5412:21): [True: 0, False: 0]
  ------------------
 5413|      0|                    case SNMPERR_USM_NOTINTIMEWINDOW:
  ------------------
  |  |  266|      0|#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
  ------------------
  |  Branch (5413:21): [True: 0, False: 0]
  ------------------
 5414|      0|                        callback(NETSNMP_CALLBACK_OP_SEC_ERROR, session,
  ------------------
  |  |  358|      0|#define NETSNMP_CALLBACK_OP_SEC_ERROR		7
  ------------------
 5415|      0|                                 pdu->reqid, pdu, cb_data);
 5416|      0|                        break;
 5417|      0|                    case SNMPERR_TIMEOUT: /* engineID probe timed out */
  ------------------
  |  |  241|      0|#define SNMPERR_TIMEOUT 		(-24)
  ------------------
  |  Branch (5417:21): [True: 0, False: 0]
  ------------------
 5418|      0|                        callback(NETSNMP_CALLBACK_OP_TIMED_OUT, session,
  ------------------
  |  |  353|      0|#define NETSNMP_CALLBACK_OP_TIMED_OUT		2
  ------------------
 5419|      0|                                 pdu->reqid, pdu, cb_data);
 5420|      0|                        break;
 5421|      0|                    default:
  ------------------
  |  Branch (5421:21): [True: 0, False: 0]
  ------------------
 5422|      0|                        callback(NETSNMP_CALLBACK_OP_SEND_FAILED, session,
  ------------------
  |  |  354|      0|#define NETSNMP_CALLBACK_OP_SEND_FAILED		3
  ------------------
 5423|      0|                                 pdu->reqid, pdu, cb_data);
 5424|      0|                        break;
 5425|      0|                }
 5426|      0|            }
 5427|       |            /** no packet to send?? */
 5428|      0|            return 0;
 5429|      0|        }
 5430|      3|    }
 5431|       |
 5432|       |    /*
 5433|       |     * Send the message.  
 5434|       |     */
 5435|       |
 5436|      3|    DEBUGMSGTL(("sess_process_packet", "sending message id#%ld reqid#%ld len %"
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 3]
  |  |  ------------------
  ------------------
 5437|      3|                NETSNMP_PRIz "u\n", pdu->msgid, pdu->reqid, isp->opacket_len));
 5438|      3|    result = netsnmp_transport_send(transport, isp->opacket, isp->opacket_len,
 5439|      3|                                    &(pdu->transport_data),
 5440|      3|                                    &(pdu->transport_data_length));
 5441|       |
 5442|      3|    SNMP_FREE(isp->obuf);
  ------------------
  |  |   62|      3|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 3, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 3]
  |  |  ------------------
  ------------------
 5443|      3|    isp->opacket = NULL; /* opacket was in obuf, so no free needed */
 5444|      3|    isp->opacket_len = 0;
 5445|       |
 5446|      3|    if (result < 0) {
  ------------------
  |  Branch (5446:9): [True: 0, False: 3]
  ------------------
 5447|      0|        session->s_snmp_errno = SNMPERR_BAD_SENDTO;
  ------------------
  |  |  229|      0|#define SNMPERR_BAD_SENDTO		(-12)
  ------------------
 5448|      0|        session->s_errno = errno;
 5449|      0|        if (callback)
  ------------------
  |  Branch (5449:13): [True: 0, False: 0]
  ------------------
 5450|      0|            callback(NETSNMP_CALLBACK_OP_SEND_FAILED, session,
  ------------------
  |  |  354|      0|#define NETSNMP_CALLBACK_OP_SEND_FAILED		3
  ------------------
 5451|      0|                     pdu->reqid, pdu, cb_data);
 5452|      0|        return 0;
 5453|      0|    }
 5454|       |
 5455|      3|    reqid = pdu->reqid;
 5456|       |
 5457|       |    /*
 5458|       |     * Bug 2387: 0 is a valid request id, so since reqid is used as a return
 5459|       |     * code with 0 meaning an error, set reqid to 1 if there is no error. This
 5460|       |     * does not affect the request id in the packet and fixes a memory leak
 5461|       |     * for incoming PDUs with a request id of 0. This could cause some
 5462|       |     * confusion if the caller is expecting the request id to match the
 5463|       |     * return code, as the documentation states it will. Most example code
 5464|       |     * just checks for non-zero, so hopefully this wont be an issue.
 5465|       |     */
 5466|      3|    if (0 == reqid && (SNMPERR_SUCCESS == session->s_snmp_errno))
  ------------------
  |  |  217|      3|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (5466:9): [True: 3, False: 0]
  |  Branch (5466:23): [True: 3, False: 0]
  ------------------
 5467|      3|        ++reqid;
 5468|       |
 5469|       |    /*
 5470|       |     * Add to pending requests list if we expect a response.  
 5471|       |     */
 5472|      3|    if (pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE) {
  ------------------
  |  |  312|      3|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
  |  Branch (5472:9): [True: 0, False: 3]
  ------------------
 5473|      0|        netsnmp_request_list *rp;
 5474|      0|        struct timeval  tv;
 5475|       |
 5476|      0|        rp = calloc(1, sizeof(netsnmp_request_list));
 5477|      0|        if (rp == NULL) {
  ------------------
  |  Branch (5477:13): [True: 0, False: 0]
  ------------------
 5478|      0|            session->s_snmp_errno = SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5479|      0|            return 0;
 5480|      0|        }
 5481|       |
 5482|      0|        netsnmp_get_monotonic_clock(&tv);
 5483|      0|        rp->pdu = pdu;
 5484|      0|        rp->request_id = pdu->reqid;
 5485|      0|        rp->message_id = pdu->msgid;
 5486|      0|        rp->callback = callback;
 5487|      0|        rp->cb_data = cb_data;
 5488|      0|        rp->retries = 0;
 5489|      0|        if (pdu->flags & UCD_MSG_FLAG_PDU_TIMEOUT) {
  ------------------
  |  |  315|      0|#define UCD_MSG_FLAG_PDU_TIMEOUT            0x1000
  ------------------
  |  Branch (5489:13): [True: 0, False: 0]
  ------------------
 5490|      0|            rp->timeout = pdu->time * 1000000L;
 5491|      0|        } else {
 5492|      0|            rp->timeout = session->timeout;
 5493|      0|        }
 5494|      0|        rp->timeM = tv;
 5495|      0|        tv.tv_usec += rp->timeout;
 5496|      0|        tv.tv_sec += tv.tv_usec / 1000000L;
 5497|      0|        tv.tv_usec %= 1000000L;
 5498|      0|        rp->expireM = tv;
 5499|       |
 5500|       |        /*
 5501|       |         * XX lock should be per session ! 
 5502|       |         */
 5503|      0|        snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|      0|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5504|      0|        if (isp->requestsEnd) {
  ------------------
  |  Branch (5504:13): [True: 0, False: 0]
  ------------------
 5505|      0|            rp->next_request = isp->requestsEnd->next_request;
 5506|      0|            isp->requestsEnd->next_request = rp;
 5507|      0|            isp->requestsEnd = rp;
 5508|      0|        } else {
 5509|      0|            rp->next_request = isp->requests;
 5510|      0|            isp->requests = rp;
 5511|      0|            isp->requestsEnd = rp;
 5512|      0|        }
 5513|      0|        snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|      0|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5514|      3|    } else {
 5515|       |        /*
 5516|       |         * No response expected...  
 5517|       |         */
 5518|      3|        if (reqid) {
  ------------------
  |  Branch (5518:13): [True: 3, False: 0]
  ------------------
 5519|       |            /*
 5520|       |             * Free v1 or v2 TRAP PDU iff no error  
 5521|       |             */
 5522|      3|            snmp_free_pdu(pdu);
 5523|      3|        }
 5524|      3|    }
 5525|       |
 5526|      3|    return reqid;
 5527|      3|}
snmp_api.c:_sess_read_dgram_packet:
 6135|     65|{
 6136|     65|    netsnmp_session *sp = slp ? slp->session : NULL;
  ------------------
  |  Branch (6136:27): [True: 65, False: 0]
  ------------------
 6137|     65|    struct snmp_internal_session *isp = slp ? slp->internal : NULL;
  ------------------
  |  Branch (6137:41): [True: 65, False: 0]
  ------------------
 6138|     65|    netsnmp_transport *transport = slp ? slp->transport : NULL;
  ------------------
  |  Branch (6138:36): [True: 65, False: 0]
  ------------------
 6139|       |
 6140|     65|    if (!sp || !isp || !transport || !rcvp ) {
  ------------------
  |  Branch (6140:9): [True: 0, False: 65]
  |  Branch (6140:16): [True: 0, False: 65]
  |  Branch (6140:24): [True: 0, False: 65]
  |  Branch (6140:38): [True: 0, False: 65]
  ------------------
 6141|      0|        DEBUGMSGTL(("sess_read_packet", "missing arguments\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]
  |  |  ------------------
  ------------------
 6142|      0|        return -2;
 6143|      0|    }
 6144|       |
 6145|     65|    if (transport->flags & NETSNMP_TRANSPORT_FLAG_STREAM)
  ------------------
  |  |   51|     65|#define		NETSNMP_TRANSPORT_FLAG_STREAM	 0x01
  ------------------
  |  Branch (6145:9): [True: 0, False: 65]
  ------------------
 6146|      0|        return -2;
 6147|       |
 6148|     65|    if (NULL != rcvp->packet) {
  ------------------
  |  Branch (6148:9): [True: 0, False: 65]
  ------------------
 6149|      0|        snmp_log(LOG_WARNING, "overwriting existing saved packet; sess %p\n",
 6150|      0|                 sp);
 6151|      0|        SNMP_FREE(rcvp->packet);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6152|      0|    }
 6153|       |
 6154|     65|    if ((rcvp->packet = (u_char *) malloc(SNMP_MAX_RCV_MSG_SIZE)) == NULL) {
  ------------------
  |  |  141|     65|#define SNMP_MAX_RCV_MSG_SIZE      65536
  ------------------
  |  Branch (6154:9): [True: 0, False: 65]
  ------------------
 6155|      0|        DEBUGMSGTL(("sess_read_packet", "can't malloc %u bytes for packet\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]
  |  |  ------------------
  ------------------
 6156|      0|                    SNMP_MAX_RCV_MSG_SIZE));
 6157|      0|        return -2;
 6158|      0|    }
 6159|       |
 6160|     65|    rcvp->packet_len = netsnmp_transport_recv(transport, rcvp->packet,
 6161|     65|                                              SNMP_MAX_RCV_MSG_SIZE,
  ------------------
  |  |  141|     65|#define SNMP_MAX_RCV_MSG_SIZE      65536
  ------------------
 6162|     65|                                              &rcvp->opaque, &rcvp->olength);
 6163|     65|    if (rcvp->packet_len == -1) {
  ------------------
  |  Branch (6163:9): [True: 0, False: 65]
  ------------------
 6164|      0|        sp->s_snmp_errno = SNMPERR_BAD_RECVFROM;
  ------------------
  |  |  242|      0|#define SNMPERR_BAD_RECVFROM 		(-25)
  ------------------
 6165|      0|        sp->s_errno = errno;
 6166|      0|        snmp_set_detail(strerror(errno));
 6167|      0|        SNMP_FREE(rcvp->packet);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6168|      0|        SNMP_FREE(rcvp->opaque);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6169|      0|        return -1;
 6170|      0|    }
 6171|       |
 6172|       |    /** clear so any other sess sharing this socket won't try reading again */
 6173|     65|    NETSNMP_LARGE_FD_CLR(transport->sock, fdset);
  ------------------
  |  |   43|     65|                    netsnmp_large_fd_clr(fd, fdset)
  ------------------
 6174|       |
 6175|     65|    if (0 == rcvp->packet_len &&
  ------------------
  |  Branch (6175:9): [True: 0, False: 65]
  ------------------
 6176|      0|        transport->flags & NETSNMP_TRANSPORT_FLAG_EMPTY_PKT) {
  ------------------
  |  |   56|      0|#define		NETSNMP_TRANSPORT_FLAG_EMPTY_PKT 0x10
  ------------------
  |  Branch (6176:9): [True: 0, False: 0]
  ------------------
 6177|       |        /* this allows for a transport that needs to return from
 6178|       |         * packet processing that doesn't necessarily have any
 6179|       |         * consumable data in it. */
 6180|       |
 6181|       |        /* reset the flag since it's a per-message flag */
 6182|      0|        transport->flags &= (~NETSNMP_TRANSPORT_FLAG_EMPTY_PKT);
  ------------------
  |  |   56|      0|#define		NETSNMP_TRANSPORT_FLAG_EMPTY_PKT 0x10
  ------------------
 6183|       |
 6184|       |        /** free packet */
 6185|      0|        SNMP_FREE(rcvp->packet);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6186|      0|        SNMP_FREE(rcvp->opaque);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 6187|       |
 6188|      0|        return -2;
 6189|      0|    }
 6190|       |
 6191|     65|    return 0;
 6192|     65|}
snmp_api.c:_sess_process_packet:
 5976|     65|{
 5977|     65|    netsnmp_pdu         *pdu;
 5978|     65|    int                  rc;
 5979|       |
 5980|     65|    pdu = _sess_process_packet_parse_pdu(slp, sp, isp, transport, opaque,
 5981|     65|                                         olength, packetptr, length);
 5982|     65|    if (NULL == pdu)
  ------------------
  |  Branch (5982:9): [True: 65, False: 0]
  ------------------
 5983|     65|        return -1;
 5984|       |
 5985|       |    /*
 5986|       |     * find session to process pdu. usually that will be the current session,
 5987|       |     * but with the introduction of shared transports, another session may
 5988|       |     * have the same socket.
 5989|       |     */
 5990|      0|    do {
 5991|      0|        rc = _sess_process_packet_handle_pdu(slp, sp, isp, transport, pdu);
 5992|      0|        if (-2 != rc || !(transport->flags & NETSNMP_TRANSPORT_FLAG_SHARED))
  ------------------
  |  |   58|      0|#define		NETSNMP_TRANSPORT_FLAG_SHARED	 0x40
  ------------------
  |  Branch (5992:13): [True: 0, False: 0]
  |  Branch (5992:25): [True: 0, False: 0]
  ------------------
 5993|      0|            break;
 5994|       |
 5995|       |        /** -2 means pdu not in request list. check other sessions */
 5996|      0|        do  {
 5997|      0|            slp = slp->next;
 5998|      0|        } while (slp && slp->transport->sock != transport->sock);
  ------------------
  |  Branch (5998:18): [True: 0, False: 0]
  |  Branch (5998:25): [True: 0, False: 0]
  ------------------
 5999|      0|        if (!slp)
  ------------------
  |  Branch (5999:13): [True: 0, False: 0]
  ------------------
 6000|      0|            break; /* no more sessions with same socket */
 6001|       |
 6002|      0|        sp = slp->session;
 6003|      0|        isp = slp->internal;
 6004|      0|        transport = slp->transport;
 6005|      0|    } while(slp);
  ------------------
  |  Branch (6005:13): [True: 0, False: 0]
  ------------------
 6006|       |
 6007|      0|    if (-2 == rc) { /* did not find session for pdu */
  ------------------
  |  Branch (6007:9): [True: 0, False: 0]
  ------------------
 6008|      0|        snmp_increment_statistic(STAT_SNMPUNKNOWNPDUHANDLERS);
  ------------------
  |  |  646|      0|#define   STAT_SNMPUNKNOWNPDUHANDLERS        2
  ------------------
 6009|      0|        DEBUGMSGTL(("sess_process_packet", "unhandled PDU\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]
  |  |  ------------------
  ------------------
 6010|      0|        snmp_free_pdu(pdu);
 6011|      0|    }
 6012|       |
 6013|      0|  return rc;
 6014|     65|}
snmp_api.c:_sess_process_packet_parse_pdu:
 5665|     65|{
 5666|     65|  netsnmp_pdu    *pdu;
 5667|     65|  int             ret = 0;
 5668|     65|  int             dump = 0, filter = 0;
 5669|       |
 5670|     65|  debug_indent_reset();
 5671|       |
 5672|     65|  DEBUGMSGTL(("sess_process_packet",
  ------------------
  |  |   66|     65|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 65]
  |  |  ------------------
  ------------------
 5673|     65|	      "session %p fd %d pkt %p length %d\n", slp,
 5674|     65|	      transport->sock, packetptr, length));
 5675|       |
 5676|     65|  dump = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     65|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 5677|     65|                                NETSNMP_DS_LIB_DUMP_PACKET);
  ------------------
  |  |   63|     65|#define NETSNMP_DS_LIB_DUMP_PACKET         4
  ------------------
 5678|     65|#ifndef NETSNMP_FEATURE_REMOVE_FILTER_SOURCE
 5679|     65|  filter = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     65|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 5680|     65|                                  NETSNMP_DS_LIB_FILTER_TYPE);
  ------------------
  |  |  133|     65|#define NETSNMP_DS_LIB_FILTER_TYPE         17 /* 0=NONE, 1=whitelist, -1=blacklist */
  ------------------
 5681|     65|#endif
 5682|     65|  if (dump || filter) {
  ------------------
  |  Branch (5682:7): [True: 0, False: 65]
  |  Branch (5682:15): [True: 0, False: 65]
  ------------------
 5683|      0|      int filtered = 0;
 5684|      0|      char *addrtxt = netsnmp_transport_peer_string(transport, opaque, olength);
 5685|      0|      snmp_log(LOG_DEBUG, "\nReceived %d byte packet from %s\n",
 5686|      0|               length, addrtxt);
 5687|       |
 5688|      0|      if (dump)
  ------------------
  |  Branch (5688:11): [True: 0, False: 0]
  ------------------
 5689|      0|          xdump(packetptr, length, "");
 5690|       |
 5691|      0|#ifndef NETSNMP_FEATURE_REMOVE_FILTER_SOURCE
 5692|      0|      if (filter) {
  ------------------
  |  Branch (5692:11): [True: 0, False: 0]
  ------------------
 5693|      0|          char *sourceaddr = NULL, *c = strchr(addrtxt, '[');
 5694|      0|          const char *dropstr = NULL;
 5695|      0|          if (c) {
  ------------------
  |  Branch (5695:15): [True: 0, False: 0]
  ------------------
 5696|      0|              sourceaddr = ++c;
 5697|      0|              c = strchr(sourceaddr, ']');
 5698|      0|              if (c)
  ------------------
  |  Branch (5698:19): [True: 0, False: 0]
  ------------------
 5699|      0|                  *c = 0;
 5700|      0|              filtered = netsnmp_transport_filter_check(sourceaddr);
 5701|      0|          }
 5702|      0|          else if (!strncmp(addrtxt, "callback", 8)) {
  ------------------
  |  Branch (5702:20): [True: 0, False: 0]
  ------------------
 5703|       |              /* do not filter internal request */
 5704|      0|              DEBUGMSGTL(("sess_process_packet:filter",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 5705|      0|                          "bypass packet from %s \n",
 5706|      0|                          addrtxt));
 5707|      0|              filtered = 1;
 5708|      0|          }
 5709|      0|          if ((filter == -1) && filtered)
  ------------------
  |  Branch (5709:15): [True: 0, False: 0]
  |  Branch (5709:33): [True: 0, False: 0]
  ------------------
 5710|      0|              dropstr = "matched blacklist";
 5711|      0|          else if ((filter == 1) && !filtered)
  ------------------
  |  Branch (5711:20): [True: 0, False: 0]
  |  Branch (5711:37): [True: 0, False: 0]
  ------------------
 5712|      0|              dropstr = "didn't match whitelist";
 5713|      0|          if (dropstr) {
  ------------------
  |  Branch (5713:15): [True: 0, False: 0]
  ------------------
 5714|      0|              DEBUGMSGTL(("sess_process_packet:filter",
  ------------------
  |  |   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 (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5715|      0|                          "packet from %s %s\n",
 5716|      0|                          sourceaddr ? sourceaddr : "UNKNOWN", dropstr));
 5717|      0|              SNMP_FREE(opaque);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 5718|      0|              SNMP_FREE(addrtxt);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 5719|      0|              return NULL;
 5720|      0|          }
 5721|      0|      }
 5722|      0|#endif
 5723|       |
 5724|      0|      SNMP_FREE(addrtxt);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 5725|      0|  }
 5726|       |
 5727|       |  /*
 5728|       |   * Do transport-level filtering (e.g. IP-address based allow/deny).  
 5729|       |   */
 5730|       |
 5731|     65|  if (isp->hook_pre) {
  ------------------
  |  Branch (5731:7): [True: 0, False: 65]
  ------------------
 5732|      0|    if (isp->hook_pre(sp, transport, opaque, olength) == 0) {
  ------------------
  |  Branch (5732:9): [True: 0, False: 0]
  ------------------
 5733|      0|      DEBUGMSGTL(("sess_process_packet", "pre-parse fail\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]
  |  |  ------------------
  ------------------
 5734|      0|      SNMP_FREE(opaque);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 5735|      0|      return NULL;
 5736|      0|    }
 5737|      0|  }
 5738|       |
 5739|     65|  if (isp->hook_create_pdu) {
  ------------------
  |  Branch (5739:7): [True: 0, False: 65]
  ------------------
 5740|      0|    pdu = isp->hook_create_pdu(transport, opaque, olength);
 5741|     65|  } else {
 5742|     65|    pdu = snmp_create_sess_pdu(transport, opaque, olength);
 5743|     65|  }
 5744|       |
 5745|     65|  if (pdu == NULL) {
  ------------------
  |  Branch (5745:7): [True: 0, False: 65]
  ------------------
 5746|      0|    snmp_log(LOG_ERR, "pdu failed to be created\n");
 5747|      0|    SNMP_FREE(opaque);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 5748|      0|    return NULL;
 5749|      0|  }
 5750|       |
 5751|       |  /* if the transport was a magic tunnel, mark the PDU as having come
 5752|       |     through one. */
 5753|     65|  if (transport->flags & NETSNMP_TRANSPORT_FLAG_TUNNELED) {
  ------------------
  |  |   53|     65|#define		NETSNMP_TRANSPORT_FLAG_TUNNELED	 0x04
  ------------------
  |  Branch (5753:7): [True: 0, False: 65]
  ------------------
 5754|      0|      pdu->flags |= UCD_MSG_FLAG_TUNNELED;
  ------------------
  |  |  317|      0|#define UCD_MSG_FLAG_TUNNELED               0x4000
  ------------------
 5755|      0|  }
 5756|       |
 5757|     65|  if (isp->hook_parse) {
  ------------------
  |  Branch (5757:7): [True: 0, False: 65]
  ------------------
 5758|      0|    ret = isp->hook_parse(sp, pdu, packetptr, length);
 5759|     65|  } else {
 5760|     65|    ret = snmp_parse(slp, sp, pdu, packetptr, length);
 5761|     65|  }
 5762|       |
 5763|     65|  DEBUGMSGTL(("sess_process_packet", "received message id#%ld reqid#%ld len "
  ------------------
  |  |   66|     65|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 65]
  |  |  ------------------
  ------------------
 5764|     65|              "%u\n", pdu->msgid, pdu->reqid, length));
 5765|       |
 5766|     65|  if (ret != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|     65|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
  |  Branch (5766:7): [True: 65, False: 0]
  ------------------
 5767|     65|    DEBUGMSGTL(("sess_process_packet", "parse fail\n"));
  ------------------
  |  |   66|     65|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 65]
  |  |  ------------------
  ------------------
 5768|     65|  }
 5769|       |
 5770|     65|  if (isp->hook_post) {
  ------------------
  |  Branch (5770:7): [True: 0, False: 65]
  ------------------
 5771|      0|    if (isp->hook_post(sp, pdu, ret) == 0) {
  ------------------
  |  Branch (5771:9): [True: 0, False: 0]
  ------------------
 5772|      0|      DEBUGMSGTL(("sess_process_packet", "post-parse fail\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]
  |  |  ------------------
  ------------------
 5773|      0|      ret = SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 5774|      0|    }
 5775|      0|  }
 5776|       |
 5777|     65|  if (ret != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|     65|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
  |  Branch (5777:7): [True: 65, False: 0]
  ------------------
 5778|     65|    snmp_free_pdu(pdu);
 5779|     65|    return NULL;
 5780|     65|  }
 5781|       |
 5782|      0|  return pdu;
 5783|     65|}

snmp_comstr_parse:
  109|      4|{
  110|      4|    u_char          type;
  111|      4|    long            ver;
  112|      4|    size_t          origlen = *slen;
  113|       |
  114|       |    /*
  115|       |     * Message is an ASN.1 SEQUENCE.
  116|       |     */
  117|      4|    data = asn_parse_sequence(data, length, &type,
  118|      4|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|      4|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
  119|      4|                              "auth message");
  120|      4|    if (data == NULL) {
  ------------------
  |  Branch (120:9): [True: 0, False: 4]
  ------------------
  121|      0|        return NULL;
  122|      0|    }
  123|       |
  124|       |    /*
  125|       |     * First field is the version.
  126|       |     */
  127|      4|    DEBUGDUMPHEADER("recv", "SNMP version");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
  128|      4|    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
  129|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
  130|      4|    *version = ver;
  131|      4|    if (data == NULL) {
  ------------------
  |  Branch (131:9): [True: 0, False: 4]
  ------------------
  132|      0|        ERROR_MSG("bad parse of version");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  133|      0|        return NULL;
  134|      0|    }
  135|       |
  136|       |    /*
  137|       |     * second field is the community string for SNMPv1 & SNMPv2c 
  138|       |     */
  139|      4|    DEBUGDUMPHEADER("recv", "community string");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
  140|      4|    data = asn_parse_string(data, length, &type, psid, slen);
  141|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
  142|      4|    if (data == NULL) {
  ------------------
  |  Branch (142:9): [True: 1, False: 3]
  ------------------
  143|      1|        ERROR_MSG("bad parse of community");
  ------------------
  |  |  188|      1|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  144|      1|        return NULL;
  145|      1|    }
  146|      3|    psid[SNMP_MIN(*slen, origlen - 1)] = '\0';
  ------------------
  |  |  111|      3|#define SNMP_MIN(a,b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (111:24): [True: 0, False: 3]
  |  |  ------------------
  ------------------
  147|      3|    return (u_char *) data;
  148|       |
  149|      4|}                               /* end snmp_comstr_parse() */

snmp_clone_mem:
  307|     21|{
  308|     21|    *dstPtr = NULL;
  309|     21|    if (srcPtr) {
  ------------------
  |  Branch (309:9): [True: 12, False: 9]
  ------------------
  310|     12|        *dstPtr = malloc(len + 1);
  311|     12|        if (!*dstPtr) {
  ------------------
  |  Branch (311:13): [True: 0, False: 12]
  ------------------
  312|      0|            return 1;
  313|      0|        }
  314|     12|        memmove(*dstPtr, srcPtr, len);
  315|       |        /*
  316|       |         * this is for those routines that expect 0-terminated strings!!!
  317|       |         * someone should rather have called strdup
  318|       |         */
  319|     12|        ((char *) *dstPtr)[len] = 0;
  320|     12|    }
  321|     21|    return 0;
  322|     21|}
snmp_clone_pdu:
  590|      3|{
  591|      3|    return _clone_pdu(pdu, 0);  /* copies all variables */
  592|      3|}
snmp_set_var_objid:
  688|      3|{
  689|      3|    size_t          len = sizeof(oid) * name_length;
  690|       |
  691|      3|    if (vp->name != vp->name_loc && vp->name != NULL) {
  ------------------
  |  Branch (691:9): [True: 3, False: 0]
  |  Branch (691:37): [True: 0, False: 3]
  ------------------
  692|       |        /*
  693|       |         * Probably previously-allocated "big storage".  Better free it
  694|       |         * else memory leaks possible.  
  695|       |         */
  696|      0|        free(vp->name);
  697|      0|    }
  698|       |
  699|       |    /*
  700|       |     * use built-in storage for smaller values 
  701|       |     */
  702|      3|    if (len <= sizeof(vp->name_loc)) {
  ------------------
  |  Branch (702:9): [True: 3, False: 0]
  ------------------
  703|      3|        vp->name = vp->name_loc;
  704|      3|    } else {
  705|      0|        vp->name = (oid *) malloc(len);
  706|      0|        if (!vp->name)
  ------------------
  |  Branch (706:13): [True: 0, False: 0]
  ------------------
  707|      0|            return 1;
  708|      0|    }
  709|      3|    if (objid)
  ------------------
  |  Branch (709:9): [True: 3, False: 0]
  ------------------
  710|      3|        memmove(vp->name, objid, len);
  711|      3|    vp->name_length = name_length;
  712|      3|    return 0;
  713|      3|}
snmp_set_var_value:
  804|      3|{
  805|      3|    int             largeval = 1;
  806|       |
  807|       |    /*
  808|       |     * xxx-rks: why the unconditional free? why not use existing
  809|       |     * memory, if len < vars->val_len ?
  810|       |     */
  811|      3|    if (vars->val.string && vars->val.string != vars->buf) {
  ------------------
  |  Branch (811:9): [True: 0, False: 3]
  |  Branch (811:29): [True: 0, False: 0]
  ------------------
  812|      0|        free(vars->val.string);
  813|      0|    }
  814|      3|    vars->val.string = NULL;
  815|      3|    vars->val_len = 0;
  816|       |
  817|      3|    if (value == NULL && len > 0) {
  ------------------
  |  Branch (817:9): [True: 0, False: 3]
  |  Branch (817:26): [True: 0, False: 0]
  ------------------
  818|      0|        snmp_log(LOG_ERR, "bad size for NULL value\n");
  819|      0|        return 1;
  820|      0|    }
  821|       |
  822|       |    /*
  823|       |     * use built-in storage for smaller values 
  824|       |     */
  825|      3|    if (len <= sizeof(vars->buf)) {
  ------------------
  |  Branch (825:9): [True: 3, False: 0]
  ------------------
  826|      3|        vars->val.string = (u_char *) vars->buf;
  827|      3|        largeval = 0;
  828|      3|    }
  829|       |
  830|      3|    if ((0 == len) || (NULL == value)) {
  ------------------
  |  Branch (830:9): [True: 0, False: 3]
  |  Branch (830:23): [True: 0, False: 3]
  ------------------
  831|      0|        vars->val.string[0] = 0;
  832|      0|        return 0;
  833|      0|    }
  834|       |
  835|      3|    vars->val_len = len;
  836|      3|    switch (vars->type) {
  837|      0|    case ASN_INTEGER:
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (837:5): [True: 0, False: 3]
  ------------------
  838|      0|    case ASN_UNSIGNED:
  ------------------
  |  |   91|      0|#define ASN_UNSIGNED    (ASN_APPLICATION | 2)   /* RFC 1902 - same as GAUGE */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (838:5): [True: 0, False: 3]
  ------------------
  839|      0|    case ASN_TIMETICKS:
  ------------------
  |  |   92|      0|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (839:5): [True: 0, False: 3]
  ------------------
  840|      3|    case ASN_COUNTER:
  ------------------
  |  |   89|      3|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|      3|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (840:5): [True: 3, False: 0]
  ------------------
  841|      3|    case ASN_UINTEGER:
  ------------------
  |  |  100|      3|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      3|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (841:5): [True: 0, False: 3]
  ------------------
  842|      3|        if (vars->val_len == sizeof(int)) {
  ------------------
  |  Branch (842:13): [True: 0, False: 3]
  ------------------
  843|      0|            if (ASN_INTEGER == vars->type) {
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (843:17): [True: 0, False: 0]
  ------------------
  844|      0|                const int      *val_int 
  845|      0|                    = (const int *) value;
  846|      0|                *(vars->val.integer) = (long) *val_int;
  847|      0|            } else {
  848|      0|                const u_int    *val_uint
  849|      0|                    = (const u_int *) value;
  850|      0|                *(vars->val.integer) = (unsigned long) *val_uint;
  851|      0|            }
  852|      0|        }
  853|      3|        else if (vars->val_len == sizeof(long)){
  ------------------
  |  Branch (853:18): [True: 3, False: 0]
  ------------------
  854|      3|            const u_long   *val_ulong
  855|      3|                = (const u_long *) value;
  856|      3|            *(vars->val.integer) = *val_ulong;
  857|      3|            if (*(vars->val.integer) > 0xffffffff) {
  ------------------
  |  Branch (857:17): [True: 0, False: 3]
  ------------------
  858|      0|                NETSNMP_LOGONCE((LOG_INFO,
  ------------------
  |  |   37|      0|#define NETSNMP_LOGONCE(x) do { \
  |  |   38|      0|        static char logged = 0; \
  |  |   39|      0|        if (!logged) {          \
  |  |  ------------------
  |  |  |  Branch (39:13): [True: 0, False: 0]
  |  |  ------------------
  |  |   40|      0|            logged = 1;         \
  |  |   41|      0|            snmp_log x ;        \
  |  |   42|      0|        }                       \
  |  |   43|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (43:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  859|      0|                                 "truncating integer value > 32 bits\n"));
  860|      0|                *(vars->val.integer) &= 0xffffffff;
  861|      0|            }
  862|      3|        }
  863|      0|        else if (vars->val_len == sizeof(long long)){
  ------------------
  |  Branch (863:18): [True: 0, False: 0]
  ------------------
  864|      0|            const unsigned long long   *val_ullong
  865|      0|                = (const unsigned long long *) value;
  866|      0|            *(vars->val.integer) = (long) *val_ullong;
  867|      0|            if (*(vars->val.integer) > 0xffffffff) {
  ------------------
  |  Branch (867:17): [True: 0, False: 0]
  ------------------
  868|      0|                NETSNMP_LOGONCE((LOG_INFO,
  ------------------
  |  |   37|      0|#define NETSNMP_LOGONCE(x) do { \
  |  |   38|      0|        static char logged = 0; \
  |  |   39|      0|        if (!logged) {          \
  |  |  ------------------
  |  |  |  Branch (39:13): [True: 0, False: 0]
  |  |  ------------------
  |  |   40|      0|            logged = 1;         \
  |  |   41|      0|            snmp_log x ;        \
  |  |   42|      0|        }                       \
  |  |   43|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (43:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  869|      0|                                 "truncating integer value > 32 bits\n"));
  870|      0|                *(vars->val.integer) &= 0xffffffff;
  871|      0|            }
  872|      0|        }
  873|      0|        else if (vars->val_len == sizeof(intmax_t)){
  ------------------
  |  Branch (873:18): [True: 0, False: 0]
  ------------------
  874|      0|            const uintmax_t *val_uintmax_t
  875|      0|                = (const uintmax_t *) value;
  876|      0|            *(vars->val.integer) = (long) *val_uintmax_t;
  877|      0|            if (*(vars->val.integer) > 0xffffffff) {
  ------------------
  |  Branch (877:17): [True: 0, False: 0]
  ------------------
  878|      0|                NETSNMP_LOGONCE((LOG_INFO,
  ------------------
  |  |   37|      0|#define NETSNMP_LOGONCE(x) do { \
  |  |   38|      0|        static char logged = 0; \
  |  |   39|      0|        if (!logged) {          \
  |  |  ------------------
  |  |  |  Branch (39:13): [True: 0, False: 0]
  |  |  ------------------
  |  |   40|      0|            logged = 1;         \
  |  |   41|      0|            snmp_log x ;        \
  |  |   42|      0|        }                       \
  |  |   43|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (43:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  879|      0|                                 "truncating integer value > 32 bits\n"));
  880|      0|                *(vars->val.integer) &= 0xffffffff;
  881|      0|            }
  882|      0|        }
  883|      0|        else if (vars->val_len == sizeof(short)) {
  ------------------
  |  Branch (883:18): [True: 0, False: 0]
  ------------------
  884|      0|            if (ASN_INTEGER == vars->type) {
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (884:17): [True: 0, False: 0]
  ------------------
  885|      0|                const short      *val_short 
  886|      0|                    = (const short *) value;
  887|      0|                *(vars->val.integer) = (long) *val_short;
  888|      0|            } else {
  889|      0|                const u_short    *val_ushort
  890|      0|                    = (const u_short *) value;
  891|      0|                *(vars->val.integer) = (unsigned long) *val_ushort;
  892|      0|            }
  893|      0|        }
  894|      0|        else if (vars->val_len == sizeof(char)) {
  ------------------
  |  Branch (894:18): [True: 0, False: 0]
  ------------------
  895|      0|            if (ASN_INTEGER == vars->type) {
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (895:17): [True: 0, False: 0]
  ------------------
  896|      0|                const signed char   *val_char
  897|      0|                    = (const signed char *) value;
  898|      0|                *(vars->val.integer) = (long) *val_char;
  899|      0|            } else {
  900|      0|                    const u_char    *val_uchar
  901|      0|                    = (const u_char *) value;
  902|      0|                *(vars->val.integer) = (unsigned long) *val_uchar;
  903|      0|            }
  904|      0|        }
  905|      0|        else {
  906|      0|            snmp_log(LOG_ERR,"bad size for integer-like type (%d)\n",
  907|      0|                     (int)vars->val_len);
  908|      0|            return (1);
  909|      0|        }
  910|      3|        vars->val_len = sizeof(long);
  911|      3|        break;
  912|       |
  913|      0|    case ASN_OBJECT_ID:
  ------------------
  |  |   81|      0|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (913:5): [True: 0, False: 3]
  ------------------
  914|      0|    case ASN_PRIV_IMPLIED_OBJECT_ID:
  ------------------
  |  |  205|      0|#define ASN_PRIV_IMPLIED_OBJECT_ID  (ASN_PRIVATE | ASN_OBJECT_ID)       /* 6 */
  |  |  ------------------
  |  |  |  |   93|      0|#define ASN_PRIVATE	    0xC0U
  |  |  ------------------
  |  |               #define ASN_PRIV_IMPLIED_OBJECT_ID  (ASN_PRIVATE | ASN_OBJECT_ID)       /* 6 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_OBJECT_ID	    0x06U
  |  |  ------------------
  ------------------
  |  Branch (914:5): [True: 0, False: 3]
  ------------------
  915|      0|    case ASN_PRIV_INCL_RANGE:
  ------------------
  |  |  201|      0|#define ASN_PRIV_INCL_RANGE (ASN_PRIVATE | 2)
  |  |  ------------------
  |  |  |  |   93|      0|#define ASN_PRIVATE	    0xC0U
  |  |  ------------------
  ------------------
  |  Branch (915:5): [True: 0, False: 3]
  ------------------
  916|      0|    case ASN_PRIV_EXCL_RANGE:
  ------------------
  |  |  202|      0|#define ASN_PRIV_EXCL_RANGE (ASN_PRIVATE | 3)
  |  |  ------------------
  |  |  |  |   93|      0|#define ASN_PRIVATE	    0xC0U
  |  |  ------------------
  ------------------
  |  Branch (916:5): [True: 0, False: 3]
  ------------------
  917|      0|        if (largeval) {
  ------------------
  |  Branch (917:13): [True: 0, False: 0]
  ------------------
  918|      0|            vars->val.objid = (oid *) malloc(vars->val_len);
  919|      0|        }
  920|      0|        if (vars->val.objid == NULL) {
  ------------------
  |  Branch (920:13): [True: 0, False: 0]
  ------------------
  921|      0|            snmp_log(LOG_ERR,"no storage for OID\n");
  922|      0|            return 1;
  923|      0|        }
  924|      0|        memmove(vars->val.objid, value, vars->val_len);
  925|      0|        break;
  926|       |
  927|      0|    case ASN_IPADDRESS: /* snmp_build_var_op treats IPADDR like a string */
  ------------------
  |  |   88|      0|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (927:5): [True: 0, False: 3]
  ------------------
  928|      0|        if (4 != vars->val_len) {
  ------------------
  |  Branch (928:13): [True: 0, False: 0]
  ------------------
  929|      0|            netsnmp_assert("ipaddress length == 4");
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  930|      0|        }
  931|      0|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  932|      0|    case ASN_PRIV_IMPLIED_OCTET_STR:
  ------------------
  |  |  204|      0|#define ASN_PRIV_IMPLIED_OCTET_STR  (ASN_PRIVATE | ASN_OCTET_STR)       /* 4 */
  |  |  ------------------
  |  |  |  |   93|      0|#define ASN_PRIVATE	    0xC0U
  |  |  ------------------
  |  |               #define ASN_PRIV_IMPLIED_OCTET_STR  (ASN_PRIVATE | ASN_OCTET_STR)       /* 4 */
  |  |  ------------------
  |  |  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  |  |  ------------------
  ------------------
  |  Branch (932:5): [True: 0, False: 3]
  ------------------
  933|      0|    case ASN_OCTET_STR:
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (933:5): [True: 0, False: 3]
  ------------------
  934|      0|    case ASN_BIT_STR:
  ------------------
  |  |   77|      0|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (934:5): [True: 0, False: 3]
  ------------------
  935|      0|    case ASN_OPAQUE:
  ------------------
  |  |   93|      0|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (935:5): [True: 0, False: 3]
  ------------------
  936|      0|    case ASN_NSAP:
  ------------------
  |  |   98|      0|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (936:5): [True: 0, False: 3]
  ------------------
  937|      0|        if (vars->val_len >= sizeof(vars->buf)) {
  ------------------
  |  Branch (937:13): [True: 0, False: 0]
  ------------------
  938|      0|            vars->val.string = (u_char *) malloc(vars->val_len + 1);
  939|      0|        }
  940|      0|        if (vars->val.string == NULL) {
  ------------------
  |  Branch (940:13): [True: 0, False: 0]
  ------------------
  941|      0|            snmp_log(LOG_ERR,"no storage for string\n");
  942|      0|            return 1;
  943|      0|        }
  944|      0|        memmove(vars->val.string, value, vars->val_len);
  945|       |        /*
  946|       |         * Make sure the string is zero-terminated; some bits of code make
  947|       |         * this assumption.  Easier to do this here than fix all these wrong
  948|       |         * assumptions.  
  949|       |         */
  950|      0|        vars->val.string[vars->val_len] = '\0';
  951|      0|        break;
  952|       |
  953|      0|    case SNMP_NOSUCHOBJECT:
  ------------------
  |  |  201|      0|#define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (953:5): [True: 0, False: 3]
  ------------------
  954|      0|    case SNMP_NOSUCHINSTANCE:
  ------------------
  |  |  202|      0|#define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (954:5): [True: 0, False: 3]
  ------------------
  955|      0|    case SNMP_ENDOFMIBVIEW:
  ------------------
  |  |  203|      0|#define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (955:5): [True: 0, False: 3]
  ------------------
  956|      0|    case ASN_NULL:
  ------------------
  |  |   79|      0|#define ASN_NULL	    0x05U
  ------------------
  |  Branch (956:5): [True: 0, False: 3]
  ------------------
  957|      0|        vars->val_len = 0;
  958|      0|        vars->val.string = NULL;
  959|      0|        break;
  960|       |
  961|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
  962|      0|    case ASN_OPAQUE_U64:
  ------------------
  |  |  192|      0|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|      0|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (962:5): [True: 0, False: 3]
  ------------------
  963|      0|    case ASN_OPAQUE_I64:
  ------------------
  |  |  183|      0|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|      0|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (963:5): [True: 0, False: 3]
  ------------------
  964|      0|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
  965|      0|    case ASN_COUNTER64:
  ------------------
  |  |   99|      0|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (965:5): [True: 0, False: 3]
  ------------------
  966|      0|        if (largeval || vars->val_len != sizeof(struct counter64)) {
  ------------------
  |  Branch (966:13): [True: 0, False: 0]
  |  Branch (966:25): [True: 0, False: 0]
  ------------------
  967|      0|            snmp_log(LOG_ERR,"bad size for counter 64 (%d)\n",
  968|      0|                     (int)vars->val_len);
  969|      0|            return (1);
  970|      0|        }
  971|      0|        vars->val_len = sizeof(struct counter64);
  972|      0|        memmove(vars->val.counter64, value, vars->val_len);
  973|      0|        break;
  974|       |
  975|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
  976|      0|    case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|      0|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|      0|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (976:5): [True: 0, False: 3]
  ------------------
  977|      0|        if (largeval) {
  ------------------
  |  Branch (977:13): [True: 0, False: 0]
  ------------------
  978|      0|            snmp_log(LOG_ERR,"bad size for opaque float (%d)\n",
  979|      0|                     (int)vars->val_len);
  980|      0|            return (1);
  981|      0|        }
  982|      0|        vars->val_len = sizeof(float);
  983|      0|        memmove(vars->val.floatVal, value, vars->val_len);
  984|      0|        break;
  985|       |
  986|      0|    case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|      0|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|      0|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (986:5): [True: 0, False: 3]
  ------------------
  987|      0|        if (largeval) {
  ------------------
  |  Branch (987:13): [True: 0, False: 0]
  ------------------
  988|      0|            snmp_log(LOG_ERR,"bad size for opaque double (%d)\n",
  989|      0|                     (int)vars->val_len);
  990|      0|            return (1);
  991|      0|        }
  992|      0|        vars->val_len = sizeof(double);
  993|      0|        memmove(vars->val.doubleVal, value, vars->val_len);
  994|      0|        break;
  995|       |
  996|      0|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
  997|       |
  998|      0|    default:
  ------------------
  |  Branch (998:5): [True: 0, False: 3]
  ------------------
  999|      0|        snmp_log(LOG_ERR,"Internal error in type switching\n");
 1000|      0|        snmp_set_detail("Internal error in type switching\n");
 1001|      0|        return (1);
 1002|      3|    }
 1003|       |
 1004|      3|    return 0;
 1005|      3|}
snmp_client.c:_copy_varlist:
  425|      3|{                               /* !=0 number variables to copy */
  426|      3|    netsnmp_variable_list *newhead, *newvar, *oldvar;
  427|      3|    int             ii = 0;
  428|       |
  429|      3|    newhead = NULL;
  430|      3|    oldvar = NULL;
  431|       |
  432|      3|    while (var && (copy_count-- > 0)) {
  ------------------
  |  Branch (432:12): [True: 0, False: 3]
  |  Branch (432:19): [True: 0, False: 0]
  ------------------
  433|       |        /*
  434|       |         * Drop the specified variable (if applicable) 
  435|       |         * xxx hmm, is it intentional that dropping the errindex
  436|       |         *     counts towards copy_count?
  437|       |         */
  438|      0|        if (++ii == errindex) {
  ------------------
  |  Branch (438:13): [True: 0, False: 0]
  ------------------
  439|      0|            var = var->next_variable;
  440|      0|            continue;
  441|      0|        }
  442|       |
  443|       |        /*
  444|       |         * clone the next variable. Cleanup if alloc fails 
  445|       |         */
  446|      0|        newvar = (netsnmp_variable_list *)
  447|      0|            malloc(sizeof(netsnmp_variable_list));
  448|      0|        if (snmp_clone_var(var, newvar)) {
  ------------------
  |  Branch (448:13): [True: 0, False: 0]
  ------------------
  449|      0|            if (newvar)
  ------------------
  |  Branch (449:17): [True: 0, False: 0]
  ------------------
  450|      0|                free(newvar);
  451|      0|            snmp_free_varbind(newhead);
  452|      0|            return NULL;
  453|      0|        }
  454|       |
  455|       |        /*
  456|       |         * add cloned variable to new list  
  457|       |         */
  458|      0|        if (NULL == newhead)
  ------------------
  |  Branch (458:13): [True: 0, False: 0]
  ------------------
  459|      0|            newhead = newvar;
  460|      0|        if (oldvar)
  ------------------
  |  Branch (460:13): [True: 0, False: 0]
  ------------------
  461|      0|            oldvar->next_variable = newvar;
  462|      0|        oldvar = newvar;
  463|       |
  464|      0|        var = var->next_variable;
  465|      0|    }
  466|      3|    return newhead;
  467|      3|}
snmp_client.c:_clone_pdu:
  558|      3|{
  559|      3|    netsnmp_pdu    *newpdu;
  560|       |
  561|      3|    newpdu = _clone_pdu_header(pdu);
  562|      3|    if (!newpdu)
  ------------------
  |  Branch (562:9): [True: 0, False: 3]
  ------------------
  563|      0|        return newpdu;
  564|      3|    newpdu = _copy_pdu_vars(pdu, newpdu, drop_err, 0, 10000);   /* skip none, copy all */
  565|       |
  566|      3|    return newpdu;
  567|      3|}
snmp_client.c:_clone_pdu_header:
  361|      3|{
  362|      3|    netsnmp_pdu    *newpdu;
  363|      3|    struct snmp_secmod_def *sptr;
  364|      3|    int ret;
  365|       |
  366|      3|    if (!pdu)
  ------------------
  |  Branch (366:9): [True: 0, False: 3]
  ------------------
  367|      0|        return NULL;
  368|       |
  369|      3|    newpdu = netsnmp_memdup(pdu, sizeof(netsnmp_pdu));
  370|      3|    if (!newpdu)
  ------------------
  |  Branch (370:9): [True: 0, False: 3]
  ------------------
  371|      0|        return NULL;
  372|       |
  373|       |    /*
  374|       |     * reset copied pointers if copy fails 
  375|       |     */
  376|      3|    newpdu->variables = NULL;
  377|      3|    newpdu->enterprise = NULL;
  378|      3|    newpdu->community = NULL;
  379|      3|    newpdu->securityEngineID = NULL;
  380|      3|    newpdu->securityName = NULL;
  381|      3|    newpdu->contextEngineID = NULL;
  382|      3|    newpdu->contextName = NULL;
  383|      3|    newpdu->transport_data = NULL;
  384|       |
  385|       |    /*
  386|       |     * copy buffers individually. If any copy fails, all are freed. 
  387|       |     */
  388|      3|    if (snmp_clone_mem((void **) &newpdu->enterprise, pdu->enterprise,
  ------------------
  |  Branch (388:9): [True: 0, False: 3]
  ------------------
  389|      3|                       sizeof(oid) * pdu->enterprise_length) ||
  390|      3|        snmp_clone_mem((void **) &newpdu->community, pdu->community,
  ------------------
  |  Branch (390:9): [True: 0, False: 3]
  ------------------
  391|      3|                       pdu->community_len) ||
  392|      3|        snmp_clone_mem((void **) &newpdu->contextEngineID,
  ------------------
  |  Branch (392:9): [True: 0, False: 3]
  ------------------
  393|      3|                       pdu->contextEngineID, pdu->contextEngineIDLen)
  394|      3|        || snmp_clone_mem((void **) &newpdu->securityEngineID,
  ------------------
  |  Branch (394:12): [True: 0, False: 3]
  ------------------
  395|      3|                          pdu->securityEngineID, pdu->securityEngineIDLen)
  396|      3|        || snmp_clone_mem((void **) &newpdu->contextName, pdu->contextName,
  ------------------
  |  Branch (396:12): [True: 0, False: 3]
  ------------------
  397|      3|                          pdu->contextNameLen)
  398|      3|        || snmp_clone_mem((void **) &newpdu->securityName,
  ------------------
  |  Branch (398:12): [True: 0, False: 3]
  ------------------
  399|      3|                          pdu->securityName, pdu->securityNameLen)
  400|      3|        || snmp_clone_mem((void **) &newpdu->transport_data,
  ------------------
  |  Branch (400:12): [True: 0, False: 3]
  ------------------
  401|      3|                          pdu->transport_data,
  402|      3|                          pdu->transport_data_length)) {
  403|      0|        snmp_free_pdu(newpdu);
  404|      0|        return NULL;
  405|      0|    }
  406|       |
  407|      3|    sptr = find_sec_mod(newpdu->securityModel);
  408|      3|    if (sptr && sptr->pdu_clone) {
  ------------------
  |  Branch (408:9): [True: 3, False: 0]
  |  Branch (408:17): [True: 3, False: 0]
  ------------------
  409|       |        /* call security model if it needs to know about this */
  410|      3|        ret = sptr->pdu_clone(pdu, newpdu);
  411|      3|        if (ret) {
  ------------------
  |  Branch (411:13): [True: 0, False: 3]
  ------------------
  412|      0|            snmp_free_pdu(newpdu);
  413|      0|            return NULL;
  414|      0|        }
  415|      3|    }
  416|       |
  417|      3|    return newpdu;
  418|      3|}
snmp_client.c:_copy_pdu_vars:
  495|      3|{                               /* !=0 number of variables to copy */
  496|      3|    netsnmp_variable_list *var;
  497|       |#ifdef TEMPORARILY_DISABLED
  498|       |    int             copied;
  499|       |#endif
  500|      3|    int             drop_idx;
  501|       |
  502|      3|    if (!newpdu)
  ------------------
  |  Branch (502:9): [True: 0, False: 3]
  ------------------
  503|      0|        return NULL;            /* where is PDU to copy to ? */
  504|       |
  505|      3|    if (drop_err)
  ------------------
  |  Branch (505:9): [True: 0, False: 3]
  ------------------
  506|      0|        drop_idx = pdu->errindex - skip_count;
  507|      3|    else
  508|      3|        drop_idx = 0;
  509|       |
  510|      3|    var = pdu->variables;
  511|      3|    while (var && (skip_count-- > 0))   /* skip over pdu variables */
  ------------------
  |  Branch (511:12): [True: 0, False: 3]
  |  Branch (511:19): [True: 0, False: 0]
  ------------------
  512|      0|        var = var->next_variable;
  513|       |
  514|       |#ifdef TEMPORARILY_DISABLED
  515|       |    copied = 0;
  516|       |    if (pdu->flags & UCD_MSG_FLAG_FORCE_PDU_COPY)
  517|       |        copied = 1;             /* We're interested in 'empty' responses too */
  518|       |#endif
  519|       |
  520|      3|    newpdu->variables = _copy_varlist(var, drop_idx, copy_count);
  521|       |#ifdef TEMPORARILY_DISABLED
  522|       |    if (newpdu->variables)
  523|       |        copied = 1;
  524|       |#endif
  525|       |
  526|       |#ifdef ALSO_TEMPORARILY_DISABLED
  527|       |    /*
  528|       |     * Error if bad errindex or if target PDU has no variables copied 
  529|       |     */
  530|       |    if ((drop_err && (ii < pdu->errindex))
  531|       |#ifdef TEMPORARILY_DISABLED
  532|       |        /*
  533|       |         * SNMPv3 engineID probes are allowed to be empty.
  534|       |         * See the comment in snmp_api.c for further details 
  535|       |         */
  536|       |        || copied == 0
  537|       |#endif
  538|       |        ) {
  539|       |        snmp_free_pdu(newpdu);
  540|       |        return 0;
  541|       |    }
  542|       |#endif
  543|      3|    return newpdu;
  544|      3|}

debug_indent_reset:
  112|     65|{
  113|     65|    if (debugindent != 0)
  ------------------
  |  Branch (113:9): [True: 0, False: 65]
  ------------------
  114|      0|        DEBUGMSGTL(("dump_indent","indent reset from %d\n", debugindent));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  115|     65|    debugindent = 0;
  116|     65|}
debug_is_token_registered:
  303|     68|{
  304|     68|    int             i, rc;
  305|       |
  306|       |    /*
  307|       |     * debugging flag is on or off
  308|       |     */
  309|     68|    if (!dodebug)
  ------------------
  |  Branch (309:9): [True: 68, False: 0]
  ------------------
  310|     68|        return SNMPERR_GENERR;
  ------------------
  |  |  218|     68|#define SNMPERR_GENERR			(-1)
  ------------------
  311|       |
  312|      0|    if (debug_num_tokens == 0 || debug_print_everything) {
  ------------------
  |  Branch (312:9): [True: 0, False: 0]
  |  Branch (312:34): [True: 0, False: 0]
  ------------------
  313|       |        /*
  314|       |         * no tokens specified, print everything
  315|       |         */
  316|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  317|      0|    }
  318|      0|    else
  319|      0|        rc = SNMPERR_GENERR; /* ! found = err */
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  320|       |
  321|      0|    for (i = 0; i < debug_num_tokens; i++) {
  ------------------
  |  Branch (321:17): [True: 0, False: 0]
  ------------------
  322|      0|        if (SNMP_DEBUG_DISABLED == dbg_tokens[i].enabled)
  ------------------
  |  |   57|      0|#define SNMP_DEBUG_DISABLED           0
  ------------------
  |  Branch (322:13): [True: 0, False: 0]
  ------------------
  323|      0|            continue;
  324|      0|        if (dbg_tokens[i].token_name &&
  ------------------
  |  Branch (324:13): [True: 0, False: 0]
  ------------------
  325|      0|            strncmp(dbg_tokens[i].token_name, token,
  ------------------
  |  Branch (325:13): [True: 0, False: 0]
  ------------------
  326|      0|                    strlen(dbg_tokens[i].token_name)) == 0) {
  327|      0|            if (SNMP_DEBUG_ACTIVE == dbg_tokens[i].enabled)
  ------------------
  |  |   58|      0|#define SNMP_DEBUG_ACTIVE             1
  ------------------
  |  Branch (327:17): [True: 0, False: 0]
  ------------------
  328|      0|                return SNMPERR_SUCCESS; /* active */
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  329|      0|            else
  330|      0|                return SNMPERR_GENERR; /* excluded */
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  331|      0|        }
  332|      0|    }
  333|      0|    return rc;
  334|      0|}
snmp_get_do_debugging:
  551|  34.1k|{
  552|  34.1k|    return dodebug;
  553|  34.1k|}
snmp_debug_shutdown:
  569|     66|{
  570|     66|    int i;
  571|       |
  572|     66|    for (i = 0; i < debug_num_tokens; i++)
  ------------------
  |  Branch (572:17): [True: 0, False: 66]
  ------------------
  573|       |       SNMP_FREE(dbg_tokens[i].token_name);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  574|     66|}
snmp_debug_init:
  722|     66|{
  723|       |#ifdef HAVE_WOLFSSL_WOLFCRYPT_LOGGING_H
  724|       |    wolfSSL_Debugging_ON();
  725|       |    wolfSSL_SetLoggingCb(snmp_log_wolfssl_msg);
  726|       |#endif
  727|       |
  728|     66|    register_prenetsnmp_mib_handler("snmp", "doDebugging",
  729|     66|                                    debug_config_turn_on_debugging, NULL,
  730|     66|                                    "(1|0)");
  731|     66|    register_prenetsnmp_mib_handler("snmp", "debugTokens",
  732|     66|                                    debug_config_register_tokens, NULL,
  733|     66|                                    "token[,token...]");
  734|     66|#ifndef NETSNMP_DISABLE_DYNAMIC_LOG_LEVEL
  735|     66|    register_prenetsnmp_mib_handler("snmp", "debugLogLevel",
  736|       |                                    debug_config_debug_log_level, NULL,
  737|     66|                                    "(emerg|alert|crit|err|warning|notice|info|debug)");
  738|     66|#endif /* NETSNMP_DISABLE_DYNAMIC_LOG_LEVEL */
  739|     66|}

init_snmp_enum:
   54|     66|{
   55|     66|    if (NULL != snmp_enum_lists)
  ------------------
  |  Branch (55:9): [True: 0, False: 66]
  ------------------
   56|      0|        return SE_OK;
  ------------------
  |  |   42|      0|#define SE_OK            0
  ------------------
   57|       |
   58|     66|    snmp_enum_lists = calloc(SE_MAX_IDS * SE_MAX_SUBIDS,
  ------------------
  |  |   21|     66|#define SE_MAX_IDS 5
  ------------------
                  snmp_enum_lists = calloc(SE_MAX_IDS * SE_MAX_SUBIDS,
  ------------------
  |  |   22|     66|#define SE_MAX_SUBIDS 32        /* needs to be a multiple of 8 */
  ------------------
   59|     66|                             sizeof(*snmp_enum_lists));
   60|     66|    if (!snmp_enum_lists)
  ------------------
  |  Branch (60:9): [True: 0, False: 66]
  ------------------
   61|      0|        return SE_NOMEM;
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
   62|     66|    current_maj_num = SE_MAX_IDS;
  ------------------
  |  |   21|     66|#define SE_MAX_IDS 5
  ------------------
   63|     66|    current_min_num = SE_MAX_SUBIDS;
  ------------------
  |  |   22|     66|#define SE_MAX_SUBIDS 32        /* needs to be a multiple of 8 */
  ------------------
   64|       |
   65|     66|    register_const_config_handler(type, "enum", se_read_conf, NULL, NULL);
   66|     66|    return SE_OK;
  ------------------
  |  |   42|     66|#define SE_OK            0
  ------------------
   67|     66|}
se_add_pair_to_list:
  269|  1.84k|{
  270|  1.84k|    struct snmp_enum_list *lastnode = NULL, *new_node, *tmp;
  271|       |
  272|  1.84k|    if (!list) {
  ------------------
  |  Branch (272:9): [True: 0, False: 1.84k]
  ------------------
  273|      0|        free(label);
  274|      0|        return SE_DNE;
  ------------------
  |  |   45|      0|#define SE_DNE           -2
  ------------------
  275|      0|    }
  276|       |
  277|  1.84k|    tmp = *list;
  278|  5.54k|    while (tmp) {
  ------------------
  |  Branch (278:12): [True: 3.96k, False: 1.58k]
  ------------------
  279|  3.96k|        if (tmp->value == value) {
  ------------------
  |  Branch (279:13): [True: 264, False: 3.69k]
  ------------------
  280|    264|            free(label);
  281|    264|            return (SE_ALREADY_THERE);
  ------------------
  |  |   44|    264|#define SE_ALREADY_THERE 2
  ------------------
  282|    264|        }
  283|  3.69k|        lastnode = tmp;
  284|  3.69k|        tmp = tmp->next;
  285|  3.69k|    }
  286|       |
  287|  1.58k|    new_node = SNMP_MALLOC_STRUCT(snmp_enum_list);
  ------------------
  |  |   69|  1.58k|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  288|  1.58k|    if (!new_node) {
  ------------------
  |  Branch (288:9): [True: 0, False: 1.58k]
  ------------------
  289|      0|        free(label);
  290|      0|        return (SE_NOMEM);
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
  291|      0|    }
  292|       |
  293|  1.58k|    if (lastnode)
  ------------------
  |  Branch (293:9): [True: 1.25k, False: 330]
  ------------------
  294|  1.25k|        lastnode->next = new_node;
  295|    330|    else
  296|    330|        *list = new_node;
  297|  1.58k|    new_node->label = label;
  298|  1.58k|    new_node->value = value;
  299|  1.58k|    new_node->next = NULL;
  300|  1.58k|    return (SE_OK);
  ------------------
  |  |   42|  1.58k|#define SE_OK            0
  ------------------
  301|  1.58k|}
se_add_pair_to_slist:
  365|  1.84k|{
  366|  1.84k|    struct snmp_enum_list **list_p = se_find_slist_ptr(listname);
  367|       |
  368|  1.84k|    if (!list_p) {
  ------------------
  |  Branch (368:9): [True: 330, False: 1.51k]
  ------------------
  369|    330|        struct snmp_enum_list_str *sptr =
  370|    330|            SNMP_MALLOC_STRUCT(snmp_enum_list_str);
  ------------------
  |  |   69|    330|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  371|    330|        if (!sptr) {
  ------------------
  |  Branch (371:13): [True: 0, False: 330]
  ------------------
  372|      0|            free(label);
  373|      0|            return SE_NOMEM;
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
  374|      0|        }
  375|    330|        sptr->next = sliststorage;
  376|    330|        sptr->name = strdup(listname);
  377|    330|        if (!sptr->name) {
  ------------------
  |  Branch (377:13): [True: 0, False: 330]
  ------------------
  378|      0|            free(sptr);
  379|      0|            free(label);
  380|      0|            return SE_NOMEM;
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
  381|      0|        }
  382|    330|        list_p = &sptr->list;
  383|    330|        sliststorage = sptr;
  384|    330|    }
  385|       |
  386|  1.84k|    return se_add_pair_to_list(list_p, label, value);
  387|  1.84k|}
clear_snmp_enum:
  404|     66|{
  405|     66|    struct snmp_enum_list_str *sptr = sliststorage, *next = NULL;
  406|     66|    unsigned int major, minor;
  407|       |
  408|    396|    while (sptr != NULL) {
  ------------------
  |  Branch (408:12): [True: 330, False: 66]
  ------------------
  409|    330|	next = sptr->next;
  410|    330|	free_enum_list(sptr->list);
  411|    330|	SNMP_FREE(sptr->name);
  ------------------
  |  |   62|    330|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 330, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 330]
  |  |  ------------------
  ------------------
  412|    330|	SNMP_FREE(sptr);
  ------------------
  |  |   62|    330|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 330, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 330]
  |  |  ------------------
  ------------------
  413|    330|	sptr = next;
  414|    330|    }
  415|     66|    sliststorage = NULL;
  416|       |
  417|    396|    for (major = 0; major < current_maj_num; major++) {
  ------------------
  |  Branch (417:21): [True: 330, False: 66]
  ------------------
  418|  10.8k|        for (minor = 0; minor < current_min_num; minor++) {
  ------------------
  |  Branch (418:25): [True: 10.5k, False: 330]
  ------------------
  419|  10.5k|            struct snmp_enum_list **list_ptr = se_find_list_ptr(major, minor);
  420|       |
  421|  10.5k|            if (!list_ptr || !*list_ptr)
  ------------------
  |  Branch (421:17): [True: 0, False: 10.5k]
  |  Branch (421:30): [True: 10.5k, False: 0]
  ------------------
  422|  10.5k|                continue;
  423|      0|            free_enum_list(*list_ptr);
  424|      0|        }
  425|    330|    }
  426|     66|    current_maj_num = 0;
  427|     66|    current_min_num = 0;
  428|       |    SNMP_FREE(snmp_enum_lists);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  429|     66|}
snmp_enum.c:se_find_list_ptr:
  174|  10.5k|{
  175|  10.5k|    if (major >= current_maj_num || minor >= current_min_num)
  ------------------
  |  Branch (175:9): [True: 0, False: 10.5k]
  |  Branch (175:37): [True: 0, False: 10.5k]
  ------------------
  176|      0|        return NULL;
  177|  10.5k|    netsnmp_assert(NULL != snmp_enum_lists);
  ------------------
  |  |   47|  10.5k|#      define netsnmp_assert(x)  do { \
  |  |   48|  10.5k|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 10.5k, False: 0]
  |  |  ------------------
  |  |   49|  10.5k|                 ; \
  |  |   50|  10.5k|              else \
  |  |   51|  10.5k|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|  10.5k|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 10.5k]
  |  |  ------------------
  ------------------
  178|       |
  179|  10.5k|    return &snmp_enum_lists[major * current_min_num + minor];
  180|  10.5k|}
snmp_enum.c:se_find_slist_ptr:
  314|  1.84k|{
  315|  1.84k|    struct snmp_enum_list_str *sptr;
  316|  1.84k|    if (!listname)
  ------------------
  |  Branch (316:9): [True: 0, False: 1.84k]
  ------------------
  317|      0|        return NULL;
  318|       |
  319|  2.50k|    for (sptr = sliststorage; sptr != NULL; sptr = sptr->next)
  ------------------
  |  Branch (319:31): [True: 2.17k, False: 330]
  ------------------
  320|  2.17k|        if (sptr->name && strcmp(sptr->name, listname) == 0)
  ------------------
  |  Branch (320:13): [True: 2.17k, False: 0]
  |  Branch (320:27): [True: 1.51k, False: 660]
  ------------------
  321|  1.51k|            return &sptr->list;
  322|       |
  323|    330|    return NULL;
  324|  1.84k|}
snmp_enum.c:free_enum_list:
  391|    330|{
  392|    330|    struct snmp_enum_list *next;
  393|       |
  394|  1.91k|    while (list) {
  ------------------
  |  Branch (394:12): [True: 1.58k, False: 330]
  ------------------
  395|  1.58k|        next = list->next;
  396|  1.58k|        SNMP_FREE(list->label);
  ------------------
  |  |   62|  1.58k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 1.58k, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 1.58k]
  |  |  ------------------
  ------------------
  397|       |        SNMP_FREE(list);
  ------------------
  |  |   62|  1.58k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 1.58k, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 1.58k]
  |  |  ------------------
  ------------------
  398|  1.58k|        list = next;
  399|  1.58k|    }
  400|    330|}

init_snmp_logging:
  168|     66|{
  169|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "logTimestamp", 
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  170|     66|			 NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_LOG_TIMESTAMP);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              			 NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_LOG_TIMESTAMP);
  ------------------
  |  |   64|     66|#define NETSNMP_DS_LIB_LOG_TIMESTAMP       5
  ------------------
  171|     66|    register_prenetsnmp_mib_handler("snmp", "logOption",
  172|     66|                                    parse_config_logOption, NULL, "string");
  173|       |
  174|     66|}
shutdown_snmp_logging:
  178|     66|{
  179|     66|   snmp_disable_log();
  180|     66|   while(NULL != logh_head)
  ------------------
  |  Branch (180:10): [True: 0, False: 66]
  ------------------
  181|      0|      netsnmp_remove_loghandler( logh_head );
  182|     66|}
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|}
snmp_disable_log:
  690|     66|{
  691|     66|    netsnmp_log_handler *logh;
  692|       |
  693|     66|    for (logh = logh_head; logh; logh = logh->next) {
  ------------------
  |  Branch (693:28): [True: 0, False: 66]
  ------------------
  694|      0|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_SYSLOG
  695|      0|        if (logh->type == NETSNMP_LOGHANDLER_SYSLOG)
  ------------------
  |  |   72|      0|#define NETSNMP_LOGHANDLER_SYSLOG	4
  ------------------
  |  Branch (695:13): [True: 0, False: 0]
  ------------------
  696|      0|            snmp_disable_syslog_entry(logh);
  697|      0|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_SYSLOG */
  698|      0|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_FILE
  699|      0|        if (logh->type == NETSNMP_LOGHANDLER_FILE)
  ------------------
  |  |   71|      0|#define NETSNMP_LOGHANDLER_FILE		3
  ------------------
  |  Branch (699:13): [True: 0, False: 0]
  ------------------
  700|      0|            snmp_disable_filelog_entry(logh);
  701|      0|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_FILE */
  702|      0|        netsnmp_disable_this_loghandler(logh);
  703|      0|    }
  704|     66|}
log_handler_stdouterr:
 1101|  3.10k|{
 1102|  3.10k|    static int      newline = 1;	 /* MTCRITICAL_RESOURCE */
 1103|  3.10k|    const char     *newline_ptr;
 1104|  3.10k|    char            sbuf[40];
 1105|       |
 1106|  3.10k|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|  3.10k|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1106:9): [True: 0, False: 3.10k]
  ------------------
 1107|  3.10k|                               NETSNMP_DS_LIB_LOG_TIMESTAMP) && newline) {
  ------------------
  |  |   64|  3.10k|#define NETSNMP_DS_LIB_LOG_TIMESTAMP       5
  ------------------
  |  Branch (1107:65): [True: 0, False: 0]
  ------------------
 1108|      0|        sprintf_stamp(NULL, sbuf);
 1109|  3.10k|    } else {
 1110|  3.10k|        strcpy(sbuf, "");
 1111|  3.10k|    }
 1112|       |    /*
 1113|       |     * Remember whether or not the current line ends with a newline for the
 1114|       |     * next call of log_handler_stdouterr().
 1115|       |     */
 1116|  3.10k|    newline_ptr = strrchr(str, '\n');
 1117|  3.10k|    newline = newline_ptr && newline_ptr[1] == 0;
  ------------------
  |  Branch (1117:15): [True: 3.10k, False: 0]
  |  Branch (1117:30): [True: 3.10k, False: 0]
  ------------------
 1118|       |
 1119|  3.10k|    if (logh->imagic)
  ------------------
  |  Branch (1119:9): [True: 0, False: 3.10k]
  ------------------
 1120|      0|       printf(         "%s%s", sbuf, str);
 1121|  3.10k|    else
 1122|  3.10k|       fprintf(stderr, "%s%s", sbuf, str);
 1123|       |
 1124|  3.10k|    return 1;
 1125|  3.10k|}
snmp_log_string:
 1292|  3.10k|{
 1293|  3.10k|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1294|  3.10k|    static int stderr_enabled = 0;
 1295|  3.10k|    static netsnmp_log_handler lh = { 1, 0, 0, 0, "stderr",
 1296|  3.10k|                                      log_handler_stdouterr, 0, NULL,  NULL,
 1297|  3.10k|                                      NULL };
 1298|  3.10k|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1299|  3.10k|    netsnmp_log_handler *logh;
 1300|       |
 1301|       |    /*
 1302|       |     * We've got to be able to log messages *somewhere*!
 1303|       |     * If you don't want stderr logging, then enable something else.
 1304|       |     */
 1305|  3.10k|    if (0 == logh_enabled) {
  ------------------
  |  Branch (1305:9): [True: 3.10k, False: 0]
  ------------------
 1306|  3.10k|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1307|  3.10k|        if (!stderr_enabled) {
  ------------------
  |  Branch (1307:13): [True: 1, False: 3.10k]
  ------------------
 1308|      1|            ++stderr_enabled;
 1309|      1|            netsnmp_set_line_buffering(stderr);
 1310|      1|        }
 1311|  3.10k|        log_handler_stdouterr( &lh, priority, str );
 1312|  3.10k|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1313|       |
 1314|  3.10k|        return;
 1315|  3.10k|    }
 1316|      0|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1317|      0|    else if (stderr_enabled) {
  ------------------
  |  Branch (1317:14): [True: 0, False: 0]
  ------------------
 1318|      0|        stderr_enabled = 0;
 1319|      0|        log_handler_stdouterr( &lh, LOG_INFO,
 1320|      0|                               "Log handling defined - disabling stderr\n" );
 1321|      0|    }
 1322|      0|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1323|       |        
 1324|       |
 1325|       |    /*
 1326|       |     * Start at the given priority, and work "upwards"....
 1327|       |     */
 1328|      0|    if (priority > LOG_DEBUG)
  ------------------
  |  Branch (1328:9): [True: 0, False: 0]
  ------------------
 1329|      0|        priority = LOG_DEBUG;
 1330|      0|    logh = logh_priorities[priority];
 1331|      0|    for ( ; logh; logh = logh->next ) {
  ------------------
  |  Branch (1331:13): [True: 0, False: 0]
  ------------------
 1332|       |        /*
 1333|       |         * ... but skipping any handlers with a "maximum priority"
 1334|       |         *     that we have already exceeded. And don't forget to
 1335|       |         *     ensure this logging is turned on (see snmp_disable_stderrlog
 1336|       |         *     and its cohorts).
 1337|       |         */
 1338|      0|        if (logh->enabled && priority <= logh->pri_max)
  ------------------
  |  Branch (1338:13): [True: 0, False: 0]
  |  Branch (1338:30): [True: 0, False: 0]
  ------------------
 1339|      0|            logh->handler( logh, priority, str );
 1340|      0|    }
 1341|      0|}
snmp_vlog:
 1379|  3.10k|{
 1380|  3.10k|    char           *buffer = NULL;
 1381|  3.10k|    int             length;
 1382|       |
 1383|  3.10k|    length = vasprintf(&buffer, format, ap);
 1384|  3.10k|    if (length < 0) {
  ------------------
  |  Branch (1384:9): [True: 0, False: 3.10k]
  ------------------
 1385|      0|        snmp_log_string(LOG_ERR, "Could not format log-string\n");
 1386|      0|        return -1;
 1387|      0|    }
 1388|       |
 1389|  3.10k|    snmp_log_string(priority, buffer);
 1390|  3.10k|    free(buffer);
 1391|  3.10k|    return 0;
 1392|  3.10k|}
snmp_log:
 1403|  3.10k|{
 1404|  3.10k|    va_list         ap;
 1405|  3.10k|    int             ret;
 1406|  3.10k|    va_start(ap, format);
 1407|  3.10k|    ret = snmp_vlog(priority, format, ap);
 1408|       |    va_end(ap);
 1409|  3.10k|    return (ret);
 1410|  3.10k|}

netsnmp_init_openssl:
  118|     67|void netsnmp_init_openssl(void) {
  119|       |
  120|       |    /* avoid duplicate calls */
  121|     67|    if (have_started_already)
  ------------------
  |  Branch (121:9): [True: 66, False: 1]
  ------------------
  122|     66|        return;
  123|      1|    have_started_already = 1;
  124|       |
  125|      1|    DEBUGMSGTL(("snmp_openssl", "initializing\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]
  |  |  ------------------
  ------------------
  126|       |
  127|       |    /* Initializing OpenSSL */
  128|      1|#ifdef HAVE_SSL_LIBRARY_INIT
  129|      1|    SSL_library_init();
  130|      1|#endif
  131|      1|#ifdef HAVE_SSL_LOAD_ERROR_STRINGS
  132|      1|    SSL_load_error_strings();
  133|      1|#endif
  134|       |#ifdef HAVE_ERR_LOAD_BIO_STRINGS
  135|       |    ERR_load_BIO_strings();
  136|       |#endif
  137|      1|#ifdef HAVE_OPENSSL_ADD_ALL_ALGORITHMS
  138|       |    OpenSSL_add_all_algorithms();
  139|      1|#endif
  140|      1|}

init_secmod:
   48|     66|{
   49|     66|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
   50|     66|                           SNMP_CALLBACK_SESSION_INIT, set_default_secmod,
  ------------------
  |  |   29|     66|#define SNMP_CALLBACK_SESSION_INIT		5
  ------------------
   51|     66|                           NULL);
   52|       |
   53|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defSecurityModel",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
   54|     66|			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECMODEL);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECMODEL);
  ------------------
  |  |  161|     66|#define NETSNMP_DS_LIB_SECMODEL          10
  ------------------
   55|       |    /*
   56|       |     * this file is generated by configure for all the stuff we're using 
   57|       |     */
   58|     66|#include "snmpsm_init.h"
  ------------------
  |  |    1|       |/* This file is automatically generated by configure.  Do not modify by hand. */
  |  |    2|     66|init_usm();
  |  |    3|     66|init_tsm();
  |  |    4|     66|init_ksm();
  ------------------
   59|     66|}
shutdown_secmod:
   63|     66|{
   64|     66|    #include "snmpsm_shutdown.h"
  ------------------
  |  |    1|       |/* This file is automatically generated by configure.  Do not modify by hand. */
  |  |    2|     66|shutdown_usm();
  |  |    3|     66|shutdown_tsm();
  |  |    4|     66|shutdown_ksm();
  ------------------
   65|     66|}
register_sec_mod:
   70|    198|{
   71|    198|    int             result = 0;
   72|    198|    struct snmp_secmod_list *sptr;
   73|    198|    char           *othername, *modname2 = NULL;
   74|       |
   75|    396|    for (sptr = registered_services; sptr; sptr = sptr->next) {
  ------------------
  |  Branch (75:38): [True: 198, False: 198]
  ------------------
   76|    198|        if (sptr->securityModel == secmod) {
  ------------------
  |  Branch (76:13): [True: 0, False: 198]
  ------------------
   77|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
   78|      0|        }
   79|    198|    }
   80|    198|    sptr = SNMP_MALLOC_STRUCT(snmp_secmod_list);
  ------------------
  |  |   69|    198|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
   81|    198|    if (sptr == NULL)
  ------------------
  |  Branch (81:9): [True: 0, False: 198]
  ------------------
   82|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
   83|    198|    sptr->secDef = newdef;
   84|    198|    sptr->securityModel = secmod;
   85|    198|    sptr->next = registered_services;
   86|    198|    registered_services = sptr;
   87|    198|    modname2 = strdup(modname);
   88|    198|    if (!modname2)
  ------------------
  |  Branch (88:9): [True: 0, False: 198]
  ------------------
   89|      0|        result = SE_NOMEM;
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
   90|    198|    else
   91|    198|        result = se_add_pair_to_slist("snmp_secmods", modname2, secmod);
   92|    198|    if (result != SE_OK) {
  ------------------
  |  |   42|    198|#define SE_OK            0
  ------------------
  |  Branch (92:9): [True: 0, False: 198]
  ------------------
   93|      0|        switch (result) {
   94|      0|        case SE_NOMEM:
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
  |  Branch (94:9): [True: 0, False: 0]
  ------------------
   95|      0|            snmp_log(LOG_CRIT, "snmp_secmod: no memory\n");
   96|      0|            break;
   97|       |
   98|      0|        case SE_ALREADY_THERE:
  ------------------
  |  |   44|      0|#define SE_ALREADY_THERE 2
  ------------------
  |  Branch (98:9): [True: 0, False: 0]
  ------------------
   99|      0|            othername = se_find_label_in_slist("snmp_secmods", secmod);
  100|      0|            if (strcmp(othername, modname) != 0) {
  ------------------
  |  Branch (100:17): [True: 0, False: 0]
  ------------------
  101|      0|                snmp_log(LOG_ERR,
  102|      0|                         "snmp_secmod: two security modules %s and %s registered with the same security number\n",
  103|      0|                         modname, othername);
  104|      0|            }
  105|      0|            break;
  106|       |
  107|      0|        default:
  ------------------
  |  Branch (107:9): [True: 0, False: 0]
  ------------------
  108|      0|            snmp_log(LOG_ERR,
  109|      0|                     "snmp_secmod: unknown error trying to register a new security module\n");
  110|      0|            break;
  111|      0|        }
  112|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  113|      0|    }
  114|    198|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|    198|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  115|    198|}
unregister_sec_mod:
  121|     66|{
  122|     66|    struct snmp_secmod_list *sptr, *lptr;
  123|       |
  124|     66|    for (sptr = registered_services, lptr = NULL; sptr;
  ------------------
  |  Branch (124:51): [True: 0, False: 66]
  ------------------
  125|     66|         lptr = sptr, sptr = sptr->next) {
  126|      0|        if (sptr->securityModel == secmod) {
  ------------------
  |  Branch (126:13): [True: 0, False: 0]
  ------------------
  127|      0|            if ( lptr )
  ------------------
  |  Branch (127:18): [True: 0, False: 0]
  ------------------
  128|      0|                lptr->next = sptr->next;
  129|      0|            else
  130|      0|                registered_services = sptr->next;
  131|      0|	    SNMP_FREE(sptr->secDef);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  132|      0|            SNMP_FREE(sptr);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  133|      0|            return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  134|      0|        }
  135|      0|    }
  136|       |    /*
  137|       |     * not registered 
  138|       |     */
  139|     66|    return SNMPERR_GENERR;
  ------------------
  |  |  218|     66|#define SNMPERR_GENERR			(-1)
  ------------------
  140|     66|}
clear_sec_mod:
  145|     66|{
  146|     66|    struct snmp_secmod_list *tmp = registered_services, *next = NULL;
  147|       |
  148|    264|    while (tmp != NULL) {
  ------------------
  |  Branch (148:12): [True: 198, False: 66]
  ------------------
  149|    198|	next = tmp->next;
  150|    198|	SNMP_FREE(tmp->secDef);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 198, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
  151|    198|	SNMP_FREE(tmp);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 198, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
  152|    198|	tmp = next;
  153|    198|    }
  154|       |    registered_services = NULL;
  155|     66|}
find_sec_mod:
  160|    226|{
  161|    226|    struct snmp_secmod_list *sptr;
  162|       |
  163|    745|    for (sptr = registered_services; sptr; sptr = sptr->next) {
  ------------------
  |  Branch (163:38): [True: 678, False: 67]
  ------------------
  164|    678|        if (sptr->securityModel == secmod) {
  ------------------
  |  Branch (164:13): [True: 159, False: 519]
  ------------------
  165|    159|            return sptr->secDef;
  166|    159|        }
  167|    678|    }
  168|       |    /*
  169|       |     * not registered 
  170|       |     */
  171|     67|    return NULL;
  172|    226|}
snmp_secmod.c:set_default_secmod:
  189|     66|{
  190|     66|    netsnmp_session *sess = (netsnmp_session *) serverarg;
  191|     66|    char           *cptr;
  192|     66|    int             model;
  193|       |
  194|     66|    if (!sess)
  ------------------
  |  Branch (194:9): [True: 0, False: 66]
  ------------------
  195|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  196|     66|    if (sess->securityModel == SNMP_DEFAULT_SECMODEL) {
  ------------------
  |  |  124|     66|#define SNMP_DEFAULT_SECMODEL	    -1
  ------------------
  |  Branch (196:9): [True: 66, False: 0]
  ------------------
  197|     66|        if ((cptr = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (197:13): [True: 0, False: 66]
  ------------------
  198|     66|					  NETSNMP_DS_LIB_SECMODEL)) != NULL) {
  ------------------
  |  |  161|     66|#define NETSNMP_DS_LIB_SECMODEL          10
  ------------------
  199|      0|            if ((model = se_find_value_in_slist("snmp_secmods", cptr))
  ------------------
  |  Branch (199:17): [True: 0, False: 0]
  ------------------
  200|      0|		!= SE_DNE) {
  ------------------
  |  |   45|      0|#define SE_DNE           -2
  ------------------
  201|      0|                sess->securityModel = model;
  202|      0|            } else {
  203|      0|                snmp_log(LOG_ERR,
  204|      0|                         "unknown security model name: %s.  Forcing USM instead.\n",
  205|      0|                         cptr);
  206|      0|                sess->securityModel = NETSNMP_SECMOD_DEFAULT_MODEL;
  ------------------
  |  |  177|      0|#define NETSNMP_SECMOD_DEFAULT_MODEL  USM_SEC_MODEL_NUMBER
  |  |  ------------------
  |  |  |  |   40|      0|#define USM_SEC_MODEL_NUMBER            SNMP_SEC_MODEL_USM
  |  |  |  |  ------------------
  |  |  |  |  |  |  295|      0|#define SNMP_SEC_MODEL_USM		3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  207|      0|                return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  208|      0|            }
  209|     66|        } else {
  210|     66|            sess->securityModel = NETSNMP_SECMOD_DEFAULT_MODEL;
  ------------------
  |  |  177|     66|#define NETSNMP_SECMOD_DEFAULT_MODEL  USM_SEC_MODEL_NUMBER
  |  |  ------------------
  |  |  |  |   40|     66|#define USM_SEC_MODEL_NUMBER            SNMP_SEC_MODEL_USM
  |  |  |  |  ------------------
  |  |  |  |  |  |  295|     66|#define SNMP_SEC_MODEL_USM		3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  211|     66|        }
  212|     66|    }
  213|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  214|     66|}

netsnmp_register_default_domain:
   60|    132|{
   61|    132|    struct netsnmp_lookup_domain *run = domains, *prev = NULL;
   62|    132|    int res = 0;
   63|       |
   64|    198|    while (run != NULL && strcmp(run->application, application) < 0) {
  ------------------
  |  Branch (64:12): [True: 66, False: 132]
  |  Branch (64:27): [True: 66, False: 0]
  ------------------
   65|     66|	prev = run;
   66|     66|	run = run->next;
   67|     66|    }
   68|    132|    if (run && strcmp(run->application, application) == 0) {
  ------------------
  |  Branch (68:9): [True: 0, False: 132]
  |  Branch (68:16): [True: 0, False: 0]
  ------------------
   69|      0|      if (run->domain != NULL) {
  ------------------
  |  Branch (69:11): [True: 0, False: 0]
  ------------------
   70|      0|          destroy_word_array(run->domain);
   71|      0|	  run->domain = NULL;
   72|      0|	  res = 1;
   73|      0|      }
   74|    132|    } else {
   75|    132|	run = SNMP_MALLOC_STRUCT(netsnmp_lookup_domain);
  ------------------
  |  |   69|    132|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
   76|    132|	run->application = strdup(application);
   77|    132|	run->userDomain = NULL;
   78|    132|	if (prev) {
  ------------------
  |  Branch (78:6): [True: 66, False: 66]
  ------------------
   79|     66|	    run->next = prev->next;
   80|     66|	    prev->next = run;
   81|     66|	} else {
   82|     66|	    run->next = domains;
   83|     66|	    domains = run;
   84|     66|	}
   85|    132|    }
   86|    132|    if (domain) {
  ------------------
  |  Branch (86:9): [True: 132, False: 0]
  ------------------
   87|    132|        run->domain = create_word_array(domain);
   88|    132|    } else if (run->userDomain == NULL) {
  ------------------
  |  Branch (88:16): [True: 0, False: 0]
  ------------------
   89|      0|	if (prev)
  ------------------
  |  Branch (89:6): [True: 0, False: 0]
  ------------------
   90|      0|	    prev->next = run->next;
   91|      0|	else
   92|      0|	    domains = run->next;
   93|      0|	free(run->application);
   94|      0|	free(run);
   95|      0|    }
   96|    132|    return res;
   97|    132|}
netsnmp_clear_default_domain:
  101|     66|{
  102|    198|    while (domains) {
  ------------------
  |  Branch (102:12): [True: 132, False: 66]
  ------------------
  103|    132|	struct netsnmp_lookup_domain *tmp = domains;
  104|    132|	domains = domains->next;
  105|    132|	free(tmp->application);
  106|    132|        destroy_word_array(tmp->userDomain);
  107|    132|        destroy_word_array(tmp->domain);
  108|    132|	free(tmp);
  109|    132|    }
  110|     66|}
netsnmp_lookup_default_domains:
  186|     66|{
  187|     66|    const char * const * res;
  188|       |
  189|     66|    if (application == NULL)
  ------------------
  |  Branch (189:9): [True: 0, False: 66]
  ------------------
  190|      0|	res = NULL;
  191|     66|    else {
  192|     66|        struct netsnmp_lookup_domain *run = domains;
  193|       |
  194|    198|	while (run && strcmp(run->application, application) < 0)
  ------------------
  |  Branch (194:9): [True: 132, False: 66]
  |  Branch (194:16): [True: 132, False: 0]
  ------------------
  195|    132|	    run = run->next;
  196|     66|	if (run && strcmp(run->application, application) == 0)
  ------------------
  |  Branch (196:6): [True: 0, False: 66]
  |  Branch (196:13): [True: 0, False: 0]
  ------------------
  197|      0|	    if (run->userDomain)
  ------------------
  |  Branch (197:10): [True: 0, False: 0]
  ------------------
  198|      0|                res = (const char * const *)run->userDomain;
  199|      0|	    else
  200|      0|                res = (const char * const *)run->domain;
  201|     66|	else
  202|     66|	    res = NULL;
  203|     66|    }
  204|     66|    DEBUGMSGTL(("defaults",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  205|     66|                "netsnmp_lookup_default_domain(\"%s\") ->",
  206|     66|                application ? application : "[NIL]"));
  207|     66|    if (res) {
  ------------------
  |  Branch (207:9): [True: 0, False: 66]
  ------------------
  208|      0|        const char * const * r = res;
  209|      0|        while(*r) {
  ------------------
  |  Branch (209:15): [True: 0, False: 0]
  ------------------
  210|      0|            DEBUGMSG(("defaults", " \"%s\"", *r));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  211|      0|            ++r;
  212|      0|        }
  213|      0|        DEBUGMSG(("defaults", "\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  214|      0|    } else
  215|     66|        DEBUGMSG(("defaults", " \"[NIL]\"\n"));
  ------------------
  |  |   61|     66|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 66]
  |  |  ------------------
  ------------------
  216|     66|    return res;
  217|     66|}
netsnmp_register_default_target:
  248|    924|{
  249|    924|    struct netsnmp_lookup_target *run = targets, *prev = NULL;
  250|    924|    int i = 0, res = 0;
  251|  5.08k|    while (run && ((i = strcmp(run->application, application)) < 0 ||
  ------------------
  |  Branch (251:12): [True: 4.81k, False: 264]
  |  Branch (251:20): [True: 3.23k, False: 1.58k]
  ------------------
  252|  4.15k|		   (i == 0 && strcmp(run->domain, domain) < 0))) {
  ------------------
  |  Branch (252:7): [True: 1.58k, False: 0]
  |  Branch (252:17): [True: 924, False: 660]
  ------------------
  253|  4.15k|	prev = run;
  254|  4.15k|	run = run->next;
  255|  4.15k|    }
  256|    924|    if (run && i == 0 && strcmp(run->domain, domain) == 0) {
  ------------------
  |  Branch (256:9): [True: 660, False: 264]
  |  Branch (256:16): [True: 660, False: 0]
  |  Branch (256:26): [True: 0, False: 660]
  ------------------
  257|      0|      if (run->target != NULL) {
  ------------------
  |  Branch (257:11): [True: 0, False: 0]
  ------------------
  258|      0|	    free(run->target);
  259|      0|	    run->target = NULL;
  260|      0|	    res = 1;
  261|      0|      }
  262|    924|    } else {
  263|    924|	run = SNMP_MALLOC_STRUCT(netsnmp_lookup_target);
  ------------------
  |  |   69|    924|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  264|    924|	run->application = strdup(application);
  265|    924|	run->domain = strdup(domain);
  266|    924|	run->userTarget = NULL;
  267|    924|	if (prev) {
  ------------------
  |  Branch (267:6): [True: 726, False: 198]
  ------------------
  268|    726|	    run->next = prev->next;
  269|    726|	    prev->next = run;
  270|    726|	} else {
  271|    198|	    run->next = targets;
  272|    198|	    targets = run;
  273|    198|	}
  274|    924|    }
  275|    924|    if (target) {
  ------------------
  |  Branch (275:9): [True: 924, False: 0]
  ------------------
  276|    924|	run->target = strdup(target);
  277|    924|    } else if (run->userTarget == NULL) {
  ------------------
  |  Branch (277:16): [True: 0, False: 0]
  ------------------
  278|      0|	if (prev)
  ------------------
  |  Branch (278:6): [True: 0, False: 0]
  ------------------
  279|      0|	    prev->next = run->next;
  280|      0|	else
  281|      0|	    targets = run->next;
  282|      0|	free(run->domain);
  283|      0|	free(run->application);
  284|      0|	free(run);
  285|      0|    }
  286|    924|    return res;
  287|    924|}
netsnmp_clear_default_target:
  294|     66|{
  295|    990|    while (targets) {
  ------------------
  |  Branch (295:12): [True: 924, False: 66]
  ------------------
  296|    924|	struct netsnmp_lookup_target *tmp = targets;
  297|    924|	targets = targets->next;
  298|    924|	free(tmp->application);
  299|    924|	free(tmp->domain);
  300|    924|	free(tmp->userTarget);
  301|    924|	free(tmp->target);
  302|    924|	free(tmp);
  303|    924|    }
  304|     66|}
netsnmp_lookup_default_target:
  397|     66|{
  398|     66|    int i = 0;
  399|     66|    struct netsnmp_lookup_target *run = targets;
  400|     66|    const char *res;
  401|       |
  402|     66|    if (application == NULL || domain == NULL)
  ------------------
  |  Branch (402:9): [True: 0, False: 66]
  |  Branch (402:32): [True: 0, False: 66]
  ------------------
  403|      0|	res = NULL;
  404|     66|    else {
  405|    990|	while (run && ((i = strcmp(run->application, application)) < 0 ||
  ------------------
  |  Branch (405:9): [True: 924, False: 66]
  |  Branch (405:17): [True: 924, False: 0]
  ------------------
  406|      0|		       (i == 0 && strcmp(run->domain, domain) < 0)))
  ------------------
  |  Branch (406:11): [True: 0, False: 0]
  |  Branch (406:21): [True: 0, False: 0]
  ------------------
  407|    924|	    run = run->next;
  408|     66|	if (run && i == 0 && strcmp(run->domain, domain) == 0)
  ------------------
  |  Branch (408:6): [True: 0, False: 66]
  |  Branch (408:13): [True: 0, False: 0]
  |  Branch (408:23): [True: 0, False: 0]
  ------------------
  409|      0|	    if (run->userTarget != NULL)
  ------------------
  |  Branch (409:10): [True: 0, False: 0]
  ------------------
  410|      0|		res = run->userTarget;
  411|      0|	    else
  412|      0|		res = run->target;
  413|     66|	else
  414|     66|	    res = NULL;
  415|     66|    }
  416|     66|    DEBUGMSGTL(("defaults",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  417|     66|		"netsnmp_lookup_default_target(\"%s\", \"%s\") -> \"%s\"\n",
  418|     66|		application ? application : "[NIL]",
  419|     66|		domain ? domain : "[NIL]",
  420|     66|		res ? res : "[NIL]"));
  421|     66|    return res;
  422|     66|}
netsnmp_register_service_handlers:
  426|     66|{
  427|     66|    register_config_handler("snmp:", "defDomain",
  428|     66|			    netsnmp_register_user_domain,
  429|     66|			    netsnmp_clear_user_domain,
  430|     66|			    "application domain");
  431|     66|    register_config_handler("snmp:", "defTarget",
  432|     66|			    netsnmp_register_user_target,
  433|     66|			    netsnmp_clear_user_target,
  434|     66|			    "application domain target");
  435|     66|}
snmp_service.c:destroy_word_array:
   38|    264|{
   39|    264|    if (arr) {
  ------------------
  |  Branch (39:9): [True: 132, False: 132]
  ------------------
   40|    132|        char** run = arr;
   41|    396|        while(*run) {
  ------------------
  |  Branch (41:15): [True: 264, False: 132]
  ------------------
   42|    264|            free(*run);
   43|    264|            ++run;
   44|    264|        }
   45|    132|        free(arr);
   46|    132|    }
   47|    264|}
snmp_service.c:create_word_array:
   28|    132|{
   29|    132|    size_t tmplen = strlen(cptr);
   30|    132|    char* tmp = (char*)malloc(tmplen + 1);
   31|    132|    char** res = create_word_array_helper(cptr, 0, tmp, tmplen + 1);
   32|    132|    free(tmp);
   33|    132|    return res;
   34|    132|}
snmp_service.c:create_word_array_helper:
   11|    264|{
   12|    264|    char* item;
   13|    264|    char** res;
   14|    264|    cptr = copy_nword_const(cptr, tmp, tmplen);
   15|    264|    item = strdup(tmp);
   16|    264|    if (cptr)
  ------------------
  |  Branch (16:9): [True: 132, False: 132]
  ------------------
   17|    132|        res = create_word_array_helper(cptr, idx + 1, tmp, tmplen);
   18|    132|    else {
   19|    132|        res = (char**)malloc(sizeof(char*) * (idx + 2));
   20|       |        res[idx + 1] = NULL;
   21|    132|    }
   22|    264|    res[idx] = item;
   23|    264|    return res;
   24|    264|}
snmp_service.c:netsnmp_clear_user_domain:
  161|    264|{
  162|    264|    struct netsnmp_lookup_domain *run = domains, *prev = NULL;
  163|       |
  164|    792|    while (run) {
  ------------------
  |  Branch (164:12): [True: 528, False: 264]
  ------------------
  165|    528|	if (run->userDomain != NULL) {
  ------------------
  |  Branch (165:6): [True: 0, False: 528]
  ------------------
  166|      0|            destroy_word_array(run->userDomain);
  167|      0|	    run->userDomain = NULL;
  168|      0|	}
  169|    528|	if (run->domain == NULL) {
  ------------------
  |  Branch (169:6): [True: 0, False: 528]
  ------------------
  170|      0|	    struct netsnmp_lookup_domain *tmp = run;
  171|      0|	    if (prev)
  ------------------
  |  Branch (171:10): [True: 0, False: 0]
  ------------------
  172|      0|		run = prev->next = run->next;
  173|      0|	    else
  174|      0|		run = domains = run->next;
  175|      0|	    free(tmp->application);
  176|      0|	    free(tmp);
  177|    528|	} else {
  178|    528|	    prev = run;
  179|    528|	    run = run->next;
  180|    528|	}
  181|    528|    }
  182|    264|}
snmp_service.c:netsnmp_clear_user_target:
  371|    264|{
  372|    264|    struct netsnmp_lookup_target *run = targets, *prev = NULL;
  373|       |
  374|  3.96k|    while (run) {
  ------------------
  |  Branch (374:12): [True: 3.69k, False: 264]
  ------------------
  375|  3.69k|	if (run->userTarget != NULL) {
  ------------------
  |  Branch (375:6): [True: 0, False: 3.69k]
  ------------------
  376|      0|	    free(run->userTarget);
  377|      0|	    run->userTarget = NULL;
  378|      0|	}
  379|  3.69k|	if (run->target == NULL) {
  ------------------
  |  Branch (379:6): [True: 0, False: 3.69k]
  ------------------
  380|      0|	    struct netsnmp_lookup_target *tmp = run;
  381|      0|	    if (prev)
  ------------------
  |  Branch (381:10): [True: 0, False: 0]
  ------------------
  382|      0|		run = prev->next = run->next;
  383|      0|	    else
  384|      0|		run = targets = run->next;
  385|      0|	    free(tmp->application);
  386|      0|	    free(tmp->domain);
  387|      0|	    free(tmp);
  388|  3.69k|	} else {
  389|  3.69k|	    prev = run;
  390|  3.69k|	    run = run->next;
  391|  3.69k|	}
  392|  3.69k|    }
  393|    264|}

init_snmp_transport:
  124|     66|{
  125|     66|    netsnmp_ds_register_config(ASN_BOOLEAN,
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  126|     66|                               "snmp", "dontLoadHostConfig",
  127|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  128|     66|                               NETSNMP_DS_LIB_DONT_LOAD_HOST_FILES);
  ------------------
  |  |  100|     66|#define NETSNMP_DS_LIB_DONT_LOAD_HOST_FILES 40 /* don't read host.conf files */
  ------------------
  129|     66|#ifndef NETSNMP_FEATURE_REMOVE_FILTER_SOURCE
  130|     66|    register_app_config_handler("sourceFilterType",
  131|     66|                                netsnmp_transport_parse_filterType,
  132|       |                                NULL, "none|whitelist|blacklist");
  133|     66|    register_app_config_handler("sourceFilterAddress",
  134|     66|                                netsnmp_transport_parse_filter,
  135|     66|                                netsnmp_transport_filter_cleanup,
  136|     66|                                "host");
  137|     66|#endif /* NETSNMP_FEATURE_REMOVE_FILTER_SOURCE */
  138|     66|}
shutdown_snmp_transport:
  142|     66|{
  143|     66|#ifndef NETSNMP_FEATURE_REMOVE_FILTER_SOURCE
  144|     66|    netsnmp_transport_filter_cleanup();
  145|     66|#endif
  146|     66|}
netsnmp_transport_free:
  232|    132|{
  233|    132|    if (NULL == t)
  ------------------
  |  Branch (233:9): [True: 66, False: 66]
  ------------------
  234|     66|        return;
  235|       |
  236|     66|#ifndef FEATURE_REMOVE_TRANSPORT_CACHE
  237|       |    /** don't free a transport that is currently shared */
  238|     66|    if (netsnmp_transport_cache_remove(t) == 1)
  ------------------
  |  Branch (238:9): [True: 0, False: 66]
  ------------------
  239|      0|        return;
  240|     66|#endif
  241|       |
  242|     66|    SNMP_FREE(t->local);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  243|     66|    SNMP_FREE(t->remote);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  244|     66|    SNMP_FREE(t->data);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  245|     66|    netsnmp_transport_free(t->base_transport);
  246|       |
  247|       |    SNMP_FREE(t);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  248|     66|}
netsnmp_transport_filter_cleanup:
  370|    264|{
  371|    264|    if (NULL == filtered)
  ------------------
  |  Branch (371:9): [True: 264, False: 0]
  ------------------
  372|    264|        return;
  373|      0|    CONTAINER_CLEAR(filtered, filtered->free_item, NULL);
  374|      0|    CONTAINER_FREE(filtered);
  375|       |    filtered = NULL;
  376|      0|}
netsnmp_transport_send:
  405|      3|{
  406|      3|    int dumpPacket, debugLength;
  407|       |
  408|      3|    if ((NULL == t) || (NULL == t->f_send)) {
  ------------------
  |  Branch (408:9): [True: 0, False: 3]
  |  Branch (408:24): [True: 0, False: 3]
  ------------------
  409|      0|        DEBUGMSGTL(("transport:pkt:send", "NULL transport or send function\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]
  |  |  ------------------
  ------------------
  410|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  411|      0|    }
  412|       |
  413|      3|    dumpPacket = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      3|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  414|      3|                                        NETSNMP_DS_LIB_DUMP_PACKET);
  ------------------
  |  |   63|      3|#define NETSNMP_DS_LIB_DUMP_PACKET         4
  ------------------
  415|      3|    debugLength = (SNMPERR_SUCCESS ==
  ------------------
  |  |  217|      3|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  416|      3|                   debug_is_token_registered("transport:send"));
  417|       |
  418|      3|    if (dumpPacket | debugLength) {
  ------------------
  |  Branch (418:9): [True: 0, False: 3]
  ------------------
  419|      0|        char *str = netsnmp_transport_peer_string(t,
  420|      0|                                                  opaque ? *opaque : NULL,
  ------------------
  |  Branch (420:51): [True: 0, False: 0]
  ------------------
  421|      0|                                                  olength ? *olength : 0);
  ------------------
  |  Branch (421:51): [True: 0, False: 0]
  ------------------
  422|      0|        if (debugLength)
  ------------------
  |  Branch (422:13): [True: 0, False: 0]
  ------------------
  423|      0|            DEBUGMSGT_NC(("transport:send","%lu bytes to %s\n",
  ------------------
  |  |   85|      0|#define DEBUGMSGT_NC(x) do { __DBGMSGT_NC(x); }while(0)
  |  |  ------------------
  |  |  |  |  149|      0|#define __DBGMSGT_NC(x)  debug_combo_nc x
  |  |  ------------------
  |  |  |  Branch (85:54): [Folded, False: 0]
  |  |  ------------------
  ------------------
  424|      0|                          (unsigned long)length, str));
  425|      0|        if (dumpPacket)
  ------------------
  |  Branch (425:13): [True: 0, False: 0]
  ------------------
  426|      0|            snmp_log(LOG_DEBUG, "\nSending %lu bytes to %s\n", 
  427|      0|                     (unsigned long)length, str);
  428|      0|        SNMP_FREE(str);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  429|      0|    }
  430|      3|    if (dumpPacket)
  ------------------
  |  Branch (430:9): [True: 0, False: 3]
  ------------------
  431|      0|        xdump(packet, length, "");
  432|       |
  433|      3|    return t->f_send(t, packet, length, opaque, olength);
  434|      3|}
netsnmp_transport_recv:
  439|     65|{
  440|     65|    int debugLength;
  441|       |
  442|     65|    if ((NULL == t) || (NULL == t->f_recv)) {
  ------------------
  |  Branch (442:9): [True: 0, False: 65]
  |  Branch (442:24): [True: 0, False: 65]
  ------------------
  443|      0|        DEBUGMSGTL(("transport:recv", "NULL transport or recv function\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]
  |  |  ------------------
  ------------------
  444|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  445|      0|    }
  446|       |
  447|     65|    length = t->f_recv(t, packet, length, opaque, olength);
  448|       |
  449|     65|    if (length <=0)
  ------------------
  |  Branch (449:9): [True: 0, False: 65]
  ------------------
  450|      0|        return length; /* don't log timeouts/socket closed */
  451|       |
  452|     65|    debugLength = (SNMPERR_SUCCESS ==
  ------------------
  |  |  217|     65|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  453|     65|                   debug_is_token_registered("transport:recv"));
  454|       |
  455|     65|    if (debugLength) {
  ------------------
  |  Branch (455:9): [True: 0, False: 65]
  ------------------
  456|      0|        char *str = netsnmp_transport_peer_string(t,
  457|      0|                                                  opaque ? *opaque : NULL,
  ------------------
  |  Branch (457:51): [True: 0, False: 0]
  ------------------
  458|      0|                                                  olength ? *olength : 0);
  ------------------
  |  Branch (458:51): [True: 0, False: 0]
  ------------------
  459|      0|        DEBUGMSGT_NC(("transport:recv","%d bytes from %s\n", length, str));
  ------------------
  |  |   85|      0|#define DEBUGMSGT_NC(x) do { __DBGMSGT_NC(x); }while(0)
  |  |  ------------------
  |  |  |  |  149|      0|#define __DBGMSGT_NC(x)  debug_combo_nc x
  |  |  ------------------
  |  |  |  Branch (85:54): [Folded, False: 0]
  |  |  ------------------
  ------------------
  460|      0|        SNMP_FREE(str);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  461|      0|    }
  462|       |
  463|     65|    return length;
  464|     65|}
netsnmp_tdomain_init:
  492|     66|{
  493|     66|    DEBUGMSGTL(("tdomain", "netsnmp_tdomain_init() called\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  494|       |
  495|       |/* include the configure generated list of constructor calls */
  496|     66|#include "transports/snmp_transport_inits.h"
  ------------------
  |  |    1|       |/* This file is automatically generated by configure.  Do not modify by hand. */
  |  |    2|     66|netsnmp_tlsbase_ctor();
  |  |    3|     66|netsnmp_tlstcp_ctor();
  |  |    4|     66|netsnmp_dtlsudp_ctor();
  |  |    5|     66|netsnmp_udpshared_ctor();
  |  |    6|     66|netsnmp_std_ctor();
  |  |    7|     66|netsnmp_ipx_ctor();
  |  |    8|     66|netsnmp_aal5pvc_ctor();
  |  |    9|     66|netsnmp_udpipv6_ctor();
  |  |   10|     66|netsnmp_tcpipv6_ctor();
  |  |   11|     66|netsnmp_udp_ctor();
  |  |   12|     66|netsnmp_tcp_ctor();
  |  |   13|     66|netsnmp_alias_ctor();
  |  |   14|     66|netsnmp_unix_ctor();
  ------------------
  497|       |
  498|     66|    netsnmp_tdomain_dump();
  499|       |
  500|       |
  501|     66|}
netsnmp_clear_tdomain_list:
  505|     66|{
  506|     66|    netsnmp_tdomain *list = domain_list, *next = NULL;
  507|     66|    DEBUGMSGTL(("tdomain", "clear_tdomain_list() called\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  508|       |
  509|    793|    while (list != NULL) {
  ------------------
  |  Branch (509:12): [True: 727, False: 66]
  ------------------
  510|    727|	next = list->next;
  511|    727|	SNMP_FREE(list->prefix);
  ------------------
  |  |   62|    727|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 727, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 727]
  |  |  ------------------
  ------------------
  512|       |        /* attention!! list itself is not in the heap, so we must not free it! */
  513|    727|	list = next;
  514|    727|    }
  515|       |    domain_list = NULL;
  516|     66|}
netsnmp_tdomain_register:
  543|    727|{
  544|    727|    netsnmp_tdomain **prevNext = &domain_list, *d;
  545|       |
  546|    727|    if (n != NULL) {
  ------------------
  |  Branch (546:9): [True: 727, False: 0]
  ------------------
  547|  4.36k|        for (d = domain_list; d != NULL; d = d->next) {
  ------------------
  |  Branch (547:31): [True: 3.64k, False: 727]
  ------------------
  548|  3.64k|            if (netsnmp_oid_equals(n->name, n->name_length,
  ------------------
  |  Branch (548:17): [True: 0, False: 3.64k]
  ------------------
  549|  3.64k|                                d->name, d->name_length) == 0) {
  550|       |                /*
  551|       |                 * Already registered.  
  552|       |                 */
  553|      0|                return 0;
  554|      0|            }
  555|  3.64k|            prevNext = &(d->next);
  556|  3.64k|        }
  557|    727|        n->next = NULL;
  558|    727|        *prevNext = n;
  559|    727|        return 1;
  560|    727|    } else {
  561|      0|        return 0;
  562|      0|    }
  563|    727|}
netsnmp_tdomain_transport_tspec:
  632|     66|{
  633|     66|    const char *application, *str, *default_domain, *default_target, *source;
  634|     66|    int local;
  635|     66|    netsnmp_tdomain    *match = NULL;
  636|     66|    const char         *addr = NULL;
  637|     66|    const char * const *spec = NULL;
  638|     66|    int                 any_found = 0;
  639|     66|    char buf[SNMP_MAXPATH];
  640|     66|    const char **lspec = NULL;
  641|     66|    char *tokenized_domain = NULL;
  642|       |
  643|     66|    application = tspec->application;
  644|     66|    str = tspec->target;
  645|     66|    local = tspec->flags & NETSNMP_TSPEC_LOCAL;
  ------------------
  |  |  117|     66|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  646|     66|    default_domain = tspec->default_domain;
  647|     66|    default_target = tspec->default_target;
  648|     66|    source = tspec->source;
  649|       |    /** transport_config = tspec->transport_config; not used yet */
  650|       |
  651|     66|    DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  652|     66|                "tdomain_transport_spec(\"%s\", \"%s\", %d, \"%s\", \"%s\", \"%s\")\n",
  653|     66|                application, str ? str : "[NIL]", local,
  654|     66|                default_domain ? default_domain : "[NIL]",
  655|     66|                default_target ? default_target : "[NIL]",
  656|     66|                source ? source : "[NIL]"));
  657|       |
  658|       |    /* see if we can load a host-name specific set of conf files */
  659|     66|    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (659:9): [True: 66, False: 0]
  ------------------
  660|     66|                                NETSNMP_DS_LIB_DONT_LOAD_HOST_FILES) &&
  ------------------
  |  |  100|     66|#define NETSNMP_DS_LIB_DONT_LOAD_HOST_FILES 40 /* don't read host.conf files */
  ------------------
  661|     66|        netsnmp_is_fqdn(str)) {
  ------------------
  |  Branch (661:9): [True: 0, False: 66]
  ------------------
  662|      0|        static int have_added_handler = 0;
  663|      0|        char *newhost;
  664|      0|        struct config_line *config_handlers;
  665|      0|        struct config_files file_names;
  666|      0|        char *prev_hostname;
  667|       |
  668|       |        /* register a "transport" specifier */
  669|      0|        if (!have_added_handler) {
  ------------------
  |  Branch (669:13): [True: 0, False: 0]
  ------------------
  670|      0|            have_added_handler = 1;
  671|      0|            netsnmp_ds_register_config(ASN_OCTET_STR,
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
  672|      0|                                       "snmp", "transport",
  673|      0|                                       NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  674|      0|                                       NETSNMP_DS_LIB_HOSTNAME);
  ------------------
  |  |  178|      0|#define NETSNMP_DS_LIB_HOSTNAME          27
  ------------------
  675|      0|        }
  676|       |
  677|       |        /* we save on specific setting that we don't allow to change
  678|       |           from one transport creation to the next; ie, we don't want
  679|       |           the "transport" specifier to be a default.  It should be a
  680|       |           single invocation use only */
  681|      0|        prev_hostname = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  682|      0|                                              NETSNMP_DS_LIB_HOSTNAME);
  ------------------
  |  |  178|      0|#define NETSNMP_DS_LIB_HOSTNAME          27
  ------------------
  683|      0|        if (prev_hostname)
  ------------------
  |  Branch (683:13): [True: 0, False: 0]
  ------------------
  684|      0|            prev_hostname = strdup(prev_hostname);
  685|       |
  686|       |        /* read in the hosts/STRING.conf files */
  687|      0|        config_handlers = read_config_get_handlers("snmp");
  688|      0|        snprintf(buf, sizeof(buf)-1, "hosts/%s", str);
  689|      0|        file_names.fileHeader = buf;
  690|      0|        file_names.start = config_handlers;
  691|      0|        file_names.next = NULL;
  692|      0|        DEBUGMSGTL(("tdomain", "checking for host specific config %s\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]
  |  |  ------------------
  ------------------
  693|      0|                    buf));
  694|      0|        read_config_files_of_type(EITHER_CONFIG, &file_names);
  ------------------
  |  |   16|      0|#define EITHER_CONFIG 2
  ------------------
  695|       |
  696|      0|        if (NULL !=
  ------------------
  |  Branch (696:13): [True: 0, False: 0]
  ------------------
  697|      0|            (newhost = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  698|      0|                                             NETSNMP_DS_LIB_HOSTNAME))) {
  ------------------
  |  |  178|      0|#define NETSNMP_DS_LIB_HOSTNAME          27
  ------------------
  699|      0|            strlcpy(buf, newhost, sizeof(buf));
  700|      0|            str = buf;
  701|      0|        }
  702|       |
  703|      0|        netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  704|      0|                              NETSNMP_DS_LIB_HOSTNAME,
  ------------------
  |  |  178|      0|#define NETSNMP_DS_LIB_HOSTNAME          27
  ------------------
  705|      0|                              prev_hostname);
  706|      0|        SNMP_FREE(prev_hostname);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  707|      0|    }
  708|       |
  709|       |    /* First try - assume that there is a domain in str (domain:target) */
  710|       |
  711|     66|    if (str != NULL) {
  ------------------
  |  Branch (711:9): [True: 66, False: 0]
  ------------------
  712|     66|        const char *cp;
  713|     66|        if ((cp = strchr(str, ':')) != NULL) {
  ------------------
  |  Branch (713:13): [True: 66, False: 0]
  ------------------
  714|     66|            char* mystring = (char*)malloc(cp + 1 - str);
  715|     66|            if (mystring == NULL)
  ------------------
  |  Branch (715:17): [True: 0, False: 66]
  ------------------
  716|      0|                return NULL;
  717|     66|            memcpy(mystring, str, cp - str);
  718|     66|            mystring[cp - str] = '\0';
  719|     66|            addr = cp + 1;
  720|       |
  721|     66|            match = find_tdomain(mystring);
  722|     66|            free(mystring);
  723|     66|        }
  724|     66|    }
  725|       |
  726|       |    /*
  727|       |     * Second try, if there is no domain in str (target), then try the
  728|       |     * default domain
  729|       |     */
  730|       |
  731|     66|    if (match == NULL) {
  ------------------
  |  Branch (731:9): [True: 66, False: 0]
  ------------------
  732|     66|        addr = str;
  733|     66|        if (addr && *addr == '/') {
  ------------------
  |  Branch (733:13): [True: 66, False: 0]
  |  Branch (733:21): [True: 0, False: 66]
  ------------------
  734|      0|            DEBUGMSGTL(("tdomain",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  735|      0|                        "Address starts with '/', so assume \"unix\" "
  736|      0|                        "domain\n"));
  737|      0|            match = find_tdomain("unix");
  738|     66|        } else if (default_domain) {
  ------------------
  |  Branch (738:20): [True: 0, False: 66]
  ------------------
  739|      0|            DEBUGMSGTL(("tdomain",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  740|      0|                        "Use user specified default domain \"%s\"\n",
  741|      0|                        default_domain));
  742|      0|            if (!strchr(default_domain, ','))
  ------------------
  |  Branch (742:17): [True: 0, False: 0]
  ------------------
  743|      0|                match = find_tdomain(default_domain);
  744|      0|            else {
  745|      0|                int commas = 0;
  746|      0|                const char *cp = default_domain;
  747|      0|                char *ptr = NULL;
  748|      0|                tokenized_domain = strdup(default_domain);
  749|      0|                if (!tokenized_domain)
  ------------------
  |  Branch (749:21): [True: 0, False: 0]
  ------------------
  750|      0|                    return NULL;
  751|       |
  752|      0|                while (*++cp) if (*cp == ',') commas++;
  ------------------
  |  Branch (752:24): [True: 0, False: 0]
  |  Branch (752:35): [True: 0, False: 0]
  ------------------
  753|      0|                lspec = calloc(commas+2, sizeof(char *));
  754|      0|                if (!lspec) {
  ------------------
  |  Branch (754:21): [True: 0, False: 0]
  ------------------
  755|      0|                    free(tokenized_domain);
  756|      0|                    return NULL;
  757|      0|                }
  758|      0|                commas = 1;
  759|      0|                lspec[0] = strtok_r(tokenized_domain, ",", &ptr);
  760|      0|                while ((lspec[commas++] = strtok_r(NULL, ",", &ptr)))
  ------------------
  |  Branch (760:24): [True: 0, False: 0]
  ------------------
  761|      0|                    ;
  762|      0|                spec = lspec;
  763|      0|            }
  764|     66|        } else {
  765|     66|            spec = netsnmp_lookup_default_domains(application);
  766|     66|            if (spec == NULL) {
  ------------------
  |  Branch (766:17): [True: 66, False: 0]
  ------------------
  767|     66|                DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  768|     66|                            "No default domain found, assume \"udp\"\n"));
  769|     66|                match = find_tdomain("udp");
  770|     66|            } else {
  771|      0|                const char * const * r = spec;
  772|      0|                DEBUGMSGTL(("tdomain",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  773|      0|                            "Use application default domains"));
  774|      0|                while(*r) {
  ------------------
  |  Branch (774:23): [True: 0, False: 0]
  ------------------
  775|      0|                    DEBUGMSG(("tdomain", " \"%s\"", *r));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  776|      0|                    ++r;
  777|      0|                }
  778|      0|                DEBUGMSG(("tdomain", "\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  779|      0|            }
  780|     66|        }
  781|     66|    }
  782|       |
  783|     66|    for(;;) {
  784|     66|        if (match) {
  ------------------
  |  Branch (784:13): [True: 66, False: 0]
  ------------------
  785|     66|            netsnmp_transport *t = NULL;
  786|     66|            const char* addr2;
  787|       |
  788|     66|            any_found = 1;
  789|       |            /*
  790|       |             * Ok, we know what domain to try, lets see what default data
  791|       |             * should be used with it
  792|       |             */
  793|     66|            if (default_target != NULL)
  ------------------
  |  Branch (793:17): [True: 0, False: 66]
  ------------------
  794|      0|                addr2 = default_target;
  795|     66|            else
  796|     66|                addr2 = netsnmp_lookup_default_target(application,
  797|     66|                                                      match->prefix[0]);
  798|     66|            DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  799|     66|                        "trying domain \"%s\" address \"%s\" "
  800|     66|                        "default address \"%s\"\n",
  801|     66|                        match->prefix[0], addr ? addr : "[NIL]",
  802|     66|                        addr2 ? addr2 : "[NIL]"));
  803|     66|            if (match->f_create_from_tspec) {
  ------------------
  |  Branch (803:17): [True: 66, False: 0]
  ------------------
  804|     66|                netsnmp_tdomain_spec tspec_tmp;
  805|     66|                memcpy(&tspec_tmp, tspec, sizeof(tspec_tmp));
  806|       |                /** if we didn't have a default target but looked one up,
  807|       |                 *  copy the spec and use the found default. */
  808|     66|                if ((default_target == NULL) && (addr2 != NULL))
  ------------------
  |  Branch (808:21): [True: 66, False: 0]
  |  Branch (808:49): [True: 0, False: 66]
  ------------------
  809|      0|                    tspec_tmp.default_target = addr2;
  810|     66|                if (addr != tspec_tmp.target)
  ------------------
  |  Branch (810:21): [True: 0, False: 66]
  ------------------
  811|      0|                    tspec_tmp.target = addr;
  812|     66|                t = match->f_create_from_tspec(&tspec_tmp);
  813|     66|            }
  814|      0|            else {
  815|       |#if 0 /** remove warning until all transports implement tspec */
  816|       |                NETSNMP_LOGONCE((LOG_WARNING,
  817|       |                                 "transport domain %s uses deprecated f_create function\n",
  818|       |                                 match->prefix[0]));
  819|       |#endif
  820|      0|                if (match->f_create_from_tstring) {
  ------------------
  |  Branch (820:21): [True: 0, False: 0]
  ------------------
  821|      0|                    t = match->f_create_from_tstring(addr, local);
  822|      0|                }
  823|      0|                else
  824|      0|                    t = match->f_create_from_tstring_new(addr, local, addr2);
  825|      0|            }
  826|     66|            if (t) {
  ------------------
  |  Branch (826:17): [True: 66, False: 0]
  ------------------
  827|     66|                if (lspec) {
  ------------------
  |  Branch (827:21): [True: 0, False: 66]
  ------------------
  828|      0|                    free(tokenized_domain);
  829|      0|                    free(lspec);
  830|      0|                }
  831|     66|                return t;
  832|     66|            }
  833|     66|        }
  834|      0|        addr = str;
  835|      0|        if (spec && *spec)
  ------------------
  |  Branch (835:13): [True: 0, False: 0]
  |  Branch (835:21): [True: 0, False: 0]
  ------------------
  836|      0|            match = find_tdomain(*spec++);
  837|      0|        else
  838|      0|            break;
  839|      0|    }
  840|      0|    if (!any_found)
  ------------------
  |  Branch (840:9): [True: 0, False: 0]
  ------------------
  841|      0|        snmp_log(LOG_ERR, "No support for any checked transport domain\n");
  842|      0|    if (lspec) {
  ------------------
  |  Branch (842:9): [True: 0, False: 0]
  ------------------
  843|      0|        free(tokenized_domain);
  844|      0|        free(lspec);
  845|      0|    }
  846|       |    return NULL;
  847|     66|}
netsnmp_tdomain_transport_full:
  854|     66|{
  855|     66|    netsnmp_tdomain_spec tspec;
  856|     66|    memset(&tspec, 0x0, sizeof(tspec));
  857|     66|    tspec.application = application;
  858|     66|    tspec.target = str;
  859|     66|    if (local)
  ------------------
  |  Branch (859:9): [True: 66, False: 0]
  ------------------
  860|     66|        tspec.flags |= NETSNMP_TSPEC_LOCAL;
  ------------------
  |  |  117|     66|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  861|     66|    tspec.default_domain = default_domain;
  862|     66|    tspec.default_target = default_target;
  863|     66|    tspec.source = NULL;
  864|       |    tspec.transport_config = NULL;
  865|     66|    return netsnmp_tdomain_transport_tspec(&tspec);
  866|     66|}
netsnmp_transport_open_server:
  925|     66|{
  926|     66|    return netsnmp_tdomain_transport_full(application, str, 1, NULL, NULL);
  927|     66|}
_tc_find_transport:
 1229|     66|{
 1230|       |    /*
 1231|       |     * we shouldn't really have that many transports, so instead of
 1232|       |     * using an additional key, just iterate over the whole container.
 1233|       |     */
 1234|     66|    netsnmp_iterator  *itr;
 1235|     66|    trans_cache *tc;
 1236|       |
 1237|     66|    DEBUGMSGTL(("transport:cache:find_transport", "%p\n", t));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 1238|       |
 1239|     66|    if (NULL == _container)
  ------------------
  |  Branch (1239:9): [True: 66, False: 0]
  ------------------
 1240|     66|        return NULL;
 1241|       |
 1242|      0|    itr = CONTAINER_ITERATOR(_container);
  ------------------
  |  |  404|      0|#define CONTAINER_ITERATOR(x)       (x)->get_iterator(x)
  ------------------
 1243|      0|    if (NULL == itr) {
  ------------------
  |  Branch (1243:9): [True: 0, False: 0]
  ------------------
 1244|      0|        snmp_log(LOG_ERR, "could not get iterator for transport cache\n");
 1245|      0|        return NULL;
 1246|      0|    }
 1247|       |
 1248|      0|    tc = ITERATOR_FIRST(itr);
  ------------------
  |  |  546|      0|#define ITERATOR_FIRST(x)  x->first(x)
  ------------------
 1249|      0|    for( ; tc; tc = ITERATOR_NEXT(itr))
  ------------------
  |  |  547|      0|#define ITERATOR_NEXT(x)   x->next(x)
  ------------------
  |  Branch (1249:12): [True: 0, False: 0]
  ------------------
 1250|      0|        if (tc->t == t)
  ------------------
  |  Branch (1250:13): [True: 0, False: 0]
  ------------------
 1251|      0|            break;
 1252|      0|    ITERATOR_RELEASE(itr);
  ------------------
  |  |  550|      0|#define ITERATOR_RELEASE(x) do { x->release(x); x = NULL; } while(0)
  |  |  ------------------
  |  |  |  Branch (550:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1253|       |
 1254|      0|    DEBUGMSGT(("transport:cache:find_transport","found %p\n", tc));
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1255|       |
 1256|      0|    return tc;
 1257|      0|}
netsnmp_transport_cache_remove:
 1261|     66|{
 1262|     66|    trans_cache *tc;
 1263|       |
 1264|     66|    DEBUGMSGTL(("transport:cache:close", "%p\n", t));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 1265|       |
 1266|     66|    if (NULL == t)
  ------------------
  |  Branch (1266:9): [True: 0, False: 66]
  ------------------
 1267|      0|        return 0;
 1268|       |
 1269|       |    /** transport in cache? */
 1270|     66|    tc = _tc_find_transport(t);
 1271|     66|    if (NULL == tc) {
  ------------------
  |  Branch (1271:9): [True: 66, False: 0]
  ------------------
 1272|     66|        DEBUGMSGTL(("transport:cache:close", "%p not found in cache\n", t));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 1273|     66|        return 0;
 1274|     66|    }
 1275|       |
 1276|      0|    --tc->count;
 1277|       |
 1278|       |    /** still in use? */
 1279|      0|    if (tc->count > 0) {
  ------------------
  |  Branch (1279:9): [True: 0, False: 0]
  ------------------
 1280|      0|        DEBUGMSGTL(("transport:cache:close", "still %d user(s) of %p\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]
  |  |  ------------------
  ------------------
 1281|      0|                    tc->count, t));
 1282|      0|        return 1;
 1283|      0|    }
 1284|       |
 1285|       |    /** unbalanced get/close? */
 1286|      0|    if (tc->count < 0)
  ------------------
  |  Branch (1286:9): [True: 0, False: 0]
  ------------------
 1287|      0|        snmp_log(LOG_WARNING, "transport cache get/close mismatch\n");
 1288|       |
 1289|      0|    _tc_remove(tc);
 1290|      0|    _tc_free(tc); /* also does close */
 1291|       |
 1292|      0|    return 0;
 1293|      0|}
snmp_transport.c:netsnmp_tdomain_dump:
  521|     66|{
  522|     66|    netsnmp_tdomain *d;
  523|     66|    int i = 0;
  524|       |
  525|     66|    DEBUGMSGTL(("tdomain", "domain_list -> "));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  526|    793|    for (d = domain_list; d != NULL; d = d->next) {
  ------------------
  |  Branch (526:27): [True: 727, False: 66]
  ------------------
  527|    727|        DEBUGMSG(("tdomain", "{ "));
  ------------------
  |  |   61|    727|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    727|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 727]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 727]
  |  |  ------------------
  ------------------
  528|    727|        DEBUGMSGOID(("tdomain", d->name, d->name_length));
  ------------------
  |  |   67|    727|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    727|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 727]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 727]
  |  |  ------------------
  ------------------
  529|    727|        DEBUGMSG(("tdomain", ", \""));
  ------------------
  |  |   61|    727|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    727|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 727]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 727]
  |  |  ------------------
  ------------------
  530|  2.11k|        for (i = 0; d->prefix[i] != NULL; i++) {
  ------------------
  |  Branch (530:21): [True: 1.38k, False: 727]
  ------------------
  531|  1.38k|            DEBUGMSG(("tdomain", "%s%s", d->prefix[i],
  ------------------
  |  |   61|  1.38k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.38k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.38k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:56): [True: 0, False: 0]
  |  |  |  Branch (61:67): [Folded, False: 1.38k]
  |  |  ------------------
  ------------------
  532|  1.38k|		      (d->prefix[i + 1]) ? "/" : ""));
  533|  1.38k|        }
  534|    727|        DEBUGMSG(("tdomain", "\" } -> "));
  ------------------
  |  |   61|    727|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    727|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 727]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 727]
  |  |  ------------------
  ------------------
  535|    727|    }
  536|     66|    DEBUGMSG(("tdomain", "[NIL]\n"));
  ------------------
  |  |   61|     66|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 66]
  |  |  ------------------
  ------------------
  537|     66|}
snmp_transport.c:netsnmp_is_fqdn:
  612|     66|{
  613|     66|    if (!thename)
  ------------------
  |  Branch (613:9): [True: 0, False: 66]
  ------------------
  614|      0|        return 0;
  615|    660|    while(*thename) {
  ------------------
  |  Branch (615:11): [True: 660, False: 0]
  ------------------
  616|    660|        if (*thename != '.' && !isupper((unsigned char)*thename) &&
  ------------------
  |  Branch (616:13): [True: 462, False: 198]
  |  Branch (616:32): [True: 462, False: 0]
  ------------------
  617|    462|            !islower((unsigned char)*thename) &&
  ------------------
  |  Branch (617:13): [True: 462, False: 0]
  ------------------
  618|    462|            !isdigit((unsigned char)*thename) && *thename != '-') {
  ------------------
  |  Branch (618:13): [True: 66, False: 396]
  |  Branch (618:50): [True: 66, False: 0]
  ------------------
  619|     66|            return 0;
  620|     66|        }
  621|    594|        thename++;
  622|    594|    }
  623|      0|    return 1;
  624|     66|}
snmp_transport.c:find_tdomain:
  594|    132|{
  595|    132|    netsnmp_tdomain *d;
  596|  1.32k|    for (d = domain_list; d != NULL; d = d->next) {
  ------------------
  |  Branch (596:27): [True: 1.25k, False: 66]
  ------------------
  597|  1.25k|        int i;
  598|  3.76k|        for (i = 0; d->prefix[i] != NULL; i++)
  ------------------
  |  Branch (598:21): [True: 2.57k, False: 1.19k]
  ------------------
  599|  2.57k|            if (strcasecmp(d->prefix[i], spec) == 0) {
  ------------------
  |  Branch (599:17): [True: 66, False: 2.51k]
  ------------------
  600|     66|                DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  601|     66|                            "Found domain \"%s\" from specifier \"%s\"\n",
  602|     66|                            d->prefix[0], spec));
  603|     66|                return d;
  604|     66|            }
  605|  1.25k|    }
  606|     66|    DEBUGMSGTL(("tdomain", "Found no domain from specifier \"%s\"\n", spec));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  607|       |    return NULL;
  608|    132|}

init_ksm:
  218|     66|{
  219|     66|    krb5_error_code retval;
  220|     66|    struct snmp_secmod_def *def;
  221|     66|    int             i;
  222|       |
  223|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defKSMKeytab",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  224|     66|                               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_KSM_KEYTAB);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                             NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_KSM_KEYTAB);
  ------------------
  |  |  172|     66|#define NETSNMP_DS_LIB_KSM_KEYTAB        21
  ------------------
  225|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defKSMServiceName",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  226|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  227|     66|			       NETSNMP_DS_LIB_KSM_SERVICE_NAME);
  ------------------
  |  |  173|     66|#define NETSNMP_DS_LIB_KSM_SERVICE_NAME  22
  ------------------
  228|     66|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
  229|     66|			   SNMP_CALLBACK_POST_READ_CONFIG,
  ------------------
  |  |   24|     66|#define SNMP_CALLBACK_POST_READ_CONFIG	        0
  ------------------
  230|     66|			   init_snmpksm_post_config, NULL);
  231|       |
  232|       |
  233|     66|    if (kcontext == NULL) {
  ------------------
  |  Branch (233:9): [True: 66, False: 0]
  ------------------
  234|     66|        retval = krb5_init_context(&kcontext);
  235|       |
  236|     66|        if (retval) {
  ------------------
  |  Branch (236:13): [True: 0, False: 66]
  ------------------
  237|      0|            DEBUGMSGTL(("ksm", "krb5_init_context failed (%s), not "
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  238|      0|                        "registering KSM\n", error_message(retval)));
  239|      0|            return;
  240|      0|        }
  241|     66|    }
  242|       |
  243|  4.29k|    for (i = 0; i < HASHSIZE; i++)
  ------------------
  |  |  129|  4.29k|#define HASHSIZE	64
  ------------------
  |  Branch (243:17): [True: 4.22k, False: 66]
  ------------------
  244|  4.22k|        ksm_hash_table[i] = NULL;
  245|       |
  246|     66|    def = SNMP_MALLOC_STRUCT(snmp_secmod_def);
  ------------------
  |  |   69|     66|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  247|       |
  248|     66|    if (!def) {
  ------------------
  |  Branch (248:9): [True: 0, False: 66]
  ------------------
  249|      0|        DEBUGMSGTL(("ksm", "Unable to malloc snmp_secmod struct, not "
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  250|      0|                    "registering KSM\n"));
  251|      0|        return;
  252|      0|    }
  253|       |
  254|     66|    def->encode_reverse = ksm_rgenerate_out_msg;
  255|     66|    def->decode = ksm_process_in_msg;
  256|     66|    def->session_open = ksm_session_init;
  257|     66|    def->pdu_free_state_ref = ksm_free_state_ref;
  258|     66|    def->pdu_free = ksm_free_pdu;
  259|     66|    def->pdu_clone = ksm_clone_pdu;
  260|       |
  261|     66|    register_sec_mod(NETSNMP_SEC_MODEL_KSM, "ksm", def);
  ------------------
  |  |   13|     66|#define NETSNMP_SEC_MODEL_KSM     2066432
  ------------------
  262|     66|}
shutdown_ksm:
  265|     66|{
  266|     66|    unregister_sec_mod(NETSNMP_SEC_MODEL_KSM);
  ------------------
  |  |   13|     66|#define NETSNMP_SEC_MODEL_KSM     2066432
  ------------------
  267|     66|    if (kcontext)
  ------------------
  |  Branch (267:9): [True: 66, False: 0]
  ------------------
  268|     66|        krb5_free_context(kcontext);
  269|       |    kcontext = NULL;
  270|     66|}
snmpksm.c:init_snmpksm_post_config:
  169|     66|{
  170|       |
  171|     66|    if (kcontext == NULL) {
  ------------------
  |  Branch (171:9): [True: 0, False: 66]
  ------------------
  172|       |	/* not reached, I'd imagine */
  173|      0|        return SNMPERR_KRB5;
  ------------------
  |  |  280|      0|#define SNMPERR_KRB5			(-63)
  ------------------
  174|      0|    }
  175|       |
  176|     66|    if (service_name == NULL) {
  ------------------
  |  Branch (176:9): [True: 1, False: 65]
  ------------------
  177|       |	/* always reached, I'd imagine */
  178|      1|	char *c = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  179|      1|					NETSNMP_DS_LIB_KSM_SERVICE_NAME);
  ------------------
  |  |  173|      1|#define NETSNMP_DS_LIB_KSM_SERVICE_NAME  22
  ------------------
  180|      1|	if (c != NULL) {
  ------------------
  |  Branch (180:6): [True: 0, False: 1]
  ------------------
  181|      0|		service_name = c;
  182|      0|	}
  183|      1|	else {
  184|      1|		service_name = service_host;
  185|      1|	}
  186|      1|    }
  187|       |
  188|     66|    if (keytab_setup == 0) {
  ------------------
  |  Branch (188:9): [True: 1, False: 65]
  ------------------
  189|       |	/* always reached, I'd imagine */
  190|      1|	char *c = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  191|      1|					NETSNMP_DS_LIB_KSM_KEYTAB);
  ------------------
  |  |  172|      1|#define NETSNMP_DS_LIB_KSM_KEYTAB        21
  ------------------
  192|      1|	if (c) {
  ------------------
  |  Branch (192:6): [True: 0, False: 1]
  ------------------
  193|      0|	    krb5_error_code retval;
  194|      0|	    DEBUGMSGTL(("ksm", "Using keytab %s\n", c));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  195|      0|	    retval = krb5_kt_resolve(kcontext, c, &keytab);
  196|      0|	    if (retval) {
  ------------------
  |  Branch (196:10): [True: 0, False: 0]
  ------------------
  197|      0|		DEBUGMSGTL(("ksm", "krb5_kt_resolve(\"%s\") failed. KSM "
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  198|      0|			    "config callback failing\n", error_message(retval)));
  199|      0|		return SNMPERR_KRB5;
  ------------------
  |  |  280|      0|#define SNMPERR_KRB5			(-63)
  ------------------
  200|      0|	    }
  201|      0|	}
  202|      1|	else {
  203|      1|	    DEBUGMSGTL(("ksm", "Using default keytab\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]
  |  |  ------------------
  ------------------
  204|      1|	}
  205|      1|	keytab_setup = 1;
  206|      1|    }
  207|       |
  208|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  209|     66|}

init_tsm:
   43|     66|{
   44|     66|    struct snmp_secmod_def *def;
   45|     66|    int ret;
   46|       |
   47|     66|    def = SNMP_MALLOC_STRUCT(snmp_secmod_def);
  ------------------
  |  |   69|     66|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
   48|       |
   49|     66|    if (!def) {
  ------------------
  |  Branch (49:9): [True: 0, False: 66]
  ------------------
   50|      0|        snmp_log(LOG_ERR,
   51|      0|                 "Unable to malloc snmp_secmod struct, not registering TSM\n");
   52|      0|        return;
   53|      0|    }
   54|       |
   55|     66|    def->encode_reverse = tsm_rgenerate_out_msg;
   56|     66|    def->decode = tsm_process_in_msg;
   57|     66|    def->session_open = tsm_session_init;
   58|     66|    def->pdu_free_state_ref = tsm_free_state_ref;
   59|     66|    def->pdu_clone = tsm_clone_pdu;
   60|     66|    def->pdu_free = tsm_free_pdu;
   61|     66|    def->probe_engineid = snmpv3_probe_contextEngineID_rfc5343;
   62|       |
   63|     66|    DEBUGMSGTL(("tsm","registering ourselves\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
   64|     66|    ret = register_sec_mod(SNMP_SEC_MODEL_TSM, "tsm", def);
  ------------------
  |  |  296|     66|#define SNMP_SEC_MODEL_TSM              4
  ------------------
   65|     66|    DEBUGMSGTL(("tsm"," returned %d\n", ret));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
   66|       |
   67|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "tsmUseTransportPrefix",
  ------------------
  |  |   72|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
   68|     66|			       NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
   69|     66|                               NETSNMP_DS_LIB_TSM_USE_PREFIX);
  ------------------
  |  |   99|     66|#define NETSNMP_DS_LIB_TSM_USE_PREFIX      39 /* TSM's simple security name mapping */
  ------------------
   70|     66|}
shutdown_tsm:
   75|     66|{
   76|     66|}

usm_get_user2:
  517|      3|{
  518|      3|    DEBUGMSGTL(("usm", "getting user %.*s\n", (int)nameLen,
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 3]
  |  |  ------------------
  ------------------
  519|      3|                (const char *)name));
  520|      3|    return usm_get_user_from_list(engineID, engineIDLen, name, nameLen,
  521|      3|                                  userList, 1);
  522|      3|}
usm_free_user:
  749|    198|{
  750|    198|    if (user == NULL)
  ------------------
  |  Branch (750:9): [True: 132, False: 66]
  ------------------
  751|    132|        return NULL;
  752|       |
  753|     66|    SNMP_FREE(user->engineID);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  754|     66|    SNMP_FREE(user->name);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  755|     66|    SNMP_FREE(user->secName);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  756|     66|    SNMP_FREE(user->cloneFrom);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  757|     66|    SNMP_FREE(user->userPublicString);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  758|     66|    SNMP_FREE(user->authProtocol);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  759|     66|    SNMP_FREE(user->privProtocol);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  760|       |
  761|     66|    if (user->authKey != NULL) {
  ------------------
  |  Branch (761:9): [True: 0, False: 66]
  ------------------
  762|      0|        SNMP_ZERO(user->authKey, user->authKeyLen);
  ------------------
  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  763|      0|        SNMP_FREE(user->authKey);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  764|      0|    }
  765|       |
  766|     66|    if (user->privKey != NULL) {
  ------------------
  |  Branch (766:9): [True: 0, False: 66]
  ------------------
  767|      0|        SNMP_ZERO(user->privKey, user->privKeyLen);
  ------------------
  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  768|      0|        SNMP_FREE(user->privKey);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  769|      0|    }
  770|       |
  771|     66|    if (user->authKeyKu != NULL) {
  ------------------
  |  Branch (771:9): [True: 0, False: 66]
  ------------------
  772|      0|        SNMP_ZERO(user->authKeyKu, user->authKeyKuLen);
  ------------------
  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  773|      0|        SNMP_FREE(user->authKeyKu);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  774|      0|    }
  775|       |
  776|     66|    if (user->privKeyKu != NULL) {
  ------------------
  |  Branch (776:9): [True: 0, False: 66]
  ------------------
  777|      0|        SNMP_ZERO(user->privKeyKu, user->privKeyKuLen);
  ------------------
  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  778|      0|        SNMP_FREE(user->privKeyKu);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  779|      0|    }
  780|       |
  781|     66|#ifdef NETSNMP_USE_OPENSSL
  782|     66|    if (user->usmDHUserAuthKeyChange)
  ------------------
  |  Branch (782:9): [True: 0, False: 66]
  ------------------
  783|      0|    {
  784|      0|        DH_free(user->usmDHUserAuthKeyChange);
  785|      0|        user->usmDHUserAuthKeyChange = NULL;
  786|      0|    }
  787|       |
  788|     66|    if (user->usmDHUserPrivKeyChange)
  ------------------
  |  Branch (788:9): [True: 0, False: 66]
  ------------------
  789|      0|    {
  790|      0|        DH_free(user->usmDHUserPrivKeyChange);
  791|      0|        user->usmDHUserPrivKeyChange = NULL;
  792|      0|    }
  793|     66|#endif
  794|       |
  795|       |    /*
  796|       |     * FIX  Why not put this check *first?*
  797|       |     */
  798|     66|    if (user->prev != NULL && user->prev != (struct usmUser *)-1) {   /* ack, this shouldn't happen */
  ------------------
  |  Branch (798:9): [True: 0, False: 66]
  |  Branch (798:31): [True: 0, False: 0]
  ------------------
  799|      0|        user->prev->next = user->next;
  800|      0|    }
  801|     66|    if (user->next != NULL && user->next != (struct usmUser *)-1) {
  ------------------
  |  Branch (801:9): [True: 0, False: 66]
  |  Branch (801:31): [True: 0, False: 0]
  ------------------
  802|      0|        user->next->prev = user->prev;
  803|      0|        if (user->prev != NULL) /* ack this is really bad, because it means
  ------------------
  |  Branch (803:13): [True: 0, False: 0]
  ------------------
  804|       |                                 * * we'll loose the head of some structure tree */
  805|      0|            DEBUGMSGTL(("usm",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  806|      0|                        "Severe: Asked to free the head of a usmUser tree somewhere."));
  807|      0|    }
  808|       |
  809|       |
  810|     66|    SNMP_ZERO(user, sizeof(*user));
  ------------------
  |  |   77|     66|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 66, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 66]
  |  |  ------------------
  ------------------
  811|     66|    SNMP_FREE(user);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  812|       |
  813|     66|    return NULL;                /* for convenience to returns from calling functions */
  814|       |
  815|    198|}                               /* end usm_free_user() */
usm_create_user:
 4096|     66|{
 4097|     66|    struct usmUser *newUser;
 4098|       |
 4099|       |    /*
 4100|       |     * create the new user 
 4101|       |     */
 4102|     66|    newUser = calloc(1, sizeof(struct usmUser));
 4103|     66|    if (newUser == NULL)
  ------------------
  |  Branch (4103:9): [True: 0, False: 66]
  ------------------
 4104|      0|        return NULL;
 4105|       |
 4106|       |    /*
 4107|       |     * fill the auth/priv protocols 
 4108|       |     */
 4109|     66|    if ((newUser->authProtocol =
  ------------------
  |  Branch (4109:9): [True: 0, False: 66]
  ------------------
 4110|     66|         snmp_duplicate_objid(usmNoAuthProtocol,
 4111|     66|                              OID_LENGTH(usmNoAuthProtocol))) ==
  ------------------
  |  |   64|     66|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     66|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 4112|     66|        NULL)
 4113|      0|        return usm_free_user(newUser);
 4114|     66|    newUser->authProtocolLen = OID_LENGTH(usmNoAuthProtocol);
  ------------------
  |  |   64|     66|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     66|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 4115|       |
 4116|     66|    if ((newUser->privProtocol =
  ------------------
  |  Branch (4116:9): [True: 0, False: 66]
  ------------------
 4117|     66|         snmp_duplicate_objid(usmNoPrivProtocol,
 4118|     66|                              OID_LENGTH(usmNoPrivProtocol))) ==
  ------------------
  |  |   64|     66|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     66|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 4119|     66|        NULL)
 4120|      0|        return usm_free_user(newUser);
 4121|     66|    newUser->privProtocolLen = OID_LENGTH(usmNoPrivProtocol);
  ------------------
  |  |   64|     66|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     66|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 4122|       |
 4123|       |    /*
 4124|       |     * set the storage type to nonvolatile, and the status to ACTIVE 
 4125|       |     */
 4126|     66|    newUser->userStorageType = ST_NONVOLATILE;
  ------------------
  |  |   52|     66|#define ST_NONVOLATILE	3
  ------------------
 4127|     66|    newUser->userStatus = RS_ACTIVE;
  ------------------
  |  |   35|     66|#define RS_ACTIVE	        1
  ------------------
 4128|     66|    return newUser;
 4129|       |
 4130|     66|}                               /* end usm_clone_user() */
get_default_authtype:
 5075|    132|{
 5076|    132|    if (defaultAuthType == NULL) {
  ------------------
  |  Branch (5076:9): [True: 1, False: 131]
  ------------------
 5077|      1|        defaultAuthType = SNMP_DEFAULT_AUTH_PROTO;
  ------------------
  |  |  127|      1|#define SNMP_DEFAULT_AUTH_PROTO     usmHMACMD5AuthProtocol
  ------------------
 5078|      1|        defaultAuthTypeLen = SNMP_DEFAULT_AUTH_PROTOLEN;
  ------------------
  |  |  131|      1|#define SNMP_DEFAULT_AUTH_PROTOLEN  OID_LENGTH(SNMP_DEFAULT_AUTH_PROTO)
  |  |  ------------------
  |  |  |  |   64|      1|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |  |  |   65|      1|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  |  |  ------------------
  ------------------
 5079|      1|    }
 5080|    132|    if (len)
  ------------------
  |  Branch (5080:9): [True: 66, False: 66]
  ------------------
 5081|     66|        *len = defaultAuthTypeLen;
 5082|    132|    return defaultAuthType;
 5083|    132|}
get_default_privtype:
 5097|    132|{
 5098|    132|    if (defaultPrivType == NULL) {
  ------------------
  |  Branch (5098:9): [True: 1, False: 131]
  ------------------
 5099|      1|        defaultPrivType = SNMP_DEFAULT_PRIV_PROTO;
  ------------------
  |  |  133|      1|#define SNMP_DEFAULT_PRIV_PROTO     usmDESPrivProtocol
  ------------------
 5100|      1|        defaultPrivTypeLen = SNMP_DEFAULT_PRIV_PROTOLEN;
  ------------------
  |  |  137|      1|#define SNMP_DEFAULT_PRIV_PROTOLEN  OID_LENGTH(SNMP_DEFAULT_PRIV_PROTO)
  |  |  ------------------
  |  |  |  |   64|      1|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |  |  |   65|      1|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  |  |  ------------------
  ------------------
 5101|      1|    }
 5102|    132|    if (len)
  ------------------
  |  Branch (5102:9): [True: 66, False: 66]
  ------------------
 5103|     66|        *len = defaultPrivTypeLen;
 5104|    132|    return defaultPrivType;
 5105|    132|}
init_usm:
 5197|     66|{
 5198|     66|    struct snmp_secmod_def *def;
 5199|     66|    char *type;
 5200|       |
 5201|     66|    DEBUGMSGTL(("init_usm", "unit_usm: %" NETSNMP_PRIo "u %" NETSNMP_PRIo "u\n",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 5202|     66|                usmNoPrivProtocol[0], usmNoPrivProtocol[1]));
 5203|       |
 5204|     66|    sc_init();                  /* initialize scapi code */
 5205|       |
 5206|       |    /*
 5207|       |     * register ourselves as a security service
 5208|       |     */
 5209|     66|    def = SNMP_MALLOC_STRUCT(snmp_secmod_def);
  ------------------
  |  |   69|     66|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
 5210|     66|    if (def == NULL)
  ------------------
  |  Branch (5210:9): [True: 0, False: 66]
  ------------------
 5211|      0|        return;
 5212|       |    /*
 5213|       |     * XXX: def->init_sess_secmod move stuff from snmp_api.c
 5214|       |     */
 5215|     66|    def->encode_reverse = usm_secmod_rgenerate_out_msg;
 5216|     66|    def->encode_forward = usm_secmod_generate_out_msg;
 5217|     66|    def->decode = usm_secmod_process_in_msg;
 5218|     66|    def->pdu_clone = usm_clone;
 5219|     66|    def->pdu_free_state_ref = usm_free_usmStateReference;
 5220|     66|    def->session_setup = usm_session_init;
 5221|     66|    def->handle_report = usm_handle_report;
 5222|     66|    def->probe_engineid = usm_discover_engineid;
 5223|     66|    def->post_probe_engineid = usm_create_user_from_session_hook;
 5224|     66|    if (register_sec_mod(USM_SEC_MODEL_NUMBER, "usm", def) != SNMPERR_SUCCESS) {
  ------------------
  |  |   40|     66|#define USM_SEC_MODEL_NUMBER            SNMP_SEC_MODEL_USM
  |  |  ------------------
  |  |  |  |  295|     66|#define SNMP_SEC_MODEL_USM		3
  |  |  ------------------
  ------------------
                  if (register_sec_mod(USM_SEC_MODEL_NUMBER, "usm", def) != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (5224:9): [True: 0, False: 66]
  ------------------
 5225|      0|        SNMP_FREE(def);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 5226|      0|        snmp_log(LOG_ERR, "could not register usm sec mod\n");
 5227|      0|        return;
 5228|      0|    }
 5229|       |
 5230|     66|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 5231|     66|                           SNMP_CALLBACK_POST_PREMIB_READ_CONFIG,
  ------------------
  |  |   27|     66|#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG	3
  ------------------
 5232|     66|                           init_usm_post_config, NULL);
 5233|       |
 5234|     66|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 5235|     66|                           SNMP_CALLBACK_SHUTDOWN,
  ------------------
  |  |   26|     66|#define SNMP_CALLBACK_SHUTDOWN		        2
  ------------------
 5236|     66|                           deinit_usm_post_config, NULL);
 5237|       |
 5238|     66|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 5239|     66|                           SNMP_CALLBACK_SHUTDOWN,
  ------------------
  |  |   26|     66|#define SNMP_CALLBACK_SHUTDOWN		        2
  ------------------
 5240|     66|                           free_engineID, NULL);
 5241|       |
 5242|     66|    register_config_handler("snmp", "defAuthType", snmpv3_authtype_conf,
 5243|     66|                            NULL, "MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224");
 5244|     66|    register_config_handler("snmp", "defPrivType", snmpv3_privtype_conf,
 5245|     66|                            NULL,
 5246|     66|                            "DES"
 5247|     66|#ifdef HAVE_AES
 5248|     66|                            "|AES|AES-128"
 5249|     66|#ifdef NETSNMP_DRAFT_BLUMENTHAL_AES_04
 5250|     66|                            "|AES-192|AES-256"
 5251|     66|#endif /* NETSNMP_DRAFT_BLUMENTHAL_AES_04 */
 5252|       |#else
 5253|       |                            " (AES support not available)"
 5254|       |#endif
 5255|     66|                           );
 5256|       |
 5257|       |    /*
 5258|       |     * Free stuff at shutdown time
 5259|       |     */
 5260|     66|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 5261|     66|                           SNMP_CALLBACK_SHUTDOWN,
  ------------------
  |  |   26|     66|#define SNMP_CALLBACK_SHUTDOWN		        2
  ------------------
 5262|     66|                           free_enginetime_on_shutdown, NULL);
 5263|       |
 5264|       |
 5265|     66|    type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE);
  ------------------
  |  |  157|     66|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
 5266|       |
 5267|     66|    register_config_handler(type, "userSetAuthPass", usm_set_password,
 5268|     66|                            NULL, NULL);
 5269|     66|    register_config_handler(type, "userSetPrivPass", usm_set_password,
 5270|     66|                            NULL, NULL);
 5271|     66|    register_config_handler(type, "userSetAuthKey", usm_set_password, NULL,
 5272|     66|                            NULL);
 5273|     66|    register_config_handler(type, "userSetPrivKey", usm_set_password, NULL,
 5274|     66|                            NULL);
 5275|     66|    register_config_handler(type, "userSetAuthLocalKey", usm_set_password,
 5276|     66|                            NULL, NULL);
 5277|     66|    register_config_handler(type, "userSetPrivLocalKey", usm_set_password,
 5278|     66|                            NULL, NULL);
 5279|     66|}
shutdown_usm:
 5283|     66|{
 5284|     66|    free_etimelist();
 5285|     66|    clear_user_list();
 5286|     66|}
snmpusm.c:usm_get_user_from_list:
  482|      3|{
  483|      3|    struct usmUser *ptr;
  484|       |
  485|      3|    for (ptr = puserList; ptr != NULL; ptr = ptr->next) {
  ------------------
  |  Branch (485:27): [True: 0, False: 3]
  ------------------
  486|      0|        if (ptr->name && strlen(ptr->name) == nameLen &&
  ------------------
  |  Branch (486:13): [True: 0, False: 0]
  |  Branch (486:26): [True: 0, False: 0]
  ------------------
  487|      0|            memcmp(ptr->name, name, nameLen) == 0) {
  ------------------
  |  Branch (487:13): [True: 0, False: 0]
  ------------------
  488|      0|          DEBUGMSGTL(("usm", "match on user %s\n", ptr->name));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  489|      0|          if (ptr->engineIDLen == engineIDLen &&
  ------------------
  |  Branch (489:15): [True: 0, False: 0]
  ------------------
  490|      0|            ((ptr->engineID == NULL && engineID == NULL) ||
  ------------------
  |  Branch (490:15): [True: 0, False: 0]
  |  Branch (490:40): [True: 0, False: 0]
  ------------------
  491|      0|             (ptr->engineID != NULL && engineID != NULL &&
  ------------------
  |  Branch (491:15): [True: 0, False: 0]
  |  Branch (491:40): [True: 0, False: 0]
  ------------------
  492|      0|              memcmp(ptr->engineID, engineID, engineIDLen) == 0)))
  ------------------
  |  Branch (492:15): [True: 0, False: 0]
  ------------------
  493|      0|            return ptr;
  494|      0|          DEBUGMSGTL(("usm", "no match on engineID ("));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  495|      0|          if (engineID) {
  ------------------
  |  Branch (495:15): [True: 0, False: 0]
  ------------------
  496|      0|              DEBUGMSGHEX(("usm", engineID, engineIDLen));
  ------------------
  |  |   71|      0|#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  ------------------
  |  |  |  Branch (71:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  497|      0|          } else {
  498|      0|              DEBUGMSGTL(("usm", "Empty EngineID"));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  499|      0|          }
  500|      0|          DEBUGMSG(("usm", ")\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  501|      0|        }
  502|      0|    }
  503|       |
  504|       |    /*
  505|       |     * return "" user used to facilitate engineID discovery
  506|       |     */
  507|      3|    if (use_default && !strcmp(name, "")) {
  ------------------
  |  Branch (507:9): [True: 3, False: 0]
  |  Branch (507:24): [True: 0, False: 3]
  ------------------
  508|      0|        DEBUGMSGTL(("usm", "return noNameUser\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]
  |  |  ------------------
  ------------------
  509|      0|        return noNameUser;
  510|      0|    }
  511|      3|    return NULL;
  512|      3|}
snmpusm.c:usm_secmod_rgenerate_out_msg:
 2430|      3|{
 2431|      3|    if (!parms)
  ------------------
  |  Branch (2431:9): [True: 0, False: 3]
  ------------------
 2432|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 2433|       |
 2434|      3|    return usm_rgenerate_out_msg(parms->msgProcModel,
 2435|      3|                                 parms->globalData, parms->globalDataLen,
 2436|      3|                                 parms->maxMsgSize, parms->secModel,
 2437|      3|                                 parms->secEngineID, parms->secEngineIDLen,
 2438|      3|                                 parms->secName, parms->secNameLen,
 2439|      3|                                 parms->secLevel,
 2440|      3|                                 parms->scopedPdu, parms->scopedPduLen,
 2441|      3|                                 parms->secStateRef,
 2442|      3|                                 parms->session->sessUser,
 2443|      3|                                 parms->wholeMsg, parms->wholeMsgLen,
 2444|      3|                                 parms->wholeMsgOffset);
 2445|      3|}
snmpusm.c:usm_rgenerate_out_msg:
 1977|      3|{
 1978|      3|    size_t          msgAuthParmLen = 0;
 1979|      3|    u_int           boots_uint;
 1980|      3|    u_int           time_uint;
 1981|      3|    long            boots_long;
 1982|      3|    long            time_long;
 1983|       |
 1984|       |    /*
 1985|       |     * Indirection because secStateRef values override parameters.
 1986|       |     * 
 1987|       |     * None of these are to be free'd - they are either pointing to
 1988|       |     * what's in the secStateRef or to something either in the
 1989|       |     * actual parameter list or the user list.
 1990|       |     */
 1991|       |
 1992|      3|    const char     *theName = NULL;
 1993|      3|    u_int           theNameLength = 0;
 1994|      3|    const u_char   *theEngineID = NULL;
 1995|      3|    u_int           theEngineIDLength = 0;
 1996|      3|    u_char         *theAuthKey = NULL;
 1997|      3|    u_int           theAuthKeyLength = 0;
 1998|      3|    const oid      *theAuthProtocol = NULL;
 1999|      3|    u_int           theAuthProtocolLength = 0;
 2000|      3|    u_char         *thePrivKey = NULL;
 2001|      3|    u_int           thePrivKeyLength = 0;
 2002|      3|    const oid      *thePrivProtocol = NULL;
 2003|      3|    u_int           thePrivProtocolLength = 0;
 2004|      3|    int             theSecLevel = 0;    /* No defined const for bad
 2005|       |                                         * value (other then err). */
 2006|      3|    size_t          salt_length = 0, save_salt_length = 0;
 2007|      3|    u_char          salt[BYTESIZE(USM_MAX_SALT_LENGTH)];
 2008|      3|    u_char          authParams[USM_MAX_AUTHSIZE];
 2009|      3|    u_char          iv[BYTESIZE(USM_MAX_SALT_LENGTH)];
 2010|      3|    size_t          sp_offset = 0, mac_offset = 0;
 2011|      3|    int             rc = 0;
 2012|       |
 2013|      3|    DEBUGMSGTL(("usm", "USM processing has begun (offset %d)\n", (int)*offset));
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 3]
  |  |  ------------------
  ------------------
 2014|       |
 2015|      3|    if (secStateRef != NULL) {
  ------------------
  |  Branch (2015:9): [True: 0, False: 3]
  ------------------
 2016|       |        /*
 2017|       |         * To hush the compiler for now.  XXX 
 2018|       |         */
 2019|      0|        const struct usmStateReference *ref = secStateRef;
 2020|       |
 2021|      0|        theName = ref->usr_name;
 2022|      0|        theNameLength = ref->usr_name_length;
 2023|      0|        theEngineID = ref->usr_engine_id;
 2024|      0|        theEngineIDLength = ref->usr_engine_id_length;
 2025|       |
 2026|      0|        if (!theEngineIDLength) {
  ------------------
  |  Branch (2026:13): [True: 0, False: 0]
  ------------------
 2027|      0|            theEngineID = secEngineID;
 2028|      0|            theEngineIDLength = secEngineIDLen;
 2029|      0|        }
 2030|       |
 2031|      0|        theAuthProtocol = ref->usr_auth_protocol;
 2032|      0|        theAuthProtocolLength = ref->usr_auth_protocol_length;
 2033|      0|        theAuthKey = ref->usr_auth_key;
 2034|      0|        theAuthKeyLength = ref->usr_auth_key_length;
 2035|      0|        thePrivProtocol = ref->usr_priv_protocol;
 2036|      0|        thePrivProtocolLength = ref->usr_priv_protocol_length;
 2037|      0|        thePrivKey = ref->usr_priv_key;
 2038|      0|        thePrivKeyLength = ref->usr_priv_key_length;
 2039|      0|        theSecLevel = ref->usr_sec_level;
 2040|      0|    }
 2041|       |
 2042|       |    /*
 2043|       |     * * Identify the user record.
 2044|       |     */
 2045|      3|    else {
 2046|      3|        struct usmUser *user;
 2047|       |
 2048|       |        /*
 2049|       |         * we do allow an unknown user name for
 2050|       |         * unauthenticated requests. 
 2051|       |         */
 2052|      3|        if (sessUser)
  ------------------
  |  Branch (2052:13): [True: 0, False: 3]
  ------------------
 2053|      0|            user = sessUser;
 2054|      3|        else
 2055|      3|            user = usm_get_user2(secEngineID, secEngineIDLen, secName, secNameLen);
 2056|       |
 2057|      3|        if (user == NULL && secLevel != SNMP_SEC_LEVEL_NOAUTH) {
  ------------------
  |  |  299|      3|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
  |  Branch (2057:13): [True: 3, False: 0]
  |  Branch (2057:29): [True: 0, False: 3]
  ------------------
 2058|      0|            DEBUGMSGTL(("usm", "Unknown User\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]
  |  |  ------------------
  ------------------
 2059|      0|            return SNMPERR_USM_UNKNOWNSECURITYNAME;
  ------------------
  |  |  260|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
 2060|      0|        }
 2061|       |
 2062|      3|        theName = secName;
 2063|      3|        theNameLength = secNameLen;
 2064|      3|        theEngineID = secEngineID;
 2065|      3|        theSecLevel = secLevel;
 2066|      3|        theEngineIDLength = secEngineIDLen;
 2067|      3|        if (user) {
  ------------------
  |  Branch (2067:13): [True: 0, False: 3]
  ------------------
 2068|      0|            theAuthProtocol = user->authProtocol;
 2069|      0|            theAuthProtocolLength = user->authProtocolLen;
 2070|      0|            theAuthKey = user->authKey;
 2071|      0|            theAuthKeyLength = user->authKeyLen;
 2072|      0|            thePrivProtocol = user->privProtocol;
 2073|      0|            thePrivProtocolLength = user->privProtocolLen;
 2074|      0|            thePrivKey = user->privKey;
 2075|      0|            thePrivKeyLength = user->privKeyLen;
 2076|      3|        } else {
 2077|       |            /*
 2078|       |             * unknown users can not do authentication (obviously) 
 2079|       |             */
 2080|      3|            theAuthProtocol = usmNoAuthProtocol;
 2081|      3|            theAuthProtocolLength =
 2082|      3|                OID_LENGTH(usmNoAuthProtocol);
  ------------------
  |  |   64|      3|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      3|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 2083|      3|            theAuthKey = NULL;
 2084|      3|            theAuthKeyLength = 0;
 2085|      3|            thePrivProtocol = usmNoPrivProtocol;
 2086|      3|            thePrivProtocolLength =
 2087|      3|                OID_LENGTH(usmNoPrivProtocol);
  ------------------
  |  |   64|      3|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      3|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 2088|      3|            thePrivKey = NULL;
 2089|      3|            thePrivKeyLength = 0;
 2090|      3|        }
 2091|      3|    }                           /* endif -- secStateRef==NULL */
 2092|       |
 2093|       |
 2094|       |    /*
 2095|       |     * From here to the end of the function, avoid reference to
 2096|       |     * secName, secEngineID, secLevel, and associated lengths.
 2097|       |     */
 2098|       |
 2099|       |
 2100|       |    /*
 2101|       |     * Check to see if the user can use the requested sec services.
 2102|       |     */
 2103|      3|    if (usm_check_secLevel_vs_protocols(theSecLevel,
  ------------------
  |  Branch (2103:9): [True: 0, False: 3]
  ------------------
 2104|      3|                                        theAuthProtocol,
 2105|      3|                                        theAuthProtocolLength,
 2106|      3|                                        thePrivProtocol,
 2107|      3|                                        thePrivProtocolLength) == 1) {
 2108|      0|        DEBUGMSGTL(("usm", "Unsupported Security Level or type (%d)\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]
  |  |  ------------------
  ------------------
 2109|      0|                    theSecLevel));
 2110|       |
 2111|      0|        return SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL;
  ------------------
  |  |  261|      0|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
 2112|      0|    }
 2113|       |
 2114|       |
 2115|       |    /*
 2116|       |     * * Retrieve the engine information.
 2117|       |     * *
 2118|       |     * * XXX    No error is declared in the EoP when sending messages to
 2119|       |     * *        unknown engines, processing continues w/ boots/time == (0,0).
 2120|       |     */
 2121|      3|    if (get_enginetime(theEngineID, theEngineIDLength,
  ------------------
  |  Branch (2121:9): [True: 0, False: 3]
  ------------------
 2122|      3|                       &boots_uint, &time_uint, FALSE) == -1) {
  ------------------
  |  |  125|      3|#define FALSE 0
  ------------------
 2123|      0|        DEBUGMSGTL(("usm", "%s\n", "Failed to find engine data."));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2124|      0|    }
 2125|       |
 2126|      3|    boots_long = boots_uint;
 2127|      3|    time_long = time_uint;
 2128|       |
 2129|      3|    if (theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      3|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2129:9): [True: 0, False: 3]
  ------------------
 2130|       |        /*
 2131|       |         * Initially assume that the ciphertext will end up the same size as
 2132|       |         * the plaintext plus some padding.  Really sc_encrypt ought to be able
 2133|       |         * to grow this for us, a la asn_realloc_rbuild_<type> functions, but
 2134|       |         * this will do for now.  
 2135|       |         */
 2136|      0|        u_char         *ciphertext = NULL;
 2137|      0|        size_t          ciphertextlen = scopedPduLen + 64;
 2138|      0|        int             priv_type = sc_get_privtype(thePrivProtocol,
 2139|      0|                                                    thePrivProtocolLength);
 2140|       |
 2141|      0|        if ((ciphertext = (u_char *) malloc(ciphertextlen)) == NULL) {
  ------------------
  |  Branch (2141:13): [True: 0, False: 0]
  ------------------
 2142|      0|            DEBUGMSGTL(("usm",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2143|      0|                        "couldn't malloc %d bytes for encrypted PDU\n",
 2144|      0|                        (int)ciphertextlen));
 2145|      0|            return SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 2146|      0|        }
 2147|       |
 2148|       |        /*
 2149|       |         * XXX Hardwired to seek into a 1DES private key!  
 2150|       |         */
 2151|      0|#ifdef HAVE_AES
 2152|      0|        if (USM_CREATE_USER_PRIV_AES == (priv_type & USM_PRIV_MASK_ALG)) {
  ------------------
  |  |  176|      0|#define USM_CREATE_USER_PRIV_AES            0x02
  ------------------
                      if (USM_CREATE_USER_PRIV_AES == (priv_type & USM_PRIV_MASK_ALG)) {
  ------------------
  |  |  166|      0|#define USM_PRIV_MASK_ALG                   0x0000ff
  ------------------
  |  Branch (2152:13): [True: 0, False: 0]
  ------------------
 2153|      0|            salt_length = BYTESIZE(USM_AES_SALT_LENGTH);
  ------------------
  |  |   55|      0|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 2154|      0|            save_salt_length = BYTESIZE(USM_AES_SALT_LENGTH)/2;
  ------------------
  |  |   55|      0|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 2155|      0|            if (!thePrivKey ||
  ------------------
  |  Branch (2155:17): [True: 0, False: 0]
  ------------------
 2156|      0|                usm_set_aes_iv(salt, &salt_length,
  ------------------
  |  Branch (2156:17): [True: 0, False: 0]
  ------------------
 2157|      0|                               htonl(boots_uint), htonl(time_uint),
 2158|      0|                               iv) == -1) {
 2159|      0|                DEBUGMSGTL(("usm", "Can't set AES iv.\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]
  |  |  ------------------
  ------------------
 2160|      0|                SNMP_FREE(ciphertext);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2161|      0|                return SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 2162|      0|            }
 2163|      0|        } 
 2164|      0|#endif
 2165|      0|#ifndef NETSNMP_DISABLE_DES
 2166|      0|        if (USM_CREATE_USER_PRIV_DES == (priv_type & USM_PRIV_MASK_ALG)) {
  ------------------
  |  |  172|      0|#define USM_CREATE_USER_PRIV_DES            0x01
  ------------------
                      if (USM_CREATE_USER_PRIV_DES == (priv_type & USM_PRIV_MASK_ALG)) {
  ------------------
  |  |  166|      0|#define USM_PRIV_MASK_ALG                   0x0000ff
  ------------------
  |  Branch (2166:13): [True: 0, False: 0]
  ------------------
 2167|      0|            salt_length = BYTESIZE(USM_DES_SALT_LENGTH);
  ------------------
  |  |   55|      0|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 2168|      0|            save_salt_length = BYTESIZE(USM_DES_SALT_LENGTH);
  ------------------
  |  |   55|      0|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 2169|      0|            if (!thePrivKey || (usm_set_salt(salt, &salt_length,
  ------------------
  |  Branch (2169:17): [True: 0, False: 0]
  |  Branch (2169:32): [True: 0, False: 0]
  ------------------
 2170|      0|                                             thePrivKey + 8,
 2171|      0|                                             thePrivKeyLength - 8,
 2172|      0|                                             iv) == -1)) {
 2173|      0|                DEBUGMSGTL(("usm", "Can't set DES-CBC salt.\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]
  |  |  ------------------
  ------------------
 2174|      0|                SNMP_FREE(ciphertext);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2175|      0|                return SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 2176|      0|            }
 2177|      0|        }
 2178|      0|#endif
 2179|       |#ifdef NETSNMP_ENABLE_TESTING_CODE
 2180|       |        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
 2181|       |            dump_chunk("usm/dump", "This data was encrypted:",
 2182|       |                       scopedPdu, scopedPduLen);
 2183|       |        }
 2184|       |#endif
 2185|       |
 2186|      0|        if (sc_encrypt(thePrivProtocol, thePrivProtocolLength,
  ------------------
  |  Branch (2186:13): [True: 0, False: 0]
  ------------------
 2187|      0|                       thePrivKey, thePrivKeyLength,
 2188|      0|                       salt, salt_length,
 2189|      0|                       scopedPdu, scopedPduLen,
 2190|      0|                       ciphertext, &ciphertextlen) != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|      0|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
 2191|      0|            DEBUGMSGTL(("usm", "encryption error.\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]
  |  |  ------------------
  ------------------
 2192|      0|            SNMP_FREE(ciphertext);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2193|      0|            return SNMPERR_USM_ENCRYPTIONERROR;
  ------------------
  |  |  262|      0|#define SNMPERR_USM_ENCRYPTIONERROR		(-45)
  ------------------
 2194|      0|        }
 2195|       |
 2196|       |        /*
 2197|       |         * Write the encrypted scopedPdu back into the packet buffer.  
 2198|       |         */
 2199|       |
 2200|      0|        *offset = 0;
 2201|      0|        rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2202|      0|                                       (u_char) (ASN_UNIVERSAL |
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
 2203|      0|                                                 ASN_PRIMITIVE |
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2204|      0|                                                 ASN_OCTET_STR),
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 2205|      0|                                       ciphertext, ciphertextlen);
 2206|      0|        if (rc == 0) {
  ------------------
  |  Branch (2206:13): [True: 0, False: 0]
  ------------------
 2207|      0|            DEBUGMSGTL(("usm", "Encryption failed.\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]
  |  |  ------------------
  ------------------
 2208|      0|            SNMP_FREE(ciphertext);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2209|      0|            return SNMPERR_USM_ENCRYPTIONERROR;
  ------------------
  |  |  262|      0|#define SNMPERR_USM_ENCRYPTIONERROR		(-45)
  ------------------
 2210|      0|        }
 2211|       |
 2212|       |#ifdef NETSNMP_ENABLE_TESTING_CODE
 2213|       |        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
 2214|       |            dump_chunk("usm/dump", "salt + Encrypted form: ", salt,
 2215|       |                       salt_length);
 2216|       |            dump_chunk("usm/dump", "wholeMsg:",
 2217|       |                       (*wholeMsg + *wholeMsgLen - *offset), *offset);
 2218|       |        }
 2219|       |#endif
 2220|       |
 2221|      0|        DEBUGMSGTL(("usm", "Encryption successful.\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]
  |  |  ------------------
  ------------------
 2222|      0|        SNMP_FREE(ciphertext);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2223|      3|    } else {
 2224|       |        /*
 2225|       |         * theSecLevel != SNMP_SEC_LEVEL_AUTHPRIV  
 2226|       |         */
 2227|      3|    }
 2228|       |
 2229|       |    /*
 2230|       |     * Start encoding the msgSecurityParameters.  
 2231|       |     */
 2232|       |
 2233|      3|    sp_offset = *offset;
 2234|       |
 2235|      3|    DEBUGDUMPHEADER("send", "msgPrivacyParameters");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2236|       |    /*
 2237|       |     * msgPrivacyParameters (warning: assumes DES salt).  
 2238|       |     */
 2239|      3|    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2240|      3|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2241|      3|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|      3|#define ASN_OCTET_STR	    0x04U
  ------------------
 2242|      3|                                   iv,
 2243|      3|                                   save_salt_length);
 2244|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2245|      3|    if (rc == 0) {
  ------------------
  |  Branch (2245:9): [True: 0, False: 3]
  ------------------
 2246|      0|        DEBUGMSGTL(("usm", "building privParams failed.\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]
  |  |  ------------------
  ------------------
 2247|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2248|      0|    }
 2249|       |
 2250|      3|    DEBUGDUMPHEADER("send", "msgAuthenticationParameters");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2251|       |    /*
 2252|       |     * msgAuthenticationParameters.
 2253|       |     */
 2254|      3|    if (theSecLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
  ------------------
  |  |  300|      6|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (2254:9): [True: 0, False: 3]
  ------------------
 2255|      3|        || theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      3|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2255:12): [True: 0, False: 3]
  ------------------
 2256|      0|        memset(authParams, 0, sizeof(authParams));
 2257|      0|        msgAuthParmLen =
 2258|      0|            sc_get_auth_maclen(sc_get_authtype(theAuthProtocol,
 2259|      0|                                               theAuthProtocolLength));
 2260|      0|    }
 2261|       |
 2262|      3|    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2263|      3|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2264|      3|                                             | ASN_OCTET_STR), authParams,
  ------------------
  |  |   78|      3|#define ASN_OCTET_STR	    0x04U
  ------------------
 2265|      3|                                   msgAuthParmLen);
 2266|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2267|      3|    if (rc == 0) {
  ------------------
  |  Branch (2267:9): [True: 0, False: 3]
  ------------------
 2268|      0|        DEBUGMSGTL(("usm", "building authParams failed.\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]
  |  |  ------------------
  ------------------
 2269|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2270|      0|    }
 2271|       |
 2272|       |    /*
 2273|       |     * Remember where to put the actual HMAC we calculate later on.  An
 2274|       |     * encoded OCTET STRING of length USM_MD5_AND_SHA_AUTH_LEN has an ASN.1
 2275|       |     * header of length 2, hence the fudge factor.  This works as long as
 2276|       |     * auth lengths stay < 127.
 2277|       |     */
 2278|      3|    mac_offset = *offset - 2;
 2279|       |
 2280|       |    /*
 2281|       |     * msgUserName.  
 2282|       |     */
 2283|      3|    DEBUGDUMPHEADER("send", "msgUserName");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2284|      3|    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2285|      3|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2286|      3|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|      3|#define ASN_OCTET_STR	    0x04U
  ------------------
 2287|      3|                                   (const u_char *) theName, theNameLength);
 2288|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2289|      3|    if (rc == 0) {
  ------------------
  |  Branch (2289:9): [True: 0, False: 3]
  ------------------
 2290|      0|        DEBUGMSGTL(("usm", "building authParams failed.\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]
  |  |  ------------------
  ------------------
 2291|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2292|      0|    }
 2293|       |
 2294|       |    /*
 2295|       |     * msgAuthoritativeEngineTime.  
 2296|       |     */
 2297|      3|    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineTime");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2298|      3|    rc = asn_realloc_rbuild_int(wholeMsg, wholeMsgLen, offset, 1,
 2299|      3|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2300|      3|                                          ASN_INTEGER), &time_long,
  ------------------
  |  |   75|      3|#define ASN_INTEGER	    0x02U
  ------------------
 2301|      3|                                sizeof(long));
 2302|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2303|      3|    if (rc == 0) {
  ------------------
  |  Branch (2303:9): [True: 0, False: 3]
  ------------------
 2304|      0|        DEBUGMSGTL(("usm",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2305|      0|                    "building msgAuthoritativeEngineTime failed.\n"));
 2306|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2307|      0|    }
 2308|       |
 2309|       |    /*
 2310|       |     * msgAuthoritativeEngineBoots.  
 2311|       |     */
 2312|      3|    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineBoots");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2313|      3|    rc = asn_realloc_rbuild_int(wholeMsg, wholeMsgLen, offset, 1,
 2314|      3|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2315|      3|                                          ASN_INTEGER), &boots_long,
  ------------------
  |  |   75|      3|#define ASN_INTEGER	    0x02U
  ------------------
 2316|      3|                                sizeof(long));
 2317|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2318|      3|    if (rc == 0) {
  ------------------
  |  Branch (2318:9): [True: 0, False: 3]
  ------------------
 2319|      0|        DEBUGMSGTL(("usm",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2320|      0|                    "building msgAuthoritativeEngineBoots failed.\n"));
 2321|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2322|      0|    }
 2323|       |
 2324|      3|    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineID");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2325|      3|    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2326|      3|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2327|      3|                                             | ASN_OCTET_STR), theEngineID,
  ------------------
  |  |   78|      3|#define ASN_OCTET_STR	    0x04U
  ------------------
 2328|      3|                                   theEngineIDLength);
 2329|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2330|      3|    if (rc == 0) {
  ------------------
  |  Branch (2330:9): [True: 0, False: 3]
  ------------------
 2331|      0|        DEBUGMSGTL(("usm", "building msgAuthoritativeEngineID failed.\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]
  |  |  ------------------
  ------------------
 2332|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2333|      0|    }
 2334|       |
 2335|       |    /*
 2336|       |     * USM msgSecurityParameters sequence header  
 2337|       |     */
 2338|      3|    rc = asn_realloc_rbuild_sequence(wholeMsg, wholeMsgLen, offset, 1,
 2339|      3|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      3|#define ASN_SEQUENCE	    0x10U
  ------------------
 2340|      3|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2341|      3|                                     *offset - sp_offset);
 2342|      3|    if (rc == 0) {
  ------------------
  |  Branch (2342:9): [True: 0, False: 3]
  ------------------
 2343|      0|        DEBUGMSGTL(("usm", "building usm security parameters failed.\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]
  |  |  ------------------
  ------------------
 2344|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2345|      0|    }
 2346|       |
 2347|       |    /*
 2348|       |     * msgSecurityParameters OCTET STRING wrapper.  
 2349|       |     */
 2350|      3|    rc = asn_realloc_rbuild_header(wholeMsg, wholeMsgLen, offset, 1,
 2351|      3|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2352|      3|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|      3|#define ASN_OCTET_STR	    0x04U
  ------------------
 2353|      3|                                   *offset - sp_offset);
 2354|       |
 2355|      3|    if (rc == 0) {
  ------------------
  |  Branch (2355:9): [True: 0, False: 3]
  ------------------
 2356|      0|        DEBUGMSGTL(("usm", "building msgSecurityParameters failed.\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]
  |  |  ------------------
  ------------------
 2357|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2358|      0|    }
 2359|       |
 2360|       |    /*
 2361|       |     * Copy in the msgGlobalData and msgVersion.  
 2362|       |     */
 2363|      3|    while ((*wholeMsgLen - *offset) < globalDataLen) {
  ------------------
  |  Branch (2363:12): [True: 0, False: 3]
  ------------------
 2364|      0|        if (!asn_realloc(wholeMsg, wholeMsgLen)) {
  ------------------
  |  Branch (2364:13): [True: 0, False: 0]
  ------------------
 2365|      0|            DEBUGMSGTL(("usm", "building global data failed.\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]
  |  |  ------------------
  ------------------
 2366|      0|            return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2367|      0|        }
 2368|      0|    }
 2369|       |
 2370|      3|    *offset += globalDataLen;
 2371|      3|    memcpy(*wholeMsg + *wholeMsgLen - *offset, globalData, globalDataLen);
 2372|       |
 2373|       |    /*
 2374|       |     * Total packet sequence.  
 2375|       |     */
 2376|      3|    rc = asn_realloc_rbuild_sequence(wholeMsg, wholeMsgLen, offset, 1,
 2377|      3|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      3|#define ASN_SEQUENCE	    0x10U
  ------------------
 2378|      3|                                               ASN_CONSTRUCTOR), *offset);
  ------------------
  |  |   96|      3|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2379|      3|    if (rc == 0) {
  ------------------
  |  Branch (2379:9): [True: 0, False: 3]
  ------------------
 2380|      0|        DEBUGMSGTL(("usm", "building master packet sequence failed.\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]
  |  |  ------------------
  ------------------
 2381|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2382|      0|    }
 2383|       |
 2384|       |    /*
 2385|       |     * Now consider / do authentication.  
 2386|       |     */
 2387|       |
 2388|      3|    if (theSecLevel == SNMP_SEC_LEVEL_AUTHNOPRIV ||
  ------------------
  |  |  300|      6|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (2388:9): [True: 0, False: 3]
  ------------------
 2389|      3|        theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      3|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2389:9): [True: 0, False: 3]
  ------------------
 2390|      0|        size_t          temp_sig_len = msgAuthParmLen;
 2391|      0|        u_char         *temp_sig = (u_char *) malloc(temp_sig_len);
 2392|      0|        u_char         *proto_msg = *wholeMsg + *wholeMsgLen - *offset;
 2393|      0|        size_t          proto_msg_len = *offset;
 2394|       |
 2395|       |
 2396|      0|        if (temp_sig == NULL) {
  ------------------
  |  Branch (2396:13): [True: 0, False: 0]
  ------------------
 2397|      0|            DEBUGMSGTL(("usm", "Out of memory.\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]
  |  |  ------------------
  ------------------
 2398|      0|            return SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 2399|      0|        }
 2400|       |
 2401|      0|        if (sc_generate_keyed_hash(theAuthProtocol, theAuthProtocolLength,
  ------------------
  |  Branch (2401:13): [True: 0, False: 0]
  ------------------
 2402|      0|                                   theAuthKey, theAuthKeyLength,
 2403|      0|                                   proto_msg, proto_msg_len,
 2404|      0|                                   temp_sig, &temp_sig_len)
 2405|      0|            != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|      0|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
 2406|      0|            SNMP_FREE(temp_sig);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2407|      0|            DEBUGMSGTL(("usm", "Signing failed.\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]
  |  |  ------------------
  ------------------
 2408|      0|            return SNMPERR_USM_AUTHENTICATIONFAILURE;
  ------------------
  |  |  263|      0|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
 2409|      0|        }
 2410|       |
 2411|      0|        if (temp_sig_len != msgAuthParmLen) {
  ------------------
  |  Branch (2411:13): [True: 0, False: 0]
  ------------------
 2412|      0|            SNMP_FREE(temp_sig);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2413|      0|            DEBUGMSGTL(("usm", "Signing lengths failed.\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]
  |  |  ------------------
  ------------------
 2414|      0|            return SNMPERR_USM_AUTHENTICATIONFAILURE;
  ------------------
  |  |  263|      0|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
 2415|      0|        }
 2416|       |
 2417|      0|        memcpy(*wholeMsg + *wholeMsgLen - mac_offset, temp_sig,
 2418|      0|               msgAuthParmLen);
 2419|      0|        SNMP_FREE(temp_sig);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2420|      0|    }
 2421|       |    /*
 2422|       |     * endif -- create keyed hash 
 2423|       |     */
 2424|      3|    DEBUGMSGTL(("usm", "USM processing completed.\n"));
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 3]
  |  |  ------------------
  ------------------
 2425|      3|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      3|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 2426|      3|}                               /* end usm_rgenerate_out_msg() */
snmpusm.c:usm_check_secLevel_vs_protocols:
 1356|      3|{
 1357|       |
 1358|      3|    if (level == SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|      6|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (1358:9): [True: 0, False: 3]
  ------------------
 1359|      0|        &&
 1360|      0|        (netsnmp_oid_equals
  ------------------
  |  Branch (1360:9): [True: 0, False: 0]
  ------------------
 1361|      0|         (privProtocol, privProtocolLen, usmNoPrivProtocol,
 1362|      0|          OID_LENGTH(usmNoPrivProtocol)) == 0)) {
  ------------------
  |  |   64|      0|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      0|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 1363|      0|        DEBUGMSGTL(("usm", "Level: %d\n", level));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1364|      0|        DEBUGMSGTL(("usm", "Auth Protocol: "));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1365|      0|        DEBUGMSGOID(("usm", authProtocol, authProtocolLen));
  ------------------
  |  |   67|      0|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1366|      0|        DEBUGMSG(("usm", ", Priv Protocol: "));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1367|      0|        DEBUGMSGOID(("usm", privProtocol, privProtocolLen));
  ------------------
  |  |   67|      0|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1368|      0|        DEBUGMSG(("usm", "\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1369|      0|        return 1;
 1370|      0|    }
 1371|      3|    if ((level == SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|      6|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (1371:10): [True: 0, False: 3]
  ------------------
 1372|      3|         || level == SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|      3|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (1372:13): [True: 0, False: 3]
  ------------------
 1373|      0|        &&
 1374|      0|        (netsnmp_oid_equals
  ------------------
  |  Branch (1374:9): [True: 0, False: 0]
  ------------------
 1375|      0|         (authProtocol, authProtocolLen, usmNoAuthProtocol,
 1376|      0|          OID_LENGTH(usmNoAuthProtocol)) == 0)) {
  ------------------
  |  |   64|      0|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      0|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 1377|      0|        DEBUGMSGTL(("usm", "Level: %d\n", level));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1378|      0|        DEBUGMSGTL(("usm", "Auth Protocol: "));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1379|      0|        DEBUGMSGOID(("usm", authProtocol, authProtocolLen));
  ------------------
  |  |   67|      0|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1380|      0|        DEBUGMSG(("usm", ", Priv Protocol: "));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1381|      0|        DEBUGMSGOID(("usm", privProtocol, privProtocolLen));
  ------------------
  |  |   67|      0|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1382|      0|        DEBUGMSG(("usm", "\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1383|      0|        return 1;
 1384|      0|    }
 1385|       |
 1386|      3|    return 0;
 1387|       |
 1388|      3|}                               /* end usm_check_secLevel_vs_protocols() */
snmpusm.c:usm_secmod_process_in_msg:
 3357|      6|{
 3358|      6|    if (!parms)
  ------------------
  |  Branch (3358:9): [True: 0, False: 6]
  ------------------
 3359|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 3360|       |
 3361|      6|    return usm_process_in_msg(parms->msgProcModel,
 3362|      6|                              parms->maxMsgSize,
 3363|      6|                              parms->secParams,
 3364|      6|                              parms->secModel,
 3365|      6|                              parms->secLevel,
 3366|      6|                              parms->wholeMsg,
 3367|      6|                              parms->wholeMsgLen,
 3368|      6|                              parms->secEngineID,
 3369|      6|                              parms->secEngineIDLen,
 3370|      6|                              parms->secName,
 3371|      6|                              parms->secNameLen,
 3372|      6|                              parms->scopedPdu,
 3373|      6|                              parms->scopedPduLen,
 3374|      6|                              parms->maxSizeResponse,
 3375|      6|                              parms->secStateRef,
 3376|      6|                              parms->sess, parms->msg_flags);
 3377|      6|}
snmpusm.c:usm_process_in_msg:
 2956|      6|{                               /* IN     - v3 Message flags.              */
 2957|      6|    size_t          remaining = wholeMsgLen - (secParams - wholeMsg);
 2958|      6|    u_int           boots_uint;
 2959|      6|    u_int           time_uint;
 2960|      6|#ifdef HAVE_AES
 2961|      6|    u_int           net_boots, net_time;
 2962|      6|#endif
 2963|      6|#ifndef NETSNMP_DISABLE_DES
 2964|      6|    int             i;
 2965|      6|#endif
 2966|      6|    u_char          signature[USM_MAX_AUTHSIZE];
 2967|      6|    size_t          signature_length = USM_MAX_AUTHSIZE;
  ------------------
  |  |   38|      6|#define USM_MAX_AUTHSIZE                USM_HMAC384SHA512_AUTH_LEN
  |  |  ------------------
  |  |  |  |   37|      6|#define USM_HMAC384SHA512_AUTH_LEN      48      /* SHOULD */
  |  |  ------------------
  ------------------
 2968|      6|    u_char          salt[BYTESIZE(USM_MAX_SALT_LENGTH)];
 2969|      6|    size_t          salt_length = BYTESIZE(USM_MAX_SALT_LENGTH);
  ------------------
  |  |   55|      6|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 2970|      6|    u_char          iv[BYTESIZE(USM_MAX_SALT_LENGTH)];
 2971|      6|    u_int           iv_length = BYTESIZE(USM_MAX_SALT_LENGTH);
  ------------------
  |  |   55|      6|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 2972|      6|    u_char         *data_ptr;
 2973|      6|    u_char         *value_ptr;
 2974|      6|    u_char          type_value;
 2975|      6|    u_char         *end_of_overhead = NULL;
 2976|      6|    int             error;
 2977|      6|    int             rc = 0;
 2978|      6|    struct usmStateReference **secStateRef =
 2979|      6|        (struct usmStateReference **) secStateRf;
 2980|       |
 2981|      6|    struct usmUser *user;
 2982|       |
 2983|       |
 2984|      6|    DEBUGMSGTL(("usm", "USM processing begun...\n"));
  ------------------
  |  |   66|      6|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      6|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 6]
  |  |  ------------------
  ------------------
 2985|       |
 2986|      6|    netsnmp_assert(secStateRef);
  ------------------
  |  |   47|      6|#      define netsnmp_assert(x)  do { \
  |  |   48|      6|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 6, False: 0]
  |  |  ------------------
  |  |   49|      6|                 ; \
  |  |   50|      6|              else \
  |  |   51|      6|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      6|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 6]
  |  |  ------------------
  ------------------
 2987|       |
 2988|      6|    usm_free_usmStateReference(*secStateRef);
 2989|      6|    *secStateRef = usm_malloc_usmStateReference();
 2990|      6|    if (*secStateRef == NULL) {
  ------------------
  |  Branch (2990:9): [True: 0, False: 6]
  ------------------
 2991|      0|        DEBUGMSGTL(("usm", "Out of memory.\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]
  |  |  ------------------
  ------------------
 2992|      0|        return SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 2993|      0|    }
 2994|       |
 2995|       |    /*
 2996|       |     * Make sure the *secParms is an OCTET STRING.
 2997|       |     * Extract the user name, engine ID, and security level.
 2998|       |     */
 2999|      6|    if ((rc = usm_parse_security_parameters(secParams, remaining,
  ------------------
  |  Branch (2999:9): [True: 2, False: 4]
  ------------------
 3000|      6|                                            secEngineID, secEngineIDLen,
 3001|      6|                                            &boots_uint, &time_uint,
 3002|      6|                                            secName, secNameLen,
 3003|      6|                                            signature, &signature_length,
 3004|      6|                                            salt, &salt_length,
 3005|      6|                                            &data_ptr)) < 0) {
 3006|      2|        DEBUGMSGTL(("usm", "Parsing failed (rc %d).\n", rc));
  ------------------
  |  |   66|      2|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 2]
  |  |  ------------------
  ------------------
 3007|      2|        if (rc == -2) {
  ------------------
  |  Branch (3007:13): [True: 0, False: 2]
  ------------------
 3008|       |            /*
 3009|       |             * This indicates a decryptionError.  
 3010|       |             */
 3011|      0|            snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  658|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3012|      0|            error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  267|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3013|      2|        } else {
 3014|      2|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      2|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3015|      2|            error = SNMPERR_USM_PARSEERROR;
  ------------------
  |  |  264|      2|#define SNMPERR_USM_PARSEERROR			(-47)
  ------------------
 3016|      2|        }
 3017|      2|        goto err;
 3018|      2|    }
 3019|       |
 3020|       |    /*
 3021|       |     * RFC 2574 section 8.3.2
 3022|       |     * 1)  If the privParameters field is not an 8-octet OCTET STRING,
 3023|       |     * then an error indication (decryptionError) is returned to the
 3024|       |     * calling module.
 3025|       |     */
 3026|      4|    if ((secLevel == SNMP_SEC_LEVEL_AUTHPRIV) && (salt_length != 8)) {
  ------------------
  |  |  301|      4|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3026:9): [True: 0, False: 4]
  |  Branch (3026:50): [True: 0, False: 0]
  ------------------
 3027|      0|        snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  658|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3028|      0|        error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  267|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3029|      0|        goto err;
 3030|      0|    }
 3031|       |
 3032|      4|    if (secLevel != SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      4|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3032:9): [True: 4, False: 0]
  ------------------
 3033|       |        /*
 3034|       |         * pull these out now so reports can use them 
 3035|       |         */
 3036|      4|        *scopedPdu = data_ptr;
 3037|      4|        *scopedPduLen = wholeMsgLen - (data_ptr - wholeMsg);
 3038|      4|        end_of_overhead = data_ptr;
 3039|      4|    }
 3040|       |
 3041|       |    /*
 3042|       |     * Cache the name, engine ID, and security level,
 3043|       |     * * per step 2 (section 3.2)
 3044|       |     */
 3045|      4|    if (usm_set_usmStateReference_name
  ------------------
  |  Branch (3045:9): [True: 0, False: 4]
  ------------------
 3046|      4|        (*secStateRef, secName, *secNameLen) == -1) {
 3047|      0|        DEBUGMSGTL(("usm", "%s\n", "Couldn't cache name."));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 3048|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3049|      0|        goto err;
 3050|      0|    }
 3051|       |
 3052|      4|    if (usm_set_usmStateReference_engine_id
  ------------------
  |  Branch (3052:9): [True: 0, False: 4]
  ------------------
 3053|      4|        (*secStateRef, secEngineID, *secEngineIDLen) == -1) {
 3054|      0|        DEBUGMSGTL(("usm", "%s\n", "Couldn't cache engine id."));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 3055|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3056|      0|        goto err;
 3057|      0|    }
 3058|       |
 3059|      4|    if (usm_set_usmStateReference_sec_level(*secStateRef, secLevel) ==
  ------------------
  |  Branch (3059:9): [True: 0, False: 4]
  ------------------
 3060|      4|        -1) {
 3061|      0|        DEBUGMSGTL(("usm", "%s\n", "Couldn't cache security level."));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 3062|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3063|      0|        goto err;
 3064|      0|    }
 3065|       |
 3066|       |    /*
 3067|       |     * Locate the engine ID record.
 3068|       |     * If it is unknown, then either create one or note this as an error.
 3069|       |     */
 3070|      4|    if ((sess && (sess->isAuthoritative == SNMP_SESS_AUTHORITATIVE ||
  ------------------
  |  |  158|      8|#define SNMP_SESS_AUTHORITATIVE    1    /* don't learn engineIDs */
  ------------------
  |  Branch (3070:10): [True: 4, False: 0]
  |  Branch (3070:19): [True: 0, False: 4]
  ------------------
 3071|      4|                  (sess->isAuthoritative == SNMP_SESS_UNKNOWNAUTH &&
  ------------------
  |  |  159|      8|#define SNMP_SESS_UNKNOWNAUTH      2    /* sometimes (like NRs) */
  ------------------
  |  Branch (3071:20): [True: 4, False: 0]
  ------------------
 3072|      4|                   (msg_flags & SNMP_MSG_FLAG_RPRT_BIT)))) ||
  ------------------
  |  |  305|      4|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3072:20): [True: 4, False: 0]
  ------------------
 3073|      4|        (!sess && (msg_flags & SNMP_MSG_FLAG_RPRT_BIT))) {
  ------------------
  |  |  305|      0|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3073:10): [True: 0, False: 0]
  |  Branch (3073:19): [True: 0, False: 0]
  ------------------
 3074|      4|        if (ISENGINEKNOWN(secEngineID, *secEngineIDLen) == FALSE) {
  ------------------
  |  |   82|      4|	( (get_enginetime(e, e_l,				\
  |  |  ------------------
  |  |  |  Branch (82:4): [True: 0, False: 4]
  |  |  ------------------
  |  |   83|      4|		&dummy_eboot, &dummy_etime, TRUE) == SNMPERR_SUCCESS)	\
  |  |  ------------------
  |  |  |  |  128|      4|#define TRUE  1
  |  |  ------------------
  |  |               		&dummy_eboot, &dummy_etime, TRUE) == SNMPERR_SUCCESS)	\
  |  |  ------------------
  |  |  |  |  217|      4|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |   84|      4|		? TRUE						\
  |  |  ------------------
  |  |  |  |  128|      0|#define TRUE  1
  |  |  ------------------
  |  |   85|      4|		: FALSE )
  |  |  ------------------
  |  |  |  |  125|      4|#define FALSE 0
  |  |  ------------------
  ------------------
                      if (ISENGINEKNOWN(secEngineID, *secEngineIDLen) == FALSE) {
  ------------------
  |  |  125|      4|#define FALSE 0
  ------------------
  |  Branch (3074:13): [True: 4, False: 0]
  ------------------
 3075|      4|            DEBUGMSGTL(("usm", "Unknown Engine ID.\n"));
  ------------------
  |  |   66|      4|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 4]
  |  |  ------------------
  ------------------
 3076|      4|            snmp_increment_statistic(STAT_USMSTATSUNKNOWNENGINEIDS);
  ------------------
  |  |  656|      4|#define   STAT_USMSTATSUNKNOWNENGINEIDS      6
  ------------------
 3077|      4|            error = SNMPERR_USM_UNKNOWNENGINEID;
  ------------------
  |  |  265|      4|#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
  ------------------
 3078|      4|            goto err;
 3079|      4|        }
 3080|      4|    } else {
 3081|      0|        if (ENSURE_ENGINE_RECORD(secEngineID, *secEngineIDLen)
  ------------------
  |  |   88|      0|	( (set_enginetime(e, e_l, 0, 0, FALSE) == SNMPERR_SUCCESS)	\
  |  |  ------------------
  |  |  |  |  125|      0|#define FALSE 0
  |  |  ------------------
  |  |               	( (set_enginetime(e, e_l, 0, 0, FALSE) == SNMPERR_SUCCESS)	\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (88:4): [True: 0, False: 0]
  |  |  ------------------
  |  |   89|      0|		? SNMPERR_SUCCESS				\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |   90|      0|		: SNMPERR_GENERR )
  |  |  ------------------
  |  |  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  ------------------
  |  Branch (3081:13): [True: 0, False: 0]
  ------------------
 3082|      0|            != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3083|      0|            DEBUGMSGTL(("usm", "%s\n", "Couldn't ensure engine record."));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 3084|      0|            error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3085|      0|            goto err;
 3086|      0|        }
 3087|       |
 3088|      0|    }
 3089|       |
 3090|       |
 3091|       |    /*
 3092|       |     * Locate the User record.
 3093|       |     * If the user/engine ID is unknown, report this as an error.
 3094|       |     */
 3095|      0|    if (sess && sess->sessUser)
  ------------------
  |  Branch (3095:9): [True: 0, False: 0]
  |  Branch (3095:17): [True: 0, False: 0]
  ------------------
 3096|      0|        user = sess->sessUser;
 3097|      0|    else
 3098|      0|        user = usm_get_user_from_list(secEngineID, *secEngineIDLen,
 3099|      0|                                       secName, *secNameLen, userList,
 3100|      0|                                       (((sess && sess->isAuthoritative ==
  ------------------
  |  Branch (3100:43): [True: 0, False: 0]
  |  Branch (3100:51): [True: 0, False: 0]
  ------------------
 3101|      0|                                          SNMP_SESS_AUTHORITATIVE) ||
  ------------------
  |  |  158|      0|#define SNMP_SESS_AUTHORITATIVE    1    /* don't learn engineIDs */
  ------------------
 3102|      0|                                         (!sess)) ? 0 : 1));
  ------------------
  |  Branch (3102:42): [True: 0, False: 0]
  ------------------
 3103|       |
 3104|      0|    if (user == NULL) {
  ------------------
  |  Branch (3104:9): [True: 0, False: 0]
  ------------------
 3105|      0|        DEBUGMSGTL(("usm", "Unknown User(%s)\n", secName));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 3106|      0|        snmp_increment_statistic(STAT_USMSTATSUNKNOWNUSERNAMES);
  ------------------
  |  |  655|      0|#define   STAT_USMSTATSUNKNOWNUSERNAMES      5
  ------------------
 3107|      0|        error = SNMPERR_USM_UNKNOWNSECURITYNAME;
  ------------------
  |  |  260|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
 3108|      0|        goto err;
 3109|      0|    }
 3110|       |
 3111|       |    /* ensure the user is active */
 3112|      0|    if (user->userStatus != RS_ACTIVE) {
  ------------------
  |  |   35|      0|#define RS_ACTIVE	        1
  ------------------
  |  Branch (3112:9): [True: 0, False: 0]
  ------------------
 3113|      0|        DEBUGMSGTL(("usm", "Attempt to use an inactive user.\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]
  |  |  ------------------
  ------------------
 3114|      0|        error = SNMPERR_USM_UNKNOWNSECURITYNAME;
  ------------------
  |  |  260|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
 3115|      0|        goto err;
 3116|      0|    }
 3117|       |
 3118|       |    /*
 3119|       |     * Make sure the security level is appropriate.
 3120|       |     */
 3121|       |
 3122|      0|    rc = usm_check_secLevel(secLevel, user);
 3123|      0|    if (1 == rc) {
  ------------------
  |  Branch (3123:9): [True: 0, False: 0]
  ------------------
 3124|      0|        DEBUGMSGTL(("usm", "Unsupported Security Level (%d).\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]
  |  |  ------------------
  ------------------
 3125|      0|                    secLevel));
 3126|      0|        snmp_increment_statistic(STAT_USMSTATSUNSUPPORTEDSECLEVELS);
  ------------------
  |  |  653|      0|#define   STAT_USMSTATSUNSUPPORTEDSECLEVELS  3
  ------------------
 3127|      0|        error = SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL;
  ------------------
  |  |  261|      0|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
 3128|      0|        goto err;
 3129|      0|    } else if (rc != 0) {
  ------------------
  |  Branch (3129:16): [True: 0, False: 0]
  ------------------
 3130|      0|        DEBUGMSGTL(("usm", "Unknown issue.\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]
  |  |  ------------------
  ------------------
 3131|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3132|      0|        goto err;
 3133|      0|    }
 3134|       |
 3135|       |    /*
 3136|       |     * Check the authentication credentials of the message.
 3137|       |     */
 3138|      0|    if (secLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
  ------------------
  |  |  300|      0|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (3138:9): [True: 0, False: 0]
  ------------------
 3139|      0|        || secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3139:12): [True: 0, False: 0]
  ------------------
 3140|      0|        if (sc_check_keyed_hash(user->authProtocol, user->authProtocolLen,
  ------------------
  |  Branch (3140:13): [True: 0, False: 0]
  ------------------
 3141|      0|                                user->authKey, user->authKeyLen,
 3142|      0|                                wholeMsg, wholeMsgLen,
 3143|      0|                                signature, signature_length)
 3144|      0|            != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|      0|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
 3145|      0|            DEBUGMSGTL(("usm", "Verification failed.\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]
  |  |  ------------------
  ------------------
 3146|      0|            snmp_increment_statistic(STAT_USMSTATSWRONGDIGESTS);
  ------------------
  |  |  657|      0|#define   STAT_USMSTATSWRONGDIGESTS          7
  ------------------
 3147|      0|	    snmp_log(LOG_WARNING, "Authentication failed for %s\n",
 3148|      0|				user->name);
 3149|      0|            error = SNMPERR_USM_AUTHENTICATIONFAILURE;
  ------------------
  |  |  263|      0|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
 3150|      0|            goto err;
 3151|      0|        }
 3152|       |
 3153|      0|        DEBUGMSGTL(("usm", "Verification succeeded.\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]
  |  |  ------------------
  ------------------
 3154|      0|    }
 3155|       |
 3156|       |
 3157|       |    /*
 3158|       |     * Steps 10-11  user is already set - relocated before timeliness 
 3159|       |     * check in case it fails - still save user data for response.
 3160|       |     *
 3161|       |     * Cache the keys and protocol oids, per step 11 (s3.2).
 3162|       |     */
 3163|      0|    if (usm_set_usmStateReference_auth_protocol(*secStateRef,
  ------------------
  |  Branch (3163:9): [True: 0, False: 0]
  ------------------
 3164|      0|                                                user->authProtocol,
 3165|      0|                                                user->
 3166|      0|                                                authProtocolLen) == -1) {
 3167|      0|        DEBUGMSGTL(("usm", "%s\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]
  |  |  ------------------
  ------------------
 3168|      0|                    "Couldn't cache authentication protocol."));
 3169|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3170|      0|        goto err;
 3171|      0|    }
 3172|       |
 3173|      0|    if (usm_set_usmStateReference_auth_key(*secStateRef,
  ------------------
  |  Branch (3173:9): [True: 0, False: 0]
  ------------------
 3174|      0|                                           user->authKey,
 3175|      0|                                           user->authKeyLen) == -1) {
 3176|      0|        DEBUGMSGTL(("usm", "%s\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]
  |  |  ------------------
  ------------------
 3177|      0|                    "Couldn't cache authentication key."));
 3178|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3179|      0|        goto err;
 3180|      0|    }
 3181|       |
 3182|      0|    if (usm_set_usmStateReference_priv_protocol(*secStateRef,
  ------------------
  |  Branch (3182:9): [True: 0, False: 0]
  ------------------
 3183|      0|                                                user->privProtocol,
 3184|      0|                                                user->
 3185|      0|                                                privProtocolLen) == -1) {
 3186|      0|        DEBUGMSGTL(("usm", "%s\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]
  |  |  ------------------
  ------------------
 3187|      0|                    "Couldn't cache privacy protocol."));
 3188|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3189|      0|        goto err;
 3190|      0|    }
 3191|       |
 3192|      0|    if (usm_set_usmStateReference_priv_key(*secStateRef,
  ------------------
  |  Branch (3192:9): [True: 0, False: 0]
  ------------------
 3193|      0|                                           user->privKey,
 3194|      0|                                           user->privKeyLen) == -1) {
 3195|      0|        DEBUGMSGTL(("usm", "%s\n", "Couldn't cache privacy key."));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 3196|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3197|      0|        goto err;
 3198|      0|    }
 3199|       |
 3200|       |
 3201|       |    /*
 3202|       |     * Perform the timeliness/time manager functions.
 3203|       |     */
 3204|      0|    if (secLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
  ------------------
  |  |  300|      0|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (3204:9): [True: 0, False: 0]
  ------------------
 3205|      0|        || secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3205:12): [True: 0, False: 0]
  ------------------
 3206|      0|        if (usm_check_and_update_timeliness(secEngineID, *secEngineIDLen,
  ------------------
  |  Branch (3206:13): [True: 0, False: 0]
  ------------------
 3207|      0|                                            boots_uint, time_uint,
 3208|      0|                                            &error) == -1) {
 3209|      0|            goto err;
 3210|      0|        }
 3211|      0|    }
 3212|      0|#ifdef							LCD_TIME_SYNC_OPT
 3213|       |    /*
 3214|       |     * Cache the unauthenticated time to use in case we don't have
 3215|       |     * anything better - this guess will be no worse than (0,0)
 3216|       |     * that we normally use.
 3217|       |     */
 3218|      0|    else {
 3219|      0|        set_enginetime(secEngineID, *secEngineIDLen,
 3220|      0|                       boots_uint, time_uint, FALSE);
  ------------------
  |  |  125|      0|#define FALSE 0
  ------------------
 3221|      0|    }
 3222|      0|#endif                          /* LCD_TIME_SYNC_OPT */
 3223|       |
 3224|       |
 3225|       |    /*
 3226|       |     * If needed, decrypt the scoped PDU.
 3227|       |     */
 3228|      0|    if (secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3228:9): [True: 0, False: 0]
  ------------------
 3229|      0|        int priv_type = sc_get_privtype(user->privProtocol,
 3230|      0|                                        user->privProtocolLen);
 3231|      0|        remaining = wholeMsgLen - (data_ptr - wholeMsg);
 3232|       |
 3233|      0|        if ((value_ptr = asn_parse_sequence(data_ptr, &remaining,
  ------------------
  |  Branch (3233:13): [True: 0, False: 0]
  ------------------
 3234|      0|                                            &type_value,
 3235|      0|                                            (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                          (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3236|      0|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 3237|      0|                                            "encrypted sPDU")) == NULL) {
 3238|      0|            DEBUGMSGTL(("usm", "%s\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]
  |  |  ------------------
  ------------------
 3239|      0|                        "Failed while parsing encrypted sPDU."));
 3240|      0|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3241|      0|            usm_free_usmStateReference(*secStateRef);
 3242|      0|            *secStateRef = NULL;
 3243|      0|            error = SNMPERR_USM_PARSEERROR;
  ------------------
  |  |  264|      0|#define SNMPERR_USM_PARSEERROR			(-47)
  ------------------
 3244|      0|            goto err;
 3245|      0|        }
 3246|       |
 3247|      0|#ifndef NETSNMP_DISABLE_DES
 3248|      0|        if (USM_CREATE_USER_PRIV_DES == (priv_type & USM_PRIV_MASK_ALG)) {
  ------------------
  |  |  172|      0|#define USM_CREATE_USER_PRIV_DES            0x01
  ------------------
                      if (USM_CREATE_USER_PRIV_DES == (priv_type & USM_PRIV_MASK_ALG)) {
  ------------------
  |  |  166|      0|#define USM_PRIV_MASK_ALG                   0x0000ff
  ------------------
  |  Branch (3248:13): [True: 0, False: 0]
  ------------------
 3249|       |            /*
 3250|       |             * From RFC2574:
 3251|       |             * 
 3252|       |             * "Before decryption, the encrypted data length is verified.
 3253|       |             * If the length of the OCTET STRING to be decrypted is not
 3254|       |             * an integral multiple of 8 octets, the decryption process
 3255|       |             * is halted and an appropriate exception noted."  
 3256|       |             */
 3257|       |
 3258|      0|            if (remaining % 8 != 0) {
  ------------------
  |  Branch (3258:17): [True: 0, False: 0]
  ------------------
 3259|      0|                DEBUGMSGTL(("usm",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 3260|      0|                            "Ciphertext is %lu bytes, not an integer multiple of 8 (rem %lu)\n",
 3261|      0|                            (unsigned long)remaining, (unsigned long)remaining % 8));
 3262|      0|                snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  658|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3263|      0|                usm_free_usmStateReference(*secStateRef);
 3264|      0|                *secStateRef = NULL;
 3265|      0|                error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  267|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3266|      0|                goto err;
 3267|      0|            }
 3268|       |
 3269|      0|            end_of_overhead = value_ptr;
 3270|       |
 3271|      0|            if ( !user->privKey ) {
  ------------------
  |  Branch (3271:18): [True: 0, False: 0]
  ------------------
 3272|      0|                DEBUGMSGTL(("usm", "No privacy pass phrase for %s\n", user->secName));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 3273|      0|                snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  658|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3274|      0|                usm_free_usmStateReference(*secStateRef);
 3275|      0|                *secStateRef = NULL;
 3276|      0|                error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  267|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3277|      0|                goto err;
 3278|      0|            }
 3279|       |
 3280|       |            /*
 3281|       |             * XOR the salt with the last (iv_length) bytes
 3282|       |             * of the priv_key to obtain the IV.
 3283|       |             */
 3284|      0|            iv_length = BYTESIZE(USM_DES_SALT_LENGTH);
  ------------------
  |  |   55|      0|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 3285|      0|            for (i = 0; i < (int) iv_length; i++)
  ------------------
  |  Branch (3285:25): [True: 0, False: 0]
  ------------------
 3286|      0|                iv[i] = salt[i] ^ user->privKey[iv_length + i];
 3287|      0|        }
 3288|      0|#endif
 3289|      0|#ifdef HAVE_AES
 3290|      0|        if (USM_CREATE_USER_PRIV_AES == (priv_type & USM_PRIV_MASK_ALG)) {
  ------------------
  |  |  176|      0|#define USM_CREATE_USER_PRIV_AES            0x02
  ------------------
                      if (USM_CREATE_USER_PRIV_AES == (priv_type & USM_PRIV_MASK_ALG)) {
  ------------------
  |  |  166|      0|#define USM_PRIV_MASK_ALG                   0x0000ff
  ------------------
  |  Branch (3290:13): [True: 0, False: 0]
  ------------------
 3291|      0|            iv_length = BYTESIZE(USM_AES_SALT_LENGTH);
  ------------------
  |  |   55|      0|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 3292|      0|            net_boots = ntohl(boots_uint);
 3293|      0|            net_time = ntohl(time_uint);
 3294|      0|            memcpy(iv, &net_boots, 4);
 3295|      0|            memcpy(iv+4, &net_time, 4);
 3296|      0|            memcpy(iv+8, salt, salt_length);
 3297|      0|        }
 3298|      0|#endif
 3299|       |
 3300|       |#ifdef NETSNMP_ENABLE_TESTING_CODE
 3301|       |        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
 3302|       |            dump_chunk("usm/dump", "Cypher Text", value_ptr, remaining);
 3303|       |            dump_chunk("usm/dump", "salt + Encrypted form:",
 3304|       |                       salt, salt_length);
 3305|       |            dump_chunk("usm/dump", "IV + Encrypted form:", iv, iv_length);
 3306|       |        }
 3307|       |#endif
 3308|      0|        if (sc_decrypt(user->privProtocol, user->privProtocolLen,
  ------------------
  |  Branch (3308:13): [True: 0, False: 0]
  ------------------
 3309|      0|                       user->privKey, user->privKeyLen,
 3310|      0|                       iv, iv_length,
 3311|      0|                       value_ptr, remaining, *scopedPdu, scopedPduLen)
 3312|      0|            != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|      0|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
 3313|      0|            DEBUGMSGTL(("usm", "%s\n", "Failed decryption."));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 3314|      0|            snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  658|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3315|      0|            error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  267|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3316|      0|            goto err;
 3317|      0|        }
 3318|       |#ifdef NETSNMP_ENABLE_TESTING_CODE
 3319|       |        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
 3320|       |            dump_chunk("usm/dump", "Decrypted chunk:",
 3321|       |                       *scopedPdu, *scopedPduLen);
 3322|       |        }
 3323|       |#endif
 3324|      0|    }
 3325|       |    /*
 3326|       |     * sPDU is plaintext.
 3327|       |     */
 3328|      0|    else {
 3329|      0|        *scopedPdu = data_ptr;
 3330|      0|        *scopedPduLen = wholeMsgLen - (data_ptr - wholeMsg);
 3331|      0|        end_of_overhead = data_ptr;
 3332|       |
 3333|      0|    }                           /* endif -- PDU decryption */
 3334|       |
 3335|       |
 3336|       |    /*
 3337|       |     * Calculate the biggest sPDU for the response (i.e., whole - ovrhd).
 3338|       |     *
 3339|       |     * FIX  Correct? 
 3340|       |     */
 3341|      0|    *maxSizeResponse = maxMsgSize - (end_of_overhead - wholeMsg);
 3342|       |
 3343|       |
 3344|      0|    DEBUGMSGTL(("usm", "USM processing completed.\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]
  |  |  ------------------
  ------------------
 3345|       |
 3346|      0|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3347|       |
 3348|      6|err:
 3349|      6|    usm_free_usmStateReference(*secStateRef);
 3350|      6|    *secStateRef = NULL;
 3351|       |    netsnmp_assert(error != SNMPERR_SUCCESS);
  ------------------
  |  |   47|      6|#      define netsnmp_assert(x)  do { \
  |  |   48|      6|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 6, False: 0]
  |  |  ------------------
  |  |   49|      6|                 ; \
  |  |   50|      6|              else \
  |  |   51|      6|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      6|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 6]
  |  |  ------------------
  ------------------
 3352|      6|    return error;
 3353|      0|}                               /* end usm_process_in_msg() */
snmpusm.c:usm_malloc_usmStateReference:
  288|      6|{
  289|      6|    struct usmStateReference *retval;
  290|       |
  291|      6|    retval = calloc(1, sizeof(struct usmStateReference));
  292|      6|    if (retval)
  ------------------
  |  Branch (292:9): [True: 6, False: 0]
  ------------------
  293|      6|        retval->refcnt = 1;
  294|       |
  295|      6|    return retval;
  296|      6|}                               /* end usm_malloc_usmStateReference() */
snmpusm.c:usm_parse_security_parameters:
 2476|      6|{
 2477|      6|    u_char         *parse_ptr = secParams;
 2478|      6|    u_char         *value_ptr;
 2479|      6|    u_char         *next_ptr;
 2480|      6|    u_char          type_value;
 2481|       |
 2482|      6|    size_t          octet_string_length = remaining;
 2483|      6|    size_t          sequence_length;
 2484|      6|    size_t          remaining_bytes;
 2485|       |
 2486|      6|    long            boots_long;
 2487|      6|    long            time_long;
 2488|       |
 2489|      6|    u_int           origNameLen;
 2490|       |
 2491|       |
 2492|       |    /*
 2493|       |     * Eat the first octet header.
 2494|       |     */
 2495|      6|    if ((value_ptr = asn_parse_sequence(parse_ptr, &octet_string_length,
  ------------------
  |  Branch (2495:9): [True: 0, False: 6]
  ------------------
 2496|      6|                                        &type_value,
 2497|      6|                                        (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      6|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                      (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      6|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2498|      6|                                         ASN_OCTET_STR),
  ------------------
  |  |   78|      6|#define ASN_OCTET_STR	    0x04U
  ------------------
 2499|      6|                                        "usm first octet")) == NULL) {
 2500|       |        /*
 2501|       |         * RETURN parse error 
 2502|      0|         */ return -1;
 2503|      0|    }
 2504|       |
 2505|       |
 2506|       |    /*
 2507|       |     * Eat the sequence header.
 2508|       |     */
 2509|      6|    parse_ptr = value_ptr;
 2510|      6|    sequence_length = octet_string_length;
 2511|       |
 2512|      6|    if ((value_ptr = asn_parse_sequence(parse_ptr, &sequence_length,
  ------------------
  |  Branch (2512:9): [True: 0, False: 6]
  ------------------
 2513|      6|                                        &type_value,
 2514|      6|                                        (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|      6|#define ASN_SEQUENCE	    0x10U
  ------------------
                                                      (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      6|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2515|      6|                                        "usm sequence")) == NULL) {
 2516|       |        /*
 2517|       |         * RETURN parse error 
 2518|      0|         */ return -1;
 2519|      0|    }
 2520|       |
 2521|       |
 2522|       |    /*
 2523|       |     * Retrieve the engineID.
 2524|       |     */
 2525|      6|    parse_ptr = value_ptr;
 2526|      6|    remaining_bytes = sequence_length;
 2527|       |
 2528|      6|    DEBUGDUMPHEADER("recv", "msgAuthoritativeEngineID");
  ------------------
  |  |   79|      6|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      6|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 6]
  |  |  ------------------
  ------------------
 2529|      6|    if ((next_ptr
  ------------------
  |  Branch (2529:9): [True: 0, False: 6]
  ------------------
 2530|      6|         = asn_parse_string(parse_ptr, &remaining_bytes, &type_value,
 2531|      6|                            secEngineID, secEngineIDLen)) == NULL) {
 2532|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2533|       |        /*
 2534|       |         * RETURN parse error 
 2535|      0|         */ return -1;
 2536|      0|    }
 2537|      6|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      6|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      6|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 6]
  |  |  ------------------
  ------------------
 2538|       |
 2539|      6|    if (type_value !=
  ------------------
  |  Branch (2539:9): [True: 0, False: 6]
  ------------------
 2540|      6|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   90|      6|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   95|      6|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   78|      6|#define ASN_OCTET_STR	    0x04U
  ------------------
 2541|       |        /*
 2542|       |         * RETURN parse error 
 2543|      0|         */ return -1;
 2544|      0|    }
 2545|       |
 2546|       |
 2547|       |    /*
 2548|       |     * Retrieve the engine boots, notice switch in the way next_ptr and
 2549|       |     * remaining_bytes are used (to accommodate the asn code).
 2550|       |     */
 2551|      6|    DEBUGDUMPHEADER("recv", "msgAuthoritativeEngineBoots");
  ------------------
  |  |   79|      6|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      6|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 6]
  |  |  ------------------
  ------------------
 2552|      6|    if ((next_ptr = asn_parse_int(next_ptr, &remaining_bytes, &type_value,
  ------------------
  |  Branch (2552:9): [True: 0, False: 6]
  ------------------
 2553|      6|                                  &boots_long, sizeof(long))) == NULL) {
 2554|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2555|       |        /*
 2556|       |         * RETURN parse error 
 2557|      0|         */ return -1;
 2558|      0|    }
 2559|      6|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      6|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      6|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 6]
  |  |  ------------------
  ------------------
 2560|       |
 2561|      6|    if (type_value !=
  ------------------
  |  Branch (2561:9): [True: 0, False: 6]
  ------------------
 2562|      6|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   90|      6|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   95|      6|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   75|      6|#define ASN_INTEGER	    0x02U
  ------------------
 2563|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2564|       |        /*
 2565|       |         * RETURN parse error 
 2566|      0|         */ return -1;
 2567|      0|    }
 2568|       |
 2569|      6|    *boots_uint = (u_int) boots_long;
 2570|       |
 2571|       |
 2572|       |    /*
 2573|       |     * Retrieve the time value.
 2574|       |     */
 2575|      6|    DEBUGDUMPHEADER("recv", "msgAuthoritativeEngineTime");
  ------------------
  |  |   79|      6|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      6|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 6]
  |  |  ------------------
  ------------------
 2576|      6|    if ((next_ptr = asn_parse_int(next_ptr, &remaining_bytes, &type_value,
  ------------------
  |  Branch (2576:9): [True: 0, False: 6]
  ------------------
 2577|      6|                                  &time_long, sizeof(long))) == NULL) {
 2578|       |        /*
 2579|       |         * RETURN parse error 
 2580|      0|         */ return -1;
 2581|      0|    }
 2582|      6|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      6|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      6|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 6]
  |  |  ------------------
  ------------------
 2583|       |
 2584|      6|    if (type_value !=
  ------------------
  |  Branch (2584:9): [True: 0, False: 6]
  ------------------
 2585|      6|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   90|      6|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   95|      6|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   75|      6|#define ASN_INTEGER	    0x02U
  ------------------
 2586|       |        /*
 2587|       |         * RETURN parse error 
 2588|      0|         */ return -1;
 2589|      0|    }
 2590|       |
 2591|      6|    *time_uint = (u_int) time_long;
 2592|       |
 2593|      6|    if (*boots_uint > ENGINEBOOT_MAX || *time_uint > ENGINETIME_MAX) {
  ------------------
  |  |  183|     12|#define ENGINEBOOT_MAX	2147483647      /* ((2^31)-1) */
  ------------------
                  if (*boots_uint > ENGINEBOOT_MAX || *time_uint > ENGINETIME_MAX) {
  ------------------
  |  |  182|      6|#define ENGINETIME_MAX	2147483647      /* ((2^31)-1) */
  ------------------
  |  Branch (2593:9): [True: 0, False: 6]
  |  Branch (2593:41): [True: 1, False: 5]
  ------------------
 2594|      1|        return -1;
 2595|      1|    }
 2596|       |
 2597|       |    /*
 2598|       |     * Retrieve the secName.
 2599|       |     */
 2600|      5|    origNameLen = *secNameLen;
 2601|       |
 2602|       |
 2603|      5|    DEBUGDUMPHEADER("recv", "msgUserName");
  ------------------
  |  |   79|      5|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      5|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 5]
  |  |  ------------------
  ------------------
 2604|      5|    if ((next_ptr
  ------------------
  |  Branch (2604:9): [True: 0, False: 5]
  ------------------
 2605|      5|         = asn_parse_string(next_ptr, &remaining_bytes, &type_value,
 2606|      5|                            (u_char *) secName, secNameLen)) == NULL) {
 2607|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2608|       |        /*
 2609|       |         * RETURN parse error 
 2610|      0|         */ return -1;
 2611|      0|    }
 2612|      5|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      5|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      5|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 5]
  |  |  ------------------
  ------------------
 2613|       |
 2614|       |    /*
 2615|       |     * FIX -- doesn't this also indicate a buffer overrun?
 2616|       |     */
 2617|      5|    if (origNameLen < *secNameLen + 1) {
  ------------------
  |  Branch (2617:9): [True: 0, False: 5]
  ------------------
 2618|       |        /*
 2619|       |         * RETURN parse error, but it's really a parameter error 
 2620|       |         */
 2621|      0|        return -1;
 2622|      0|    }
 2623|       |
 2624|      5|    if (*secNameLen > 32) {
  ------------------
  |  Branch (2624:9): [True: 0, False: 5]
  ------------------
 2625|       |        /*
 2626|       |         * This is a USM-specific limitation over and above the above
 2627|       |         * limitation (which will probably default to the length of an
 2628|       |         * SnmpAdminString, i.e. 255).  See RFC 2574, sec. 2.4.  
 2629|       |         */
 2630|      0|        return -1;
 2631|      0|    }
 2632|       |
 2633|      5|    secName[*secNameLen] = '\0';
 2634|       |
 2635|      5|    if (type_value !=
  ------------------
  |  Branch (2635:9): [True: 0, False: 5]
  ------------------
 2636|      5|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   90|      5|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   95|      5|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   78|      5|#define ASN_OCTET_STR	    0x04U
  ------------------
 2637|       |        /*
 2638|       |         * RETURN parse error 
 2639|      0|         */ return -1;
 2640|      0|    }
 2641|       |
 2642|       |
 2643|       |    /*
 2644|       |     * Retrieve the signature and blank it if there.
 2645|       |     */
 2646|      5|    DEBUGDUMPHEADER("recv", "msgAuthenticationParameters");
  ------------------
  |  |   79|      5|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      5|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 5]
  |  |  ------------------
  ------------------
 2647|      5|    if ((next_ptr
  ------------------
  |  Branch (2647:9): [True: 1, False: 4]
  ------------------
 2648|      5|         = asn_parse_string(next_ptr, &remaining_bytes, &type_value,
 2649|      5|                            signature, signature_length)) == NULL) {
 2650|      1|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      1|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 1]
  |  |  ------------------
  ------------------
 2651|       |        /*
 2652|       |         * RETURN parse error 
 2653|      1|         */ return -1;
 2654|      1|    }
 2655|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2656|       |
 2657|      4|    if (type_value !=
  ------------------
  |  Branch (2657:9): [True: 0, False: 4]
  ------------------
 2658|      4|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   78|      4|#define ASN_OCTET_STR	    0x04U
  ------------------
 2659|       |        /*
 2660|       |         * RETURN parse error 
 2661|      0|         */ return -1;
 2662|      0|    }
 2663|       |
 2664|      4|    if (*signature_length != 0) {       /* Blanking for authentication step later */
  ------------------
  |  Branch (2664:9): [True: 4, False: 0]
  ------------------
 2665|      4|        memset(next_ptr - (u_long) * signature_length,
 2666|      4|               0, *signature_length);
 2667|      4|    }
 2668|       |
 2669|       |
 2670|       |    /*
 2671|       |     * Retrieve the salt.
 2672|       |     *
 2673|       |     * Note that the next ptr is where the data section starts.
 2674|       |     */
 2675|      4|    DEBUGDUMPHEADER("recv", "msgPrivacyParameters");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2676|      4|    if ((*data_ptr
  ------------------
  |  Branch (2676:9): [True: 0, False: 4]
  ------------------
 2677|      4|         = asn_parse_string(next_ptr, &remaining_bytes, &type_value,
 2678|      4|                            salt, salt_length)) == NULL) {
 2679|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2680|       |        /*
 2681|       |         * RETURN parse error 
 2682|      0|         */ return -2;
 2683|      0|    }
 2684|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2685|       |
 2686|      4|    if (type_value !=
  ------------------
  |  Branch (2686:9): [True: 0, False: 4]
  ------------------
 2687|      4|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   78|      4|#define ASN_OCTET_STR	    0x04U
  ------------------
 2688|       |        /*
 2689|       |         * RETURN parse error 
 2690|      0|         */ return -2;
 2691|      0|    }
 2692|       |
 2693|      4|    return 0;
 2694|       |
 2695|      4|}                               /* end usm_parse_security_parameters() */
snmpusm.c:usm_set_usmStateReference_name:
  356|      4|{
  357|       |    MAKE_ENTRY(ref, char, name, name_len, usr_name, usr_name_length);
  ------------------
  |  |  248|      4|#define MAKE_ENTRY(ref, type, item, len, field, field_len)      \
  |  |  249|      4|do {                                                            \
  |  |  250|      4|	if (ref == NULL)                                        \
  |  |  ------------------
  |  |  |  Branch (250:6): [True: 0, False: 4]
  |  |  ------------------
  |  |  251|      4|		return -1;                                      \
  |  |  252|      4|	if (ref->field != NULL)	{                               \
  |  |  ------------------
  |  |  |  Branch (252:6): [True: 0, False: 4]
  |  |  ------------------
  |  |  253|      0|		SNMP_ZERO(ref->field, ref->field_len);          \
  |  |  ------------------
  |  |  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  254|      0|		SNMP_FREE(ref->field);                          \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  255|      0|	}                                                       \
  |  |  256|      4|	ref->field_len = 0;                                     \
  |  |  257|      4|        if (len == 0 || item == NULL)                           \
  |  |  ------------------
  |  |  |  Branch (257:13): [True: 0, False: 4]
  |  |  |  Branch (257:25): [True: 0, False: 4]
  |  |  ------------------
  |  |  258|      4|		return 0;                                       \
  |  |  259|      4|	ref->field = netsnmp_memdup(item, len * sizeof(type));  \
  |  |  260|      4|        if (ref->field == NULL)                                 \
  |  |  ------------------
  |  |  |  Branch (260:13): [True: 0, False: 4]
  |  |  ------------------
  |  |  261|      4|		return -1;                                      \
  |  |  262|      4|                                                                \
  |  |  263|      4|	ref->field_len = len;                                   \
  |  |  264|      4|	return 0;                                               \
  |  |  265|      4|} while (0)
  |  |  ------------------
  |  |  |  Branch (265:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  358|      4|}
snmpusm.c:usm_set_usmStateReference_engine_id:
  364|      4|{
  365|       |    MAKE_ENTRY(ref, u_char, engine_id, engine_id_len,
  ------------------
  |  |  248|      4|#define MAKE_ENTRY(ref, type, item, len, field, field_len)      \
  |  |  249|      4|do {                                                            \
  |  |  250|      4|	if (ref == NULL)                                        \
  |  |  ------------------
  |  |  |  Branch (250:6): [True: 0, False: 4]
  |  |  ------------------
  |  |  251|      4|		return -1;                                      \
  |  |  252|      4|	if (ref->field != NULL)	{                               \
  |  |  ------------------
  |  |  |  Branch (252:6): [True: 0, False: 4]
  |  |  ------------------
  |  |  253|      0|		SNMP_ZERO(ref->field, ref->field_len);          \
  |  |  ------------------
  |  |  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  254|      0|		SNMP_FREE(ref->field);                          \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  255|      0|	}                                                       \
  |  |  256|      4|	ref->field_len = 0;                                     \
  |  |  257|      4|        if (len == 0 || item == NULL)                           \
  |  |  ------------------
  |  |  |  Branch (257:13): [True: 0, False: 4]
  |  |  |  Branch (257:25): [True: 0, False: 4]
  |  |  ------------------
  |  |  258|      4|		return 0;                                       \
  |  |  259|      4|	ref->field = netsnmp_memdup(item, len * sizeof(type));  \
  |  |  260|      4|        if (ref->field == NULL)                                 \
  |  |  ------------------
  |  |  |  Branch (260:13): [True: 0, False: 4]
  |  |  ------------------
  |  |  261|      4|		return -1;                                      \
  |  |  262|      4|                                                                \
  |  |  263|      4|	ref->field_len = len;                                   \
  |  |  264|      4|	return 0;                                               \
  |  |  265|      4|} while (0)
  |  |  ------------------
  |  |  |  Branch (265:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  366|      4|               usr_engine_id, usr_engine_id_length);
  367|      4|}
snmpusm.c:usm_set_usmStateReference_sec_level:
  406|      4|{
  407|      4|    if (ref == NULL)
  ------------------
  |  Branch (407:9): [True: 0, False: 4]
  ------------------
  408|      0|        return -1;
  409|      4|    ref->usr_sec_level = sec_level;
  410|      4|    return 0;
  411|      4|}
snmpusm.c:usm_clone:
  300|      3|{
  301|      3|    struct usmStateReference *ref = pdu->securityStateRef;
  302|      3|    struct usmStateReference **new_ref =
  303|      3|        (struct usmStateReference **)&new_pdu->securityStateRef;
  304|      3|    int ret = 0;
  305|       |
  306|      3|    if (!ref)
  ------------------
  |  Branch (306:9): [True: 3, False: 0]
  ------------------
  307|      3|        return ret;
  308|       |
  309|      0|    if (pdu->command == SNMP_MSG_TRAP2) {
  ------------------
  |  |  142|      0|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (309:9): [True: 0, False: 0]
  ------------------
  310|      0|        ret = usm_clone_usmStateReference(ref, new_ref);
  311|      0|    } else {
  312|      0|        netsnmp_assert(ref == *new_ref);
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  313|      0|        ref->refcnt++;
  314|      0|    }
  315|       |
  316|      0|    return ret;
  317|      3|}
snmpusm.c:usm_free_usmStateReference:
  321|     18|{
  322|     18|    struct usmStateReference *ref = old;
  323|       |
  324|     18|    if (!ref)
  ------------------
  |  Branch (324:9): [True: 12, False: 6]
  ------------------
  325|     12|        return;
  326|       |
  327|      6|    if (--ref->refcnt > 0)
  ------------------
  |  Branch (327:9): [True: 0, False: 6]
  ------------------
  328|      0|        return;
  329|       |
  330|      6|    SNMP_FREE(ref->usr_name);
  ------------------
  |  |   62|      6|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 4, False: 2]
  |  |  |  Branch (62:66): [Folded, False: 6]
  |  |  ------------------
  ------------------
  331|      6|    SNMP_FREE(ref->usr_engine_id);
  ------------------
  |  |   62|      6|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 4, False: 2]
  |  |  |  Branch (62:66): [Folded, False: 6]
  |  |  ------------------
  ------------------
  332|      6|    SNMP_FREE(ref->usr_auth_protocol);
  ------------------
  |  |   62|      6|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 6]
  |  |  |  Branch (62:66): [Folded, False: 6]
  |  |  ------------------
  ------------------
  333|      6|    SNMP_FREE(ref->usr_priv_protocol);
  ------------------
  |  |   62|      6|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 6]
  |  |  |  Branch (62:66): [Folded, False: 6]
  |  |  ------------------
  ------------------
  334|       |
  335|      6|    if (ref->usr_auth_key_length && ref->usr_auth_key) {
  ------------------
  |  Branch (335:9): [True: 0, False: 6]
  |  Branch (335:37): [True: 0, False: 0]
  ------------------
  336|      0|        SNMP_ZERO(ref->usr_auth_key, ref->usr_auth_key_length);
  ------------------
  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  337|      0|        SNMP_FREE(ref->usr_auth_key);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  338|      0|    }
  339|      6|    if (ref->usr_priv_key_length && ref->usr_priv_key) {
  ------------------
  |  Branch (339:9): [True: 0, False: 6]
  |  Branch (339:37): [True: 0, False: 0]
  ------------------
  340|      0|        SNMP_ZERO(ref->usr_priv_key, ref->usr_priv_key_length);
  ------------------
  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  341|      0|        SNMP_FREE(ref->usr_priv_key);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  342|      0|    }
  343|       |
  344|       |    SNMP_FREE(ref);
  ------------------
  |  |   62|      6|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 6, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 6]
  |  |  ------------------
  ------------------
  345|      6|}                               /* end usm_free_usmStateReference() */
snmpusm.c:usm_session_init:
 3460|     66|{
 3461|     66|    char *cp;
 3462|     66|    size_t i;
 3463|       |    
 3464|     66|    if (in_session->securityAuthProtoLen > 0) {
  ------------------
  |  Branch (3464:9): [True: 0, False: 66]
  ------------------
 3465|      0|        session->securityAuthProto =
 3466|      0|            snmp_duplicate_objid(in_session->securityAuthProto,
 3467|      0|                                 in_session->securityAuthProtoLen);
 3468|      0|        if (session->securityAuthProto == NULL) {
  ------------------
  |  Branch (3468:13): [True: 0, False: 0]
  ------------------
 3469|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3470|      0|            return SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3471|      0|        }
 3472|     66|    } else if (get_default_authtype(&i) != NULL) {
  ------------------
  |  Branch (3472:16): [True: 66, False: 0]
  ------------------
 3473|     66|        session->securityAuthProto =
 3474|     66|            snmp_duplicate_objid(get_default_authtype(NULL), i);
 3475|     66|        session->securityAuthProtoLen = i;
 3476|     66|    }
 3477|       |
 3478|     66|    if (in_session->securityPrivProtoLen > 0) {
  ------------------
  |  Branch (3478:9): [True: 0, False: 66]
  ------------------
 3479|      0|        session->securityPrivProto =
 3480|      0|            snmp_duplicate_objid(in_session->securityPrivProto,
 3481|      0|                                 in_session->securityPrivProtoLen);
 3482|      0|        if (session->securityPrivProto == NULL) {
  ------------------
  |  Branch (3482:13): [True: 0, False: 0]
  ------------------
 3483|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3484|      0|            return SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3485|      0|        }
 3486|     66|    } else if (get_default_privtype(&i) != NULL) {
  ------------------
  |  Branch (3486:16): [True: 66, False: 0]
  ------------------
 3487|     66|        session->securityPrivProto =
 3488|     66|            snmp_duplicate_objid(get_default_privtype(NULL), i);
 3489|     66|        session->securityPrivProtoLen = i;
 3490|     66|    }
 3491|       |
 3492|     66|    if ((in_session->securityAuthKeyLen <= 0) &&
  ------------------
  |  Branch (3492:9): [True: 66, False: 0]
  ------------------
 3493|     66|        ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3493:9): [True: 0, False: 66]
  ------------------
 3494|     66|				     NETSNMP_DS_LIB_AUTHMASTERKEY)))) {
  ------------------
  |  |  167|     66|#define NETSNMP_DS_LIB_AUTHMASTERKEY     16
  ------------------
 3495|      0|        size_t buflen = sizeof(session->securityAuthKey);
 3496|      0|        u_char *tmpp = session->securityAuthKey;
 3497|      0|        session->securityAuthKeyLen = 0;
 3498|       |        /* it will be a hex string */
 3499|      0|        if (!snmp_hex_to_binary(&tmpp, &buflen,
  ------------------
  |  Branch (3499:13): [True: 0, False: 0]
  ------------------
 3500|      0|                                &session->securityAuthKeyLen, 0, cp)) {
 3501|      0|            snmp_set_detail("error parsing authentication master key");
 3502|      0|            return SNMP_ERR_GENERR;
  ------------------
  |  |  217|      0|#define SNMP_ERR_GENERR	                (5)
  ------------------
 3503|      0|        }
 3504|     66|    } else if ((in_session->securityAuthKeyLen <= 0) &&
  ------------------
  |  Branch (3504:16): [True: 66, False: 0]
  ------------------
 3505|     66|               ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3505:17): [True: 0, False: 66]
  ------------------
 3506|     66|                                            NETSNMP_DS_LIB_AUTHPASSPHRASE)) ||
  ------------------
  |  |  154|     66|#define NETSNMP_DS_LIB_AUTHPASSPHRASE    3
  ------------------
 3507|     66|                (cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3507:17): [True: 0, False: 66]
  ------------------
 3508|     66|                                            NETSNMP_DS_LIB_PASSPHRASE)))) {
  ------------------
  |  |  153|     66|#define NETSNMP_DS_LIB_PASSPHRASE        2
  ------------------
 3509|      0|        session->securityAuthKeyLen = USM_AUTH_KU_LEN;
  ------------------
  |  |  257|      0|#define USM_AUTH_KU_LEN     64
  ------------------
 3510|      0|        if (generate_Ku(session->securityAuthProto,
  ------------------
  |  Branch (3510:13): [True: 0, False: 0]
  ------------------
 3511|      0|                        session->securityAuthProtoLen,
 3512|      0|                        (u_char *) cp, strlen(cp),
 3513|      0|                        session->securityAuthKey,
 3514|      0|                        &session->securityAuthKeyLen) != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3515|      0|            snmp_set_detail
 3516|      0|                ("Error generating a key (Ku) from the supplied authentication pass phrase.");
 3517|      0|            return SNMP_ERR_GENERR;
  ------------------
  |  |  217|      0|#define SNMP_ERR_GENERR	                (5)
  ------------------
 3518|      0|        }
 3519|      0|    }
 3520|       |
 3521|       |    
 3522|     66|    if ((in_session->securityPrivKeyLen <= 0) &&
  ------------------
  |  Branch (3522:9): [True: 66, False: 0]
  ------------------
 3523|     66|        ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3523:9): [True: 0, False: 66]
  ------------------
 3524|     66|				     NETSNMP_DS_LIB_PRIVMASTERKEY)))) {
  ------------------
  |  |  168|     66|#define NETSNMP_DS_LIB_PRIVMASTERKEY     17
  ------------------
 3525|      0|        size_t buflen = sizeof(session->securityPrivKey);
 3526|      0|        u_char *tmpp = session->securityPrivKey;
 3527|      0|        session->securityPrivKeyLen = 0;
 3528|       |        /* it will be a hex string */
 3529|      0|        if (!snmp_hex_to_binary(&tmpp, &buflen,
  ------------------
  |  Branch (3529:13): [True: 0, False: 0]
  ------------------
 3530|      0|                                &session->securityPrivKeyLen, 0, cp)) {
 3531|      0|            snmp_set_detail("error parsing encryption master key");
 3532|      0|            return SNMP_ERR_GENERR;
  ------------------
  |  |  217|      0|#define SNMP_ERR_GENERR	                (5)
  ------------------
 3533|      0|        }
 3534|     66|    } else if ((in_session->securityPrivKeyLen <= 0) &&
  ------------------
  |  Branch (3534:16): [True: 66, False: 0]
  ------------------
 3535|     66|               ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3535:17): [True: 0, False: 66]
  ------------------
 3536|     66|                                            NETSNMP_DS_LIB_PRIVPASSPHRASE)) ||
  ------------------
  |  |  155|     66|#define NETSNMP_DS_LIB_PRIVPASSPHRASE    4
  ------------------
 3537|     66|                (cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3537:17): [True: 0, False: 66]
  ------------------
 3538|     66|                                            NETSNMP_DS_LIB_PASSPHRASE)))) {
  ------------------
  |  |  153|     66|#define NETSNMP_DS_LIB_PASSPHRASE        2
  ------------------
 3539|      0|        session->securityPrivKeyLen = USM_PRIV_KU_LEN;
  ------------------
  |  |  258|      0|#define USM_PRIV_KU_LEN     64
  ------------------
 3540|      0|        if (generate_Ku(session->securityAuthProto,
  ------------------
  |  Branch (3540:13): [True: 0, False: 0]
  ------------------
 3541|      0|                        session->securityAuthProtoLen,
 3542|      0|                        (u_char *) cp, strlen(cp),
 3543|      0|                        session->securityPrivKey,
 3544|      0|                        &session->securityPrivKeyLen) != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3545|      0|            snmp_set_detail
 3546|      0|                ("Error generating a key (Ku) from the supplied privacy pass phrase.");
 3547|      0|            return SNMP_ERR_GENERR;
  ------------------
  |  |  217|      0|#define SNMP_ERR_GENERR	                (5)
  ------------------
 3548|      0|        }
 3549|      0|    }
 3550|       |
 3551|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3552|     66|}
snmpusm.c:usm_handle_report:
 3383|      6|{
 3384|       |    /*
 3385|       |     * handle reportable errors 
 3386|       |     */
 3387|       |
 3388|       |    /* this will get in our way */
 3389|      6|    usm_free_usmStateReference(pdu->securityStateRef);
 3390|      6|    pdu->securityStateRef = NULL;
 3391|       |
 3392|      6|    switch (result) {
  ------------------
  |  Branch (3392:13): [True: 4, False: 2]
  ------------------
 3393|      0|    case SNMPERR_USM_AUTHENTICATIONFAILURE:
  ------------------
  |  |  263|      0|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
  |  Branch (3393:5): [True: 0, False: 6]
  ------------------
 3394|      0|    {
 3395|      0|        int res = session->s_snmp_errno;
 3396|      0|        session->s_snmp_errno = result;
 3397|      0|        if (session->callback) {
  ------------------
  |  Branch (3397:13): [True: 0, False: 0]
  ------------------
 3398|      0|            session->callback(NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE,
  ------------------
  |  |  352|      0|#define NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE	1
  ------------------
 3399|      0|                              session, pdu->reqid, pdu,
 3400|      0|                              session->callback_magic);
 3401|      0|        }
 3402|      0|        session->s_snmp_errno = res;
 3403|      0|    }  
 3404|      0|    NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 3405|      4|    case SNMPERR_USM_UNKNOWNENGINEID:
  ------------------
  |  |  265|      4|#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
  ------------------
  |  Branch (3405:5): [True: 4, False: 2]
  ------------------
 3406|      4|    case SNMPERR_USM_UNKNOWNSECURITYNAME:
  ------------------
  |  |  260|      4|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (3406:5): [True: 0, False: 6]
  ------------------
 3407|      4|    case SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL:
  ------------------
  |  |  261|      4|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
  |  Branch (3407:5): [True: 0, False: 6]
  ------------------
 3408|      4|    case SNMPERR_USM_NOTINTIMEWINDOW:
  ------------------
  |  |  266|      4|#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
  ------------------
  |  Branch (3408:5): [True: 0, False: 6]
  ------------------
 3409|      4|    case SNMPERR_USM_DECRYPTIONERROR:
  ------------------
  |  |  267|      4|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
  |  Branch (3409:5): [True: 0, False: 6]
  ------------------
 3410|       |
 3411|      4|        if (SNMP_CMD_CONFIRMED(pdu->command) ||
  ------------------
  |  |  193|      8|#define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
  |  |  ------------------
  |  |  |  |  141|      8|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
  |  |  ------------------
  |  |  |  |  140|      8|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (193:32): [True: 0, False: 4]
  |  |  |  Branch (193:56): [True: 0, False: 4]
  |  |  ------------------
  |  |  194|      4|                               c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
  |  |  ------------------
  |  |  |  |  126|      8|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                              c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
  |  |  ------------------
  |  |  |  |  125|      8|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (194:32): [True: 0, False: 4]
  |  |  |  Branch (194:57): [True: 0, False: 4]
  |  |  ------------------
  |  |  195|      8|                               c == SNMP_MSG_SET )
  |  |  ------------------
  |  |  |  |  129|      8|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (195:32): [True: 0, False: 4]
  |  |  ------------------
  ------------------
 3412|      4|            (pdu->command == 0
  ------------------
  |  Branch (3412:14): [True: 3, False: 1]
  ------------------
 3413|      3|             && (pdu->flags & SNMP_MSG_FLAG_RPRT_BIT))) {
  ------------------
  |  |  305|      3|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3413:17): [True: 3, False: 0]
  ------------------
 3414|      3|            netsnmp_pdu    *pdu2;
 3415|      3|            int             flags = pdu->flags;
 3416|       |
 3417|      3|            pdu->flags |= UCD_MSG_FLAG_FORCE_PDU_COPY;
  ------------------
  |  |  313|      3|#define UCD_MSG_FLAG_FORCE_PDU_COPY          0x400
  ------------------
 3418|      3|            pdu2 = snmp_clone_pdu(pdu);
 3419|      3|            pdu->flags = pdu2->flags = flags;
 3420|      3|            snmpv3_make_report(pdu2, result);
 3421|      3|            if (0 == snmp_sess_send(slp, pdu2)) {
  ------------------
  |  Branch (3421:17): [True: 0, False: 3]
  ------------------
 3422|      0|                snmp_free_pdu(pdu2);
 3423|       |                /*
 3424|       |                 * TODO: indicate error 
 3425|       |                 */
 3426|      0|            }
 3427|      3|        }
 3428|      4|        break;
 3429|      6|    }       
 3430|      6|}
snmpusm.c:init_usm_post_config:
 5133|     66|{
 5134|     66|    size_t          salt_integer_len = sizeof(salt_integer);
 5135|     66|    uint64_t        current_time;
 5136|       |
 5137|     66|    if (sc_random((u_char *) & salt_integer, &salt_integer_len) !=
  ------------------
  |  Branch (5137:9): [True: 0, False: 66]
  ------------------
 5138|     66|        SNMPERR_SUCCESS) {
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5139|      0|        DEBUGMSGTL(("usm", "sc_random() failed: using time() as salt.\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]
  |  |  ------------------
  ------------------
 5140|      0|        current_time = time(NULL);
 5141|      0|        salt_integer = current_time;
 5142|      0|    }
 5143|       |
 5144|     66|#ifdef HAVE_AES
 5145|     66|    salt_integer_len = sizeof (salt_integer64_1);
 5146|     66|    if (sc_random((u_char *) & salt_integer64_1, &salt_integer_len) !=
  ------------------
  |  Branch (5146:9): [True: 0, False: 66]
  ------------------
 5147|     66|        SNMPERR_SUCCESS) {
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5148|      0|        DEBUGMSGTL(("usm", "sc_random() failed: using time() as aes1 salt.\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]
  |  |  ------------------
  ------------------
 5149|      0|        current_time = time(NULL);
 5150|      0|        salt_integer64_1 = current_time;
 5151|      0|    }
 5152|     66|    salt_integer_len = sizeof (salt_integer64_1);
 5153|     66|    if (sc_random((u_char *) & salt_integer64_2, &salt_integer_len) !=
  ------------------
  |  Branch (5153:9): [True: 0, False: 66]
  ------------------
 5154|     66|        SNMPERR_SUCCESS) {
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5155|      0|        DEBUGMSGTL(("usm", "sc_random() failed: using time() as aes2 salt.\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]
  |  |  ------------------
  ------------------
 5156|      0|        current_time = time(NULL);
 5157|      0|        salt_integer64_2 = current_time;
 5158|      0|    }
 5159|     66|#endif
 5160|       |
 5161|       |    // Free noNameUser before it is assigned
 5162|     66|    usm_free_user(noNameUser);
 5163|       |
 5164|     66|#ifndef NETSNMP_DISABLE_MD5
 5165|     66|    noNameUser = usm_create_initial_user("", usmHMACMD5AuthProtocol,
 5166|     66|                                         OID_LENGTH(usmHMACMD5AuthProtocol),
  ------------------
  |  |   64|     66|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     66|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 5167|     66|                                         SNMP_DEFAULT_PRIV_PROTO,
  ------------------
  |  |  133|     66|#define SNMP_DEFAULT_PRIV_PROTO     usmDESPrivProtocol
  ------------------
 5168|     66|                                         SNMP_DEFAULT_PRIV_PROTOLEN);
  ------------------
  |  |  137|     66|#define SNMP_DEFAULT_PRIV_PROTOLEN  OID_LENGTH(SNMP_DEFAULT_PRIV_PROTO)
  |  |  ------------------
  |  |  |  |   64|     66|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |  |  |   65|     66|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  |  |  ------------------
  ------------------
 5169|       |#else
 5170|       |    noNameUser = usm_create_initial_user("", usmHMACSHA1AuthProtocol,
 5171|       |                                         OID_LENGTH(usmHMACSHA1AuthProtocol),
 5172|       |                                         SNMP_DEFAULT_PRIV_PROTO,
 5173|       |                                         SNMP_DEFAULT_PRIV_PROTOLEN);
 5174|       |#endif
 5175|       |
 5176|     66|    if ( noNameUser ) {
  ------------------
  |  Branch (5176:10): [True: 66, False: 0]
  ------------------
 5177|     66|        SNMP_FREE(noNameUser->engineID);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 5178|     66|        noNameUser->engineIDLen = 0;
 5179|     66|    }
 5180|       |
 5181|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5182|     66|}                               /* end init_usm_post_config() */
snmpusm.c:usm_create_initial_user:
 4141|     66|{
 4142|     66|    struct usmUser *newUser = usm_create_user();
 4143|     66|    if (newUser == NULL)
  ------------------
  |  Branch (4143:9): [True: 0, False: 66]
  ------------------
 4144|      0|        return NULL;
 4145|       |
 4146|     66|    if ((newUser->name = strdup(name)) == NULL)
  ------------------
  |  Branch (4146:9): [True: 0, False: 66]
  ------------------
 4147|      0|        return usm_free_user(newUser);
 4148|       |
 4149|     66|    if ((newUser->secName = strdup(name)) == NULL)
  ------------------
  |  Branch (4149:9): [True: 0, False: 66]
  ------------------
 4150|      0|        return usm_free_user(newUser);
 4151|       |
 4152|     66|    if ((newUser->engineID =
  ------------------
  |  Branch (4152:9): [True: 0, False: 66]
  ------------------
 4153|     66|         snmpv3_generate_engineID(&newUser->engineIDLen)) == NULL)
 4154|      0|        return usm_free_user(newUser);
 4155|       |
 4156|     66|    if ((newUser->cloneFrom = (oid *) malloc(sizeof(oid) * 2)) == NULL)
  ------------------
  |  Branch (4156:9): [True: 0, False: 66]
  ------------------
 4157|      0|        return usm_free_user(newUser);
 4158|     66|    newUser->cloneFrom[0] = 0;
 4159|     66|    newUser->cloneFrom[1] = 0;
 4160|     66|    newUser->cloneFromLen = 2;
 4161|       |
 4162|     66|    SNMP_FREE(newUser->privProtocol);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 4163|     66|    if ((newUser->privProtocol = snmp_duplicate_objid(privProtocol,
  ------------------
  |  Branch (4163:9): [True: 0, False: 66]
  ------------------
 4164|     66|                                                      privProtocolLen)) ==
 4165|     66|        NULL) {
 4166|      0|        return usm_free_user(newUser);
 4167|      0|    }
 4168|     66|    newUser->privProtocolLen = privProtocolLen;
 4169|       |
 4170|     66|    SNMP_FREE(newUser->authProtocol);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 4171|     66|    if ((newUser->authProtocol = snmp_duplicate_objid(authProtocol,
  ------------------
  |  Branch (4171:9): [True: 0, False: 66]
  ------------------
 4172|     66|                                                      authProtocolLen)) ==
 4173|     66|        NULL) {
 4174|      0|        return usm_free_user(newUser);
 4175|      0|    }
 4176|     66|    newUser->authProtocolLen = authProtocolLen;
 4177|       |
 4178|     66|    newUser->userStatus = RS_ACTIVE;
  ------------------
  |  |   35|     66|#define RS_ACTIVE	        1
  ------------------
 4179|     66|    newUser->userStorageType = ST_READONLY;
  ------------------
  |  |   54|     66|#define ST_READONLY	5
  ------------------
 4180|       |
 4181|     66|    return newUser;
 4182|     66|}
snmpusm.c:deinit_usm_post_config:
 5187|     66|{
 5188|     66|    usm_free_user(noNameUser);
 5189|     66|    noNameUser = NULL;
 5190|       |
 5191|     66|    DEBUGMSGTL(("deinit_usm_post_config", "initial user removed\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 5192|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5193|     66|}                               /* end deinit_usm_post_config() */
snmpusm.c:free_enginetime_on_shutdown:
  274|     66|{
  275|     66|    u_char engineID[SNMP_MAX_ENG_SIZE];
  276|     66|    size_t engineID_len = sizeof(engineID);
  277|       |
  278|     66|    DEBUGMSGTL(("snmpv3", "free enginetime callback called\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  279|       |
  280|     66|    engineID_len = snmpv3_get_engineID(engineID, engineID_len);
  281|     66|    if (engineID_len > 0)
  ------------------
  |  Branch (281:9): [True: 0, False: 66]
  ------------------
  282|      0|	free_enginetime(engineID, engineID_len);
  283|     66|    return 0;
  284|     66|}
snmpusm.c:clear_user_list:
 3989|     66|{
 3990|     66|    struct usmUser *tmp = userList, *next = NULL;
 3991|       |
 3992|     66|    while (tmp != NULL) {
  ------------------
  |  Branch (3992:12): [True: 0, False: 66]
  ------------------
 3993|      0|	next = tmp->next;
 3994|      0|	usm_free_user(tmp);
 3995|      0|	tmp = next;
 3996|      0|    }
 3997|     66|    userList = NULL;
 3998|       |
 3999|     66|}

setup_engineID:
  471|     66|{
  472|     66|    int             enterpriseid = htonl(NETSNMP_ENTERPRISE_OID),
  473|     66|        netsnmpoid = htonl(NETSNMP_OID),
  474|     66|        localsetup = (eidp) ? 0 : 1;
  ------------------
  |  Branch (474:22): [True: 0, False: 66]
  ------------------
  475|       |
  476|       |    /*
  477|       |     * Use local engineID if *eidp == NULL.  
  478|       |     */
  479|     66|#ifdef HAVE_GETHOSTNAME
  480|     66|    u_char          buf[SNMP_MAXBUF_SMALL];
  481|     66|    struct hostent *hent = NULL;
  482|     66|#endif
  483|     66|    u_char         *bufp = NULL;
  484|     66|    size_t          len;
  485|     66|    int             localEngineIDType = engineIDType;
  486|     66|    int             tmpint;
  487|     66|    time_t          tmptime;
  488|       |
  489|     66|    engineIDIsSet = 1;
  490|       |
  491|     66|#ifdef HAVE_GETHOSTNAME
  492|     66|#ifdef AF_INET6
  493|       |    /*
  494|       |     * see if they selected IPV4 or IPV6 support 
  495|       |     */
  496|     66|    if ((ENGINEID_TYPE_IPV6 == localEngineIDType) ||
  ------------------
  |  |   20|     66|#define ENGINEID_TYPE_IPV6    2
  ------------------
  |  Branch (496:9): [True: 0, False: 66]
  ------------------
  497|     66|        (ENGINEID_TYPE_IPV4 == localEngineIDType)) {
  ------------------
  |  |   19|     66|#define ENGINEID_TYPE_IPV4    1
  ------------------
  |  Branch (497:9): [True: 0, False: 66]
  ------------------
  498|       |        /*
  499|       |         * get the host name and save the information 
  500|       |         */
  501|      0|        gethostname((char *) buf, sizeof(buf));
  502|      0|        hent = netsnmp_gethostbyname((char *) buf);
  503|      0|        if (hent && hent->h_addrtype == AF_INET6) {
  ------------------
  |  Branch (503:13): [True: 0, False: 0]
  |  Branch (503:21): [True: 0, False: 0]
  ------------------
  504|      0|            localEngineIDType = ENGINEID_TYPE_IPV6;
  ------------------
  |  |   20|      0|#define ENGINEID_TYPE_IPV6    2
  ------------------
  505|      0|        } else {
  506|       |            /*
  507|       |             * Not IPV6 so we go with default 
  508|       |             */
  509|      0|            localEngineIDType = ENGINEID_TYPE_IPV4;
  ------------------
  |  |   19|      0|#define ENGINEID_TYPE_IPV4    1
  ------------------
  510|      0|        }
  511|      0|    }
  512|       |#else
  513|       |    /*
  514|       |     * No IPV6 support.  Check if they selected IPV6 engineID type.
  515|       |     *  If so make it IPV4 instead 
  516|       |     */
  517|       |    if (ENGINEID_TYPE_IPV6 == localEngineIDType) {
  518|       |        localEngineIDType = ENGINEID_TYPE_IPV4;
  519|       |    }
  520|       |    if (ENGINEID_TYPE_IPV4 == localEngineIDType) {
  521|       |        /*
  522|       |         * get the host name and save the information 
  523|       |         */
  524|       |        gethostname((char *) buf, sizeof(buf));
  525|       |        hent = netsnmp_gethostbyname((char *) buf);
  526|       |    }
  527|       |#endif
  528|     66|#endif                          /* HAVE_GETHOSTNAME */
  529|       |
  530|       |    /*
  531|       |     * Determine if we have text and if so setup our localEngineIDType
  532|       |     * * appropriately.  
  533|       |     */
  534|     66|    if (NULL != text) {
  ------------------
  |  Branch (534:9): [True: 0, False: 66]
  ------------------
  535|      0|        engineIDType = localEngineIDType = ENGINEID_TYPE_TEXT;
  ------------------
  |  |   22|      0|#define ENGINEID_TYPE_TEXT    4
  ------------------
  536|      0|    }
  537|       |    /*
  538|       |     * Determine length of the engineID string. 
  539|       |     */
  540|     66|    len = 5;                    /* always have 5 leading bytes */
  541|     66|    switch (localEngineIDType) {
  542|      0|    case ENGINEID_TYPE_TEXT:
  ------------------
  |  |   22|      0|#define ENGINEID_TYPE_TEXT    4
  ------------------
  |  Branch (542:5): [True: 0, False: 66]
  ------------------
  543|      0|        if (NULL == text) {
  ------------------
  |  Branch (543:13): [True: 0, False: 0]
  ------------------
  544|      0|            snmp_log(LOG_ERR,
  545|      0|                     "Can't set up engineID of type text from an empty string.\n");
  546|      0|            return -1;
  547|      0|        }
  548|      0|        len += strlen(text);    /* 5 leading bytes+text. No NULL char */
  549|      0|        break;
  550|      0|#if defined(IFHWADDRLEN) && defined(SIOCGIFHWADDR)
  551|      0|    case ENGINEID_TYPE_MACADDR:        /* MAC address */
  ------------------
  |  |   21|      0|#define ENGINEID_TYPE_MACADDR 3
  ------------------
  |  Branch (551:5): [True: 0, False: 66]
  ------------------
  552|      0|        len += 6;               /* + 6 bytes for MAC address */
  553|      0|        break;
  554|      0|#endif
  555|      0|    case ENGINEID_TYPE_IPV4:   /* IPv4 */
  ------------------
  |  |   19|      0|#define ENGINEID_TYPE_IPV4    1
  ------------------
  |  Branch (555:5): [True: 0, False: 66]
  ------------------
  556|      0|        len += 4;               /* + 4 byte IPV4 address */
  557|      0|        break;
  558|      0|    case ENGINEID_TYPE_IPV6:   /* IPv6 */
  ------------------
  |  |   20|      0|#define ENGINEID_TYPE_IPV6    2
  ------------------
  |  Branch (558:5): [True: 0, False: 66]
  ------------------
  559|      0|        len += 16;              /* + 16 byte IPV6 address */
  560|      0|        break;
  561|     66|    case ENGINEID_TYPE_NETSNMP_RND:        /* Net-SNMP specific encoding */
  ------------------
  |  |   24|     66|#define ENGINEID_TYPE_NETSNMP_RND 128
  ------------------
  |  Branch (561:5): [True: 66, False: 0]
  ------------------
  562|     66|        if (engineID)           /* already setup, keep current value */
  ------------------
  |  Branch (562:13): [True: 0, False: 66]
  ------------------
  563|      0|            return engineIDLength;
  564|     66|        if (oldEngineID) {
  ------------------
  |  Branch (564:13): [True: 0, False: 66]
  ------------------
  565|      0|            len = oldEngineIDLength;
  566|     66|        } else {
  567|     66|            len += sizeof(int) + sizeof(time_t);
  568|     66|        }
  569|     66|        break;
  570|      0|    default:
  ------------------
  |  Branch (570:5): [True: 0, False: 66]
  ------------------
  571|      0|        snmp_log(LOG_ERR,
  572|      0|                 "Unknown EngineID type requested for setup (%d).  Using IPv4.\n",
  573|      0|                 localEngineIDType);
  574|      0|        localEngineIDType = ENGINEID_TYPE_IPV4; /* make into IPV4 */
  ------------------
  |  |   19|      0|#define ENGINEID_TYPE_IPV4    1
  ------------------
  575|      0|        len += 4;               /* + 4 byte IPv4 address */
  576|      0|        break;
  577|     66|    }                           /* switch */
  578|       |
  579|       |
  580|       |    /*
  581|       |     * Allocate memory and store enterprise ID.
  582|       |     */
  583|     66|    if (len == 0) {
  ------------------
  |  Branch (583:9): [True: 0, False: 66]
  ------------------
  584|      0|        snmp_log(LOG_ERR, "%s(): len == 0\n", __func__);
  585|      0|        return -1;
  586|      0|    }
  587|     66|    bufp = calloc(1, len);
  588|     66|    if (bufp == NULL) {
  ------------------
  |  Branch (588:9): [True: 0, False: 66]
  ------------------
  589|      0|        snmp_log_perror("setup_engineID() calloc()");
  590|      0|        return -1;
  591|      0|    }
  592|     66|    if (localEngineIDType == ENGINEID_TYPE_NETSNMP_RND)
  ------------------
  |  |   24|     66|#define ENGINEID_TYPE_NETSNMP_RND 128
  ------------------
  |  Branch (592:9): [True: 66, False: 0]
  ------------------
  593|       |        /*
  594|       |         * we must use the net-snmp enterprise id here, regardless 
  595|       |         */
  596|     66|        memcpy(bufp, &netsnmpoid, sizeof(netsnmpoid));    /* XXX Must be 4 bytes! */
  597|      0|    else
  598|      0|        memcpy(bufp, &enterpriseid, sizeof(enterpriseid));      /* XXX Must be 4 bytes! */
  599|       |
  600|     66|    bufp[0] |= 0x80;
  601|       |
  602|       |
  603|       |    /*
  604|       |     * Store the given text  -OR-   the first found IP address
  605|       |     *  -OR-  the MAC address  -OR-  random elements
  606|       |     * (the latter being the recommended default)
  607|       |     */
  608|     66|    switch (localEngineIDType) {
  609|     66|    case ENGINEID_TYPE_NETSNMP_RND:
  ------------------
  |  |   24|     66|#define ENGINEID_TYPE_NETSNMP_RND 128
  ------------------
  |  Branch (609:5): [True: 66, False: 0]
  ------------------
  610|     66|        if (oldEngineID) {
  ------------------
  |  Branch (610:13): [True: 0, False: 66]
  ------------------
  611|       |            /*
  612|       |             * keep our previous notion of the engineID 
  613|       |             */
  614|      0|            memcpy(bufp, oldEngineID, oldEngineIDLength);
  615|     66|        } else {
  616|       |            /*
  617|       |             * Here we've desigend our own ENGINEID that is not based on
  618|       |             * an address which may change and may even become conflicting
  619|       |             * in the future like most of the default v3 engineID types
  620|       |             * suffer from.
  621|       |             * 
  622|       |             * Ours is built from 2 fairly random elements: a random number and
  623|       |             * the current time in seconds.  This method suffers from boxes
  624|       |             * that may not have a correct clock setting and random number
  625|       |             * seed at startup, but few OSes should have that problem.
  626|       |             */
  627|     66|            bufp[4] = ENGINEID_TYPE_NETSNMP_RND;
  ------------------
  |  |   24|     66|#define ENGINEID_TYPE_NETSNMP_RND 128
  ------------------
  628|     66|            tmpint = netsnmp_random();
  629|     66|            memcpy(bufp + 5, &tmpint, sizeof(tmpint));
  630|     66|            tmptime = time(NULL);
  631|     66|            memcpy(bufp + 5 + sizeof(tmpint), &tmptime, sizeof(tmptime));
  632|     66|        }
  633|     66|        break;
  634|      0|    case ENGINEID_TYPE_TEXT:
  ------------------
  |  |   22|      0|#define ENGINEID_TYPE_TEXT    4
  ------------------
  |  Branch (634:5): [True: 0, False: 66]
  ------------------
  635|      0|        bufp[4] = ENGINEID_TYPE_TEXT;
  ------------------
  |  |   22|      0|#define ENGINEID_TYPE_TEXT    4
  ------------------
  636|      0|        memcpy((char *) bufp + 5, (text), strlen(text));
  637|      0|        break;
  638|      0|#ifdef HAVE_GETHOSTNAME
  639|      0|#ifdef AF_INET6
  640|      0|    case ENGINEID_TYPE_IPV6:
  ------------------
  |  |   20|      0|#define ENGINEID_TYPE_IPV6    2
  ------------------
  |  Branch (640:5): [True: 0, False: 66]
  ------------------
  641|      0|        bufp[4] = ENGINEID_TYPE_IPV6;
  ------------------
  |  |   20|      0|#define ENGINEID_TYPE_IPV6    2
  ------------------
  642|      0|        if (hent)
  ------------------
  |  Branch (642:13): [True: 0, False: 0]
  ------------------
  643|      0|            memcpy(bufp + 5, hent->h_addr_list[0], hent->h_length);
  644|      0|        break;
  645|      0|#endif
  646|      0|#endif
  647|      0|#if defined(IFHWADDRLEN) && defined(SIOCGIFHWADDR)
  648|      0|    case ENGINEID_TYPE_MACADDR:
  ------------------
  |  |   21|      0|#define ENGINEID_TYPE_MACADDR 3
  ------------------
  |  Branch (648:5): [True: 0, False: 66]
  ------------------
  649|      0|        {
  650|      0|            int             x;
  651|      0|            bufp[4] = ENGINEID_TYPE_MACADDR;
  ------------------
  |  |   21|      0|#define ENGINEID_TYPE_MACADDR 3
  ------------------
  652|       |            /*
  653|       |             * use default NIC if none provided 
  654|       |             */
  655|      0|            if (NULL == engineIDNic) {
  ------------------
  |  Branch (655:17): [True: 0, False: 0]
  ------------------
  656|      0|	      x = getHwAddress(DEFAULT_NIC, (char *)&bufp[5]);
  ------------------
  |  |   26|      0|#define	DEFAULT_NIC "eth0"
  ------------------
  657|      0|            } else {
  658|      0|	      x = getHwAddress((char *)engineIDNic, (char *)&bufp[5]);
  659|      0|            }
  660|      0|            if (0 != x)
  ------------------
  |  Branch (660:17): [True: 0, False: 0]
  ------------------
  661|       |                /*
  662|       |                 * function failed fill MAC address with zeros 
  663|       |                 */
  664|      0|            {
  665|      0|                memset(&bufp[5], 0, 6);
  666|      0|            }
  667|      0|        }
  668|      0|        break;
  669|      0|#endif
  670|      0|    case ENGINEID_TYPE_IPV4:
  ------------------
  |  |   19|      0|#define ENGINEID_TYPE_IPV4    1
  ------------------
  |  Branch (670:5): [True: 0, False: 66]
  ------------------
  671|      0|    default:
  ------------------
  |  Branch (671:5): [True: 0, False: 66]
  ------------------
  672|      0|        bufp[4] = ENGINEID_TYPE_IPV4;
  ------------------
  |  |   19|      0|#define ENGINEID_TYPE_IPV4    1
  ------------------
  673|      0|#ifdef HAVE_GETHOSTNAME
  674|      0|        if (hent && hent->h_addrtype == AF_INET) {
  ------------------
  |  Branch (674:13): [True: 0, False: 0]
  |  Branch (674:21): [True: 0, False: 0]
  ------------------
  675|      0|            memcpy(bufp + 5, hent->h_addr_list[0], hent->h_length);
  676|      0|        } else {                /* Unknown address type.  Default to 127.0.0.1. */
  677|       |
  678|      0|            bufp[5] = 127;
  679|      0|            bufp[6] = 0;
  680|      0|            bufp[7] = 0;
  681|      0|            bufp[8] = 1;
  682|      0|        }
  683|       |#else                           /* HAVE_GETHOSTNAME */
  684|       |        /*
  685|       |         * Unknown address type.  Default to 127.0.0.1. 
  686|       |         */
  687|       |        bufp[5] = 127;
  688|       |        bufp[6] = 0;
  689|       |        bufp[7] = 0;
  690|       |        bufp[8] = 1;
  691|       |#endif                          /* HAVE_GETHOSTNAME */
  692|      0|        break;
  693|     66|    }
  694|       |
  695|       |    /*
  696|       |     * Pass the string back to the calling environment, or use it for
  697|       |     * our local engineID.
  698|       |     */
  699|     66|    if (localsetup) {
  ------------------
  |  Branch (699:9): [True: 66, False: 0]
  ------------------
  700|     66|        SNMP_FREE(engineID);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  701|     66|        engineID = bufp;
  702|     66|        engineIDLength = len;
  703|       |
  704|     66|    } else {
  705|      0|        *eidp = bufp;
  706|      0|    }
  707|       |
  708|       |
  709|     66|    return len;
  710|       |
  711|     66|}                               /* end setup_engineID() */
free_engineID:
  716|     66|{
  717|     66|    SNMP_FREE(engineID);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  718|     66|    SNMP_FREE(engineIDNic);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  719|       |    SNMP_FREE(oldEngineID);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  720|     66|    engineIDIsSet = 0;
  721|     66|    return 0;
  722|     66|}
init_snmpv3:
  993|     66|{
  994|     66|    netsnmp_get_monotonic_clock(&snmpv3starttime);
  995|       |
  996|     66|    if (!type)
  ------------------
  |  Branch (996:9): [True: 0, False: 66]
  ------------------
  997|      0|        type = "__snmpapp__";
  998|       |
  999|       |    /*
 1000|       |     * we need to be called back later 
 1001|       |     */
 1002|     66|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1003|     66|                           SNMP_CALLBACK_POST_READ_CONFIG,
  ------------------
  |  |   24|     66|#define SNMP_CALLBACK_POST_READ_CONFIG	        0
  ------------------
 1004|     66|                           init_snmpv3_post_config, NULL);
 1005|       |
 1006|     66|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1007|     66|                           SNMP_CALLBACK_POST_PREMIB_READ_CONFIG,
  ------------------
  |  |   27|     66|#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG	3
  ------------------
 1008|     66|                           init_snmpv3_post_premib_config, NULL);
 1009|       |    /*
 1010|       |     * we need to be called back later 
 1011|       |     */
 1012|     66|    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
                  snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
  ------------------
  |  |   25|     66|#define SNMP_CALLBACK_STORE_DATA	        1
  ------------------
 1013|     66|                           snmpv3_store, (void *) strdup(type));
 1014|       |
 1015|       |    /*
 1016|       |     * initialize submodules 
 1017|       |     */
 1018|       |    /*
 1019|       |     * NOTE: this must be after the callbacks are registered above,
 1020|       |     * since they need to be called before the USM callbacks. 
 1021|       |     */
 1022|     66|    init_secmod();
 1023|       |
 1024|       |    /*
 1025|       |     * register all our configuration handlers (ack, there's a lot) 
 1026|       |     */
 1027|       |
 1028|       |    /*
 1029|       |     * handle engineID setup before everything else which may depend on it 
 1030|       |     */
 1031|     66|    register_prenetsnmp_mib_handler(type, "engineID", engineID_conf, NULL,
 1032|     66|                                    "string");
 1033|     66|    register_prenetsnmp_mib_handler(type, "oldEngineID", oldengineID_conf,
 1034|     66|                                    NULL, NULL);
 1035|     66|    register_prenetsnmp_mib_handler(type, "exactEngineID", exactEngineID_conf,
 1036|     66|                                    NULL, NULL);
 1037|     66|    register_prenetsnmp_mib_handler(type, "engineIDType",
 1038|     66|                                    engineIDType_conf, NULL, "num");
 1039|     66|    register_prenetsnmp_mib_handler(type, "engineIDNic", engineIDNic_conf,
 1040|     66|                                    NULL, "string");
 1041|     66|    register_config_handler(type, "engineBoots", engineBoots_conf, NULL,
 1042|     66|                            NULL);
 1043|       |
 1044|       |    /*
 1045|       |     * default store config entries 
 1046|       |     */
 1047|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defSecurityName",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
 1048|     66|			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECNAME);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECNAME);
  ------------------
  |  |  151|     66|#define NETSNMP_DS_LIB_SECNAME           0
  ------------------
 1049|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defContext", 
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
 1050|     66|			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CONTEXT);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CONTEXT);
  ------------------
  |  |  152|     66|#define NETSNMP_DS_LIB_CONTEXT           1
  ------------------
 1051|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defPassphrase",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
 1052|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1053|     66|                               NETSNMP_DS_LIB_PASSPHRASE);
  ------------------
  |  |  153|     66|#define NETSNMP_DS_LIB_PASSPHRASE        2
  ------------------
 1054|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defAuthPassphrase",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
 1055|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1056|     66|                               NETSNMP_DS_LIB_AUTHPASSPHRASE);
  ------------------
  |  |  154|     66|#define NETSNMP_DS_LIB_AUTHPASSPHRASE    3
  ------------------
 1057|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defPrivPassphrase",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
 1058|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1059|     66|                               NETSNMP_DS_LIB_PRIVPASSPHRASE);
  ------------------
  |  |  155|     66|#define NETSNMP_DS_LIB_PRIVPASSPHRASE    4
  ------------------
 1060|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defAuthMasterKey",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
 1061|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1062|     66|                               NETSNMP_DS_LIB_AUTHMASTERKEY);
  ------------------
  |  |  167|     66|#define NETSNMP_DS_LIB_AUTHMASTERKEY     16
  ------------------
 1063|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defPrivMasterKey",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
 1064|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1065|     66|                               NETSNMP_DS_LIB_PRIVMASTERKEY);
  ------------------
  |  |  168|     66|#define NETSNMP_DS_LIB_PRIVMASTERKEY     17
  ------------------
 1066|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defAuthLocalizedKey",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
 1067|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1068|     66|                               NETSNMP_DS_LIB_AUTHLOCALIZEDKEY);
  ------------------
  |  |  169|     66|#define NETSNMP_DS_LIB_AUTHLOCALIZEDKEY  18
  ------------------
 1069|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defPrivLocalizedKey",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
 1070|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1071|     66|                               NETSNMP_DS_LIB_PRIVLOCALIZEDKEY);
  ------------------
  |  |  170|     66|#define NETSNMP_DS_LIB_PRIVLOCALIZEDKEY  19
  ------------------
 1072|     66|    register_config_handler("snmp", "defVersion", version_conf, NULL,
 1073|     66|                            "1|2c|3");
 1074|       |
 1075|     66|    register_config_handler("snmp", "defSecurityLevel",
 1076|       |                            snmpv3_secLevel_conf, NULL,
 1077|     66|                            "noAuthNoPriv|authNoPriv|authPriv");
 1078|     66|}
init_snmpv3_post_config:
 1088|     66|{
 1089|       |
 1090|     66|    size_t          engineIDLen;
 1091|     66|    u_char         *c_engineID;
 1092|     66|    u_long          localEngineTime;
 1093|     66|    u_long          localEngineBoots;
 1094|       |
 1095|     66|    c_engineID = snmpv3_generate_engineID(&engineIDLen);
 1096|       |
 1097|     66|    if (!c_engineID || engineIDLen == 0) {
  ------------------
  |  Branch (1097:9): [True: 0, False: 66]
  |  Branch (1097:24): [True: 0, False: 66]
  ------------------
 1098|       |        /*
 1099|       |         * Something went wrong - help! 
 1100|       |         */
 1101|      0|        SNMP_FREE(c_engineID);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1102|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1103|      0|    }
 1104|       |
 1105|       |    /*
 1106|       |     * if our engineID has changed at all, the boots record must be set to 1 
 1107|       |     */
 1108|     66|    if (engineIDLen != oldEngineIDLength ||
  ------------------
  |  Branch (1108:9): [True: 66, False: 0]
  ------------------
 1109|      0|        oldEngineID == NULL || c_engineID == NULL ||
  ------------------
  |  Branch (1109:9): [True: 0, False: 0]
  |  Branch (1109:32): [True: 0, False: 0]
  ------------------
 1110|     66|        memcmp(oldEngineID, c_engineID, engineIDLen) != 0) {
  ------------------
  |  Branch (1110:9): [True: 0, False: 0]
  ------------------
 1111|     66|        engineBoots = 1;
 1112|     66|    }
 1113|       |
 1114|     66|#ifdef NETSNMP_SECMOD_USM
 1115|       |    /*
 1116|       |     * for USM set our local engineTime in the LCD timing cache 
 1117|       |     */
 1118|     66|    localEngineTime = snmpv3_local_snmpEngineTime();
 1119|     66|    localEngineBoots = snmpv3_local_snmpEngineBoots();
 1120|     66|    set_enginetime(c_engineID, engineIDLen,
 1121|     66|                   localEngineBoots,
 1122|     66|                   localEngineTime, TRUE);
  ------------------
  |  |  128|     66|#define TRUE  1
  ------------------
 1123|     66|#endif /* NETSNMP_SECMOD_USM */
 1124|       |
 1125|     66|    SNMP_FREE(c_engineID);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 1126|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1127|     66|}
init_snmpv3_post_premib_config:
 1132|     66|{
 1133|     66|    if (!engineIDIsSet)
  ------------------
  |  Branch (1133:9): [True: 66, False: 0]
  ------------------
 1134|     66|        setup_engineID(NULL, NULL);
 1135|       |
 1136|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1137|     66|}
snmpv3_store:
 1147|     66|{
 1148|     66|    char            line[SNMP_MAXBUF_SMALL];
 1149|     66|    u_char          c_engineID[SNMP_MAXBUF_SMALL];
 1150|     66|    int             engineIDLen;
 1151|     66|    const char     *type = (const char *) clientarg;
 1152|       |
 1153|     66|    if (type == NULL)           /* should never happen, since the arg is ours */
  ------------------
  |  Branch (1153:9): [True: 0, False: 66]
  ------------------
 1154|      0|        type = "unknown";
 1155|       |
 1156|     66|    sprintf(line, "engineBoots %ld", engineBoots);
 1157|     66|    read_config_store(type, line);
 1158|       |
 1159|     66|    engineIDLen = snmpv3_get_engineID(c_engineID, SNMP_MAXBUF_SMALL);
  ------------------
  |  |   45|     66|#define SNMP_MAXBUF_SMALL	512
  ------------------
 1160|       |
 1161|     66|    if (engineIDLen) {
  ------------------
  |  Branch (1161:9): [True: 66, False: 0]
  ------------------
 1162|       |        /*
 1163|       |         * store the engineID used for this run 
 1164|       |         */
 1165|     66|        sprintf(line, "oldEngineID ");
 1166|     66|        read_config_save_octet_string(line + strlen(line), c_engineID,
 1167|     66|                                      engineIDLen);
 1168|     66|        read_config_store(type, line);
 1169|     66|    }
 1170|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1171|     66|}                               /* snmpv3_store() */
snmpv3_local_snmpEngineBoots:
 1175|     66|{
 1176|     66|    return engineBoots;
 1177|     66|}
snmpv3_get_engineID:
 1197|    270|{
 1198|       |    /*
 1199|       |     * Sanity check.
 1200|       |     */
 1201|    270|    if (!buf || (buflen < engineIDLength)) {
  ------------------
  |  Branch (1201:9): [True: 0, False: 270]
  |  Branch (1201:17): [True: 0, False: 270]
  ------------------
 1202|      0|        return 0;
 1203|      0|    }
 1204|    270|    if (!engineID) {
  ------------------
  |  Branch (1204:9): [True: 66, False: 204]
  ------------------
 1205|     66|        return 0;
 1206|     66|    }
 1207|       |
 1208|    204|    memcpy(buf, engineID, engineIDLength);
 1209|    204|    return engineIDLength;
 1210|       |
 1211|    270|}                               /* end snmpv3_get_engineID() */
snmpv3_generate_engineID:
 1267|    138|{
 1268|    138|    u_char         *newID;
 1269|    138|    newID = (u_char *) malloc(engineIDLength);
 1270|       |
 1271|    138|    if (newID) {
  ------------------
  |  Branch (1271:9): [True: 138, False: 0]
  ------------------
 1272|    138|        *length = snmpv3_get_engineID(newID, engineIDLength);
 1273|    138|        if (*length == 0) {
  ------------------
  |  Branch (1273:13): [True: 0, False: 138]
  ------------------
 1274|      0|            SNMP_FREE(newID);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1275|      0|            newID = NULL;
 1276|      0|        }
 1277|    138|    }
 1278|    138|    return newID;
 1279|       |
 1280|    138|}                               /* end snmpv3_generate_engineID() */
snmpv3_local_snmpEngineTime:
 1294|    135|{
 1295|       |#ifdef NETSNMP_FEATURE_CHECKING
 1296|       |    netsnmp_feature_require(calculate_sectime_diff)
 1297|       |#endif /* NETSNMP_FEATURE_CHECKING */
 1298|       |
 1299|    135|    static uint32_t last_engineTime;
 1300|    135|    struct timeval  now;
 1301|    135|    uint32_t engineTime;
 1302|       |
 1303|    135|    netsnmp_get_monotonic_clock(&now);
 1304|    135|    engineTime = calculate_sectime_diff(&now, &snmpv3starttime) & 0x7fffffffL;
 1305|    135|    if (engineTime < last_engineTime)
  ------------------
  |  Branch (1305:9): [True: 0, False: 135]
  ------------------
 1306|      0|        engineBoots++;
 1307|    135|    last_engineTime = engineTime;
 1308|    135|    return engineTime;
 1309|    135|}

strlcpy:
   26|    266|{ 
   27|    266|	size_t src_len = strlen(src); 
   28|    266|	size_t new_len; 
   29|       |
   30|    266|	if (len == 0) {
  ------------------
  |  Branch (30:6): [True: 0, False: 266]
  ------------------
   31|      0|		return (src_len);
   32|      0|	}
   33|       |
   34|    266|        if (src_len >= len) {
  ------------------
  |  Branch (34:13): [True: 0, False: 266]
  ------------------
   35|      0|		new_len = len - 1;
   36|    266|	} else {
   37|    266|                new_len = src_len;
   38|    266|	}
   39|       |
   40|    266|        memcpy(dest, src, new_len); 
   41|    266|	dest[new_len] = '\0'; 
   42|    266|	return (src_len); 
   43|    266|}

netsnmp_gethostbyname_v4:
  773|     66|{
  774|     66|#ifdef HAVE_GETADDRINFO
  775|     66|    struct addrinfo *addrs = NULL;
  776|     66|    struct addrinfo hint;
  777|     66|    int             err;
  778|       |
  779|     66|    memset(&hint, 0, sizeof hint);
  780|     66|    hint.ai_flags = 0;
  781|     66|    hint.ai_family = PF_INET;
  782|     66|    hint.ai_socktype = SOCK_DGRAM;
  783|     66|    hint.ai_protocol = 0;
  784|       |
  785|     66|    err = netsnmp_getaddrinfo(name, NULL, &hint, &addrs);
  786|     66|    if (err != 0) {
  ------------------
  |  Branch (786:9): [True: 0, False: 66]
  ------------------
  787|      0|        return -1;
  788|      0|    }
  789|       |
  790|     66|    if (addrs != NULL) {
  ------------------
  |  Branch (790:9): [True: 66, False: 0]
  ------------------
  791|     66|        memcpy(addr_out,
  792|     66|               &((struct sockaddr_in *) addrs->ai_addr)->sin_addr,
  793|     66|               sizeof(in_addr_t));
  794|     66|        freeaddrinfo(addrs);
  795|     66|    } else {
  796|      0|        DEBUGMSGTL(("get_thisaddr",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  797|      0|                    "Failed to resolve IPv4 hostname\n"));
  798|      0|    }
  799|     66|    return 0;
  800|       |
  801|       |#elif defined(HAVE_GETHOSTBYNAME)
  802|       |    struct hostent *hp = NULL;
  803|       |
  804|       |    hp = netsnmp_gethostbyname(name);
  805|       |    if (hp == NULL) {
  806|       |        DEBUGMSGTL(("get_thisaddr",
  807|       |                    "hostname (couldn't resolve)\n"));
  808|       |        return -1;
  809|       |    } else if (hp->h_addrtype != AF_INET) {
  810|       |        DEBUGMSGTL(("get_thisaddr",
  811|       |                    "hostname (not AF_INET!)\n"));
  812|       |        return -1;
  813|       |    } else {
  814|       |        DEBUGMSGTL(("get_thisaddr",
  815|       |                    "hostname (resolved okay)\n"));
  816|       |        memcpy(addr_out, hp->h_addr, sizeof(in_addr_t));
  817|       |    }
  818|       |    return 0;
  819|       |
  820|       |#elif defined(HAVE_GETIPNODEBYNAME)
  821|       |    struct hostent *hp = NULL;
  822|       |    int             err;
  823|       |
  824|       |    hp = getipnodebyname(peername, AF_INET, 0, &err);
  825|       |    if (hp == NULL) {
  826|       |        DEBUGMSGTL(("get_thisaddr",
  827|       |                    "hostname (couldn't resolve = %d)\n", err));
  828|       |        return -1;
  829|       |    }
  830|       |    DEBUGMSGTL(("get_thisaddr",
  831|       |                "hostname (resolved okay)\n"));
  832|       |    memcpy(addr_out, hp->h_addr, sizeof(in_addr_t));
  833|       |    return 0;
  834|       |
  835|       |#else /* HAVE_GETIPNODEBYNAME */
  836|       |    return -1;
  837|       |#endif
  838|     66|}
netsnmp_getaddrinfo:
  843|     66|{
  844|     66|#ifdef HAVE_GETADDRINFO
  845|     66|    struct addrinfo *addrs = NULL;
  846|     66|    struct addrinfo hint;
  847|     66|    int             err;
  848|       |#ifdef DNSSEC_LOCAL_VALIDATION
  849|       |    val_status_t    val_status;
  850|       |#endif
  851|       |
  852|     66|    DEBUGMSGTL(("dns:getaddrinfo", "looking up "));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  853|     66|    if (name)
  ------------------
  |  Branch (853:9): [True: 66, False: 0]
  ------------------
  854|     66|        DEBUGMSG(("dns:getaddrinfo", "\"%s\"", name));
  ------------------
  |  |   61|     66|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 66]
  |  |  ------------------
  ------------------
  855|      0|    else
  856|      0|        DEBUGMSG(("dns:getaddrinfo", "<NULL>"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  857|       |
  858|     66|    if (service)
  ------------------
  |  Branch (858:9): [True: 0, False: 66]
  ------------------
  859|      0|	DEBUGMSG(("dns:getaddrinfo", ":\"%s\"", service));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  860|       |
  861|     66|    if (hints)
  ------------------
  |  Branch (861:9): [True: 66, False: 0]
  ------------------
  862|     66|	DEBUGMSG(("dns:getaddrinfo",
  ------------------
  |  |   61|     66|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:56): [True: 0, False: 0]
  |  |  |  Branch (61:56): [True: 0, False: 0]
  |  |  |  Branch (61:56): [True: 0, False: 0]
  |  |  |  Branch (61:67): [Folded, False: 66]
  |  |  ------------------
  ------------------
  863|     66|                  " with hints ({.ai_flags = %#x, .ai_family = %s})",
  864|     66|                  hints->ai_flags, hints->ai_family == 0 ? "0" :
  865|     66|                  hints->ai_family == AF_INET ? "AF_INET" :
  866|     66|                  hints->ai_family == AF_INET6 ? "AF_INET6" : "?"));
  867|      0|    else
  868|      0|	DEBUGMSG(("dns:getaddrinfo", " with no hint"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  869|       |
  870|     66|    DEBUGMSG(("dns:getaddrinfo", "\n"));
  ------------------
  |  |   61|     66|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 66]
  |  |  ------------------
  ------------------
  871|       |
  872|     66|    if (NULL == hints) {
  ------------------
  |  Branch (872:9): [True: 0, False: 66]
  ------------------
  873|      0|        memset(&hint, 0, sizeof hint);
  874|      0|        hint.ai_flags = 0;
  875|      0|        hint.ai_family = PF_INET;
  876|      0|        hint.ai_socktype = SOCK_DGRAM;
  877|      0|        hint.ai_protocol = 0;
  878|      0|        hints = &hint;
  879|     66|    } else {
  880|     66|        memcpy(&hint, hints, sizeof hint);
  881|     66|    }
  882|       |
  883|     66|#ifndef DNSSEC_LOCAL_VALIDATION
  884|     66|    err = getaddrinfo(name, NULL, &hint, &addrs);
  885|       |#else /* DNSSEC_LOCAL_VALIDATION */
  886|       |    err = val_getaddrinfo(netsnmp_validator_context(), name, NULL, &hint,
  887|       |                          &addrs, &val_status);
  888|       |    DEBUGMSGTL(("dns:sec:val", "err %d, val_status %d / %s; trusted: %d\n",
  889|       |                err, val_status, p_val_status(val_status),
  890|       |                val_istrusted(val_status)));
  891|       |    if (! val_istrusted(val_status)) {
  892|       |        int rc;
  893|       |        if ((err != 0) && VAL_GETADDRINFO_HAS_STATUS(err)) {
  894|       |            snmp_log(LOG_WARNING,
  895|       |                     "WARNING: UNTRUSTED error in DNS resolution for %s!\n",
  896|       |                     name);
  897|       |            rc = EAI_FAIL;
  898|       |        } else {
  899|       |            snmp_log(LOG_WARNING,
  900|       |                     "The authenticity of DNS response is not trusted (%s)\n",
  901|       |                     p_val_status(val_status));
  902|       |            rc = EAI_NONAME;
  903|       |        }
  904|       |        /** continue anyways if DNSSEC_WARN_ONLY is set */
  905|       |        if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
  906|       |                                    NETSNMP_DS_LIB_DNSSEC_WARN_ONLY))
  907|       |            return rc;
  908|       |    }
  909|       |
  910|       |
  911|       |#endif /* DNSSEC_LOCAL_VALIDATION */
  912|     66|    *res = addrs;
  913|     66|    DEBUGIF("dns:getaddrinfo") {
  ------------------
  |  |  145|     66|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|    132|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  914|      0|        if (err == 0 && addrs && addrs->ai_addr) {
  ------------------
  |  Branch (914:13): [True: 0, False: 0]
  |  Branch (914:25): [True: 0, False: 0]
  |  Branch (914:34): [True: 0, False: 0]
  ------------------
  915|      0|            const char *fam = "?";
  916|      0|            char dst[64] = "?";
  917|      0|            uint16_t port = 0;
  918|       |
  919|      0|            switch (addrs->ai_addr->sa_family) {
  ------------------
  |  Branch (919:21): [True: 0, False: 0]
  ------------------
  920|      0|            case AF_INET: {
  ------------------
  |  Branch (920:13): [True: 0, False: 0]
  ------------------
  921|      0|                struct sockaddr_in *sin = (struct sockaddr_in *)addrs->ai_addr;
  922|       |
  923|      0|                fam = "AF_INET";
  924|      0|                inet_ntop(AF_INET, &sin->sin_addr, dst, sizeof(dst));
  925|      0|                port = ntohs(sin->sin_port);
  926|      0|                break;
  927|      0|            }
  928|      0|            case AF_INET6: {
  ------------------
  |  Branch (928:13): [True: 0, False: 0]
  ------------------
  929|      0|                struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)
  930|      0|                    addrs->ai_addr;
  931|       |
  932|      0|                fam = "AF_INET6";
  933|      0|                inet_ntop(AF_INET6, &sin6->sin6_addr, dst, sizeof(dst));
  934|      0|                port = ntohs(sin6->sin6_port);
  935|      0|                break;
  936|      0|            }
  937|      0|            }
  938|      0|            DEBUGMSGTL(("dns:getaddrinfo", "answer { %s, %s:%hu }\n", fam, dst,
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  939|      0|                        port));
  940|      0|        }
  941|      0|    }
  942|     66|    return err;
  943|       |#else
  944|       |    NETSNMP_LOGONCE((LOG_ERR, "getaddrinfo not available"));
  945|       |    return EAI_FAIL;
  946|       |#endif /* getaddrinfo */
  947|     66|}
calculate_sectime_diff:
 1176|    135|{
 1177|    135|    struct timeval  diff;
 1178|       |
 1179|    135|    NETSNMP_TIMERSUB(now, then, &diff);
  ------------------
  |  |  173|    135|#define NETSNMP_TIMERSUB(a, b, res) do {                        \
  |  |  174|    135|    (res)->tv_sec  = (a)->tv_sec  - (b)->tv_sec - 1;            \
  |  |  175|    135|    (res)->tv_usec = (a)->tv_usec - (b)->tv_usec + 1000000L;    \
  |  |  176|    135|    if ((res)->tv_usec >= 1000000L) {                           \
  |  |  ------------------
  |  |  |  Branch (176:9): [True: 135, False: 0]
  |  |  ------------------
  |  |  177|    135|        (res)->tv_usec -= 1000000L;                             \
  |  |  178|    135|        (res)->tv_sec++;                                        \
  |  |  179|    135|    }                                                           \
  |  |  180|    135|} while (0)
  |  |  ------------------
  |  |  |  Branch (180:10): [Folded, False: 135]
  |  |  ------------------
  ------------------
 1180|    135|    return (u_int)(diff.tv_sec + (diff.tv_usec >= 500000L));
 1181|    135|}
mkdirhier:
 1241|      1|{
 1242|      1|    struct stat     sbuf;
 1243|      1|    char           *ourcopy = strdup(pathname);
 1244|      1|    char           *entry;
 1245|      1|    char           *buf = NULL;
 1246|      1|    char           *st = NULL;
 1247|      1|    int             res;
 1248|       |
 1249|      1|    res = SNMPERR_GENERR;
  ------------------
  |  |  218|      1|#define SNMPERR_GENERR			(-1)
  ------------------
 1250|      1|    if (!ourcopy)
  ------------------
  |  Branch (1250:9): [True: 0, False: 1]
  ------------------
 1251|      0|        goto out;
 1252|       |
 1253|      1|    buf = malloc(strlen(pathname) + 2);
 1254|      1|    if (!buf)
  ------------------
  |  Branch (1254:9): [True: 0, False: 1]
  ------------------
 1255|      0|        goto out;
 1256|       |
 1257|       |#if defined (WIN32) || defined (cygwin)
 1258|       |    /* convert backslash to forward slash */
 1259|       |    for (entry = ourcopy; *entry; entry++)
 1260|       |        if (*entry == '\\')
 1261|       |            *entry = '/';
 1262|       |#endif
 1263|       |
 1264|      1|    entry = strtok_r(ourcopy, "/", &st);
 1265|       |
 1266|      1|    buf[0] = '\0';
 1267|       |
 1268|       |#if defined (WIN32) || defined (cygwin)
 1269|       |    /*
 1270|       |     * Check if first entry contains a drive-letter
 1271|       |     *   e.g  "c:/path"
 1272|       |     */
 1273|       |    if ((entry) && (':' == entry[1]) &&
 1274|       |        (('\0' == entry[2]) || ('/' == entry[2]))) {
 1275|       |        strcat(buf, entry);
 1276|       |        entry = strtok_r(NULL, "/", &st);
 1277|       |    }
 1278|       |#endif
 1279|       |
 1280|       |    /*
 1281|       |     * check to see if filename is a directory 
 1282|       |     */
 1283|      3|    while (entry) {
  ------------------
  |  Branch (1283:12): [True: 2, False: 1]
  ------------------
 1284|      2|        strcat(buf, "/");
 1285|      2|        strcat(buf, entry);
 1286|      2|        entry = strtok_r(NULL, "/", &st);
 1287|      2|        if (entry == NULL && skiplast)
  ------------------
  |  Branch (1287:13): [True: 1, False: 1]
  |  Branch (1287:30): [True: 0, False: 1]
  ------------------
 1288|      0|            break;
 1289|      2|        if (stat(buf, &sbuf) < 0) {
  ------------------
  |  Branch (1289:13): [True: 1, False: 1]
  ------------------
 1290|       |            /*
 1291|       |             * DNE, make it 
 1292|       |             */
 1293|       |#ifdef WIN32
 1294|       |            if (CreateDirectory(buf, NULL) == 0)
 1295|       |#else
 1296|      1|            if (mkdir(buf, mode) == -1)
  ------------------
  |  Branch (1296:17): [True: 0, False: 1]
  ------------------
 1297|      0|#endif
 1298|      0|                goto out;
 1299|      1|            else
 1300|      1|                snmp_log(LOG_INFO, "Created directory: %s\n", buf);
 1301|      1|        } else {
 1302|       |            /*
 1303|       |             * exists, is it a file? 
 1304|       |             */
 1305|      1|            if ((sbuf.st_mode & S_IFDIR) == 0) {
  ------------------
  |  Branch (1305:17): [True: 0, False: 1]
  ------------------
 1306|       |                /*
 1307|       |                 * ack! can't make a directory on top of a file 
 1308|       |                 */
 1309|      0|                goto out;
 1310|      0|            }
 1311|      1|        }
 1312|      2|    }
 1313|      1|    res = SNMPERR_SUCCESS;
  ------------------
  |  |  217|      1|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1314|      1|out:
 1315|      1|    free(buf);
 1316|      1|    free(ourcopy);
 1317|      1|    return res;
 1318|      1|}
netsnmp_os_prematch:
 1384|     66|{
 1385|     66|#ifdef HAVE_SYS_UTSNAME_H
 1386|     66|  static int printOSonce = 1;
 1387|     66|  struct utsname utsbuf;
 1388|     66|  if ( 0 > uname(&utsbuf))
  ------------------
  |  Branch (1388:8): [True: 0, False: 66]
  ------------------
 1389|      0|    return -1;
 1390|       |
 1391|     66|  if (printOSonce) {
  ------------------
  |  Branch (1391:7): [True: 1, False: 65]
  ------------------
 1392|      1|    printOSonce = 0;
 1393|       |    /* show the four elements that the kernel can be sure of */
 1394|      1|  DEBUGMSGT(("daemonize","sysname '%s',\nrelease '%s',\nversion '%s',\nmachine '%s'\n",
  ------------------
  |  |   62|      1|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 1]
  |  |  ------------------
  ------------------
 1395|      1|      utsbuf.sysname, utsbuf.release, utsbuf.version, utsbuf.machine));
 1396|      1|  }
 1397|     66|  if (0 != strcasecmp(utsbuf.sysname, ospmname)) return -1;
  ------------------
  |  Branch (1397:7): [True: 0, False: 66]
  ------------------
 1398|       |
 1399|       |  /* Required to match only the leading characters */
 1400|     66|  return strncasecmp(utsbuf.release, ospmrelprefix, strlen(ospmrelprefix));
 1401|       |
 1402|       |#else
 1403|       |
 1404|       |  return -1;
 1405|       |
 1406|       |#endif /* HAVE_SYS_UTSNAME_H */
 1407|     66|}

netsnmp_memdup:
  279|    148|{
  280|    148|    void *to = NULL;
  281|       |
  282|    148|    if (from) {
  ------------------
  |  Branch (282:9): [True: 148, False: 0]
  ------------------
  283|    148|        to = malloc(size);
  284|    148|        if (to)
  ------------------
  |  Branch (284:13): [True: 148, False: 0]
  ------------------
  285|    148|            memcpy(to, from, size);
  286|    148|    }
  287|    148|    return to;
  288|    148|}                               /* end netsnmp_memdup() */
netsnmp_get_monotonic_clock:
  948|    332|{
  949|    332|#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
  950|    332|    struct timespec ts;
  951|    332|    int res;
  952|       |
  953|    332|    res = clock_gettime(CLOCK_MONOTONIC, &ts);
  954|    332|    if (res >= 0) {
  ------------------
  |  Branch (954:9): [True: 332, False: 0]
  ------------------
  955|    332|        tv->tv_sec = ts.tv_sec;
  956|    332|        tv->tv_usec = ts.tv_nsec / 1000;
  957|    332|    } else {
  958|      0|        gettimeofday(tv, NULL);
  959|      0|    }
  960|       |#elif defined(WIN32)
  961|       |    /*
  962|       |     * Windows: return tick count. Note: the rate at which the tick count
  963|       |     * increases is not adjusted by the time synchronization algorithm, so
  964|       |     * expect an error of <= 100 ppm for the rate at which this clock
  965|       |     * increases.
  966|       |     */
  967|       |    typedef ULONGLONG (WINAPI * pfGetTickCount64)(void);
  968|       |    static int s_initialized;
  969|       |    static pfGetTickCount64 s_pfGetTickCount64;
  970|       |    uint64_t now64;
  971|       |
  972|       |    if (!s_initialized) {
  973|       |        HMODULE hKernel32 = GetModuleHandle("kernel32");
  974|       |        s_pfGetTickCount64 =
  975|       |            (pfGetTickCount64) GetProcAddress(hKernel32, "GetTickCount64");
  976|       |        s_initialized = TRUE;
  977|       |    }
  978|       |
  979|       |    if (s_pfGetTickCount64) {
  980|       |        /* Windows Vista, Windows 2008 or any later Windows version */
  981|       |        now64 = (*s_pfGetTickCount64)();
  982|       |    } else {
  983|       |        /* Windows XP, Windows 2003 or any earlier Windows version */
  984|       |        static uint32_t s_wraps, s_last;
  985|       |        uint32_t now;
  986|       |
  987|       |        now = GetTickCount();
  988|       |        if (now < s_last)
  989|       |            s_wraps++;
  990|       |        s_last = now;
  991|       |        now64 = ((uint64_t)s_wraps << 32) | now;
  992|       |    }
  993|       |    tv->tv_sec = now64 / 1000;
  994|       |    tv->tv_usec = (now64 % 1000) * 1000;
  995|       |#else
  996|       |    /* At least FreeBSD 4 doesn't provide monotonic clock support. */
  997|       |#warning Not sure how to query a monotonically increasing clock on your system. \
  998|       |Timers will not work correctly if the system clock is adjusted by e.g. ntpd.
  999|       |    gettimeofday(tv, NULL);
 1000|       |#endif
 1001|    332|}
netsnmp_getenv:
 1187|    332|{
 1188|    332|#if !defined (WIN32) && !defined (cygwin)
 1189|    332|  return (getenv(name));
 1190|       |#else
 1191|       |  char *temp = NULL;  
 1192|       |  HKEY hKey;
 1193|       |  unsigned char * key_value = NULL;
 1194|       |  DWORD key_value_size = 0;
 1195|       |  DWORD key_value_type = 0;
 1196|       |  DWORD getenv_worked = 0;
 1197|       |
 1198|       |  DEBUGMSGTL(("read_config", "netsnmp_getenv called with name: %s\n",name));
 1199|       |
 1200|       |  if (!(name))
 1201|       |    return NULL;
 1202|       |  
 1203|       |  /* Try environment variable first */ 
 1204|       |  temp = getenv(name);
 1205|       |  if (temp) {
 1206|       |    getenv_worked = 1;
 1207|       |    DEBUGMSGTL(("read_config", "netsnmp_getenv will return from ENV: %s\n",temp));
 1208|       |  }
 1209|       |  
 1210|       |  /* Next try HKCU */
 1211|       |  if (temp == NULL)
 1212|       |  {
 1213|       |    if (getenv("SNMP_IGNORE_WINDOWS_REGISTRY"))
 1214|       |      return NULL;
 1215|       |
 1216|       |    if (RegOpenKeyExA(
 1217|       |          HKEY_CURRENT_USER, 
 1218|       |          "SOFTWARE\\Net-SNMP", 
 1219|       |          0, 
 1220|       |          KEY_QUERY_VALUE, 
 1221|       |          &hKey) == ERROR_SUCCESS) {   
 1222|       |      
 1223|       |      if (RegQueryValueExA(
 1224|       |            hKey, 
 1225|       |            name, 
 1226|       |            NULL, 
 1227|       |            &key_value_type, 
 1228|       |            NULL,               /* Just get the size */
 1229|       |            &key_value_size) == ERROR_SUCCESS) {
 1230|       |
 1231|       |        SNMP_FREE(key_value);
 1232|       |
 1233|       |        /* Allocate memory needed +1 to allow RegQueryValueExA to NULL terminate the
 1234|       |         * string data in registry is missing one (which is unlikely).
 1235|       |         */
 1236|       |        key_value = malloc((sizeof(char) * key_value_size)+sizeof(char));
 1237|       |        
 1238|       |        if (RegQueryValueExA(
 1239|       |              hKey, 
 1240|       |              name, 
 1241|       |              NULL, 
 1242|       |              &key_value_type, 
 1243|       |              key_value, 
 1244|       |              &key_value_size) == ERROR_SUCCESS) {
 1245|       |        }
 1246|       |        temp = (char *) key_value;
 1247|       |      }
 1248|       |      RegCloseKey(hKey);
 1249|       |      if (temp)
 1250|       |        DEBUGMSGTL(("read_config", "netsnmp_getenv will return from HKCU: %s\n",temp));
 1251|       |    }
 1252|       |  }
 1253|       |
 1254|       |  /* Next try HKLM */
 1255|       |  if (temp == NULL)
 1256|       |  {
 1257|       |    if (RegOpenKeyExA(
 1258|       |          HKEY_LOCAL_MACHINE, 
 1259|       |          "SOFTWARE\\Net-SNMP", 
 1260|       |          0, 
 1261|       |          KEY_QUERY_VALUE, 
 1262|       |          &hKey) == ERROR_SUCCESS) {   
 1263|       |      
 1264|       |      if (RegQueryValueExA(
 1265|       |            hKey, 
 1266|       |            name, 
 1267|       |            NULL, 
 1268|       |            &key_value_type, 
 1269|       |            NULL,               /* Just get the size */
 1270|       |            &key_value_size) == ERROR_SUCCESS) {
 1271|       |
 1272|       |        SNMP_FREE(key_value);
 1273|       |
 1274|       |        /* Allocate memory needed +1 to allow RegQueryValueExA to NULL terminate the
 1275|       |         * string data in registry is missing one (which is unlikely).
 1276|       |         */
 1277|       |        key_value = malloc((sizeof(char) * key_value_size)+sizeof(char));
 1278|       |        
 1279|       |        if (RegQueryValueExA(
 1280|       |              hKey, 
 1281|       |              name, 
 1282|       |              NULL, 
 1283|       |              &key_value_type, 
 1284|       |              key_value, 
 1285|       |              &key_value_size) == ERROR_SUCCESS) {
 1286|       |        }
 1287|       |        temp = (char *) key_value;
 1288|       |
 1289|       |      }
 1290|       |      RegCloseKey(hKey);
 1291|       |      if (temp)
 1292|       |        DEBUGMSGTL(("read_config", "netsnmp_getenv will return from HKLM: %s\n",temp));
 1293|       |    }
 1294|       |  }
 1295|       |  
 1296|       |  if (temp && !getenv_worked) {
 1297|       |    setenv(name, temp, 1);
 1298|       |    SNMP_FREE(temp);
 1299|       |  }
 1300|       |
 1301|       |  DEBUGMSGTL(("read_config", "netsnmp_getenv returning: %s\n",getenv(name)));
 1302|       |
 1303|       |  return(getenv(name));
 1304|       |#endif
 1305|    332|}
netsnmp_gethomedir:
 1417|     67|const char *netsnmp_gethomedir(void) {
 1418|     67|    const char *homepath = netsnmp_getenv("HOME");
 1419|       |#ifdef _WIN32
 1420|       |    if (!homepath)
 1421|       |        homepath = netsnmp_getenv("USERPROFILE");
 1422|       |#endif
 1423|     67|    return homepath;
 1424|     67|}

netsnmp_aal5pvc_ctor:
  371|     66|{
  372|     66|    aal5pvcDomain.name = netsnmp_AAL5PVCDomain;
  373|     66|    aal5pvcDomain.name_length = OID_LENGTH(netsnmp_AAL5PVCDomain);
  ------------------
  |  |   64|     66|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     66|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  374|     66|    aal5pvcDomain.prefix = calloc(3, sizeof(char *));
  375|     66|    if (!aal5pvcDomain.prefix) {
  ------------------
  |  Branch (375:9): [True: 0, False: 66]
  ------------------
  376|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  377|      0|        return;
  378|      0|    }
  379|     66|    aal5pvcDomain.prefix[0] = "aal5pvc";
  380|     66|    aal5pvcDomain.prefix[1] = "pvc";
  381|       |
  382|     66|    aal5pvcDomain.f_create_from_tstring_new = netsnmp_aal5pvc_create_tstring;
  383|     66|    aal5pvcDomain.f_create_from_ostring     = netsnmp_aal5pvc_create_ostring;
  384|       |
  385|     66|    netsnmp_tdomain_register(&aal5pvcDomain);
  386|     66|}

free_alias_config:
   61|    132|free_alias_config(void) {
   62|    132|    netsnmp_free_all_list_data(alias_memory);
   63|       |    alias_memory = NULL;
   64|    132|}
netsnmp_alias_ctor:
   98|     66|{
   99|     66|    aliasDomain.name = netsnmp_snmpALIASDomain;
  100|     66|    aliasDomain.name_length = OID_LENGTH(netsnmp_snmpALIASDomain);
  ------------------
  |  |   64|     66|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     66|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  101|     66|    aliasDomain.prefix = calloc(2, sizeof(char *));
  102|     66|    if (!aliasDomain.prefix) {
  ------------------
  |  Branch (102:9): [True: 0, False: 66]
  ------------------
  103|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  104|      0|        return;
  105|      0|    }
  106|     66|    aliasDomain.prefix[0] = "alias";
  107|       |
  108|     66|    aliasDomain.f_create_from_tstring_new = netsnmp_alias_create_tstring;
  109|     66|    aliasDomain.f_create_from_ostring     = netsnmp_alias_create_ostring;
  110|       |
  111|     66|    netsnmp_tdomain_register(&aliasDomain);
  112|       |
  113|     66|    register_config_handler("snmp", "alias", parse_alias_config,
  114|     66|                            free_alias_config, "NAME TRANSPORT_DEFINITION");
  115|     66|}

netsnmp_dtlsudp_ctor:
 1652|     66|{
 1653|     66|    static const char indexname[] = "_netsnmp_addr_info";
 1654|     66|    static const char *prefixes[] = { "dtlsudp", "dtls"
 1655|     66|#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
 1656|     66|                                      , "dtlsudp6", "dtls6"
 1657|     66|#endif
 1658|     66|    };
 1659|     66|    int i, num_prefixes = sizeof(prefixes) / sizeof(char *);
 1660|     66|#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
 1661|     66|    static const char indexname6[] = "_netsnmp_addr_info6";
 1662|     66|#endif
 1663|       |
 1664|     66|    DEBUGMSGTL(("dtlsudp", "registering DTLS constructor\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 1665|       |
 1666|       |    /* config settings */
 1667|       |
 1668|     66|#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
 1669|     66|    if (!openssl_addr_index6)
  ------------------
  |  Branch (1669:9): [True: 1, False: 65]
  ------------------
 1670|      1|        openssl_addr_index6 =
 1671|      1|            SSL_get_ex_new_index(0, NETSNMP_REMOVE_CONST(void *, indexname6),
 1672|     66|                                 NULL, NULL, NULL);
 1673|     66|#endif
 1674|       |
 1675|     66|    dtlsudpDomain.name = netsnmpDTLSUDPDomain;
 1676|     66|    dtlsudpDomain.name_length = netsnmpDTLSUDPDomain_len;
 1677|     66|    dtlsudpDomain.prefix = calloc(num_prefixes + 1, sizeof(char *));
 1678|     66|    if (!dtlsudpDomain.prefix) {
  ------------------
  |  Branch (1678:9): [True: 0, False: 66]
  ------------------
 1679|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
 1680|      0|        return;
 1681|      0|    }
 1682|    330|    for (i = 0; i < num_prefixes; ++ i)
  ------------------
  |  Branch (1682:17): [True: 264, False: 66]
  ------------------
 1683|    264|        dtlsudpDomain.prefix[i] = prefixes[i];
 1684|       |
 1685|     66|    dtlsudpDomain.f_create_from_tstring_new = netsnmp_dtlsudp_create_tstring;
 1686|     66|    dtlsudpDomain.f_create_from_ostring     = netsnmp_dtlsudp_create_ostring;
 1687|       |
 1688|     66|    if (!openssl_addr_index)
  ------------------
  |  Branch (1688:9): [True: 1, False: 65]
  ------------------
 1689|      1|        openssl_addr_index =
 1690|      1|            SSL_get_ex_new_index(0, NETSNMP_REMOVE_CONST(void *, indexname),
 1691|     66|                                 NULL, NULL, NULL);
 1692|       |
 1693|     66|    netsnmp_tdomain_register(&dtlsudpDomain);
 1694|     66|}

netsnmp_parse_ep_str:
   31|     66|{
   32|     66|    char *dup, *cp, *addrstr = NULL, *iface = NULL, *portstr = NULL;
   33|     66|    unsigned port;
   34|       |
   35|     66|    if (!endpoint)
  ------------------
  |  Branch (35:9): [True: 0, False: 66]
  ------------------
   36|      0|        return 0;
   37|       |
   38|     66|    dup = strdup(endpoint);
   39|     66|    if (!dup)
  ------------------
  |  Branch (39:9): [True: 0, False: 66]
  ------------------
   40|      0|        return 0;
   41|       |
   42|     66|    cp = dup;
   43|     66|    if (netsnmp_isnumber(cp)) {
  ------------------
  |  Branch (43:9): [True: 0, False: 66]
  ------------------
   44|      0|        portstr = cp;
   45|     66|    } else {
   46|     66|        if (*cp == '[') {
  ------------------
  |  Branch (46:13): [True: 0, False: 66]
  ------------------
   47|      0|            addrstr = cp + 1;
   48|      0|            cp = strchr(cp, ']');
   49|      0|            if (cp) {
  ------------------
  |  Branch (49:17): [True: 0, False: 0]
  ------------------
   50|      0|                cp[0] = '\0';
   51|      0|                cp++;
   52|      0|            } else {
   53|      0|                goto err;
   54|      0|            }
   55|     66|        } else if (*cp != '@' && (*cp != ':' || cp[1] == ':')) {
  ------------------
  |  Branch (55:20): [True: 66, False: 0]
  |  Branch (55:35): [True: 66, False: 0]
  |  Branch (55:49): [True: 0, False: 0]
  ------------------
   56|     66|            addrstr = cp;
   57|     66|            cp = strchr(addrstr, '@');
   58|     66|            if (!cp) {
  ------------------
  |  Branch (58:17): [True: 66, False: 0]
  ------------------
   59|     66|                cp = strrchr(addrstr, ':');
   60|     66|                if (cp && strchr(dup, ':') < cp)
  ------------------
  |  Branch (60:21): [True: 66, False: 0]
  |  Branch (60:27): [True: 0, False: 66]
  ------------------
   61|      0|                    cp = NULL;
   62|     66|            }
   63|     66|        }
   64|     66|        if (cp && *cp == '@') {
  ------------------
  |  Branch (64:13): [True: 66, False: 0]
  |  Branch (64:19): [True: 0, False: 66]
  ------------------
   65|      0|            *cp = '\0';
   66|      0|            iface = cp + 1;
   67|      0|            cp = strchr(cp + 1, ':');
   68|      0|        }
   69|     66|        if (cp && *cp == ':') {
  ------------------
  |  Branch (69:13): [True: 66, False: 0]
  |  Branch (69:19): [True: 66, False: 0]
  ------------------
   70|     66|            *cp++ = '\0';
   71|     66|            portstr = cp;
   72|     66|            if (!netsnmp_isnumber(cp))
  ------------------
  |  Branch (72:17): [True: 0, False: 66]
  ------------------
   73|      0|                goto err;
   74|     66|        } else if (cp && *cp) {
  ------------------
  |  Branch (74:20): [True: 0, False: 0]
  |  Branch (74:26): [True: 0, False: 0]
  ------------------
   75|      0|            goto err;
   76|      0|        }
   77|     66|    }
   78|       |
   79|     66|    if (addrstr) {
  ------------------
  |  Branch (79:9): [True: 66, False: 0]
  ------------------
   80|     66|        ep_str->addr = strdup(addrstr);
   81|     66|        if (!ep_str->addr)
  ------------------
  |  Branch (81:13): [True: 0, False: 66]
  ------------------
   82|      0|            goto err;
   83|     66|    }
   84|     66|    if (iface)
  ------------------
  |  Branch (84:9): [True: 0, False: 66]
  ------------------
   85|      0|        strlcpy(ep_str->iface, iface, sizeof(ep_str->iface));
   86|     66|    if (portstr) {
  ------------------
  |  Branch (86:9): [True: 66, False: 0]
  ------------------
   87|     66|        port = atoi(portstr);
   88|     66|        if (port <= 0xffff)
  ------------------
  |  Branch (88:13): [True: 66, False: 0]
  ------------------
   89|     66|            strlcpy(ep_str->port, portstr, sizeof(ep_str->port));
   90|      0|        else
   91|      0|            goto err;
   92|     66|    }
   93|       |
   94|     66|    free(dup);
   95|     66|    return 1;
   96|       |
   97|      0|err:
   98|      0|    free(ep_str->addr);
   99|       |    ep_str->addr = NULL;
  100|      0|    free(dup);
  101|      0|    return 0;
  102|     66|}
netsnmp_bindtodevice:
  105|     66|{
  106|       |    /* If no interface name has been specified, report success. */
  107|     66|    if (!iface || iface[0] == '\0')
  ------------------
  |  Branch (107:9): [True: 0, False: 66]
  |  Branch (107:19): [True: 66, False: 0]
  ------------------
  108|     66|        return 0;
  109|       |
  110|      0|#ifdef HAVE_SO_BINDTODEVICE
  111|      0|    {
  112|       |        /*
  113|       |         * +1 to work around the Linux kernel bug that the passed in name is not
  114|       |         * '\0'-terminated.
  115|       |         */
  116|      0|        int ifacelen = strlen(iface) + 1;
  117|      0|        int ret;
  118|       |
  119|      0|        ret = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, iface, ifacelen);
  120|      0|        if (ret < 0)
  ------------------
  |  Branch (120:13): [True: 0, False: 0]
  ------------------
  121|      0|            snmp_log(LOG_ERR, "Binding socket to interface %s failed: %s\n",
  122|      0|                     iface, strerror(errno));
  123|      0|        return ret;
  124|     66|    }
  125|       |#else
  126|       |    errno = EINVAL;
  127|       |    return -1;
  128|       |#endif
  129|     66|}
netsnmp_ipbase_session_init:
  132|     66|                            struct snmp_session *sess) {
  133|     66|    union {
  134|     66|        struct sockaddr     sa;
  135|     66|        struct sockaddr_in  sin;
  136|     66|        struct sockaddr_in6 sin6;
  137|     66|    } ss;
  138|     66|    socklen_t len = sizeof(ss);
  139|       |
  140|     66|    if (!sess) {
  ------------------
  |  Branch (140:9): [True: 0, False: 66]
  ------------------
  141|      0|        DEBUGMSGTL(("netsnmp_ipbase", "session pointer is NULL\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]
  |  |  ------------------
  ------------------
  142|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  143|      0|    }
  144|       |
  145|     66|    if (getsockname(transport->sock, (struct sockaddr *)&ss, &len) == -1) {
  ------------------
  |  Branch (145:9): [True: 0, False: 66]
  ------------------
  146|      0|        DEBUGMSGTL(("netsnmp_ipbase", "getsockname error %s\n", strerror(errno)));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  147|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  148|      0|    }
  149|     66|    switch (ss.sa.sa_family) {
  150|     66|    case AF_INET:
  ------------------
  |  Branch (150:5): [True: 66, False: 0]
  ------------------
  151|     66|        sess->local_port = ntohs(ss.sin.sin_port);
  152|     66|        break;
  153|      0|    case AF_INET6:
  ------------------
  |  Branch (153:5): [True: 0, False: 66]
  ------------------
  154|      0|        sess->local_port = ntohs(ss.sin6.sin6_port);
  155|      0|        break;
  156|      0|    default:
  ------------------
  |  Branch (156:5): [True: 0, False: 66]
  ------------------
  157|      0|        DEBUGMSGTL(("netsnmp_ipbase", "unsupported address family %d\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]
  |  |  ------------------
  ------------------
  158|      0|                    ss.sa.sa_family));
  159|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  160|     66|    }
  161|       |
  162|     66|    DEBUGMSGTL(("netsnmp_ipbase", "local port number %d\n", sess->local_port));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  163|       |
  164|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  165|     66|}
snmpIPBaseDomain.c:netsnmp_isnumber:
   12|    132|{
   13|    132|    if (!*cp)
  ------------------
  |  Branch (13:9): [True: 0, False: 132]
  ------------------
   14|      0|        return 0;
   15|       |
   16|    132|    while (isdigit((unsigned char)*cp))
  ------------------
  |  Branch (16:12): [True: 462, False: 132]
  ------------------
   17|    462|        cp++;
   18|    132|    return *cp == '\0';
   19|    132|}

netsnmp_ipx_ctor:
  476|     66|{
  477|     66|    ipxDomain.name = netsnmpIPXDomain;
  478|     66|    ipxDomain.name_length = netsnmpIPXDomain_len;
  479|     66|    ipxDomain.prefix = calloc(2, sizeof(char *));
  480|     66|    if (!ipxDomain.prefix) {
  ------------------
  |  Branch (480:9): [True: 0, False: 66]
  ------------------
  481|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  482|      0|        return;
  483|      0|    }
  484|     66|    ipxDomain.prefix[0] = "ipx";
  485|       |
  486|     66|    ipxDomain.f_create_from_tstring_new = netsnmp_ipx_create_tstring;
  487|     66|    ipxDomain.f_create_from_ostring     = netsnmp_ipx_create_ostring;
  488|       |
  489|     66|    netsnmp_tdomain_register(&ipxDomain);
  490|     66|}

netsnmp_sockaddr_in3:
   87|     66|{
   88|     66|    struct sockaddr_in *addr = &ep->a.sin;
   89|     66|    struct netsnmp_ep_str ep_str;
   90|     66|    int port, ret;
   91|       |
   92|     66|    if (!ep)
  ------------------
  |  Branch (92:9): [True: 0, False: 66]
  ------------------
   93|      0|        return 0;
   94|       |
   95|     66|    DEBUGMSGTL(("netsnmp_sockaddr_in",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
   96|     66|                "addr %p, inpeername \"%s\", default_target \"%s\"\n",
   97|     66|                ep, inpeername ? inpeername : "[NIL]",
   98|     66|                default_target ? default_target : "[NIL]"));
   99|       |
  100|     66|    memset(ep, 0, sizeof(*ep));
  101|     66|    addr->sin_addr.s_addr = htonl(INADDR_ANY);
  102|     66|    addr->sin_family = AF_INET;
  103|     66|    addr->sin_port = htons((u_short)SNMP_PORT);
  104|       |
  105|     66|    memset(&ep_str, 0, sizeof(ep_str));
  106|     66|    port = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  107|     66|                              NETSNMP_DS_LIB_DEFAULT_PORT);
  ------------------
  |  |  117|     66|#define NETSNMP_DS_LIB_DEFAULT_PORT         3
  ------------------
  108|     66|    if (port != 0)
  ------------------
  |  Branch (108:9): [True: 0, False: 66]
  ------------------
  109|      0|        snprintf(ep_str.port, sizeof(ep_str.port), "%d", port);
  110|     66|    else if (default_target &&
  ------------------
  |  Branch (110:14): [True: 0, False: 66]
  ------------------
  111|      0|             !netsnmp_parse_ep_str(&ep_str, default_target))
  ------------------
  |  Branch (111:14): [True: 0, False: 0]
  ------------------
  112|      0|            snmp_log(LOG_ERR, "Invalid default target %s\n",
  113|      0|                     default_target);
  114|     66|    if (inpeername && *inpeername != '\0') {
  ------------------
  |  Branch (114:9): [True: 66, False: 0]
  |  Branch (114:23): [True: 66, False: 0]
  ------------------
  115|     66|	if (ep_str.addr) {
  ------------------
  |  Branch (115:6): [True: 0, False: 66]
  ------------------
  116|      0|	    free(ep_str.addr);  /* free default target */
  117|      0|	    ep_str.addr = NULL;
  118|      0|	}
  119|     66|	if (!netsnmp_parse_ep_str(&ep_str, inpeername))
  ------------------
  |  Branch (119:6): [True: 0, False: 66]
  ------------------
  120|      0|            return 0;
  121|     66|    }
  122|       |
  123|     66|    if (ep_str.port[0])
  ------------------
  |  Branch (123:9): [True: 66, False: 0]
  ------------------
  124|     66|        addr->sin_port = htons(atoi(ep_str.port));
  125|     66|    if (ep_str.iface[0])
  ------------------
  |  Branch (125:9): [True: 0, False: 66]
  ------------------
  126|      0|        strlcpy(ep->iface, ep_str.iface, sizeof(ep->iface));
  127|     66|    if (ep_str.addr && strcmp(ep_str.addr, "255.255.255.255") == 0) {
  ------------------
  |  Branch (127:9): [True: 66, False: 0]
  |  Branch (127:24): [True: 0, False: 66]
  ------------------
  128|       |        /*
  129|       |         * The explicit broadcast address hack
  130|       |         */
  131|      0|        DEBUGMSGTL(("netsnmp_sockaddr_in", "Explicit UDP broadcast\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]
  |  |  ------------------
  ------------------
  132|      0|        addr->sin_addr.s_addr = INADDR_NONE;
  133|     66|    } else if (ep_str.addr && strcmp(ep_str.addr, "") != 0) {
  ------------------
  |  Branch (133:16): [True: 66, False: 0]
  |  Branch (133:31): [True: 66, False: 0]
  ------------------
  134|     66|        ret = netsnmp_gethostbyname_v4(ep_str.addr, &addr->sin_addr.s_addr);
  135|     66|        if (ret < 0) {
  ------------------
  |  Branch (135:13): [True: 0, False: 66]
  ------------------
  136|      0|            DEBUGMSGTL(("netsnmp_sockaddr_in",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  137|      0|                        "couldn't resolve hostname \"%s\"\n", ep_str.addr));
  138|      0|            free(ep_str.addr);
  139|      0|            return 0;
  140|      0|        }
  141|     66|        DEBUGMSGTL(("netsnmp_sockaddr_in",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  142|     66|                    "hostname (resolved okay)\n"));
  143|     66|    }
  144|       |
  145|       |    /*
  146|       |     * Finished
  147|       |     */
  148|       |
  149|     66|    DEBUGMSGTL(("netsnmp_sockaddr_in", "return { AF_INET, %s:%hu }\n",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  150|     66|                inet_ntoa(addr->sin_addr), ntohs(addr->sin_port)));
  151|     66|    free(ep_str.addr);
  152|     66|    return 1;
  153|     66|}

netsnmp_std_ctor:
  268|     66|{
  269|     66|    stdDomain.name = netsnmp_snmpSTDDomain;
  270|     66|    stdDomain.name_length = OID_LENGTH(netsnmp_snmpSTDDomain);
  ------------------
  |  |   64|     66|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     66|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  271|     66|    stdDomain.prefix = calloc(2, sizeof(char *));
  272|     66|    if (!stdDomain.prefix) {
  ------------------
  |  Branch (272:9): [True: 0, False: 66]
  ------------------
  273|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  274|      0|        return;
  275|      0|    }
  276|     66|    stdDomain.prefix[0] = "std";
  277|       |
  278|     66|    stdDomain.f_create_from_tstring_new = netsnmp_std_create_tstring;
  279|     66|    stdDomain.f_create_from_ostring     = netsnmp_std_create_ostring;
  280|       |
  281|     66|    netsnmp_tdomain_register(&stdDomain);
  282|     66|}

netsnmp_socketbase_close:
   43|     66|int netsnmp_socketbase_close(netsnmp_transport *t) {
   44|     66|    int rc = -1;
   45|     66|    if (t->sock >= 0) {
  ------------------
  |  Branch (45:9): [True: 66, False: 0]
  ------------------
   46|     66|#ifndef HAVE_CLOSESOCKET
   47|     66|        rc = close(t->sock);
   48|       |#else
   49|       |        rc = closesocket(t->sock);
   50|       |#endif
   51|     66|        t->sock = -1;
   52|     66|    }
   53|     66|    return rc;
   54|     66|}
netsnmp_sock_buffer_set:
  220|    132|{
  221|       |#if ! defined(SO_SNDBUF) && ! defined(SO_RCVBUF)
  222|       |    DEBUGMSGTL(("socket:buffer", "Changing socket buffer is not supported\n"));
  223|       |    return -1;
  224|       |#else
  225|    132|    const char     *buftype;
  226|    132|    int            curbuf = 0;
  227|    132|    socklen_t      curbuflen = sizeof(int);
  228|       |
  229|       |#   ifndef  SO_SNDBUF
  230|       |    if (SO_SNDBUF == optname) {
  231|       |        DEBUGMSGTL(("socket:buffer",
  232|       |                    "Changing socket send buffer is not supported\n"));
  233|       |        return -1;
  234|       |    }
  235|       |#   endif                          /*SO_SNDBUF */
  236|       |#   ifndef  SO_RCVBUF
  237|       |    if (SO_RCVBUF == optname) {
  238|       |        DEBUGMSGTL(("socket:buffer",
  239|       |                    "Changing socket receive buffer is not supported\n"));
  240|       |        return -1;
  241|       |    }
  242|       |#   endif                          /*SO_RCVBUF */
  243|       |
  244|       |    /*
  245|       |     * What is the requested buffer size ?
  246|       |     */
  247|    132|    if (0 == size)
  ------------------
  |  Branch (247:9): [True: 132, False: 0]
  ------------------
  248|    132|        size = _sock_buffer_size_get(optname, local, &buftype);
  249|      0|    else {
  250|      0|        buftype = _sock_buf_type_get(optname, local);
  251|      0|        DEBUGMSGT(("verbose:socket:buffer", "Requested %s is %d\n",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  252|      0|                   buftype, size));
  253|      0|    }
  254|       |
  255|    132|    if ((getsockopt(s, SOL_SOCKET, optname, (void *) &curbuf,
  ------------------
  |  Branch (255:9): [True: 132, False: 0]
  ------------------
  256|    132|                    &curbuflen) == 0) 
  257|    132|        && (curbuflen == sizeof(int))) {
  ------------------
  |  Branch (257:12): [True: 132, False: 0]
  ------------------
  258|       |        
  259|    132|        DEBUGMSGT(("verbose:socket:buffer", "Original %s is %d\n",
  ------------------
  |  |   62|    132|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    132|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 132]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 132]
  |  |  ------------------
  ------------------
  260|    132|                   buftype, curbuf));
  261|    132|        if (curbuf >= size) {
  ------------------
  |  Branch (261:13): [True: 132, False: 0]
  ------------------
  262|    132|            DEBUGMSGT(("verbose:socket:buffer",
  ------------------
  |  |   62|    132|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    132|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 132]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 132]
  |  |  ------------------
  ------------------
  263|    132|                      "New %s size is smaller than original!\n", buftype));
  264|    132|        }
  265|    132|    }
  266|       |
  267|       |    /*
  268|       |     * If the buffersize was not specified or it was a negative value
  269|       |     * then don't change the OS buffers at all
  270|       |     */
  271|    132|    if (size <= 0) {
  ------------------
  |  Branch (271:9): [True: 132, False: 0]
  ------------------
  272|    132|       DEBUGMSGT(("socket:buffer",
  ------------------
  |  |   62|    132|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    132|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 132]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 132]
  |  |  ------------------
  ------------------
  273|    132|                    "%s not valid or not specified; using OS default(%d)\n",
  274|    132|                    buftype,curbuf));
  275|    132|       return curbuf;
  276|    132|    }
  277|       |
  278|       |    /*
  279|       |     * Try to set the requested send buffer
  280|       |     */
  281|      0|    if (setsockopt(s, SOL_SOCKET, optname, (void *) &size, sizeof(int)) == 0) {
  ------------------
  |  Branch (281:9): [True: 0, False: 0]
  ------------------
  282|       |        /*
  283|       |         * Because some platforms lie about the actual buffer that has been 
  284|       |         * set (Linux will always say it worked ...), we print some 
  285|       |         * diagnostic output for debugging
  286|       |         */
  287|      0|        DEBUGIF("socket:buffer") {
  ------------------
  |  |  145|      0|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  288|      0|            DEBUGMSGT(("socket:buffer", "Set %s to %d\n",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  289|      0|                       buftype, size));
  290|      0|            if ((getsockopt(s, SOL_SOCKET, optname, (void *) &curbuf,
  ------------------
  |  Branch (290:17): [True: 0, False: 0]
  ------------------
  291|      0|                            &curbuflen) == 0) 
  292|      0|                    && (curbuflen == sizeof(int))) {
  ------------------
  |  Branch (292:24): [True: 0, False: 0]
  ------------------
  293|       |
  294|      0|                DEBUGMSGT(("verbose:socket:buffer",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  295|      0|                           "Now %s is %d\n", buftype, curbuf));
  296|      0|            }
  297|      0|        }
  298|       |        /*
  299|       |         * If the new buffer is smaller than the size we requested, we will
  300|       |         * try to increment the new buffer with 1k increments 
  301|       |         * (this will sometime allow us to reach a more optimal buffer.)
  302|       |         *   For example : On Solaris, if the max OS buffer is 100k and you
  303|       |         *   request 110k, you end up with the default 8k :-(
  304|       |         */
  305|      0|        if (curbuf < size) {
  ------------------
  |  Branch (305:13): [True: 0, False: 0]
  ------------------
  306|      0|            curbuf = _sock_buffer_maximize(s, optname, buftype, size);
  307|      0|            if(-1 != curbuf)
  ------------------
  |  Branch (307:16): [True: 0, False: 0]
  ------------------
  308|      0|                size = curbuf;
  309|      0|        }
  310|       |
  311|      0|    } else {
  312|       |        /*
  313|       |         * Obviously changing the buffer failed, most like like because we 
  314|       |         * requested a buffer greater than the OS limit.
  315|       |         * Therefore we need to search for an optimal buffer that is close
  316|       |         * enough to the point of failure.
  317|       |         * This will allow us to reach a more optimal buffer.
  318|       |         *   For example : On Solaris, if the max OS buffer is 100k and you 
  319|       |         *   request 110k, you end up with the default 8k :-(
  320|       |         *   After this quick seach we would get 1k close to 100k (the max)
  321|       |         */
  322|      0|        DEBUGMSGTL(("socket:buffer", "couldn't set %s to %d\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]
  |  |  ------------------
  ------------------
  323|      0|                    buftype, size));
  324|       |
  325|      0|        curbuf = _sock_buffer_maximize(s, optname, buftype, size);
  326|      0|        if(-1 != curbuf)
  ------------------
  |  Branch (326:12): [True: 0, False: 0]
  ------------------
  327|      0|            size = curbuf;
  328|      0|    }
  329|       |
  330|      0|    return size;
  331|    132|#endif
  332|    132|}
snmpSocketBaseDomain.c:_sock_buffer_size_get:
  159|    132|{
  160|    132|    int size;
  161|       |
  162|    132|    if (NULL != buftype)
  ------------------
  |  Branch (162:9): [True: 132, False: 0]
  ------------------
  163|    132|        *buftype = _sock_buf_type_get(optname, local);
  164|       |
  165|    132|    if (optname == SO_SNDBUF) {
  ------------------
  |  Branch (165:9): [True: 66, False: 66]
  ------------------
  166|     66|        if (local) {
  ------------------
  |  Branch (166:13): [True: 66, False: 0]
  ------------------
  167|     66|            size = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  168|     66|                    NETSNMP_DS_LIB_SERVERSENDBUF);
  ------------------
  |  |  122|     66|#define NETSNMP_DS_LIB_SERVERSENDBUF        7 /* send buffer (server) */
  ------------------
  169|       |#ifdef NETSNMP_DEFAULT_SERVER_SEND_BUF
  170|       |            if (size <= 0)
  171|       |               size = NETSNMP_DEFAULT_SERVER_SEND_BUF;
  172|       |#endif
  173|     66|        } else {
  174|      0|            size = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  175|      0|                    NETSNMP_DS_LIB_CLIENTSENDBUF);
  ------------------
  |  |  124|      0|#define NETSNMP_DS_LIB_CLIENTSENDBUF        9 /* send buffer (client) */
  ------------------
  176|       |#ifdef NETSNMP_DEFAULT_CLIENT_SEND_BUF
  177|       |            if (size <= 0)
  178|       |               size = NETSNMP_DEFAULT_CLIENT_SEND_BUF;
  179|       |#endif
  180|      0|        }
  181|     66|    } else if (optname == SO_RCVBUF) {
  ------------------
  |  Branch (181:16): [True: 66, False: 0]
  ------------------
  182|     66|        if (local) {
  ------------------
  |  Branch (182:13): [True: 66, False: 0]
  ------------------
  183|     66|            size = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  184|     66|                    NETSNMP_DS_LIB_SERVERRECVBUF);
  ------------------
  |  |  123|     66|#define NETSNMP_DS_LIB_SERVERRECVBUF        8 /* receive buffer (server) */
  ------------------
  185|       |#ifdef NETSNMP_DEFAULT_SERVER_RECV_BUF
  186|       |            if (size <= 0)
  187|       |               size = NETSNMP_DEFAULT_SERVER_RECV_BUF;
  188|       |#endif
  189|     66|        } else {
  190|      0|            size = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  191|      0|                    NETSNMP_DS_LIB_CLIENTRECVBUF);
  ------------------
  |  |  125|      0|#define NETSNMP_DS_LIB_CLIENTRECVBUF       10 /* receive buffer (client) */
  ------------------
  192|       |#ifdef NETSNMP_DEFAULT_CLIENT_RECV_BUF
  193|       |            if (size <= 0)
  194|       |               size = NETSNMP_DEFAULT_CLIENT_RECV_BUF;
  195|       |#endif
  196|      0|        }
  197|     66|    } else {
  198|      0|        size = 0;
  199|      0|    }
  200|       |
  201|    132|    DEBUGMSGTL(("socket:buffer", "Requested %s is %d\n",
  ------------------
  |  |   66|    132|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    132|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 132]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 132]
  |  |  ------------------
  ------------------
  202|    132|                (buftype) ? *buftype : "unknown buffer", size));
  203|       |
  204|    132|    return(size);
  205|    132|}
snmpSocketBaseDomain.c:_sock_buf_type_get:
  132|    132|{
  133|    132|    if (optname == SO_SNDBUF) {
  ------------------
  |  Branch (133:9): [True: 66, False: 66]
  ------------------
  134|     66|        if (local)
  ------------------
  |  Branch (134:13): [True: 66, False: 0]
  ------------------
  135|     66|            return "server send buffer";
  136|      0|        else
  137|      0|            return "client send buffer";
  138|     66|    } else if (optname == SO_RCVBUF) {
  ------------------
  |  Branch (138:16): [True: 66, False: 0]
  ------------------
  139|     66|        if (local)
  ------------------
  |  Branch (139:13): [True: 66, False: 0]
  ------------------
  140|     66|            return "server receive buffer";
  141|      0|        else
  142|      0|            return "client receive buffer";
  143|     66|    }
  144|       |
  145|      0|    return "unknown buffer";
  146|    132|}

netsnmp_tcp_ctor:
  347|     66|{
  348|     66|    tcpDomain.name = netsnmp_snmpTCPDomain;
  349|     66|    tcpDomain.name_length = OID_LENGTH(netsnmp_snmpTCPDomain);
  ------------------
  |  |   64|     66|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     66|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  350|     66|    tcpDomain.prefix = calloc(2, sizeof(char *));
  351|     66|    if (!tcpDomain.prefix) {
  ------------------
  |  Branch (351:9): [True: 0, False: 66]
  ------------------
  352|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  353|      0|        return;
  354|      0|    }
  355|     66|    tcpDomain.prefix[0] = "tcp";
  356|       |
  357|     66|    tcpDomain.f_create_from_tstring_new = netsnmp_tcp_create_tstring;
  358|     66|    tcpDomain.f_create_from_ostring     = netsnmp_tcp_create_ostring;
  359|       |
  360|     66|    netsnmp_tdomain_register(&tcpDomain);
  361|     66|}

netsnmp_tcpipv6_ctor:
  365|     66|{
  366|     66|    tcp6Domain.name = netsnmp_TCPIPv6Domain;
  367|     66|    tcp6Domain.name_length = OID_LENGTH(netsnmp_TCPIPv6Domain);
  ------------------
  |  |   64|     66|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     66|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  368|     66|    tcp6Domain.f_create_from_tstring_new = netsnmp_tcp6_create_tstring;
  369|     66|    tcp6Domain.f_create_from_ostring     = netsnmp_tcp6_create_ostring;
  370|     66|    tcp6Domain.prefix = calloc(4, sizeof(char *));
  371|     66|    if (!tcp6Domain.prefix) {
  ------------------
  |  Branch (371:9): [True: 0, False: 66]
  ------------------
  372|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  373|      0|        return;
  374|      0|    }
  375|     66|    tcp6Domain.prefix[0] = "tcp6";
  376|     66|    tcp6Domain.prefix[1] = "tcpv6";
  377|     66|    tcp6Domain.prefix[2] = "tcpipv6";
  378|       |
  379|     66|    netsnmp_tdomain_register(&tcp6Domain);
  380|     66|}

netsnmp_tlsbase_ctor:
  896|     66|netsnmp_tlsbase_ctor(void) {
  897|       |
  898|       |    /* bootstrap ssl since we'll need it */
  899|     66|    netsnmp_init_openssl();
  900|       |
  901|       |    /* the private client cert to authenticate with */
  902|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "extraX509SubDir",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  903|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  904|     66|                               NETSNMP_DS_LIB_CERT_EXTRA_SUBDIR);
  ------------------
  |  |  177|     66|#define NETSNMP_DS_LIB_CERT_EXTRA_SUBDIR 26
  ------------------
  905|       |
  906|       |    /* Do we have a CRL list? */
  907|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "x509CRLFile",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  908|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  909|     66|                               NETSNMP_DS_LIB_X509_CRL_FILE);
  ------------------
  |  |  179|     66|#define NETSNMP_DS_LIB_X509_CRL_FILE     28
  ------------------
  910|       |
  911|       |    /* What TLS algorithms should be use */
  912|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "tlsAlgorithms",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  913|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  914|     66|                               NETSNMP_DS_LIB_TLS_ALGORITMS);
  ------------------
  |  |  180|     66|#define NETSNMP_DS_LIB_TLS_ALGORITMS     29
  ------------------
  915|       |
  916|       |    /* What TLS version should be used at least */
  917|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "tlsMinVersion",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  918|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  919|     66|                               NETSNMP_DS_LIB_TLS_MIN_VERSION);
  ------------------
  |  |  187|     66|#define NETSNMP_DS_LIB_TLS_MIN_VERSION   36
  ------------------
  920|       |
  921|       |    /* What TLS version should be used at max */
  922|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "tlsMaxVersion",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  923|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  924|     66|                               NETSNMP_DS_LIB_TLS_MAX_VERSION);
  ------------------
  |  |  188|     66|#define NETSNMP_DS_LIB_TLS_MAX_VERSION   37
  ------------------
  925|       |
  926|       |    /*
  927|       |     * for the client
  928|       |     */
  929|       |
  930|       |    /* the public client cert to authenticate with */
  931|     66|    register_config_handler("snmp", "clientCert", _parse_client_cert, NULL,
  932|     66|                            NULL);
  933|       |
  934|       |    /*
  935|       |     * for the server
  936|       |     */
  937|       |
  938|       |    /* The X509 server key to use */
  939|     66|    register_config_handler("snmp", "serverCert", _parse_server_cert, NULL,
  940|     66|                            NULL);
  941|       |    /*
  942|       |     * remove cert config ambiguity: localCert, peerCert
  943|       |     */
  944|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "localCert",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  945|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  946|     66|                               NETSNMP_DS_LIB_TLS_LOCAL_CERT);
  ------------------
  |  |  181|     66|#define NETSNMP_DS_LIB_TLS_LOCAL_CERT    30
  ------------------
  947|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "peerCert",
  ------------------
  |  |   78|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  948|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  949|     66|                               NETSNMP_DS_LIB_TLS_PEER_CERT);
  ------------------
  |  |  182|     66|#define NETSNMP_DS_LIB_TLS_PEER_CERT     31
  ------------------
  950|       |
  951|       |    /*
  952|       |     * register our boot-strapping needs
  953|       |     */
  954|     66|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
  955|     66|			   SNMP_CALLBACK_POST_PREMIB_READ_CONFIG,
  ------------------
  |  |   27|     66|#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG	3
  ------------------
  956|     66|			   tls_bootstrap, NULL);
  957|       |
  958|     66|}
snmpTLSBaseDomain.c:tls_bootstrap:
  848|     66|tls_bootstrap(int majorid, int minorid, void *serverarg, void *clientarg) {
  849|     66|    char indexname[] = "_netsnmp_verify_info";
  850|       |
  851|       |    /* don't do this more than once */
  852|     66|    if (have_done_bootstrap)
  ------------------
  |  Branch (852:9): [True: 65, False: 1]
  ------------------
  853|     65|        return 0;
  854|      1|    have_done_bootstrap = 1;
  855|       |
  856|      1|    netsnmp_certs_load();
  857|       |
  858|      1|    openssl_local_index =
  859|      1|        SSL_get_ex_new_index(0, indexname, NULL, NULL, NULL);
  860|       |
  861|      1|    return 0;
  862|     66|}

netsnmp_tlstcp_ctor:
 1074|     66|{
 1075|     66|    DEBUGMSGTL(("tlstcp", "registering TLS constructor\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
 1076|       |
 1077|       |    /* config settings */
 1078|       |
 1079|     66|    tlstcpDomain.name = netsnmpTLSTCPDomain;
 1080|     66|    tlstcpDomain.name_length = netsnmpTLSTCPDomain_len;
 1081|     66|    tlstcpDomain.prefix = calloc(3, sizeof(char *));
 1082|     66|    if (!tlstcpDomain.prefix) {
  ------------------
  |  Branch (1082:9): [True: 0, False: 66]
  ------------------
 1083|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
 1084|      0|        return;
 1085|      0|    }
 1086|     66|    tlstcpDomain.prefix[0] = "tlstcp";
 1087|     66|    tlstcpDomain.prefix[1] = "tls";
 1088|       |
 1089|     66|    tlstcpDomain.f_create_from_tstring_new = netsnmp_tlstcp_create_tstring;
 1090|     66|    tlstcpDomain.f_create_from_ostring     = netsnmp_tlstcp_create_ostring;
 1091|       |
 1092|     66|    netsnmp_tdomain_register(&tlstcpDomain);
 1093|     66|}

_netsnmp_udp_sockopt_set:
   69|     66|{
   70|     66|#ifdef  SO_BSDCOMPAT
   71|       |    /*
   72|       |     * Patch for Linux.  Without this, UDP packets that fail get an ICMP
   73|       |     * response.  Linux turns the failed ICMP response into an error message
   74|       |     * and return value, unlike all other OS's.  
   75|       |     */
   76|     66|    if (0 == netsnmp_os_prematch("Linux","2.4"))
  ------------------
  |  Branch (76:9): [True: 0, False: 66]
  ------------------
   77|      0|    {
   78|      0|        int             one = 1;
   79|      0|        DEBUGMSGTL(("socket:option", "setting socket option SO_BSDCOMPAT\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]
  |  |  ------------------
  ------------------
   80|      0|        setsockopt(fd, SOL_SOCKET, SO_BSDCOMPAT, (void *) &one,
   81|      0|                   sizeof(one));
   82|      0|    }
   83|     66|#endif                          /*SO_BSDCOMPAT */
   84|       |    /*
   85|       |     * SO_REUSEADDR will allow multiple apps to open the same port at
   86|       |     * the same time. Only the last one to open the socket will get
   87|       |     * data. Obviously, for an agent, this is a bad thing. There should
   88|       |     * only be one listener.
   89|       |     */
   90|       |#ifdef ALLOW_PORT_HIJACKING
   91|       |#ifdef  SO_REUSEADDR
   92|       |    /*
   93|       |     * Allow the same port to be specified multiple times without failing.
   94|       |     *    (useful for a listener)
   95|       |     */
   96|       |    {
   97|       |        int             one = 1;
   98|       |        DEBUGMSGTL(("socket:option", "setting socket option SO_REUSEADDR\n"));
   99|       |        setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *) &one,
  100|       |                   sizeof(one));
  101|       |    }
  102|       |#endif                          /*SO_REUSEADDR */
  103|       |#endif
  104|       |
  105|       |    /*
  106|       |     * Try to set the send and receive buffers to a reasonably large value, so
  107|       |     * that we can send and receive big PDUs (defaults to 8192 bytes (!) on
  108|       |     * Solaris, for instance).  Don't worry too much about errors -- just
  109|       |     * plough on regardless.  
  110|       |     */
  111|     66|    netsnmp_sock_buffer_set(fd, SO_SNDBUF, local, 0);
  112|       |    netsnmp_sock_buffer_set(fd, SO_RCVBUF, local, 0);
  113|     66|}
netsnmp_udpbase_recvfrom:
  144|     65|{
  145|     65|    int r;
  146|     65|#if !defined(WIN32)
  147|     65|    struct iovec iov;
  148|     65|    char cmsg[CMSG_SPACE(cmsg_data_size)];
  149|     65|    struct cmsghdr *cm;
  150|     65|    struct msghdr msg;
  151|       |
  152|     65|    iov.iov_base = buf;
  153|     65|    iov.iov_len = len;
  154|       |
  155|     65|    memset(&msg, 0, sizeof msg);
  156|     65|    msg.msg_name = from;
  157|     65|    msg.msg_namelen = *fromlen;
  158|     65|    msg.msg_iov = &iov;
  159|     65|    msg.msg_iovlen = 1;
  160|     65|    msg.msg_control = &cmsg;
  161|     65|    msg.msg_controllen = sizeof(cmsg);
  162|       |
  163|     65|    r = recvmsg(s, &msg, MSG_DONTWAIT);
  164|       |#else /* !defined(WIN32) */
  165|       |    WSABUF wsabuf;
  166|       |    char cmsg[WSA_CMSG_SPACE(sizeof(struct in_pktinfo))];
  167|       |    WSACMSGHDR *cm;
  168|       |    WSAMSG msg;
  169|       |    DWORD bytes_received;
  170|       |
  171|       |    wsabuf.buf = buf;
  172|       |    wsabuf.len = len;
  173|       |
  174|       |    msg.name = from;
  175|       |    msg.namelen = *fromlen;
  176|       |    msg.lpBuffers = &wsabuf;
  177|       |    msg.dwBufferCount = 1;
  178|       |    msg.Control.len = sizeof(cmsg);
  179|       |    msg.Control.buf = cmsg;
  180|       |    msg.dwFlags = 0;
  181|       |
  182|       |    if (pfWSARecvMsg) {
  183|       |        r = pfWSARecvMsg(s, &msg, &bytes_received, NULL, NULL) == 0 ?
  184|       |            bytes_received : -1;
  185|       |        *fromlen = msg.namelen;
  186|       |    } else {
  187|       |        r = recvfrom(s, buf, len, MSG_DONTWAIT, from, fromlen);
  188|       |    }
  189|       |#endif /* !defined(WIN32) */
  190|       |
  191|     65|    if (r == -1) {
  ------------------
  |  Branch (191:9): [True: 0, False: 65]
  ------------------
  192|      0|        return -1;
  193|      0|    }
  194|       |
  195|     65|    DEBUGMSGTL(("udpbase:recv", "got source addr: %s\n",
  ------------------
  |  |   66|     65|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 65]
  |  |  ------------------
  ------------------
  196|     65|                inet_ntoa(((struct sockaddr_in *)from)->sin_addr)));
  197|       |
  198|     65|    {
  199|       |        /* Get the local port number for use in diagnostic messages */
  200|     65|        int r2 = getsockname(s, dstip, dstlen);
  201|     65|        netsnmp_assert(r2 == 0);
  ------------------
  |  |   47|     65|#      define netsnmp_assert(x)  do { \
  |  |   48|     65|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 65, False: 0]
  |  |  ------------------
  |  |   49|     65|                 ; \
  |  |   50|     65|              else \
  |  |   51|     65|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     65|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 65]
  |  |  ------------------
  ------------------
  202|     65|    }
  203|       |
  204|     65|#if !defined(WIN32)
  205|    130|    for (cm = CMSG_FIRSTHDR(&msg); cm != NULL; cm = CMSG_NXTHDR(&msg, cm)) {
  ------------------
  |  Branch (205:15): [True: 65, False: 0]
  |  Branch (205:36): [True: 65, False: 65]
  ------------------
  206|     65|#if defined(HAVE_IP_PKTINFO)
  207|     65|        if (cm->cmsg_level == SOL_IP && cm->cmsg_type == IP_PKTINFO) {
  ------------------
  |  Branch (207:13): [True: 65, False: 0]
  |  Branch (207:41): [True: 65, False: 0]
  ------------------
  208|     65|            struct in_pktinfo* src = (struct in_pktinfo *)CMSG_DATA(cm);
  209|     65|            netsnmp_assert(dstip->sa_family == AF_INET);
  ------------------
  |  |   47|     65|#      define netsnmp_assert(x)  do { \
  |  |   48|     65|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 65, False: 0]
  |  |  ------------------
  |  |   49|     65|                 ; \
  |  |   50|     65|              else \
  |  |   51|     65|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     65|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 65]
  |  |  ------------------
  ------------------
  210|     65|            ((struct sockaddr_in*)dstip)->sin_addr = src->ipi_addr;
  211|     65|            *if_index = src->ipi_ifindex;
  212|     65|            DEBUGMSGTL(("udpbase:recv",
  ------------------
  |  |   66|     65|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 65]
  |  |  ------------------
  ------------------
  213|     65|                        "got destination (local) addr %s, iface %d\n",
  214|     65|                        inet_ntoa(src->ipi_addr), *if_index));
  215|     65|        }
  216|       |#elif defined(HAVE_IP_RECVDSTADDR)
  217|       |        if (cm->cmsg_level == IPPROTO_IP && cm->cmsg_type == IP_RECVDSTADDR) {
  218|       |            struct in_addr* src = (struct in_addr *)CMSG_DATA(cm);
  219|       |            ((struct sockaddr_in*)dstip)->sin_addr = *src;
  220|       |            DEBUGMSGTL(("netsnmp_udp", "got destination (local) addr %s\n",
  221|       |                        inet_ntoa(*src)));
  222|       |        }
  223|       |#endif
  224|     65|    }
  225|       |#else /* !defined(WIN32) */
  226|       |    for (cm = WSA_CMSG_FIRSTHDR(&msg); cm; cm = WSA_CMSG_NXTHDR(&msg, cm)) {
  227|       |        if (cm->cmsg_level == IPPROTO_IP && cm->cmsg_type == IP_PKTINFO) {
  228|       |            struct in_pktinfo* src = (struct in_pktinfo *)WSA_CMSG_DATA(cm);
  229|       |            netsnmp_assert(dstip->sa_family == AF_INET);
  230|       |            ((struct sockaddr_in*)dstip)->sin_addr = src->ipi_addr;
  231|       |            *if_index = src->ipi_ifindex;
  232|       |            DEBUGMSGTL(("udpbase:recv",
  233|       |                        "got destination (local) addr %s, iface %d\n",
  234|       |                        inet_ntoa(src->ipi_addr), *if_index));
  235|       |        }
  236|       |    }
  237|       |#endif /* !defined(WIN32) */
  238|     65|    return r;
  239|     65|}
netsnmp_udpbase_sendto_unix:
  245|      3|{
  246|      3|    struct iovec iov;
  247|      3|    struct msghdr m = { NULL };
  248|      3|    char          cmsg[CMSG_SPACE(cmsg_data_size)];
  249|      3|    int           rc;
  250|      3|    char          iface[IFNAMSIZ];
  251|      3|    socklen_t     ifacelen = IFNAMSIZ;
  252|       |
  253|      3|    iov.iov_base = NETSNMP_REMOVE_CONST(void *, data);
  ------------------
  |  |   91|      3|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  254|      3|    iov.iov_len  = len;
  255|       |
  256|      3|    m.msg_name		= NETSNMP_REMOVE_CONST(void *, remote);
  ------------------
  |  |   91|      3|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  257|      3|    m.msg_namelen	= sizeof(struct sockaddr_in);
  258|      3|    m.msg_iov		= &iov;
  259|      3|    m.msg_iovlen	= 1;
  260|      3|    m.msg_flags		= 0;
  261|       |
  262|      3|    if (srcip && srcip->s_addr != INADDR_ANY) {
  ------------------
  |  Branch (262:9): [True: 3, False: 0]
  |  Branch (262:18): [True: 3, False: 0]
  ------------------
  263|      3|        struct cmsghdr *cm;
  264|      3|        struct in_pktinfo ipi;
  265|      3|        int use_sendto = FALSE;
  ------------------
  |  |  125|      3|#define FALSE 0
  ------------------
  266|       |
  267|      3|        memset(cmsg, 0, sizeof(cmsg));
  268|       |
  269|      3|        m.msg_control    = &cmsg;
  270|      3|        m.msg_controllen = sizeof(cmsg);
  271|       |
  272|      3|        cm = CMSG_FIRSTHDR(&m);
  ------------------
  |  Branch (272:14): [True: 3, False: 0]
  ------------------
  273|      3|        cm->cmsg_len = CMSG_LEN(cmsg_data_size);
  274|       |
  275|      3|#if defined(HAVE_IP_PKTINFO)
  276|      3|        cm->cmsg_level = SOL_IP;
  277|      3|        cm->cmsg_type = IP_PKTINFO;
  278|       |
  279|      3|        memset(&ipi, 0, sizeof(ipi));
  280|      3|#ifdef HAVE_SO_BINDTODEVICE
  281|       |        /*
  282|       |         * For asymmetric multihomed users, we only set ifindex to 0 to
  283|       |         * let kernel handle return if there was no iface bound to the
  284|       |         * socket.
  285|       |         */
  286|      3|        if (getsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, iface,
  ------------------
  |  Branch (286:13): [True: 0, False: 3]
  ------------------
  287|      3|                       &ifacelen) != 0)  {
  288|      0|            DEBUGMSGTL(("udpbase:sendto",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  289|      0|                        "getsockopt SO_BINDTODEVICE failed: %s\n",
  290|      0|                        strerror(errno)));
  291|      3|        } else if (ifacelen == 0) {
  ------------------
  |  Branch (291:20): [True: 3, False: 0]
  ------------------
  292|      3|            DEBUGMSGTL(("udpbase:sendto",
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 3]
  |  |  ------------------
  ------------------
  293|      3|                        "sendto: SO_BINDTODEVICE not set\n"));
  294|      3|        } else {
  295|      0|            DEBUGMSGTL(("udpbase:sendto",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  296|      0|                        "sendto: SO_BINDTODEVICE dev=%s using ifindex=%d\n",
  297|      0|                        iface, if_index));
  298|      0|            use_sendto = TRUE;
  ------------------
  |  |  128|      0|#define TRUE  1
  ------------------
  299|      0|        }
  300|      3|#endif /* HAVE_SO_BINDTODEVICE */
  301|       |
  302|      3|#ifdef HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST
  303|      3|        DEBUGMSGTL(("udpbase:sendto", "sending from %s\n",
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 3]
  |  |  ------------------
  ------------------
  304|      3|                    inet_ntoa(*srcip)));
  305|      3|        ipi.ipi_spec_dst.s_addr = srcip->s_addr;
  306|       |#else
  307|       |        DEBUGMSGTL(("udpbase:sendto", "ignoring from address %s\n",
  308|       |                    inet_ntoa(*srcip)));
  309|       |#endif
  310|      3|        memcpy(CMSG_DATA(cm), &ipi, sizeof(ipi));
  311|       |
  312|       |        /*
  313|       |         * For Linux and VRF, use sendto() instead of sendmsg(). Do not pass a
  314|       |         * cmsg with IP_PKTINFO set because that would override the bind to
  315|       |         * VRF which is set by 'vrf exec' command. That would break VRF.
  316|       |         */
  317|      3|        if (use_sendto)
  ------------------
  |  Branch (317:13): [True: 0, False: 3]
  ------------------
  318|      0|            rc = sendto(fd, data, len, MSG_DONTWAIT, remote,
  319|      0|                        sizeof(struct sockaddr));
  320|      3|        else
  321|      3|            rc = sendmsg(fd, &m, MSG_DONTWAIT);
  322|      3|        if (rc >= 0 || (errno != EINVAL && errno != ENETUNREACH))
  ------------------
  |  Branch (322:13): [True: 3, False: 0]
  |  Branch (322:25): [True: 0, False: 0]
  |  Branch (322:44): [True: 0, False: 0]
  ------------------
  323|      3|            return rc;
  324|       |
  325|       |        /*
  326|       |         * The error might be caused by broadcast srcip (i.e. we're responding
  327|       |         * to a broadcast request) - sendmsg does not like it. Try to resend it
  328|       |         * using the interface on which it was received
  329|       |         */
  330|       |
  331|      0|        DEBUGMSGTL(("udpbase:sendto", "re-sending on iface %d\n", if_index));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  332|       |
  333|      0|        {
  334|      0|            struct in_pktinfo ipi;
  335|       |
  336|      0|            memset(&ipi, 0, sizeof(ipi));
  337|      0|            ipi.ipi_ifindex = if_index;
  338|      0|#ifdef HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST
  339|      0|            ipi.ipi_spec_dst.s_addr = INADDR_ANY;
  340|      0|#endif
  341|      0|            memcpy(CMSG_DATA(cm), &ipi, sizeof(ipi));
  342|      0|        }
  343|       |#elif defined(HAVE_IP_SENDSRCADDR)
  344|       |        cm->cmsg_level = IPPROTO_IP;
  345|       |        cm->cmsg_type = IP_SENDSRCADDR;
  346|       |        memcpy((struct in_addr *)CMSG_DATA(cm), srcip, sizeof(struct in_addr));
  347|       |#endif
  348|      0|        rc = sendmsg(fd, &m, MSG_DONTWAIT);
  349|      0|        if (rc >= 0 || errno != EINVAL)
  ------------------
  |  Branch (349:13): [True: 0, False: 0]
  |  Branch (349:24): [True: 0, False: 0]
  ------------------
  350|      0|            return rc;
  351|       |
  352|      0|        DEBUGMSGTL(("udpbase:sendto", "re-sending without source address\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]
  |  |  ------------------
  ------------------
  353|      0|        m.msg_control = NULL;
  354|      0|        m.msg_controllen = 0;
  355|      0|    }
  356|       |
  357|      0|    return sendmsg(fd, &m, MSG_DONTWAIT);
  358|      3|}
netsnmp_udpbase_sendto:
  416|      3|{
  417|      3|#if !defined(WIN32)
  418|      3|    return netsnmp_udpbase_sendto_unix(fd, srcip, if_index, remote, data, len);
  419|       |#else /* !defined(WIN32) */
  420|       |    return netsnmp_udpbase_sendto_win32(fd, srcip, if_index, remote, data, len);
  421|       |#endif /* !defined(WIN32) */
  422|      3|}
netsnmp_udpbase_recv:
  434|     65|{
  435|     65|    int             rc = -1;
  436|     65|    socklen_t       fromlen = sizeof(netsnmp_sockaddr_storage);
  437|     65|    netsnmp_indexed_addr_pair *addr_pair = NULL;
  438|     65|    struct sockaddr *from;
  439|       |
  440|     65|    if (t != NULL && t->sock >= 0) {
  ------------------
  |  Branch (440:9): [True: 65, False: 0]
  |  Branch (440:22): [True: 65, False: 0]
  ------------------
  441|     65|        addr_pair = SNMP_MALLOC_TYPEDEF(netsnmp_indexed_addr_pair);
  ------------------
  |  |   73|     65|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  442|     65|        if (addr_pair == NULL) {
  ------------------
  |  Branch (442:13): [True: 0, False: 65]
  ------------------
  443|      0|            *opaque = NULL;
  444|      0|            *olength = 0;
  445|      0|            return -1;
  446|      0|        } else
  447|     65|            from = &addr_pair->remote_addr.sa;
  448|       |
  449|    130|	while (rc < 0) {
  ------------------
  |  Branch (449:9): [True: 65, False: 65]
  ------------------
  450|     65|#ifdef netsnmp_udpbase_recvfrom_sendto_defined
  451|     65|            socklen_t local_addr_len = sizeof(addr_pair->local_addr);
  452|     65|            rc = netsnmp_udp_recvfrom(t->sock, buf, size, from, &fromlen,
  453|     65|                                      &addr_pair->local_addr.sa,
  454|     65|                                      &local_addr_len, &(addr_pair->if_index));
  455|       |#else
  456|       |            rc = recvfrom(t->sock, buf, size, MSG_DONTWAIT, from, &fromlen);
  457|       |#endif /* netsnmp_udpbase_recvfrom_sendto_defined */
  458|     65|	    if (rc < 0 && errno != EINTR) {
  ------------------
  |  Branch (458:10): [True: 0, False: 65]
  |  Branch (458:20): [True: 0, False: 0]
  ------------------
  459|      0|		break;
  460|      0|	    }
  461|     65|	}
  462|       |
  463|     65|        if (rc >= 0) {
  ------------------
  |  Branch (463:13): [True: 65, False: 0]
  ------------------
  464|     65|            DEBUGIF("netsnmp_udp") {
  ------------------
  |  |  145|     65|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|    130|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  465|      0|                char *str = netsnmp_udp_fmtaddr(
  466|      0|                    NULL, addr_pair, sizeof(netsnmp_indexed_addr_pair));
  467|      0|                DEBUGMSGTL(("netsnmp_udp",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  468|      0|                            "recvfrom fd %d got %d bytes (from %s)\n",
  469|      0|                            t->sock, rc, str));
  470|      0|                free(str);
  471|      0|            }
  472|     65|        } else {
  473|      0|            DEBUGMSGTL(("netsnmp_udp", "recvfrom fd %d err %d (\"%s\")\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]
  |  |  ------------------
  ------------------
  474|      0|                        t->sock, errno, strerror(errno)));
  475|      0|        }
  476|     65|        *opaque = (void *)addr_pair;
  477|     65|        *olength = sizeof(netsnmp_indexed_addr_pair);
  478|     65|    }
  479|     65|    return rc;
  480|     65|}
netsnmp_udpbase_send:
  487|      3|{
  488|      3|    int rc = -1;
  489|      3|    const netsnmp_indexed_addr_pair *addr_pair = NULL;
  490|      3|    const struct sockaddr *to = NULL;
  491|       |
  492|      3|    if (opaque != NULL && *opaque != NULL && NULL != olength &&
  ------------------
  |  Branch (492:9): [True: 3, False: 0]
  |  Branch (492:27): [True: 3, False: 0]
  |  Branch (492:46): [True: 3, False: 0]
  ------------------
  493|      3|        ((*olength == sizeof(netsnmp_indexed_addr_pair) ||
  ------------------
  |  Branch (493:11): [True: 3, False: 0]
  ------------------
  494|      3|          (*olength == sizeof(struct sockaddr_in))))) {
  ------------------
  |  Branch (494:11): [True: 0, False: 0]
  ------------------
  495|      3|        addr_pair = (const netsnmp_indexed_addr_pair *) (*opaque);
  496|      3|    } else if (t != NULL && t->data != NULL &&
  ------------------
  |  Branch (496:16): [True: 0, False: 0]
  |  Branch (496:29): [True: 0, False: 0]
  ------------------
  497|      0|                t->data_length == sizeof(netsnmp_indexed_addr_pair)) {
  ------------------
  |  Branch (497:17): [True: 0, False: 0]
  ------------------
  498|      0|        addr_pair = (netsnmp_indexed_addr_pair *) (t->data);
  499|      0|    } else {
  500|      0|        int len = -1;
  501|      0|        if (opaque != NULL && *opaque != NULL && NULL != olength)
  ------------------
  |  Branch (501:13): [True: 0, False: 0]
  |  Branch (501:31): [True: 0, False: 0]
  |  Branch (501:50): [True: 0, False: 0]
  ------------------
  502|      0|            len = *olength;
  503|      0|        else if (t != NULL && t->data != NULL)
  ------------------
  |  Branch (503:18): [True: 0, False: 0]
  |  Branch (503:31): [True: 0, False: 0]
  ------------------
  504|      0|            len = t->data_length;
  505|      0|        snmp_log(LOG_ERR, "unknown addr type of size %d\n", len);
  506|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  507|      0|    }
  508|       |
  509|      3|    to = &addr_pair->remote_addr.sa;
  510|       |
  511|      3|    if (to != NULL && t != NULL && t->sock >= 0) {
  ------------------
  |  Branch (511:9): [True: 3, False: 0]
  |  Branch (511:23): [True: 3, False: 0]
  |  Branch (511:36): [True: 3, False: 0]
  ------------------
  512|      3|        DEBUGIF("netsnmp_udp") {
  ------------------
  |  |  145|      3|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|      6|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  513|      0|            char *str = netsnmp_udp_fmtaddr(NULL, addr_pair,
  514|      0|                                            sizeof(netsnmp_indexed_addr_pair));
  515|      0|            DEBUGMSGTL(("netsnmp_udp", "send %d bytes from %p to %s on fd %d\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]
  |  |  ------------------
  ------------------
  516|      0|                        size, buf, str, t->sock));
  517|      0|            free(str);
  518|      0|        }
  519|      6|	while (rc < 0) {
  ------------------
  |  Branch (519:9): [True: 3, False: 3]
  ------------------
  520|      3|#ifdef netsnmp_udpbase_recvfrom_sendto_defined
  521|      3|            rc = netsnmp_udp_sendto(t->sock,
  522|      3|                    addr_pair ? &(addr_pair->local_addr.sin.sin_addr) : NULL,
  ------------------
  |  Branch (522:21): [True: 3, False: 0]
  ------------------
  523|      3|                    addr_pair ? addr_pair->if_index : 0, to, buf, size);
  ------------------
  |  Branch (523:21): [True: 3, False: 0]
  ------------------
  524|       |#else
  525|       |            rc = sendto(t->sock, buf, size, 0, to, sizeof(struct sockaddr));
  526|       |#endif /* netsnmp_udpbase_recvfrom_sendto_defined */
  527|      3|	    if (rc < 0 && errno != EINTR) {
  ------------------
  |  Branch (527:10): [True: 0, False: 3]
  |  Branch (527:20): [True: 0, False: 0]
  ------------------
  528|      0|                DEBUGMSGTL(("netsnmp_udp", "sendto error, rc %d (errno %d)\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]
  |  |  ------------------
  ------------------
  529|      0|                            rc, errno));
  530|      0|		break;
  531|      0|	    }
  532|      3|	}
  533|      3|    }
  534|      3|    return rc;
  535|      3|}

netsnmp_udp_recvfrom:
  156|     65|{
  157|       |    /** udpipv4 just calls udpbase. should we skip directly to there? */
  158|     65|    return netsnmp_udpipv4_recvfrom(s, buf, len, from, fromlen, dstip, dstlen,
  159|     65|                                    if_index);
  160|     65|}
netsnmp_udp_sendto:
  164|      3|{
  165|       |    /** udpipv4 just calls udpbase. should we skip directly to there? */
  166|      3|    return netsnmp_udpipv4_sendto(fd, srcip, if_index, remote, data, len);
  167|      3|}
netsnmp_udp_create_tspec:
  683|     66|{
  684|     66|    netsnmp_transport *t = netsnmp_udpipv4base_tspec_transport(tspec);
  685|     66|    if (NULL != t) {
  ------------------
  |  Branch (685:9): [True: 66, False: 0]
  ------------------
  686|     66|        netsnmp_udp_transport_base(t);
  687|     66|    }
  688|     66|    return t;
  689|       |
  690|     66|}
netsnmp_udp_ctor:
  706|     66|{
  707|     66|    udpDomain.name = netsnmpUDPDomain;
  708|     66|    udpDomain.name_length = netsnmpUDPDomain_len;
  709|     66|    udpDomain.prefix = calloc(2, sizeof(char *));
  710|     66|    if (!udpDomain.prefix) {
  ------------------
  |  Branch (710:9): [True: 0, False: 66]
  ------------------
  711|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  712|      0|        return;
  713|      0|    }
  714|     66|    udpDomain.prefix[0] = "udp";
  715|       |
  716|     66|    udpDomain.f_create_from_tstring_new = netsnmp_udp_create_tstring;
  717|     66|    udpDomain.f_create_from_tspec       = netsnmp_udp_create_tspec;
  718|     66|    udpDomain.f_create_from_ostring     = netsnmp_udp_create_ostring;
  719|       |
  720|     66|    netsnmp_tdomain_register(&udpDomain);
  721|     66|}
snmpUDPDomain.c:netsnmp_udp_transport_base:
  176|     66|{
  177|     66|    if (NULL == t) {
  ------------------
  |  Branch (177:9): [True: 0, False: 66]
  ------------------
  178|      0|        return NULL;
  179|      0|    }
  180|       |
  181|       |    /*
  182|       |     * Set Domain
  183|       |     */
  184|       |
  185|     66|    t->domain = netsnmpUDPDomain;
  186|     66|    t->domain_length = netsnmpUDPDomain_len;
  187|       |
  188|       |    /*
  189|       |     * 16-bit length field, 8 byte UDP header, 20 byte IPv4 header  
  190|       |     */
  191|       |
  192|     66|    t->msgMaxSize = 0xffff - 8 - 20;
  193|     66|    t->f_recv     = netsnmp_udpbase_recv;
  194|     66|    t->f_send     = netsnmp_udpbase_send;
  195|     66|    t->f_close    = netsnmp_socketbase_close;
  196|     66|    t->f_accept   = NULL;
  197|     66|    t->f_setup_session = netsnmp_ipbase_session_init;
  198|     66|    t->f_fmtaddr  = netsnmp_udp_fmtaddr;
  199|     66|    t->f_get_taddr = netsnmp_ipv4_get_taddr;
  200|       |
  201|     66|    return t;
  202|     66|}

netsnmp_udpipv4_recvfrom:
   62|     65|{
   63|     65|    return netsnmp_udpbase_recvfrom(s, buf, len, from, fromlen, dstip, dstlen,
   64|     65|                                    if_index);
   65|     65|}
netsnmp_udpipv4_sendto:
   70|      3|{
   71|      3|    return netsnmp_udpbase_sendto(fd, srcip, if_index, remote, data, len);
   72|      3|}
netsnmp_udpipv4base_transport_init:
   77|     66|{
   78|     66|    netsnmp_transport *t;
   79|     66|    const struct sockaddr_in *addr = &ep->a.sin;
   80|     66|    u_char *addr_ptr;
   81|       |
   82|     66|    if (addr == NULL || addr->sin_family != AF_INET) {
  ------------------
  |  Branch (82:9): [True: 0, False: 66]
  |  Branch (82:25): [True: 0, False: 66]
  ------------------
   83|      0|        return NULL;
   84|      0|    }
   85|       |
   86|     66|    t = SNMP_MALLOC_TYPEDEF(netsnmp_transport);
  ------------------
  |  |   73|     66|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
   87|     66|    if (NULL == t)
  ------------------
  |  Branch (87:9): [True: 0, False: 66]
  ------------------
   88|      0|        return NULL;
   89|       |
   90|     66|    t->sock = -1;
   91|       |
   92|     66|    addr_ptr = netsnmp_memdup(addr, sizeof(*addr));
   93|     66|    if (NULL == addr_ptr) {
  ------------------
  |  Branch (93:9): [True: 0, False: 66]
  ------------------
   94|      0|        free(t);
   95|      0|        return NULL;
   96|      0|    }
   97|       |
   98|     66|    if (local) {
  ------------------
  |  Branch (98:9): [True: 66, False: 0]
  ------------------
   99|       |        /** This is a server session. */
  100|     66|        t->local_length = sizeof(*addr);
  101|     66|        t->local = addr_ptr;
  102|     66|    } else {
  103|       |        /** This is a client session. */
  104|      0|        t->remote = addr_ptr;
  105|      0|        t->remote_length = sizeof(*addr);
  106|      0|    }
  107|       |
  108|     66|    DEBUGIF("netsnmp_udpbase") {
  ------------------
  |  |  145|     66|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|    132|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  109|      0|        netsnmp_indexed_addr_pair addr_pair;
  110|      0|        char                      *str;
  111|      0|        memset(&addr_pair, 0, sizeof(netsnmp_indexed_addr_pair));
  112|      0|        memcpy(&(addr_pair.remote_addr), addr, sizeof(*addr));
  113|      0|        str = netsnmp_udp_fmtaddr(NULL, (void *)&addr_pair,
  114|      0|                                  sizeof(netsnmp_indexed_addr_pair));
  115|      0|        DEBUGMSGTL(("netsnmp_udpbase", "open %s %s\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 (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  116|      0|                    local ? "local" : "remote", str));
  117|      0|        free(str);
  118|      0|    }
  119|       |
  120|     66|    if (!local) {
  ------------------
  |  Branch (120:9): [True: 0, False: 66]
  ------------------
  121|      0|        netsnmp_indexed_addr_pair *addr_pair;
  122|       |
  123|       |        /*
  124|       |         * allocate space to save the (remote) address in the
  125|       |         * transport-specific data pointer for later use by netsnmp_udp_send.
  126|       |         */
  127|      0|        t->data = calloc(1, sizeof(netsnmp_indexed_addr_pair));
  128|      0|        if (NULL == t->data) {
  ------------------
  |  Branch (128:13): [True: 0, False: 0]
  ------------------
  129|      0|            netsnmp_transport_free(t);
  130|      0|            return NULL;
  131|      0|        }
  132|      0|        t->data_length = sizeof(netsnmp_indexed_addr_pair);
  133|       |
  134|      0|        addr_pair = (netsnmp_indexed_addr_pair *)t->data;
  135|      0|        memcpy(&addr_pair->remote_addr, addr, sizeof(*addr));
  136|      0|    }
  137|     66|    return t;
  138|     66|}
netsnmp_udpipv4base_transport_socket:
  142|     66|{
  143|     66|    int local = flags & NETSNMP_TSPEC_LOCAL;
  ------------------
  |  |  117|     66|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  144|     66|    int sock = socket(PF_INET, SOCK_DGRAM, 0);
  145|       |
  146|     66|    DEBUGMSGTL(("UDPBase", "opened socket %d as local=%d\n", sock, local));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  147|     66|    if (sock < 0)
  ------------------
  |  Branch (147:9): [True: 0, False: 66]
  ------------------
  148|      0|        return -1;
  149|       |
  150|     66|    _netsnmp_udp_sockopt_set(sock, local);
  151|       |
  152|     66|    return sock;
  153|     66|}
netsnmp_udpipv4base_transport_bind:
  158|     66|{
  159|     66|    const struct sockaddr_in *addr = &ep->a.sin;
  160|     66|#if defined(HAVE_IP_PKTINFO) || defined(HAVE_IP_RECVDSTADDR) || defined(WIN32)
  161|     66|    int                sockopt = 1;
  162|     66|#endif
  163|     66|    int                rc;
  164|       |
  165|     66|    if (flags & NETSNMP_TSPEC_LOCAL) {
  ------------------
  |  |  117|     66|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  |  Branch (165:9): [True: 66, False: 0]
  ------------------
  166|       |#ifdef NETSNMP_NO_LISTEN_SUPPORT
  167|       |        return NULL;
  168|       |#endif /* NETSNMP_NO_LISTEN_SUPPORT */
  169|     66|#if defined(HAVE_IP_PKTINFO) && !defined(WIN32)
  170|     66|        if (setsockopt(t->sock, SOL_IP, IP_PKTINFO, &sockopt, sizeof sockopt) == -1) {
  ------------------
  |  Branch (170:13): [True: 0, False: 66]
  ------------------
  171|      0|            DEBUGMSGTL(("netsnmp_udpbase", "couldn't set IP_PKTINFO: %s\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]
  |  |  ------------------
  ------------------
  172|      0|                        strerror(errno)));
  173|      0|            return 1;
  174|      0|        }
  175|     66|        DEBUGMSGTL(("netsnmp_udpbase", "set IP_PKTINFO\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 66]
  |  |  ------------------
  ------------------
  176|       |#elif defined(HAVE_IP_RECVDSTADDR)
  177|       |        if (setsockopt(t->sock, IPPROTO_IP, IP_RECVDSTADDR, &sockopt, sizeof sockopt) == -1) {
  178|       |            DEBUGMSGTL(("netsnmp_udp", "couldn't set IP_RECVDSTADDR: %s\n",
  179|       |                        strerror(errno)));
  180|       |            return 1;
  181|       |        }
  182|       |        DEBUGMSGTL(("netsnmp_udp", "set IP_RECVDSTADDR\n"));
  183|       |#elif defined(WIN32)
  184|       |        if (setsockopt(t->sock, IPPROTO_IP, IP_PKTINFO, (void *)&sockopt,
  185|       |                       sizeof(sockopt)) == -1) {
  186|       |            DEBUGMSGTL(("netsnmp_udpbase", "couldn't set IP_PKTINFO: %d\n",
  187|       |                        WSAGetLastError()));
  188|       |        } else {
  189|       |            DEBUGMSGTL(("netsnmp_udpbase", "set IP_PKTINFO\n"));
  190|       |        }
  191|       |#endif
  192|     66|    }
  193|       |
  194|     66|    DEBUGIF("netsnmp_udpbase") {
  ------------------
  |  |  145|     66|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|    132|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  195|      0|        netsnmp_indexed_addr_pair addr_pair;
  196|      0|        char *str;
  197|      0|        memset(&addr_pair, 0x0, sizeof(addr_pair));
  198|      0|        memcpy(&(addr_pair.local_addr), addr, sizeof(*addr));
  199|      0|        str = netsnmp_udp_fmtaddr(NULL, (void *)&addr_pair,
  200|      0|                                  sizeof(netsnmp_indexed_addr_pair));
  201|      0|        DEBUGMSGTL(("netsnmp_udpbase", "binding socket: %d to %s\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]
  |  |  ------------------
  ------------------
  202|      0|                    t->sock, str));
  203|      0|        free(str);
  204|      0|    }
  205|     66|    if (flags & NETSNMP_TSPEC_PREBOUND) {
  ------------------
  |  |  118|     66|#define NETSNMP_TSPEC_PREBOUND                  0x02 /* 1=bound by systemd, 0=needs bind in the library */
  ------------------
  |  Branch (205:9): [True: 0, False: 66]
  ------------------
  206|      0|        DEBUGMSGTL(("netsnmp_udpbase", "socket %d is prebound, nothing to do\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]
  |  |  ------------------
  ------------------
  207|      0|                    t->sock));
  208|      0|        return 0;
  209|      0|    }
  210|     66|    rc = netsnmp_bindtodevice(t->sock, ep->iface);
  211|     66|    if (rc != 0) {
  ------------------
  |  Branch (211:9): [True: 0, False: 66]
  ------------------
  212|      0|        DEBUGMSGTL(("netsnmp_udpbase", "failed to bind to iface %s: %s\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]
  |  |  ------------------
  ------------------
  213|      0|                    ep->iface, strerror(errno)));
  214|      0|        goto err;
  215|      0|    }
  216|     66|    rc = bind(t->sock, (const struct sockaddr *)addr, sizeof(*addr));
  217|     66|    if ( rc != 0 ) {
  ------------------
  |  Branch (217:10): [True: 0, False: 66]
  ------------------
  218|      0|        DEBUGMSGTL(("netsnmp_udpbase",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  219|      0|                    "failed to bind for clientaddr: %d %s\n",
  220|      0|                    errno, strerror(errno)));
  221|      0|        goto err;
  222|      0|    }
  223|       |
  224|     66|    return 0;
  225|       |
  226|      0|err:
  227|      0|    netsnmp_socketbase_close(t);
  228|      0|    return 1;
  229|     66|}
netsnmp_udpipv4base_transport_with_source:
  265|     66|{
  266|     66|    netsnmp_transport         *t = NULL;
  267|     66|    const struct netsnmp_ep   *bind_addr;
  268|     66|    int                        rc, flags = 0;
  269|       |
  270|     66|    t = netsnmp_udpipv4base_transport_init(ep, local);
  271|     66|    if (NULL == t)
  ------------------
  |  Branch (271:9): [True: 0, False: 66]
  ------------------
  272|      0|         return NULL;
  273|       |
  274|     66|    if (local) {
  ------------------
  |  Branch (274:9): [True: 66, False: 0]
  ------------------
  275|     66|        bind_addr = ep;
  276|     66|        flags |= NETSNMP_TSPEC_LOCAL;
  ------------------
  |  |  117|     66|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  277|       |
  278|     66|#ifndef NETSNMP_NO_SYSTEMD
  279|       |        /*
  280|       |         * Maybe the socket was already provided by systemd...
  281|       |         */
  282|     66|        t->sock = netsnmp_sd_find_inet_socket(PF_INET, SOCK_DGRAM, -1,
  283|     66|                                              ntohs(ep->a.sin.sin_port));
  284|     66|        if (t->sock >= 0)
  ------------------
  |  Branch (284:13): [True: 0, False: 66]
  ------------------
  285|      0|            flags |= NETSNMP_TSPEC_PREBOUND;
  ------------------
  |  |  118|      0|#define NETSNMP_TSPEC_PREBOUND                  0x02 /* 1=bound by systemd, 0=needs bind in the library */
  ------------------
  286|     66|#endif
  287|     66|    }
  288|      0|    else
  289|      0|        bind_addr = src_addr;
  290|       |
  291|     66|    if (-1 == t->sock)
  ------------------
  |  Branch (291:9): [True: 66, False: 0]
  ------------------
  292|     66|        t->sock = netsnmp_udpipv4base_transport_socket(flags);
  293|     66|    if (t->sock < 0) {
  ------------------
  |  Branch (293:9): [True: 0, False: 66]
  ------------------
  294|      0|        netsnmp_transport_free(t);
  295|      0|        return NULL;
  296|      0|    }
  297|       |
  298|       |    /*
  299|       |     * If we've been given an address to bind to, then bind to it.
  300|       |     * Otherwise the OS will use "something sensible".
  301|       |     */
  302|     66|    if (NULL == bind_addr)
  ------------------
  |  Branch (302:9): [True: 0, False: 66]
  ------------------
  303|      0|        return t;
  304|       |
  305|       |    /* for Linux VRF Traps we try to bind the iface if clientaddr is not set */
  306|     66|    if (ep && ep->iface[0]) {
  ------------------
  |  Branch (306:9): [True: 66, False: 0]
  |  Branch (306:15): [True: 0, False: 66]
  ------------------
  307|      0|        rc = netsnmp_bindtodevice(t->sock, ep->iface);
  308|      0|        if (rc)
  ------------------
  |  Branch (308:13): [True: 0, False: 0]
  ------------------
  309|      0|            DEBUGMSGTL(("netsnmp_udpbase", "VRF: Could not bind socket %d to %s\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]
  |  |  ------------------
  ------------------
  310|      0|                        t->sock, ep->iface));
  311|      0|        else
  312|      0|            DEBUGMSGTL(("netsnmp_udpbase", "VRF: Bound socket %d to %s\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]
  |  |  ------------------
  ------------------
  313|      0|                        t->sock, ep->iface));
  314|      0|    }
  315|       |
  316|     66|    rc = netsnmp_udpipv4base_transport_bind(t, bind_addr, flags);
  317|     66|    if (rc) {
  ------------------
  |  Branch (317:9): [True: 0, False: 66]
  ------------------
  318|      0|        netsnmp_transport_free(t);
  319|      0|        t = NULL;
  320|      0|    }
  321|     66|    else if (!local)
  ------------------
  |  Branch (321:14): [True: 0, False: 66]
  ------------------
  322|      0|        netsnmp_udpipv4base_transport_get_bound_addr(t);
  323|       |
  324|     66|    return t;
  325|     66|}
netsnmp_udpipv4base_tspec_transport:
  329|     66|{
  330|     66|    struct netsnmp_ep addr;
  331|     66|    int local;
  332|       |
  333|     66|    if (NULL == tspec)
  ------------------
  |  Branch (333:9): [True: 0, False: 66]
  ------------------
  334|      0|        return NULL;
  335|       |
  336|     66|    local = tspec->flags & NETSNMP_TSPEC_LOCAL;
  ------------------
  |  |  117|     66|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  337|       |
  338|       |    /** get address from target */
  339|     66|    if (!netsnmp_sockaddr_in3(&addr, tspec->target, tspec->default_target))
  ------------------
  |  Branch (339:9): [True: 0, False: 66]
  ------------------
  340|      0|        return NULL;
  341|       |
  342|     66|    if (NULL != tspec->source) {
  ------------------
  |  Branch (342:9): [True: 0, False: 66]
  ------------------
  343|      0|        struct netsnmp_ep src_addr;
  344|       |
  345|       |        /** get sockaddr from source */
  346|      0|        if (!netsnmp_sockaddr_in3(&src_addr, tspec->source, ":0"))
  ------------------
  |  Branch (346:13): [True: 0, False: 0]
  ------------------
  347|      0|            return NULL;
  348|      0|        return netsnmp_udpipv4base_transport_with_source(&addr, local,
  349|      0|                                                         &src_addr);
  350|      0|    }
  351|       |
  352|       |    /** no source and default client address ok */
  353|     66|    return netsnmp_udpipv4base_transport(&addr, local);
  354|     66|}
netsnmp_udpipv4base_transport:
  358|     66|{
  359|     66|    struct netsnmp_ep client_ep;
  360|     66|    const char *client_addr;
  361|     66|    int uses_port;
  362|       |
  363|     66|    memset(&client_ep, 0, sizeof(client_ep));
  364|     66|    client_ep.a.sin.sin_family = AF_INET;
  365|       |
  366|     66|    if (local)
  ------------------
  |  Branch (366:9): [True: 66, False: 0]
  ------------------
  367|     66|        goto out;
  368|       |
  369|      0|    client_addr = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  370|      0|                                        NETSNMP_DS_LIB_CLIENT_ADDR);
  ------------------
  |  |  165|      0|#define NETSNMP_DS_LIB_CLIENT_ADDR       14
  ------------------
  371|      0|    if (!client_addr)
  ------------------
  |  Branch (371:9): [True: 0, False: 0]
  ------------------
  372|      0|        goto out;
  373|       |
  374|      0|    if (netsnmp_sockaddr_in3(&client_ep, client_addr, ":0") < 0) {
  ------------------
  |  Branch (374:9): [True: 0, False: 0]
  ------------------
  375|      0|        snmp_log(LOG_ERR, "Parsing clientaddr %s failed\n", client_addr);
  376|      0|        goto out;
  377|      0|    }
  378|       |
  379|      0|    uses_port = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  380|      0|                                       NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT);
  ------------------
  |  |  102|      0|#define NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT 42 /* NETSNMP_DS_LIB_CLIENT_ADDR includes address and also port */
  ------------------
  381|      0|    if (!uses_port)
  ------------------
  |  Branch (381:9): [True: 0, False: 0]
  ------------------
  382|      0|        client_ep.a.sin.sin_port = 0;
  383|       |
  384|     66|out:
  385|     66|    return netsnmp_udpipv4base_transport_with_source(ep, local, &client_ep);
  386|      0|}

netsnmp_udpipv6_ctor:
  997|     66|{
  998|     66|    udp6Domain.name = netsnmp_UDPIPv6Domain;
  999|     66|    udp6Domain.name_length = OID_LENGTH(netsnmp_UDPIPv6Domain);
  ------------------
  |  |   64|     66|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     66|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 1000|     66|    udp6Domain.f_create_from_tstring_new = netsnmp_udp6_create_tstring;
 1001|     66|    udp6Domain.f_create_from_tspec       = netsnmp_udp6_create_tspec;
 1002|     66|    udp6Domain.f_create_from_ostring     = netsnmp_udp6_create_ostring;
 1003|     66|    udp6Domain.prefix = calloc(5, sizeof(char *));
 1004|     66|    if (!udp6Domain.prefix) {
  ------------------
  |  Branch (1004:9): [True: 0, False: 66]
  ------------------
 1005|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
 1006|      0|        return;
 1007|      0|    }
 1008|     66|    udp6Domain.prefix[0] = "udp6";
 1009|     66|    udp6Domain.prefix[1] = "ipv6";
 1010|     66|    udp6Domain.prefix[2] = "udpv6";
 1011|     66|    udp6Domain.prefix[3] = "udpipv6";
 1012|       |
 1013|     66|    netsnmp_tdomain_register(&udp6Domain);
 1014|     66|}

netsnmp_udpshared_ctor:
  453|     66|{
  454|     66|    static netsnmp_tdomain domain;
  455|     66|    static int done = 0;
  456|       |
  457|     66|    if (done)
  ------------------
  |  Branch (457:9): [True: 65, False: 1]
  ------------------
  458|     65|        return;
  459|      1|    done = 1;
  460|       |
  461|      1|    domain.name = netsnmpUDPsharedDomain;
  462|      1|    domain.name_length = netsnmpUDPsharedDomain_len;
  463|       |
  464|      1|    domain.prefix = calloc(2, sizeof(char *));
  465|      1|    if (!domain.prefix) {
  ------------------
  |  Branch (465:9): [True: 0, False: 1]
  ------------------
  466|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  467|      0|        return;
  468|      0|    }
  469|      1|    domain.prefix[0] = "udpshared";
  470|       |
  471|      1|    domain.f_create_from_tstring_new = netsnmp_udpshared_create_tstring;
  472|      1|    domain.f_create_from_tspec       = netsnmp_udpshared_create_tspec;
  473|      1|    domain.f_create_from_ostring     = netsnmp_udpshared_create_ostring;
  474|       |
  475|      1|    netsnmp_tdomain_register(&domain);
  476|      1|}

netsnmp_unix_ctor:
  520|     66|{
  521|     66|    unixDomain.name = netsnmp_UnixDomain;
  522|     66|    unixDomain.name_length = OID_LENGTH(netsnmp_UnixDomain);
  ------------------
  |  |   64|     66|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     66|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  523|     66|    unixDomain.prefix = calloc(2, sizeof(char *));
  524|     66|    if (!unixDomain.prefix) {
  ------------------
  |  Branch (524:9): [True: 0, False: 66]
  ------------------
  525|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  526|      0|        return;
  527|      0|    }
  528|     66|    unixDomain.prefix[0] = "unix";
  529|       |
  530|     66|    unixDomain.f_create_from_tstring_new = netsnmp_unix_create_tstring;
  531|     66|    unixDomain.f_create_from_ostring     = netsnmp_unix_create_ostring;
  532|       |
  533|     66|    netsnmp_tdomain_register(&unixDomain);
  534|     66|}

init_vacm:
   85|     66|{
   86|       |    /* views for access via get/set/send-notifications */
   87|     66|    se_add_pair_to_slist(VACM_VIEW_ENUM_NAME, strdup("read"),
  ------------------
  |  |  103|     66|#define VACM_VIEW_ENUM_NAME "vacmviews"
  ------------------
   88|     66|                         VACM_VIEW_READ);
  ------------------
  |  |   77|     66|#define VACM_VIEW_READ     0
  ------------------
   89|     66|    se_add_pair_to_slist(VACM_VIEW_ENUM_NAME, strdup("write"),
  ------------------
  |  |  103|     66|#define VACM_VIEW_ENUM_NAME "vacmviews"
  ------------------
   90|     66|                         VACM_VIEW_WRITE);
  ------------------
  |  |   78|     66|#define VACM_VIEW_WRITE    1
  ------------------
   91|     66|    se_add_pair_to_slist(VACM_VIEW_ENUM_NAME, strdup("notify"),
  ------------------
  |  |  103|     66|#define VACM_VIEW_ENUM_NAME "vacmviews"
  ------------------
   92|     66|                         VACM_VIEW_NOTIFY);
  ------------------
  |  |   79|     66|#define VACM_VIEW_NOTIFY   2
  ------------------
   93|       |
   94|       |    /* views for permissions when receiving notifications */
   95|     66|    se_add_pair_to_slist(VACM_VIEW_ENUM_NAME, strdup("log"),
  ------------------
  |  |  103|     66|#define VACM_VIEW_ENUM_NAME "vacmviews"
  ------------------
   96|     66|                         VACM_VIEW_LOG);
  ------------------
  |  |   82|     66|#define VACM_VIEW_LOG      3
  ------------------
   97|     66|    se_add_pair_to_slist(VACM_VIEW_ENUM_NAME, strdup("execute"),
  ------------------
  |  |  103|     66|#define VACM_VIEW_ENUM_NAME "vacmviews"
  ------------------
   98|     66|                         VACM_VIEW_EXECUTE);
  ------------------
  |  |   83|     66|#define VACM_VIEW_EXECUTE  4
  ------------------
   99|     66|    se_add_pair_to_slist(VACM_VIEW_ENUM_NAME, strdup("net"),
  ------------------
  |  |  103|     66|#define VACM_VIEW_ENUM_NAME "vacmviews"
  ------------------
  100|     66|                         VACM_VIEW_NET);
  ------------------
  |  |   84|     66|#define VACM_VIEW_NET      5
  ------------------
  101|     66|}

LLVMFuzzerInitialize:
   54|      2|int LLVMFuzzerInitialize(int *argc, char ***argv) {
   55|      2|    if (getenv("NETSNMP_DEBUGGING") != NULL) {
  ------------------
  |  Branch (55:9): [True: 0, False: 2]
  ------------------
   56|      0|        snmp_enable_stderrlog();
   57|      0|        snmp_set_do_debugging(1);
   58|      0|        debug_register_tokens("sess_process_packet");
   59|      0|    }
   60|       |
   61|      2|    return 0;
   62|      2|}
LLVMFuzzerTestOneInput:
   64|     67|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   65|     67|    netsnmp_transport *transport = NULL;
   66|     67|    netsnmp_session *session = NULL;
   67|     67|    const unsigned short pkt_len = size;
   68|     67|    const void *const pkt = data;
   69|     67|    int skt = -1;
   70|     67|    int ret = 1;
   71|       |
   72|     67|    if (pkt_len == 0)
  ------------------
  |  Branch (72:9): [True: 1, False: 66]
  ------------------
   73|      1|        goto cleanup;
   74|       |
   75|     66|    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS, "mibs");
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS, "mibs");
  ------------------
  |  |  162|     66|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
   76|     66|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
   77|     66|                           NETSNMP_DS_LIB_DONT_PERSIST_STATE, 1);
  ------------------
  |  |   92|     66|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
   78|     66|    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PERSISTENT_DIR,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PERSISTENT_DIR,
  ------------------
  |  |  159|     66|#define NETSNMP_DS_LIB_PERSISTENT_DIR    8
  ------------------
   79|     66|                          "/tmp");
   80|       |
   81|     66|    init_snmp("snmptrapd");
   82|       |
   83|     66|    transport = netsnmp_transport_open_server("trap_fuzzer", "127.0.0.1:7365");
   84|     66|    if (!transport) {
  ------------------
  |  Branch (84:9): [True: 0, False: 66]
  ------------------
   85|      0|        fprintf(stderr, "Error: failed to open Net-SNMP transport.\n");
   86|      0|        goto cleanup;
   87|      0|    }
   88|     66|    session = add_session(transport);
   89|     66|    if (!session) {
  ------------------
  |  Branch (89:9): [True: 0, False: 66]
  ------------------
   90|      0|        fprintf(stderr, "Error: failed to add Net-SNMP session.\n");
   91|      0|        goto cleanup;
   92|      0|    }
   93|       |
   94|     66|    skt = socket(AF_INET, SOCK_DGRAM, 0);
   95|     66|    if (skt < 0) {
  ------------------
  |  Branch (95:9): [True: 0, False: 66]
  ------------------
   96|      0|        perror("socket()");
   97|      0|        goto shutdown;
   98|      0|    }
   99|     66|    struct sockaddr_in addr = {
  100|     66|        .sin_family = AF_INET,
  101|     66|        .sin_port = htons(7365),
  102|     66|        .sin_addr = { htonl(INADDR_LOOPBACK) }
  103|     66|    };
  104|     66|    if (connect(skt, &addr, sizeof(addr)) < 0) {
  ------------------
  |  Branch (104:9): [True: 0, False: 66]
  ------------------
  105|      0|        perror("connect()");
  106|      0|        goto shutdown;
  107|      0|    }
  108|     66|    if (send(skt, pkt, pkt_len, 0) < 0) {
  ------------------
  |  Branch (108:9): [True: 1, False: 65]
  ------------------
  109|      1|        perror("send()");
  110|      1|        goto shutdown;
  111|      1|    }
  112|     65|    {
  113|     65|        fd_set readfds,writefds,exceptfds;
  114|     65|        int numfds = 0, block = 0;
  115|     65|        struct timeval timeout;
  116|       |
  117|     65|        FD_ZERO(&readfds);
  ------------------
  |  Branch (117:9): [Folded, False: 65]
  ------------------
  118|     65|        FD_ZERO(&writefds);
  ------------------
  |  Branch (118:9): [Folded, False: 65]
  ------------------
  119|     65|        FD_ZERO(&exceptfds);
  ------------------
  |  Branch (119:9): [Folded, False: 65]
  ------------------
  120|     65|        timerclear(&timeout);
  121|     65|        timeout.tv_sec = 5;
  122|     65|        snmp_select_info(&numfds, &readfds, &timeout, &block);
  123|     65|        if (select(numfds, &readfds, &writefds, &exceptfds, &timeout) > 0)
  ------------------
  |  Branch (123:13): [True: 65, False: 0]
  ------------------
  124|     65|            snmp_read(&readfds);
  125|     65|    }
  126|     65|    ret = 0;
  127|       |
  128|     66|shutdown:
  129|     66|    snmp_shutdown("snmptrapd");
  130|       |
  131|     67|cleanup:
  132|     67|    if (skt >= 0)
  ------------------
  |  Branch (132:9): [True: 66, False: 1]
  ------------------
  133|     66|        close(skt);
  134|     67|    if (session)
  ------------------
  |  Branch (134:9): [True: 66, False: 1]
  ------------------
  135|     66|        snmp_close(session);
  136|       |
  137|     67|    return ret;
  138|     66|}
snmp_parse_trap2_fuzzer.c:add_session:
   37|     66|{
   38|     66|    netsnmp_session session;
   39|       |
   40|     66|    snmp_sess_init(&session);
   41|     66|    session.peername = SNMP_DEFAULT_PEERNAME;
  ------------------
  |  |  120|     66|#define SNMP_DEFAULT_PEERNAME	    NULL
  ------------------
   42|     66|    session.version = SNMP_DEFAULT_VERSION;
  ------------------
  |  |  123|     66|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
   43|     66|    session.community_len = SNMP_DEFAULT_COMMUNITY_LEN;
  ------------------
  |  |  111|     66|#define SNMP_DEFAULT_COMMUNITY_LEN  0   /* to get a default community name */
  ------------------
   44|     66|    session.retries = SNMP_DEFAULT_RETRIES;
  ------------------
  |  |  112|     66|#define SNMP_DEFAULT_RETRIES	    -1
  ------------------
   45|     66|    session.timeout = SNMP_DEFAULT_TIMEOUT;
  ------------------
  |  |  113|     66|#define SNMP_DEFAULT_TIMEOUT	    -1
  ------------------
   46|     66|    session.callback = snmp_input;
   47|     66|    session.callback_magic = t;
   48|     66|    session.authenticator = NULL;
   49|     66|    session.isAuthoritative = SNMP_SESS_UNKNOWNAUTH;
  ------------------
  |  |  159|     66|#define SNMP_SESS_UNKNOWNAUTH      2    /* sometimes (like NRs) */
  ------------------
   50|       |
   51|     66|    return snmp_add(&session, t, NULL, NULL);
   52|     66|}

