asn_parse_nlength:
  325|    700|{
  326|    700|    int len_len;
  327|       |
  328|    700|    if (pkt_len < 1)
  ------------------
  |  Branch (328:9): [True: 0, False: 700]
  ------------------
  329|      0|        return NULL;               /* always too short */
  330|       |
  331|    700|    if (NULL == pkt || NULL == data_len)
  ------------------
  |  Branch (331:9): [True: 0, False: 700]
  |  Branch (331:24): [True: 0, False: 700]
  ------------------
  332|      0|        return NULL;
  333|       |
  334|    700|    *data_len = 0;
  335|       |
  336|    700|    if (*pkt & 0x80) {
  ------------------
  |  Branch (336:9): [True: 8, False: 692]
  ------------------
  337|       |        /*
  338|       |         * long length; first byte is length of length (after masking high bit)
  339|       |         */
  340|      8|        len_len = (int) ((*pkt & ~0x80) + 1);
  341|      8|        if (pkt_len < len_len)
  ------------------
  |  Branch (341:13): [True: 2, False: 6]
  ------------------
  342|      2|            return NULL;           /* still too short for length and data */
  343|       |
  344|       |        /* now we know we have enough data to parse length */
  345|      6|        if (NULL == asn_parse_length(pkt, data_len))
  ------------------
  |  Branch (345:13): [True: 3, False: 3]
  ------------------
  346|      3|            return NULL;           /* propagate error from asn_parse_length */
  347|    692|    } else {
  348|       |        /*
  349|       |         * short length; first byte is the length
  350|       |         */
  351|    692|        len_len = 1;
  352|    692|        *data_len = *pkt;
  353|    692|    }
  354|       |
  355|    695|    if ((*data_len + len_len) > pkt_len)
  ------------------
  |  Branch (355:9): [True: 11, False: 684]
  ------------------
  356|     11|        return NULL;
  357|       |
  358|    684|    return (pkt + len_len);
  359|    695|}
asn_check_packet:
  484|    236|{
  485|    236|    u_long          asn_length;
  486|       |
  487|    236|    if (len < 2)
  ------------------
  |  Branch (487:9): [True: 18, False: 218]
  ------------------
  488|     18|        return 0;               /* always too short */
  489|       |
  490|    218|    if (*pkt != (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR))
  ------------------
  |  |   84|    218|#define ASN_SEQUENCE	    0x10U
  ------------------
                  if (*pkt != (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR))
  ------------------
  |  |   96|    218|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
  |  Branch (490:9): [True: 19, False: 199]
  ------------------
  491|     19|        return -1;              /* wrong type */
  492|       |
  493|    199|    if (*(pkt + 1) & 0x80) {
  ------------------
  |  Branch (493:9): [True: 7, False: 192]
  ------------------
  494|       |        /*
  495|       |         * long length 
  496|       |         */
  497|      7|        if ((int) len < (int) (*(pkt + 1) & ~0x80) + 2)
  ------------------
  |  Branch (497:13): [True: 1, False: 6]
  ------------------
  498|      1|            return 0;           /* still to short, incomplete length */
  499|      6|        if (NULL == asn_parse_length(pkt + 1, &asn_length))
  ------------------
  |  Branch (499:13): [True: 5, False: 1]
  ------------------
  500|      5|            return 0;           /* propagate error from asn_parse_length() */
  501|      1|        return (asn_length + 2 + (*(pkt + 1) & ~0x80));
  502|    192|    } else {
  503|       |        /*
  504|       |         * short length 
  505|       |         */
  506|    192|        return (*(pkt + 1) + 2);
  507|    192|    }
  508|    199|}
asn_parse_int:
  557|    367|{
  558|       |    /*
  559|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  560|       |     */
  561|    367|    static const char *errpre = "parse int";
  562|    367|    register u_char *bufp = data;
  563|    367|    u_long          asn_length;
  564|    367|    int             i;
  565|    367|    union {
  566|    367|        long          l;
  567|    367|        unsigned char b[sizeof(long)];
  568|    367|    } value;
  569|       |
  570|    367|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (570:9): [True: 0, False: 367]
  |  Branch (570:25): [True: 0, False: 367]
  |  Branch (570:47): [True: 0, False: 367]
  |  Branch (570:63): [True: 0, False: 367]
  ------------------
  571|      0|        ERROR_MSG("parse int: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  572|      0|        return NULL;
  573|      0|    }
  574|       |
  575|    367|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (575:9): [True: 0, False: 367]
  ------------------
  576|      0|        _asn_size_err(errpre, intsize, sizeof(long));
  577|      0|        return NULL;
  578|      0|    }
  579|       |
  580|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
  581|    367|    if (*datalength < 2) {
  ------------------
  |  Branch (581:9): [True: 117, False: 250]
  ------------------
  582|    117|        _asn_short_err(errpre, *datalength, 2);
  583|    117|        return NULL;
  584|    117|    }
  585|       |
  586|    250|    *type = *bufp++;
  587|    250|    if (*type != ASN_INTEGER) {
  ------------------
  |  |   75|    250|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (587:9): [True: 4, False: 246]
  ------------------
  588|      4|        _asn_type_err(errpre, *type);
  589|      4|        return NULL;
  590|      4|    }
  591|       |
  592|    246|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  593|    246|    if (NULL == bufp) {
  ------------------
  |  Branch (593:9): [True: 6, False: 240]
  ------------------
  594|      6|        _asn_short_err(errpre, *datalength - 1, asn_length);
  595|      6|        return NULL;
  596|      6|    }
  597|       |
  598|    240|    if ((size_t) asn_length > intsize || (int) asn_length == 0) {
  ------------------
  |  Branch (598:9): [True: 1, False: 239]
  |  Branch (598:42): [True: 7, False: 232]
  ------------------
  599|      8|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  600|      8|        return NULL;
  601|      8|    }
  602|       |
  603|    232|    *datalength -= (int) asn_length + (bufp - data);
  604|       |
  605|    232|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|    232|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    232|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 232]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 232]
  |  |  ------------------
  ------------------
  606|       |
  607|    232|    memset(&value.b, *bufp & 0x80 ? 0xff : 0, sizeof(value.b));
  ------------------
  |  Branch (607:22): [True: 13, False: 219]
  ------------------
  608|    232|    if (NETSNMP_BIGENDIAN) {
  ------------------
  |  | 2422|    232|#  define NETSNMP_BIGENDIAN 0
  |  |  ------------------
  |  |  |  Branch (2422:29): [Folded, False: 232]
  |  |  ------------------
  ------------------
  609|      0|        for (i = sizeof(long) - asn_length; asn_length--; i++)
  ------------------
  |  Branch (609:45): [True: 0, False: 0]
  ------------------
  610|      0|            value.b[i] = *bufp++;
  611|    232|    } else {
  612|    744|        for (i = asn_length - 1; asn_length--; i--)
  ------------------
  |  Branch (612:34): [True: 512, False: 232]
  ------------------
  613|    512|            value.b[i] = *bufp++;
  614|    232|    }
  615|       |
  616|    232|    CHECK_OVERFLOW_S(value.l, 1);
  ------------------
  |  |  214|    232|#define CHECK_OVERFLOW_S(x,y) do {                                      \
  |  |  215|    232|        if (x > INT32_MAX) {                                            \
  |  |  ------------------
  |  |  |  Branch (215:13): [True: 3, False: 229]
  |  |  ------------------
  |  |  216|      3|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  217|      3|            x &= 0xffffffff;                                            \
  |  |  218|    229|        } else if (x < INT32_MIN) {                                     \
  |  |  ------------------
  |  |  |  Branch (218:20): [True: 5, False: 224]
  |  |  ------------------
  |  |  219|      5|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|      5|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      5|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 5]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  220|      5|            x = 0 - (x & 0xffffffff);                                   \
  |  |  221|      5|        }                                                               \
  |  |  222|    232|    } while(0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded, False: 232]
  |  |  ------------------
  ------------------
  617|       |
  618|    232|    DEBUGMSG(("dumpv_recv", "  Integer:\t%ld (0x%.2lX)\n", value.l, value.l));
  ------------------
  |  |   61|    232|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    232|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 232]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 232]
  |  |  ------------------
  ------------------
  619|       |
  620|    232|    *intp = value.l;
  621|    232|    return bufp;
  622|    240|}
asn_parse_unsigned_int:
  650|      1|{
  651|       |    /*
  652|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  653|       |     */
  654|      1|    static const char *errpre = "parse uint";
  655|      1|    register u_char *bufp = data;
  656|      1|    u_long          asn_length;
  657|      1|    register u_long value = 0;
  658|       |
  659|      1|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (659:9): [True: 0, False: 1]
  |  Branch (659:25): [True: 0, False: 1]
  |  Branch (659:47): [True: 0, False: 1]
  |  Branch (659:63): [True: 0, False: 1]
  ------------------
  660|      0|        ERROR_MSG("parse uint: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  661|      0|        return NULL;
  662|      0|    }
  663|       |
  664|      1|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (664:9): [True: 0, False: 1]
  ------------------
  665|      0|        _asn_size_err(errpre, intsize, sizeof(long));
  666|      0|        return NULL;
  667|      0|    }
  668|       |
  669|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
  670|      1|    if (*datalength < 2) {
  ------------------
  |  Branch (670:9): [True: 0, False: 1]
  ------------------
  671|      0|        _asn_short_err(errpre, *datalength, 2);
  672|      0|        return NULL;
  673|      0|    }
  674|       |
  675|      1|    *type = *bufp++;
  676|      1|    if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   89|      2|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|      1|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   90|      2|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|      1|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   92|      1|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (676:9): [True: 1, False: 0]
  |  Branch (676:33): [True: 0, False: 1]
  |  Branch (676:55): [True: 0, False: 0]
  ------------------
  677|      0|            && *type != ASN_UINTEGER) {
  ------------------
  |  |  100|      0|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (677:16): [True: 0, False: 0]
  ------------------
  678|      0|        _asn_type_err(errpre, *type);
  679|      0|        return NULL;
  680|      0|    }
  681|       |
  682|      1|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  683|      1|    if (NULL == bufp) {
  ------------------
  |  Branch (683:9): [True: 1, False: 0]
  ------------------
  684|      1|        _asn_short_err(errpre, *datalength - 1, asn_length);
  685|      1|        return NULL;
  686|      1|    }
  687|       |
  688|      0|    if ((asn_length > (intsize + 1)) || ((int) asn_length == 0) ||
  ------------------
  |  Branch (688:9): [True: 0, False: 0]
  |  Branch (688:41): [True: 0, False: 0]
  ------------------
  689|      0|        ((asn_length == intsize + 1) && *bufp != 0x00)) {
  ------------------
  |  Branch (689:10): [True: 0, False: 0]
  |  Branch (689:41): [True: 0, False: 0]
  ------------------
  690|      0|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  691|      0|        return NULL;
  692|      0|    }
  693|      0|    *datalength -= (int) asn_length + (bufp - data);
  694|       |
  695|      0|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|      0|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 0]
  |  |  ------------------
  ------------------
  696|       |
  697|      0|    while (asn_length--)
  ------------------
  |  Branch (697:12): [True: 0, False: 0]
  ------------------
  698|      0|        value = (value << 8) | *bufp++;
  699|       |
  700|      0|    CHECK_OVERFLOW_U(value,2);
  ------------------
  |  |  224|      0|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|      0|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  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|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  701|       |
  702|      0|    DEBUGMSG(("dumpv_recv", "  UInteger:\t%ld (0x%.2lX)\n", value, value));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  703|       |
  704|      0|    *intp = value;
  705|      0|    return bufp;
  706|      0|}
asn_parse_string:
  910|    114|{
  911|    114|    static const char *errpre = "parse string";
  912|    114|    u_char         *bufp = data;
  913|    114|    u_long          asn_length;
  914|       |
  915|    114|    if (NULL == data || NULL == datalength || NULL == type || NULL == str ||
  ------------------
  |  Branch (915:9): [True: 0, False: 114]
  |  Branch (915:25): [True: 0, False: 114]
  |  Branch (915:47): [True: 0, False: 114]
  |  Branch (915:63): [True: 0, False: 114]
  ------------------
  916|    114|        NULL == strlength) {
  ------------------
  |  Branch (916:9): [True: 0, False: 114]
  ------------------
  917|      0|        ERROR_MSG("parse string: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  918|      0|        return NULL;
  919|      0|    }
  920|       |
  921|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
  922|    114|    if (*datalength < 2) {
  ------------------
  |  Branch (922:9): [True: 0, False: 114]
  ------------------
  923|      0|        _asn_short_err(errpre, *datalength, 2);
  924|      0|        return NULL;
  925|      0|    }
  926|       |
  927|    114|    *type = *bufp++;
  928|    114|    if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   78|    228|#define ASN_OCTET_STR	    0x04U
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   88|    150|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|     36|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   93|    150|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|     36|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (928:9): [True: 36, False: 78]
  |  Branch (928:35): [True: 36, False: 0]
  |  Branch (928:61): [True: 19, False: 17]
  ------------------
  929|     19|            && *type != ASN_NSAP) {
  ------------------
  |  |   98|     19|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|     19|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (929:16): [True: 19, False: 0]
  ------------------
  930|     19|        _asn_type_err(errpre, *type);
  931|     19|        return NULL;
  932|     19|    }
  933|       |
  934|     95|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  935|     95|    if (NULL == bufp) {
  ------------------
  |  Branch (935:9): [True: 2, False: 93]
  ------------------
  936|      2|        _asn_short_err(errpre, *datalength - 1, asn_length);
  937|      2|        return NULL;
  938|      2|    }
  939|       |
  940|     93|    if (asn_length > *strlength) {
  ------------------
  |  Branch (940:9): [True: 1, False: 92]
  ------------------
  941|      1|        _asn_length_err(errpre, (size_t) asn_length, *strlength);
  942|      1|        return NULL;
  943|      1|    }
  944|       |
  945|     92|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|     92|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     92|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 92]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 92]
  |  |  ------------------
  ------------------
  946|       |
  947|     92|    memmove(str, bufp, asn_length);
  948|     92|    if (*strlength > asn_length)
  ------------------
  |  Branch (948:9): [True: 92, False: 0]
  ------------------
  949|     92|        str[asn_length] = 0;
  950|     92|    *strlength = asn_length;
  951|     92|    *datalength -= asn_length + (bufp - data);
  952|       |
  953|     92|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|     92|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|    184|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 92]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  954|      0|        u_char         *buf = (u_char *) malloc(1 + asn_length);
  955|      0|        size_t          l = (buf != NULL) ? (1 + asn_length) : 0, ol = 0;
  ------------------
  |  Branch (955:29): [True: 0, False: 0]
  ------------------
  956|       |
  957|      0|        if (sprint_realloc_asciistring
  ------------------
  |  Branch (957:13): [True: 0, False: 0]
  ------------------
  958|      0|            (&buf, &l, &ol, 1, str, asn_length)) {
  959|      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]
  |  |  ------------------
  ------------------
  960|      0|        } else {
  961|      0|            if (buf == NULL) {
  ------------------
  |  Branch (961:17): [True: 0, False: 0]
  ------------------
  962|      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]
  |  |  ------------------
  ------------------
  963|      0|            } else {
  964|      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]
  |  |  ------------------
  ------------------
  965|      0|                          buf));
  966|      0|            }
  967|      0|        }
  968|      0|        if (buf != NULL) {
  ------------------
  |  Branch (968:13): [True: 0, False: 0]
  ------------------
  969|      0|            free(buf);
  970|      0|        }
  971|      0|    }
  972|       |
  973|     92|    return bufp + asn_length;
  974|     93|}
asn_parse_header:
 1071|    345|{
 1072|    345|    register u_char *bufp;
 1073|    345|    u_long          asn_length = 0;
 1074|    345|    const char      *errpre = "parse header";
 1075|       |
 1076|    345|    if (!data || !datalength || !type) {
  ------------------
  |  Branch (1076:9): [True: 0, False: 345]
  |  Branch (1076:18): [True: 0, False: 345]
  |  Branch (1076:33): [True: 0, False: 345]
  ------------------
 1077|      0|        ERROR_MSG("parse header: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1078|      0|        return NULL;
 1079|      0|    }
 1080|       |
 1081|       |    /** need at least 2 bytes to work with: type, length (which might be 0) */
 1082|    345|    if (*datalength < 2) {
  ------------------
  |  Branch (1082:9): [True: 0, False: 345]
  ------------------
 1083|      0|        _asn_short_err(errpre, *datalength, 2);
 1084|      0|        return NULL;
 1085|      0|    }
 1086|       |
 1087|    345|    bufp = data;
 1088|       |    /*
 1089|       |     * this only works on data types < 30, i.e. no extension octets 
 1090|       |     */
 1091|    345|    if (IS_EXTENSION_ID(*bufp)) {
  ------------------
  |  |  103|    345|#define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    345|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |               #define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    345|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |  |  Branch (103:31): [True: 0, False: 345]
  |  |  ------------------
  ------------------
 1092|      0|        ERROR_MSG("can't process ID >= 30");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1093|      0|        return NULL;
 1094|      0|    }
 1095|    345|    *type = *bufp++;
 1096|       |
 1097|    345|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1098|    345|    if (NULL == bufp) {
  ------------------
  |  Branch (1098:9): [True: 4, False: 341]
  ------------------
 1099|      4|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1100|      4|        return NULL;
 1101|      4|    }
 1102|       |
 1103|       |#ifdef DUMP_PRINT_HEADERS
 1104|       |    DEBUGDUMPSETUP("recv", data, (bufp - data));
 1105|       |    DEBUGMSG(("dumpv_recv", "  Header: 0x%.2X, len = %d (0x%X)\n", *data,
 1106|       |              asn_length, asn_length));
 1107|       |#else
 1108|       |    /*
 1109|       |     * DEBUGMSGHEXTLI(("recv",data,(bufp-data)));
 1110|       |     * DEBUGMSG(("dumpH_recv","\n"));
 1111|       |     */
 1112|    341|#endif
 1113|       |
 1114|    341|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1115|       |
 1116|    341|    if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |   93|    212|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    212|#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 (1116:9): [True: 212, False: 129]
  |  Branch (1116:29): [True: 0, False: 212]
  |  Branch (1116:54): [True: 0, False: 0]
  ------------------
 1117|       |
 1118|       |        /*
 1119|       |         * check if 64-but counter 
 1120|       |         */
 1121|      0|        switch (*(bufp + 1)) {
 1122|      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 (1122:9): [True: 0, False: 0]
  ------------------
 1123|      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 (1123:9): [True: 0, False: 0]
  ------------------
 1124|      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 (1124:9): [True: 0, False: 0]
  ------------------
 1125|      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 (1125:9): [True: 0, False: 0]
  ------------------
 1126|      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 (1126:9): [True: 0, False: 0]
  ------------------
 1127|      0|            *type = *(bufp + 1);
 1128|      0|            break;
 1129|       |
 1130|      0|        default:
  ------------------
  |  Branch (1130:9): [True: 0, False: 0]
  ------------------
 1131|       |            /*
 1132|       |             * just an Opaque 
 1133|       |             */
 1134|      0|            *datalength = (int) asn_length;
 1135|      0|            return bufp;
 1136|      0|        }
 1137|       |        /*
 1138|       |         * value is encoded as special format 
 1139|       |         */
 1140|      0|        *datalength = (int) asn_length;
 1141|      0|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 1142|      0|        if (NULL == bufp) {
  ------------------
  |  Branch (1142:13): [True: 0, False: 0]
  ------------------
 1143|      0|            _asn_short_err("parse opaque header", *datalength - 2, asn_length);
 1144|      0|            return NULL;
 1145|      0|        }
 1146|      0|    }
 1147|    341|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 1148|       |
 1149|    341|    *datalength = (int) asn_length;
 1150|       |
 1151|    341|    return bufp;
 1152|    341|}
asn_parse_sequence:
 1171|    329|{                               /* error message prefix */
 1172|    329|    data = asn_parse_header(data, datalength, type);
 1173|    329|    if (data && (*type != expected_type)) {
  ------------------
  |  Branch (1173:9): [True: 326, False: 3]
  |  Branch (1173:17): [True: 13, False: 313]
  ------------------
 1174|     13|        char            ebuf[128];
 1175|     13|        snprintf(ebuf, sizeof(ebuf),
 1176|     13|                 "%s header type %02X: s/b %02X", estr,
 1177|     13|                (u_char) * type, (u_char) expected_type);
 1178|     13|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|     13|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1179|     13|        return NULL;
 1180|     13|    }
 1181|    316|    return data;
 1182|    329|}
asn_parse_length:
 1293|     12|{
 1294|     12|    static const char *errpre = "parse length";
 1295|     12|    char            ebuf[128];
 1296|     12|    register u_char lengthbyte;
 1297|       |
 1298|     12|    if (!data || !length) {
  ------------------
  |  Branch (1298:9): [True: 0, False: 12]
  |  Branch (1298:18): [True: 0, False: 12]
  ------------------
 1299|      0|        ERROR_MSG("parse length: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1300|      0|        return NULL;
 1301|      0|    }
 1302|     12|    lengthbyte = *data;
 1303|       |
 1304|     12|    if (lengthbyte & ASN_LONG_LEN) {
  ------------------
  |  |   98|     12|#define ASN_LONG_LEN	    0x80U
  ------------------
  |  Branch (1304:9): [True: 12, False: 0]
  ------------------
 1305|     12|        lengthbyte &= ~ASN_LONG_LEN;    /* turn MSb off */
  ------------------
  |  |   98|     12|#define ASN_LONG_LEN	    0x80U
  ------------------
 1306|     12|        if (lengthbyte == 0) {
  ------------------
  |  Branch (1306:13): [True: 1, False: 11]
  ------------------
 1307|      1|            snprintf(ebuf, sizeof(ebuf),
 1308|      1|                     "%s: indefinite length not supported", errpre);
 1309|      1|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|      1|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1310|      1|            return NULL;
 1311|      1|        }
 1312|     11|        if (lengthbyte > sizeof(long)) {
  ------------------
  |  Branch (1312:13): [True: 4, False: 7]
  ------------------
 1313|      4|            snprintf(ebuf, sizeof(ebuf),
 1314|      4|                    "%s: data length %d > %lu not supported", errpre,
 1315|      4|                    lengthbyte, (unsigned long)sizeof(long));
 1316|      4|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|      4|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1317|      4|            return NULL;
 1318|      4|        }
 1319|      7|        data++;
 1320|      7|        *length = 0;            /* protect against short lengths */
 1321|     49|        while (lengthbyte--) {
  ------------------
  |  Branch (1321:16): [True: 42, False: 7]
  ------------------
 1322|     42|            *length <<= 8;
 1323|     42|            *length |= *data++;
 1324|     42|        }
 1325|      7|        if ((long) *length < 0) {
  ------------------
  |  Branch (1325:13): [True: 3, False: 4]
  ------------------
 1326|      3|            snprintf(ebuf, sizeof(ebuf),
 1327|      3|                     "%s: negative data length %ld\n", errpre,
 1328|      3|                     (long) *length);
 1329|      3|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|      3|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1330|      3|            return NULL;
 1331|      3|        }
 1332|      4|        return data;
 1333|      7|    } else {                    /* short asnlength */
 1334|      0|        *length = (long) lengthbyte;
 1335|      0|        return data + 1;
 1336|      0|    }
 1337|     12|}
asn_parse_objid:
 1435|     13|{
 1436|     13|    static const char *errpre = "parse objid";
 1437|       |    /*
 1438|       |     * ASN.1 objid ::= 0x06 asnlength subidentifier {subidentifier}*
 1439|       |     * subidentifier ::= {leadingbyte}* lastbyte
 1440|       |     * leadingbyte ::= 1 7bitvalue
 1441|       |     * lastbyte ::= 0 7bitvalue
 1442|       |     */
 1443|     13|    register u_char *bufp = data;
 1444|     13|    register oid   *oidp = objid + 1;
 1445|     13|    register u_long subidentifier;
 1446|     13|    register long   length;
 1447|     13|    u_long          asn_length;
 1448|     13|    size_t          original_length = *objidlength;
 1449|       |
 1450|     13|    if (NULL == data || NULL == datalength || NULL == type || NULL == objid) {
  ------------------
  |  Branch (1450:9): [True: 0, False: 13]
  |  Branch (1450:25): [True: 0, False: 13]
  |  Branch (1450:47): [True: 0, False: 13]
  |  Branch (1450:63): [True: 0, False: 13]
  ------------------
 1451|      0|        ERROR_MSG("parse objid: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1452|      0|        return NULL;
 1453|      0|    }
 1454|       |
 1455|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
 1456|     13|    if (*datalength < 2) {
  ------------------
  |  Branch (1456:9): [True: 0, False: 13]
  ------------------
 1457|      0|        _asn_short_err(errpre, *datalength, 2);
 1458|      0|        return NULL;
 1459|      0|    }
 1460|       |
 1461|     13|    *type = *bufp++;
 1462|     13|    if (*type != ASN_OBJECT_ID) {
  ------------------
  |  |   81|     13|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (1462:9): [True: 0, False: 13]
  ------------------
 1463|      0|        _asn_type_err(errpre, *type);
 1464|      0|        return NULL;
 1465|      0|    }
 1466|     13|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1467|     13|    if (NULL == bufp) {
  ------------------
  |  Branch (1467:9): [True: 3, False: 10]
  ------------------
 1468|      3|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1469|      3|        return NULL;
 1470|      3|    }
 1471|       |
 1472|     10|    *datalength -= (int) asn_length + (bufp - data);
 1473|       |
 1474|     10|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|     10|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     10|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 10]
  |  |  ------------------
  ------------------
 1475|       |
 1476|       |    /*
 1477|       |     * Handle invalid object identifier encodings of the form 06 00 robustly 
 1478|       |     */
 1479|     10|    if (asn_length == 0)
  ------------------
  |  Branch (1479:9): [True: 0, False: 10]
  ------------------
 1480|      0|        objid[0] = objid[1] = 0;
 1481|       |
 1482|     10|    length = asn_length;
 1483|     10|    (*objidlength)--;           /* account for expansion of first byte */
 1484|       |
 1485|     56|    while (length > 0 && (*objidlength)-- > 0) {
  ------------------
  |  Branch (1485:12): [True: 46, False: 10]
  |  Branch (1485:26): [True: 46, False: 0]
  ------------------
 1486|     46|        subidentifier = 0;
 1487|     65|        do {                    /* shift and add in low order 7 bits */
 1488|     65|            if (subidentifier > (MAX_SUBID >> 7)) {
  ------------------
  |  |   18|     65|#define MAX_SUBID   0xFFFFFFFFUL
  ------------------
  |  Branch (1488:17): [True: 0, False: 65]
  ------------------
 1489|      0|                ERROR_MSG("subidentifier too large / overflow");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1490|      0|                return NULL;
 1491|      0|            }
 1492|     65|            subidentifier =
 1493|     65|                (subidentifier << 7) + (*(u_char *) bufp & ~ASN_BIT8);
  ------------------
  |  |  100|     65|#define ASN_BIT8	    0x80U
  ------------------
 1494|     65|            length--;
 1495|     65|        } while ((*(u_char *) bufp++ & ASN_BIT8) && (length > 0));        /* last byte has high bit clear */
  ------------------
  |  |  100|     65|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1495:18): [True: 19, False: 46]
  |  Branch (1495:53): [True: 19, False: 0]
  ------------------
 1496|       |
 1497|     46|	if (length == 0) {
  ------------------
  |  Branch (1497:6): [True: 10, False: 36]
  ------------------
 1498|     10|            u_char *last_byte = bufp - 1;
 1499|     10|            if (*last_byte & ASN_BIT8) {
  ------------------
  |  |  100|     10|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1499:17): [True: 0, False: 10]
  ------------------
 1500|       |                /* last byte has high bit set -> wrong BER encoded OID */
 1501|      0|                ERROR_MSG("subidentifier syntax error");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1502|      0|                return NULL;
 1503|      0|            }
 1504|     10|        }
 1505|     46|        if (subidentifier > MAX_SUBID) {
  ------------------
  |  |   18|     46|#define MAX_SUBID   0xFFFFFFFFUL
  ------------------
  |  Branch (1505:13): [True: 0, False: 46]
  ------------------
 1506|      0|            ERROR_MSG("subidentifier too large");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1507|      0|            return NULL;
 1508|      0|        }
 1509|     46|        *oidp++ = (oid) subidentifier;
 1510|     46|    }
 1511|       |
 1512|     10|    if (length || oidp < objid + 1) {
  ------------------
  |  Branch (1512:9): [True: 0, False: 10]
  |  Branch (1512:19): [True: 0, False: 10]
  ------------------
 1513|      0|        ERROR_MSG("OID length exceeds buffer size");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1514|      0|        *objidlength = original_length;
 1515|      0|        return NULL;
 1516|      0|    }
 1517|       |
 1518|       |    /*
 1519|       |     * The first two subidentifiers are encoded into the first component
 1520|       |     * with the value (X * 40) + Y, where:
 1521|       |     *  X is the value of the first subidentifier.
 1522|       |     *  Y is the value of the second subidentifier.
 1523|       |     */
 1524|     10|    subidentifier = oidp - objid >= 2 ? objid[1] : 0;
  ------------------
  |  Branch (1524:21): [True: 10, False: 0]
  ------------------
 1525|     10|    if (subidentifier == 0x2B) {
  ------------------
  |  Branch (1525:9): [True: 0, False: 10]
  ------------------
 1526|      0|        objid[0] = 1;
 1527|      0|        objid[1] = 3;
 1528|     10|    } else {
 1529|     10|        if (subidentifier < 40) {
  ------------------
  |  Branch (1529:13): [True: 1, False: 9]
  ------------------
 1530|      1|            objid[0] = 0;
 1531|      1|            objid[1] = subidentifier;
 1532|      9|        } else if (subidentifier < 80) {
  ------------------
  |  Branch (1532:20): [True: 1, False: 8]
  ------------------
 1533|      1|            objid[0] = 1;
 1534|      1|            objid[1] = subidentifier - 40;
 1535|      8|        } else {
 1536|      8|            objid[0] = 2;
 1537|      8|            objid[1] = subidentifier - 80;
 1538|      8|        }
 1539|     10|    }
 1540|       |
 1541|     10|    *objidlength = (int) (oidp - objid);
 1542|       |
 1543|     10|    DEBUGMSG(("dumpv_recv", "  ObjID: "));
  ------------------
  |  |   61|     10|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     10|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 10]
  |  |  ------------------
  ------------------
 1544|     10|    DEBUGMSGOID(("dumpv_recv", objid, *objidlength));
  ------------------
  |  |   67|     10|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     10|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 10]
  |  |  ------------------
  ------------------
 1545|     10|    DEBUGMSG(("dumpv_recv", "\n"));
  ------------------
  |  |   61|     10|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     10|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 10]
  |  |  ------------------
  ------------------
 1546|     10|    return bufp;
 1547|     10|}
asn_realloc_rbuild_length:
 2853|    338|{
 2854|    338|    static const char *errpre = "build length";
 2855|    338|    char            ebuf[128];
 2856|    338|    int             tmp_int;
 2857|    338|    size_t          start_offset = *offset;
 2858|       |
 2859|    338|    if (length <= 0x7f) {
  ------------------
  |  Branch (2859:9): [True: 338, False: 0]
  ------------------
 2860|    338|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (2860:13): [True: 0, False: 338]
  ------------------
 2861|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2861:18): [True: 0, False: 0]
  |  Branch (2861:23): [True: 0, False: 0]
  ------------------
 2862|      0|            snprintf(ebuf, sizeof(ebuf),
 2863|      0|                    "%s: bad length < 1 :%ld, %lu", errpre,
 2864|      0|                    (long)(*pkt_len - *offset), (unsigned long)length);
 2865|      0|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2866|      0|            return 0;
 2867|      0|        }
 2868|    338|        *(*pkt + *pkt_len - (++*offset)) = length;
 2869|    338|    } else {
 2870|      0|        while (length > 0xff) {
  ------------------
  |  Branch (2870:16): [True: 0, False: 0]
  ------------------
 2871|      0|            if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (2871:17): [True: 0, False: 0]
  ------------------
 2872|      0|                && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2872:22): [True: 0, False: 0]
  |  Branch (2872:27): [True: 0, False: 0]
  ------------------
 2873|      0|                snprintf(ebuf, sizeof(ebuf),
 2874|      0|                        "%s: bad length < 1 :%ld, %lu", errpre,
 2875|      0|                        (long)(*pkt_len - *offset), (unsigned long)length);
 2876|      0|                ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2877|      0|                return 0;
 2878|      0|            }
 2879|      0|            *(*pkt + *pkt_len - (++*offset)) = length & 0xff;
 2880|      0|            length >>= 8;
 2881|      0|        }
 2882|       |
 2883|      0|        while ((*pkt_len - *offset) < 2) {
  ------------------
  |  Branch (2883:16): [True: 0, False: 0]
  ------------------
 2884|      0|            if (!(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2884:19): [True: 0, False: 0]
  |  Branch (2884:24): [True: 0, False: 0]
  ------------------
 2885|      0|                snprintf(ebuf, sizeof(ebuf),
 2886|      0|                        "%s: bad length < 1 :%ld, %lu", errpre,
 2887|      0|                        (long)(*pkt_len - *offset), (unsigned long)length);
 2888|      0|                ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2889|      0|                return 0;
 2890|      0|            }
 2891|      0|        }
 2892|       |
 2893|      0|        *(*pkt + *pkt_len - (++*offset)) = length & 0xff;
 2894|      0|        tmp_int = *offset - start_offset;
 2895|      0|        *(*pkt + *pkt_len - (++*offset)) = tmp_int | 0x80;
 2896|      0|    }
 2897|       |
 2898|    338|    return 1;
 2899|    338|}
asn_realloc_rbuild_header:
 2922|    338|{
 2923|    338|    char            ebuf[128];
 2924|       |
 2925|    338|    if (asn_realloc_rbuild_length(pkt, pkt_len, offset, r, length)) {
  ------------------
  |  Branch (2925:9): [True: 338, False: 0]
  ------------------
 2926|    338|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (2926:13): [True: 0, False: 338]
  ------------------
 2927|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2927:18): [True: 0, False: 0]
  |  Branch (2927:23): [True: 0, False: 0]
  ------------------
 2928|      0|            snprintf(ebuf, sizeof(ebuf),
 2929|      0|                    "bad header length < 1 :%ld, %lu",
 2930|      0|                    (long)(*pkt_len - *offset), (unsigned long)length);
 2931|      0|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2932|      0|            return 0;
 2933|      0|        }
 2934|    338|        *(*pkt + *pkt_len - (++*offset)) = type;
 2935|    338|        return 1;
 2936|    338|    }
 2937|      0|    return 0;
 2938|    338|}
asn_realloc_rbuild_int:
 2961|    117|{
 2962|    117|    static const char *errpre = "build int";
 2963|    117|    register long   integer = *intp;
 2964|    117|    int             testvalue;
 2965|    117|    size_t          start_offset = *offset;
 2966|       |
 2967|    117|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (2967:9): [True: 0, False: 117]
  ------------------
 2968|      0|        _asn_size_err(errpre, intsize, sizeof(long));
 2969|      0|        return 0;
 2970|      0|    }
 2971|       |
 2972|    117|    CHECK_OVERFLOW_S(integer,10);
  ------------------
  |  |  214|    117|#define CHECK_OVERFLOW_S(x,y) do {                                      \
  |  |  215|    117|        if (x > INT32_MAX) {                                            \
  |  |  ------------------
  |  |  |  Branch (215:13): [True: 0, False: 117]
  |  |  ------------------
  |  |  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|    117|        } else if (x < INT32_MIN) {                                     \
  |  |  ------------------
  |  |  |  Branch (218:20): [True: 0, False: 117]
  |  |  ------------------
  |  |  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|    117|    } while(0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded, False: 117]
  |  |  ------------------
  ------------------
 2973|    117|    testvalue = (integer < 0) ? -1 : 0;
  ------------------
  |  Branch (2973:17): [True: 0, False: 117]
  ------------------
 2974|       |
 2975|    117|    if (((*pkt_len - *offset) < 1) && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2975:9): [True: 0, False: 117]
  |  Branch (2975:41): [True: 0, False: 0]
  |  Branch (2975:46): [True: 0, False: 0]
  ------------------
 2976|      0|        return 0;
 2977|      0|    }
 2978|    117|    *(*pkt + *pkt_len - (++*offset)) = (u_char) integer;
 2979|    117|    integer >>= 8;
 2980|       |
 2981|    169|    while (integer != testvalue) {
  ------------------
  |  Branch (2981:12): [True: 52, False: 117]
  ------------------
 2982|     52|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (2982:13): [True: 0, False: 52]
  ------------------
 2983|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2983:18): [True: 0, False: 0]
  |  Branch (2983:23): [True: 0, False: 0]
  ------------------
 2984|      0|            return 0;
 2985|      0|        }
 2986|     52|        *(*pkt + *pkt_len - (++*offset)) = (u_char) integer;
 2987|     52|        integer >>= 8;
 2988|     52|    }
 2989|       |
 2990|    117|    if ((*(*pkt + *pkt_len - *offset) & 0x80) != (testvalue & 0x80)) {
  ------------------
  |  Branch (2990:9): [True: 13, False: 104]
  ------------------
 2991|       |        /*
 2992|       |         * Make sure left most bit is representational of the rest of the bits
 2993|       |         * that aren't encoded.  
 2994|       |         */
 2995|     13|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (2995:13): [True: 0, False: 13]
  ------------------
 2996|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2996:18): [True: 0, False: 0]
  |  Branch (2996:23): [True: 0, False: 0]
  ------------------
 2997|      0|            return 0;
 2998|      0|        }
 2999|     13|        *(*pkt + *pkt_len - (++*offset)) = testvalue & 0xff;
 3000|     13|    }
 3001|       |
 3002|    117|    if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r, type,
  ------------------
  |  Branch (3002:9): [True: 117, False: 0]
  ------------------
 3003|    117|                                  (*offset - start_offset))) {
 3004|    117|        if (_asn_realloc_build_header_check(errpre, pkt, pkt_len,
  ------------------
  |  Branch (3004:13): [True: 0, False: 117]
  ------------------
 3005|    117|                                            (*offset - start_offset))) {
 3006|      0|            return 0;
 3007|    117|        } else {
 3008|    117|            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset),
  ------------------
  |  |   83|    117|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    117|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 117]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 117]
  |  |  ------------------
  ------------------
 3009|    117|                           (*offset - start_offset));
 3010|    117|            DEBUGMSG(("dumpv_send", "  Integer:\t%ld (0x%.2lX)\n", *intp,
  ------------------
  |  |   61|    117|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    117|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 117]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 117]
  |  |  ------------------
  ------------------
 3011|    117|                      *intp));
 3012|    117|            return 1;
 3013|    117|        }
 3014|    117|    }
 3015|       |
 3016|      0|    return 0;
 3017|    117|}
asn_realloc_rbuild_string:
 3042|     91|{
 3043|     91|    static const char *errpre = "build string";
 3044|     91|    size_t          start_offset = *offset;
 3045|       |
 3046|     91|    if (str == NULL && strlength > 0) {
  ------------------
  |  Branch (3046:9): [True: 0, False: 91]
  |  Branch (3046:24): [True: 0, False: 0]
  ------------------
 3047|      0|        ERROR_MSG("no string passed into asn_realloc_rbuild_string()\n");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3048|      0|        return 0;
 3049|      0|    }
 3050|       |
 3051|     91|    while ((*pkt_len - *offset) < strlength) {
  ------------------
  |  Branch (3051:12): [True: 0, False: 91]
  ------------------
 3052|      0|        if (!(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (3052:15): [True: 0, False: 0]
  |  Branch (3052:20): [True: 0, False: 0]
  ------------------
 3053|      0|            return 0;
 3054|      0|        }
 3055|      0|    }
 3056|       |
 3057|     91|    *offset += strlength;
 3058|     91|    if (str)
  ------------------
  |  Branch (3058:9): [True: 91, False: 0]
  ------------------
 3059|     91|        memcpy(*pkt + *pkt_len - *offset, str, strlength);
 3060|       |
 3061|     91|    if (asn_realloc_rbuild_header
  ------------------
  |  Branch (3061:9): [True: 91, False: 0]
  ------------------
 3062|     91|        (pkt, pkt_len, offset, r, type, strlength)) {
 3063|     91|        if (_asn_realloc_build_header_check
  ------------------
  |  Branch (3063:13): [True: 0, False: 91]
  ------------------
 3064|     91|            (errpre, pkt, pkt_len, strlength)) {
 3065|      0|            return 0;
 3066|     91|        } else {
 3067|     91|            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset),
  ------------------
  |  |   83|     91|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     91|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 91]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 91]
  |  |  ------------------
  ------------------
 3068|     91|                           *offset - start_offset);
 3069|     91|            DEBUGIF("dumpv_send") {
  ------------------
  |  |  145|     91|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|    182|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 91]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3070|      0|                if (strlength == 0) {
  ------------------
  |  Branch (3070:21): [True: 0, False: 0]
  ------------------
 3071|      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]
  |  |  ------------------
  ------------------
 3072|      0|                } else {
 3073|      0|                    u_char         *buf = (u_char *) malloc(2 * strlength);
 3074|      0|                    size_t          l =
 3075|      0|                        (buf != NULL) ? (2 * strlength) : 0, ol = 0;
  ------------------
  |  Branch (3075:25): [True: 0, False: 0]
  ------------------
 3076|       |
 3077|      0|                    if (sprint_realloc_asciistring
  ------------------
  |  Branch (3077:25): [True: 0, False: 0]
  ------------------
 3078|      0|                        (&buf, &l, &ol, 1, str, strlength)) {
 3079|      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]
  |  |  ------------------
  ------------------
 3080|      0|                    } else {
 3081|      0|                        if (buf == NULL) {
  ------------------
  |  Branch (3081:29): [True: 0, False: 0]
  ------------------
 3082|      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]
  |  |  ------------------
  ------------------
 3083|      0|                                      "  String:\t[TRUNCATED]\n"));
 3084|      0|                        } else {
 3085|      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]
  |  |  ------------------
  ------------------
 3086|      0|                                      "  String:\t%s [TRUNCATED]\n", buf));
 3087|      0|                        }
 3088|      0|                    }
 3089|      0|                    if (buf != NULL) {
  ------------------
  |  Branch (3089:25): [True: 0, False: 0]
  ------------------
 3090|      0|                        free(buf);
 3091|      0|                    }
 3092|      0|                }
 3093|      0|            }
 3094|     91|        }
 3095|     91|        return 1;
 3096|     91|    }
 3097|       |
 3098|      0|    return 0;
 3099|     91|}
asn_realloc_rbuild_unsigned_int:
 3122|     13|{
 3123|     13|    static const char *errpre = "build uint";
 3124|     13|    register u_long integer = *intp;
 3125|     13|    size_t          start_offset = *offset;
 3126|       |
 3127|     13|    if (intsize != sizeof(unsigned long)) {
  ------------------
  |  Branch (3127:9): [True: 0, False: 13]
  ------------------
 3128|      0|        _asn_size_err(errpre, intsize, sizeof(unsigned long));
 3129|      0|        return 0;
 3130|      0|    }
 3131|       |
 3132|     13|    CHECK_OVERFLOW_U(integer,11);
  ------------------
  |  |  224|     13|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|     13|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 13]
  |  |  ------------------
  |  |  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|     13|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 13]
  |  |  ------------------
  ------------------
 3133|       |
 3134|     13|    if (((*pkt_len - *offset) < 1) && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (3134:9): [True: 0, False: 13]
  |  Branch (3134:41): [True: 0, False: 0]
  |  Branch (3134:46): [True: 0, False: 0]
  ------------------
 3135|      0|        return 0;
 3136|      0|    }
 3137|     13|    *(*pkt + *pkt_len - (++*offset)) = (u_char) integer;
 3138|     13|    integer >>= 8;
 3139|       |
 3140|     13|    while (integer != 0) {
  ------------------
  |  Branch (3140:12): [True: 0, False: 13]
  ------------------
 3141|      0|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (3141:13): [True: 0, False: 0]
  ------------------
 3142|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (3142:18): [True: 0, False: 0]
  |  Branch (3142:23): [True: 0, False: 0]
  ------------------
 3143|      0|            return 0;
 3144|      0|        }
 3145|      0|        *(*pkt + *pkt_len - (++*offset)) = (u_char) integer;
 3146|      0|        integer >>= 8;
 3147|      0|    }
 3148|       |
 3149|     13|    if ((*(*pkt + *pkt_len - *offset) & 0x80) != (0 & 0x80)) {
  ------------------
  |  Branch (3149:9): [True: 0, False: 13]
  ------------------
 3150|       |        /*
 3151|       |         * Make sure left most bit is representational of the rest of the bits
 3152|       |         * that aren't encoded.  
 3153|       |         */
 3154|      0|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (3154:13): [True: 0, False: 0]
  ------------------
 3155|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (3155:18): [True: 0, False: 0]
  |  Branch (3155:23): [True: 0, False: 0]
  ------------------
 3156|      0|            return 0;
 3157|      0|        }
 3158|      0|        *(*pkt + *pkt_len - (++*offset)) = 0;
 3159|      0|    }
 3160|       |
 3161|     13|    if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r, type,
  ------------------
  |  Branch (3161:9): [True: 13, False: 0]
  ------------------
 3162|     13|                                  (*offset - start_offset))) {
 3163|     13|        if (_asn_realloc_build_header_check(errpre, pkt, pkt_len,
  ------------------
  |  Branch (3163:13): [True: 0, False: 13]
  ------------------
 3164|     13|                                            (*offset - start_offset))) {
 3165|      0|            return 0;
 3166|     13|        } else {
 3167|     13|            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset),
  ------------------
  |  |   83|     13|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 3168|     13|                           (*offset - start_offset));
 3169|     13|            DEBUGMSG(("dumpv_send", "  UInteger:\t%lu (0x%.2lX)\n", *intp,
  ------------------
  |  |   61|     13|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 13]
  |  |  ------------------
  ------------------
 3170|     13|                      *intp));
 3171|     13|            return 1;
 3172|     13|        }
 3173|     13|    }
 3174|       |
 3175|      0|    return 0;
 3176|     13|}
asn_realloc_rbuild_sequence:
 3199|     91|{
 3200|     91|    return asn_realloc_rbuild_header(pkt, pkt_len, offset, r, type,
 3201|     91|                                     length);
 3202|     91|}
asn_realloc_rbuild_objid:
 3273|     13|{
 3274|       |    /*
 3275|       |     * ASN.1 objid ::= 0x06 asnlength subidentifier {subidentifier}*
 3276|       |     * subidentifier ::= {leadingbyte}* lastbyte
 3277|       |     * leadingbyte ::= 1 7bitvalue
 3278|       |     * lastbyte ::= 0 7bitvalue
 3279|       |     */
 3280|     13|    register size_t i;
 3281|     13|    register oid    tmpint;
 3282|     13|    size_t          start_offset = *offset;
 3283|     13|    const char     *errpre = "build objid";
 3284|       |
 3285|       |    /*
 3286|       |     * Check if there are at least 2 sub-identifiers.  
 3287|       |     */
 3288|     13|    if (objidlength == 0) {
  ------------------
  |  Branch (3288:9): [True: 0, False: 13]
  ------------------
 3289|       |        /*
 3290|       |         * There are not, so make the OID have two sub-identifiers with value
 3291|       |         * zero. Encode both sub-identifiers as a single byte.
 3292|       |         */
 3293|      0|        if (!store_byte(pkt, pkt_len, offset, r, 0))
  ------------------
  |  Branch (3293:13): [True: 0, False: 0]
  ------------------
 3294|      0|            return 0;
 3295|     13|    } else if (objid[0] > 2) {
  ------------------
  |  Branch (3295:16): [True: 0, False: 13]
  ------------------
 3296|      0|        ERROR_MSG("build objid: bad first subidentifier");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3297|      0|        return 0;
 3298|     13|    } else if (objidlength == 1) {
  ------------------
  |  Branch (3298:16): [True: 0, False: 13]
  ------------------
 3299|       |        /*
 3300|       |         * Encode the first value.  
 3301|       |         */
 3302|      0|        if (!store_byte(pkt, pkt_len, offset, r, 40 * objid[0]))
  ------------------
  |  Branch (3302:13): [True: 0, False: 0]
  ------------------
 3303|      0|            return 0;
 3304|     13|    } else {
 3305|    130|        for (i = objidlength - 1; i >= 2; i--) {
  ------------------
  |  Branch (3305:35): [True: 117, False: 13]
  ------------------
 3306|    117|            tmpint = objid[i];
 3307|    117|            CHECK_OVERFLOW_U(tmpint, 12);
  ------------------
  |  |  224|    117|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|    117|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 117]
  |  |  ------------------
  |  |  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|    117|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 117]
  |  |  ------------------
  ------------------
 3308|    117|            if (!store_uint32(pkt, pkt_len, offset, r, tmpint))
  ------------------
  |  Branch (3308:17): [True: 0, False: 117]
  ------------------
 3309|      0|                return 0;
 3310|    117|        }
 3311|       |
 3312|       |        /*
 3313|       |         * Combine the first two values.  
 3314|       |         */
 3315|     13|        if ((objid[1] >= 40 && objid[0] < 2) ||
  ------------------
  |  Branch (3315:14): [True: 0, False: 13]
  |  Branch (3315:32): [True: 0, False: 0]
  ------------------
 3316|     13|            objid[1] > UINT32_MAX - objid[0] * 40) {
  ------------------
  |  Branch (3316:13): [True: 0, False: 13]
  ------------------
 3317|      0|            return 0;
 3318|      0|        }
 3319|     13|        if (!store_uint32(pkt, pkt_len, offset, r, objid[0] * 40 + objid[1]))
  ------------------
  |  Branch (3319:13): [True: 0, False: 13]
  ------------------
 3320|      0|            return 0;
 3321|     13|    }
 3322|       |
 3323|     13|    tmpint = *offset - start_offset;
 3324|     13|    if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r, type, tmpint)) {
  ------------------
  |  Branch (3324:9): [True: 13, False: 0]
  ------------------
 3325|     13|        if (_asn_realloc_build_header_check(errpre, pkt, pkt_len, tmpint)) {
  ------------------
  |  Branch (3325:13): [True: 0, False: 13]
  ------------------
 3326|      0|            return 0;
 3327|     13|        } else {
 3328|     13|            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset), tmpint);
  ------------------
  |  |   83|     13|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 3329|     13|            DEBUGMSG(("dumpv_send", "  ObjID: "));
  ------------------
  |  |   61|     13|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 13]
  |  |  ------------------
  ------------------
 3330|     13|            DEBUGMSGOID(("dumpv_send", objid, objidlength));
  ------------------
  |  |   67|     13|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 13]
  |  |  ------------------
  ------------------
 3331|     13|            DEBUGMSG(("dumpv_send", "\n"));
  ------------------
  |  |   61|     13|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 13]
  |  |  ------------------
  ------------------
 3332|     13|            return 1;
 3333|     13|        }
 3334|     13|    }
 3335|       |
 3336|      0|    return 0;
 3337|     13|}
asn1.c:_asn_short_err:
  299|    133|{
  300|    133|    char            ebuf[128];
  301|       |
  302|    133|    snprintf(ebuf, sizeof(ebuf), "%s length %lu too short: need %lu", str,
  303|    133|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  304|    133|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|    133|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  305|    133|}
asn1.c:_asn_type_err:
  261|     23|{
  262|     23|    char            ebuf[128];
  263|       |
  264|     23|    snprintf(ebuf, sizeof(ebuf), "%s type %d", str, wrongtype);
  265|     23|    ebuf[ sizeof(ebuf)-1 ] = 0;
  266|     23|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|     23|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  267|     23|}
asn1.c:_asn_length_err:
  280|      9|{
  281|      9|    char            ebuf[128];
  282|       |
  283|      9|    snprintf(ebuf, sizeof(ebuf),
  284|      9|            "%s length %lu too large: exceeds %lu", str,
  285|      9|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  286|      9|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|      9|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  287|      9|}
asn1.c:_asn_realloc_build_header_check:
  453|    234|{
  454|    234|    char            ebuf[128];
  455|       |
  456|    234|    if (pkt == NULL || *pkt == NULL) {
  ------------------
  |  Branch (456:9): [True: 0, False: 234]
  |  Branch (456:24): [True: 0, False: 234]
  ------------------
  457|       |        /*
  458|       |         * Error message is set.  
  459|       |         */
  460|      0|        return 1;
  461|      0|    }
  462|       |
  463|    234|    if (*pkt_len < typedlen) {
  ------------------
  |  Branch (463:9): [True: 0, False: 234]
  ------------------
  464|      0|        snprintf(ebuf, sizeof(ebuf),
  465|      0|                "%s: bad header, length too short: %lu < %lu", str,
  466|      0|                (unsigned long)*pkt_len, (unsigned long)typedlen);
  467|      0|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  468|      0|        return 1;
  469|      0|    }
  470|    234|    return 0;
  471|    234|}
asn1.c:store_byte:
 3217|    130|{
 3218|    130|    netsnmp_assert(*offset <= *pkt_len);
  ------------------
  |  |   47|    130|#      define netsnmp_assert(x)  do { \
  |  |   48|    130|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 130, False: 0]
  |  |  ------------------
  |  |   49|    130|                 ; \
  |  |   50|    130|              else \
  |  |   51|    130|                 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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    130|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 130]
  |  |  ------------------
  ------------------
 3219|    130|    if (*offset >= *pkt_len && (!r || !asn_realloc(pkt, pkt_len)))
  ------------------
  |  Branch (3219:9): [True: 0, False: 130]
  |  Branch (3219:33): [True: 0, False: 0]
  |  Branch (3219:39): [True: 0, False: 0]
  ------------------
 3220|      0|        return 0;
 3221|    130|    netsnmp_assert(*offset < *pkt_len);
  ------------------
  |  |   47|    130|#      define netsnmp_assert(x)  do { \
  |  |   48|    130|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 130, False: 0]
  |  |  ------------------
  |  |   49|    130|                 ; \
  |  |   50|    130|              else \
  |  |   51|    130|                 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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    130|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 130]
  |  |  ------------------
  ------------------
 3222|    130|    *(*pkt + *pkt_len - (++*offset)) = byte;
 3223|    130|    return 1;
 3224|    130|}
asn1.c:store_uint32:
 3239|    130|{
 3240|    130|    if (!store_byte(pkt, pkt_len, offset, r, subid & 0x7f))
  ------------------
  |  Branch (3240:9): [True: 0, False: 130]
  ------------------
 3241|      0|        return 0;
 3242|       |
 3243|    130|    for (subid >>= 7; subid; subid >>= 7)
  ------------------
  |  Branch (3243:23): [True: 0, False: 130]
  ------------------
 3244|      0|        if (!store_byte(pkt, pkt_len, offset, r, subid | 0x80))
  ------------------
  |  Branch (3244:13): [True: 0, False: 0]
  ------------------
 3245|      0|            return 0;
 3246|       |
 3247|    130|    return 1;
 3248|    130|}

init_callbacks:
  196|     58|{
  197|       |    /*
  198|       |     * (poses a problem if you put init_callbacks() inside of
  199|       |     * init_snmp() and then want the app to register a callback before
  200|       |     * init_snmp() is called in the first place.  -- Wes 
  201|       |     */
  202|     58|    if (0 == _callback_need_init)
  ------------------
  |  Branch (202:9): [True: 57, False: 1]
  ------------------
  203|     57|        return;
  204|       |    
  205|      1|    _callback_need_init = 0;
  206|       |    
  207|      1|    memset(thecallbacks, 0, sizeof(thecallbacks)); 
  208|      1|#ifdef LOCK_PER_CALLBACK_SUBID
  209|      1|    memset(_locks, 0, sizeof(_locks));
  210|       |#else
  211|       |    _lock = 0;
  212|       |#endif
  213|       |    
  214|      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]
  |  |  ------------------
  ------------------
  215|      1|}
snmp_register_callback:
  256|    627|{
  257|    627|    return netsnmp_register_callback( major, minor, new_callback, arg,
  258|    627|                                      NETSNMP_CALLBACK_DEFAULT_PRIORITY);
  ------------------
  |  |   40|    627|#define NETSNMP_CALLBACK_DEFAULT_PRIORITY       0
  ------------------
  259|    627|}
netsnmp_register_callback:
  278|    627|{
  279|    627|    struct snmp_gen_callback *newscp = NULL, *scp = NULL;
  280|       |
  281|    627|    if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
  ------------------
  |  |   12|  1.25k|#define MAX_CALLBACK_IDS    2
  ------------------
                  if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
  ------------------
  |  |   13|    627|#define MAX_CALLBACK_SUBIDS 18
  ------------------
  |  Branch (281:9): [True: 0, False: 627]
  |  Branch (281:38): [True: 0, False: 627]
  ------------------
  282|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  283|      0|    }
  284|       |
  285|    627|    if (_callback_need_init)
  ------------------
  |  Branch (285:9): [True: 1, False: 626]
  ------------------
  286|      1|        init_callbacks();
  287|       |
  288|    627|    _callback_lock(major,minor, "netsnmp_register_callback", 1);
  289|       |    
  290|    627|    if ((newscp = SNMP_MALLOC_STRUCT(snmp_gen_callback)) == NULL) {
  ------------------
  |  |   69|    627|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  |  Branch (290:9): [True: 0, False: 627]
  ------------------
  291|      0|        _callback_unlock(major,minor);
  292|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  293|    627|    } else {
  294|    627|        struct snmp_gen_callback **prevNext = &(thecallbacks[major][minor]);
  295|       |
  296|    627|        newscp->priority = priority;
  297|    627|        newscp->sc_client_arg = arg;
  298|    627|        newscp->sc_callback = new_callback;
  299|    627|        newscp->next = NULL;
  300|       |
  301|  1.14k|        for (scp = thecallbacks[major][minor]; scp != NULL;
  ------------------
  |  Branch (301:48): [True: 513, False: 627]
  ------------------
  302|    627|             scp = scp->next) {
  303|    513|            if (newscp->priority < scp->priority) {
  ------------------
  |  Branch (303:17): [True: 0, False: 513]
  ------------------
  304|      0|                newscp->next = scp;
  305|      0|                break;
  306|      0|            }
  307|    513|            prevNext = &(scp->next);
  308|    513|        }
  309|       |
  310|    627|        *prevNext = newscp;
  311|       |
  312|    627|        DEBUGMSGTL(("callback", "registered (%d,%d) at %p with priority %d\n",
  ------------------
  |  |   66|    627|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    627|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 627]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 627]
  |  |  ------------------
  ------------------
  313|    627|                    major, minor, newscp, priority));
  314|    627|        _callback_unlock(major,minor);
  315|    627|        return SNMPERR_SUCCESS;
  ------------------
  |  |  184|    627|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  316|    627|    }
  317|    627|}
snmp_call_callbacks:
  338|    399|{
  339|    399|    struct snmp_gen_callback *scp;
  340|    399|    unsigned int    count = 0;
  341|       |    
  342|    399|    if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
  ------------------
  |  |   12|    798|#define MAX_CALLBACK_IDS    2
  ------------------
                  if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
  ------------------
  |  |   13|    399|#define MAX_CALLBACK_SUBIDS 18
  ------------------
  |  Branch (342:9): [True: 0, False: 399]
  |  Branch (342:38): [True: 0, False: 399]
  ------------------
  343|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  344|      0|    }
  345|       |    
  346|    399|    if (_callback_need_init)
  ------------------
  |  Branch (346:9): [True: 0, False: 399]
  ------------------
  347|      0|        init_callbacks();
  348|       |
  349|    399|#ifdef LOCK_PER_CALLBACK_SUBID
  350|    399|    _callback_lock(major,minor,"snmp_call_callbacks", 1);
  351|       |#else
  352|       |    /*
  353|       |     * Notes:
  354|       |     * - this gets hit the first time a trap is sent after a new trap
  355|       |     *   destination has been added (session init cb during send trap cb)
  356|       |     */
  357|       |    _callback_lock(major,minor, NULL, 0);
  358|       |#endif
  359|       |
  360|    399|    DEBUGMSGTL(("callback", "START calling callbacks for maj=%d min=%d\n",
  ------------------
  |  |   66|    399|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    399|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 399]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 399]
  |  |  ------------------
  ------------------
  361|    399|                major, minor));
  362|       |
  363|       |    /*
  364|       |     * for each registered callback of type major and minor 
  365|       |     */
  366|  1.02k|    for (scp = thecallbacks[major][minor]; scp != NULL; scp = scp->next) {
  ------------------
  |  Branch (366:44): [True: 627, False: 399]
  ------------------
  367|       |
  368|       |        /*
  369|       |         * skip unregistered callbacks
  370|       |         */
  371|    627|        if(NULL == scp->sc_callback)
  ------------------
  |  Branch (371:12): [True: 0, False: 627]
  ------------------
  372|      0|            continue;
  373|       |
  374|    627|        DEBUGMSGTL(("callback", "calling a callback for maj=%d min=%d\n",
  ------------------
  |  |   66|    627|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    627|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 627]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 627]
  |  |  ------------------
  ------------------
  375|    627|                    major, minor));
  376|       |
  377|       |        /*
  378|       |         * call them 
  379|       |         */
  380|    627|        (*(scp->sc_callback)) (major, minor, caller_arg,
  381|    627|                               scp->sc_client_arg);
  382|    627|        count++;
  383|    627|    }
  384|       |
  385|    399|    DEBUGMSGTL(("callback",
  ------------------
  |  |   66|    399|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    399|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 399]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 399]
  |  |  ------------------
  ------------------
  386|    399|                "END calling callbacks for maj=%d min=%d (%d called)\n",
  387|    399|                major, minor, count));
  388|       |
  389|    399|    _callback_unlock(major,minor);
  390|    399|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|    399|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  391|    399|}
netsnmp_callback_clear_client_arg:
  516|    114|{
  517|    114|    struct snmp_gen_callback *scp = NULL;
  518|    114|    int rc = 0;
  519|       |
  520|       |    /*
  521|       |     * don't init i and j before loop, since the caller specified
  522|       |     * the starting point explicitly. But *after* the i loop has
  523|       |     * finished executing once, init j to 0 for the next pass
  524|       |     * through the subids.
  525|       |     */
  526|    342|    for (; i < MAX_CALLBACK_IDS; i++,j=0) {
  ------------------
  |  |   12|    342|#define MAX_CALLBACK_IDS    2
  ------------------
  |  Branch (526:12): [True: 228, False: 114]
  ------------------
  527|  4.27k|        for (; j < MAX_CALLBACK_SUBIDS; j++) {
  ------------------
  |  |   13|  4.27k|#define MAX_CALLBACK_SUBIDS 18
  ------------------
  |  Branch (527:16): [True: 4.04k, False: 228]
  ------------------
  528|  4.04k|            scp = thecallbacks[i][j]; 
  529|  5.07k|            while (scp != NULL) {
  ------------------
  |  Branch (529:20): [True: 1.02k, False: 4.04k]
  ------------------
  530|  1.02k|                if ((NULL != scp->sc_callback) &&
  ------------------
  |  Branch (530:21): [True: 1.02k, False: 0]
  ------------------
  531|  1.02k|                    (scp->sc_client_arg != NULL) &&
  ------------------
  |  Branch (531:21): [True: 57, False: 969]
  ------------------
  532|     57|                    (scp->sc_client_arg == ptr)) {
  ------------------
  |  Branch (532:21): [True: 0, False: 57]
  ------------------
  533|      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]
  |  |  ------------------
  ------------------
  534|      0|                    scp->sc_client_arg = NULL;
  535|      0|                    ++rc;
  536|      0|                }
  537|  1.02k|                scp = scp->next;
  538|  1.02k|            }
  539|  4.04k|        }
  540|    228|    }
  541|       |
  542|    114|    if (0 != rc) {
  ------------------
  |  Branch (542:9): [True: 0, False: 114]
  ------------------
  543|      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]
  |  |  ------------------
  ------------------
  544|      0|    }
  545|       |
  546|    114|    return rc;
  547|    114|}
clear_callback:
  551|     57|{
  552|     57|    unsigned int i = 0, j = 0;
  553|     57|    struct snmp_gen_callback *scp = NULL;
  554|       |
  555|     57|    if (_callback_need_init)
  ------------------
  |  Branch (555:9): [True: 0, False: 57]
  ------------------
  556|      0|        init_callbacks();
  557|       |
  558|     57|    DEBUGMSGTL(("callback", "clear callback\n"));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
  559|    171|    for (i = 0; i < MAX_CALLBACK_IDS; i++) {
  ------------------
  |  |   12|    171|#define MAX_CALLBACK_IDS    2
  ------------------
  |  Branch (559:17): [True: 114, False: 57]
  ------------------
  560|  2.16k|        for (j = 0; j < MAX_CALLBACK_SUBIDS; j++) {
  ------------------
  |  |   13|  2.16k|#define MAX_CALLBACK_SUBIDS 18
  ------------------
  |  Branch (560:21): [True: 2.05k, False: 114]
  ------------------
  561|  2.05k|            _callback_lock(i,j, "clear_callback", 1);
  562|  2.05k|            scp = thecallbacks[i][j];
  563|  2.67k|            while (scp != NULL) {
  ------------------
  |  Branch (563:20): [True: 627, False: 2.05k]
  ------------------
  564|    627|                thecallbacks[i][j] = scp->next;
  565|       |                /*
  566|       |                 * if there is a client arg, check for duplicates
  567|       |                 * and then free it.
  568|       |                 */
  569|    627|                if ((NULL != scp->sc_callback) &&
  ------------------
  |  Branch (569:21): [True: 627, False: 0]
  ------------------
  570|    627|                    (scp->sc_client_arg != NULL)) {
  ------------------
  |  Branch (570:21): [True: 57, False: 570]
  ------------------
  571|     57|                    void *tmp_arg;
  572|       |                    /*
  573|       |                     * save the client arg, then set it to null so that it
  574|       |                     * won't look like a duplicate, then check for duplicates
  575|       |                     * starting at the current i,j (earlier dups should have
  576|       |                     * already been found) and free the pointer.
  577|       |                     */
  578|     57|                    tmp_arg = scp->sc_client_arg;
  579|     57|                    scp->sc_client_arg = NULL;
  580|     57|                    DEBUGMSGTL(("9:callback", "  freeing %p at [%d,%d]\n", tmp_arg, i, j));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
  581|     57|                    (void)netsnmp_callback_clear_client_arg(tmp_arg, i, j);
  582|     57|                    free(tmp_arg);
  583|     57|                }
  584|       |                SNMP_FREE(scp);
  ------------------
  |  |   62|    627|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 627, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 627]
  |  |  ------------------
  ------------------
  585|    627|                scp = thecallbacks[i][j];
  586|    627|            }
  587|  2.05k|            _callback_unlock(i,j);
  588|  2.05k|        }
  589|    114|    }
  590|     57|}
callback.c:_callback_lock:
  119|  3.07k|{
  120|  3.07k|    int lock_holded=0;
  121|  3.07k|    NETSNMP_SELECT_TIMEVAL lock_time;
  ------------------
  |  | 1774|  3.07k|#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.07k|#ifdef CALLBACK_NAME_LOGGING
  131|  3.07k|    DEBUGMSGTL(("9:callback:lock", "locked (%s,%s)\n",
  ------------------
  |  |   66|  3.07k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.07k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.07k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#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.07k]
  |  |  ------------------
  ------------------
  132|  3.07k|                types[major], (SNMP_CALLBACK_LIBRARY == major) ?
  133|  3.07k|                SNMP_STRORNULL(lib[minor]) : "null"));
  134|  3.07k|#endif
  135|  3.07k|    while (CALLBACK_LOCK_COUNT(major,minor) >= 1 && ++lock_holded < 100) {
  ------------------
  |  |  109|  3.07k|#define CALLBACK_LOCK_COUNT(maj,min) _locks[maj][min]
  ------------------
  |  Branch (135:12): [True: 0, False: 3.07k]
  |  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.07k|    if(lock_holded >= 100) {
  ------------------
  |  Branch (141:8): [True: 0, False: 3.07k]
  ------------------
  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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      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.07k|    CALLBACK_LOCK(major,minor);
  ------------------
  |  |  107|  3.07k|#define CALLBACK_LOCK(maj,min) ++_locks[maj][min]
  ------------------
  152|  3.07k|    return 0;
  153|  3.07k|}
callback.c:_callback_unlock:
  157|  3.07k|{
  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.07k|    CALLBACK_UNLOCK(major,minor);
  ------------------
  |  |  108|  3.07k|#define CALLBACK_UNLOCK(maj,min) --_locks[maj][min]
  ------------------
  166|       |
  167|  3.07k|    if (CALLBACK_LOCK_COUNT(major,minor) == 0) {
  ------------------
  |  |  109|  3.07k|#define CALLBACK_LOCK_COUNT(maj,min) _locks[maj][min]
  ------------------
  |  Branch (167:9): [True: 3.07k, False: 0]
  ------------------
  168|  3.07k|        struct snmp_gen_callback *scp, **prevNext;
  169|  3.07k|        scp = thecallbacks[major][minor];
  170|  3.07k|        prevNext = &(thecallbacks[major][minor]);
  171|  4.84k|        while (scp != NULL) {
  ------------------
  |  Branch (171:16): [True: 1.76k, False: 3.07k]
  ------------------
  172|  1.76k|            if (scp->sc_callback == NULL) {
  ------------------
  |  Branch (172:17): [True: 0, False: 1.76k]
  ------------------
  173|      0|                *prevNext = scp->next;
  174|      0|                SNMP_FREE(scp);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  175|      0|                scp = *prevNext;
  176|  1.76k|            } else {
  177|  1.76k|                prevNext = &(scp->next);
  178|  1.76k|                scp = scp->next;
  179|  1.76k|            }
  180|  1.76k|        }
  181|  3.07k|    }
  182|       |
  183|  3.07k|#ifdef CALLBACK_NAME_LOGGING
  184|  3.07k|    DEBUGMSGTL(("9:callback:lock", "unlocked (%s,%s)\n",
  ------------------
  |  |   66|  3.07k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.07k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.07k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#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.07k]
  |  |  ------------------
  ------------------
  185|  3.07k|                types[major], (SNMP_CALLBACK_LIBRARY == major) ?
  186|  3.07k|                SNMP_STRORNULL(lib[minor]) : "null"));
  187|  3.07k|#endif
  188|  3.07k|}

_netsnmp_release_trustcerts:
  175|    171|{
  176|    171|    if (NULL != _trusted_certs) {
  ------------------
  |  Branch (176:9): [True: 57, False: 114]
  ------------------
  177|     57|        CONTAINER_FREE_ALL(_trusted_certs, NULL);
  178|     57|        CONTAINER_FREE(_trusted_certs);
  179|       |        _trusted_certs = NULL;
  180|     57|    }
  181|    171|}
_setup_trusted_certs:
  185|     57|{
  186|     57|    _trusted_certs = netsnmp_container_find("trusted_certs:fifo");
  187|     57|    if (NULL == _trusted_certs) {
  ------------------
  |  Branch (187:9): [True: 0, False: 57]
  ------------------
  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|     57|    _trusted_certs->container_name = strdup("trusted certificates");
  193|     57|    _trusted_certs->compare = netsnmp_str_compare;
  194|     57|}
netsnmp_certs_init:
  209|     57|{
  210|     57|    const char *trustCert_help = TRUSTCERT_CONFIG_TOKEN
  ------------------
  |  |  140|     57|#define TRUSTCERT_CONFIG_TOKEN "trustCert"
  ------------------
  211|     57|        " FINGERPRINT|FILENAME";
  212|       |
  213|     57|    register_config_handler("snmp", TRUSTCERT_CONFIG_TOKEN,
  ------------------
  |  |  140|     57|#define TRUSTCERT_CONFIG_TOKEN "trustCert"
  ------------------
  214|     57|                            _parse_trustcert, _netsnmp_release_trustcerts,
  215|     57|                            trustCert_help);
  216|     57|    _setup_containers();
  217|       |
  218|       |    /** add certificate type mapping */
  219|     57|    se_add_pair_to_slist("cert_types", strdup("pem"), NS_CERT_TYPE_PEM);
  220|     57|    se_add_pair_to_slist("cert_types", strdup("crt"), NS_CERT_TYPE_DER);
  221|     57|    se_add_pair_to_slist("cert_types", strdup("cer"), NS_CERT_TYPE_DER);
  222|     57|    se_add_pair_to_slist("cert_types", strdup("cert"), NS_CERT_TYPE_DER);
  223|     57|    se_add_pair_to_slist("cert_types", strdup("der"), NS_CERT_TYPE_DER);
  224|     57|    se_add_pair_to_slist("cert_types", strdup("key"), NS_CERT_TYPE_KEY);
  225|     57|    se_add_pair_to_slist("cert_types", strdup("private"), NS_CERT_TYPE_KEY);
  226|       |
  227|       |    /** hash algs */
  228|     57|    se_add_pair_to_slist("cert_hash_alg", strdup("sha1"), NS_HASH_SHA1);
  ------------------
  |  |   85|     57|#define NS_HASH_SHA1        2
  ------------------
  229|     57|    se_add_pair_to_slist("cert_hash_alg", strdup("md5"), NS_HASH_MD5);
  ------------------
  |  |   84|     57|#define NS_HASH_MD5         1
  ------------------
  230|     57|    se_add_pair_to_slist("cert_hash_alg", strdup("sha224"), NS_HASH_SHA224);
  ------------------
  |  |   86|     57|#define NS_HASH_SHA224      3
  ------------------
  231|     57|    se_add_pair_to_slist("cert_hash_alg", strdup("sha256"), NS_HASH_SHA256);
  ------------------
  |  |   87|     57|#define NS_HASH_SHA256      4
  ------------------
  232|     57|    se_add_pair_to_slist("cert_hash_alg", strdup("sha384"), NS_HASH_SHA384);
  ------------------
  |  |   88|     57|#define NS_HASH_SHA384      5
  ------------------
  233|     57|    se_add_pair_to_slist("cert_hash_alg", strdup("sha512"), NS_HASH_SHA512);
  ------------------
  |  |   89|     57|#define NS_HASH_SHA512      6
  ------------------
  234|       |
  235|       |    /** map types */
  236|     57|    se_add_pair_to_slist("cert_map_type", strdup("cn"),
  237|     57|                         TSNM_tlstmCertCommonName);
  ------------------
  |  |  129|     57|#define TSNM_tlstmCertCommonName                6
  ------------------
  238|     57|    se_add_pair_to_slist("cert_map_type", strdup("ip"),
  239|     57|                         TSNM_tlstmCertSANIpAddress);
  ------------------
  |  |  127|     57|#define TSNM_tlstmCertSANIpAddress              4
  ------------------
  240|     57|    se_add_pair_to_slist("cert_map_type", strdup("rfc822"),
  241|     57|                         TSNM_tlstmCertSANRFC822Name);
  ------------------
  |  |  125|     57|#define TSNM_tlstmCertSANRFC822Name             2
  ------------------
  242|     57|    se_add_pair_to_slist("cert_map_type", strdup("dns"),
  243|     57|                         TSNM_tlstmCertSANDNSName);
  ------------------
  |  |  126|     57|#define TSNM_tlstmCertSANDNSName                3
  ------------------
  244|     57|    se_add_pair_to_slist("cert_map_type", strdup("any"), TSNM_tlstmCertSANAny);
  ------------------
  |  |  128|     57|#define TSNM_tlstmCertSANAny                    5
  ------------------
  245|     57|    se_add_pair_to_slist("cert_map_type", strdup("sn"),
  246|     57|                         TSNM_tlstmCertSpecified);
  ------------------
  |  |  124|     57|#define TSNM_tlstmCertSpecified                 1
  ------------------
  247|       |
  248|     57|}
netsnmp_certs_shutdown:
  252|     57|{
  253|     57|    netsnmp_container ***c, **containers[] = {
  254|     57|        &_tlstmParams, &_tlstmAddr, &_maps, &_certs, &_keys, NULL
  255|     57|    };
  256|       |
  257|     57|    DEBUGMSGT(("cert:util:shutdown","shutdown\n"));
  ------------------
  |  |   62|     57|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 57]
  |  |  ------------------
  ------------------
  258|       |
  259|    342|    for (c = containers; *c; c++) {
  ------------------
  |  Branch (259:26): [True: 285, False: 57]
  ------------------
  260|    285|        if (!**c)
  ------------------
  |  Branch (260:13): [True: 171, False: 114]
  ------------------
  261|    171|            continue;
  262|    114|        CONTAINER_FREE_ALL(**c, NULL);
  263|    114|        CONTAINER_FREE(**c);
  264|       |        **c = NULL;
  265|    114|    }
  266|     57|    _netsnmp_release_trustcerts();
  267|     57|}
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)
  |  |  ------------------
  |  |  |  |  184|      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|     57|{
  354|     57|    netsnmp_container *additional_keys;
  355|       |
  356|     57|    int rc;
  357|       |
  358|     57|    _certs = _get_cert_container("netsnmp certificates");
  359|     57|    if (NULL == _certs)
  ------------------
  |  Branch (359:9): [True: 0, False: 57]
  ------------------
  360|      0|        return;
  361|       |
  362|       |    /** additional keys: common name */
  363|     57|    additional_keys = netsnmp_container_find("certs_cn:binary_array");
  364|     57|    if (NULL == additional_keys) {
  ------------------
  |  Branch (364:9): [True: 0, False: 57]
  ------------------
  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|     57|    additional_keys->container_name = strdup("certs_cn");
  370|     57|    additional_keys->free_item = NULL;
  371|     57|    additional_keys->compare = _cert_cn_compare;
  372|     57|    CONTAINER_SET_OPTIONS(additional_keys, CONTAINER_KEY_ALLOW_DUPLICATES, rc);
  ------------------
  |  |  375|     57|#define CONTAINER_SET_OPTIONS(x,o,rc)  do {                             \
  |  |  376|     57|        if (NULL==(x)->options)                                         \
  |  |  ------------------
  |  |  |  Branch (376:13): [True: 0, False: 57]
  |  |  ------------------
  |  |  377|     57|            rc = -1;                                                    \
  |  |  378|     57|        else {                                                          \
  |  |  379|     57|            rc = (x)->options(x, 1, o);                                 \
  |  |  380|     57|            if (rc != -1 )                                              \
  |  |  ------------------
  |  |  |  Branch (380:17): [True: 57, False: 0]
  |  |  ------------------
  |  |  381|     57|                (x)->flags |= o;                                        \
  |  |  382|     57|        }                                                               \
  |  |  383|     57|    } while(0)
  |  |  ------------------
  |  |  |  Branch (383:13): [Folded, False: 57]
  |  |  ------------------
  ------------------
  373|     57|    netsnmp_container_add_index(_certs, additional_keys);
  374|       |
  375|       |    /** additional keys: subject name */
  376|     57|    additional_keys = netsnmp_container_find("certs_sn:binary_array");
  377|     57|    if (NULL == additional_keys) {
  ------------------
  |  Branch (377:9): [True: 0, False: 57]
  ------------------
  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|     57|    additional_keys->container_name = strdup("certs_sn");
  383|     57|    additional_keys->free_item = NULL;
  384|     57|    additional_keys->compare = _cert_sn_compare;
  385|     57|    additional_keys->ncompare = _cert_sn_ncompare;
  386|     57|    CONTAINER_SET_OPTIONS(additional_keys, CONTAINER_KEY_ALLOW_DUPLICATES, rc);
  ------------------
  |  |  375|     57|#define CONTAINER_SET_OPTIONS(x,o,rc)  do {                             \
  |  |  376|     57|        if (NULL==(x)->options)                                         \
  |  |  ------------------
  |  |  |  Branch (376:13): [True: 0, False: 57]
  |  |  ------------------
  |  |  377|     57|            rc = -1;                                                    \
  |  |  378|     57|        else {                                                          \
  |  |  379|     57|            rc = (x)->options(x, 1, o);                                 \
  |  |  380|     57|            if (rc != -1 )                                              \
  |  |  ------------------
  |  |  |  Branch (380:17): [True: 57, False: 0]
  |  |  ------------------
  |  |  381|     57|                (x)->flags |= o;                                        \
  |  |  382|     57|        }                                                               \
  |  |  383|     57|    } while(0)
  |  |  ------------------
  |  |  |  Branch (383:13): [Folded, False: 57]
  |  |  ------------------
  ------------------
  387|     57|    netsnmp_container_add_index(_certs, additional_keys);
  388|       |
  389|       |    /** additional keys: file name */
  390|     57|    additional_keys = netsnmp_container_find("certs_fn:binary_array");
  391|     57|    if (NULL == additional_keys) {
  ------------------
  |  Branch (391:9): [True: 0, False: 57]
  ------------------
  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|     57|    additional_keys->container_name = strdup("certs_fn");
  397|     57|    additional_keys->free_item = NULL;
  398|     57|    additional_keys->compare = _cert_fn_compare;
  399|     57|    additional_keys->ncompare = _cert_fn_ncompare;
  400|     57|    CONTAINER_SET_OPTIONS(additional_keys, CONTAINER_KEY_ALLOW_DUPLICATES, rc);
  ------------------
  |  |  375|     57|#define CONTAINER_SET_OPTIONS(x,o,rc)  do {                             \
  |  |  376|     57|        if (NULL==(x)->options)                                         \
  |  |  ------------------
  |  |  |  Branch (376:13): [True: 0, False: 57]
  |  |  ------------------
  |  |  377|     57|            rc = -1;                                                    \
  |  |  378|     57|        else {                                                          \
  |  |  379|     57|            rc = (x)->options(x, 1, o);                                 \
  |  |  380|     57|            if (rc != -1 )                                              \
  |  |  ------------------
  |  |  |  Branch (380:17): [True: 57, False: 0]
  |  |  ------------------
  |  |  381|     57|                (x)->flags |= o;                                        \
  |  |  382|     57|        }                                                               \
  |  |  383|     57|    } while(0)
  |  |  ------------------
  |  |  |  Branch (383:13): [Folded, False: 57]
  |  |  ------------------
  ------------------
  401|     57|    netsnmp_container_add_index(_certs, additional_keys);
  402|       |
  403|     57|    _keys = netsnmp_container_find("cert_keys:binary_array");
  404|     57|    if (NULL == _keys) {
  ------------------
  |  Branch (404:9): [True: 0, False: 57]
  ------------------
  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|     57|    _keys->container_name = strdup("netsnmp certificate keys");
  410|     57|    _keys->free_item = _key_free;
  411|     57|    _keys->compare = _cert_fn_compare;
  412|       |
  413|     57|    _setup_trusted_certs();
  414|     57|}
cert_util.c:_get_cert_container:
  332|     57|{
  333|     57|    netsnmp_container *c;
  334|       |
  335|     57|    int rc;
  336|       |
  337|     57|    c = netsnmp_container_find("certs:binary_array");
  338|     57|    if (NULL == c) {
  ------------------
  |  Branch (338:9): [True: 0, False: 57]
  ------------------
  339|      0|        snmp_log(LOG_ERR, "could not create container for %s\n", use);
  340|      0|        return NULL;
  341|      0|    }
  342|     57|    c->container_name = strdup(use);
  343|     57|    c->free_item = _cert_free;
  344|     57|    c->compare = _cert_compare;
  345|       |
  346|     57|    CONTAINER_SET_OPTIONS(c, CONTAINER_KEY_ALLOW_DUPLICATES, rc);
  ------------------
  |  |  375|     57|#define CONTAINER_SET_OPTIONS(x,o,rc)  do {                             \
  |  |  376|     57|        if (NULL==(x)->options)                                         \
  |  |  ------------------
  |  |  |  Branch (376:13): [True: 0, False: 57]
  |  |  ------------------
  |  |  377|     57|            rc = -1;                                                    \
  |  |  378|     57|        else {                                                          \
  |  |  379|     57|            rc = (x)->options(x, 1, o);                                 \
  |  |  380|     57|            if (rc != -1 )                                              \
  |  |  ------------------
  |  |  |  Branch (380:17): [True: 57, False: 0]
  |  |  ------------------
  |  |  381|     57|                (x)->flags |= o;                                        \
  |  |  382|     57|        }                                                               \
  |  |  383|     57|    } while(0)
  |  |  ------------------
  |  |  |  Branch (383:13): [Folded, False: 57]
  |  |  ------------------
  ------------------
  347|       |
  348|     57|    return c;
  349|     57|}
cert_util.c:_cert_indexes_load:
 1721|      1|{
 1722|      1|    const char     *confpath;
 1723|      1|    char           *confpath_copy, *dir, *st = NULL;
 1724|      1|    char            certdir[SNMP_MAXPATH];
 1725|      1|    const char     *subdirs[] = { NULL, "ca-certs", "certs", "private", NULL };
 1726|      1|    int             i = 0;
 1727|       |
 1728|       |    /*
 1729|       |     * load indexes from persistent dir
 1730|       |     */
 1731|      1|    _certindexes_load();
 1732|       |
 1733|       |    /*
 1734|       |     * duplicate path building from read_config_files_of_type() in
 1735|       |     * read_config.c. That is, use SNMPCONFPATH environment variable if
 1736|       |     * it is defined, otherwise use configuration directory.
 1737|       |     */
 1738|      1|    confpath = netsnmp_getenv("SNMPCONFPATH");
 1739|      1|    if (NULL == confpath)
  ------------------
  |  Branch (1739:9): [True: 1, False: 0]
  ------------------
 1740|      1|        confpath = get_configuration_directory();
 1741|       |
 1742|      1|    subdirs[0] = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1743|      1|                                       NETSNMP_DS_LIB_CERT_EXTRA_SUBDIR);
  ------------------
  |  |  177|      1|#define NETSNMP_DS_LIB_CERT_EXTRA_SUBDIR 26
  ------------------
 1744|      1|    confpath_copy = strdup(confpath);
 1745|      1|    if (!confpath_copy)
  ------------------
  |  Branch (1745:9): [True: 0, False: 1]
  ------------------
 1746|      0|        return;
 1747|      1|    for ( dir = strtok_r(confpath_copy, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      1|#define ENV_SEPARATOR ":"
  ------------------
 1748|      5|          dir; dir = strtok_r(NULL, ENV_SEPARATOR, &st)) {
  ------------------
  |  |   67|      4|#define ENV_SEPARATOR ":"
  ------------------
  |  Branch (1748:11): [True: 4, False: 1]
  ------------------
 1749|       |
 1750|      4|        i = (NULL == subdirs[0]) ? 1 : 0;
  ------------------
  |  Branch (1750:13): [True: 4, False: 0]
  ------------------
 1751|     16|        for ( ; subdirs[i] ; ++i ) {
  ------------------
  |  Branch (1751:17): [True: 12, False: 4]
  ------------------
 1752|       |            /** check tls subdir */
 1753|     12|            snprintf(certdir, sizeof(certdir), "%s/tls/%s", dir, subdirs[i]);
 1754|     12|            _add_certdir(certdir);
 1755|     12|        } /* for subdirs */
 1756|      4|    } /* for conf path dirs */
 1757|       |    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]
  |  |  ------------------
  ------------------
 1758|      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|    dir = opendir( filename );
  793|      1|    if ( dir == NULL ) {
  ------------------
  |  Branch (793:10): [True: 1, False: 0]
  ------------------
  794|      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]
  |  |  ------------------
  ------------------
  795|      1|                   "creating new cert_indexes directory\n"));
  796|      1|        mkdirhier( filename, NETSNMP_AGENT_DIRECTORY_MODE, 0);
  ------------------
  |  | 2034|      1|#define NETSNMP_AGENT_DIRECTORY_MODE 0700
  ------------------
  797|      1|        return;
  798|      1|    }
  799|       |
  800|       |    /*
  801|       |     * Create a list of which directory each file refers to
  802|       |     */
  803|      0|    while ((file = readdir( dir ))) {
  ------------------
  |  Branch (803:12): [True: 0, False: 0]
  ------------------
  804|      0|        if ( !isdigit(0xFF & file->d_name[0]))
  ------------------
  |  Branch (804:14): [True: 0, False: 0]
  ------------------
  805|      0|            continue;
  806|      0|        i = atoi( file->d_name );
  807|       |
  808|      0|        snprintf(filename, sizeof(filename), "%s/cert_indexes/%d",
  809|      0|                 get_persistent_directory(), i );
  810|      0|        fp = fopen( filename, "r" );
  811|      0|        if ( !fp ) {
  ------------------
  |  Branch (811:14): [True: 0, False: 0]
  ------------------
  812|      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]
  |  |  ------------------
  ------------------
  813|      0|            continue;
  814|      0|        }
  815|      0|        cp = fgets( line, sizeof(line), fp );
  816|      0|        if ( cp ) {
  ------------------
  |  Branch (816:14): [True: 0, False: 0]
  ------------------
  817|      0|            line[strlen(line)-1] = 0;
  818|      0|            pos = strrchr(line, ' ');
  819|      0|            if (pos)
  ------------------
  |  Branch (819:17): [True: 0, False: 0]
  ------------------
  820|      0|                *pos = '\0';
  821|      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]
  |  |  ------------------
  ------------------
  822|      0|            (void)_certindex_add( line+4, i );  /* Skip 'DIR ' */
  823|      0|        } else {
  824|      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]
  |  |  ------------------
  ------------------
  825|      0|        }
  826|      0|        fclose( fp );
  827|      0|    }
  828|      0|    closedir( dir );
  829|      0|}
cert_util.c:_add_certdir:
 1630|     12|{
 1631|     12|    FILE           *index;
 1632|     12|    char           *file;
 1633|     12|    int             count = 0;
 1634|     12|    netsnmp_container *cert_container;
 1635|     12|    netsnmp_iterator  *it;
 1636|     12|    struct stat     statbuf;
 1637|       |
 1638|     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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     12|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 12]
  |  |  ------------------
  ------------------
 1639|       |
 1640|     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]
  |  |  ------------------
  ------------------
 1641|       |
 1642|     12|    if (stat(dirname, &statbuf) != 0) {
  ------------------
  |  Branch (1642:9): [True: 12, False: 0]
  ------------------
 1643|     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]
  |  |  ------------------
  ------------------
 1644|     12|                   dirname ));
 1645|     12|        return -1;
 1646|     12|    }
 1647|      0|#ifdef S_ISDIR
 1648|      0|    if (!S_ISDIR(statbuf.st_mode)) {
  ------------------
  |  Branch (1648:9): [True: 0, False: 0]
  ------------------
 1649|      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]
  |  |  ------------------
  ------------------
 1650|      0|        return -1;
 1651|      0|    }
 1652|      0|#endif
 1653|       |
 1654|      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]
  |  |  ------------------
  ------------------
 1655|       |
 1656|       |    /*
 1657|       |     * look for existing index
 1658|       |     */
 1659|      0|    count = _cert_read_index(dirname, &statbuf);
 1660|      0|    if (count >= 0)
  ------------------
  |  Branch (1660:9): [True: 0, False: 0]
  ------------------
 1661|      0|        return count;
 1662|       |
 1663|      0|    index = _certindex_new( dirname );
 1664|      0|    if (NULL == index) {
  ------------------
  |  Branch (1664:9): [True: 0, False: 0]
  ------------------
 1665|      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]
  |  |  ------------------
  ------------------
 1666|      0|                    "error opening index for cert directory\n"));
 1667|      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]
  |  |  ------------------
  ------------------
 1668|      0|    }
 1669|       |
 1670|       |    /*
 1671|       |     * index was missing, out of date or bad. rescan directory.
 1672|       |     */
 1673|      0|    cert_container =
 1674|      0|        netsnmp_directory_container_read_some(NULL, dirname,
 1675|      0|                                              _cert_cert_filter, NULL,
 1676|      0|                                              NETSNMP_DIR_RELATIVE_PATH |
  ------------------
  |  |   48|      0|#define NETSNMP_DIR_RELATIVE_PATH                     0x0002
  ------------------
 1677|      0|                                              NETSNMP_DIR_EMPTY_OK |
  ------------------
  |  |   51|      0|#define NETSNMP_DIR_EMPTY_OK                          0x0008
  ------------------
 1678|      0|                                              NETSNMP_DIR_ALLOW_DUPLICATES);
  ------------------
  |  |   57|      0|#define NETSNMP_DIR_ALLOW_DUPLICATES                  0x0040
  ------------------
 1679|      0|    if (NULL == cert_container) {
  ------------------
  |  Branch (1679:9): [True: 0, False: 0]
  ------------------
 1680|      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]
  |  |  ------------------
  ------------------
 1681|      0|                    "error creating container for cert files\n"));
 1682|      0|        goto err_index;
 1683|      0|    }
 1684|       |
 1685|       |    /*
 1686|       |     * iterate through the found files and add them to index
 1687|       |     */
 1688|      0|    it = CONTAINER_ITERATOR(cert_container);
  ------------------
  |  |  404|      0|#define CONTAINER_ITERATOR(x)       (x)->get_iterator(x)
  ------------------
 1689|      0|    if (NULL == it) {
  ------------------
  |  Branch (1689:9): [True: 0, False: 0]
  ------------------
 1690|      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]
  |  |  ------------------
  ------------------
 1691|      0|                    "error creating iterator for cert files\n"));
 1692|      0|        goto err_container;
 1693|      0|    }
 1694|       |
 1695|      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 (1695:37): [True: 0, False: 0]
  ------------------
 1696|      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]
  |  |  ------------------
  ------------------
 1697|      0|        if ( 0 == _add_certfile( dirname, file, index ))
  ------------------
  |  Branch (1697:14): [True: 0, False: 0]
  ------------------
 1698|      0|            count++;
 1699|      0|        else
 1700|      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]
  |  |  ------------------
  ------------------
 1701|      0|                        file));
 1702|      0|    }
 1703|       |
 1704|       |    /*
 1705|       |     * clean up and return
 1706|       |     */
 1707|      0|    ITERATOR_RELEASE(it);
  ------------------
  |  |  550|      0|#define ITERATOR_RELEASE(x) do { x->release(x); x = NULL; } while(0)
  |  |  ------------------
  |  |  |  Branch (550:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1708|       |
 1709|      0|  err_container:
 1710|      0|    netsnmp_directory_container_free(cert_container);
 1711|       |
 1712|      0|  err_index:
 1713|      0|    if (index)
  ------------------
  |  Branch (1713:9): [True: 0, False: 0]
  ------------------
 1714|      0|        fclose(index);
 1715|       |
 1716|      0|    return count;
 1717|      0|}

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

netsnmp_binary_array_release:
  216|    342|{
  217|    342|    binary_array_table *t = (binary_array_table*)c->container_data;
  218|    342|    SNMP_FREE(t->data);
  ------------------
  |  |   62|    342|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 285]
  |  |  |  Branch (62:66): [Folded, False: 342]
  |  |  ------------------
  ------------------
  219|    342|    SNMP_FREE(t);
  ------------------
  |  |   62|    342|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 342, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 342]
  |  |  ------------------
  ------------------
  220|    342|    SNMP_FREE(c->container_name);
  ------------------
  |  |   62|    342|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 342]
  |  |  |  Branch (62:66): [Folded, False: 342]
  |  |  ------------------
  ------------------
  221|       |    SNMP_FREE(c);
  ------------------
  |  |   62|    342|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 342, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 342]
  |  |  ------------------
  ------------------
  222|    342|}
netsnmp_binary_array_options_set:
  232|    228|{
  233|    228|#define BA_FLAGS (CONTAINER_KEY_ALLOW_DUPLICATES|CONTAINER_KEY_UNSORTED)
  234|       |
  235|    228|    if (set) {
  ------------------
  |  Branch (235:9): [True: 228, False: 0]
  ------------------
  236|    228|        if ((flags & BA_FLAGS) == flags) {
  ------------------
  |  |  233|    228|#define BA_FLAGS (CONTAINER_KEY_ALLOW_DUPLICATES|CONTAINER_KEY_UNSORTED)
  |  |  ------------------
  |  |  |  |  370|    228|#define CONTAINER_KEY_ALLOW_DUPLICATES             0x00000001
  |  |  ------------------
  |  |               #define BA_FLAGS (CONTAINER_KEY_ALLOW_DUPLICATES|CONTAINER_KEY_UNSORTED)
  |  |  ------------------
  |  |  |  |  371|    228|#define CONTAINER_KEY_UNSORTED                     0x00000002
  |  |  ------------------
  ------------------
  |  Branch (236:13): [True: 228, False: 0]
  ------------------
  237|       |            /** if turning off unsorted, do sort */
  238|    228|            int sort = ((c->flags & CONTAINER_KEY_UNSORTED) &&
  ------------------
  |  |  371|    228|#define CONTAINER_KEY_UNSORTED                     0x00000002
  ------------------
  |  Branch (238:25): [True: 0, False: 228]
  ------------------
  239|      0|                        ! (flags & CONTAINER_KEY_UNSORTED));
  ------------------
  |  |  371|      0|#define CONTAINER_KEY_UNSORTED                     0x00000002
  ------------------
  |  Branch (239:25): [True: 0, False: 0]
  ------------------
  240|    228|            c->flags = flags;
  241|    228|            if (sort) {
  ------------------
  |  Branch (241:17): [True: 0, False: 228]
  ------------------
  242|      0|                binary_array_table *t = (binary_array_table*)c->container_data;
  243|      0|                t->dirty = 1; /* force sort */
  244|      0|                Sort_Array(c);
  245|      0|            }
  246|    228|            return flags;
  247|    228|        } else {
  248|      0|            return -1; /* unsupported flag */
  249|      0|        }
  250|    228|    } else {
  251|      0|        return ((c->flags & flags) == flags);
  252|      0|    }
  253|    228|}
netsnmp_container_get_binary_array:
  816|    342|{
  817|       |    /*
  818|       |     * allocate memory
  819|       |     */
  820|    342|    netsnmp_container *c = SNMP_MALLOC_TYPEDEF(netsnmp_container);
  ------------------
  |  |   73|    342|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  821|    342|    if (NULL==c) {
  ------------------
  |  Branch (821:9): [True: 0, False: 342]
  ------------------
  822|      0|        snmp_log(LOG_ERR, "couldn't allocate memory\n");
  823|      0|        return NULL;
  824|      0|    }
  825|       |
  826|    342|    c->container_data = netsnmp_binary_array_initialize();
  827|    342|    if (NULL == c->container_data) {
  ------------------
  |  Branch (827:9): [True: 0, False: 342]
  ------------------
  828|      0|        free(c);
  829|      0|        snmp_log(LOG_ERR, "couldn't allocate memory for container_data\n");
  830|      0|        return NULL;
  831|      0|    }
  832|       |
  833|       |    /*
  834|       |     * NOTE: CHANGES HERE MUST BE DUPLICATED IN duplicate AS WELL!!
  835|       |     */
  836|    342|    netsnmp_init_container(c, NULL, _ba_free, _ba_size, NULL, _ba_insert,
  837|    342|                           _ba_remove, _ba_find);
  838|    342|    c->find_next = _ba_find_next;
  839|    342|    c->get_subset = _ba_get_subset;
  840|    342|    c->get_iterator = _ba_iterator_get;
  841|    342|    c->for_each = _ba_for_each;
  842|    342|    c->clear = _ba_clear;
  843|    342|    c->options = _ba_options;
  844|    342|    c->duplicate = _ba_duplicate;
  845|    342|    c->get_at = netsnmp_binary_array_get_at;
  846|    342|    c->remove_at = netsnmp_binary_array_remove_at;
  847|    342|    c->insert_before = _ba_insert_before;
  848|       |
  849|    342|    return c;
  850|    342|}
netsnmp_container_get_binary_array_factory:
  854|     57|{
  855|     57|    static netsnmp_factory f = { "binary_array",
  856|     57|                                 netsnmp_container_get_binary_array };
  857|       |    
  858|     57|    return &f;
  859|     57|}
netsnmp_container_binary_array_init:
  863|     57|{
  864|     57|    netsnmp_container_register("binary_array",
  865|     57|                               netsnmp_container_get_binary_array_factory());
  866|     57|}
container_binary_array.c:_ba_is_sorted:
  336|    684|{
  337|       |    /*
  338|       |     * The code below has been commented out because it negatively affects
  339|       |     * performance.
  340|       |     */
  341|       |#if 0
  342|       |    const binary_array_table *t = c->container_data;
  343|       |    int i;
  344|       |
  345|       |    for (i = 0; i + 1 < t->count; ++i)
  346|       |        if (c->compare(t->data[i], t->data[i + 1]) > 0)
  347|       |            return 0;
  348|       |#endif
  349|       |
  350|    684|    return 1;
  351|    684|}
container_binary_array.c:binary_search:
  125|  2.28k|{
  126|  2.28k|    binary_array_table *t = (binary_array_table*)c->container_data;
  127|  2.28k|    size_t             len = t->count;
  128|  2.28k|    size_t             half;
  129|  2.28k|    size_t             first = 0;
  130|  2.28k|    size_t             middle = 0; /* init not needed; keeps compiler happy */
  131|  2.28k|    int                result = 0; /* init not needed; keeps compiler happy */
  132|       |
  133|  2.28k|    if (!len) {
  ------------------
  |  Branch (133:9): [True: 0, False: 2.28k]
  ------------------
  134|      0|        if (NULL != next)
  ------------------
  |  Branch (134:13): [True: 0, False: 0]
  ------------------
  135|      0|            *next = 0;
  136|      0|        return -1;
  137|      0|    }
  138|       |
  139|  2.28k|    if (c->flags & CONTAINER_KEY_UNSORTED) {
  ------------------
  |  |  371|  2.28k|#define CONTAINER_KEY_UNSORTED                     0x00000002
  ------------------
  |  Branch (139:9): [True: 0, False: 2.28k]
  ------------------
  140|      0|        if (!exact) {
  ------------------
  |  Branch (140:13): [True: 0, False: 0]
  ------------------
  141|      0|            snmp_log(LOG_ERR, "non-exact search on unsorted container %s?!?\n",
  142|      0|                     c->container_name);
  143|      0|            return -1;
  144|      0|        }
  145|      0|        return linear_search(val, c);
  146|      0|    }
  147|       |
  148|  2.28k|    if (t->dirty)
  ------------------
  |  Branch (148:9): [True: 0, False: 2.28k]
  ------------------
  149|      0|        Sort_Array(c);
  150|       |
  151|  8.94k|    while (len > 0) {
  ------------------
  |  Branch (151:12): [True: 7.35k, False: 1.59k]
  ------------------
  152|  7.35k|        half = len >> 1;
  153|  7.35k|        middle = first + half;
  154|  7.35k|        if ((result = c->compare(t->data[middle], val)) < 0) {
  ------------------
  |  Branch (154:13): [True: 2.45k, False: 4.90k]
  ------------------
  155|  2.45k|            first = middle + 1;
  156|  2.45k|            len = len - half - 1;
  157|  4.90k|        } else if (result == 0) {
  ------------------
  |  Branch (157:20): [True: 684, False: 4.21k]
  ------------------
  158|    684|            first = middle;
  159|    684|            break;
  160|  4.21k|        } else {
  161|  4.21k|            len = half;
  162|  4.21k|        }
  163|  7.35k|    }
  164|       |
  165|  2.28k|    if (first >= t->count) {
  ------------------
  |  Branch (165:9): [True: 228, False: 2.05k]
  ------------------
  166|    228|        if (exact && NULL != next)
  ------------------
  |  Branch (166:13): [True: 228, False: 0]
  |  Branch (166:22): [True: 114, False: 114]
  ------------------
  167|    114|            *next = t->count;
  168|    228|        return -1;
  169|    228|    }
  170|       |
  171|  2.05k|    if (first != middle) {
  ------------------
  |  Branch (171:9): [True: 1.14k, False: 912]
  ------------------
  172|       |        /* last compare wasn't against first, so get actual result */
  173|  1.14k|        result = c->compare(t->data[first], val);
  174|  1.14k|    }
  175|       |
  176|  2.05k|    if(result == 0) {
  ------------------
  |  Branch (176:8): [True: 684, False: 1.36k]
  ------------------
  177|    684|        if (exact && NULL != next)
  ------------------
  |  Branch (177:13): [True: 684, False: 0]
  |  Branch (177:22): [True: 0, False: 684]
  ------------------
  178|      0|            *next = first+1;
  179|    684|        else if (!exact && ++first == t->count) {
  ------------------
  |  Branch (179:18): [True: 0, False: 684]
  |  Branch (179:28): [True: 0, False: 0]
  ------------------
  180|      0|            if (NULL != next)
  ------------------
  |  Branch (180:17): [True: 0, False: 0]
  ------------------
  181|      0|                *next = first;
  182|      0|            first = -1;
  183|      0|        }
  184|  1.36k|    } else if(exact) {
  ------------------
  |  Branch (184:15): [True: 1.36k, False: 0]
  ------------------
  185|  1.36k|        if (NULL != next) {
  ------------------
  |  Branch (185:13): [True: 513, False: 855]
  ------------------
  186|    513|            if (result > 0)
  ------------------
  |  Branch (186:17): [True: 513, False: 0]
  ------------------
  187|    513|                *next = first;
  188|      0|            else
  189|      0|                *next = t->count;
  190|    513|        }
  191|  1.36k|        first = -1;
  192|  1.36k|    }
  193|       |
  194|  2.05k|    return first;
  195|  2.28k|}
container_binary_array.c:netsnmp_binary_array_initialize:
  199|    342|{
  200|    342|    binary_array_table *t;
  201|       |
  202|    342|    t = SNMP_MALLOC_TYPEDEF(binary_array_table);
  ------------------
  |  |   73|    342|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  203|    342|    if (t == NULL)
  ------------------
  |  Branch (203:9): [True: 0, False: 342]
  ------------------
  204|      0|        return NULL;
  205|       |
  206|    342|    t->max_size = 0;
  207|    342|    t->count = 0;
  208|    342|    t->dirty = 0;
  209|    342|    t->data = NULL;
  210|       |
  211|    342|    return t;
  212|    342|}
container_binary_array.c:_ba_free:
  712|    342|{
  713|    342|    netsnmp_binary_array_release(container);
  714|    342|    return 0;
  715|    342|}
container_binary_array.c:_ba_size:
  719|      1|{
  720|      1|    return netsnmp_binary_array_count(container);
  721|      1|}
container_binary_array.c:netsnmp_binary_array_count:
  257|      1|{
  258|      1|    binary_array_table *t = (binary_array_table*)c->container_data;
  259|       |    /*
  260|       |     * return count
  261|       |     */
  262|      1|    return t ? t->count : 0;
  ------------------
  |  Branch (262:12): [True: 1, False: 0]
  ------------------
  263|      1|}
container_binary_array.c:_ba_insert:
  693|    684|{
  694|    684|    return netsnmp_binary_array_insert(container, data);
  695|    684|}
container_binary_array.c:netsnmp_binary_array_insert:
  532|    684|{
  533|    684|    binary_array_table *t = (binary_array_table*)c->container_data;
  534|    684|    const int duplicates_allowed = c->flags & CONTAINER_KEY_ALLOW_DUPLICATES;
  ------------------
  |  |  370|    684|#define CONTAINER_KEY_ALLOW_DUPLICATES             0x00000001
  ------------------
  535|    684|    const int sorted = !(c->flags & CONTAINER_KEY_UNSORTED);
  ------------------
  |  |  371|    684|#define CONTAINER_KEY_UNSORTED                     0x00000002
  ------------------
  536|    684|    int             i = -2;
  537|    684|    size_t          next, pos;
  538|    684|    void           *entry = NETSNMP_REMOVE_CONST(void *, const_entry);
  ------------------
  |  |   91|    684|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  539|       |
  540|    684|    if (NULL == entry)
  ------------------
  |  Branch (540:9): [True: 0, False: 684]
  ------------------
  541|      0|        return -1;
  542|       |
  543|       |    /*
  544|       |     * check key if we have at least 1 item and duplicates aren't allowed
  545|       |     */
  546|    684|    if (!duplicates_allowed && t->count) {
  ------------------
  |  Branch (546:9): [True: 684, False: 0]
  |  Branch (546:32): [True: 627, False: 57]
  ------------------
  547|    627|        i = binary_search(entry, c, 1, &next);
  548|    627|        if (i >= 0) {
  ------------------
  |  Branch (548:13): [True: 0, False: 627]
  ------------------
  549|      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]
  |  |  ------------------
  ------------------
  550|      0|            return -1;
  551|      0|        }
  552|    627|    }
  553|       | 
  554|       |    /*
  555|       |     * if unsorted, just add at the end
  556|       |     */
  557|    684|    if (!sorted) {
  ------------------
  |  Branch (557:9): [True: 0, False: 684]
  ------------------
  558|      0|        pos = t->count;
  559|    684|    } else {
  560|       |        /** if we haven't searched for key yet, do it now */
  561|    684|        if (-2 == i) {
  ------------------
  |  Branch (561:13): [True: 57, False: 627]
  ------------------
  562|     57|            if (0 == t->count) {
  ------------------
  |  Branch (562:17): [True: 57, False: 0]
  ------------------
  563|     57|                next = 0;
  564|     57|                i = -1;
  565|     57|            } else {
  566|      0|                i = binary_search(entry, c, 1, &next);
  567|      0|            }
  568|     57|        }
  569|       |
  570|    684|        pos = next;
  571|       |        /* if key found, advance past any duplicates */
  572|    684|        if (duplicates_allowed && i >= 0)
  ------------------
  |  Branch (572:13): [True: 0, False: 684]
  |  Branch (572:35): [True: 0, False: 0]
  ------------------
  573|      0|            while (pos < t->count && c->compare(t->data[pos], entry) == 0)
  ------------------
  |  Branch (573:20): [True: 0, False: 0]
  |  Branch (573:38): [True: 0, False: 0]
  ------------------
  574|      0|                ++pos;
  575|    684|    }
  576|       |
  577|    684|    return netsnmp_binary_array_insert_before(c, pos, entry, !sorted);
  578|    684|}
container_binary_array.c:netsnmp_binary_array_insert_before:
  487|    684|{
  488|    684|    binary_array_table *t = (binary_array_table*)c->container_data;
  489|       |
  490|    684|    if (NULL == entry)
  ------------------
  |  Branch (490:9): [True: 0, False: 684]
  ------------------
  491|      0|        return -1;
  492|       |
  493|    684|    if (index > t->count) {
  ------------------
  |  Branch (493:9): [True: 0, False: 684]
  ------------------
  494|      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]
  |  |  ------------------
  ------------------
  495|      0|        return -1;
  496|      0|    }
  497|       |
  498|       |     /*
  499|       |      * check if we need to resize the array
  500|       |      */
  501|    684|    _ba_resize_check(t);
  502|       |
  503|    684|    netsnmp_assert(t->count < t->max_size);
  ------------------
  |  |   47|    684|#      define netsnmp_assert(x)  do { \
  |  |   48|    684|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 684, False: 0]
  |  |  ------------------
  |  |   49|    684|                 ; \
  |  |   50|    684|              else \
  |  |   51|    684|                 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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    684|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 684]
  |  |  ------------------
  ------------------
  504|       |
  505|       |    /*
  506|       |     * shift array
  507|       |     */
  508|    684|    memmove(&t->data[index+1], &t->data[index],
  509|    684|            sizeof(void*) * (t->count - index));
  510|       |
  511|       |    /*
  512|       |     * Insert the new entry into the data array
  513|       |     */
  514|    684|    t->data[index] = NETSNMP_REMOVE_CONST(void *, entry);
  ------------------
  |  |   91|    684|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  515|    684|    ++t->count;
  516|       |
  517|    684|    netsnmp_assert(index < t->count);
  ------------------
  |  |   47|    684|#      define netsnmp_assert(x)  do { \
  |  |   48|    684|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 684, False: 0]
  |  |  ------------------
  |  |   49|    684|                 ; \
  |  |   50|    684|              else \
  |  |   51|    684|                 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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    684|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 684]
  |  |  ------------------
  ------------------
  518|    684|    netsnmp_assert(t->count <= t->max_size);
  ------------------
  |  |   47|    684|#      define netsnmp_assert(x)  do { \
  |  |   48|    684|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 684, False: 0]
  |  |  ------------------
  |  |   49|    684|                 ; \
  |  |   50|    684|              else \
  |  |   51|    684|                 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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    684|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 684]
  |  |  ------------------
  ------------------
  519|       |
  520|    684|    if (dirty)
  ------------------
  |  Branch (520:9): [True: 0, False: 684]
  ------------------
  521|      0|        t->dirty = 1;
  522|       |
  523|    684|    netsnmp_assert(t->dirty || _ba_is_sorted(c));
  ------------------
  |  |   47|    684|#      define netsnmp_assert(x)  do { \
  |  |   48|  2.05k|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 684]
  |  |  |  Branch (48:20): [True: 684, False: 0]
  |  |  ------------------
  |  |   49|    684|                 ; \
  |  |   50|    684|              else \
  |  |   51|    684|                 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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    684|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 684]
  |  |  ------------------
  ------------------
  524|       |
  525|    684|    ++c->sync;
  526|       |
  527|    684|    return 0;
  528|    684|}
container_binary_array.c:_ba_resize_check:
  458|    684|{
  459|    684|    size_t new_max;
  460|    684|    void ** new_data;
  461|    684|    if (t->max_size > t->count)
  ------------------
  |  Branch (461:9): [True: 570, False: 114]
  ------------------
  462|    570|        return 0; /* resize not needed */
  463|       |
  464|       |    /*
  465|       |     * Table is full, so extend it to double the size, or use 10 elements
  466|       |     * if it is empty.
  467|       |     */
  468|    114|    new_max = t->max_size > 0 ? 2 * t->max_size : 10;
  ------------------
  |  Branch (468:15): [True: 57, False: 57]
  ------------------
  469|    114|    new_data = (void**) realloc(t->data, new_max * sizeof(void*));
  470|    114|    if (new_data == NULL) {
  ------------------
  |  Branch (470:9): [True: 0, False: 114]
  ------------------
  471|      0|        snmp_log(LOG_ERR, "malloc failed in _ba_resize_check\n");
  472|      0|        return -1; /* error */
  473|      0|    }
  474|       |
  475|    114|    memset(new_data + t->max_size, 0x0,
  476|    114|           (new_max - t->max_size) * sizeof(void*));
  477|       |
  478|    114|    t->data = new_data;
  479|    114|    t->max_size = new_max;
  480|       |
  481|    114|    return 1; /* resized */
  482|    114|}
container_binary_array.c:_ba_find:
  681|  1.71k|{
  682|  1.71k|    return netsnmp_binary_array_get(container, data, 1);
  683|  1.71k|}
container_binary_array.c:netsnmp_binary_array_get:
  267|  1.71k|{
  268|  1.71k|    binary_array_table *t = (binary_array_table*)c->container_data;
  269|  1.71k|    int             index = 0;
  270|       |
  271|       |    /*
  272|       |     * if there is no data, return NULL;
  273|       |     */
  274|  1.71k|    if (!t->count)
  ------------------
  |  Branch (274:9): [True: 57, False: 1.65k]
  ------------------
  275|     57|        return NULL;
  276|       |
  277|       |    /*
  278|       |     * if the table is dirty, sort it.
  279|       |     */
  280|  1.65k|    if (t->dirty)
  ------------------
  |  Branch (280:9): [True: 0, False: 1.65k]
  ------------------
  281|      0|        Sort_Array(c);
  282|       |
  283|       |    /*
  284|       |     * if there is a key, search. Otherwise default is 0;
  285|       |     */
  286|  1.65k|    if (key) {
  ------------------
  |  Branch (286:9): [True: 1.65k, False: 0]
  ------------------
  287|  1.65k|        if ((index = binary_search(key, c, exact, NULL)) == -1)
  ------------------
  |  Branch (287:13): [True: 969, False: 684]
  ------------------
  288|    969|            return NULL;
  289|    684|        if (!exact &&
  ------------------
  |  Branch (289:13): [True: 0, False: 684]
  ------------------
  290|      0|            c->flags & CONTAINER_KEY_ALLOW_DUPLICATES) {
  ------------------
  |  |  370|      0|#define CONTAINER_KEY_ALLOW_DUPLICATES             0x00000001
  ------------------
  |  Branch (290:13): [True: 0, False: 0]
  ------------------
  291|      0|            int result;
  292|       |
  293|       |            /*
  294|       |             * If duplicates are allowed, we have to be extra
  295|       |             * sure that we didn't just increment to a duplicate,
  296|       |             * thus causing a getnext loop.
  297|       |             */
  298|      0|            result = c->compare(t->data[index], key);
  299|      0|            while (result == 0) {
  ------------------
  |  Branch (299:20): [True: 0, False: 0]
  ------------------
  300|      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]
  |  |  ------------------
  ------------------
  301|      0|					    c->container_name));
  302|      0|                if (++index == t->count)
  ------------------
  |  Branch (302:21): [True: 0, False: 0]
  ------------------
  303|      0|                   return NULL;
  304|      0|                result = c->compare(t->data[index], key);
  305|      0|            }
  306|      0|        }
  307|    684|    }
  308|       |
  309|    684|    return t->data[index];
  310|  1.65k|}
container_binary_array.c:_ba_for_each:
  726|     57|{
  727|     57|    netsnmp_binary_array_for_each(container, f, context, 1);
  728|     57|}
container_binary_array.c:netsnmp_binary_array_for_each:
  426|     57|{
  427|     57|    binary_array_table *t = (binary_array_table*)c->container_data;
  428|     57|    size_t             i;
  429|       |
  430|     57|    if (sort && t->dirty)
  ------------------
  |  Branch (430:9): [True: 57, False: 0]
  |  Branch (430:17): [True: 0, False: 57]
  ------------------
  431|      0|        Sort_Array(c);
  432|       |
  433|    741|    for (i = 0; i < t->count; ++i)
  ------------------
  |  Branch (433:17): [True: 684, False: 57]
  ------------------
  434|    684|        (*fe) (t->data[i], context);
  435|     57|}
container_binary_array.c:_ba_clear:
  733|    285|{
  734|    285|    netsnmp_binary_array_clear(container, f, context);
  735|    285|}
container_binary_array.c:netsnmp_binary_array_clear:
  441|    285|{
  442|    285|    binary_array_table *t = (binary_array_table*)c->container_data;
  443|       |
  444|    285|    if( NULL != fe ) {
  ------------------
  |  Branch (444:9): [True: 114, False: 171]
  ------------------
  445|    114|        size_t             i;
  446|       |
  447|    114|        for (i = 0; i < t->count; ++i)
  ------------------
  |  Branch (447:21): [True: 0, False: 114]
  ------------------
  448|      0|            (*fe) (t->data[i], context);
  449|    114|    }
  450|       |
  451|    285|    t->count = 0;
  452|    285|    t->dirty = 0;
  453|    285|    ++c->sync;
  454|    285|}
container_binary_array.c:_ba_options:
  761|    228|{
  762|    228|    return netsnmp_binary_array_options_set(c, set, flags);
  763|    228|}
container_binary_array.c:_ba_iterator_get:
 1020|      1|{
 1021|      1|    binary_array_iterator* it;
 1022|       |
 1023|      1|    if(NULL == c)
  ------------------
  |  Branch (1023:8): [True: 0, False: 1]
  ------------------
 1024|      0|        return NULL;
 1025|       |
 1026|      1|    it = SNMP_MALLOC_TYPEDEF(binary_array_iterator);
  ------------------
  |  |   73|      1|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 1027|      1|    if(NULL == it)
  ------------------
  |  Branch (1027:8): [True: 0, False: 1]
  ------------------
 1028|      0|        return NULL;
 1029|       |
 1030|      1|    it->base.container = c;
 1031|       |    
 1032|      1|    it->base.first = _ba_iterator_first;
 1033|      1|    it->base.next = _ba_iterator_next;
 1034|      1|    it->base.curr = _ba_iterator_curr;
 1035|      1|    it->base.last = _ba_iterator_last;
 1036|      1|    it->base.remove = _ba_iterator_remove;
 1037|      1|    it->base.reset = _ba_iterator_reset;
 1038|      1|    it->base.release = _ba_iterator_release;
 1039|       |
 1040|      1|    (void)_ba_iterator_reset(&it->base);
 1041|       |
 1042|      1|    return &it->base;
 1043|      1|}
container_binary_array.c:_ba_iterator_first:
  931|      1|{
  932|      1|    binary_array_iterator *it = (void *)nit;
  933|       |
  934|      1|    return _ba_iterator_position(it, 0);
  935|      1|}
container_binary_array.c:_ba_iterator_position:
  894|      1|{
  895|      1|    binary_array_table *t = _ba_it2cont(it);
  896|      1|    if (NULL == t)
  ------------------
  |  Branch (896:9): [True: 0, False: 1]
  ------------------
  897|      0|        return t; /* msg already logged */
  898|       |
  899|      1|    if(it->base.container->sync != it->base.sync) {
  ------------------
  |  Branch (899:8): [True: 0, False: 1]
  ------------------
  900|      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]
  |  |  ------------------
  ------------------
  901|      0|        return NULL;
  902|      0|    }
  903|       |    
  904|      1|    if(0 == t->count) {
  ------------------
  |  Branch (904:8): [True: 1, False: 0]
  ------------------
  905|      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]
  |  |  ------------------
  ------------------
  906|      1|        return NULL;
  907|      1|    }
  908|      0|    else if(pos >= t->count) {
  ------------------
  |  Branch (908:13): [True: 0, False: 0]
  ------------------
  909|      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]
  |  |  ------------------
  ------------------
  910|      0|        return NULL;
  911|      0|    }
  912|       |
  913|      0|    return t->data[ pos ];
  914|      1|}
container_binary_array.c:_ba_it2cont:
  875|      2|{
  876|      2|    if(NULL == it) {
  ------------------
  |  Branch (876:8): [True: 0, False: 2]
  ------------------
  877|      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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  878|      0|        return NULL;
  879|      0|    }
  880|      2|    if(NULL == it->base.container) {
  ------------------
  |  Branch (880:8): [True: 0, False: 2]
  ------------------
  881|      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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  882|      0|        return NULL;
  883|      0|    }
  884|      2|    if(NULL == it->base.container->container_data) {
  ------------------
  |  Branch (884:8): [True: 0, False: 2]
  ------------------
  885|      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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  886|      0|        return NULL;
  887|      0|    }
  888|       |
  889|      2|    return (binary_array_table*)(it->base.container->container_data);
  890|      2|}
container_binary_array.c:_ba_iterator_reset:
  988|      1|{
  989|      1|    binary_array_iterator *it = (void *)nit;
  990|      1|    binary_array_table* t = _ba_it2cont(it);
  991|      1|    if(NULL == t) {
  ------------------
  |  Branch (991:8): [True: 0, False: 1]
  ------------------
  992|      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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  993|      0|        return -1;
  994|      0|    }
  995|       |
  996|      1|    if (t->dirty)
  ------------------
  |  Branch (996:9): [True: 0, False: 1]
  ------------------
  997|      0|        Sort_Array(it->base.container);
  998|       |
  999|       |    /*
 1000|       |     * save sync count, to make sure container doesn't change while
 1001|       |     * iterator is in use.
 1002|       |     */
 1003|      1|    it->base.sync = it->base.container->sync;
 1004|       |
 1005|      1|    it->pos = 0;
 1006|       |
 1007|      1|    return 0;
 1008|      1|}
container_binary_array.c:_ba_iterator_release:
 1012|      1|{
 1013|      1|    free(it);
 1014|       |
 1015|      1|    return 0;
 1016|      1|}

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

netsnmp_container_get_null_factory:
  173|     57|{
  174|     57|    static netsnmp_factory f = { "null",
  175|     57|                                 netsnmp_container_get_null};
  176|       |    
  177|     57|    DEBUGMSGTL(("container:null:get_null_factory","in\n"));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
  178|     57|    return &f;
  179|     57|}
netsnmp_container_null_init:
  183|     57|{
  184|     57|    netsnmp_container_register("null",
  185|     57|                               netsnmp_container_get_null_factory());
  186|     57|}

netsnmp_free_all_list_data:
   49|    171|{
   50|    171|    netsnmp_data_list *tmpptr;
   51|    171|    for (; head;) {
  ------------------
  |  Branch (51:12): [True: 0, False: 171]
  ------------------
   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|    171|}
shutdown_data_list:
  395|     57|{
  396|     57|    netsnmp_free_all_list_data(saveHead);
  397|     57|}

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

netsnmp_large_fd_setfd:
  120|     56|{
  121|     56|    netsnmp_assert(fd >= 0);
  ------------------
  |  |   47|     56|#      define netsnmp_assert(x)  do { \
  |  |   48|     56|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 56, False: 0]
  |  |  ------------------
  |  |   49|     56|                 ; \
  |  |   50|     56|              else \
  |  |   51|     56|                 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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     56|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 56]
  |  |  ------------------
  ------------------
  122|       |
  123|     56|    while (fd >= (int)fdset->lfs_setsize)
  ------------------
  |  Branch (123:12): [True: 0, False: 56]
  ------------------
  124|      0|        netsnmp_large_fd_set_resize(fdset, 2 * (fdset->lfs_setsize + 1));
  125|       |
  126|     56|    LFD_SET(fd, fdset->lfs_setptr);
  127|     56|}
netsnmp_large_fd_is_set:
  140|     56|{
  141|     56|    netsnmp_assert(fd >= 0);
  ------------------
  |  |   47|     56|#      define netsnmp_assert(x)  do { \
  |  |   48|     56|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 56, False: 0]
  |  |  ------------------
  |  |   49|     56|                 ; \
  |  |   50|     56|              else \
  |  |   51|     56|                 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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     56|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 56]
  |  |  ------------------
  ------------------
  142|       |
  143|     56|    return ((unsigned)fd < fdset->lfs_setsize &&
  ------------------
  |  Branch (143:13): [True: 56, False: 0]
  ------------------
  144|     56|            LFD_ISSET(fd, fdset->lfs_setptr));
  ------------------
  |  Branch (144:13): [True: 56, False: 0]
  ------------------
  145|     56|}
netsnmp_large_fd_set_init:
  151|    112|{
  152|    112|    fdset->lfs_setsize = 0;
  153|    112|    fdset->lfs_setptr  = NULL;
  154|       |#if !defined(cygwin) && defined(HAVE_WINSOCK_H)
  155|       |    fdset->lfs_set.fd_count = 0;
  156|       |#endif
  157|    112|    netsnmp_large_fd_set_resize(fdset, setsize);
  158|    112|}
netsnmp_large_fd_set_resize:
  192|    336|{
  193|    336|    int             fd_set_bytes;
  194|       |
  195|    336|    if (fdset->lfs_setsize == setsize)
  ------------------
  |  Branch (195:9): [True: 112, False: 224]
  ------------------
  196|    112|        goto success;
  197|       |
  198|    224|    if (setsize > FD_SETSIZE) {
  ------------------
  |  Branch (198:9): [True: 0, False: 224]
  ------------------
  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|    224|    } else {
  211|    224|        if (fdset->lfs_setsize > FD_SETSIZE) {
  ------------------
  |  Branch (211:13): [True: 0, False: 224]
  ------------------
  212|      0|            fdset->lfs_set = *fdset->lfs_setptr;
  213|      0|            free(fdset->lfs_setptr);
  214|      0|        }
  215|    224|        fdset->lfs_setptr = &fdset->lfs_set;
  216|    224|    }
  217|       |
  218|    224|#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|    224|    if ( fdset->lfs_setsize == 0 && setsize == FD_SETSIZE ) {
  ------------------
  |  Branch (223:10): [True: 112, False: 112]
  |  Branch (223:37): [True: 112, False: 0]
  ------------------
  224|       |        /* In this case we can use the OS's FD_ZERO */
  225|    112|        FD_ZERO(fdset->lfs_setptr);
  ------------------
  |  Branch (225:9): [Folded, False: 112]
  ------------------
  226|    112|    } else {
  227|    112|        int             i;
  228|       |
  229|    112|        for (i = fdset->lfs_setsize; i < setsize; i++)
  ------------------
  |  Branch (229:38): [True: 0, False: 112]
  ------------------
  230|      0|            LFD_CLR(i, fdset->lfs_setptr);
  231|    112|    }
  232|    224|#endif
  233|       |
  234|    224|    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|    336|success:
  240|    336|    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|    224|}
netsnmp_large_fd_set_cleanup:
  252|    112|{
  253|    112|    netsnmp_large_fd_set_resize(fdset, 0);
  254|    112|    fdset->lfs_setsize = 0;
  255|       |    fdset->lfs_setptr  = NULL;
  256|    112|}
netsnmp_copy_fd_set_to_large_fd_set:
  261|    112|{
  262|       |    netsnmp_large_fd_set_resize(dst, FD_SETSIZE);
  263|    112|    *dst->lfs_setptr = *src;
  264|    112|}
netsnmp_copy_large_fd_set_to_fd_set:
  269|     56|{
  270|       |    /* Report failure if *src is larger than FD_SETSIZE. */
  271|     56|    if (src->lfs_setsize > FD_SETSIZE) {
  ------------------
  |  Branch (271:9): [True: 0, False: 56]
  ------------------
  272|      0|        FD_ZERO(dst);
  ------------------
  |  Branch (272:9): [Folded, False: 0]
  ------------------
  273|      0|        return -1;
  274|      0|    }
  275|       |
  276|     56|    *dst = *src->lfs_setptr;
  277|       |
  278|     56|#if !(!defined(cygwin) && defined(HAVE_WINSOCK_H))
  279|     56|    {
  280|     56|        int             i;
  281|       |
  282|       |        /* Unix: clear any file descriptors defined in *dst but not in *src. */
  283|     56|        for (i = src->lfs_setsize; i < FD_SETSIZE; ++i)
  ------------------
  |  Branch (283:36): [True: 0, False: 56]
  ------------------
  284|     56|            FD_CLR(i, dst);
  285|     56|    }
  286|     56|#endif
  287|       |
  288|     56|    return 0;
  289|     56|}
large_fd_set.c:LFD_SET:
   95|     56|{
   96|     56|    enum { nfdbits = 8 * sizeof(p->fds_bits[0]) };
   97|     56|    NETSNMP_FD_MASK_TYPE *fds_array = p->fds_bits;
  ------------------
  |  | 1718|     56|#define NETSNMP_FD_MASK_TYPE __fd_mask
  ------------------
   98|       |
   99|     56|    fds_array[n / nfdbits] |= (1ULL << (n % nfdbits));
  100|     56|}
large_fd_set.c:LFD_ISSET:
  111|     56|{
  112|     56|    enum { nfdbits = 8 * sizeof(p->fds_bits[0]) };
  113|     56|    const NETSNMP_FD_MASK_TYPE *fds_array = p->fds_bits;
  114|       |
  115|     56|    return (fds_array[n / nfdbits] & (1ULL << (n % nfdbits))) != 0;
  116|     56|}

get_enginetime:
   98|     19|{
   99|     19|    int             rval = SNMPERR_SUCCESS;
  ------------------
  |  |  184|     19|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  100|     19|    int             timediff = 0;
  101|     19|    Enginetime      e = NULL;
  102|       |
  103|       |
  104|       |
  105|       |    /*
  106|       |     * Sanity check.
  107|       |     */
  108|     19|    if (!engine_time || !engineboot) {
  ------------------
  |  Branch (108:9): [True: 0, False: 19]
  |  Branch (108:25): [True: 0, False: 19]
  ------------------
  109|      0|        QUITFUN(SNMPERR_GENERR, get_enginetime_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  185|      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|     19|    *engine_time = *engineboot = 0;
  118|       |
  119|     19|    if (!engineID || (engineID_len <= 0)) {
  ------------------
  |  Branch (119:9): [True: 0, False: 19]
  |  Branch (119:22): [True: 0, False: 19]
  ------------------
  120|      0|        QUITFUN(SNMPERR_GENERR, get_enginetime_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  121|      0|    }
  122|       |
  123|     19|    if (!(e = search_enginetime_list(engineID, engineID_len))) {
  ------------------
  |  Branch (123:9): [True: 6, False: 13]
  ------------------
  124|      6|        QUITFUN(SNMPERR_GENERR, get_enginetime_quit);
  ------------------
  |  |  143|      6|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  184|      6|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 6, Folded]
  |  |  ------------------
  |  |  144|      6|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  185|      6|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      6|		goto l ;		\
  |  |  146|      6|	}
  ------------------
  125|      0|    }
  126|     13|#ifdef LCD_TIME_SYNC_OPT
  127|     13|    if (!authenticated || e->authenticatedFlag) {
  ------------------
  |  Branch (127:9): [True: 13, False: 0]
  |  Branch (127:27): [True: 0, False: 0]
  ------------------
  128|     13|#endif
  129|     13|        *engine_time = e->engineTime;
  130|     13|        *engineboot = e->engineBoot;
  131|       |
  132|     13|       timediff = (int) (snmpv3_local_snmpEngineTime() - e->lastReceivedEngineTime);
  133|       |
  134|     13|#ifdef LCD_TIME_SYNC_OPT
  135|     13|    }
  136|     13|#endif
  137|       |
  138|     13|    if (timediff > (int) (ENGINETIME_MAX - *engine_time)) {
  ------------------
  |  |  182|     13|#define ENGINETIME_MAX	2147483647      /* ((2^31)-1) */
  ------------------
  |  Branch (138:9): [True: 0, False: 13]
  ------------------
  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|     13|    } else {
  150|     13|        *engine_time += timediff;
  151|     13|    }
  152|       |
  153|     13|    DEBUGMSGTL(("lcd_get_enginetime", "engineID "));
  ------------------
  |  |   66|     13|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 13]
  |  |  ------------------
  ------------------
  154|     13|    DEBUGMSGHEX(("lcd_get_enginetime", engineID, engineID_len));
  ------------------
  |  |   71|     13|#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  ------------------
  |  |  |  Branch (71:71): [Folded, False: 13]
  |  |  ------------------
  ------------------
  155|     13|    DEBUGMSG(("lcd_get_enginetime", ": boots=%d, time=%d\n", *engineboot,
  ------------------
  |  |   61|     13|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 13]
  |  |  ------------------
  ------------------
  156|     13|              *engine_time));
  157|       |
  158|     19|  get_enginetime_quit:
  159|     19|    return rval;
  160|       |
  161|     13|}                               /* end get_enginetime() */
free_etimelist:
  295|     57|{
  296|     57|     int index = 0;
  297|     57|     Enginetime e = NULL;
  298|     57|     Enginetime nextE = NULL;
  299|       |
  300|  1.36k|     for( ; index < ETIMELIST_SIZE; ++index)
  ------------------
  |  |   21|  1.36k|#define ETIMELIST_SIZE	23
  ------------------
  |  Branch (300:13): [True: 1.31k, False: 57]
  ------------------
  301|  1.31k|     {
  302|  1.31k|           e = etimelist[index];
  303|       |
  304|  1.36k|           while(e != NULL)
  ------------------
  |  Branch (304:18): [True: 57, False: 1.31k]
  ------------------
  305|     57|           {
  306|     57|                 nextE = e->next;
  307|     57|                 SNMP_FREE(e->engineID);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  308|     57|                 SNMP_FREE(e);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  309|     57|                 e = nextE;
  310|     57|           }
  311|       |
  312|       |           etimelist[index] = NULL;
  313|  1.31k|     }
  314|     57|     return;
  315|     57|}
set_enginetime:
  344|     57|{
  345|     57|    int             rval = SNMPERR_SUCCESS, iindex;
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  346|     57|    Enginetime      e = NULL;
  347|       |
  348|       |
  349|       |
  350|       |    /*
  351|       |     * Sanity check.
  352|       |     */
  353|     57|    if (!engineID || (engineID_len <= 0)) {
  ------------------
  |  Branch (353:9): [True: 0, False: 57]
  |  Branch (353:22): [True: 0, False: 57]
  ------------------
  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|     57|    if (!(e = search_enginetime_list(engineID, engineID_len))) {
  ------------------
  |  Branch (362:9): [True: 57, False: 0]
  ------------------
  363|     57|        if ((iindex = hash_engineID(engineID, engineID_len)) < 0) {
  ------------------
  |  Branch (363:13): [True: 0, False: 57]
  ------------------
  364|      0|            QUITFUN(SNMPERR_GENERR, set_enginetime_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  365|      0|        }
  366|       |
  367|     57|        e = calloc(1, sizeof(*e));
  368|       |
  369|     57|        e->next = etimelist[iindex];
  370|     57|        etimelist[iindex] = e;
  371|       |
  372|     57|        e->engineID = calloc(1, engineID_len);
  373|     57|        memcpy(e->engineID, engineID, engineID_len);
  374|       |
  375|     57|        e->engineID_len = engineID_len;
  376|     57|    }
  377|     57|#ifdef LCD_TIME_SYNC_OPT
  378|     57|    if (authenticated || !e->authenticatedFlag) {
  ------------------
  |  Branch (378:9): [True: 57, False: 0]
  |  Branch (378:26): [True: 0, False: 0]
  ------------------
  379|     57|        e->authenticatedFlag = authenticated;
  380|       |#else
  381|       |    if (authenticated) {
  382|       |#endif
  383|     57|        e->engineTime = engine_time;
  384|     57|        e->engineBoot = engineboot;
  385|     57|        e->lastReceivedEngineTime = snmpv3_local_snmpEngineTime();
  386|     57|    }
  387|       |
  388|     57|    e = NULL;                   /* Indicates a successful update. */
  389|       |
  390|     57|    DEBUGMSGTL(("lcd_set_enginetime", "engineID "));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
  391|     57|    DEBUGMSGHEX(("lcd_set_enginetime", engineID, engineID_len));
  ------------------
  |  |   71|     57|#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  ------------------
  |  |  |  Branch (71:71): [Folded, False: 57]
  |  |  ------------------
  ------------------
  392|     57|    DEBUGMSG(("lcd_set_enginetime", ": boots=%d, time=%d\n", engineboot,
  ------------------
  |  |   61|     57|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 57]
  |  |  ------------------
  ------------------
  393|     57|              engine_time));
  394|       |
  395|     57|  set_enginetime_quit:
  396|     57|    SNMP_FREE(e);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 57]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  397|       |
  398|     57|    return rval;
  399|       |
  400|     57|}                               /* end set_enginetime() */
search_enginetime_list:
  423|     76|{
  424|     76|    int             rval = SNMPERR_SUCCESS;
  ------------------
  |  |  184|     76|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  425|     76|    Enginetime      e = NULL;
  426|       |
  427|       |
  428|       |    /*
  429|       |     * Sanity check.
  430|       |     */
  431|     76|    if (!engineID || (engineID_len <= 0)) {
  ------------------
  |  Branch (431:9): [True: 0, False: 76]
  |  Branch (431:22): [True: 0, False: 76]
  ------------------
  432|      0|        QUITFUN(SNMPERR_GENERR, search_enginetime_list_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  185|      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|     76|    rval = hash_engineID(engineID, engineID_len);
  440|     76|    if (rval < 0) {
  ------------------
  |  Branch (440:9): [True: 0, False: 76]
  ------------------
  441|      0|        QUITFUN(SNMPERR_GENERR, search_enginetime_list_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  442|      0|    }
  443|     76|    e = etimelist[rval];
  444|       |
  445|     76|    for ( /*EMPTY*/; e; e = e->next) {
  ------------------
  |  Branch (445:22): [True: 13, False: 63]
  ------------------
  446|     13|        if ((engineID_len == e->engineID_len)
  ------------------
  |  Branch (446:13): [True: 13, False: 0]
  ------------------
  447|     13|            && !memcmp(e->engineID, engineID, engineID_len)) {
  ------------------
  |  Branch (447:16): [True: 13, False: 0]
  ------------------
  448|     13|            break;
  449|     13|        }
  450|     13|    }
  451|       |
  452|       |
  453|     76|  search_enginetime_list_quit:
  454|     76|    return e;
  455|       |
  456|     76|}                               /* end search_enginetime_list() */
hash_engineID:
  481|    133|{
  482|    133|    int             rval = SNMPERR_GENERR;
  ------------------
  |  |  185|    133|#define SNMPERR_GENERR			(-1)
  ------------------
  483|    133|    size_t          buf_len = SNMP_MAXBUF;
  ------------------
  |  |   43|    133|#define SNMP_MAXBUF		(1024 * 4)
  ------------------
  484|    133|    u_int           additive = 0;
  485|    133|    u_char         *bufp, buf[SNMP_MAXBUF];
  486|    133|    void           *context = NULL;
  487|       |
  488|       |
  489|       |
  490|       |    /*
  491|       |     * Sanity check.
  492|       |     */
  493|    133|    if (!engineID || (engineID_len <= 0)) {
  ------------------
  |  Branch (493:9): [True: 0, False: 133]
  |  Branch (493:22): [True: 0, False: 133]
  ------------------
  494|      0|        QUITFUN(SNMPERR_GENERR, hash_engineID_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  185|      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|    133|#ifndef NETSNMP_DISABLE_MD5
  502|    133|    rval = sc_hash(usmHMACMD5AuthProtocol,
  503|    133|                   OID_LENGTH(usmHMACMD5AuthProtocol),
  ------------------
  |  |   64|    133|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|    133|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  504|    133|                   engineID, engineID_len, buf, &buf_len);
  505|    133|    if (rval == SNMPERR_SC_NOT_CONFIGURED) {
  ------------------
  |  |  223|    133|#define SNMPERR_SC_NOT_CONFIGURED	(-39)
  ------------------
  |  Branch (505:9): [True: 0, False: 133]
  ------------------
  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|    133|    QUITFUN(rval, hash_engineID_quit);
  ------------------
  |  |  143|    133|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  184|    133|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, False: 133]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  517|       |
  518|    665|    for (bufp = buf; (bufp - buf) < (int) buf_len; bufp += 4) {
  ------------------
  |  Branch (518:22): [True: 532, False: 133]
  ------------------
  519|    532|        additive += (u_int) * bufp;
  520|    532|    }
  521|       |
  522|    133|  hash_engineID_quit:
  523|    133|    SNMP_FREE(context);
  ------------------
  |  |   62|    133|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 133]
  |  |  |  Branch (62:66): [Folded, False: 133]
  |  |  ------------------
  ------------------
  524|    133|    memset(buf, 0, SNMP_MAXBUF);
  ------------------
  |  |   43|    133|#define SNMP_MAXBUF		(1024 * 4)
  ------------------
  525|       |
  526|    133|    return (rval < 0) ? rval : (int)(additive % ETIMELIST_SIZE);
  ------------------
  |  |   21|    133|#define ETIMELIST_SIZE	23
  ------------------
  |  Branch (526:12): [True: 0, False: 133]
  ------------------
  527|       |
  528|    133|}                               /* end hash_engineID() */

register_mib_handlers:
 2480|     57|{
 2481|     57|#ifndef NETSNMP_DISABLE_MIB_LOADING
 2482|     57|    register_prenetsnmp_mib_handler("snmp", "mibdirs",
 2483|     57|                                    handle_mibdirs_conf, NULL,
 2484|     57|                                    "[mib-dirs|+mib-dirs|-mib-dirs]");
 2485|     57|    register_prenetsnmp_mib_handler("snmp", "mibs",
 2486|     57|                                    handle_mibs_conf, NULL,
 2487|     57|                                    "[mib-tokens|+mib-tokens|-mib-tokens]");
 2488|     57|    register_config_handler("snmp", "mibfile",
 2489|     57|                            handle_mibfile_conf, NULL, "mibfile-to-read");
 2490|       |    /*
 2491|       |     * register the snmp.conf configuration handlers for default
 2492|       |     * parsing behaviour 
 2493|       |     */
 2494|       |
 2495|     57|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "showMibErrors",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
 2496|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_ERRORS);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_ERRORS);
  ------------------
  |  |   59|     57|#define NETSNMP_DS_LIB_MIB_ERRORS          0
  ------------------
 2497|     57|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "commentToEOL",     /* Describes actual behaviour */
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
 2498|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_COMMENT_TERM);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_COMMENT_TERM);
  ------------------
  |  |   61|     57|#define NETSNMP_DS_LIB_MIB_COMMENT_TERM    2
  ------------------
 2499|     57|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "strictCommentTerm",    /* Backward compatibility */
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
 2500|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_COMMENT_TERM);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_COMMENT_TERM);
  ------------------
  |  |   61|     57|#define NETSNMP_DS_LIB_MIB_COMMENT_TERM    2
  ------------------
 2501|     57|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "mibAllowUnderline",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
 2502|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_PARSE_LABEL);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_PARSE_LABEL);
  ------------------
  |  |   62|     57|#define NETSNMP_DS_LIB_MIB_PARSE_LABEL     3
  ------------------
 2503|     57|    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "mibWarningLevel",
  ------------------
  |  |   75|     57|#define ASN_INTEGER	    0x02U
  ------------------
 2504|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_WARNINGS);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_WARNINGS);
  ------------------
  |  |  114|     57|#define NETSNMP_DS_LIB_MIB_WARNINGS         0
  ------------------
 2505|     57|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "mibReplaceWithLatest",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
 2506|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_REPLACE);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_REPLACE);
  ------------------
  |  |   67|     57|#define NETSNMP_DS_LIB_MIB_REPLACE         7    /* replace objects from latest module */
  ------------------
 2507|     57|#endif
 2508|       |
 2509|     57|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "printNumericEnums",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
 2510|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM);
  ------------------
  |  |   68|     57|#define NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM  8    /* print only numeric enum values */
  ------------------
 2511|     57|    register_prenetsnmp_mib_handler("snmp", "printNumericOids",
 2512|     57|                       handle_print_numeric, NULL, "(1|yes|true|0|no|false)");
 2513|     57|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "escapeQuotes",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
 2514|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_ESCAPE_QUOTES);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_ESCAPE_QUOTES);
  ------------------
  |  |   79|     57|#define NETSNMP_DS_LIB_ESCAPE_QUOTES       19   /* shell escape quote marks in oids */
  ------------------
 2515|     57|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "dontBreakdownOids",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
 2516|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS);
  ------------------
  |  |   70|     57|#define NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS 10   /* dont print oid indexes specially */
  ------------------
 2517|     57|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "quickPrinting",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
 2518|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT);
  ------------------
  |  |   73|     57|#define NETSNMP_DS_LIB_QUICK_PRINT         13   /* print very brief output for parsing */
  ------------------
 2519|     57|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "numericTimeticks",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
 2520|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NUMERIC_TIMETICKS);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NUMERIC_TIMETICKS);
  ------------------
  |  |   78|     57|#define NETSNMP_DS_LIB_NUMERIC_TIMETICKS   18   /* print timeticks as a number */
  ------------------
 2521|     57|    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "oidOutputFormat",
  ------------------
  |  |   75|     57|#define ASN_INTEGER	    0x02U
  ------------------
 2522|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
  ------------------
  |  |  118|     57|#define NETSNMP_DS_LIB_OID_OUTPUT_FORMAT    4
  ------------------
 2523|     57|    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "suffixPrinting",
  ------------------
  |  |   75|     57|#define ASN_INTEGER	    0x02U
  ------------------
 2524|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
  ------------------
  |  |  118|     57|#define NETSNMP_DS_LIB_OID_OUTPUT_FORMAT    4
  ------------------
 2525|     57|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "extendedIndex",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
 2526|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_EXTENDED_INDEX);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_EXTENDED_INDEX);
  ------------------
  |  |   82|     57|#define NETSNMP_DS_LIB_EXTENDED_INDEX	   22   /* print extended index format [x1][x2] */
  ------------------
 2527|     57|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "printHexText",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
 2528|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_HEX_TEXT);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_HEX_TEXT);
  ------------------
  |  |   83|     57|#define NETSNMP_DS_LIB_PRINT_HEX_TEXT      23   /* print ASCII text along with hex strings */
  ------------------
 2529|     57|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "printValueOnly",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
 2530|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_BARE_VALUE);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_BARE_VALUE);
  ------------------
  |  |   81|     57|#define NETSNMP_DS_LIB_PRINT_BARE_VALUE	   21   /* just print value (not OID = value) */
  ------------------
 2531|     57|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "dontPrintUnits",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
 2532|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_PRINT_UNITS);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_PRINT_UNITS);
  ------------------
  |  |   89|     57|#define NETSNMP_DS_LIB_DONT_PRINT_UNITS    29 /* don't print UNITS suffix */
  ------------------
 2533|     57|    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "hexOutputLength",
  ------------------
  |  |   75|     57|#define ASN_INTEGER	    0x02U
  ------------------
 2534|     57|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH);
  ------------------
  |  |  121|     57|#define NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH    6
  ------------------
 2535|     57|}
netsnmp_set_mib_directory:
 2550|     57|{
 2551|     57|    const char *newdir;
 2552|     57|    char *olddir, *tmpdir = NULL;
 2553|       |
 2554|     57|    DEBUGTRACE;
  ------------------
  |  |   63|     57|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 57]
  |  |  ------------------
  ------------------
 2555|     57|    if (NULL == dir) {
  ------------------
  |  Branch (2555:9): [True: 0, False: 57]
  ------------------
 2556|      0|        return;
 2557|      0|    }
 2558|       |    
 2559|     57|    olddir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 2560|     57|				   NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|     57|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2561|     57|    if (olddir) {
  ------------------
  |  Branch (2561:9): [True: 57, False: 0]
  ------------------
 2562|     57|        if ((*dir == '+') || (*dir == '-')) {
  ------------------
  |  Branch (2562:13): [True: 0, False: 57]
  |  Branch (2562:30): [True: 0, False: 57]
  ------------------
 2563|       |            /** New dir starts with '+', thus we add it. */
 2564|      0|            if (*dir++ == '+') {
  ------------------
  |  Branch (2564:17): [True: 0, False: 0]
  ------------------
 2565|      0|                if (asprintf(&tmpdir, "%s%c%s", olddir, ENV_SEPARATOR_CHAR, dir) < 0)
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
  |  Branch (2565:21): [True: 0, False: 0]
  ------------------
 2566|      0|                    tmpdir = NULL;
 2567|      0|            } else {
 2568|      0|                if (asprintf(&tmpdir, "%s%c%s", dir, ENV_SEPARATOR_CHAR, olddir) < 0)
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
  |  Branch (2568:21): [True: 0, False: 0]
  ------------------
 2569|      0|                    tmpdir = NULL;
 2570|      0|            }
 2571|      0|            if (!tmpdir) {
  ------------------
  |  Branch (2571:17): [True: 0, False: 0]
  ------------------
 2572|      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]
  |  |  ------------------
  ------------------
 2573|      0|                return;
 2574|      0|            }
 2575|      0|            newdir = tmpdir;
 2576|     57|        } else {
 2577|     57|            newdir = dir;
 2578|     57|        }
 2579|     57|    } else {
 2580|       |        /** If dir starts with '+' skip '+' it. */
 2581|      0|        newdir = ((*dir == '+') ? ++dir : dir);
  ------------------
  |  Branch (2581:19): [True: 0, False: 0]
  ------------------
 2582|      0|    }
 2583|     57|    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS,
  ------------------
  |  |  162|     57|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2584|     57|                          newdir);
 2585|       |
 2586|       |    /** set_string calls strdup, so if we allocated memory, free it */
 2587|     57|    if (tmpdir == newdir) {
  ------------------
  |  Branch (2587:9): [True: 0, False: 57]
  ------------------
 2588|       |        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]
  |  |  ------------------
  ------------------
 2589|      0|    }
 2590|     57|}
netsnmp_get_mib_directory:
 2607|    171|{
 2608|    171|    char *dir;
 2609|       |
 2610|    171|    DEBUGTRACE;
  ------------------
  |  |   63|    171|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    171|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 171]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 171]
  |  |  ------------------
  ------------------
 2611|    171|    dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |   48|    171|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|    171|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2612|    171|    if (dir == NULL) {
  ------------------
  |  Branch (2612:9): [True: 0, False: 171]
  ------------------
 2613|      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]
  |  |  ------------------
  ------------------
 2614|       |
 2615|       |        /** Check if the environment variable is set */
 2616|      0|        dir = netsnmp_getenv("MIBDIRS");
 2617|      0|        if (dir == NULL) {
  ------------------
  |  Branch (2617:13): [True: 0, False: 0]
  ------------------
 2618|      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]
  |  |  ------------------
  ------------------
 2619|       |            /** Not set use hard coded path */
 2620|      0|            if (confmibdir == NULL) {
  ------------------
  |  Branch (2620:17): [True: 0, False: 0]
  ------------------
 2621|      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]
  |  |  ------------------
  ------------------
 2622|      0|                netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1666|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2623|      0|            }
 2624|      0|            else if ((*confmibdir == '+') || (*confmibdir == '-')) {
  ------------------
  |  Branch (2624:22): [True: 0, False: 0]
  |  Branch (2624:46): [True: 0, False: 0]
  ------------------
 2625|      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]
  |  |  ------------------
  ------------------
 2626|      0|                netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1666|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2627|      0|                netsnmp_set_mib_directory(confmibdir);
 2628|      0|            }
 2629|      0|            else {
 2630|      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]
  |  |  ------------------
  ------------------
 2631|      0|                netsnmp_set_mib_directory(confmibdir);
 2632|      0|            }
 2633|      0|        } else if ((*dir == '+') || (*dir == '-')) {
  ------------------
  |  Branch (2633:20): [True: 0, False: 0]
  |  Branch (2633:37): [True: 0, False: 0]
  ------------------
 2634|      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]
  |  |  ------------------
  ------------------
 2635|      0|            netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1666|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2636|      0|            netsnmp_set_mib_directory(dir);
 2637|      0|        } else {
 2638|      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]
  |  |  ------------------
  ------------------
 2639|      0|            netsnmp_set_mib_directory(dir);
 2640|      0|        }
 2641|      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
  ------------------
 2642|      0|    }
 2643|    171|    DEBUGMSGTL(("get_mib_directory", "mib directories set '%s'\n", dir));
  ------------------
  |  |   66|    171|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    171|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 171]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 171]
  |  |  ------------------
  ------------------
 2644|    171|    return(dir);
 2645|    171|}
netsnmp_fixup_mib_directory:
 2654|     57|{
 2655|     57|    const char *homepath = netsnmp_gethomedir();
 2656|     57|    char *mibpath = netsnmp_get_mib_directory();
 2657|     57|    char *oldmibpath = NULL;
 2658|     57|    char *ptr_home;
 2659|     57|    char *new_mibpath;
 2660|       |
 2661|     57|    DEBUGTRACE;
  ------------------
  |  |   63|     57|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 57]
  |  |  ------------------
  ------------------
 2662|     57|    if (homepath && mibpath) {
  ------------------
  |  Branch (2662:9): [True: 57, False: 0]
  |  Branch (2662:21): [True: 57, False: 0]
  ------------------
 2663|     57|        DEBUGMSGTL(("fixup_mib_directory", "mib directories '%s'\n", mibpath));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 2664|     57|        while ((ptr_home = strstr(mibpath, "$HOME"))) {
  ------------------
  |  Branch (2664:16): [True: 0, False: 57]
  ------------------
 2665|      0|            new_mibpath = (char *)malloc(strlen(mibpath) - strlen("$HOME") +
 2666|      0|					 strlen(homepath)+1);
 2667|      0|            if (new_mibpath) {
  ------------------
  |  Branch (2667:17): [True: 0, False: 0]
  ------------------
 2668|      0|                *ptr_home = 0; /* null out the spot where we stop copying */
 2669|      0|                sprintf(new_mibpath, "%s%s%s", mibpath, homepath,
 2670|      0|			ptr_home + strlen("$HOME"));
 2671|       |                /** swap in the new value and repeat */
 2672|      0|                mibpath = new_mibpath;
 2673|      0|		if (oldmibpath != NULL) {
  ------------------
  |  Branch (2673:7): [True: 0, False: 0]
  ------------------
 2674|      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]
  |  |  ------------------
  ------------------
 2675|      0|		}
 2676|      0|		oldmibpath = new_mibpath;
 2677|      0|            } else {
 2678|      0|                break;
 2679|      0|            }
 2680|      0|        }
 2681|       |
 2682|     57|        netsnmp_set_mib_directory(mibpath);
 2683|       |	
 2684|       |	/*  The above copies the mibpath for us, so...  */
 2685|       |
 2686|     57|	if (oldmibpath != NULL) {
  ------------------
  |  Branch (2686:6): [True: 0, False: 57]
  ------------------
 2687|      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]
  |  |  ------------------
  ------------------
 2688|      0|	}
 2689|       |
 2690|     57|    }
 2691|       |
 2692|     57|}
netsnmp_init_mib:
 2701|     57|{
 2702|     57|    const char     *prefix;
 2703|     57|    char           *env_var, *entry;
 2704|     57|    PrefixListPtr   pp = &mib_prefixes[0];
 2705|     57|    char           *st = NULL;
 2706|       |
 2707|     57|    if (Mib)
  ------------------
  |  Branch (2707:9): [True: 0, False: 57]
  ------------------
 2708|      0|        return;
 2709|     57|    netsnmp_init_mib_internals();
 2710|       |
 2711|       |    /*
 2712|       |     * Initialise the MIB directory/ies 
 2713|       |     */
 2714|     57|    netsnmp_fixup_mib_directory();
 2715|     57|    env_var = strdup(netsnmp_get_mib_directory());
 2716|     57|    if (!env_var)
  ------------------
  |  Branch (2716:9): [True: 0, False: 57]
  ------------------
 2717|      0|        return;
 2718|       |
 2719|     57|    DEBUGMSGTL(("init_mib",
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 2720|     57|                "Seen MIBDIRS: Looking in '%s' for mib dirs ...\n",
 2721|     57|                env_var));
 2722|       |
 2723|     57|    entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|     57|#define ENV_SEPARATOR ":"
  ------------------
 2724|    114|    while (entry) {
  ------------------
  |  Branch (2724:12): [True: 57, False: 57]
  ------------------
 2725|     57|        add_mibdir(entry);
 2726|     57|        entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|     57|#define ENV_SEPARATOR ":"
  ------------------
 2727|     57|    }
 2728|     57|    SNMP_FREE(env_var);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
 2729|       |
 2730|     57|    env_var = netsnmp_getenv("MIBFILES");
 2731|     57|    if (env_var != NULL) {
  ------------------
  |  Branch (2731:9): [True: 0, False: 57]
  ------------------
 2732|      0|        if (*env_var == '+')
  ------------------
  |  Branch (2732:13): [True: 0, False: 0]
  ------------------
 2733|      0|            entry = strtok_r(env_var+1, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2734|      0|        else
 2735|      0|            entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2736|      0|        while (entry) {
  ------------------
  |  Branch (2736:16): [True: 0, False: 0]
  ------------------
 2737|      0|            add_mibfile(entry, NULL);
 2738|      0|            entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2739|      0|        }
 2740|      0|    }
 2741|       |
 2742|     57|    netsnmp_init_mib_internals();
 2743|       |
 2744|       |    /*
 2745|       |     * Read in any modules or mibs requested 
 2746|       |     */
 2747|       |
 2748|     57|    env_var = netsnmp_getenv("MIBS");
 2749|     57|    if (env_var == NULL) {
  ------------------
  |  Branch (2749:9): [True: 57, False: 0]
  ------------------
 2750|     57|        if (confmibs != NULL)
  ------------------
  |  Branch (2750:13): [True: 0, False: 57]
  ------------------
 2751|      0|            env_var = strdup(confmibs);
 2752|     57|        else
 2753|     57|            env_var = strdup(NETSNMP_DEFAULT_MIBS);
  ------------------
  |  | 2014|     57|#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:LM-SENSORS-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"
  ------------------
 2754|     57|    } else {
 2755|      0|        env_var = strdup(env_var);
 2756|      0|    }
 2757|     57|    if (env_var && ((*env_var == '+') || (*env_var == '-'))) {
  ------------------
  |  Branch (2757:9): [True: 57, False: 0]
  |  Branch (2757:21): [True: 0, False: 57]
  |  Branch (2757:42): [True: 0, False: 57]
  ------------------
 2758|      0|        int res;
 2759|       |
 2760|      0|        if (*env_var == '+')
  ------------------
  |  Branch (2760:13): [True: 0, False: 0]
  ------------------
 2761|      0|            res = asprintf(&entry, "%s%c%s", NETSNMP_DEFAULT_MIBS,
  ------------------
  |  | 2014|      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:LM-SENSORS-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"
  ------------------
 2762|      0|                           ENV_SEPARATOR_CHAR, env_var + 1);
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 2763|      0|        else
 2764|      0|            res = asprintf(&entry, "%s%c%s", env_var + 1, ENV_SEPARATOR_CHAR,
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 2765|      0|                           NETSNMP_DEFAULT_MIBS);
  ------------------
  |  | 2014|      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:LM-SENSORS-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"
  ------------------
 2766|      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]
  |  |  ------------------
  ------------------
 2767|      0|        if (res < 0) {
  ------------------
  |  Branch (2767:13): [True: 0, False: 0]
  ------------------
 2768|      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]
  |  |  ------------------
  ------------------
 2769|      0|            return;
 2770|      0|        }
 2771|      0|        env_var = entry;
 2772|      0|    }
 2773|       |
 2774|     57|    if (env_var != NULL) {
  ------------------
  |  Branch (2774:9): [True: 57, False: 0]
  ------------------
 2775|     57|        DEBUGMSGTL(("init_mib",
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 2776|     57|                    "Seen MIBS: Looking in '%s' for mib files ...\n",
 2777|     57|                    env_var));
 2778|     57|        entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|     57|#define ENV_SEPARATOR ":"
  ------------------
 2779|  2.79k|        while (entry) {
  ------------------
  |  Branch (2779:16): [True: 2.73k, False: 57]
  ------------------
 2780|  2.73k|            if (strcasecmp(entry, DEBUG_ALWAYS_TOKEN) == 0) {
  ------------------
  |  |  227|  2.73k|#define DEBUG_ALWAYS_TOKEN "all"
  ------------------
  |  Branch (2780:17): [True: 0, False: 2.73k]
  ------------------
 2781|      0|                read_all_mibs();
 2782|  2.73k|            } else if (strstr(entry, "/") != NULL) {
  ------------------
  |  Branch (2782:24): [True: 0, False: 2.73k]
  ------------------
 2783|      0|                read_mib(entry);
 2784|  2.73k|            } else {
 2785|  2.73k|                netsnmp_read_module(entry);
 2786|  2.73k|            }
 2787|  2.73k|            entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|  2.73k|#define ENV_SEPARATOR ":"
  ------------------
 2788|  2.73k|        }
 2789|     57|        adopt_orphans();
 2790|     57|        SNMP_FREE(env_var);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
 2791|     57|    }
 2792|       |
 2793|     57|    env_var = netsnmp_getenv("MIBFILES");
 2794|     57|    if (env_var != NULL) {
  ------------------
  |  Branch (2794:9): [True: 0, False: 57]
  ------------------
 2795|      0|        if ((*env_var == '+') || (*env_var == '-')) {
  ------------------
  |  Branch (2795:13): [True: 0, False: 0]
  |  Branch (2795:34): [True: 0, False: 0]
  ------------------
 2796|       |#ifdef NETSNMP_DEFAULT_MIBFILES
 2797|       |            entry =
 2798|       |                (char *) malloc(strlen(NETSNMP_DEFAULT_MIBFILES) +
 2799|       |                                strlen(env_var) + 2);
 2800|       |            if (!entry) {
 2801|       |                DEBUGMSGTL(("init_mib", "env mibfiles malloc failed"));
 2802|       |            } else {
 2803|       |                if (*env_var++ == '+')
 2804|       |                    sprintf(entry, "%s%c%s", NETSNMP_DEFAULT_MIBFILES, ENV_SEPARATOR_CHAR,
 2805|       |                            env_var );
 2806|       |                else
 2807|       |                    sprintf(entry, "%s%c%s", env_var, ENV_SEPARATOR_CHAR,
 2808|       |                            NETSNMP_DEFAULT_MIBFILES );
 2809|       |            }
 2810|       |            SNMP_FREE(env_var);
 2811|       |            env_var = entry;
 2812|       |#else
 2813|      0|            env_var = strdup(env_var + 1);
 2814|      0|#endif
 2815|      0|        } else {
 2816|      0|            env_var = strdup(env_var);
 2817|      0|        }
 2818|     57|    } else {
 2819|       |#ifdef NETSNMP_DEFAULT_MIBFILES
 2820|       |        env_var = strdup(NETSNMP_DEFAULT_MIBFILES);
 2821|       |#endif
 2822|     57|    }
 2823|       |
 2824|     57|    if (env_var != NULL) {
  ------------------
  |  Branch (2824:9): [True: 0, False: 57]
  ------------------
 2825|      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]
  |  |  ------------------
  ------------------
 2826|      0|                    "Seen MIBFILES: Looking in '%s' for mib files ...\n",
 2827|      0|                    env_var));
 2828|      0|        entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2829|      0|        while (entry) {
  ------------------
  |  Branch (2829:16): [True: 0, False: 0]
  ------------------
 2830|      0|            read_mib(entry);
 2831|      0|            entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2832|      0|        }
 2833|      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]
  |  |  ------------------
  ------------------
 2834|      0|    }
 2835|       |
 2836|     57|    prefix = netsnmp_getenv("PREFIX");
 2837|       |
 2838|     57|    if (!prefix)
  ------------------
  |  Branch (2838:9): [True: 57, False: 0]
  ------------------
 2839|     57|        prefix = Standard_Prefix;
 2840|       |
 2841|     57|    Prefix = (char *) malloc(strlen(prefix) + 2);
 2842|     57|    if (!Prefix)
  ------------------
  |  Branch (2842:9): [True: 0, False: 57]
  ------------------
 2843|      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]
  |  |  ------------------
  ------------------
 2844|     57|    else
 2845|     57|        strcpy(Prefix, prefix);
 2846|       |
 2847|     57|    DEBUGMSGTL(("init_mib",
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 2848|     57|                "Seen PREFIX: Looking in '%s' for prefix ...\n", Prefix));
 2849|       |
 2850|       |    /*
 2851|       |     * remove trailing dot 
 2852|       |     */
 2853|     57|    if (Prefix) {
  ------------------
  |  Branch (2853:9): [True: 57, False: 0]
  ------------------
 2854|     57|        env_var = &Prefix[strlen(Prefix) - 1];
 2855|     57|        if (*env_var == '.')
  ------------------
  |  Branch (2855:13): [True: 0, False: 57]
  ------------------
 2856|      0|            *env_var = '\0';
 2857|     57|    }
 2858|       |
 2859|     57|    pp->str = Prefix;           /* fixup first mib_prefix entry */
 2860|       |    /*
 2861|       |     * now that the list of prefixes is built, save each string length. 
 2862|       |     */
 2863|    399|    while (pp->str) {
  ------------------
  |  Branch (2863:12): [True: 342, False: 57]
  ------------------
 2864|    342|        pp->len = strlen(pp->str);
 2865|    342|        pp++;
 2866|    342|    }
 2867|       |
 2868|     57|    Mib = tree_head;            /* Backwards compatibility */
 2869|     57|    tree_top = calloc(1, sizeof(struct tree));
 2870|       |    /*
 2871|       |     * XX error check ? 
 2872|       |     */
 2873|     57|    if (tree_top) {
  ------------------
  |  Branch (2873:9): [True: 57, False: 0]
  ------------------
 2874|     57|        tree_top->label = strdup("(top)");
 2875|     57|        tree_top->child_list = tree_head;
 2876|     57|    }
 2877|     57|}
shutdown_mib:
 2893|     57|{
 2894|     57|    unload_all_mibs();
 2895|     57|    if (tree_top) {
  ------------------
  |  Branch (2895:9): [True: 57, False: 0]
  ------------------
 2896|     57|        if (tree_top->label)
  ------------------
  |  Branch (2896:13): [True: 57, False: 0]
  ------------------
 2897|     57|            SNMP_FREE(tree_top->label);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
 2898|     57|        SNMP_FREE(tree_top);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
 2899|     57|    }
 2900|     57|    tree_head = NULL;
 2901|     57|    Mib = NULL;
 2902|     57|    if (Prefix != NULL && Prefix != &Standard_Prefix[0])
  ------------------
  |  Branch (2902:9): [True: 57, False: 0]
  |  Branch (2902:27): [True: 57, False: 0]
  ------------------
 2903|     57|        SNMP_FREE(Prefix);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
 2904|     57|    if (Prefix)
  ------------------
  |  Branch (2904:9): [True: 0, False: 57]
  ------------------
 2905|      0|        Prefix = NULL;
 2906|     57|    SNMP_FREE(confmibs);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 57]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
 2907|       |    SNMP_FREE(confmibdir);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 57]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
 2908|     57|}
set_function:
 2940|    171|{
 2941|    171|    subtree->printer = NULL;
 2942|    171|    switch (subtree->type) {
 2943|      0|    case TYPE_OBJID:
  ------------------
  |  |  155|      0|#define TYPE_OBJID          1
  ------------------
  |  Branch (2943:5): [True: 0, False: 171]
  ------------------
 2944|      0|        subtree->printomat = sprint_realloc_object_identifier;
 2945|      0|        break;
 2946|      0|    case TYPE_OCTETSTR:
  ------------------
  |  |  156|      0|#define TYPE_OCTETSTR       2
  ------------------
  |  Branch (2946:5): [True: 0, False: 171]
  ------------------
 2947|      0|        subtree->printomat = sprint_realloc_octet_string;
 2948|      0|        break;
 2949|      0|    case TYPE_INTEGER:
  ------------------
  |  |  157|      0|#define TYPE_INTEGER        3
  ------------------
  |  Branch (2949:5): [True: 0, False: 171]
  ------------------
 2950|      0|        subtree->printomat = sprint_realloc_integer;
 2951|      0|        break;
 2952|      0|    case TYPE_INTEGER32:
  ------------------
  |  |  170|      0|#define TYPE_INTEGER32      16
  ------------------
  |  Branch (2952:5): [True: 0, False: 171]
  ------------------
 2953|      0|        subtree->printomat = sprint_realloc_integer;
 2954|      0|        break;
 2955|      0|    case TYPE_NETADDR:
  ------------------
  |  |  158|      0|#define TYPE_NETADDR        4
  ------------------
  |  Branch (2955:5): [True: 0, False: 171]
  ------------------
 2956|      0|        subtree->printomat = sprint_realloc_networkaddress;
 2957|      0|        break;
 2958|      0|    case TYPE_IPADDR:
  ------------------
  |  |  159|      0|#define TYPE_IPADDR         5
  ------------------
  |  Branch (2958:5): [True: 0, False: 171]
  ------------------
 2959|      0|        subtree->printomat = sprint_realloc_ipaddress;
 2960|      0|        break;
 2961|      0|    case TYPE_COUNTER:
  ------------------
  |  |  160|      0|#define TYPE_COUNTER        6
  ------------------
  |  Branch (2961:5): [True: 0, False: 171]
  ------------------
 2962|      0|        subtree->printomat = sprint_realloc_counter;
 2963|      0|        break;
 2964|      0|    case TYPE_GAUGE:
  ------------------
  |  |  161|      0|#define TYPE_GAUGE          7
  ------------------
  |  Branch (2964:5): [True: 0, False: 171]
  ------------------
 2965|      0|        subtree->printomat = sprint_realloc_gauge;
 2966|      0|        break;
 2967|      0|    case TYPE_TIMETICKS:
  ------------------
  |  |  162|      0|#define TYPE_TIMETICKS      8
  ------------------
  |  Branch (2967:5): [True: 0, False: 171]
  ------------------
 2968|      0|        subtree->printomat = sprint_realloc_timeticks;
 2969|      0|        break;
 2970|      0|    case TYPE_OPAQUE:
  ------------------
  |  |  163|      0|#define TYPE_OPAQUE         9
  ------------------
  |  Branch (2970:5): [True: 0, False: 171]
  ------------------
 2971|      0|        subtree->printomat = sprint_realloc_opaque;
 2972|      0|        break;
 2973|      0|    case TYPE_NULL:
  ------------------
  |  |  164|      0|#define TYPE_NULL           10
  ------------------
  |  Branch (2973:5): [True: 0, False: 171]
  ------------------
 2974|      0|        subtree->printomat = sprint_realloc_null;
 2975|      0|        break;
 2976|      0|    case TYPE_BITSTRING:
  ------------------
  |  |  166|      0|#define TYPE_BITSTRING      12
  ------------------
  |  Branch (2976:5): [True: 0, False: 171]
  ------------------
 2977|      0|        subtree->printomat = sprint_realloc_bitstring;
 2978|      0|        break;
 2979|      0|    case TYPE_NSAPADDRESS:
  ------------------
  |  |  167|      0|#define TYPE_NSAPADDRESS    13
  ------------------
  |  Branch (2979:5): [True: 0, False: 171]
  ------------------
 2980|      0|        subtree->printomat = sprint_realloc_nsapaddress;
 2981|      0|        break;
 2982|      0|    case TYPE_COUNTER64:
  ------------------
  |  |  165|      0|#define TYPE_COUNTER64      11
  ------------------
  |  Branch (2982:5): [True: 0, False: 171]
  ------------------
 2983|      0|        subtree->printomat = sprint_realloc_counter64;
 2984|      0|        break;
 2985|      0|    case TYPE_UINTEGER:
  ------------------
  |  |  168|      0|#define TYPE_UINTEGER       14
  ------------------
  |  Branch (2985:5): [True: 0, False: 171]
  ------------------
 2986|      0|        subtree->printomat = sprint_realloc_uinteger;
 2987|      0|        break;
 2988|      0|    case TYPE_UNSIGNED32:
  ------------------
  |  |  169|      0|#define TYPE_UNSIGNED32     15
  ------------------
  |  Branch (2988:5): [True: 0, False: 171]
  ------------------
 2989|      0|        subtree->printomat = sprint_realloc_gauge;
 2990|      0|        break;
 2991|    171|    case TYPE_OTHER:
  ------------------
  |  |  154|    171|#define TYPE_OTHER          0
  ------------------
  |  Branch (2991:5): [True: 171, False: 0]
  ------------------
 2992|    171|    default:
  ------------------
  |  Branch (2992:5): [True: 0, False: 171]
  ------------------
 2993|    171|        subtree->printomat = sprint_realloc_by_type;
 2994|    171|        break;
 2995|    171|    }
 2996|    171|}

netsnmp_init_mib_internals:
  700|  2.90k|{
  701|  2.90k|    register struct tok *tp;
  702|  2.90k|    register int    b, i;
  703|  2.90k|    int             max_modc;
  704|       |
  705|  2.90k|    if (tree_head)
  ------------------
  |  Branch (705:9): [True: 2.85k, False: 57]
  ------------------
  706|  2.85k|        return;
  707|       |
  708|       |    /*
  709|       |     * Set up hash list of pre-defined tokens
  710|       |     */
  711|     57|    memset(buckets, 0, sizeof(buckets));
  712|  5.30k|    for (tp = tokens; tp->name; tp++) {
  ------------------
  |  Branch (712:23): [True: 5.24k, False: 57]
  ------------------
  713|  5.24k|        tp->hash = name_hash(tp->name);
  714|  5.24k|        b = BUCKET(tp->hash);
  ------------------
  |  |  527|  5.24k|#define BUCKET(x)       (x & (HASHSIZE-1))
  |  |  ------------------
  |  |  |  |  526|  5.24k|#define HASHSIZE        32
  |  |  ------------------
  ------------------
  715|  5.24k|        if (buckets[b])
  ------------------
  |  Branch (715:13): [True: 3.42k, False: 1.82k]
  ------------------
  716|  3.42k|            tp->next = buckets[b];      /* BUG ??? */
  717|  5.24k|        buckets[b] = tp;
  718|  5.24k|    }
  719|       |
  720|       |    /*
  721|       |     * Initialise other internal structures
  722|       |     */
  723|       |
  724|     57|    max_modc = sizeof(module_map) / sizeof(module_map[0]) - 1;
  725|  1.25k|    for (i = 0; i < max_modc; ++i)
  ------------------
  |  Branch (725:17): [True: 1.19k, False: 57]
  ------------------
  726|  1.19k|        module_map[i].next = &(module_map[i + 1]);
  727|     57|    module_map[max_modc].next = NULL;
  728|     57|    module_map_head = module_map;
  729|       |
  730|     57|    memset(nbuckets, 0, sizeof(nbuckets));
  731|     57|    memset(tbuckets, 0, sizeof(tbuckets));
  732|     57|    free(tclist);
  733|     57|    tc_alloc = TC_INCR;
  ------------------
  |  |  134|     57|#define TC_INCR 100
  ------------------
  734|     57|    tclist = calloc(tc_alloc, sizeof(struct tc));
  735|     57|    build_translation_table();
  736|     57|    init_tree_roots();          /* Set up initial roots */
  737|       |    /*
  738|       |     * Relies on 'add_mibdir' having set up the modules 
  739|       |     */
  740|     57|}
which_module:
 3835|    171|{
 3836|    171|    struct module  *mp;
 3837|       |
 3838|    171|    for (mp = module_head; mp; mp = mp->next)
  ------------------
  |  Branch (3838:28): [True: 0, False: 171]
  ------------------
 3839|      0|        if (!label_compare(mp->name, name))
  ------------------
  |  | 1236|      0|#define	label_compare	strcmp
  ------------------
  |  Branch (3839:13): [True: 0, False: 0]
  ------------------
 3840|      0|            return (mp->modid);
 3841|       |
 3842|    171|    DEBUGMSGTL(("parse-mibs", "Module %s not found\n", name));
  ------------------
  |  |   66|    171|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    171|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 171]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 171]
  |  |  ------------------
  ------------------
 3843|    171|    return (-1);
 3844|    171|}
adopt_orphans:
 4033|     57|{
 4034|     57|    struct node    *np = NULL, *onp;
 4035|     57|    struct tree    *tp;
 4036|     57|    int             i, adopted = 1;
 4037|       |
 4038|     57|    if (!orphan_nodes)
  ------------------
  |  Branch (4038:9): [True: 57, False: 0]
  ------------------
 4039|     57|        return;
 4040|      0|    init_node_hash(orphan_nodes);
 4041|      0|    orphan_nodes = NULL;
 4042|       |
 4043|      0|    while (adopted) {
  ------------------
  |  Branch (4043:12): [True: 0, False: 0]
  ------------------
 4044|      0|        adopted = 0;
 4045|      0|        for (i = 0; i < NHASHSIZE; i++)
  ------------------
  |  |  529|      0|#define NHASHSIZE    128
  ------------------
  |  Branch (4045:21): [True: 0, False: 0]
  ------------------
 4046|      0|            if (nbuckets[i]) {
  ------------------
  |  Branch (4046:17): [True: 0, False: 0]
  ------------------
 4047|      0|                for (np = nbuckets[i]; np != NULL; np = np->next) {
  ------------------
  |  Branch (4047:40): [True: 0, False: 0]
  ------------------
 4048|      0|                    tp = find_tree_node(np->parent, -1);
 4049|      0|		    if (tp) {
  ------------------
  |  Branch (4049:11): [True: 0, False: 0]
  ------------------
 4050|      0|			do_subtree(tp, &np);
 4051|      0|			adopted = 1;
 4052|       |                        /*
 4053|       |                         * if do_subtree adopted the entire bucket, stop
 4054|       |                         */
 4055|      0|                        if(NULL == nbuckets[i])
  ------------------
  |  Branch (4055:28): [True: 0, False: 0]
  ------------------
 4056|      0|                            break;
 4057|       |
 4058|       |                        /*
 4059|       |                         * do_subtree may modify nbuckets, and if np
 4060|       |                         * was adopted, np->next probably isn't an orphan
 4061|       |                         * anymore. if np is still in the bucket (do_subtree
 4062|       |                         * didn't adopt it) keep on plugging. otherwise
 4063|       |                         * start over, at the top of the bucket.
 4064|       |                         */
 4065|      0|                        for(onp = nbuckets[i]; onp; onp = onp->next)
  ------------------
  |  Branch (4065:48): [True: 0, False: 0]
  ------------------
 4066|      0|                            if(onp == np)
  ------------------
  |  Branch (4066:32): [True: 0, False: 0]
  ------------------
 4067|      0|                                break;
 4068|      0|                        if(NULL == onp) { /* not in the list */
  ------------------
  |  Branch (4068:28): [True: 0, False: 0]
  ------------------
 4069|      0|                            np = nbuckets[i]; /* start over */
 4070|      0|                        }
 4071|      0|		    }
 4072|      0|		}
 4073|      0|            }
 4074|      0|    }
 4075|       |
 4076|       |    /*
 4077|       |     * Report on outstanding orphans
 4078|       |     *    and link them back into the orphan list
 4079|       |     */
 4080|      0|    for (i = 0; i < NHASHSIZE; i++)
  ------------------
  |  |  529|      0|#define NHASHSIZE    128
  ------------------
  |  Branch (4080:17): [True: 0, False: 0]
  ------------------
 4081|      0|        if (nbuckets[i]) {
  ------------------
  |  Branch (4081:13): [True: 0, False: 0]
  ------------------
 4082|      0|            if (orphan_nodes)
  ------------------
  |  Branch (4082:17): [True: 0, False: 0]
  ------------------
 4083|      0|                onp = np->next = nbuckets[i];
 4084|      0|            else
 4085|      0|                onp = orphan_nodes = nbuckets[i];
 4086|      0|            nbuckets[i] = NULL;
 4087|      0|            while (onp) {
  ------------------
  |  Branch (4087:20): [True: 0, False: 0]
  ------------------
 4088|      0|                char            modbuf[256];
 4089|      0|                snmp_log(LOG_WARNING,
 4090|      0|                         "Cannot resolve OID in %s: %s ::= { %s %ld } at line %d in %s\n",
 4091|      0|                         module_name(onp->modid, modbuf),
 4092|      0|                         (onp->label ? onp->label : "<no label>"),
  ------------------
  |  Branch (4092:27): [True: 0, False: 0]
  ------------------
 4093|      0|                         (onp->parent ? onp->parent : "<no parent>"),
  ------------------
  |  Branch (4093:27): [True: 0, False: 0]
  ------------------
 4094|      0|                         onp->subid, onp->lineno, onp->filename);
 4095|      0|                np = onp;
 4096|      0|                onp = onp->next;
 4097|      0|            }
 4098|      0|        }
 4099|      0|}
netsnmp_read_module:
 4111|  2.73k|{
 4112|  2.73k|    int status = 0;
 4113|  2.73k|    status = read_module_internal(name);
 4114|       |
 4115|  2.73k|    if (status == MODULE_NOT_FOUND) {
  ------------------
  |  |  513|  2.73k|#define MODULE_NOT_FOUND	0
  ------------------
  |  Branch (4115:9): [True: 2.73k, False: 0]
  ------------------
 4116|  2.73k|        if (!read_module_replacements(name))
  ------------------
  |  Branch (4116:13): [True: 2.73k, False: 0]
  ------------------
 4117|  2.73k|            print_module_not_found(name);
 4118|  2.73k|    } else if (status == MODULE_SYNTAX_ERROR) {
  ------------------
  |  |  520|      0|#define MODULE_SYNTAX_ERROR     4
  ------------------
  |  Branch (4118:16): [True: 0, False: 0]
  ------------------
 4119|      0|        gMibError = 0;
 4120|      0|        gLoop = 1;
 4121|       |
 4122|      0|        strncat(gMibNames, " ", sizeof(gMibNames) - strlen(gMibNames) - 1);
 4123|      0|        strncat(gMibNames, name, sizeof(gMibNames) - strlen(gMibNames) - 1);
 4124|      0|    }
 4125|       |
 4126|  2.73k|    return tree_head;
 4127|  2.73k|}
unload_module_by_ID:
 4136|     57|{
 4137|     57|    struct tree    *tp, *next;
 4138|     57|    int             i;
 4139|       |
 4140|    228|    for (tp = tree_top; tp; tp = next) {
  ------------------
  |  Branch (4140:25): [True: 171, False: 57]
  ------------------
 4141|       |        /*
 4142|       |         * Essentially, this is equivalent to the code fragment:
 4143|       |         *      if (tp->modID == modID)
 4144|       |         *        tp->number_modules--;
 4145|       |         * but handles one tree node being part of several modules,
 4146|       |         * and possible multiple copies of the same module ID.
 4147|       |         */
 4148|    171|        int             nmod = tp->number_modules;
 4149|    171|        if (nmod > 0) {         /* in some module */
  ------------------
  |  Branch (4149:13): [True: 171, False: 0]
  ------------------
 4150|       |            /*
 4151|       |             * Remove all copies of this module ID
 4152|       |             */
 4153|    171|            int             cnt = 0, *pi1, *pi2 = tp->module_list;
 4154|    342|            for (i = 0, pi1 = pi2; i < nmod; i++, pi2++) {
  ------------------
  |  Branch (4154:36): [True: 171, False: 171]
  ------------------
 4155|    171|                if (*pi2 == modID)
  ------------------
  |  Branch (4155:21): [True: 171, False: 0]
  ------------------
 4156|    171|                    continue;
 4157|      0|                cnt++;
 4158|      0|                *pi1++ = *pi2;
 4159|      0|            }
 4160|    171|            if (nmod != cnt) {  /* in this module */
  ------------------
  |  Branch (4160:17): [True: 171, False: 0]
  ------------------
 4161|       |                /*
 4162|       |                 * if ( (nmod - cnt) > 1)
 4163|       |                 * printf("Dup modid %d,  %d times, '%s'\n", tp->modid, (nmod-cnt), tp->label); fflush(stdout); ?* XXDEBUG 
 4164|       |                 */
 4165|    171|                tp->number_modules = cnt;
 4166|    171|                switch (cnt) {
 4167|    171|                case 0:
  ------------------
  |  Branch (4167:17): [True: 171, False: 0]
  ------------------
 4168|    171|                    tp->module_list[0] = -1;    /* Mark unused, */
 4169|    171|		    NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2440|    171|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4170|       |
 4171|    171|                case 1:        /* save the remaining module */
  ------------------
  |  Branch (4171:17): [True: 0, False: 171]
  ------------------
 4172|    171|                    if (&(tp->modid) != tp->module_list) {
  ------------------
  |  Branch (4172:25): [True: 0, False: 171]
  ------------------
 4173|      0|                        tp->modid = tp->module_list[0];
 4174|      0|                        free(tp->module_list);
 4175|      0|                        tp->module_list = &(tp->modid);
 4176|      0|                    }
 4177|    171|                    break;
 4178|       |
 4179|      0|                default:
  ------------------
  |  Branch (4179:17): [True: 0, False: 171]
  ------------------
 4180|      0|                    break;
 4181|    171|                }
 4182|    171|            }                   /* if tree node is in this module */
 4183|    171|        }
 4184|       |        /*
 4185|       |         * if tree node is in some module 
 4186|       |         */
 4187|    171|        next = tp->next_peer;
 4188|       |
 4189|       |
 4190|       |        /*
 4191|       |         *  OK - that's dealt with *this* node.
 4192|       |         *    Now let's look at the children.
 4193|       |         *    (Isn't recursion wonderful!)
 4194|       |         */
 4195|    171|        if (tp->child_list)
  ------------------
  |  Branch (4195:13): [True: 0, False: 171]
  ------------------
 4196|      0|            unload_module_by_ID(modID, tp->child_list);
 4197|       |
 4198|       |
 4199|    171|        if (tp->number_modules == 0) {
  ------------------
  |  Branch (4199:13): [True: 171, False: 0]
  ------------------
 4200|       |            /*
 4201|       |             * This node isn't needed any more (except perhaps
 4202|       |             * for the sake of the children) 
 4203|       |             */
 4204|    171|            if (tp->child_list == NULL) {
  ------------------
  |  Branch (4204:17): [True: 171, False: 0]
  ------------------
 4205|    171|                unlink_tree(tp);
 4206|    171|                free_tree(tp);
 4207|    171|            } else {
 4208|      0|                free_partial_tree(tp, TRUE);
  ------------------
  |  |  128|      0|#define TRUE  1
  ------------------
 4209|      0|            }
 4210|    171|        }
 4211|    171|    }
 4212|     57|}
unload_all_mibs:
 4249|     57|{
 4250|     57|    struct module  *mp;
 4251|     57|    struct module_compatability *mcp;
 4252|     57|    struct tc      *ptc;
 4253|     57|    unsigned int    i;
 4254|       |
 4255|     57|    for (mcp = module_map_head; mcp; mcp = module_map_head) {
  ------------------
  |  Branch (4255:33): [True: 57, False: 0]
  ------------------
 4256|     57|        if (mcp == module_map)
  ------------------
  |  Branch (4256:13): [True: 57, False: 0]
  ------------------
 4257|     57|            break;
 4258|      0|        module_map_head = mcp->next;
 4259|      0|        if (mcp->tag) free(NETSNMP_REMOVE_CONST(char *, mcp->tag));
  ------------------
  |  |   91|      0|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  |  Branch (4259:13): [True: 0, False: 0]
  ------------------
 4260|      0|        free(NETSNMP_REMOVE_CONST(char *, mcp->old_module));
  ------------------
  |  |   91|      0|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
 4261|      0|        free(NETSNMP_REMOVE_CONST(char *, mcp->new_module));
  ------------------
  |  |   91|      0|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
 4262|      0|        free(mcp);
 4263|      0|    }
 4264|       |
 4265|     57|    for (mp = module_head; mp; mp = module_head) {
  ------------------
  |  Branch (4265:28): [True: 0, False: 57]
  ------------------
 4266|      0|        struct module_import *mi = mp->imports;
 4267|      0|        if (mi) {
  ------------------
  |  Branch (4267:13): [True: 0, False: 0]
  ------------------
 4268|      0|            for (i = 0; i < (unsigned int)mp->no_imports; ++i) {
  ------------------
  |  Branch (4268:25): [True: 0, False: 0]
  ------------------
 4269|      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]
  |  |  ------------------
  ------------------
 4270|      0|            }
 4271|      0|            mp->no_imports = 0;
 4272|      0|            if (mi == root_imports)
  ------------------
  |  Branch (4272:17): [True: 0, False: 0]
  ------------------
 4273|      0|                memset(mi, 0, sizeof(*mi));
 4274|      0|            else
 4275|      0|                free(mi);
 4276|      0|        }
 4277|       |
 4278|      0|        unload_module_by_ID(mp->modid, tree_head);
 4279|      0|        module_head = mp->next;
 4280|      0|        free(mp->name);
 4281|      0|        free(mp->file);
 4282|      0|        free(mp);
 4283|      0|    }
 4284|     57|    unload_module_by_ID(-1, tree_head);
 4285|       |    /*
 4286|       |     * tree nodes are cleared 
 4287|       |     */
 4288|       |
 4289|  5.75k|    for (i = 0, ptc = tclist; i < tc_alloc; i++, ptc++) {
  ------------------
  |  Branch (4289:31): [True: 5.70k, False: 57]
  ------------------
 4290|  5.70k|        if (ptc->type == 0)
  ------------------
  |  Branch (4290:13): [True: 5.70k, False: 0]
  ------------------
 4291|  5.70k|            continue;
 4292|      0|        free_enums(&ptc->enums);
 4293|      0|        free_ranges(&ptc->ranges);
 4294|      0|        free(ptc->descriptor);
 4295|      0|        if (ptc->hint)
  ------------------
  |  Branch (4295:13): [True: 0, False: 0]
  ------------------
 4296|      0|            free(ptc->hint);
 4297|      0|        if (ptc->description)
  ------------------
  |  Branch (4297:13): [True: 0, False: 0]
  ------------------
 4298|      0|            free(ptc->description);
 4299|      0|    }
 4300|     57|    SNMP_FREE(tclist);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
 4301|     57|    tc_alloc = 0;
 4302|       |
 4303|     57|    memset(buckets, 0, sizeof(buckets));
 4304|     57|    memset(nbuckets, 0, sizeof(nbuckets));
 4305|     57|    memset(tbuckets, 0, sizeof(tbuckets));
 4306|       |
 4307|    228|    for (i = 0; i < sizeof(root_imports) / sizeof(root_imports[0]); i++) {
  ------------------
  |  Branch (4307:17): [True: 171, False: 57]
  ------------------
 4308|    171|        SNMP_FREE(root_imports[i].label);
  ------------------
  |  |   62|    171|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 171, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 171]
  |  |  ------------------
  ------------------
 4309|    171|    }
 4310|       |
 4311|     57|    max_module = 0;
 4312|     57|    current_module = 0;
 4313|     57|    module_map_head = NULL;
 4314|     57|    SNMP_FREE(last_err_module);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
 4315|       |
 4316|     57|    {
 4317|     57|        struct node *np = orphan_nodes;
 4318|       |
 4319|     57|        while (np) {
  ------------------
  |  Branch (4319:16): [True: 0, False: 57]
  ------------------
 4320|      0|            struct node *nnp = np->next;
 4321|      0|            free_node(np);
 4322|      0|            np = nnp;
 4323|      0|        }
 4324|       |        orphan_nodes = NULL;
 4325|     57|    }
 4326|     57|    erroneousMibs = 0;
 4327|     57|    first_err_module = 1;
 4328|     57|}
add_mibdir:
 5124|     57|{
 5125|     57|    const char     *oldFile = File;
 5126|     57|    int             oldLine = mibLine;
 5127|     57|    char          **filenames;
 5128|     57|    int             count = 0;
 5129|     57|    int             filename_count, i;
 5130|       |
 5131|     57|    DEBUGMSGTL(("parse-mibs", "Scanning directory %s\n", dirname));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 5132|       |
 5133|     57|    filename_count = scan_directory(&filenames, dirname);
 5134|       |
 5135|     57|    if (filename_count >= 0) {
  ------------------
  |  Branch (5135:9): [True: 0, False: 57]
  ------------------
 5136|      0|        for (i = 0; i < filename_count; i++) {
  ------------------
  |  Branch (5136:21): [True: 0, False: 0]
  ------------------
 5137|      0|            if (add_mibfile(filenames[i], strrchr(filenames[i], '/')) == 0)
  ------------------
  |  Branch (5137:17): [True: 0, False: 0]
  ------------------
 5138|      0|                count++;
 5139|      0|	    free(filenames[i]);
 5140|      0|        }
 5141|      0|        File = oldFile;
 5142|      0|        mibLine = oldLine;
 5143|      0|        free(filenames);
 5144|      0|        return (count);
 5145|      0|    }
 5146|     57|    else
 5147|     57|        DEBUGMSGTL(("parse-mibs","cannot open MIB directory %s\n", dirname));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 5148|       |
 5149|     57|    return (-1);
 5150|     57|}
parse.c:name_hash:
  687|  5.58k|{
  688|  5.58k|    int             hash = 0;
  689|  5.58k|    const char     *cp;
  690|       |
  691|  5.58k|    if (!name)
  ------------------
  |  Branch (691:9): [True: 0, False: 5.58k]
  ------------------
  692|      0|        return 0;
  693|  58.5k|    for (cp = name; *cp; cp++)
  ------------------
  |  Branch (693:21): [True: 53.0k, False: 5.58k]
  ------------------
  694|  53.0k|        hash += tolower((unsigned char)(*cp));
  ------------------
  |  Branch (694:17): [True: 0, False: 0]
  |  Branch (694:17): [True: 0, False: 0]
  |  Branch (694:17): [Folded, False: 53.0k]
  ------------------
  695|  5.58k|    return (hash);
  696|  5.58k|}
parse.c:build_translation_table:
 1071|     57|{
 1072|     57|    int             count;
 1073|       |
 1074|  14.6k|    for (count = 0; count < 256; count++) {
  ------------------
  |  Branch (1074:21): [True: 14.5k, False: 57]
  ------------------
 1075|  14.5k|        switch (count) {
 1076|     57|        case OBJID:
  ------------------
  |  |  167|     57|#define OBJID       (4 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     57|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1076:9): [True: 57, False: 14.5k]
  ------------------
 1077|     57|            translation_table[count] = TYPE_OBJID;
  ------------------
  |  |  155|     57|#define TYPE_OBJID          1
  ------------------
 1078|     57|            break;
 1079|     57|        case OCTETSTR:
  ------------------
  |  |  168|     57|#define OCTETSTR    (5 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     57|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1079:9): [True: 57, False: 14.5k]
  ------------------
 1080|     57|            translation_table[count] = TYPE_OCTETSTR;
  ------------------
  |  |  156|     57|#define TYPE_OCTETSTR       2
  ------------------
 1081|     57|            break;
 1082|     57|        case INTEGER:
  ------------------
  |  |  169|     57|#define INTEGER     (6 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     57|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1082:9): [True: 57, False: 14.5k]
  ------------------
 1083|     57|            translation_table[count] = TYPE_INTEGER;
  ------------------
  |  |  157|     57|#define TYPE_INTEGER        3
  ------------------
 1084|     57|            break;
 1085|     57|        case NETADDR:
  ------------------
  |  |  170|     57|#define NETADDR     (7 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     57|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1085:9): [True: 57, False: 14.5k]
  ------------------
 1086|     57|            translation_table[count] = TYPE_NETADDR;
  ------------------
  |  |  158|     57|#define TYPE_NETADDR        4
  ------------------
 1087|     57|            break;
 1088|     57|        case IPADDR:
  ------------------
  |  |  171|     57|#define IPADDR      (8 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     57|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1088:9): [True: 57, False: 14.5k]
  ------------------
 1089|     57|            translation_table[count] = TYPE_IPADDR;
  ------------------
  |  |  159|     57|#define TYPE_IPADDR         5
  ------------------
 1090|     57|            break;
 1091|     57|        case COUNTER:
  ------------------
  |  |  172|     57|#define COUNTER     (9 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     57|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1091:9): [True: 57, False: 14.5k]
  ------------------
 1092|     57|            translation_table[count] = TYPE_COUNTER;
  ------------------
  |  |  160|     57|#define TYPE_COUNTER        6
  ------------------
 1093|     57|            break;
 1094|     57|        case GAUGE:
  ------------------
  |  |  173|     57|#define GAUGE       (10 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     57|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1094:9): [True: 57, False: 14.5k]
  ------------------
 1095|     57|            translation_table[count] = TYPE_GAUGE;
  ------------------
  |  |  161|     57|#define TYPE_GAUGE          7
  ------------------
 1096|     57|            break;
 1097|     57|        case TIMETICKS:
  ------------------
  |  |  174|     57|#define TIMETICKS   (11 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     57|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1097:9): [True: 57, False: 14.5k]
  ------------------
 1098|     57|            translation_table[count] = TYPE_TIMETICKS;
  ------------------
  |  |  162|     57|#define TYPE_TIMETICKS      8
  ------------------
 1099|     57|            break;
 1100|     57|        case KW_OPAQUE:
  ------------------
  |  |  175|     57|#define KW_OPAQUE   (12 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     57|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1100:9): [True: 57, False: 14.5k]
  ------------------
 1101|     57|            translation_table[count] = TYPE_OPAQUE;
  ------------------
  |  |  163|     57|#define TYPE_OPAQUE         9
  ------------------
 1102|     57|            break;
 1103|     57|        case NUL:
  ------------------
  |  |  176|     57|#define NUL         (13 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     57|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1103:9): [True: 57, False: 14.5k]
  ------------------
 1104|     57|            translation_table[count] = TYPE_NULL;
  ------------------
  |  |  164|     57|#define TYPE_NULL           10
  ------------------
 1105|     57|            break;
 1106|     57|        case COUNTER64:
  ------------------
  |  |  211|     57|#define COUNTER64   (43 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     57|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1106:9): [True: 57, False: 14.5k]
  ------------------
 1107|     57|            translation_table[count] = TYPE_COUNTER64;
  ------------------
  |  |  165|     57|#define TYPE_COUNTER64      11
  ------------------
 1108|     57|            break;
 1109|     57|        case BITSTRING:
  ------------------
  |  |  209|     57|#define BITSTRING   (41 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     57|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1109:9): [True: 57, False: 14.5k]
  ------------------
 1110|     57|            translation_table[count] = TYPE_BITSTRING;
  ------------------
  |  |  166|     57|#define TYPE_BITSTRING      12
  ------------------
 1111|     57|            break;
 1112|     57|        case NSAPADDRESS:
  ------------------
  |  |  210|     57|#define NSAPADDRESS (42 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     57|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1112:9): [True: 57, False: 14.5k]
  ------------------
 1113|     57|            translation_table[count] = TYPE_NSAPADDRESS;
  ------------------
  |  |  167|     57|#define TYPE_NSAPADDRESS    13
  ------------------
 1114|     57|            break;
 1115|     57|        case INTEGER32:
  ------------------
  |  |  274|     57|#define INTEGER32	(105 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     57|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1115:9): [True: 57, False: 14.5k]
  ------------------
 1116|     57|            translation_table[count] = TYPE_INTEGER32;
  ------------------
  |  |  170|     57|#define TYPE_INTEGER32      16
  ------------------
 1117|     57|            break;
 1118|     57|        case UINTEGER32:
  ------------------
  |  |  224|     57|#define UINTEGER32 (56 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     57|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1118:9): [True: 57, False: 14.5k]
  ------------------
 1119|     57|            translation_table[count] = TYPE_UINTEGER;
  ------------------
  |  |  168|     57|#define TYPE_UINTEGER       14
  ------------------
 1120|     57|            break;
 1121|     57|        case UNSIGNED32:
  ------------------
  |  |  273|     57|#define UNSIGNED32	(104 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     57|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1121:9): [True: 57, False: 14.5k]
  ------------------
 1122|     57|            translation_table[count] = TYPE_UNSIGNED32;
  ------------------
  |  |  169|     57|#define TYPE_UNSIGNED32     15
  ------------------
 1123|     57|            break;
 1124|     57|        case TRAPTYPE:
  ------------------
  |  |  229|     57|#define TRAPTYPE    61
  ------------------
  |  Branch (1124:9): [True: 57, False: 14.5k]
  ------------------
 1125|     57|            translation_table[count] = TYPE_TRAPTYPE;
  ------------------
  |  |  174|     57|#define TYPE_TRAPTYPE	    20
  ------------------
 1126|     57|            break;
 1127|     57|        case NOTIFTYPE:
  ------------------
  |  |  213|     57|#define NOTIFTYPE   45
  ------------------
  |  Branch (1127:9): [True: 57, False: 14.5k]
  ------------------
 1128|     57|            translation_table[count] = TYPE_NOTIFTYPE;
  ------------------
  |  |  175|     57|#define TYPE_NOTIFTYPE      21
  ------------------
 1129|     57|            break;
 1130|     57|        case NOTIFGROUP:
  ------------------
  |  |  258|     57|#define NOTIFGROUP  88
  ------------------
  |  Branch (1130:9): [True: 57, False: 14.5k]
  ------------------
 1131|     57|            translation_table[count] = TYPE_NOTIFGROUP;
  ------------------
  |  |  177|     57|#define TYPE_NOTIFGROUP	    23
  ------------------
 1132|     57|            break;
 1133|     57|        case OBJGROUP:
  ------------------
  |  |  212|     57|#define OBJGROUP    44
  ------------------
  |  Branch (1133:9): [True: 57, False: 14.5k]
  ------------------
 1134|     57|            translation_table[count] = TYPE_OBJGROUP;
  ------------------
  |  |  176|     57|#define TYPE_OBJGROUP	    22
  ------------------
 1135|     57|            break;
 1136|     57|        case MODULEIDENTITY:
  ------------------
  |  |  220|     57|#define MODULEIDENTITY 52
  ------------------
  |  Branch (1136:9): [True: 57, False: 14.5k]
  ------------------
 1137|     57|            translation_table[count] = TYPE_MODID;
  ------------------
  |  |  178|     57|#define TYPE_MODID	    24
  ------------------
 1138|     57|            break;
 1139|     57|        case OBJIDENTITY:
  ------------------
  |  |  275|     57|#define OBJIDENTITY	106
  ------------------
  |  Branch (1139:9): [True: 57, False: 14.5k]
  ------------------
 1140|     57|            translation_table[count] = TYPE_OBJIDENTITY;
  ------------------
  |  |  181|     57|#define TYPE_OBJIDENTITY    27
  ------------------
 1141|     57|            break;
 1142|     57|        case AGENTCAP:
  ------------------
  |  |  243|     57|#define AGENTCAP    73
  ------------------
  |  Branch (1142:9): [True: 57, False: 14.5k]
  ------------------
 1143|     57|            translation_table[count] = TYPE_AGENTCAP;
  ------------------
  |  |  179|     57|#define TYPE_AGENTCAP       25
  ------------------
 1144|     57|            break;
 1145|     57|        case COMPLIANCE:
  ------------------
  |  |  215|     57|#define COMPLIANCE  47
  ------------------
  |  Branch (1145:9): [True: 57, False: 14.5k]
  ------------------
 1146|     57|            translation_table[count] = TYPE_MODCOMP;
  ------------------
  |  |  180|     57|#define TYPE_MODCOMP        26
  ------------------
 1147|     57|            break;
 1148|  13.2k|        default:
  ------------------
  |  Branch (1148:9): [True: 13.2k, False: 1.36k]
  ------------------
 1149|  13.2k|            translation_table[count] = TYPE_OTHER;
  ------------------
  |  |  154|  13.2k|#define TYPE_OTHER          0
  ------------------
 1150|  13.2k|            break;
 1151|  14.5k|        }
 1152|  14.5k|    }
 1153|     57|}
parse.c:init_tree_roots:
 1157|     57|{
 1158|     57|    struct tree    *tp, *lasttp;
 1159|     57|    int             base_modid;
 1160|     57|    int             hash;
 1161|       |
 1162|     57|    base_modid = which_module("SNMPv2-SMI");
 1163|     57|    if (base_modid == -1)
  ------------------
  |  Branch (1163:9): [True: 57, False: 0]
  ------------------
 1164|     57|        base_modid = which_module("RFC1155-SMI");
 1165|     57|    if (base_modid == -1)
  ------------------
  |  Branch (1165:9): [True: 57, False: 0]
  ------------------
 1166|     57|        base_modid = which_module("RFC1213-MIB");
 1167|       |
 1168|       |    /*
 1169|       |     * build root node 
 1170|       |     */
 1171|     57|    tp = calloc(1, sizeof(struct tree));
 1172|     57|    if (tp == NULL)
  ------------------
  |  Branch (1172:9): [True: 0, False: 57]
  ------------------
 1173|      0|        return;
 1174|     57|    tp->label = strdup("joint-iso-ccitt");
 1175|     57|    tp->modid = base_modid;
 1176|     57|    tp->number_modules = 1;
 1177|     57|    tp->module_list = &(tp->modid);
 1178|     57|    tp->subid = 2;
 1179|     57|    tp->tc_index = -1;
 1180|     57|    set_function(tp);           /* from mib.c */
 1181|     57|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|     57|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|     57|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1182|     57|    tp->next = tbuckets[hash];
 1183|     57|    tbuckets[hash] = tp;
 1184|     57|    lasttp = tp;
 1185|     57|    root_imports[0].label = strdup(tp->label);
 1186|     57|    root_imports[0].modid = base_modid;
 1187|       |
 1188|       |    /*
 1189|       |     * build root node 
 1190|       |     */
 1191|     57|    tp = calloc(1, sizeof(struct tree));
 1192|     57|    if (tp == NULL)
  ------------------
  |  Branch (1192:9): [True: 0, False: 57]
  ------------------
 1193|      0|        return;
 1194|     57|    tp->next_peer = lasttp;
 1195|     57|    tp->label = strdup("ccitt");
 1196|     57|    tp->modid = base_modid;
 1197|     57|    tp->number_modules = 1;
 1198|     57|    tp->module_list = &(tp->modid);
 1199|     57|    tp->subid = 0;
 1200|     57|    tp->tc_index = -1;
 1201|     57|    set_function(tp);           /* from mib.c */
 1202|     57|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|     57|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|     57|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1203|     57|    tp->next = tbuckets[hash];
 1204|     57|    tbuckets[hash] = tp;
 1205|     57|    lasttp = tp;
 1206|     57|    root_imports[1].label = strdup(tp->label);
 1207|     57|    root_imports[1].modid = base_modid;
 1208|       |
 1209|       |    /*
 1210|       |     * build root node 
 1211|       |     */
 1212|     57|    tp = calloc(1, sizeof(struct tree));
 1213|     57|    if (tp == NULL)
  ------------------
  |  Branch (1213:9): [True: 0, False: 57]
  ------------------
 1214|      0|        return;
 1215|     57|    tp->next_peer = lasttp;
 1216|     57|    tp->label = strdup("iso");
 1217|     57|    tp->modid = base_modid;
 1218|     57|    tp->number_modules = 1;
 1219|     57|    tp->module_list = &(tp->modid);
 1220|     57|    tp->subid = 1;
 1221|     57|    tp->tc_index = -1;
 1222|     57|    set_function(tp);           /* from mib.c */
 1223|     57|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|     57|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|     57|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1224|     57|    tp->next = tbuckets[hash];
 1225|     57|    tbuckets[hash] = tp;
 1226|     57|    lasttp = tp;
 1227|     57|    root_imports[2].label = strdup(tp->label);
 1228|     57|    root_imports[2].modid = base_modid;
 1229|       |
 1230|     57|    tree_head = tp;
 1231|     57|}
parse.c:unlink_tbucket:
  830|    171|{
  831|    171|    int             hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|    171|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|    171|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
  832|    171|    struct tree    *otp = NULL, *ntp = tbuckets[hash];
  833|       |
  834|    171|    while (ntp && ntp != tp) {
  ------------------
  |  Branch (834:12): [True: 171, False: 0]
  |  Branch (834:19): [True: 0, False: 171]
  ------------------
  835|      0|        otp = ntp;
  836|      0|        ntp = ntp->next;
  837|      0|    }
  838|    171|    if (!ntp)
  ------------------
  |  Branch (838:9): [True: 0, False: 171]
  ------------------
  839|      0|        snmp_log(LOG_EMERG, "Can't find %s in tbuckets\n", tp->label);
  840|    171|    else if (otp)
  ------------------
  |  Branch (840:14): [True: 0, False: 171]
  ------------------
  841|      0|        otp->next = ntp->next;
  842|    171|    else
  843|    171|        tbuckets[hash] = tp->next;
  844|    171|}
parse.c:read_module_internal:
 4019|  2.73k|{
 4020|  2.73k|    struct module  *mp;
 4021|       |
 4022|  2.73k|    netsnmp_init_mib_internals();
 4023|       |
 4024|  2.73k|    for (mp = module_head; mp; mp = mp->next)
  ------------------
  |  Branch (4024:28): [True: 0, False: 2.73k]
  ------------------
 4025|      0|        if (!label_compare(mp->name, name))
  ------------------
  |  | 1236|      0|#define	label_compare	strcmp
  ------------------
  |  Branch (4025:13): [True: 0, False: 0]
  ------------------
 4026|      0|            return read_from_file(mp, name);
 4027|       |
 4028|  2.73k|    return MODULE_NOT_FOUND;
  ------------------
  |  |  513|  2.73k|#define MODULE_NOT_FOUND	0
  ------------------
 4029|  2.73k|}
parse.c:print_error:
  780|  2.73k|{
  781|  2.73k|    erroneousMibs++;
  782|  2.73k|    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|  2.73k|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (782:9): [True: 0, False: 2.73k]
  ------------------
  783|  2.73k|                                NETSNMP_DS_LIB_MIB_ERRORS))
  ------------------
  |  |   59|  2.73k|#define NETSNMP_DS_LIB_MIB_ERRORS          0
  ------------------
  784|      0|	return;
  785|  2.73k|    DEBUGMSGTL(("parse-mibs", "\n"));
  ------------------
  |  |   66|  2.73k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.73k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.73k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%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.73k]
  |  |  ------------------
  ------------------
  786|  2.73k|    if (type == ENDOFFILE)
  ------------------
  |  |  163|  2.73k|#define ENDOFFILE   0
  ------------------
  |  Branch (786:9): [True: 0, False: 2.73k]
  ------------------
  787|      0|        snmp_log(LOG_ERR, "%s (EOF): At line %d in %s\n", str, mibLine,
  788|      0|                 File);
  789|  2.73k|    else if (token && *token)
  ------------------
  |  Branch (789:14): [True: 2.73k, False: 0]
  |  Branch (789:23): [True: 2.73k, False: 0]
  ------------------
  790|  2.73k|        snmp_log(LOG_ERR, "%s (%s): At line %d in %s\n", str, token,
  791|  2.73k|                 mibLine, File);
  792|      0|    else
  793|      0|        snmp_log(LOG_ERR, "%s: At line %d in %s\n", str, mibLine, File);
  794|  2.73k|}
parse.c:free_indexes:
 5366|    171|{
 5367|    171|    if (spp && *spp) {
  ------------------
  |  Branch (5367:9): [True: 171, False: 0]
  |  Branch (5367:16): [True: 0, False: 171]
  ------------------
 5368|      0|        struct index_list *pp, *npp;
 5369|       |
 5370|      0|        pp = *spp;
 5371|      0|        *spp = NULL;
 5372|       |
 5373|      0|        while (pp) {
  ------------------
  |  Branch (5373:16): [True: 0, False: 0]
  ------------------
 5374|      0|            npp = pp->next;
 5375|      0|            if (pp->ilabel)
  ------------------
  |  Branch (5375:17): [True: 0, False: 0]
  ------------------
 5376|      0|                free(pp->ilabel);
 5377|      0|            free(pp);
 5378|      0|            pp = npp;
 5379|      0|        }
 5380|      0|    }
 5381|    171|}
parse.c:free_varbinds:
 5385|    171|{
 5386|    171|    if (spp && *spp) {
  ------------------
  |  Branch (5386:9): [True: 171, False: 0]
  |  Branch (5386:16): [True: 0, False: 171]
  ------------------
 5387|      0|        struct varbind_list *pp, *npp;
 5388|       |
 5389|      0|        pp = *spp;
 5390|      0|        *spp = NULL;
 5391|       |
 5392|      0|        while (pp) {
  ------------------
  |  Branch (5392:16): [True: 0, False: 0]
  ------------------
 5393|      0|            npp = pp->next;
 5394|      0|            if (pp->vblabel)
  ------------------
  |  Branch (5394:17): [True: 0, False: 0]
  ------------------
 5395|      0|                free(pp->vblabel);
 5396|      0|            free(pp);
 5397|      0|            pp = npp;
 5398|      0|        }
 5399|      0|    }
 5400|    171|}
parse.c:read_module_replacements:
 3899|  2.73k|{
 3900|  2.73k|    struct module_compatability *mcp;
 3901|       |
 3902|  62.9k|    for (mcp = module_map_head; mcp; mcp = mcp->next) {
  ------------------
  |  Branch (3902:33): [True: 60.1k, False: 2.73k]
  ------------------
 3903|  60.1k|        if (!label_compare(mcp->old_module, name)) {
  ------------------
  |  | 1236|  60.1k|#define	label_compare	strcmp
  ------------------
  |  Branch (3903:13): [True: 0, False: 60.1k]
  ------------------
 3904|      0|            if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3904:17): [True: 0, False: 0]
  ------------------
 3905|      0|				   NETSNMP_DS_LIB_MIB_WARNINGS)) {
  ------------------
  |  |  114|      0|#define NETSNMP_DS_LIB_MIB_WARNINGS         0
  ------------------
 3906|      0|                snmp_log(LOG_WARNING,
 3907|      0|                         "Loading replacement module %s for %s (%s)\n",
 3908|      0|                         mcp->new_module, name, File);
 3909|      0|	    }
 3910|      0|            (void) netsnmp_read_module(mcp->new_module);
 3911|      0|            return 1;
 3912|      0|        }
 3913|  60.1k|    }
 3914|  2.73k|    return 0;
 3915|  2.73k|}
parse.c:print_module_not_found:
  798|  2.73k|{
  799|  2.73k|    if (first_err_module) {
  ------------------
  |  Branch (799:9): [True: 57, False: 2.67k]
  ------------------
  800|     57|        snmp_log(LOG_ERR, "MIB search path: %s\n",
  801|     57|                           netsnmp_get_mib_directory());
  802|     57|        first_err_module = 0;
  803|     57|    }
  804|  2.73k|    if (!last_err_module || strcmp(cp, last_err_module))
  ------------------
  |  Branch (804:9): [True: 57, False: 2.67k]
  |  Branch (804:29): [True: 2.67k, False: 0]
  ------------------
  805|  2.73k|        print_error("Cannot find module", cp, CONTINUE);
  ------------------
  |  |  162|  2.73k|#define CONTINUE    -1
  ------------------
  806|  2.73k|    if (last_err_module)
  ------------------
  |  Branch (806:9): [True: 2.67k, False: 57]
  ------------------
  807|  2.67k|        free(last_err_module);
  808|  2.73k|    last_err_module = strdup(cp);
  809|  2.73k|}
parse.c:unlink_tree:
  848|    171|{
  849|    171|    struct tree    *otp = NULL, *ntp = tp->parent;
  850|       |
  851|    171|    if (!ntp) {                 /* this tree has no parent */
  ------------------
  |  Branch (851:9): [True: 171, False: 0]
  ------------------
  852|    171|        DEBUGMSGTL(("unlink_tree", "Tree node %s has no parent\n",
  ------------------
  |  |   66|    171|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    171|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 171]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 171]
  |  |  ------------------
  ------------------
  853|    171|                    tp->label));
  854|    171|    } 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|    171|    if (tree_head == tp)
  ------------------
  |  Branch (870:9): [True: 171, False: 0]
  ------------------
  871|    171|        tree_head = tp->next_peer;
  872|    171|}
parse.c:free_tree:
  903|    171|{
  904|    171|    if (!Tree)
  ------------------
  |  Branch (904:9): [True: 0, False: 171]
  ------------------
  905|      0|        return;
  906|       |
  907|    171|    unlink_tbucket(Tree);
  908|    171|    free_partial_tree(Tree, FALSE);
  ------------------
  |  |  125|    171|#define FALSE 0
  ------------------
  909|    171|    if (Tree->module_list != &Tree->modid)
  ------------------
  |  Branch (909:9): [True: 0, False: 171]
  ------------------
  910|      0|        free(Tree->module_list);
  911|    171|    free(Tree);
  912|    171|}
parse.c:free_partial_tree:
  876|    171|{
  877|    171|    if (!tp)
  ------------------
  |  Branch (877:9): [True: 0, False: 171]
  ------------------
  878|      0|        return;
  879|       |
  880|       |    /*
  881|       |     * remove the data from this tree node 
  882|       |     */
  883|    171|    free_enums(&tp->enums);
  884|    171|    free_ranges(&tp->ranges);
  885|    171|    free_indexes(&tp->indexes);
  886|    171|    free_varbinds(&tp->varbinds);
  887|    171|    if (!keep_label)
  ------------------
  |  Branch (887:9): [True: 171, False: 0]
  ------------------
  888|    171|        SNMP_FREE(tp->label);
  ------------------
  |  |   62|    171|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 171, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 171]
  |  |  ------------------
  ------------------
  889|    171|    SNMP_FREE(tp->hint);
  ------------------
  |  |   62|    171|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 171]
  |  |  |  Branch (62:66): [Folded, False: 171]
  |  |  ------------------
  ------------------
  890|    171|    SNMP_FREE(tp->units);
  ------------------
  |  |   62|    171|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 171]
  |  |  |  Branch (62:66): [Folded, False: 171]
  |  |  ------------------
  ------------------
  891|    171|    SNMP_FREE(tp->description);
  ------------------
  |  |   62|    171|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 171]
  |  |  |  Branch (62:66): [Folded, False: 171]
  |  |  ------------------
  ------------------
  892|    171|    SNMP_FREE(tp->reference);
  ------------------
  |  |   62|    171|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 171]
  |  |  |  Branch (62:66): [Folded, False: 171]
  |  |  ------------------
  ------------------
  893|    171|    SNMP_FREE(tp->augments);
  ------------------
  |  |   62|    171|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 171]
  |  |  |  Branch (62:66): [Folded, False: 171]
  |  |  ------------------
  ------------------
  894|       |    SNMP_FREE(tp->defaultValue);
  ------------------
  |  |   62|    171|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 171]
  |  |  |  Branch (62:66): [Folded, False: 171]
  |  |  ------------------
  ------------------
  895|    171|}
parse.c:scan_directory:
 5054|     57|{
 5055|     57|    DIR            *dir, *dir2;
 5056|     57|    struct dirent  *file;
 5057|     57|    char          **filenames = NULL;
 5058|     57|    int             fname_len, i, filename_count = 0, array_size = 0;
 5059|     57|    char           *tmpstr;
 5060|       |
 5061|     57|    *result = NULL;
 5062|       |
 5063|     57|    dir = opendir(dirname);
 5064|     57|    if (!dir)
  ------------------
  |  Branch (5064:9): [True: 57, False: 0]
  ------------------
 5065|     57|        return -1;
 5066|       |
 5067|      0|    while ((file = readdir(dir))) {
  ------------------
  |  Branch (5067:12): [True: 0, False: 0]
  ------------------
 5068|       |        /*
 5069|       |         * Only parse file names that don't begin with a '.'
 5070|       |         * Also skip files ending in '~', or starting/ending
 5071|       |         * with '#' which are typically editor backup files.
 5072|       |         */
 5073|      0|        fname_len = strlen(file->d_name);
 5074|      0|        if (fname_len > 0 && file->d_name[0] != '.'
  ------------------
  |  Branch (5074:13): [True: 0, False: 0]
  |  Branch (5074:30): [True: 0, False: 0]
  ------------------
 5075|      0|            && file->d_name[0] != '#'
  ------------------
  |  Branch (5075:16): [True: 0, False: 0]
  ------------------
 5076|      0|            && file->d_name[fname_len-1] != '#'
  ------------------
  |  Branch (5076:16): [True: 0, False: 0]
  ------------------
 5077|      0|            && file->d_name[fname_len-1] != '~') {
  ------------------
  |  Branch (5077:16): [True: 0, False: 0]
  ------------------
 5078|      0|            if (asprintf(&tmpstr, "%s/%s", dirname, file->d_name) < 0)
  ------------------
  |  Branch (5078:17): [True: 0, False: 0]
  ------------------
 5079|      0|                continue;
 5080|      0|            dir2 = opendir(tmpstr);
 5081|      0|            if (dir2) {
  ------------------
  |  Branch (5081:17): [True: 0, False: 0]
  ------------------
 5082|       |                /* file is a directory, don't read it */
 5083|      0|                closedir(dir2);
 5084|      0|            } else {
 5085|      0|                if (filename_count >= array_size) {
  ------------------
  |  Branch (5085:21): [True: 0, False: 0]
  ------------------
 5086|      0|                    char **new_filenames;
 5087|       |
 5088|      0|                    array_size = (array_size + 16) * 2;
 5089|      0|                    new_filenames = realloc(filenames,
 5090|      0|                                        array_size * sizeof(filenames[0]));
 5091|      0|                    if (!new_filenames) {
  ------------------
  |  Branch (5091:25): [True: 0, False: 0]
  ------------------
 5092|      0|                        free(tmpstr);
 5093|      0|                        for (i = 0; i < filename_count; i++)
  ------------------
  |  Branch (5093:37): [True: 0, False: 0]
  ------------------
 5094|      0|                            free(filenames[i]);
 5095|      0|                        free(filenames);
 5096|      0|                        closedir(dir);
 5097|      0|                        return -1;
 5098|      0|                    }
 5099|      0|                    filenames = new_filenames;
 5100|      0|                }
 5101|      0|                filenames[filename_count++] = tmpstr;
 5102|      0|                tmpstr = NULL;
 5103|      0|            }
 5104|      0|            free(tmpstr);
 5105|      0|        }
 5106|      0|    }
 5107|      0|    closedir(dir);
 5108|       |
 5109|      0|    if (filenames)
  ------------------
  |  Branch (5109:9): [True: 0, False: 0]
  ------------------
 5110|      0|        qsort(filenames, filename_count, sizeof(filenames[0]), elemcmp);
 5111|      0|    *result = filenames;
 5112|       |
 5113|      0|    return filename_count;
 5114|      0|}
parse.c:free_ranges:
 5404|    171|{
 5405|    171|    if (spp && *spp) {
  ------------------
  |  Branch (5405:9): [True: 171, False: 0]
  |  Branch (5405:16): [True: 0, False: 171]
  ------------------
 5406|      0|        struct range_list *pp, *npp;
 5407|       |
 5408|      0|        pp = *spp;
 5409|      0|        *spp = NULL;
 5410|       |
 5411|      0|        while (pp) {
  ------------------
  |  Branch (5411:16): [True: 0, False: 0]
  ------------------
 5412|      0|            npp = pp->next;
 5413|      0|            free(pp);
 5414|      0|            pp = npp;
 5415|      0|        }
 5416|      0|    }
 5417|    171|}
parse.c:free_enums:
 5421|    171|{
 5422|    171|    if (spp && *spp) {
  ------------------
  |  Branch (5422:9): [True: 171, False: 0]
  |  Branch (5422:16): [True: 0, False: 171]
  ------------------
 5423|      0|        struct enum_list *pp, *npp;
 5424|       |
 5425|      0|        pp = *spp;
 5426|      0|        *spp = NULL;
 5427|       |
 5428|      0|        while (pp) {
  ------------------
  |  Branch (5428:16): [True: 0, False: 0]
  ------------------
 5429|      0|            npp = pp->next;
 5430|      0|            if (pp->label)
  ------------------
  |  Branch (5430:17): [True: 0, False: 0]
  ------------------
 5431|      0|                free(pp->label);
 5432|      0|            free(pp);
 5433|      0|            pp = npp;
 5434|      0|        }
 5435|      0|    }
 5436|    171|}

register_prenetsnmp_mib_handler:
  256|  1.99k|{
  257|  1.99k|    return internal_register_config_handler(type, token, parser, NULL, releaser,
  258|  1.99k|					    help, PREMIB_CONFIG);
  ------------------
  |  |   15|  1.99k|#define PREMIB_CONFIG 1
  ------------------
  259|  1.99k|}
register_config_handler:
  311|  3.59k|{
  312|  3.59k|    return internal_register_config_handler(type, token, parser, NULL, releaser,
  313|  3.59k|					    help, NORMAL_CONFIG);
  ------------------
  |  |   14|  3.59k|#define NORMAL_CONFIG 0
  ------------------
  314|  3.59k|}
register_const_config_handler:
  321|     57|{
  322|     57|    return internal_register_config_handler(type, token, NULL, parser, releaser,
  323|     57|					    help, NORMAL_CONFIG);
  ------------------
  |  |   14|     57|#define NORMAL_CONFIG 0
  ------------------
  324|     57|}
register_app_config_handler:
  330|    114|{
  331|       |    return register_config_handler(NULL, token, parser, releaser, help);
  332|    114|}
unregister_config_handler:
  356|  9.51k|{
  357|  9.51k|    struct config_files **ctmp = &config_files;
  358|  9.51k|    struct config_line  **ltmp;
  359|  9.51k|    const char           *type = type_param;
  360|       |
  361|  9.51k|    if (type == NULL || *type == '\0') {
  ------------------
  |  Branch (361:9): [True: 0, False: 9.51k]
  |  Branch (361:25): [True: 0, False: 9.51k]
  ------------------
  362|      0|        type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  363|      0|				     NETSNMP_DS_LIB_APPTYPE);
  ------------------
  |  |  157|      0|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
  364|      0|    }
  365|       |
  366|       |    /*
  367|       |     * Handle multiple types (recursively)
  368|       |     */
  369|  9.51k|    if (strchr(type, ':')) {
  ------------------
  |  Branch (369:9): [True: 0, False: 9.51k]
  ------------------
  370|      0|        char                buf[STRINGMAX];
  371|      0|        char               *cptr = buf;
  372|       |
  373|      0|        strlcpy(buf, type, STRINGMAX);
  ------------------
  |  |   12|      0|#define STRINGMAX 1024
  ------------------
  374|      0|        while (cptr) {
  ------------------
  |  Branch (374:16): [True: 0, False: 0]
  ------------------
  375|      0|            char* c = cptr;
  376|      0|            cptr = strchr(cptr, ':');
  377|      0|            if(cptr) {
  ------------------
  |  Branch (377:16): [True: 0, False: 0]
  ------------------
  378|      0|                *cptr = '\0';
  379|      0|                ++cptr;
  380|      0|            }
  381|      0|            unregister_config_handler(c, token);
  382|      0|        }
  383|      0|        return;
  384|      0|    }
  385|       |    
  386|       |    /*
  387|       |     * find type in current list 
  388|       |     */
  389|  9.51k|    while (*ctmp != NULL && strcmp((*ctmp)->fileHeader, type)) {
  ------------------
  |  Branch (389:12): [True: 5.75k, False: 3.76k]
  |  Branch (389:29): [True: 0, False: 5.75k]
  ------------------
  390|      0|        ctmp = &((*ctmp)->next);
  391|      0|    }
  392|       |
  393|  9.51k|    if (*ctmp == NULL) {
  ------------------
  |  Branch (393:9): [True: 3.76k, False: 5.75k]
  ------------------
  394|       |        /*
  395|       |         * Not found, return. 
  396|       |         */
  397|  3.76k|        return;
  398|  3.76k|    }
  399|       |
  400|  5.75k|    ltmp = &((*ctmp)->start);
  401|  5.75k|    if (*ltmp == NULL) {
  ------------------
  |  Branch (401:9): [True: 0, False: 5.75k]
  ------------------
  402|       |        /*
  403|       |         * Not found, return. 
  404|       |         */
  405|      0|        return;
  406|      0|    }
  407|  5.75k|    if (strcmp((*ltmp)->config_token, token) == 0) {
  ------------------
  |  Branch (407:9): [True: 5.75k, False: 0]
  ------------------
  408|       |        /*
  409|       |         * found it at the top of the list 
  410|       |         */
  411|  5.75k|        struct config_line *ltmp2 = (*ltmp)->next;
  412|  5.75k|        if ((*ltmp)->free_func)
  ------------------
  |  Branch (412:13): [True: 399, False: 5.35k]
  ------------------
  413|    399|            (*ltmp)->free_func();
  414|  5.75k|        SNMP_FREE((*ltmp)->config_token);
  ------------------
  |  |   62|  5.75k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 5.75k, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 5.75k]
  |  |  ------------------
  ------------------
  415|  5.75k|        SNMP_FREE((*ltmp)->help);
  ------------------
  |  |   62|  5.75k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 5.07k, False: 684]
  |  |  |  Branch (62:66): [Folded, False: 5.75k]
  |  |  ------------------
  ------------------
  416|  5.75k|        SNMP_FREE(*ltmp);
  ------------------
  |  |   62|  5.75k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 5.75k, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 5.75k]
  |  |  ------------------
  ------------------
  417|  5.75k|        (*ctmp)->start = ltmp2;
  418|  5.75k|        return;
  419|  5.75k|    }
  420|      0|    while ((*ltmp)->next != NULL
  ------------------
  |  Branch (420:12): [True: 0, False: 0]
  ------------------
  421|      0|           && strcmp((*ltmp)->next->config_token, token)) {
  ------------------
  |  Branch (421:15): [True: 0, False: 0]
  ------------------
  422|      0|        ltmp = &((*ltmp)->next);
  423|      0|    }
  424|      0|    if ((*ltmp)->next != NULL) {
  ------------------
  |  Branch (424:9): [True: 0, False: 0]
  ------------------
  425|      0|        struct config_line *ltmp2 = (*ltmp)->next->next;
  426|      0|        if ((*ltmp)->next->free_func)
  ------------------
  |  Branch (426:13): [True: 0, False: 0]
  ------------------
  427|      0|            (*ltmp)->next->free_func();
  428|      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]
  |  |  ------------------
  ------------------
  429|      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]
  |  |  ------------------
  ------------------
  430|       |        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]
  |  |  ------------------
  ------------------
  431|      0|        (*ltmp)->next = ltmp2;
  432|      0|    }
  433|      0|}
unregister_all_config_handlers:
  445|     57|{
  446|     57|    struct config_files *ctmp, *save;
  447|     57|    struct config_line *ltmp;
  448|       |
  449|       |    /*
  450|       |     * Keep using config_files until there are no more! 
  451|       |     */
  452|    171|    for (ctmp = config_files; ctmp;) {
  ------------------
  |  Branch (452:31): [True: 114, False: 57]
  ------------------
  453|  5.87k|        for (ltmp = ctmp->start; ltmp; ltmp = ctmp->start) {
  ------------------
  |  Branch (453:34): [True: 5.75k, False: 114]
  ------------------
  454|  5.75k|            unregister_config_handler(ctmp->fileHeader,
  455|  5.75k|                                      ltmp->config_token);
  456|  5.75k|        }
  457|    114|        SNMP_FREE(ctmp->fileHeader);
  ------------------
  |  |   62|    114|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 114, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 114]
  |  |  ------------------
  ------------------
  458|    114|        save = ctmp->next;
  459|       |        SNMP_FREE(ctmp);
  ------------------
  |  |   62|    114|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 114, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 114]
  |  |  ------------------
  ------------------
  460|    114|        ctmp = save;
  461|    114|        config_files = save;
  462|    114|    }
  463|     57|}
netsnmp_config_remember_free_list:
  691|     57|{
  692|     57|    struct read_config_memory *tmpmem;
  693|     57|    while (*mem) {
  ------------------
  |  Branch (693:12): [True: 0, False: 57]
  ------------------
  694|      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]
  |  |  ------------------
  ------------------
  695|      0|        tmpmem = (*mem)->next;
  696|       |        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]
  |  |  ------------------
  ------------------
  697|      0|        *mem = tmpmem;
  698|      0|    }
  699|     57|}
netsnmp_config_process_memory_list:
  704|    114|{
  705|       |
  706|    114|    struct read_config_memory *mem;
  707|       |
  708|    114|    if (!memp)
  ------------------
  |  Branch (708:9): [True: 0, False: 114]
  ------------------
  709|      0|        return;
  710|       |
  711|    114|    mem = *memp;
  712|       |
  713|    114|    while (mem) {
  ------------------
  |  Branch (713:12): [True: 0, False: 114]
  ------------------
  714|      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]
  |  |  ------------------
  ------------------
  715|      0|        snmp_config_when(mem->line, when);
  716|      0|        mem = mem->next;
  717|      0|    }
  718|       |
  719|    114|    if (clear)
  ------------------
  |  Branch (719:9): [True: 57, False: 57]
  ------------------
  720|     57|        netsnmp_config_remember_free_list(memp);
  721|    114|}
netsnmp_config_process_memories_when:
  742|    114|{
  743|    114|    netsnmp_config_process_memory_list(&memorylist, when, clear);
  744|    114|}
free_config:
 1029|     57|{
 1030|     57|    struct config_files *ctmp = config_files;
 1031|     57|    struct config_line *ltmp;
 1032|       |
 1033|    171|    for (; ctmp != NULL; ctmp = ctmp->next)
  ------------------
  |  Branch (1033:12): [True: 114, False: 57]
  ------------------
 1034|  5.87k|        for (ltmp = ctmp->start; ltmp != NULL; ltmp = ltmp->next)
  ------------------
  |  Branch (1034:34): [True: 5.75k, False: 114]
  ------------------
 1035|  5.75k|            if (ltmp->free_func)
  ------------------
  |  Branch (1035:17): [True: 399, False: 5.35k]
  ------------------
 1036|    399|                (*(ltmp->free_func)) ();
 1037|     57|}
read_configs:
 1082|     57|{
 1083|     57|    char *optional_config = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1084|     57|					       NETSNMP_DS_LIB_OPTIONALCONFIG);
  ------------------
  |  |  156|     57|#define NETSNMP_DS_LIB_OPTIONALCONFIG    5
  ------------------
 1085|       |
 1086|     57|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1087|     57|                        SNMP_CALLBACK_PRE_READ_CONFIG, NULL);
  ------------------
  |  |   30|     57|#define SNMP_CALLBACK_PRE_READ_CONFIG	        7
  ------------------
 1088|       |
 1089|     57|    DEBUGMSGTL(("read_config", "reading normal configuration tokens\n"));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 1090|       |
 1091|     57|    if ((NULL != optional_config) && (*optional_config == '-')) {
  ------------------
  |  Branch (1091:9): [True: 0, False: 57]
  |  Branch (1091:38): [True: 0, False: 0]
  ------------------
 1092|      0|        (void)read_configs_optional(++optional_config, NORMAL_CONFIG);
  ------------------
  |  |   14|      0|#define NORMAL_CONFIG 0
  ------------------
 1093|      0|        optional_config = NULL; /* clear, so we don't read them twice */
 1094|      0|    }
 1095|       |
 1096|     57|    (void)read_config_files(NORMAL_CONFIG);
  ------------------
  |  |   14|     57|#define NORMAL_CONFIG 0
  ------------------
 1097|       |
 1098|       |    /*
 1099|       |     * do this even when the normal above wasn't done 
 1100|       |     */
 1101|     57|    if (NULL != optional_config)
  ------------------
  |  Branch (1101:9): [True: 0, False: 57]
  ------------------
 1102|      0|        (void)read_configs_optional(optional_config, NORMAL_CONFIG);
  ------------------
  |  |   14|      0|#define NORMAL_CONFIG 0
  ------------------
 1103|       |
 1104|     57|    netsnmp_config_process_memories_when(NORMAL_CONFIG, 1);
  ------------------
  |  |   14|     57|#define NORMAL_CONFIG 0
  ------------------
 1105|       |
 1106|     57|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1107|     57|			   NETSNMP_DS_LIB_HAVE_READ_CONFIG, 1);
  ------------------
  |  |   87|     57|#define NETSNMP_DS_LIB_HAVE_READ_CONFIG    27   /* have the config tokens been processed */
  ------------------
 1108|     57|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1109|     57|                        SNMP_CALLBACK_POST_READ_CONFIG, NULL);
  ------------------
  |  |   24|     57|#define SNMP_CALLBACK_POST_READ_CONFIG	        0
  ------------------
 1110|     57|}
read_premib_configs:
 1114|     57|{
 1115|     57|    char *optional_config = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1116|     57|					       NETSNMP_DS_LIB_OPTIONALCONFIG);
  ------------------
  |  |  156|     57|#define NETSNMP_DS_LIB_OPTIONALCONFIG    5
  ------------------
 1117|       |
 1118|     57|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1119|     57|                        SNMP_CALLBACK_PRE_PREMIB_READ_CONFIG, NULL);
  ------------------
  |  |   31|     57|#define SNMP_CALLBACK_PRE_PREMIB_READ_CONFIG	8
  ------------------
 1120|       |
 1121|     57|    DEBUGMSGTL(("read_config", "reading premib configuration tokens\n"));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 1122|       |
 1123|     57|    if ((NULL != optional_config) && (*optional_config == '-')) {
  ------------------
  |  Branch (1123:9): [True: 0, False: 57]
  |  Branch (1123:38): [True: 0, False: 0]
  ------------------
 1124|      0|        (void)read_configs_optional(++optional_config, PREMIB_CONFIG);
  ------------------
  |  |   15|      0|#define PREMIB_CONFIG 1
  ------------------
 1125|      0|        optional_config = NULL; /* clear, so we don't read them twice */
 1126|      0|    }
 1127|       |
 1128|     57|    (void)read_config_files(PREMIB_CONFIG);
  ------------------
  |  |   15|     57|#define PREMIB_CONFIG 1
  ------------------
 1129|       |
 1130|     57|    if (NULL != optional_config)
  ------------------
  |  Branch (1130:9): [True: 0, False: 57]
  ------------------
 1131|      0|        (void)read_configs_optional(optional_config, PREMIB_CONFIG);
  ------------------
  |  |   15|      0|#define PREMIB_CONFIG 1
  ------------------
 1132|       |
 1133|     57|    netsnmp_config_process_memories_when(PREMIB_CONFIG, 0);
  ------------------
  |  |   15|     57|#define PREMIB_CONFIG 1
  ------------------
 1134|       |
 1135|     57|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1136|     57|			   NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG, 1);
  ------------------
  |  |   86|     57|#define NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG 26       /* have the pre-mib parsing config tokens been processed */
  ------------------
 1137|     57|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1138|     57|                        SNMP_CALLBACK_POST_PREMIB_READ_CONFIG, NULL);
  ------------------
  |  |   27|     57|#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG	3
  ------------------
 1139|     57|}
set_configuration_directory:
 1151|      1|{
 1152|      1|    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1153|      1|			  NETSNMP_DS_LIB_CONFIGURATION_DIR, dir);
  ------------------
  |  |  160|      1|#define NETSNMP_DS_LIB_CONFIGURATION_DIR 9
  ------------------
 1154|      1|}
get_configuration_directory:
 1170|      1|{
 1171|      1|    char            defaultPath[SPRINT_MAX_LEN];
 1172|      1|    const char     *homepath;
 1173|       |
 1174|      1|    if (NULL == netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1174:9): [True: 1, False: 0]
  ------------------
 1175|      1|				      NETSNMP_DS_LIB_CONFIGURATION_DIR)) {
  ------------------
  |  |  160|      1|#define NETSNMP_DS_LIB_CONFIGURATION_DIR 9
  ------------------
 1176|      1|        homepath = netsnmp_gethomedir();
 1177|      1|        snprintf(defaultPath, sizeof(defaultPath), "%s%c%s%c%s%s%s%s",
 1178|      1|                SNMPCONFPATH, ENV_SEPARATOR_CHAR,
  ------------------
  |  | 2059|      1|#define SNMPCONFPATH "/usr/local/net-snmp-master/etc/snmp"
  ------------------
                              SNMPCONFPATH, ENV_SEPARATOR_CHAR,
  ------------------
  |  |   70|      1|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 1179|      1|                SNMPSHAREPATH, ENV_SEPARATOR_CHAR, SNMPLIBPATH,
  ------------------
  |  | 2058|      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,
  ------------------
  |  | 2057|      1|#define SNMPLIBPATH "/usr/local/net-snmp-master/lib/snmp"
  ------------------
 1180|      1|                ((homepath == NULL) ? "" : ENV_SEPARATOR),
  ------------------
  |  |   67|      1|#define ENV_SEPARATOR ":"
  ------------------
  |  Branch (1180:18): [True: 0, False: 1]
  ------------------
 1181|      1|                ((homepath == NULL) ? "" : homepath),
  ------------------
  |  Branch (1181:18): [True: 0, False: 1]
  ------------------
 1182|      1|                ((homepath == NULL) ? "" : "/.snmp"));
  ------------------
  |  Branch (1182:18): [True: 0, False: 1]
  ------------------
 1183|      1|        defaultPath[ sizeof(defaultPath)-1 ] = 0;
 1184|      1|        set_configuration_directory(defaultPath);
 1185|      1|    }
 1186|      1|    return (netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1187|      1|				  NETSNMP_DS_LIB_CONFIGURATION_DIR));
  ------------------
  |  |  160|      1|#define NETSNMP_DS_LIB_CONFIGURATION_DIR 9
  ------------------
 1188|      1|}
get_persistent_directory:
 1218|      1|{
 1219|      1|    if (NULL == netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1219:9): [True: 0, False: 1]
  ------------------
 1220|      1|				      NETSNMP_DS_LIB_PERSISTENT_DIR)) {
  ------------------
  |  |  159|      1|#define NETSNMP_DS_LIB_PERSISTENT_DIR    8
  ------------------
 1221|      0|        const char *persdir = netsnmp_getenv("SNMP_PERSISTENT_DIR");
 1222|      0|        if (NULL == persdir)
  ------------------
  |  Branch (1222:13): [True: 0, False: 0]
  ------------------
 1223|      0|            persdir = NETSNMP_PERSISTENT_DIRECTORY;
  ------------------
  |  | 2029|      0|#define NETSNMP_PERSISTENT_DIRECTORY "/var/net-snmp"
  ------------------
 1224|      0|        set_persistent_directory(persdir);
 1225|      0|    }
 1226|      1|    return (netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1227|      1|				  NETSNMP_DS_LIB_PERSISTENT_DIR));
  ------------------
  |  |  159|      1|#define NETSNMP_DS_LIB_PERSISTENT_DIR    8
  ------------------
 1228|      1|}
read_config_files_of_type:
 1412|    228|{
 1413|    228|    const char     *confpath, *persfile, *envconfpath;
 1414|    228|    char           *perspath;
 1415|    228|    int             ret = SNMPERR_GENERR;
  ------------------
  |  |  185|    228|#define SNMPERR_GENERR			(-1)
  ------------------
 1416|       |
 1417|    228|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    228|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1417:9): [True: 228, False: 0]
  ------------------
 1418|    228|                               NETSNMP_DS_LIB_DONT_PERSIST_STATE)
  ------------------
  |  |   92|    228|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
 1419|      0|        || netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1419:12): [True: 0, False: 0]
  ------------------
 1420|      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 */
  |  |  ------------------
  ------------------
 1421|    228|        || (NULL == ctmp)) return ret;
  ------------------
  |  Branch (1421:12): [True: 0, False: 0]
  ------------------
 1422|       |
 1423|       |    /*
 1424|       |     * these shouldn't change
 1425|       |     */
 1426|      0|    confpath = get_configuration_directory();
 1427|      0|    persfile = netsnmp_getenv("SNMP_PERSISTENT_FILE");
 1428|      0|    envconfpath = netsnmp_getenv("SNMPCONFPATH");
 1429|       |
 1430|       |
 1431|       |        /*
 1432|       |         * read the config files. strdup() the result of
 1433|       |         * get_persistent_directory() to avoid that parsing the "persistentDir"
 1434|       |         * keyword transforms the perspath pointer into a dangling pointer.
 1435|       |         */
 1436|      0|        perspath = strdup(get_persistent_directory());
 1437|      0|        if (perspath == NULL) {
  ------------------
  |  Branch (1437:13): [True: 0, False: 0]
  ------------------
 1438|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1439|      0|        }
 1440|      0|        if (envconfpath == NULL) {
  ------------------
  |  Branch (1440:13): [True: 0, False: 0]
  ------------------
 1441|       |            /*
 1442|       |             * read just the config files (no persistent stuff), since
 1443|       |             * persistent path can change via conf file. Then get the
 1444|       |             * current persistent directory, and read files there.
 1445|       |             */
 1446|      0|            if ( read_config_files_in_path(confpath, ctmp, when, perspath,
  ------------------
  |  Branch (1446:18): [True: 0, False: 0]
  ------------------
 1447|      0|                                      persfile) == SNMPERR_SUCCESS )
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1448|      0|                ret = SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1449|      0|            free(perspath);
 1450|      0|            perspath = strdup(get_persistent_directory());
 1451|      0|            if (perspath == NULL) {
  ------------------
  |  Branch (1451:17): [True: 0, False: 0]
  ------------------
 1452|      0|                return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1453|      0|            }
 1454|      0|            if ( read_config_files_in_path(perspath, ctmp, when, perspath,
  ------------------
  |  Branch (1454:18): [True: 0, False: 0]
  ------------------
 1455|      0|                                      persfile) == SNMPERR_SUCCESS )
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1456|      0|                ret = SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1457|      0|        }
 1458|      0|        else {
 1459|       |            /*
 1460|       |             * only read path specified by user
 1461|       |             */
 1462|      0|            if ( read_config_files_in_path(envconfpath, ctmp, when, perspath,
  ------------------
  |  Branch (1462:18): [True: 0, False: 0]
  ------------------
 1463|      0|                                      persfile) == SNMPERR_SUCCESS )
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1464|      0|                ret = SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1465|      0|        }
 1466|      0|        free(perspath);
 1467|      0|        return ret;
 1468|      0|}
read_config_files:
 1476|    114|read_config_files(int when) {
 1477|       |
 1478|    114|    struct config_files *ctmp = config_files;
 1479|    114|    int                  ret  = SNMPERR_GENERR;
  ------------------
  |  |  185|    114|#define SNMPERR_GENERR			(-1)
  ------------------
 1480|       |
 1481|    114|    config_errors = 0;
 1482|       |
 1483|    114|    if (when == PREMIB_CONFIG)
  ------------------
  |  |   15|    114|#define PREMIB_CONFIG 1
  ------------------
  |  Branch (1483:9): [True: 57, False: 57]
  ------------------
 1484|     57|        free_config();
 1485|       |
 1486|       |    /*
 1487|       |     * read all config file types 
 1488|       |     */
 1489|    342|    for (; ctmp != NULL; ctmp = ctmp->next) {
  ------------------
  |  Branch (1489:12): [True: 228, False: 114]
  ------------------
 1490|    228|        if ( read_config_files_of_type(when, ctmp) == SNMPERR_SUCCESS )
  ------------------
  |  |  184|    228|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (1490:14): [True: 0, False: 228]
  ------------------
 1491|      0|            ret = SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1492|    228|    }
 1493|       |
 1494|    114|    if (config_errors) {
  ------------------
  |  Branch (1494:9): [True: 0, False: 114]
  ------------------
 1495|       |        snmp_log(LOG_ERR, "net-snmp: %d error(s) in config file(s)\n",
 1496|      0|                 config_errors);
 1497|      0|    }
 1498|    114|    return ret;
 1499|    114|}
read_config_store:
 1548|    114|{
 1549|    114|#ifdef NETSNMP_PERSISTENT_DIRECTORY
 1550|    114|    char            file[512], *filep;
 1551|    114|    FILE           *fout;
 1552|    114|#ifdef NETSNMP_PERSISTENT_MASK
 1553|    114|    mode_t          oldmask;
 1554|    114|#endif
 1555|       |
 1556|    114|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    114|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1556:9): [True: 114, False: 0]
  ------------------
 1557|    114|                               NETSNMP_DS_LIB_DONT_PERSIST_STATE)
  ------------------
  |  |   92|    114|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
 1558|      0|     || netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1558:9): [True: 0, False: 0]
  ------------------
 1559|    114|                               NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD)) return;
  ------------------
  |  |   95|      0|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD  35 /* don't load persistent file */
  ------------------
 1560|       |
 1561|       |    /*
 1562|       |     * store configuration directives in the following order of preference:
 1563|       |     * 1. ENV variable SNMP_PERSISTENT_FILE
 1564|       |     * 2. configured <NETSNMP_PERSISTENT_DIRECTORY>/<type>.conf
 1565|       |     */
 1566|      0|    if ((filep = netsnmp_getenv("SNMP_PERSISTENT_FILE")) == NULL) {
  ------------------
  |  Branch (1566:9): [True: 0, False: 0]
  ------------------
 1567|      0|        snprintf(file, sizeof(file),
 1568|      0|                 "%s/%s.conf", get_persistent_directory(), type);
 1569|      0|        filep = file;
 1570|      0|    }
 1571|      0|#ifdef NETSNMP_PERSISTENT_MASK
 1572|      0|    oldmask = umask(NETSNMP_PERSISTENT_MASK);
  ------------------
  |  | 1764|      0|#define NETSNMP_PERSISTENT_MASK 077
  ------------------
 1573|      0|#endif
 1574|      0|    if (mkdirhier(filep, NETSNMP_AGENT_DIRECTORY_MODE, 1)) {
  ------------------
  |  | 2034|      0|#define NETSNMP_AGENT_DIRECTORY_MODE 0700
  ------------------
  |  Branch (1574:9): [True: 0, False: 0]
  ------------------
 1575|      0|        snmp_log(LOG_ERR,
 1576|      0|                 "Failed to create the persistent directory for %s\n",
 1577|      0|                 file);
 1578|      0|    }
 1579|      0|    if ((fout = fopen(filep, "a")) != NULL) {
  ------------------
  |  Branch (1579:9): [True: 0, False: 0]
  ------------------
 1580|      0|        fprintf(fout, "%s", line);
 1581|      0|        if (line[strlen(line)] != '\n')
  ------------------
  |  Branch (1581:13): [True: 0, False: 0]
  ------------------
 1582|      0|            fprintf(fout, "\n");
 1583|      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]
  |  |  ------------------
  ------------------
 1584|      0|        fflush(fout);
 1585|      0|#if defined(HAVE_FSYNC)
 1586|      0|        fsync(fileno(fout));
 1587|       |#elif defined(HAVE__GET_OSFHANDLE)
 1588|       |        {
 1589|       |            int fd;
 1590|       |            HANDLE h;
 1591|       |
 1592|       |            fd = fileno(fout);
 1593|       |            netsnmp_assert(fd != -1);
 1594|       |            /*
 1595|       |             * Use size_t instead of uintptr_t because not all supported
 1596|       |             * Windows compilers support uintptr_t.
 1597|       |             */
 1598|       |            h = (HANDLE)(size_t)_get_osfhandle(fd);
 1599|       |            netsnmp_assert(h != INVALID_HANDLE_VALUE);
 1600|       |            FlushFileBuffers(h);
 1601|       |        }
 1602|       |#endif
 1603|      0|        fclose(fout);
 1604|      0|    } else {
 1605|      0|        if (strcmp(NETSNMP_APPLICATION_CONFIG_TYPE, type) != 0) {
  ------------------
  |  |   22|      0|#define NETSNMP_APPLICATION_CONFIG_TYPE "snmpapp"
  ------------------
  |  Branch (1605:13): [True: 0, False: 0]
  ------------------
 1606|       |            /*
 1607|       |             * Ignore this error in client utilities, they can run with random
 1608|       |             * UID/GID and typically cannot write to /var. Error message just
 1609|       |             * confuses people.
 1610|       |             */
 1611|      0|            snmp_log(LOG_ERR, "read_config_store open failure on %s\n", filep);
 1612|      0|        }
 1613|      0|    }
 1614|      0|#ifdef NETSNMP_PERSISTENT_MASK
 1615|      0|    umask(oldmask);
 1616|      0|#endif
 1617|       |
 1618|      0|#endif
 1619|      0|}                               /* end read_config_store() */
snmp_save_persistent:
 1652|     57|{
 1653|     57|    char            file[512], fileold[SPRINT_MAX_LEN];
 1654|     57|    struct stat     statbuf;
 1655|     57|    int             j;
 1656|       |
 1657|     57|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1657:9): [True: 57, False: 0]
  ------------------
 1658|     57|                               NETSNMP_DS_LIB_DONT_PERSIST_STATE)
  ------------------
  |  |   92|     57|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
 1659|      0|     || netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1659:9): [True: 0, False: 0]
  ------------------
 1660|     57|                               NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE)) return;
  ------------------
  |  |   96|      0|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE  36 /* don't save persistent file */
  ------------------
 1661|       |
 1662|      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]
  |  |  ------------------
  ------------------
 1663|      0|    snprintf(file, sizeof(file),
 1664|      0|             "%s/%s.conf", get_persistent_directory(), type);
 1665|      0|    if (stat(file, &statbuf) == 0) {
  ------------------
  |  Branch (1665:9): [True: 0, False: 0]
  ------------------
 1666|      0|        for (j = 0; j <= NETSNMP_MAX_PERSISTENT_BACKUPS; j++) {
  ------------------
  |  | 2041|      0|#define NETSNMP_MAX_PERSISTENT_BACKUPS 10
  ------------------
  |  Branch (1666:21): [True: 0, False: 0]
  ------------------
 1667|      0|            snprintf(fileold, sizeof(fileold),
 1668|      0|                     "%s/%s.%d.conf", get_persistent_directory(), type, j);
 1669|      0|            if (stat(fileold, &statbuf) != 0) {
  ------------------
  |  Branch (1669:17): [True: 0, False: 0]
  ------------------
 1670|      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]
  |  |  ------------------
  ------------------
 1671|      0|                            " saving old config file: %s -> %s.\n", file,
 1672|      0|                            fileold));
 1673|      0|                if (rename(file, fileold)) {
  ------------------
  |  Branch (1673:21): [True: 0, False: 0]
  ------------------
 1674|      0|                    snmp_log(LOG_ERR, "Cannot rename %s to %s\n", file, fileold);
 1675|       |                     /* moving it failed, try nuking it, as leaving
 1676|       |                      * it around is very bad. */
 1677|      0|                    if (unlink(file) == -1)
  ------------------
  |  Branch (1677:25): [True: 0, False: 0]
  ------------------
 1678|      0|                        snmp_log(LOG_ERR, "Cannot unlink %s\n", file);
 1679|      0|                }
 1680|      0|                break;
 1681|      0|            }
 1682|      0|        }
 1683|      0|    }
 1684|       |    /*
 1685|       |     * save a warning header to the top of the new file 
 1686|       |     */
 1687|      0|    snprintf(fileold, sizeof(fileold),
 1688|      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",
 1689|      0|            "#\n# net-snmp (or ucd-snmp) persistent data file.\n#\n############################################################################\n# STOP STOP STOP STOP STOP STOP STOP STOP STOP \n",
 1690|      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",
 1691|      0|            type, type, type,
 1692|      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");
 1693|      0|    read_config_store(type, fileold);
 1694|      0|}
snmp_clean_persistent:
 1716|     57|{
 1717|     57|    char            file[512];
 1718|     57|    struct stat     statbuf;
 1719|     57|    int             j;
 1720|       |
 1721|     57|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1721:9): [True: 57, False: 0]
  ------------------
 1722|     57|                               NETSNMP_DS_LIB_DONT_PERSIST_STATE)
  ------------------
  |  |   92|     57|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
 1723|      0|     || netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1723:9): [True: 0, False: 0]
  ------------------
 1724|     57|                               NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE)) return;
  ------------------
  |  |   96|      0|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE  36 /* don't save persistent file */
  ------------------
 1725|       |
 1726|      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]
  |  |  ------------------
  ------------------
 1727|      0|    snprintf(file, sizeof(file),
 1728|      0|             "%s/%s.conf", get_persistent_directory(), type);
 1729|      0|    if (stat(file, &statbuf) == 0) {
  ------------------
  |  Branch (1729:9): [True: 0, False: 0]
  ------------------
 1730|      0|        for (j = 0; j <= NETSNMP_MAX_PERSISTENT_BACKUPS; j++) {
  ------------------
  |  | 2041|      0|#define NETSNMP_MAX_PERSISTENT_BACKUPS 10
  ------------------
  |  Branch (1730:21): [True: 0, False: 0]
  ------------------
 1731|      0|            snprintf(file, sizeof(file),
 1732|      0|                     "%s/%s.%d.conf", get_persistent_directory(), type, j);
 1733|      0|            if (stat(file, &statbuf) == 0) {
  ------------------
  |  Branch (1733:17): [True: 0, False: 0]
  ------------------
 1734|      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]
  |  |  ------------------
  ------------------
 1735|      0|                            " removing old config file: %s\n", file));
 1736|      0|                if (unlink(file) == -1)
  ------------------
  |  Branch (1736:21): [True: 0, False: 0]
  ------------------
 1737|      0|                    snmp_log(LOG_ERR, "Cannot unlink %s\n", file);
 1738|      0|            }
 1739|      0|        }
 1740|      0|    }
 1741|      0|}
skip_white_const:
 1806|    228|{
 1807|    228|    if (ptr == NULL)
  ------------------
  |  Branch (1807:9): [True: 0, False: 228]
  ------------------
 1808|      0|        return (NULL);
 1809|    342|    while (*ptr != 0 && isspace((unsigned char)*ptr))
  ------------------
  |  Branch (1809:12): [True: 228, False: 114]
  |  Branch (1809:25): [True: 114, False: 114]
  ------------------
 1810|    114|        ptr++;
 1811|    228|    if (*ptr == 0 || *ptr == '#')
  ------------------
  |  Branch (1811:9): [True: 114, False: 114]
  |  Branch (1811:22): [True: 0, False: 114]
  ------------------
 1812|    114|        return (NULL);
 1813|    114|    return (ptr);
 1814|    228|}
copy_nword_const:
 1871|    228|{
 1872|    228|    char            quote;
 1873|    228|    if (!from || !to)
  ------------------
  |  Branch (1873:9): [True: 0, False: 228]
  |  Branch (1873:18): [True: 0, False: 228]
  ------------------
 1874|      0|        return NULL;
 1875|    228|    if ((*from == '\"') || (*from == '\'')) {
  ------------------
  |  Branch (1875:9): [True: 0, False: 228]
  |  Branch (1875:28): [True: 0, False: 228]
  ------------------
 1876|      0|        quote = *(from++);
 1877|      0|        while ((*from != quote) && (*from != 0)) {
  ------------------
  |  Branch (1877:16): [True: 0, False: 0]
  |  Branch (1877:36): [True: 0, False: 0]
  ------------------
 1878|      0|            if ((*from == '\\') && (*(from + 1) != 0)) {
  ------------------
  |  Branch (1878:17): [True: 0, False: 0]
  |  Branch (1878:36): [True: 0, False: 0]
  ------------------
 1879|      0|                if (len > 0) {  /* don't copy beyond len bytes */
  ------------------
  |  Branch (1879:21): [True: 0, False: 0]
  ------------------
 1880|      0|                    *to++ = *(from + 1);
 1881|      0|                    if (--len == 0)
  ------------------
  |  Branch (1881:25): [True: 0, False: 0]
  ------------------
 1882|      0|                        *(to - 1) = '\0';       /* null protect the last spot */
 1883|      0|                }
 1884|      0|                from = from + 2;
 1885|      0|            } else {
 1886|      0|                if (len > 0) {  /* don't copy beyond len bytes */
  ------------------
  |  Branch (1886:21): [True: 0, False: 0]
  ------------------
 1887|      0|                    *to++ = *from++;
 1888|      0|                    if (--len == 0)
  ------------------
  |  Branch (1888:25): [True: 0, False: 0]
  ------------------
 1889|      0|                        *(to - 1) = '\0';       /* null protect the last spot */
 1890|      0|                } else
 1891|      0|                    from++;
 1892|      0|            }
 1893|      0|        }
 1894|      0|        if (*from == 0) {
  ------------------
  |  Branch (1894:13): [True: 0, False: 0]
  ------------------
 1895|      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]
  |  |  ------------------
  ------------------
 1896|      0|                        "no end quote found in config string\n"));
 1897|      0|        } else
 1898|      0|            from++;
 1899|    228|    } else {
 1900|  1.02k|        while (*from != 0 && !isspace((unsigned char)(*from))) {
  ------------------
  |  Branch (1900:16): [True: 912, False: 114]
  |  Branch (1900:30): [True: 798, False: 114]
  ------------------
 1901|    798|            if ((*from == '\\') && (*(from + 1) != 0)) {
  ------------------
  |  Branch (1901:17): [True: 0, False: 798]
  |  Branch (1901:36): [True: 0, False: 0]
  ------------------
 1902|      0|                if (len > 0) {  /* don't copy beyond len bytes */
  ------------------
  |  Branch (1902:21): [True: 0, False: 0]
  ------------------
 1903|      0|                    *to++ = *(from + 1);
 1904|      0|                    if (--len == 0)
  ------------------
  |  Branch (1904:25): [True: 0, False: 0]
  ------------------
 1905|      0|                        *(to - 1) = '\0';       /* null protect the last spot */
 1906|      0|                }
 1907|      0|                from = from + 2;
 1908|    798|            } else {
 1909|    798|                if (len > 0) {  /* don't copy beyond len bytes */
  ------------------
  |  Branch (1909:21): [True: 798, False: 0]
  ------------------
 1910|    798|                    *to++ = *from++;
 1911|    798|                    if (--len == 0)
  ------------------
  |  Branch (1911:25): [True: 0, False: 798]
  ------------------
 1912|      0|                        *(to - 1) = '\0';       /* null protect the last spot */
 1913|    798|                } else
 1914|      0|                    from++;
 1915|    798|            }
 1916|    798|        }
 1917|    228|    }
 1918|    228|    if (len > 0)
  ------------------
  |  Branch (1918:9): [True: 228, False: 0]
  ------------------
 1919|    228|        *to = 0;
 1920|    228|    from = skip_white_const(from);
 1921|    228|    return (from);
 1922|    228|}                               /* copy_nword */
read_config_save_octet_string:
 1963|     57|{
 1964|     57|    size_t          i;
 1965|     57|    const u_char   *cp;
 1966|       |
 1967|       |    /*
 1968|       |     * is everything easily printable
 1969|       |     */
 1970|     57|    for (i = 0, cp = str; i < len && cp &&
  ------------------
  |  Branch (1970:27): [True: 57, False: 0]
  |  Branch (1970:38): [True: 57, False: 0]
  ------------------
 1971|     57|         (isalpha(*cp) || isdigit(*cp) || *cp == ' '); cp++, i++);
  ------------------
  |  Branch (1971:11): [True: 0, False: 57]
  |  Branch (1971:27): [True: 0, False: 57]
  |  Branch (1971:43): [True: 0, False: 57]
  ------------------
 1972|       |
 1973|     57|    if (len != 0 && i == len) {
  ------------------
  |  Branch (1973:9): [True: 57, False: 0]
  |  Branch (1973:21): [True: 0, False: 57]
  ------------------
 1974|      0|        *saveto++ = '"';
 1975|      0|        memcpy(saveto, str, len);
 1976|      0|        saveto += len;
 1977|      0|        *saveto++ = '"';
 1978|      0|        *saveto = '\0';
 1979|     57|    } else {
 1980|     57|        if (str != NULL) {
  ------------------
  |  Branch (1980:13): [True: 57, False: 0]
  ------------------
 1981|     57|            sprintf(saveto, "0x");
 1982|     57|            saveto += 2;
 1983|  1.02k|            for (i = 0; i < len; i++) {
  ------------------
  |  Branch (1983:25): [True: 969, False: 57]
  ------------------
 1984|    969|                sprintf(saveto, "%02x", str[i]);
 1985|    969|                saveto = saveto + 2;
 1986|    969|            }
 1987|     57|        } else {
 1988|      0|            sprintf(saveto, "\"\"");
 1989|      0|            saveto += 2;
 1990|      0|        }
 1991|     57|    }
 1992|     57|    return saveto;
 1993|     57|}
read_config.c:internal_register_config_handler:
  153|  5.87k|{
  154|  5.87k|    struct config_files **ctmp = &config_files;
  155|  5.87k|    struct config_line  **ltmp;
  156|  5.87k|    const char           *type = type_param;
  157|       |
  158|  5.87k|    if (type == NULL || *type == '\0') {
  ------------------
  |  Branch (158:9): [True: 114, False: 5.75k]
  |  Branch (158:25): [True: 114, False: 5.64k]
  ------------------
  159|    228|        type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|    228|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  160|    228|				     NETSNMP_DS_LIB_APPTYPE);
  ------------------
  |  |  157|    228|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
  161|    228|    }
  162|       |
  163|       |    /*
  164|       |     * Handle multiple types (recursively)
  165|       |     */
  166|  5.87k|    if (strchr(type, ':')) {
  ------------------
  |  Branch (166:9): [True: 114, False: 5.75k]
  ------------------
  167|    114|        struct config_line *ltmp2 = NULL;
  168|    114|        char                buf[STRINGMAX];
  169|    114|        char               *cptr = buf;
  170|       |
  171|    114|        strlcpy(buf, type, STRINGMAX);
  ------------------
  |  |   12|    114|#define STRINGMAX 1024
  ------------------
  172|    342|        while (cptr) {
  ------------------
  |  Branch (172:16): [True: 228, False: 114]
  ------------------
  173|    228|            char* c = cptr;
  174|    228|            cptr = strchr(cptr, ':');
  175|    228|            if(cptr) {
  ------------------
  |  Branch (175:16): [True: 114, False: 114]
  ------------------
  176|    114|                *cptr = '\0';
  177|    114|                ++cptr;
  178|    114|            }
  179|    228|            ltmp2 = internal_register_config_handler(c, token, parser1, parser2,
  180|    228|                                                     releaser, help, when);
  181|    228|        }
  182|    114|        return ltmp2;
  183|    114|    }
  184|       |    
  185|       |    /*
  186|       |     * Find type in current list  -OR-  create a new file type.
  187|       |     */
  188|  6.72k|    while (*ctmp != NULL && strcmp((*ctmp)->fileHeader, type)) {
  ------------------
  |  Branch (188:12): [True: 6.61k, False: 114]
  |  Branch (188:29): [True: 969, False: 5.64k]
  ------------------
  189|    969|        ctmp = &((*ctmp)->next);
  190|    969|    }
  191|       |
  192|  5.75k|    if (*ctmp == NULL) {
  ------------------
  |  Branch (192:9): [True: 114, False: 5.64k]
  ------------------
  193|    114|        *ctmp = (struct config_files *)
  194|    114|            calloc(1, sizeof(struct config_files));
  195|    114|        if (!*ctmp) {
  ------------------
  |  Branch (195:13): [True: 0, False: 114]
  ------------------
  196|      0|            return NULL;
  197|      0|        }
  198|       |
  199|    114|        (*ctmp)->fileHeader = strdup(type);
  200|    114|        if (!(*ctmp)->fileHeader) {
  ------------------
  |  Branch (200:13): [True: 0, False: 114]
  ------------------
  201|      0|            free(*ctmp);
  202|      0|            *ctmp = NULL;
  203|      0|            return NULL;
  204|      0|        }
  205|    114|        DEBUGMSGTL(("9:read_config:type", "new type %s\n", type));
  ------------------
  |  |   66|    114|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    114|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 114]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 114]
  |  |  ------------------
  ------------------
  206|    114|    }
  207|       |
  208|  5.75k|    DEBUGMSGTL(("9:read_config:register_handler", "registering %s %s\n",
  ------------------
  |  |   66|  5.75k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  5.75k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5.75k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 5.75k]
  |  |  ------------------
  ------------------
  209|  5.75k|                type, token));
  210|       |    /*
  211|       |     * Find parser type in current list  -OR-  create a new
  212|       |     * line parser entry.
  213|       |     */
  214|  5.75k|    ltmp = &((*ctmp)->start);
  215|       |
  216|   212k|    while (*ltmp != NULL && strcmp((*ltmp)->config_token, token)) {
  ------------------
  |  Branch (216:12): [True: 206k, False: 5.75k]
  |  Branch (216:29): [True: 206k, False: 0]
  ------------------
  217|   206k|        ltmp = &((*ltmp)->next);
  218|   206k|    }
  219|       |
  220|  5.75k|    if (*ltmp == NULL) {
  ------------------
  |  Branch (220:9): [True: 5.75k, False: 0]
  ------------------
  221|  5.75k|        *ltmp = (struct config_line *)
  222|  5.75k|            calloc(1, sizeof(struct config_line));
  223|  5.75k|        if (!*ltmp) {
  ------------------
  |  Branch (223:13): [True: 0, False: 5.75k]
  ------------------
  224|      0|            return NULL;
  225|      0|        }
  226|       |
  227|  5.75k|        (*ltmp)->config_time = when;
  228|  5.75k|        (*ltmp)->config_token = strdup(token);
  229|  5.75k|        if (!(*ltmp)->config_token) {
  ------------------
  |  Branch (229:13): [True: 0, False: 5.75k]
  ------------------
  230|      0|            free(*ltmp);
  231|      0|            *ltmp = NULL;
  232|      0|            return NULL;
  233|      0|        }
  234|       |
  235|  5.75k|        if (help != NULL)
  ------------------
  |  Branch (235:13): [True: 5.07k, False: 684]
  ------------------
  236|  5.07k|            (*ltmp)->help = strdup(help);
  237|  5.75k|    }
  238|       |
  239|       |    /*
  240|       |     * Add/Replace the parse/free functions for the given line type
  241|       |     * in the given file type.
  242|       |     */
  243|  5.75k|    (*ltmp)->parse_line1 = parser1;
  244|  5.75k|    (*ltmp)->parse_line2 = parser2;
  245|  5.75k|    (*ltmp)->free_func = releaser;
  246|       |
  247|  5.75k|    return (*ltmp);
  248|       |
  249|  5.75k|}                               /* end register_config_handler() */

sc_find_auth_alg_byoid:
  270|    133|{
  271|    133|    int i = 0;
  272|       |
  273|    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]
  |  |  ------------------
  ------------------
  274|       |
  275|    133|    if ((NULL == authoid) || (0 == len))
  ------------------
  |  Branch (275:9): [True: 0, False: 133]
  |  Branch (275:30): [True: 0, False: 133]
  ------------------
  276|      0|        return NULL;
  277|       |
  278|    399|    for( ; _auth_alg_info[i].type != -1; ++i) {
  ------------------
  |  Branch (278:12): [True: 399, False: 0]
  ------------------
  279|    399|        if (len != _auth_alg_info[i].oid_len)
  ------------------
  |  Branch (279:13): [True: 0, False: 399]
  ------------------
  280|      0|            continue;
  281|    399|        if (snmp_oid_compare(_auth_alg_info[i].alg_oid,
  ------------------
  |  Branch (281:13): [True: 133, False: 266]
  ------------------
  282|    399|                             _auth_alg_info[i].oid_len,
  283|    399|                             authoid, len) == 0 )
  284|    133|            return(&_auth_alg_info[i]);
  285|    399|    }
  286|       |
  287|       |/*    DEBUGMSGTL(("scapi", "No auth alg found for"));
  288|       |      DEBUGMSGOID(("scapi", authoid, len ));*/
  289|       |
  290|      0|    return NULL;
  291|    133|}
sc_find_auth_alg_bytype:
  317|    133|{
  318|    133|    int i = 0;
  319|       |
  320|    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]
  |  |  ------------------
  ------------------
  321|       |
  322|    399|    for( ; _auth_alg_info[i].type != -1; ++i) {
  ------------------
  |  Branch (322:12): [True: 399, False: 0]
  ------------------
  323|    399|        if (type != _auth_alg_info[i].type)
  ------------------
  |  Branch (323:13): [True: 266, False: 133]
  ------------------
  324|    266|            continue;
  325|    133|        return(&_auth_alg_info[i]);
  326|    399|    }
  327|       |
  328|      0|    return NULL;
  329|    133|}
sc_get_authtype:
  342|    133|{
  343|    133|    const netsnmp_auth_alg_info *aai;
  344|       |
  345|    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]
  |  |  ------------------
  ------------------
  346|       |
  347|    133|    aai = sc_find_auth_alg_byoid(hashtype, hashtype_len);
  348|    133|    if (NULL == aai)
  ------------------
  |  Branch (348:9): [True: 0, False: 133]
  ------------------
  349|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  350|       |
  351|    133|    return aai->type;
  352|    133|}
sc_get_proper_auth_length_bytype:
  399|    133|{
  400|    133|    const netsnmp_auth_alg_info *aai;
  401|       |
  402|    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]
  |  |  ------------------
  ------------------
  403|       |
  404|    133|    aai = sc_find_auth_alg_bytype(hashtype);
  405|    133|    if (NULL == aai)
  ------------------
  |  Branch (405:9): [True: 0, False: 133]
  ------------------
  406|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  407|       |
  408|    133|    return aai->proper_length;
  409|    133|}
sc_init:
  569|     57|{
  570|     57|    int             rval = SNMPERR_SUCCESS;
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  571|       |
  572|     57|#if defined(NETSNMP_USE_OPENSSL)
  573|       |#if defined(HAVE_OPENSSL_PROVIDER_H)
  574|       |    if (legacy_provider == NULL)
  575|       |        legacy_provider = OSSL_PROVIDER_load(NULL, "legacy");
  576|       |    if (default_provider == NULL)
  577|       |        default_provider = OSSL_PROVIDER_load(NULL, "default");
  578|       |    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  579|       |                           SNMP_CALLBACK_SHUTDOWN,
  580|       |                           sc_shutdown, NULL);
  581|       |#endif
  582|       |#else /* !NETSNMP_USE_OPENSSL */
  583|       |#if defined(NETSNMP_USE_INTERNAL_MD5) || defined(NETSNMP_USE_INTERNAL_CRYPTO)
  584|       |    struct timeval  tv;
  585|       |
  586|       |    DEBUGTRACE;
  587|       |
  588|       |    gettimeofday(&tv, (struct timezone *) 0);
  589|       |
  590|       |    netsnmp_srandom((unsigned)(tv.tv_sec ^ tv.tv_usec));
  591|       |#elif defined(NETSNMP_USE_PKCS11)
  592|       |    DEBUGTRACE;
  593|       |    rval = pkcs_init();
  594|       |#else
  595|       |    rval = SNMPERR_SC_NOT_CONFIGURED;
  596|       |#endif                           /* NETSNMP_USE_INTERNAL_MD5 */
  597|       |    /*
  598|       |     * XXX ogud: The only reason to do anything here with openssl is to 
  599|       |     * * XXX ogud: seed random number generator 
  600|       |     */
  601|       |#endif                          /* NETSNMP_USE_OPENSSL */
  602|       |
  603|     57|    return rval;
  604|     57|}                               /* end sc_init() */
sc_random:
  619|    171|{
  620|    171|    int             rval = SNMPERR_SUCCESS;
  ------------------
  |  |  184|    171|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  621|       |#if !defined(NETSNMP_USE_OPENSSL) && !defined(NETSNMP_USE_PKCS11)
  622|       |    int             i;
  623|       |    int             rndval;
  624|       |    u_char         *ucp = buf;
  625|       |#endif
  626|       |
  627|    171|    DEBUGTRACE;
  ------------------
  |  |   63|    171|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    171|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 171]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 171]
  |  |  ------------------
  ------------------
  628|       |
  629|    171|#ifdef NETSNMP_USE_OPENSSL
  630|    171|    RAND_bytes(buf, *buflen);   /* will never fail */
  631|    171|    MAKE_MEM_DEFINED(buf, *buflen);
  ------------------
  |  |    8|    171|#define MAKE_MEM_DEFINED(ptr, len) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (8:50): [Folded, False: 171]
  |  |  ------------------
  ------------------
  632|       |#elif defined(NETSNMP_USE_PKCS11)  /* NETSNMP_USE_PKCS11 */
  633|       |    pkcs_random(buf, *buflen);
  634|       |#else                           /* NETSNMP_USE_INTERNAL_MD5 */
  635|       |    /*
  636|       |     * fill the buffer with random integers.  Note that random()
  637|       |     * is defined in config.h and may not be truly the random()
  638|       |     * system call if something better existed 
  639|       |     */
  640|       |    rval = *buflen - *buflen % sizeof(rndval);
  641|       |    for (i = 0; i < rval; i += sizeof(rndval)) {
  642|       |        rndval = netsnmp_random();
  643|       |        memcpy(ucp, &rndval, sizeof(rndval));
  644|       |        ucp += sizeof(rndval);
  645|       |    }
  646|       |
  647|       |    rndval = netsnmp_random();
  648|       |    memcpy(ucp, &rndval, *buflen % sizeof(rndval));
  649|       |
  650|       |    rval = SNMPERR_SUCCESS;
  651|       |#endif                          /* NETSNMP_USE_OPENSSL */
  652|    171|    return rval;
  653|       |
  654|    171|}                               /* end sc_random() */
sc_get_openssl_hashfn:
  664|    133|{
  665|    133|    const EVP_MD   *hashfn = NULL;
  666|       |
  667|    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]
  |  |  ------------------
  ------------------
  668|       |
  669|    133|    switch (auth_type) {
  ------------------
  |  Branch (669:13): [True: 133, False: 0]
  ------------------
  670|      0|#ifndef NETSNMP_DISABLE_MD5
  671|    133|        case NETSNMP_USMAUTH_HMACMD5:
  ------------------
  |  |   21|    133|#define NETSNMP_USMAUTH_HMACMD5           2
  ------------------
  |  Branch (671:9): [True: 133, False: 0]
  ------------------
  672|    133|            hashfn = (const EVP_MD *) EVP_md5();
  673|    133|            break;
  674|      0|#endif
  675|      0|        case NETSNMP_USMAUTH_HMACSHA1:
  ------------------
  |  |   22|      0|#define NETSNMP_USMAUTH_HMACSHA1          3
  ------------------
  |  Branch (675:9): [True: 0, False: 133]
  ------------------
  676|      0|            hashfn = (const EVP_MD *) EVP_sha1();
  677|      0|            break;
  678|       |
  679|      0|#ifdef HAVE_EVP_SHA224
  680|      0|        case NETSNMP_USMAUTH_HMAC128SHA224:
  ------------------
  |  |   24|      0|#define NETSNMP_USMAUTH_HMAC128SHA224     4 /* RFC 7860; OPTIONAL */
  ------------------
  |  Branch (680:9): [True: 0, False: 133]
  ------------------
  681|      0|            hashfn = (const EVP_MD *) EVP_sha224();
  682|      0|            break;
  683|       |
  684|      0|        case NETSNMP_USMAUTH_HMAC192SHA256:
  ------------------
  |  |   25|      0|#define NETSNMP_USMAUTH_HMAC192SHA256     5 /* RFC 7860; MUST */
  ------------------
  |  Branch (684:9): [True: 0, False: 133]
  ------------------
  685|      0|            hashfn = (const EVP_MD *) EVP_sha256();
  686|      0|            break;
  687|      0|#endif /* HAVE_EVP_SHA224 */
  688|       |
  689|      0|#ifdef HAVE_EVP_SHA384
  690|      0|        case NETSNMP_USMAUTH_HMAC256SHA384:
  ------------------
  |  |   26|      0|#define NETSNMP_USMAUTH_HMAC256SHA384     6 /* RFC 7860; OPTIONAL */
  ------------------
  |  Branch (690:9): [True: 0, False: 133]
  ------------------
  691|      0|            hashfn = (const EVP_MD *) EVP_sha384();
  692|      0|            break;
  693|       |
  694|      0|        case NETSNMP_USMAUTH_HMAC384SHA512:
  ------------------
  |  |   27|      0|#define NETSNMP_USMAUTH_HMAC384SHA512     7 /* RFC 7860; SHOULD */
  ------------------
  |  Branch (694:9): [True: 0, False: 133]
  ------------------
  695|      0|            hashfn = (const EVP_MD *) EVP_sha512();
  696|      0|            break;
  697|    133|#endif /* HAVE_EVP_SHA384 */
  698|    133|    }
  699|       |
  700|    133|    return hashfn;
  701|    133|}
sc_hash:
  924|    133|{
  925|    133|    int auth_type;
  926|       |
  927|    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]
  |  |  ------------------
  ------------------
  928|       |
  929|    133|    if (hashtype == NULL)
  ------------------
  |  Branch (929:9): [True: 0, False: 133]
  ------------------
  930|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  931|       |
  932|    133|    auth_type = sc_get_authtype(hashtype, hashtypelen);
  933|    133|    if (auth_type < 0 )
  ------------------
  |  Branch (933:9): [True: 0, False: 133]
  ------------------
  934|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  935|       |
  936|    133|    return sc_hash_type(auth_type, buf, buf_len, MAC, MAC_len);
  937|    133|}
sc_hash_type:
  963|    133|{
  964|    133|#if defined(NETSNMP_USE_OPENSSL) || defined(NETSNMP_USE_PKCS11) || defined(NETSNMP_USE_INTERNAL_CRYPTO)
  965|    133|    int            rval = SNMPERR_SUCCESS;
  ------------------
  |  |  184|    133|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  966|    133|#endif
  967|    133|#if defined(NETSNMP_USE_OPENSSL) || defined(NETSNMP_USE_PKCS11)
  968|    133|    unsigned int   tmp_len;
  969|    133|#endif
  970|    133|    int            ret;
  971|       |
  972|    133|#ifdef NETSNMP_USE_OPENSSL
  973|    133|    const EVP_MD   *hashfn;
  974|    133|    EVP_MD_CTX     *cptr;
  975|    133|#endif
  976|       |#ifdef NETSNMP_USE_INTERNAL_CRYPTO
  977|       |    MD5_CTX        cmd5;
  978|       |    SHA_CTX        csha1;
  979|       |#endif
  980|    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]
  |  |  ------------------
  ------------------
  981|       |
  982|    133|    if (buf == NULL || buf_len <= 0 || MAC == NULL || MAC_len == NULL )
  ------------------
  |  Branch (982:9): [True: 0, False: 133]
  |  Branch (982:24): [True: 0, False: 133]
  |  Branch (982:40): [True: 0, False: 133]
  |  Branch (982:55): [True: 0, False: 133]
  ------------------
  983|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  984|       |
  985|    133|    ret = sc_get_proper_auth_length_bytype(auth_type);
  986|    133|    if (( ret < 0 ) || (*MAC_len < (size_t)ret ))
  ------------------
  |  Branch (986:9): [True: 0, False: 133]
  |  Branch (986:24): [True: 0, False: 133]
  ------------------
  987|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  988|       |
  989|    133|#ifdef NETSNMP_USE_OPENSSL
  990|       |    /*
  991|       |     * Determine transform type.
  992|       |     */
  993|    133|    hashfn = sc_get_openssl_hashfn(auth_type);
  994|    133|    if (NULL == hashfn)
  ------------------
  |  Branch (994:9): [True: 0, False: 133]
  ------------------
  995|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  996|       |
  997|       |/** initialize the pointer */
  998|    133|#if defined(HAVE_EVP_MD_CTX_NEW)
  999|    133|    cptr = EVP_MD_CTX_new();
 1000|       |#elif defined(HAVE_EVP_MD_CTX_CREATE)
 1001|       |    cptr = EVP_MD_CTX_create();
 1002|       |#else
 1003|       |    cptr = malloc(sizeof(*cptr));
 1004|       |#if defined(OLD_DES)
 1005|       |    memset(cptr, 0, sizeof(*cptr));
 1006|       |#else
 1007|       |    EVP_MD_CTX_init(cptr);
 1008|       |#endif
 1009|       |#endif
 1010|    133|    if (!EVP_DigestInit(cptr, hashfn)) {
  ------------------
  |  Branch (1010:9): [True: 0, False: 133]
  ------------------
 1011|       |        /* requested hash function is not available */
 1012|      0|        rval = SNMPERR_SC_NOT_CONFIGURED;
  ------------------
  |  |  223|      0|#define SNMPERR_SC_NOT_CONFIGURED	(-39)
  ------------------
 1013|      0|        goto sc_hash_type_quit;
 1014|      0|    }
 1015|       |
 1016|       |/** pass the data */
 1017|    133|    EVP_DigestUpdate(cptr, buf, buf_len);
 1018|       |
 1019|       |/** do the final pass */
 1020|    133|    EVP_DigestFinal(cptr, MAC, &tmp_len);
 1021|    133|    *MAC_len = tmp_len;
 1022|       |
 1023|    133|sc_hash_type_quit:
 1024|    133|#if defined(HAVE_EVP_MD_CTX_FREE)
 1025|    133|    EVP_MD_CTX_free(cptr);
 1026|       |#elif defined(HAVE_EVP_MD_CTX_DESTROY)
 1027|       |    EVP_MD_CTX_destroy(cptr);
 1028|       |#else
 1029|       |#if !defined(OLD_DES)
 1030|       |    EVP_MD_CTX_cleanup(cptr);
 1031|       |#endif
 1032|       |    free(cptr);
 1033|       |#endif
 1034|    133|    return (rval);
 1035|       |
 1036|       |#elif defined(NETSNMP_USE_INTERNAL_CRYPTO)
 1037|       |#ifndef NETSNMP_DISABLE_MD5
 1038|       |    if (NETSNMP_USMAUTH_HMACMD5 == auth_type) {
 1039|       |        if (*MAC_len < MD5_DIGEST_LENGTH)
 1040|       |            return (SNMPERR_GENERR);      /* the buffer isn't big enough */
 1041|       |        MD5_Init(&cmd5);
 1042|       |        ret = !MD5_Update(&cmd5, buf, buf_len);
 1043|       |        if (ret != 0)
 1044|       |            return SNMPERR_GENERR;
 1045|       |        MD5_Final(MAC, &cmd5);
 1046|       |        *MAC_len = MD5_DIGEST_LENGTH;
 1047|       |    } else 
 1048|       |#endif
 1049|       |    if (NETSNMP_USMAUTH_HMACSHA1 == auth_type) {
 1050|       |        if (*MAC_len < SHA_DIGEST_LENGTH)
 1051|       |            return (SNMPERR_GENERR);      /* the buffer isn't big enough */
 1052|       |        SHA1_Init(&csha1);
 1053|       |        ret = !SHA1_Update(&csha1, buf, buf_len);
 1054|       |        if (ret != 0)
 1055|       |            return SNMPERR_GENERR;
 1056|       |        SHA1_Final(MAC, &csha1);
 1057|       |        *MAC_len = SHA_DIGEST_LENGTH;
 1058|       |            
 1059|       |    } else {
 1060|       |        return (SNMPERR_GENERR);
 1061|       |    }
 1062|       |    return (rval);
 1063|       |#elif defined(NETSNMP_USE_PKCS11)        /* NETSNMP_USE_PKCS11 */
 1064|       |
 1065|       |#ifndef NETSNMP_DISABLE_MD5
 1066|       |    if (NETSNMP_USMAUTH_HMACMD5 == auth_type) {
 1067|       |        rval = pkcs_digest(CKM_MD5, buf, buf_len, MAC, &tmp_len);
 1068|       |        *MAC_len = tmp_len;
 1069|       |    } else
 1070|       |#endif
 1071|       |    if (NETSNMP_USMAUTH_HMACSHA1 == auth_type) {
 1072|       |       rval = pkcs_digest(CKM_SHA_1, buf, buf_len, MAC, &tmp_len);
 1073|       |        *MAC_len = tmp_len;
 1074|       |    } else {
 1075|       |        return (SNMPERR_GENERR);
 1076|       |    }
 1077|       |
 1078|       |     return (rval);
 1079|       |
 1080|       |#else                           /* NETSNMP_USE_INTERNAL_MD5 */
 1081|       |
 1082|       |    if (MDchecksum(buf, buf_len, MAC, *MAC_len)) {
 1083|       |        return SNMPERR_GENERR;
 1084|       |    }
 1085|       |    if (*MAC_len > 16)
 1086|       |        *MAC_len = 16;
 1087|       |    return SNMPERR_SUCCESS;
 1088|       |
 1089|       |#endif                          /* NETSNMP_USE_OPENSSL */
 1090|    133|}

netsnmp_sd_listen_fds:
   72|     57|int netsnmp_sd_listen_fds(int unset_environment) {
   73|       |
   74|     57|        int r, fd;
   75|     57|        const char *e;
   76|     57|        char *p = NULL;
   77|     57|        unsigned long l;
   78|       |
   79|     57|        if (!(e = getenv("LISTEN_PID"))) {
  ------------------
  |  Branch (79:13): [True: 57, False: 0]
  ------------------
   80|     57|                r = 0;
   81|     57|                goto finish;
   82|     57|        }
   83|       |
   84|     57|        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|     57|finish:
  141|     57|        if (unset_environment) {
  ------------------
  |  Branch (141:13): [True: 0, False: 57]
  ------------------
  142|      0|                unsetenv("LISTEN_PID");
  143|      0|                unsetenv("LISTEN_FDS");
  144|      0|        }
  145|       |
  146|     57|        return r;
  147|      0|}
netsnmp_sd_find_inet_socket:
  356|     57|{
  357|     57|    int count, fd;
  358|       |
  359|     57|    count = netsnmp_sd_listen_fds(0);
  360|     57|    if (count <= 0) {
  ------------------
  |  Branch (360:9): [True: 57, False: 0]
  ------------------
  361|     57|        DEBUGMSGTL(("systemd:find_inet_socket", "No LISTEN_FDS found.\n"));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
  362|     57|        return -1;
  363|     57|    }
  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:
  327|     13|{
  328|     13|    size_t          start_offset = *offset;
  329|     13|    int             rc = 0;
  330|       |
  331|       |    /*
  332|       |     * Encode the value.  
  333|       |     */
  334|     13|    DEBUGDUMPHEADER("send", "Value");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
  335|       |
  336|     13|    switch (var_val_type) {
  337|      0|    case ASN_INTEGER:
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (337:5): [True: 0, False: 13]
  ------------------
  338|      0|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, allow_realloc,
  339|      0|                                    var_val_type, (long *) var_val,
  340|      0|                                    var_val_len);
  341|      0|        break;
  342|       |
  343|      0|    case ASN_GAUGE:
  ------------------
  |  |   90|      0|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (343:5): [True: 0, False: 13]
  ------------------
  344|     13|    case ASN_COUNTER:
  ------------------
  |  |   89|     13|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|     13|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (344:5): [True: 13, False: 0]
  ------------------
  345|     13|    case ASN_TIMETICKS:
  ------------------
  |  |   92|     13|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|     13|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (345:5): [True: 0, False: 13]
  ------------------
  346|     13|    case ASN_UINTEGER:
  ------------------
  |  |  100|     13|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|     13|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (346:5): [True: 0, False: 13]
  ------------------
  347|     13|        rc = asn_realloc_rbuild_unsigned_int(pkt, pkt_len, offset,
  348|     13|                                             allow_realloc, var_val_type,
  349|     13|                                             (u_long *) var_val,
  350|     13|                                             var_val_len);
  351|     13|        break;
  352|       |
  353|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
  354|      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 (354:5): [True: 0, False: 13]
  ------------------
  355|      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 (355:5): [True: 0, False: 13]
  ------------------
  356|      0|#endif
  357|      0|    case ASN_COUNTER64:
  ------------------
  |  |   99|      0|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (357:5): [True: 0, False: 13]
  ------------------
  358|      0|        rc = asn_realloc_rbuild_unsigned_int64(pkt, pkt_len, offset,
  359|      0|                                               allow_realloc, var_val_type,
  360|      0|                                               (struct counter64 *)
  361|      0|                                               var_val, var_val_len);
  362|      0|        break;
  363|       |
  364|      0|    case ASN_OCTET_STR:
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (364:5): [True: 0, False: 13]
  ------------------
  365|      0|    case ASN_IPADDRESS:
  ------------------
  |  |   88|      0|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (365:5): [True: 0, False: 13]
  ------------------
  366|      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 (366:5): [True: 0, False: 13]
  ------------------
  367|      0|    case ASN_NSAP:
  ------------------
  |  |   98|      0|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (367:5): [True: 0, False: 13]
  ------------------
  368|      0|        rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, allow_realloc,
  369|      0|                                       var_val_type, var_val, var_val_len);
  370|      0|        break;
  371|       |
  372|      0|    case ASN_OBJECT_ID:
  ------------------
  |  |   81|      0|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (372:5): [True: 0, False: 13]
  ------------------
  373|      0|        rc = asn_realloc_rbuild_objid(pkt, pkt_len, offset, allow_realloc,
  374|      0|                                      var_val_type, (oid *) var_val,
  375|      0|                                      var_val_len / sizeof(oid));
  376|      0|        break;
  377|       |
  378|      0|    case ASN_NULL:
  ------------------
  |  |   79|      0|#define ASN_NULL	    0x05U
  ------------------
  |  Branch (378:5): [True: 0, False: 13]
  ------------------
  379|      0|        rc = asn_realloc_rbuild_null(pkt, pkt_len, offset, allow_realloc,
  380|      0|                                     var_val_type);
  381|      0|        break;
  382|       |
  383|      0|    case ASN_BIT_STR:
  ------------------
  |  |   77|      0|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (383:5): [True: 0, False: 13]
  ------------------
  384|      0|        rc = asn_realloc_rbuild_bitstring(pkt, pkt_len, offset,
  385|      0|                                          allow_realloc, var_val_type,
  386|      0|                                          var_val, var_val_len);
  387|      0|        break;
  388|       |
  389|      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 (389:5): [True: 0, False: 13]
  ------------------
  390|      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 (390:5): [True: 0, False: 13]
  ------------------
  391|      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 (391:5): [True: 0, False: 13]
  ------------------
  392|      0|        rc = asn_realloc_rbuild_null(pkt, pkt_len, offset, allow_realloc,
  393|      0|                                     var_val_type);
  394|      0|        break;
  395|       |
  396|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
  397|      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 (397:5): [True: 0, False: 13]
  ------------------
  398|      0|        rc = asn_realloc_rbuild_float(pkt, pkt_len, offset, allow_realloc,
  399|      0|                                      var_val_type, (float *) var_val,
  400|      0|                                      var_val_len);
  401|      0|        break;
  402|       |
  403|      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 (403:5): [True: 0, False: 13]
  ------------------
  404|      0|        rc = asn_realloc_rbuild_double(pkt, pkt_len, offset, allow_realloc,
  405|      0|                                       var_val_type, (double *) var_val,
  406|      0|                                       var_val_len);
  407|      0|        break;
  408|       |
  409|      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 (409:5): [True: 0, False: 13]
  ------------------
  410|      0|        rc = asn_realloc_rbuild_signed_int64(pkt, pkt_len, offset,
  411|      0|                                             allow_realloc, var_val_type,
  412|      0|                                             (struct counter64 *) var_val,
  413|      0|                                             var_val_len);
  414|      0|        break;
  415|      0|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
  416|      0|    default:
  ------------------
  |  Branch (416:5): [True: 0, False: 13]
  ------------------
  417|      0|	{
  418|      0|	char error_buf[64];
  419|      0|	snprintf(error_buf, sizeof(error_buf),
  420|      0|		"wrong type in snmp_realloc_rbuild_var_op: %d", var_val_type);
  421|      0|        ERROR_MSG(error_buf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  422|      0|        rc = 0;
  423|      0|	}
  424|     13|    }
  425|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
  426|       |
  427|     13|    if (rc == 0) {
  ------------------
  |  Branch (427:9): [True: 0, False: 13]
  ------------------
  428|      0|        return 0;
  429|      0|    }
  430|       |
  431|       |    /*
  432|       |     * Build the OID.  
  433|       |     */
  434|       |
  435|     13|    DEBUGDUMPHEADER("send", "Name");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
  436|     13|    rc = asn_realloc_rbuild_objid(pkt, pkt_len, offset, allow_realloc,
  437|     13|                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
  438|     13|                                            ASN_OBJECT_ID), var_name,
  ------------------
  |  |   81|     13|#define ASN_OBJECT_ID	    0x06U
  ------------------
  439|     13|                                  *var_name_len);
  440|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
  441|     13|    if (rc == 0) {
  ------------------
  |  Branch (441:9): [True: 0, False: 13]
  ------------------
  442|      0|        ERROR_MSG("Can't build OID for variable");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  443|      0|        return 0;
  444|      0|    }
  445|       |
  446|       |    /*
  447|       |     * Build the sequence header.  
  448|       |     */
  449|       |
  450|     13|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, allow_realloc,
  451|     13|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|     13|#define ASN_SEQUENCE	    0x10U
  ------------------
  452|     13|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
  453|     13|                                     *offset - start_offset);
  454|     13|    return rc;
  455|     13|}

init_alarm_post_config:
   63|     57|{
   64|     57|    start_alarms = 1;
   65|     57|    set_an_alarm();
   66|     57|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
   67|     57|}
init_snmp_alarm:
   71|     57|{
   72|     57|    start_alarms = 0;
   73|     57|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
   74|     57|                           SNMP_CALLBACK_POST_READ_CONFIG,
  ------------------
  |  |   24|     57|#define SNMP_CALLBACK_POST_READ_CONFIG	        0
  ------------------
   75|       |                           init_alarm_post_config, NULL);
   76|     57|}
snmp_alarm_unregister_all:
  156|     57|{
  157|     57|  struct snmp_alarm *sa_ptr, *sa_tmp;
  158|       |
  159|     57|  for (sa_ptr = thealarms; sa_ptr != NULL; sa_ptr = sa_tmp) {
  ------------------
  |  Branch (159:28): [True: 0, False: 57]
  ------------------
  160|      0|    sa_tmp = sa_ptr->next;
  161|      0|    free(sa_ptr);
  162|      0|  }
  163|     57|  DEBUGMSGTL(("snmp_alarm", "ALL alarms unregistered\n"));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
  164|       |  thealarms = NULL;
  165|     57|}  
sa_find_next:
  169|     57|{
  170|     57|    struct snmp_alarm *a, *lowest = NULL;
  171|       |
  172|     57|    for (a = thealarms; a != NULL; a = a->next)
  ------------------
  |  Branch (172:25): [True: 0, False: 57]
  ------------------
  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|     57|    return lowest;
  178|     57|}
netsnmp_get_next_alarm_time:
  253|     57|{
  254|     57|    struct snmp_alarm *sa_ptr;
  255|       |
  256|     57|    sa_ptr = sa_find_next();
  257|       |
  258|     57|    if (sa_ptr) {
  ------------------
  |  Branch (258:9): [True: 0, False: 57]
  ------------------
  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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      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|     57|    } else {
  267|     57|        return 0;
  268|     57|    }
  269|     57|}
get_next_alarm_delay_time:
  282|     57|{
  283|     57|    struct timeval t_now, alarm_tm;
  284|     57|    int res;
  285|       |
  286|     57|    netsnmp_get_monotonic_clock(&t_now);
  287|     57|    res = netsnmp_get_next_alarm_time(&alarm_tm, &t_now);
  288|     57|    if (res)
  ------------------
  |  Branch (288:9): [True: 0, False: 57]
  ------------------
  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|     57|    return res;
  291|     57|}
set_an_alarm:
  296|     57|{
  297|     57|    struct timeval  delta;
  298|     57|    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|     57|    if (nextalarm && !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (306:9): [True: 0, False: 57]
  |  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|     57|    } else {
  326|     57|        DEBUGMSGTL(("snmp_alarm", "no alarms found to schedule\n"));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
  327|     57|    }
  328|     57|}

netsnmp_max_send_msg_size:
  382|    127|{
  383|    127|    u_int max = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    127|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  384|    127|                                   NETSNMP_DS_LIB_MSG_SEND_MAX);
  ------------------
  |  |  132|    127|#define NETSNMP_DS_LIB_MSG_SEND_MAX        16 /* global max response size */
  ------------------
  385|    127|    if (0 == max)
  ------------------
  |  Branch (385:9): [True: 127, False: 0]
  ------------------
  386|    127|        max = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|    127|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  387|      0|    else if (max < SNMP_MIN_MAX_LEN)
  ------------------
  |  |   48|      0|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (387:14): [True: 0, False: 0]
  ------------------
  388|      0|        max = SNMP_MIN_MAX_LEN; /* minimum max size per SNMP specs */
  ------------------
  |  |   48|      0|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  389|      0|    else if (max > SNMP_MAX_PACKET_LEN)
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (389:14): [True: 0, False: 0]
  ------------------
  390|      0|        max = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  391|       |
  392|    127|    return max;
  393|    127|}
snmp_get_next_sessid:
  486|     57|{
  487|     57|    long            retVal;
  488|     57|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSIONID);
  ------------------
  |  |   79|     57|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 57]
  |  |  ------------------
  ------------------
  489|     57|    retVal = 1 + Sessid;        /*MTCRITICAL_RESOURCE */
  490|     57|    if (!retVal)
  ------------------
  |  Branch (490:9): [True: 0, False: 57]
  ------------------
  491|      0|        retVal = 2;
  492|     57|    Sessid = retVal;
  493|     57|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   91|     57|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  |  Branch (493:9): [True: 0, False: 57]
  ------------------
  494|      0|        retVal &= 0x7fff;	/* mask to 15 bits */
  495|     57|    else
  496|     57|        retVal &= 0x7fffffff;	/* mask to 31 bits */
  497|       |
  498|     57|    if (!retVal) {
  ------------------
  |  Branch (498:9): [True: 0, False: 57]
  ------------------
  499|      0|        Sessid = retVal = 2;
  500|      0|    }
  501|     57|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSIONID);
  ------------------
  |  |   80|     57|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 57]
  |  |  ------------------
  ------------------
  502|     57|    return retVal;
  503|     57|}
snmp_get_next_transid:
  507|    183|{
  508|    183|    long            retVal;
  509|    183|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   79|    183|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 183]
  |  |  ------------------
  ------------------
  510|    183|    retVal = 1 + Transid;       /*MTCRITICAL_RESOURCE */
  511|    183|    if (!retVal)
  ------------------
  |  Branch (511:9): [True: 0, False: 183]
  ------------------
  512|      0|        retVal = 2;
  513|    183|    Transid = retVal;
  514|    183|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   48|    183|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   91|    183|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  |  Branch (514:9): [True: 0, False: 183]
  ------------------
  515|      0|        retVal &= 0x7fff;	/* mask to 15 bits */
  516|    183|    else
  517|    183|        retVal &= 0x7fffffff;	/* mask to 31 bits */
  518|       |
  519|    183|    if (!retVal) {
  ------------------
  |  Branch (519:9): [True: 0, False: 183]
  ------------------
  520|      0|        Transid = retVal = 2;
  521|      0|    }
  522|    183|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   80|    183|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 183]
  |  |  ------------------
  ------------------
  523|    183|    return retVal;
  524|    183|}
snmp_set_detail:
  538|    336|{
  539|    336|    if (detail_string != NULL) {
  ------------------
  |  Branch (539:9): [True: 336, False: 0]
  ------------------
  540|    336|        strlcpy(snmp_detail, detail_string, sizeof(snmp_detail));
  541|    336|        snmp_detail_f = 1;
  542|    336|    }
  543|    336|}
netsnmp_random:
  661|    171|{
  662|    171|#if defined(HAVE_RANDOM)
  663|       |    /*
  664|       |     * The function random() is a more sophisticated random number generator
  665|       |     * which uses nonlinear feedback and an internal table that is 124 bytes
  666|       |     * (992 bits) long. The function returns random values that are 32 bits in
  667|       |     * length. All of the bits generated by random() are usable. The random()
  668|       |     * function is adequate for simulations and games, but should not be used
  669|       |     * for security related applications such as picking cryptographic keys or
  670|       |     * simulating one-time pads.
  671|       |     */
  672|    171|    return random();
  673|       |#elif defined(HAVE_LRAND48)
  674|       |    /*
  675|       |     * As with random(), lrand48() provides excellent random numbers for
  676|       |     * simulations and games, but should not be used for security-related
  677|       |     * applications such as picking cryptographic keys or simulating one-time
  678|       |     * pads; linear congruential algorithms are too easy to break.
  679|       |     */
  680|       |    return lrand48();
  681|       |#elif defined(HAVE_RAND)
  682|       |    /*
  683|       |     * The original UNIX random number generator, rand(), is not a very good
  684|       |     * random number generator. It uses a 32-bit seed and maintains a 32-bit
  685|       |     * internal state.
  686|       |     */
  687|       |    return rand();
  688|       |#else
  689|       |#error "Neither random(), nor lrand48() nor rand() are available"
  690|       |#endif
  691|    171|}
netsnmp_srandom:
  694|     57|{
  695|     57|#if defined(HAVE_SRANDOM)
  696|     57|    srandom(seed);
  697|       |#elif defined(HAVE_SRAND48)
  698|       |    srand48(seed);
  699|       |#elif defined(HAVE_SRAND)
  700|       |    srand(seed);
  701|       |#else
  702|       |#error "Neither srandom(), nor srand48() nor srand() are available"
  703|       |#endif
  704|     57|}
snmp_sess_init:
  797|     57|{
  798|     57|    _init_snmp();
  799|       |
  800|       |    /*
  801|       |     * initialize session to default values 
  802|       |     */
  803|       |
  804|     57|    memset(session, 0, sizeof(netsnmp_session));
  805|     57|    session->timeout = SNMP_DEFAULT_TIMEOUT;
  ------------------
  |  |   80|     57|#define SNMP_DEFAULT_TIMEOUT	    -1
  ------------------
  806|     57|    session->retries = SNMP_DEFAULT_RETRIES;
  ------------------
  |  |   79|     57|#define SNMP_DEFAULT_RETRIES	    -1
  ------------------
  807|     57|    session->version = SNMP_DEFAULT_VERSION;
  ------------------
  |  |   90|     57|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  808|     57|    session->securityModel = SNMP_DEFAULT_SECMODEL;
  ------------------
  |  |   91|     57|#define SNMP_DEFAULT_SECMODEL	    -1
  ------------------
  809|     57|    session->rcvMsgMaxSize = netsnmp_max_send_msg_size();
  810|     57|    session->sndMsgMaxSize = netsnmp_max_send_msg_size();
  811|     57|    session->flags |= SNMP_FLAGS_DONT_PROBE;
  ------------------
  |  |  155|     57|#define SNMP_FLAGS_DONT_PROBE      0x100      /* don't probe for an engineID */
  ------------------
  812|     57|}
init_snmp:
  901|     57|{
  902|     57|    if (init_snmp_init_done) {
  ------------------
  |  Branch (902:9): [True: 0, False: 57]
  ------------------
  903|      0|        return;
  904|      0|    }
  905|       |
  906|     57|    init_snmp_init_done = 1;
  907|       |
  908|       |    /*
  909|       |     * make the type available everywhere else 
  910|       |     */
  911|     57|    if (type && !netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (911:9): [True: 57, False: 0]
  |  Branch (911:17): [True: 57, False: 0]
  ------------------
  912|     57|				       NETSNMP_DS_LIB_APPTYPE)) {
  ------------------
  |  |  157|     57|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
  913|     57|        netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  914|     57|			      NETSNMP_DS_LIB_APPTYPE, type);
  ------------------
  |  |  157|     57|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
  915|     57|    }
  916|       |
  917|     57|    _init_snmp();
  918|       |
  919|       |    /*
  920|       |     * set our current locale properly to initialize isprint() type functions 
  921|       |     *
  922|       |     * Do not use setlocale on qnx, it is buggy 
  923|       |     * https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.lib_ref/topic/s/setlocale.html
  924|       |     */
  925|     57|#if defined(HAVE_SETLOCALE) && !defined(__QNX__)
  926|     57|    setlocale(LC_CTYPE, "");
  927|     57|#endif
  928|       |
  929|     57|    snmp_debug_init();    /* should be done first, to turn on debugging ASAP */
  930|     57|    netsnmp_container_init_list();
  931|     57|    init_callbacks();
  932|     57|    init_snmp_logging();
  933|     57|    snmp_init_statistics();
  934|     57|    register_mib_handlers();
  935|     57|    register_default_handlers();
  936|     57|    init_snmp_transport();
  937|     57|    init_snmpv3(type);
  938|     57|    init_snmp_alarm();
  939|     57|    init_snmp_enum(type);
  940|     57|    init_vacm();
  941|     57|#if defined(NETSNMP_USE_OPENSSL) && defined(HAVE_LIBSSL) && NETSNMP_TRANSPORT_TLSBASE_DOMAIN
  942|     57|    netsnmp_certs_init();
  943|     57|#endif
  944|       |#ifdef DNSSEC_LOCAL_VALIDATION
  945|       |    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "dnssecWarnOnly",
  946|       |                               NETSNMP_DS_LIBRARY_ID,
  947|       |                               NETSNMP_DS_LIB_DNSSEC_WARN_ONLY);
  948|       |#endif
  949|       |
  950|     57|    read_premib_configs();
  951|     57|#ifndef NETSNMP_DISABLE_MIB_LOADING
  952|     57|    netsnmp_init_mib();
  953|     57|#endif /* NETSNMP_DISABLE_MIB_LOADING */
  954|       |
  955|     57|    read_configs();
  956|       |
  957|     57|}                               /* end init_snmp() */
snmp_store:
  983|     57|{
  984|     57|    DEBUGMSGTL(("snmp_store", "storing stuff...\n"));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
  985|     57|    snmp_save_persistent(type);
  986|     57|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA, NULL);
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
                  snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA, NULL);
  ------------------
  |  |   25|     57|#define SNMP_CALLBACK_STORE_DATA	        1
  ------------------
  987|     57|    snmp_clean_persistent(type);
  988|     57|}
snmp_shutdown:
 1001|     57|{
 1002|     57|    snmp_store(type);
 1003|     57|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN, NULL);
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
                  snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN, NULL);
  ------------------
  |  |   26|     57|#define SNMP_CALLBACK_SHUTDOWN		        2
  ------------------
 1004|     57|    shutdown_snmp_logging();
 1005|     57|    snmp_alarm_unregister_all();
 1006|     57|    netsnmp_query_shutdown();
 1007|     57|    snmp_close_sessions();
 1008|     57|#ifndef NETSNMP_DISABLE_MIB_LOADING
 1009|     57|    shutdown_mib();
 1010|     57|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 1011|     57|#if defined(NETSNMP_USE_OPENSSL) && defined(HAVE_LIBSSL) && NETSNMP_TRANSPORT_TLSBASE_DOMAIN
 1012|     57|    netsnmp_certs_shutdown();
 1013|     57|#endif
 1014|     57|#if !defined(NETSNMP_FEATURE_REMOVE_FILTER_SOURCE)
 1015|     57|    netsnmp_transport_filter_cleanup();
 1016|     57|#endif
 1017|     57|    unregister_all_config_handlers();
 1018|     57|    netsnmp_container_free_list();
 1019|     57|    clear_sec_mod();
 1020|     57|    clear_snmp_enum();
 1021|     57|    netsnmp_clear_tdomain_list();
 1022|     57|    clear_callback();
 1023|     57|    netsnmp_ds_shutdown();
 1024|     57|    netsnmp_clear_default_target();
 1025|     57|    netsnmp_clear_default_domain();
 1026|     57|    shutdown_secmod();
 1027|     57|    shutdown_snmp_transport();
 1028|     57|    shutdown_data_list();
 1029|     57|    snmp_debug_shutdown();    /* should be done last */
 1030|       |
 1031|     57|    init_snmp_init_done  = 0;
 1032|     57|    _init_snmp_init_done = 0;
 1033|     57|}
snmp_session_insert:
 1039|     57|{
 1040|     57|    if (NULL == slp)
  ------------------
  |  Branch (1040:9): [True: 0, False: 57]
  ------------------
 1041|      0|        return;
 1042|       |
 1043|     57|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     57|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 57]
  |  |  ------------------
  ------------------
 1044|     57|    slp->next = Sessions;
 1045|     57|    Sessions = slp;
 1046|     57|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     57|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 57]
  |  |  ------------------
  ------------------
 1047|     57|}
netsnmp_sess_config_transport:
 1631|     57|{
 1632|       |    /* Optional supplemental transport configuration information and
 1633|       |       final call to actually open the transport */
 1634|     57|    if (transport_configuration) {
  ------------------
  |  Branch (1634:9): [True: 0, False: 57]
  ------------------
 1635|      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]
  |  |  ------------------
  ------------------
 1636|      0|        if (transport->f_config) {
  ------------------
  |  Branch (1636:13): [True: 0, False: 0]
  ------------------
 1637|      0|            netsnmp_iterator *iter;
 1638|      0|            netsnmp_transport_config *config_data;
 1639|      0|            int ret = 0;
 1640|       |
 1641|      0|            iter = CONTAINER_ITERATOR(transport_configuration);
  ------------------
  |  |  404|      0|#define CONTAINER_ITERATOR(x)       (x)->get_iterator(x)
  ------------------
 1642|      0|            if (NULL == iter) {
  ------------------
  |  Branch (1642:17): [True: 0, False: 0]
  ------------------
 1643|      0|                return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1644|      0|            }
 1645|       |
 1646|      0|            for(config_data = (netsnmp_transport_config*)ITERATOR_FIRST(iter); config_data;
  ------------------
  |  |  546|      0|#define ITERATOR_FIRST(x)  x->first(x)
  ------------------
  |  Branch (1646:80): [True: 0, False: 0]
  ------------------
 1647|      0|                config_data = (netsnmp_transport_config*)ITERATOR_NEXT(iter)) {
  ------------------
  |  |  547|      0|#define ITERATOR_NEXT(x)   x->next(x)
  ------------------
 1648|      0|                ret = transport->f_config(transport, config_data->key,
 1649|      0|                                          config_data->value);
 1650|      0|                if (ret)
  ------------------
  |  Branch (1650:21): [True: 0, False: 0]
  ------------------
 1651|      0|                    break;
 1652|      0|            }
 1653|      0|            ITERATOR_RELEASE(iter);
  ------------------
  |  |  550|      0|#define ITERATOR_RELEASE(x) do { x->release(x); x = NULL; } while(0)
  |  |  ------------------
  |  |  |  Branch (550:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1654|      0|            if (ret)
  ------------------
  |  Branch (1654:17): [True: 0, False: 0]
  ------------------
 1655|      0|                return SNMPERR_TRANSPORT_CONFIG_ERROR;
  ------------------
  |  |  252|      0|#define SNMPERR_TRANSPORT_CONFIG_ERROR  (-68)
  ------------------
 1656|      0|        } else {
 1657|      0|            return SNMPERR_TRANSPORT_NO_CONFIG;
  ------------------
  |  |  251|      0|#define SNMPERR_TRANSPORT_NO_CONFIG     (-67)
  ------------------
 1658|      0|        }
 1659|      0|    }
 1660|     57|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1661|     57|}
netsnmp_sess_config_and_open_transport:
 1693|     57|{
 1694|     57|    int rc;
 1695|       |    
 1696|     57|    DEBUGMSGTL(("snmp_sess", "opening transport: %x\n", transport->flags & NETSNMP_TRANSPORT_FLAG_OPENED));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 1697|       |
 1698|       |    /* don't double open */
 1699|     57|    if (transport->flags & NETSNMP_TRANSPORT_FLAG_OPENED)
  ------------------
  |  |   57|     57|#define		NETSNMP_TRANSPORT_FLAG_OPENED	 0x20  /* f_open called */
  ------------------
  |  Branch (1699:9): [True: 0, False: 57]
  ------------------
 1700|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1701|       |
 1702|     57|    if ((rc = netsnmp_sess_config_transport(in_session->transport_configuration,
  ------------------
  |  Branch (1702:9): [True: 0, False: 57]
  ------------------
 1703|     57|                                            transport)) != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1704|      0|        in_session->s_snmp_errno = rc;
 1705|      0|        in_session->s_errno = 0;
 1706|      0|        return rc;
 1707|      0|    }
 1708|       |        
 1709|     57|    if (transport->f_open)
  ------------------
  |  Branch (1709:9): [True: 0, False: 57]
  ------------------
 1710|      0|        transport = transport->f_open(transport);
 1711|       |
 1712|     57|    if (transport == NULL) {
  ------------------
  |  Branch (1712:9): [True: 0, False: 57]
  ------------------
 1713|      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]
  |  |  ------------------
  ------------------
 1714|      0|        in_session->s_snmp_errno = SNMPERR_BAD_ADDRESS;
  ------------------
  |  |  187|      0|#define SNMPERR_BAD_ADDRESS		(-3)
  ------------------
 1715|      0|        in_session->s_errno = errno;
 1716|      0|        snmp_set_detail(in_session->peername);
 1717|      0|        return SNMPERR_BAD_ADDRESS;
  ------------------
  |  |  187|      0|#define SNMPERR_BAD_ADDRESS		(-3)
  ------------------
 1718|      0|    }
 1719|       |
 1720|       |    /** if transport has a max size, make sure session is the same (or less) */
 1721|     57|    if (in_session->rcvMsgMaxSize > transport->msgMaxSize) {
  ------------------
  |  Branch (1721:9): [True: 57, False: 0]
  ------------------
 1722|     57|        DEBUGMSGTL(("snmp_sess",
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 1723|     57|                    "limiting session rcv size (%" NETSNMP_PRIz "d) to transport max (%" NETSNMP_PRIz "d)\n",
 1724|     57|                    in_session->rcvMsgMaxSize, transport->msgMaxSize));
 1725|     57|        in_session->rcvMsgMaxSize = transport->msgMaxSize;
 1726|     57|    }
 1727|       |
 1728|     57|    if (in_session->sndMsgMaxSize > transport->msgMaxSize) {
  ------------------
  |  Branch (1728:9): [True: 57, False: 0]
  ------------------
 1729|     57|        DEBUGMSGTL(("snmp_sess",
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 1730|     57|                    "limiting session snd size (%" NETSNMP_PRIz "d) to transport max (%" NETSNMP_PRIz "d)\n",
 1731|     57|                    in_session->sndMsgMaxSize, transport->msgMaxSize));
 1732|     57|        in_session->sndMsgMaxSize = transport->msgMaxSize;
 1733|     57|    }
 1734|       |
 1735|     57|    transport->flags |= NETSNMP_TRANSPORT_FLAG_OPENED;
  ------------------
  |  |   57|     57|#define		NETSNMP_TRANSPORT_FLAG_OPENED	 0x20  /* f_open called */
  ------------------
 1736|     57|    DEBUGMSGTL(("snmp_sess", "done opening transport: %x\n", transport->flags & NETSNMP_TRANSPORT_FLAG_OPENED));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 1737|     57|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1738|     57|}
snmp_add:
 1852|     57|{
 1853|     57|    struct session_list *slp;
 1854|       |
 1855|     57|    slp = snmp_sess_add_ex(in_session, transport, fpre_parse, NULL,
 1856|     57|                           fpost_parse, NULL, NULL, NULL, NULL);
 1857|     57|    if (slp == NULL) {
  ------------------
  |  Branch (1857:9): [True: 0, False: 57]
  ------------------
 1858|      0|        return NULL;
 1859|      0|    }
 1860|       |
 1861|     57|    snmp_session_insert(slp);
 1862|       |
 1863|     57|    return (slp->session);
 1864|     57|}
snmp_sess_add_ex:
 1913|     57|{
 1914|     57|    struct session_list *slp;
 1915|     57|    int rc;
 1916|       |    
 1917|     57|    _init_snmp();
 1918|       |
 1919|     57|    if (transport == NULL)
  ------------------
  |  Branch (1919:9): [True: 0, False: 57]
  ------------------
 1920|      0|        return NULL;
 1921|       |
 1922|     57|    if (NULL != in_session && (in_session->rcvMsgMaxSize < SNMP_MIN_MAX_LEN ||
  ------------------
  |  |   48|    114|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (1922:9): [True: 57, False: 0]
  |  Branch (1922:32): [True: 0, False: 57]
  ------------------
 1923|     57|                               in_session->sndMsgMaxSize < SNMP_MIN_MAX_LEN)) {
  ------------------
  |  |   48|     57|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (1923:32): [True: 0, False: 57]
  ------------------
 1924|      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]
  |  |  ------------------
  ------------------
 1925|      0|                    "invalid session (msg sizes). need snmp_sess_init"));
 1926|      0|        in_session = NULL; /* force transport cleanup below */
 1927|      0|    }
 1928|       |
 1929|     57|    if (in_session == NULL) {
  ------------------
  |  Branch (1929:9): [True: 0, False: 57]
  ------------------
 1930|      0|        transport->f_close(transport);
 1931|      0|        netsnmp_transport_free(transport);
 1932|      0|        return NULL;
 1933|      0|    }
 1934|       |
 1935|       |    /* if the transport hasn't been fully opened yet, open it now */
 1936|     57|    if ((rc = netsnmp_sess_config_and_open_transport(in_session, transport))
  ------------------
  |  Branch (1936:9): [True: 0, False: 57]
  ------------------
 1937|     57|        != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1938|      0|        return NULL;
 1939|      0|    }
 1940|       |
 1941|     57|    DEBUGMSGTL(("snmp_sess_add", "fd %" NETSNMP_FMT_SKT "\n",
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 1942|     57|                transport->sock));
 1943|       |
 1944|     57|    if ((slp = snmp_sess_copy(in_session)) == NULL) {
  ------------------
  |  Branch (1944:9): [True: 0, False: 57]
  ------------------
 1945|      0|        transport->f_close(transport);
 1946|      0|        netsnmp_transport_free(transport);
 1947|      0|        return (NULL);
 1948|      0|    }
 1949|       |
 1950|     57|    slp->transport = transport;
 1951|     57|    slp->internal->hook_pre = fpre_parse;
 1952|     57|    slp->internal->hook_parse = fparse;
 1953|     57|    slp->internal->hook_post = fpost_parse;
 1954|     57|    slp->internal->hook_build = fbuild;
 1955|     57|    slp->internal->hook_realloc_build = frbuild;
 1956|     57|    slp->internal->check_packet = fcheck;
 1957|     57|    slp->internal->hook_create_pdu = fcreate_pdu;
 1958|       |
 1959|       |    /** don't let session max exceed transport max */
 1960|     57|    if (slp->session->rcvMsgMaxSize > transport->msgMaxSize) {
  ------------------
  |  Branch (1960:9): [True: 0, False: 57]
  ------------------
 1961|      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]
  |  |  ------------------
  ------------------
 1962|      0|                    "limiting session rcv size (%" NETSNMP_PRIz "d) to transport max (%" NETSNMP_PRIz "d)\n",
 1963|      0|                    slp->session->rcvMsgMaxSize, transport->msgMaxSize));
 1964|      0|        slp->session->rcvMsgMaxSize = transport->msgMaxSize;
 1965|      0|    }
 1966|     57|    if (slp->session->sndMsgMaxSize > transport->msgMaxSize) {
  ------------------
  |  Branch (1966:9): [True: 0, False: 57]
  ------------------
 1967|      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]
  |  |  ------------------
  ------------------
 1968|      0|                    "limiting session snd size (%" NETSNMP_PRIz "d) to transport max (%" NETSNMP_PRIz "d)\n",
 1969|      0|                    slp->session->sndMsgMaxSize, transport->msgMaxSize));
 1970|      0|        slp->session->sndMsgMaxSize = transport->msgMaxSize;
 1971|      0|    }
 1972|       |
 1973|     57|    if (transport->f_setup_session &&
  ------------------
  |  Branch (1973:9): [True: 57, False: 0]
  ------------------
 1974|     57|        transport->f_setup_session(transport, slp->session) != SNMPERR_SUCCESS)
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (1974:9): [True: 0, False: 57]
  ------------------
 1975|      0|        goto close_session;
 1976|       |
 1977|       |    /* Anything below this point should only be done if the transport
 1978|       |       had no say in the matter */
 1979|     57|    if (slp->session->securityLevel == 0)
  ------------------
  |  Branch (1979:9): [True: 57, False: 0]
  ------------------
 1980|     57|        slp->session->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|     57|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 1981|       |
 1982|     57|    if (slp->session->version == SNMP_VERSION_3) {
  ------------------
  |  |  113|     57|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (1982:9): [True: 0, False: 57]
  ------------------
 1983|      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]
  |  |  ------------------
  ------------------
 1984|      0|                    "adding v3 session -- maybe engineID probe now\n"));
 1985|      0|        if (!snmpv3_engineID_probe(slp, slp->session)) {
  ------------------
  |  Branch (1985:13): [True: 0, False: 0]
  ------------------
 1986|      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]
  |  |  ------------------
  ------------------
 1987|      0|            goto close_session;
 1988|      0|        }
 1989|      0|    }
 1990|       |
 1991|     57|    slp->session->flags &= ~SNMP_FLAGS_DONT_PROBE;
  ------------------
  |  |  155|     57|#define SNMP_FLAGS_DONT_PROBE      0x100      /* don't probe for an engineID */
  ------------------
 1992|       |
 1993|     57|    return slp;
 1994|       |
 1995|      0|close_session:
 1996|      0|    snmp_sess_close(slp);
 1997|       |    return NULL;
 1998|     57|}                               /*  end snmp_sess_add_ex()  */
netsnmp_cleanup_session:
 2058|     57|{
 2059|     57|    free(s->localname);
 2060|     57|    free(s->peername);
 2061|     57|    free(s->community);
 2062|     57|    free(s->contextEngineID);
 2063|     57|    free(s->contextName);
 2064|     57|    free(s->securityEngineID);
 2065|     57|    free(s->securityName);
 2066|     57|    free(s->securityAuthProto);
 2067|     57|    free(s->securityAuthLocalKey);
 2068|     57|    free(s->securityPrivProto);
 2069|     57|    free(s->securityPrivLocalKey);
 2070|     57|    free(s->paramName);
 2071|     57|#ifndef NETSNMP_NO_TRAP_STATS
 2072|     57|    free(s->trap_stats);
 2073|     57|#endif /* NETSNMP_NO_TRAP_STATS */
 2074|     57|    usm_free_user(s->sessUser);
 2075|     57|    netsnmp_free_transport_config(s->transport_configuration);
 2076|     57|    memset(s, 0, sizeof(*s));
 2077|     57|}
snmp_sess_close:
 2108|     57|{
 2109|     57|    netsnmp_transport *transport;
 2110|     57|    struct snmp_internal_session *isp;
 2111|     57|    netsnmp_session *sesp = NULL;
 2112|     57|    struct snmp_secmod_def *sptr;
 2113|       |
 2114|     57|    if (slp == NULL) {
  ------------------
  |  Branch (2114:9): [True: 0, False: 57]
  ------------------
 2115|      0|        return 0;
 2116|      0|    }
 2117|       |
 2118|     57|    if (slp->session != NULL &&
  ------------------
  |  Branch (2118:9): [True: 57, False: 0]
  ------------------
 2119|     57|        (sptr = find_sec_mod(slp->session->securityModel)) != NULL &&
  ------------------
  |  Branch (2119:9): [True: 57, False: 0]
  ------------------
 2120|     57|        sptr->session_close != NULL) {
  ------------------
  |  Branch (2120:9): [True: 0, False: 57]
  ------------------
 2121|      0|        (*sptr->session_close) (slp->session);
 2122|      0|    }
 2123|       |
 2124|     57|    isp = slp->internal;
 2125|     57|    slp->internal = NULL;
 2126|       |
 2127|     57|    if (isp) {
  ------------------
  |  Branch (2127:9): [True: 57, False: 0]
  ------------------
 2128|     57|        netsnmp_request_list *rp, *orp;
 2129|       |
 2130|     57|        SNMP_FREE(isp->packet);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 57]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
 2131|       |
 2132|       |        /*
 2133|       |         * Free each element in the input request list.  
 2134|       |         */
 2135|     57|        rp = isp->requests;
 2136|     57|        while (rp) {
  ------------------
  |  Branch (2136:16): [True: 0, False: 57]
  ------------------
 2137|      0|            orp = rp;
 2138|      0|            rp = rp->next_request;
 2139|      0|            if (orp->callback) {
  ------------------
  |  Branch (2139:17): [True: 0, False: 0]
  ------------------
 2140|      0|                orp->callback(NETSNMP_CALLBACK_OP_TIMED_OUT,
  ------------------
  |  |  320|      0|#define NETSNMP_CALLBACK_OP_TIMED_OUT		2
  ------------------
 2141|      0|                              slp->session, orp->pdu->reqid,
 2142|      0|                              orp->pdu, orp->cb_data);
 2143|      0|            }
 2144|      0|            remove_request(isp, NULL, orp);
 2145|      0|            free(orp);
 2146|      0|        }
 2147|       |
 2148|     57|        free(isp);
 2149|     57|    }
 2150|       |
 2151|     57|    transport = slp->transport;
 2152|     57|    slp->transport = NULL;
 2153|       |
 2154|     57|    if (transport) {
  ------------------
  |  Branch (2154:9): [True: 57, False: 0]
  ------------------
 2155|     57|        transport->f_close(transport);
 2156|     57|        netsnmp_transport_free(transport);
 2157|     57|    }
 2158|       |
 2159|     57|    sesp = slp->session;
 2160|     57|    slp->session = NULL;
 2161|       |
 2162|       |    /*
 2163|       |     * The following is necessary to avoid memory leakage when closing AgentX 
 2164|       |     * sessions that may have multiple subsessions.  These hang off the main
 2165|       |     * session at ->subsession, and chain through ->next.  
 2166|       |     */
 2167|       |
 2168|     57|    if (sesp != NULL && sesp->subsession != NULL) {
  ------------------
  |  Branch (2168:9): [True: 57, False: 0]
  |  Branch (2168:25): [True: 0, False: 57]
  ------------------
 2169|      0|        netsnmp_session *subsession = sesp->subsession, *tmpsub;
 2170|       |
 2171|      0|        while (subsession != NULL) {
  ------------------
  |  Branch (2171:16): [True: 0, False: 0]
  ------------------
 2172|      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]
  |  |  ------------------
  ------------------
 2173|      0|                        "closing session %p, subsession %p\n", sesp,
 2174|      0|                        subsession));
 2175|      0|            tmpsub = subsession->next;
 2176|      0|            snmp_free_session(subsession);
 2177|      0|            subsession = tmpsub;
 2178|      0|        }
 2179|      0|    }
 2180|       |
 2181|     57|    snmp_free_session(sesp);
 2182|     57|    free(slp);
 2183|     57|    return 1;
 2184|     57|}
snmp_close:
 2188|     57|{
 2189|     57|    struct session_list *slp = NULL, *oslp = NULL;
 2190|       |
 2191|     57|    {                           /*MTCRITICAL_RESOURCE */
 2192|     57|        snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     57|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 57]
  |  |  ------------------
  ------------------
 2193|     57|        if (Sessions && Sessions->session == session) { /* If first entry */
  ------------------
  |  Branch (2193:13): [True: 0, False: 57]
  |  Branch (2193:25): [True: 0, False: 0]
  ------------------
 2194|      0|            slp = Sessions;
 2195|      0|            Sessions = slp->next;
 2196|     57|        } else {
 2197|     57|            for (slp = Sessions; slp; slp = slp->next) {
  ------------------
  |  Branch (2197:34): [True: 0, False: 57]
  ------------------
 2198|      0|                if (slp->session == session) {
  ------------------
  |  Branch (2198:21): [True: 0, False: 0]
  ------------------
 2199|      0|                    if (oslp)   /* if we found entry that points here */
  ------------------
  |  Branch (2199:25): [True: 0, False: 0]
  ------------------
 2200|      0|                        oslp->next = slp->next; /* link around this entry */
 2201|      0|                    break;
 2202|      0|                }
 2203|      0|                oslp = slp;
 2204|      0|            }
 2205|     57|        }
 2206|     57|        snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     57|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 57]
  |  |  ------------------
  ------------------
 2207|     57|    }                           /*END MTCRITICAL_RESOURCE */
 2208|     57|    if (slp == NULL) {
  ------------------
  |  Branch (2208:9): [True: 57, False: 0]
  ------------------
 2209|     57|        return 0;
 2210|     57|    }
 2211|      0|    return snmp_sess_close(slp);
 2212|     57|}
snmp_close_sessions:
 2216|     57|{
 2217|     57|    struct session_list *slp;
 2218|       |
 2219|     57|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     57|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 57]
  |  |  ------------------
  ------------------
 2220|    114|    while (Sessions) {
  ------------------
  |  Branch (2220:12): [True: 57, False: 57]
  ------------------
 2221|     57|        slp = Sessions;
 2222|     57|        Sessions = Sessions->next;
 2223|     57|        snmp_sess_close(slp);
 2224|     57|    }
 2225|     57|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     57|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 57]
  |  |  ------------------
  ------------------
 2226|     57|    return 1;
 2227|     57|}
snmpv3_header_realloc_rbuild:
 2592|     13|{
 2593|     13|    size_t          start_offset = *offset;
 2594|     13|    u_char          msg_flags;
 2595|     13|    long            max_size, sec_model;
 2596|     13|    int             rc = 0;
 2597|       |
 2598|       |    /*
 2599|       |     * msgSecurityModel.  
 2600|       |     */
 2601|     13|    sec_model = pdu->securityModel;
 2602|     13|    DEBUGDUMPHEADER("send", "msgSecurityModel");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 2603|     13|    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 2604|     13|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2605|     13|                                          ASN_INTEGER), &sec_model,
  ------------------
  |  |   75|     13|#define ASN_INTEGER	    0x02U
  ------------------
 2606|     13|                                sizeof(sec_model));
 2607|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2608|     13|    if (rc == 0) {
  ------------------
  |  Branch (2608:9): [True: 0, False: 13]
  ------------------
 2609|      0|        return 0;
 2610|      0|    }
 2611|       |
 2612|       |    /*
 2613|       |     * msgFlags.  
 2614|       |     */
 2615|     13|    snmpv3_calc_msg_flags(pdu->securityLevel, pdu->command, &msg_flags);
 2616|     13|    DEBUGDUMPHEADER("send", "msgFlags");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 2617|     13|    rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 2618|     13|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2619|     13|                                             | ASN_OCTET_STR), &msg_flags,
  ------------------
  |  |   78|     13|#define ASN_OCTET_STR	    0x04U
  ------------------
 2620|     13|                                   sizeof(msg_flags));
 2621|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2622|     13|    if (rc == 0) {
  ------------------
  |  Branch (2622:9): [True: 0, False: 13]
  ------------------
 2623|      0|        return 0;
 2624|      0|    }
 2625|       |
 2626|       |    /*
 2627|       |     * msgMaxSize.  
 2628|       |     */
 2629|     13|    max_size = netsnmp_max_send_msg_size();
 2630|     13|    if (session->rcvMsgMaxSize < max_size)
  ------------------
  |  Branch (2630:9): [True: 13, False: 0]
  ------------------
 2631|     13|        max_size = session->rcvMsgMaxSize;
 2632|     13|    DEBUGDUMPHEADER("send:msgMaxSize2", "msgMaxSize");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 2633|     13|    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 2634|     13|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2635|     13|                                          ASN_INTEGER), &max_size,
  ------------------
  |  |   75|     13|#define ASN_INTEGER	    0x02U
  ------------------
 2636|     13|                                sizeof(max_size));
 2637|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2638|     13|    if (rc == 0) {
  ------------------
  |  Branch (2638:9): [True: 0, False: 13]
  ------------------
 2639|      0|        return 0;
 2640|      0|    }
 2641|       |
 2642|       |    /*
 2643|       |     * msgID.  
 2644|       |     */
 2645|     13|    DEBUGDUMPHEADER("send", "msgID");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 2646|     13|    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 2647|     13|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2648|     13|                                          ASN_INTEGER), &pdu->msgid,
  ------------------
  |  |   75|     13|#define ASN_INTEGER	    0x02U
  ------------------
 2649|     13|                                sizeof(pdu->msgid));
 2650|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2651|     13|    if (rc == 0) {
  ------------------
  |  Branch (2651:9): [True: 0, False: 13]
  ------------------
 2652|      0|        return 0;
 2653|      0|    }
 2654|       |
 2655|       |    /*
 2656|       |     * Global data sequence.  
 2657|       |     */
 2658|     13|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 2659|     13|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|     13|#define ASN_SEQUENCE	    0x10U
  ------------------
 2660|     13|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2661|     13|                                     *offset - start_offset);
 2662|     13|    if (rc == 0) {
  ------------------
  |  Branch (2662:9): [True: 0, False: 13]
  ------------------
 2663|      0|        return 0;
 2664|      0|    }
 2665|       |
 2666|       |    /*
 2667|       |     * Store the version field - msgVersion.  
 2668|       |     */
 2669|     13|    DEBUGDUMPHEADER("send", "SNMP Version Number");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 2670|     13|    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 2671|     13|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2672|     13|                                          ASN_INTEGER),
  ------------------
  |  |   75|     13|#define ASN_INTEGER	    0x02U
  ------------------
 2673|     13|                                (long *) &pdu->version,
 2674|     13|                                sizeof(pdu->version));
 2675|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2676|     13|    return rc;
 2677|     13|}                               /* end snmpv3_header_realloc_rbuild() */
snmpv3_scopedPDU_header_realloc_rbuild:
 2722|     13|{
 2723|     13|    size_t          start_offset = *offset;
 2724|     13|    int             rc = 0;
 2725|       |
 2726|       |    /*
 2727|       |     * contextName.  
 2728|       |     */
 2729|     13|    DEBUGDUMPHEADER("send", "contextName");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 2730|     13|    rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 2731|     13|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2732|     13|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|     13|#define ASN_OCTET_STR	    0x04U
  ------------------
 2733|     13|                                   (u_char *) pdu->contextName,
 2734|     13|                                   pdu->contextNameLen);
 2735|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2736|     13|    if (rc == 0) {
  ------------------
  |  Branch (2736:9): [True: 0, False: 13]
  ------------------
 2737|      0|        return 0;
 2738|      0|    }
 2739|       |
 2740|       |    /*
 2741|       |     * contextEngineID.  
 2742|       |     */
 2743|     13|    DEBUGDUMPHEADER("send", "contextEngineID");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 2744|     13|    rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 2745|     13|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2746|     13|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|     13|#define ASN_OCTET_STR	    0x04U
  ------------------
 2747|     13|                                   pdu->contextEngineID,
 2748|     13|                                   pdu->contextEngineIDLen);
 2749|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2750|     13|    if (rc == 0) {
  ------------------
  |  Branch (2750:9): [True: 0, False: 13]
  ------------------
 2751|      0|        return 0;
 2752|      0|    }
 2753|       |
 2754|     13|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 2755|     13|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|     13|#define ASN_SEQUENCE	    0x10U
  ------------------
 2756|     13|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2757|     13|                                     *offset - start_offset + body_len);
 2758|       |
 2759|     13|    return rc;
 2760|     13|}                               /* end snmpv3_scopedPDU_header_realloc_rbuild() */
snmpv3_packet_realloc_rbuild:
 2772|     13|{
 2773|     13|    u_char         *scoped_pdu, *hdrbuf = NULL, *hdr = NULL;
 2774|     13|    size_t          hdrbuf_len = SNMP_MAX_MSG_V3_HDRS, hdr_offset =
  ------------------
  |  |  110|     13|#define SNMP_MAX_MSG_V3_HDRS       (4+3+4+7+7+3+7+16)   /* fudge factor=16 */
  ------------------
 2775|     13|        0, spdu_offset = 0;
 2776|     13|    size_t          body_end_offset = *offset, body_len = 0;
 2777|     13|    struct snmp_secmod_def *sptr = NULL;
 2778|     13|    int             rc = 0;
 2779|       |
 2780|       |    /*
 2781|       |     * Build a scopedPDU structure into the packet buffer.  
 2782|       |     */
 2783|     13|    DEBUGPRINTPDUTYPE("send", pdu->command);
  ------------------
  |  |  440|     13|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   81|     13|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	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: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2784|     13|    if (pdu_data) {
  ------------------
  |  Branch (2784:9): [True: 0, False: 13]
  ------------------
 2785|      0|        while ((*pkt_len - *offset) < pdu_data_len) {
  ------------------
  |  Branch (2785:16): [True: 0, False: 0]
  ------------------
 2786|      0|            if (!asn_realloc(pkt, pkt_len)) {
  ------------------
  |  Branch (2786:17): [True: 0, False: 0]
  ------------------
 2787|      0|                return -1;
 2788|      0|            }
 2789|      0|        }
 2790|       |
 2791|      0|        *offset += pdu_data_len;
 2792|      0|        memcpy(*pkt + *pkt_len - *offset, pdu_data, pdu_data_len);
 2793|     13|    } else {
 2794|     13|        rc = snmp_pdu_realloc_rbuild(pkt, pkt_len, offset, pdu);
 2795|     13|        if (rc == 0) {
  ------------------
  |  Branch (2795:13): [True: 0, False: 13]
  ------------------
 2796|      0|            return -1;
 2797|      0|        }
 2798|     13|    }
 2799|     13|    body_len = *offset - body_end_offset;
 2800|       |
 2801|     13|    DEBUGDUMPSECTION("send", "ScopedPdu");
  ------------------
  |  |   81|     13|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 13]
  |  |  ------------------
  ------------------
 2802|     13|    rc = snmpv3_scopedPDU_header_realloc_rbuild(pkt, pkt_len, offset,
 2803|     13|                                                pdu, body_len);
 2804|     13|    if (rc == 0) {
  ------------------
  |  Branch (2804:9): [True: 0, False: 13]
  ------------------
 2805|      0|        return -1;
 2806|      0|    }
 2807|     13|    spdu_offset = *offset;
 2808|     13|    DEBUGINDENTADD(-4);         /*  Return from Scoped PDU.  */
  ------------------
  |  |   73|     13|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 13]
  |  |  ------------------
  ------------------
 2809|       |
 2810|     13|    if ((hdrbuf = (u_char *) malloc(hdrbuf_len)) == NULL) {
  ------------------
  |  Branch (2810:9): [True: 0, False: 13]
  ------------------
 2811|      0|        return -1;
 2812|      0|    }
 2813|       |
 2814|     13|    rc = snmpv3_header_realloc_rbuild(&hdrbuf, &hdrbuf_len, &hdr_offset,
 2815|     13|                                      session, pdu);
 2816|     13|    if (rc == 0) {
  ------------------
  |  Branch (2816:9): [True: 0, False: 13]
  ------------------
 2817|      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]
  |  |  ------------------
  ------------------
 2818|      0|        return -1;
 2819|      0|    }
 2820|     13|    hdr = hdrbuf + hdrbuf_len - hdr_offset;
 2821|     13|    scoped_pdu = *pkt + *pkt_len - spdu_offset;
 2822|       |
 2823|       |    /*
 2824|       |     * Call the security module to possibly encrypt and authenticate the
 2825|       |     * message---the entire message to transmitted on the wire is returned.  
 2826|       |     */
 2827|       |
 2828|     13|    sptr = find_sec_mod(pdu->securityModel);
 2829|     13|    DEBUGDUMPSECTION("send", "SM msgSecurityParameters");
  ------------------
  |  |   81|     13|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 13]
  |  |  ------------------
  ------------------
 2830|     13|    if (sptr && sptr->encode_reverse) {
  ------------------
  |  Branch (2830:9): [True: 13, False: 0]
  |  Branch (2830:17): [True: 13, False: 0]
  ------------------
 2831|     13|        struct snmp_secmod_outgoing_params parms;
 2832|       |
 2833|     13|        parms.msgProcModel = pdu->msgParseModel;
 2834|     13|        parms.globalData = hdr;
 2835|     13|        parms.globalDataLen = hdr_offset;
 2836|     13|        parms.maxMsgSize = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  109|     13|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 2837|     13|        parms.secModel = pdu->securityModel;
 2838|     13|        parms.secEngineID = pdu->securityEngineID;
 2839|     13|        parms.secEngineIDLen = pdu->securityEngineIDLen;
 2840|     13|        parms.secName = pdu->securityName;
 2841|     13|        parms.secNameLen = pdu->securityNameLen;
 2842|     13|        parms.secLevel = pdu->securityLevel;
 2843|     13|        parms.scopedPdu = scoped_pdu;
 2844|     13|        parms.scopedPduLen = spdu_offset;
 2845|     13|        parms.secStateRef = pdu->securityStateRef;
 2846|     13|        parms.wholeMsg = pkt;
 2847|     13|        parms.wholeMsgLen = pkt_len;
 2848|     13|        parms.wholeMsgOffset = offset;
 2849|     13|        parms.session = session;
 2850|     13|        parms.pdu = pdu;
 2851|       |
 2852|     13|        rc = (*sptr->encode_reverse) (&parms);
 2853|     13|    } else {
 2854|      0|        if (!sptr) {
  ------------------
  |  Branch (2854:13): [True: 0, False: 0]
  ------------------
 2855|      0|            snmp_log(LOG_ERR,
 2856|      0|                     "no such security service available: %d\n",
 2857|      0|                     pdu->securityModel);
 2858|      0|        } else if (!sptr->encode_reverse) {
  ------------------
  |  Branch (2858:20): [True: 0, False: 0]
  ------------------
 2859|      0|            snmp_log(LOG_ERR,
 2860|      0|                     "security service %d doesn't support reverse encoding.\n",
 2861|      0|                     pdu->securityModel);
 2862|      0|        }
 2863|      0|        rc = -1;
 2864|      0|    }
 2865|       |
 2866|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2867|       |    SNMP_FREE(hdrbuf);
  ------------------
  |  |   62|     13|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 13, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2868|     13|    return rc;
 2869|     13|}                               /* end snmpv3_packet_realloc_rbuild() */
snmp_build:
 3373|     13|{
 3374|     13|    int             rc;
 3375|       |
 3376|     13|    rc = _snmp_build(pkt, pkt_len, offset, pss, pdu);
 3377|     13|    if (rc) {
  ------------------
  |  Branch (3377:9): [True: 0, False: 13]
  ------------------
 3378|      0|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (3378:13): [True: 0, False: 0]
  ------------------
 3379|      0|            snmp_log(LOG_ERR, "snmp_build: unknown failure\n");
 3380|      0|            pss->s_snmp_errno = SNMPERR_BAD_ASN1_BUILD;
  ------------------
  |  |  195|      0|#define SNMPERR_BAD_ASN1_BUILD		(-11)
  ------------------
 3381|      0|        }
 3382|      0|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   43|      0|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 3383|      0|        rc = -1;
 3384|      0|    }
 3385|     13|    return rc;
 3386|     13|}
snmp_pdu_realloc_rbuild:
 3605|     13|{
 3606|     13|#ifndef VPCACHE_SIZE
 3607|     13|#define VPCACHE_SIZE 50
 3608|     13|#endif
 3609|     13|    netsnmp_variable_list *vpcache[VPCACHE_SIZE];
 3610|     13|    netsnmp_variable_list *vp, *tmpvp;
 3611|     13|    size_t          start_offset = *offset;
 3612|     13|    int             i, wrapped = 0, notdone, final, rc = 0;
 3613|       |
 3614|     13|    DEBUGMSGTL(("snmp_pdu_realloc_rbuild", "starting\n"));
  ------------------
  |  |   66|     13|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 13]
  |  |  ------------------
  ------------------
 3615|     26|    for (vp = pdu->variables, i = VPCACHE_SIZE - 1; vp;
  ------------------
  |  | 3607|     13|#define VPCACHE_SIZE 50
  ------------------
  |  Branch (3615:53): [True: 13, False: 13]
  ------------------
 3616|     13|         vp = vp->next_variable, i--) {
 3617|       |        /*
 3618|       |         * if estimated getbulk response size exceeded packet max size,
 3619|       |         * processing was stopped before bulk cache was filled and type
 3620|       |         * was set to ASN_PRIV_STOP, indicating that the rest of the varbinds
 3621|       |         * in the cache are empty and we can stop encoding them.
 3622|       |         */
 3623|     13|        if (ASN_PRIV_STOP == vp->type)
  ------------------
  |  |  207|     13|#define ASN_PRIV_STOP       (ASN_PRIVATE | 8)   /* 200 */
  |  |  ------------------
  |  |  |  |   93|     13|#define ASN_PRIVATE	    0xC0U
  |  |  ------------------
  ------------------
  |  Branch (3623:13): [True: 0, False: 13]
  ------------------
 3624|      0|            break;
 3625|     13|        if (i < 0) {
  ------------------
  |  Branch (3625:13): [True: 0, False: 13]
  ------------------
 3626|      0|            wrapped = notdone = 1;
 3627|      0|            i = VPCACHE_SIZE - 1;
  ------------------
  |  | 3607|      0|#define VPCACHE_SIZE 50
  ------------------
 3628|      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]
  |  |  ------------------
  ------------------
 3629|      0|        }
 3630|     13|        vpcache[i] = vp;
 3631|     13|    }
 3632|     13|    final = i + 1;
 3633|       |
 3634|     13|    do {
 3635|     26|        for (i = final; i < VPCACHE_SIZE; i++) {
  ------------------
  |  | 3607|     26|#define VPCACHE_SIZE 50
  ------------------
  |  Branch (3635:25): [True: 13, False: 13]
  ------------------
 3636|     13|            vp = vpcache[i];
 3637|     13|            DEBUGDUMPSECTION("send", "VarBind");
  ------------------
  |  |   81|     13|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 13]
  |  |  ------------------
  ------------------
 3638|     13|            rc = snmp_realloc_rbuild_var_op(pkt, pkt_len, offset, 1,
 3639|     13|                                            vp->name, &vp->name_length,
 3640|     13|                                            vp->type,
 3641|     13|                                            (u_char *) vp->val.string,
 3642|     13|                                            vp->val_len);
 3643|     13|            DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 3644|     13|            if (rc == 0) {
  ------------------
  |  Branch (3644:17): [True: 0, False: 13]
  ------------------
 3645|      0|                return 0;
 3646|      0|            }
 3647|     13|        }
 3648|       |
 3649|     13|        DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 3650|     13|        if (wrapped) {
  ------------------
  |  Branch (3650:13): [True: 0, False: 13]
  ------------------
 3651|      0|            notdone = 1;
 3652|      0|            for (i = 0; i < final; i++) {
  ------------------
  |  Branch (3652:25): [True: 0, False: 0]
  ------------------
 3653|      0|                vp = vpcache[i];
 3654|      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]
  |  |  ------------------
  ------------------
 3655|      0|                rc = snmp_realloc_rbuild_var_op(pkt, pkt_len, offset, 1,
 3656|      0|                                                vp->name, &vp->name_length,
 3657|      0|                                                vp->type,
 3658|      0|                                                (u_char *) vp->val.string,
 3659|      0|                                                vp->val_len);
 3660|      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]
  |  |  ------------------
  ------------------
 3661|      0|                if (rc == 0) {
  ------------------
  |  Branch (3661:21): [True: 0, False: 0]
  ------------------
 3662|      0|                    return 0;
 3663|      0|                }
 3664|      0|            }
 3665|       |
 3666|      0|            if (final == 0) {
  ------------------
  |  Branch (3666:17): [True: 0, False: 0]
  ------------------
 3667|      0|                tmpvp = vpcache[VPCACHE_SIZE - 1];
  ------------------
  |  | 3607|      0|#define VPCACHE_SIZE 50
  ------------------
 3668|      0|            } else {
 3669|      0|                tmpvp = vpcache[final - 1];
 3670|      0|            }
 3671|      0|            wrapped = 0;
 3672|       |
 3673|      0|            for (vp = pdu->variables, i = VPCACHE_SIZE - 1;
  ------------------
  |  | 3607|      0|#define VPCACHE_SIZE 50
  ------------------
 3674|      0|                 vp && vp != tmpvp; vp = vp->next_variable, i--) {
  ------------------
  |  Branch (3674:18): [True: 0, False: 0]
  |  Branch (3674:24): [True: 0, False: 0]
  ------------------
 3675|      0|                if (i < 0) {
  ------------------
  |  Branch (3675:21): [True: 0, False: 0]
  ------------------
 3676|      0|                    wrapped = 1;
 3677|      0|                    i = VPCACHE_SIZE - 1;
  ------------------
  |  | 3607|      0|#define VPCACHE_SIZE 50
  ------------------
 3678|      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]
  |  |  ------------------
  ------------------
 3679|      0|                }
 3680|      0|                vpcache[i] = vp;
 3681|      0|            }
 3682|      0|            final = i + 1;
 3683|     13|        } else {
 3684|     13|            notdone = 0;
 3685|     13|        }
 3686|     13|    } while (notdone);
  ------------------
  |  Branch (3686:14): [True: 0, False: 13]
  ------------------
 3687|       |
 3688|       |    /*
 3689|       |     * Save current location and build SEQUENCE tag and length placeholder for
 3690|       |     * variable-bindings sequence (actual length will be inserted later).  
 3691|       |     */
 3692|       |
 3693|     13|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 3694|     13|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|     13|#define ASN_SEQUENCE	    0x10U
  ------------------
 3695|     13|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3696|     13|                                     *offset - start_offset);
 3697|       |
 3698|       |    /*
 3699|       |     * Store fields in the PDU preceding the variable-bindings sequence.
 3700|       |     */
 3701|     13|    if (pdu->command != SNMP_MSG_TRAP) {
  ------------------
  |  |  135|     13|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3701:9): [True: 13, False: 0]
  ------------------
 3702|       |        /*
 3703|       |         * Error index (getbulk max-repetitions).  
 3704|       |         */
 3705|     13|        DEBUGDUMPHEADER("send", "error index");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 3706|     13|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3707|     13|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3708|     13|                                              | ASN_INTEGER),
  ------------------
  |  |   75|     13|#define ASN_INTEGER	    0x02U
  ------------------
 3709|     13|                                    &pdu->errindex, sizeof(pdu->errindex));
 3710|     13|        DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 3711|     13|        if (rc == 0) {
  ------------------
  |  Branch (3711:13): [True: 0, False: 13]
  ------------------
 3712|      0|            return 0;
 3713|      0|        }
 3714|       |
 3715|       |        /*
 3716|       |         * Error status (getbulk non-repeaters).  
 3717|       |         */
 3718|     13|        DEBUGDUMPHEADER("send", "error status");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 3719|     13|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3720|     13|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3721|     13|                                              | ASN_INTEGER),
  ------------------
  |  |   75|     13|#define ASN_INTEGER	    0x02U
  ------------------
 3722|     13|                                    &pdu->errstat, sizeof(pdu->errstat));
 3723|     13|        DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 3724|     13|        if (rc == 0) {
  ------------------
  |  Branch (3724:13): [True: 0, False: 13]
  ------------------
 3725|      0|            return 0;
 3726|      0|        }
 3727|       |
 3728|       |        /*
 3729|       |         * Request ID.  
 3730|       |         */
 3731|     13|        DEBUGDUMPHEADER("send", "request_id");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 3732|     13|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3733|     13|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3734|     13|                                              | ASN_INTEGER), &pdu->reqid,
  ------------------
  |  |   75|     13|#define ASN_INTEGER	    0x02U
  ------------------
 3735|     13|                                    sizeof(pdu->reqid));
 3736|     13|        DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 3737|     13|        if (rc == 0) {
  ------------------
  |  Branch (3737:13): [True: 0, False: 13]
  ------------------
 3738|      0|            return 0;
 3739|      0|        }
 3740|     13|    } else {
 3741|       |        /*
 3742|       |         * An SNMPv1 trap PDU.  
 3743|       |         */
 3744|       |
 3745|       |        /*
 3746|       |         * Timestamp.  
 3747|       |         */
 3748|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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]
  |  |  ------------------
  ------------------
 3749|      0|        rc = asn_realloc_rbuild_unsigned_int(pkt, pkt_len, offset, 1,
 3750|      0|                                             (u_char) (ASN_TIMETICKS |
  ------------------
  |  |   92|      0|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
 3751|      0|                                                       ASN_PRIMITIVE),
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3752|      0|                                             &pdu->time,
 3753|      0|                                             sizeof(pdu->time));
 3754|      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]
  |  |  ------------------
  ------------------
 3755|      0|        if (rc == 0) {
  ------------------
  |  Branch (3755:13): [True: 0, False: 0]
  ------------------
 3756|      0|            return 0;
 3757|      0|        }
 3758|       |
 3759|       |        /*
 3760|       |         * Specific trap.  
 3761|       |         */
 3762|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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]
  |  |  ------------------
  ------------------
 3763|      0|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3764|      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
  ------------------
 3765|      0|                                              | ASN_INTEGER),
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
 3766|      0|                                    (const long *) &pdu->specific_type,
 3767|      0|                                    sizeof(pdu->specific_type));
 3768|      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]
  |  |  ------------------
  ------------------
 3769|      0|        if (rc == 0) {
  ------------------
  |  Branch (3769:13): [True: 0, False: 0]
  ------------------
 3770|      0|            return 0;
 3771|      0|        }
 3772|       |
 3773|       |        /*
 3774|       |         * Generic trap.  
 3775|       |         */
 3776|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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]
  |  |  ------------------
  ------------------
 3777|      0|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3778|      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
  ------------------
 3779|      0|                                              | ASN_INTEGER),
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
 3780|      0|                                    (const long *) &pdu->trap_type,
 3781|      0|                                    sizeof(pdu->trap_type));
 3782|      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]
  |  |  ------------------
  ------------------
 3783|      0|        if (rc == 0) {
  ------------------
  |  Branch (3783:13): [True: 0, False: 0]
  ------------------
 3784|      0|            return 0;
 3785|      0|        }
 3786|       |
 3787|       |        /*
 3788|       |         * Agent-addr.  
 3789|       |         */
 3790|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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]
  |  |  ------------------
  ------------------
 3791|      0|        rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 3792|      0|                                       (u_char) (ASN_IPADDRESS |
  ------------------
  |  |   88|      0|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
 3793|      0|                                                 ASN_PRIMITIVE),
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3794|      0|                                       (const u_char *) pdu->agent_addr, 4);
 3795|      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]
  |  |  ------------------
  ------------------
 3796|      0|        if (rc == 0) {
  ------------------
  |  Branch (3796:13): [True: 0, False: 0]
  ------------------
 3797|      0|            return 0;
 3798|      0|        }
 3799|       |
 3800|       |        /*
 3801|       |         * Enterprise.  
 3802|       |         */
 3803|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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]
  |  |  ------------------
  ------------------
 3804|      0|        rc = asn_realloc_rbuild_objid(pkt, pkt_len, offset, 1,
 3805|      0|                                      (u_char) (ASN_UNIVERSAL |
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
 3806|      0|                                                ASN_PRIMITIVE |
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3807|      0|                                                ASN_OBJECT_ID),
  ------------------
  |  |   81|      0|#define ASN_OBJECT_ID	    0x06U
  ------------------
 3808|      0|                                      (oid *) pdu->enterprise,
 3809|      0|                                      pdu->enterprise_length);
 3810|      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]
  |  |  ------------------
  ------------------
 3811|      0|        if (rc == 0) {
  ------------------
  |  Branch (3811:13): [True: 0, False: 0]
  ------------------
 3812|      0|            return 0;
 3813|      0|        }
 3814|      0|    }
 3815|       |
 3816|       |    /*
 3817|       |     * Build the PDU sequence.  
 3818|       |     */
 3819|     13|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 3820|     13|                                     (u_char) pdu->command,
 3821|     13|                                     *offset - start_offset);
 3822|     13|    return rc;
 3823|     13|}
snmpv3_parse:
 3856|     39|{
 3857|     39|    u_char          type, msg_flags;
 3858|     39|    long            ver, msg_sec_model;
 3859|     39|    size_t          max_size_response;
 3860|     39|    u_char          tmp_buf[SNMP_MAX_MSG_SIZE];
 3861|     39|    size_t          tmp_buf_len;
 3862|     39|    u_char          pdu_buf[SNMP_MAX_MSG_SIZE];
 3863|     39|    u_char         *mallocbuf = NULL;
 3864|     39|    size_t          pdu_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  109|     39|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 3865|     39|    u_char         *sec_params;
 3866|     39|    u_char         *msg_data;
 3867|     39|    u_char         *cp;
 3868|     39|    size_t          asn_len, msg_len;
 3869|     39|    int             ret, ret_val;
 3870|     39|    struct snmp_secmod_def *sptr;
 3871|       |
 3872|       |
 3873|     39|    msg_data = data;
 3874|     39|    msg_len = *length;
 3875|       |
 3876|       |
 3877|       |    /*
 3878|       |     * message is an ASN.1 SEQUENCE  
 3879|       |     */
 3880|     39|    DEBUGDUMPSECTION("recv", "SNMPv3 Message");
  ------------------
  |  |   81|     39|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     39|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 39]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 39]
  |  |  ------------------
  ------------------
 3881|     39|    data = asn_parse_sequence(data, length, &type,
 3882|     39|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   84|     39|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   96|     39|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3883|     39|    if (data == NULL) {
  ------------------
  |  Branch (3883:9): [True: 0, False: 39]
  ------------------
 3884|       |        /*
 3885|       |         * error msg detail is set 
 3886|       |         */
 3887|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3888|      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]
  |  |  ------------------
  ------------------
 3889|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3890|      0|    }
 3891|       |
 3892|       |    /*
 3893|       |     * parse msgVersion  
 3894|       |     */
 3895|     39|    DEBUGDUMPHEADER("recv", "SNMP Version Number");
  ------------------
  |  |   79|     39|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     39|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 39]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 39]
  |  |  ------------------
  ------------------
 3896|     39|    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
 3897|     39|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     39|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     39|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 39]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 39]
  |  |  ------------------
  ------------------
 3898|     39|    if (data == NULL) {
  ------------------
  |  Branch (3898:9): [True: 0, False: 39]
  ------------------
 3899|      0|        ERROR_MSG("bad parse of version");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3900|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3901|      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]
  |  |  ------------------
  ------------------
 3902|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3903|      0|    }
 3904|     39|    pdu->version = ver;
 3905|       |
 3906|       |    /*
 3907|       |     * parse msgGlobalData sequence  
 3908|       |     */
 3909|     39|    cp = data;
 3910|     39|    asn_len = *length;
 3911|     39|    DEBUGDUMPSECTION("recv", "msgGlobalData");
  ------------------
  |  |   81|     39|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     39|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 39]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 39]
  |  |  ------------------
  ------------------
 3912|     39|    data = asn_parse_sequence(data, &asn_len, &type,
 3913|     39|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|     39|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|     39|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3914|     39|                              "msgGlobalData");
 3915|     39|    if (data == NULL) {
  ------------------
  |  Branch (3915:9): [True: 2, False: 37]
  ------------------
 3916|       |        /*
 3917|       |         * error msg detail is set 
 3918|       |         */
 3919|      2|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      2|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3920|      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]
  |  |  ------------------
  ------------------
 3921|      2|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      2|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3922|      2|    }
 3923|     37|    *length -= data - cp;       /* subtract off the length of the header */
 3924|       |
 3925|       |    /*
 3926|       |     * msgID 
 3927|       |     */
 3928|     37|    DEBUGDUMPHEADER("recv", "msgID");
  ------------------
  |  |   79|     37|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     37|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 37]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 37]
  |  |  ------------------
  ------------------
 3929|     37|    data =
 3930|     37|        asn_parse_int(data, length, &type, &pdu->msgid,
 3931|     37|                      sizeof(pdu->msgid));
 3932|     37|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     37|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     37|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 37]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 37]
  |  |  ------------------
  ------------------
 3933|     37|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|     30|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3933:9): [True: 7, False: 30]
  |  Branch (3933:25): [True: 0, False: 30]
  ------------------
 3934|      7|        ERROR_MSG("error parsing msgID");
  ------------------
  |  |  188|      7|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3935|      7|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      7|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      7|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 7]
  |  |  ------------------
  ------------------
 3936|      7|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      7|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3937|      7|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      7|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3938|      7|    }
 3939|       |
 3940|       |    /*
 3941|       |     * Check the msgID we received is a legal value.  If not, then increment
 3942|       |     * snmpInASNParseErrs and return the appropriate error (see RFC 2572,
 3943|       |     * para. 7.2, section 2 -- note that a bad msgID means that the received
 3944|       |     * message is NOT a serialization of an SNMPv3Message, since the msgID
 3945|       |     * field is out of bounds).  
 3946|       |     */
 3947|       |
 3948|     30|    if (pdu->msgid < 0 || pdu->msgid > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|     29|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3948:9): [True: 1, False: 29]
  |  Branch (3948:27): [True: 0, False: 29]
  ------------------
 3949|      1|        snmp_log(LOG_ERR, "Received bad msgID (%ld %s %s).\n", pdu->msgid,
 3950|      1|                 (pdu->msgid < 0) ? "<" : ">",
  ------------------
  |  Branch (3950:18): [True: 1, False: 0]
  ------------------
 3951|      1|                 (pdu->msgid < 0) ? "0" : "2^31 - 1");
  ------------------
  |  Branch (3951:18): [True: 1, False: 0]
  ------------------
 3952|      1|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      1|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3953|      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]
  |  |  ------------------
  ------------------
 3954|      1|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      1|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3955|      1|    }
 3956|       |
 3957|       |    /*
 3958|       |     * msgMaxSize 
 3959|       |     */
 3960|     29|    DEBUGDUMPHEADER("recv:msgMaxSize", "msgMaxSize");
  ------------------
  |  |   79|     29|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     29|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 29]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 29]
  |  |  ------------------
  ------------------
 3961|     29|    data = asn_parse_int(data, length, &type, &pdu->msgMaxSize,
 3962|     29|                         sizeof(pdu->msgMaxSize));
 3963|     29|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     29|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     29|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 29]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 29]
  |  |  ------------------
  ------------------
 3964|     29|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|     29|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3964:9): [True: 0, False: 29]
  |  Branch (3964:25): [True: 0, False: 29]
  ------------------
 3965|      0|        ERROR_MSG("error parsing msgMaxSize");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3966|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3967|      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]
  |  |  ------------------
  ------------------
 3968|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3969|      0|    }
 3970|       |
 3971|       |    /*
 3972|       |     * Check the msgMaxSize we received is a legal value.  If not, then
 3973|       |     * increment snmpInASNParseErrs and return the appropriate error (see RFC
 3974|       |     * 2572, para. 7.2, section 2 -- note that a bad msgMaxSize means that the
 3975|       |     * received message is NOT a serialization of an SNMPv3Message, since the
 3976|       |     * msgMaxSize field is out of bounds).
 3977|       |     */
 3978|       |
 3979|     29|    if (pdu->msgMaxSize < SNMP_MIN_MAX_LEN) {
  ------------------
  |  |   48|     29|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (3979:9): [True: 1, False: 28]
  ------------------
 3980|      1|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu < 484).\n",
 3981|      1|                 pdu->msgMaxSize);
 3982|      1|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      1|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3983|      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]
  |  |  ------------------
  ------------------
 3984|      1|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      1|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3985|     28|    } else if (pdu->msgMaxSize > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|     28|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3985:16): [True: 1, False: 27]
  ------------------
 3986|      1|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu > 2^31 - 1).\n",
 3987|      1|                 pdu->msgMaxSize);
 3988|      1|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      1|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3989|      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]
  |  |  ------------------
  ------------------
 3990|      1|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      1|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3991|     27|    } else {
 3992|     27|        DEBUGMSGTL(("snmpv3_parse:msgMaxSize", "msgMaxSize %lu received\n",
  ------------------
  |  |   66|     27|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     27|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 27]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 27]
  |  |  ------------------
  ------------------
 3993|     27|                    pdu->msgMaxSize));
 3994|       |        /** don't increase max msg size if we've already got one */
 3995|     27|        if (sess->sndMsgMaxSize < pdu->msgMaxSize) {
  ------------------
  |  Branch (3995:13): [True: 27, False: 0]
  ------------------
 3996|     27|            DEBUGMSGTL(("snmpv3_parse:msgMaxSize",
  ------------------
  |  |   66|     27|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     27|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 27]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 27]
  |  |  ------------------
  ------------------
 3997|     27|                        "msgMaxSize %" NETSNMP_PRIz "d greater than session max %ld; reducing\n",
 3998|     27|                        sess->sndMsgMaxSize, pdu->msgMaxSize));
 3999|     27|            pdu->msgMaxSize = sess->sndMsgMaxSize;
 4000|     27|        }
 4001|     27|    }
 4002|       |
 4003|       |    /*
 4004|       |     * msgFlags 
 4005|       |     */
 4006|     27|    tmp_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  109|     27|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 4007|     27|    DEBUGDUMPHEADER("recv", "msgFlags");
  ------------------
  |  |   79|     27|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     27|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 27]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 27]
  |  |  ------------------
  ------------------
 4008|     27|    data = asn_parse_string(data, length, &type, tmp_buf, &tmp_buf_len);
 4009|     27|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     27|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     27|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 27]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 27]
  |  |  ------------------
  ------------------
 4010|     27|    if (data == NULL || type != ASN_OCTET_STR || tmp_buf_len != 1) {
  ------------------
  |  |   78|     52|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (4010:9): [True: 2, False: 25]
  |  Branch (4010:25): [True: 0, False: 25]
  |  Branch (4010:50): [True: 0, False: 25]
  ------------------
 4011|      2|        ERROR_MSG("error parsing msgFlags");
  ------------------
  |  |  188|      2|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4012|      2|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      2|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4013|      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]
  |  |  ------------------
  ------------------
 4014|      2|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      2|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4015|      2|    }
 4016|     25|    msg_flags = *tmp_buf;
 4017|     25|    if (msg_flags & SNMP_MSG_FLAG_RPRT_BIT)
  ------------------
  |  |  305|     25|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (4017:9): [True: 23, False: 2]
  ------------------
 4018|     23|        pdu->flags |= SNMP_MSG_FLAG_RPRT_BIT;
  ------------------
  |  |  305|     23|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 4019|      2|    else
 4020|      2|        pdu->flags &= (~SNMP_MSG_FLAG_RPRT_BIT);
  ------------------
  |  |  305|      2|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 4021|       |
 4022|       |    /*
 4023|       |     * msgSecurityModel 
 4024|       |     */
 4025|     25|    DEBUGDUMPHEADER("recv", "msgSecurityModel");
  ------------------
  |  |   79|     25|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     25|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 25]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 25]
  |  |  ------------------
  ------------------
 4026|     25|    data = asn_parse_int(data, length, &type, &msg_sec_model,
 4027|     25|                         sizeof(msg_sec_model));
 4028|     25|    DEBUGINDENTADD(-4);         /* return from global data indent */
  ------------------
  |  |   73|     25|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     25|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 25]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 25]
  |  |  ------------------
  ------------------
 4029|     25|    if (data == NULL || type != ASN_INTEGER ||
  ------------------
  |  |   75|     48|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4029:9): [True: 2, False: 23]
  |  Branch (4029:25): [True: 0, False: 23]
  ------------------
 4030|     23|        msg_sec_model < 1 || msg_sec_model > 0x7fffffff) {
  ------------------
  |  Branch (4030:9): [True: 5, False: 18]
  |  Branch (4030:30): [True: 0, False: 18]
  ------------------
 4031|      7|        ERROR_MSG("error parsing msgSecurityModel");
  ------------------
  |  |  188|      7|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4032|      7|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      7|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4033|      7|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      7|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      7|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 7]
  |  |  ------------------
  ------------------
 4034|      7|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      7|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4035|      7|    }
 4036|     18|    sptr = find_sec_mod(msg_sec_model);
 4037|     18|    if (!sptr) {
  ------------------
  |  Branch (4037:9): [True: 0, False: 18]
  ------------------
 4038|      0|        snmp_log(LOG_WARNING, "unknown security model: %ld\n",
 4039|      0|                 msg_sec_model);
 4040|      0|        snmp_increment_statistic(STAT_SNMPUNKNOWNSECURITYMODELS);
  ------------------
  |  |  611|      0|#define   STAT_SNMPUNKNOWNSECURITYMODELS     0
  ------------------
 4041|      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]
  |  |  ------------------
  ------------------
 4042|      0|        return SNMPERR_UNKNOWN_SEC_MODEL;
  ------------------
  |  |  214|      0|#define SNMPERR_UNKNOWN_SEC_MODEL 	(-30)
  ------------------
 4043|      0|    }
 4044|     18|    pdu->securityModel = msg_sec_model;
 4045|       |
 4046|     18|    if (msg_flags & SNMP_MSG_FLAG_PRIV_BIT &&
  ------------------
  |  |  304|     36|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (4046:9): [True: 0, False: 18]
  ------------------
 4047|      0|        !(msg_flags & SNMP_MSG_FLAG_AUTH_BIT)) {
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (4047:9): [True: 0, False: 0]
  ------------------
 4048|      0|        ERROR_MSG("invalid message, illegal msgFlags");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4049|      0|        snmp_increment_statistic(STAT_SNMPINVALIDMSGS);
  ------------------
  |  |  612|      0|#define   STAT_SNMPINVALIDMSGS               1
  ------------------
 4050|      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]
  |  |  ------------------
  ------------------
 4051|      0|        return SNMPERR_INVALID_MSG;
  ------------------
  |  |  215|      0|#define SNMPERR_INVALID_MSG             (-31)
  ------------------
 4052|      0|    }
 4053|     18|    pdu->securityLevel = ((msg_flags & SNMP_MSG_FLAG_AUTH_BIT)
  ------------------
  |  |  303|     18|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (4053:27): [True: 17, False: 1]
  ------------------
 4054|     18|                          ? ((msg_flags & SNMP_MSG_FLAG_PRIV_BIT)
  ------------------
  |  |  304|     17|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (4054:30): [True: 0, False: 17]
  ------------------
 4055|     17|                             ? SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
 4056|     17|                             : SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|     17|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
 4057|     18|                          : SNMP_SEC_LEVEL_NOAUTH);
  ------------------
  |  |  299|      1|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4058|       |    /*
 4059|       |     * end of msgGlobalData 
 4060|       |     */
 4061|       |
 4062|       |    /*
 4063|       |     * securtityParameters OCTET STRING begins after msgGlobalData 
 4064|       |     */
 4065|     18|    sec_params = data;
 4066|     18|    pdu->contextEngineID = calloc(1, SNMP_MAX_ENG_SIZE);
  ------------------
  |  |  111|     18|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4067|     18|    pdu->contextEngineIDLen = SNMP_MAX_ENG_SIZE;
  ------------------
  |  |  111|     18|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4068|       |
 4069|       |    /*
 4070|       |     * Note: there is no length limit on the msgAuthoritativeEngineID field,
 4071|       |     * although we would EXPECT it to be limited to 32 (the SnmpEngineID TC
 4072|       |     * limit).  We'll use double that here to be on the safe side.  
 4073|       |     */
 4074|       |
 4075|     18|    pdu->securityEngineID = calloc(1, SNMP_MAX_ENG_SIZE * 2);
  ------------------
  |  |  111|     18|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4076|     18|    pdu->securityEngineIDLen = SNMP_MAX_ENG_SIZE * 2;
  ------------------
  |  |  111|     18|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4077|     18|    pdu->securityName = calloc(1, SNMP_MAX_SEC_NAME_SIZE);
  ------------------
  |  |  112|     18|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 4078|     18|    pdu->securityNameLen = SNMP_MAX_SEC_NAME_SIZE;
  ------------------
  |  |  112|     18|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 4079|       |
 4080|     18|    if ((pdu->securityName == NULL) ||
  ------------------
  |  Branch (4080:9): [True: 0, False: 18]
  ------------------
 4081|     18|        (pdu->securityEngineID == NULL) ||
  ------------------
  |  Branch (4081:9): [True: 0, False: 18]
  ------------------
 4082|     18|        (pdu->contextEngineID == NULL)) {
  ------------------
  |  Branch (4082:9): [True: 0, False: 18]
  ------------------
 4083|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4084|      0|    }
 4085|       |
 4086|     18|    if (pdu_buf_len < msg_len
  ------------------
  |  Branch (4086:9): [True: 0, False: 18]
  ------------------
 4087|      0|        && pdu->securityLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (4087:12): [True: 0, False: 0]
  ------------------
 4088|       |        /*
 4089|       |         * space needed is larger than we have in the default buffer 
 4090|       |         */
 4091|      0|        mallocbuf = calloc(1, msg_len);
 4092|      0|        pdu_buf_len = msg_len;
 4093|      0|        cp = mallocbuf;
 4094|     18|    } else {
 4095|     18|        memset(pdu_buf, 0, pdu_buf_len);
 4096|     18|        cp = pdu_buf;
 4097|     18|    }
 4098|       |
 4099|     18|    DEBUGDUMPSECTION("recv", "SM msgSecurityParameters");
  ------------------
  |  |   81|     18|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     18|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 18]
  |  |  ------------------
  ------------------
 4100|     18|    if (sptr->decode) {
  ------------------
  |  Branch (4100:9): [True: 18, False: 0]
  ------------------
 4101|     18|        struct snmp_secmod_incoming_params parms;
 4102|     18|        parms.msgProcModel = pdu->msgParseModel;
 4103|     18|        parms.maxMsgSize = pdu->msgMaxSize;
 4104|     18|        parms.secParams = sec_params;
 4105|     18|        parms.secModel = msg_sec_model;
 4106|     18|        parms.secLevel = pdu->securityLevel;
 4107|     18|        parms.wholeMsg = msg_data;
 4108|     18|        parms.wholeMsgLen = msg_len;
 4109|     18|        parms.secEngineID = pdu->securityEngineID;
 4110|     18|        parms.secEngineIDLen = &pdu->securityEngineIDLen;
 4111|     18|        parms.secName = pdu->securityName;
 4112|     18|        parms.secNameLen = &pdu->securityNameLen;
 4113|     18|        parms.scopedPdu = &cp;
 4114|     18|        parms.scopedPduLen = &pdu_buf_len;
 4115|     18|        parms.maxSizeResponse = &max_size_response;
 4116|     18|        parms.secStateRef = &pdu->securityStateRef;
 4117|     18|        parms.sess = sess;
 4118|     18|        parms.pdu = pdu;
 4119|     18|        parms.msg_flags = msg_flags;
 4120|     18|        ret_val = (*sptr->decode) (&parms);
 4121|     18|    } else {
 4122|      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]
  |  |  ------------------
  ------------------
 4123|      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]
  |  |  ------------------
  ------------------
 4124|      0|        snmp_log(LOG_WARNING, "security service %ld can't decode packets\n",
 4125|      0|                 msg_sec_model);
 4126|      0|        return (-1);
 4127|      0|    }
 4128|       |
 4129|     18|    if (ret_val != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|     18|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (4129:9): [True: 18, False: 0]
  ------------------
 4130|     18|        DEBUGDUMPSECTION("recv", "ScopedPDU");
  ------------------
  |  |   81|     18|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     18|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 18]
  |  |  ------------------
  ------------------
 4131|       |        /*
 4132|       |         * Parse as much as possible -- though I don't see the point? [jbpn].  
 4133|       |         */
 4134|     18|        if (cp) {
  ------------------
  |  Branch (4134:13): [True: 18, False: 0]
  ------------------
 4135|     18|            cp = snmpv3_scopedPDU_parse(pdu, cp, &pdu_buf_len);
 4136|     18|        }
 4137|     18|        if (cp) {
  ------------------
  |  Branch (4137:13): [True: 0, False: 18]
  ------------------
 4138|      0|            DEBUGPRINTPDUTYPE("recv", *cp);
  ------------------
  |  |  440|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4139|      0|            snmp_pdu_parse(pdu, cp, &pdu_buf_len);
 4140|      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]
  |  |  ------------------
  ------------------
 4141|     18|        } else {
 4142|     18|            DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     18|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     18|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 18]
  |  |  ------------------
  ------------------
 4143|     18|        }
 4144|       |
 4145|     18|        SNMP_FREE(mallocbuf);
  ------------------
  |  |   62|     18|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 18]
  |  |  |  Branch (62:66): [Folded, False: 18]
  |  |  ------------------
  ------------------
 4146|     18|        return ret_val;
 4147|     18|    }
 4148|       |
 4149|       |    /*
 4150|       |     * parse plaintext ScopedPDU sequence 
 4151|       |     */
 4152|      0|    *length = pdu_buf_len;
 4153|      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]
  |  |  ------------------
  ------------------
 4154|      0|    data = snmpv3_scopedPDU_parse(pdu, cp, length);
 4155|      0|    if (data == NULL) {
  ------------------
  |  Branch (4155:9): [True: 0, False: 0]
  ------------------
 4156|      0|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4157|      0|                 msg_sec_model);
 4158|      0|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4159|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4160|      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]
  |  |  ------------------
  ------------------
 4161|      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]
  |  |  ------------------
  ------------------
 4162|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4163|      0|    }
 4164|       |
 4165|       |    /*
 4166|       |     * parse the PDU.  
 4167|       |     */
 4168|      0|    if (after_header != NULL) {
  ------------------
  |  Branch (4168:9): [True: 0, False: 0]
  ------------------
 4169|      0|        *after_header = data;
 4170|      0|        tmp_buf_len = *length;
 4171|      0|    }
 4172|       |
 4173|      0|    DEBUGPRINTPDUTYPE("recv", *data);
  ------------------
  |  |  440|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4174|      0|    ret = snmp_pdu_parse(pdu, data, length);
 4175|      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]
  |  |  ------------------
  ------------------
 4176|       |
 4177|      0|    if (after_header != NULL) {
  ------------------
  |  Branch (4177:9): [True: 0, False: 0]
  ------------------
 4178|      0|        *length = tmp_buf_len;
 4179|      0|    }
 4180|       |
 4181|      0|    if (ret != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (4181:9): [True: 0, False: 0]
  ------------------
 4182|      0|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4183|      0|                 msg_sec_model);
 4184|      0|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4185|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4186|      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]
  |  |  ------------------
  ------------------
 4187|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4188|      0|    }
 4189|       |
 4190|      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]
  |  |  ------------------
  ------------------
 4191|      0|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4192|      0|}                               /* end snmpv3_parse() */
snmpv3_make_report:
 4223|     13|{
 4224|       |
 4225|     13|    long            ltmp;
 4226|     13|    static const oid unknownSecurityLevel[] =
 4227|     13|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 1, 0 };
 4228|     13|    static const oid notInTimeWindow[] =
 4229|     13|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 2, 0 };
 4230|     13|    static const oid unknownUserName[] =
 4231|     13|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 3, 0 };
 4232|     13|    static const oid unknownEngineID[] =
 4233|     13|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 4, 0 };
 4234|     13|    static const oid wrongDigest[] = { 1, 3, 6, 1, 6, 3, 15, 1, 1, 5, 0 };
 4235|     13|    static const oid decryptionError[] =
 4236|     13|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 6, 0 };
 4237|     13|    const oid      *err_var;
 4238|     13|    int             err_var_len;
 4239|     13|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4240|     13|    int             stat_ind;
 4241|     13|#endif
 4242|       |
 4243|     13|    switch (error) {
 4244|      6|    case SNMPERR_USM_UNKNOWNENGINEID:
  ------------------
  |  |  232|      6|#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
  ------------------
  |  Branch (4244:5): [True: 6, False: 7]
  ------------------
 4245|      6|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4246|      6|        stat_ind = STAT_USMSTATSUNKNOWNENGINEIDS;
  ------------------
  |  |  623|      6|#define   STAT_USMSTATSUNKNOWNENGINEIDS      6
  ------------------
 4247|      6|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4248|      6|        err_var = unknownEngineID;
 4249|      6|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4219|      6|#define ERROR_STAT_LENGTH 11
  ------------------
 4250|      6|        break;
 4251|      0|    case SNMPERR_USM_UNKNOWNSECURITYNAME:
  ------------------
  |  |  227|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (4251:5): [True: 0, False: 13]
  ------------------
 4252|      0|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4253|      0|        stat_ind = STAT_USMSTATSUNKNOWNUSERNAMES;
  ------------------
  |  |  622|      0|#define   STAT_USMSTATSUNKNOWNUSERNAMES      5
  ------------------
 4254|      0|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4255|      0|        err_var = unknownUserName;
 4256|      0|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4219|      0|#define ERROR_STAT_LENGTH 11
  ------------------
 4257|      0|        break;
 4258|      0|    case SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL:
  ------------------
  |  |  228|      0|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
  |  Branch (4258:5): [True: 0, False: 13]
  ------------------
 4259|      0|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4260|      0|        stat_ind = STAT_USMSTATSUNSUPPORTEDSECLEVELS;
  ------------------
  |  |  620|      0|#define   STAT_USMSTATSUNSUPPORTEDSECLEVELS  3
  ------------------
 4261|      0|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4262|      0|        err_var = unknownSecurityLevel;
 4263|      0|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4219|      0|#define ERROR_STAT_LENGTH 11
  ------------------
 4264|      0|        break;
 4265|      0|    case SNMPERR_USM_AUTHENTICATIONFAILURE:
  ------------------
  |  |  230|      0|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
  |  Branch (4265:5): [True: 0, False: 13]
  ------------------
 4266|      0|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4267|      0|        stat_ind = STAT_USMSTATSWRONGDIGESTS;
  ------------------
  |  |  624|      0|#define   STAT_USMSTATSWRONGDIGESTS          7
  ------------------
 4268|      0|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4269|      0|        err_var = wrongDigest;
 4270|      0|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4219|      0|#define ERROR_STAT_LENGTH 11
  ------------------
 4271|      0|        break;
 4272|      0|    case SNMPERR_USM_NOTINTIMEWINDOW:
  ------------------
  |  |  233|      0|#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
  ------------------
  |  Branch (4272:5): [True: 0, False: 13]
  ------------------
 4273|      0|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4274|      0|        stat_ind = STAT_USMSTATSNOTINTIMEWINDOWS;
  ------------------
  |  |  621|      0|#define   STAT_USMSTATSNOTINTIMEWINDOWS      4
  ------------------
 4275|      0|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4276|      0|        err_var = notInTimeWindow;
 4277|      0|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4219|      0|#define ERROR_STAT_LENGTH 11
  ------------------
 4278|      0|        break;
 4279|      7|    case SNMPERR_USM_DECRYPTIONERROR:
  ------------------
  |  |  234|      7|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
  |  Branch (4279:5): [True: 7, False: 6]
  ------------------
 4280|      7|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4281|      7|        stat_ind = STAT_USMSTATSDECRYPTIONERRORS;
  ------------------
  |  |  625|      7|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 4282|      7|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4283|      7|        err_var = decryptionError;
 4284|      7|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4219|      7|#define ERROR_STAT_LENGTH 11
  ------------------
 4285|      7|        break;
 4286|      0|    default:
  ------------------
  |  Branch (4286:5): [True: 0, False: 13]
  ------------------
 4287|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 4288|     13|    }
 4289|       |
 4290|     13|    snmp_free_varbind(pdu->variables);  /* free the current varbind */
 4291|       |
 4292|     13|    pdu->variables = NULL;
 4293|     13|    SNMP_FREE(pdu->securityEngineID);
  ------------------
  |  |   62|     13|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 13, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 13]
  |  |  ------------------
  ------------------
 4294|     13|    pdu->securityEngineID =
 4295|     13|        snmpv3_generate_engineID(&pdu->securityEngineIDLen);
 4296|     13|    SNMP_FREE(pdu->contextEngineID);
  ------------------
  |  |   62|     13|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 13, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 13]
  |  |  ------------------
  ------------------
 4297|     13|    pdu->contextEngineID =
 4298|     13|        snmpv3_generate_engineID(&pdu->contextEngineIDLen);
 4299|     13|    pdu->command = SNMP_MSG_REPORT;
  ------------------
  |  |  147|     13|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
 4300|     13|    pdu->errstat = 0;
 4301|     13|    pdu->errindex = 0;
 4302|     13|    SNMP_FREE(pdu->contextName);
  ------------------
  |  |   62|     13|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 13]
  |  |  |  Branch (62:66): [Folded, False: 13]
  |  |  ------------------
  ------------------
 4303|     13|    pdu->contextName = strdup("");
 4304|     13|    pdu->contextNameLen = strlen(pdu->contextName);
 4305|       |
 4306|       |    /*
 4307|       |     * reports shouldn't cache previous data. 
 4308|       |     */
 4309|       |    /*
 4310|       |     * FIX - yes they should but USM needs to follow new EoP to determine
 4311|       |     * which cached values to use 
 4312|       |     */
 4313|     13|    free_securityStateRef(pdu);
 4314|       |
 4315|     13|    if (error == SNMPERR_USM_NOTINTIMEWINDOW) {
  ------------------
  |  |  233|     13|#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
  ------------------
  |  Branch (4315:9): [True: 0, False: 13]
  ------------------
 4316|      0|        pdu->securityLevel = SNMP_SEC_LEVEL_AUTHNOPRIV;
  ------------------
  |  |  300|      0|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
 4317|     13|    } else {
 4318|     13|        pdu->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|     13|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4319|     13|    }
 4320|       |
 4321|       |    /*
 4322|       |     * find the appropriate error counter  
 4323|       |     */
 4324|     13|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4325|     13|    ltmp = snmp_get_statistic(stat_ind);
 4326|       |#else /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4327|       |    ltmp = 1;
 4328|       |#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4329|       |
 4330|       |    /*
 4331|       |     * return the appropriate error counter  
 4332|       |     */
 4333|     13|    snmp_pdu_add_variable(pdu, err_var, err_var_len,
 4334|     13|                          ASN_COUNTER, & ltmp, sizeof(ltmp));
  ------------------
  |  |   89|     13|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|     13|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
 4335|       |
 4336|     13|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     13|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4337|     13|}                               /* end snmpv3_make_report() */
snmp_parse:
 4718|    183|{
 4719|    183|    int             rc;
 4720|       |
 4721|    183|    rc = _snmp_parse(slp, pss, pdu, data, length);
 4722|    183|    if (rc) {
  ------------------
  |  Branch (4722:9): [True: 183, False: 0]
  ------------------
 4723|    183|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (4723:13): [True: 55, False: 128]
  ------------------
 4724|     55|            pss->s_snmp_errno = SNMPERR_BAD_PARSE;
  ------------------
  |  |  197|     55|#define SNMPERR_BAD_PARSE		(-13)
  ------------------
 4725|     55|        }
 4726|    183|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   43|    183|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 4727|    183|    }
 4728|       |
 4729|    183|    return rc;
 4730|    183|}
snmp_pdu_parse:
 4734|     16|{
 4735|     16|    u_char          type;
 4736|     16|    u_char          msg_type;
 4737|     16|    u_char         *var_val;
 4738|     16|    size_t          len;
 4739|     16|    size_t          four;
 4740|     16|    netsnmp_variable_list *vp = NULL, *vplast = NULL;
 4741|     16|    oid             objid[MAX_OID_LEN];
 4742|     16|    u_char         *p;
 4743|       |
 4744|       |    /*
 4745|       |     * Get the PDU type 
 4746|       |     */
 4747|     16|    data = asn_parse_header(data, length, &msg_type);
 4748|     16|    if (data == NULL)
  ------------------
  |  Branch (4748:9): [True: 1, False: 15]
  ------------------
 4749|      1|        return -1;
 4750|     15|    DEBUGMSGTL(("dumpv_recv","    Command %s\n", snmp_pdu_type(msg_type)));
  ------------------
  |  |   66|     15|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     15|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 15]
  |  |  ------------------
  ------------------
 4751|     15|    pdu->command = msg_type;
 4752|     15|    pdu->flags &= (~UCD_MSG_FLAG_RESPONSE_PDU);
  ------------------
  |  |  311|     15|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4753|       |
 4754|       |    /*
 4755|       |     * get the fields in the PDU preceding the variable-bindings sequence
 4756|       |     */
 4757|     15|    switch (pdu->command) {
 4758|     13|    case SNMP_MSG_TRAP:
  ------------------
  |  |  135|     13|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4758:5): [True: 13, False: 2]
  ------------------
 4759|       |        /*
 4760|       |         * enterprise 
 4761|       |         */
 4762|     13|        pdu->enterprise_length = MAX_OID_LEN;
  ------------------
  |  |  120|     13|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4763|     13|        data = asn_parse_objid(data, length, &type, objid,
 4764|     13|                               &pdu->enterprise_length);
 4765|     13|        if (data == NULL)
  ------------------
  |  Branch (4765:13): [True: 3, False: 10]
  ------------------
 4766|      3|            return -1;
 4767|     10|        pdu->enterprise = netsnmp_memdup(objid,
 4768|     10|                                         pdu->enterprise_length * sizeof(oid));
 4769|     10|        if (pdu->enterprise == NULL) {
  ------------------
  |  Branch (4769:13): [True: 0, False: 10]
  ------------------
 4770|      0|            return -1;
 4771|      0|        }
 4772|       |
 4773|       |        /*
 4774|       |         * agent-addr 
 4775|       |         */
 4776|     10|        four = 4;
 4777|     10|        data = asn_parse_string(data, length, &type,
 4778|     10|                                (u_char *) pdu->agent_addr, &four);
 4779|     10|        if (data == NULL)
  ------------------
  |  Branch (4779:13): [True: 7, False: 3]
  ------------------
 4780|      7|            return -1;
 4781|       |
 4782|       |        /*
 4783|       |         * generic trap 
 4784|       |         */
 4785|      3|        data = asn_parse_int(data, length, &type, (long *) &pdu->trap_type,
 4786|      3|                             sizeof(pdu->trap_type));
 4787|      3|        if (data == NULL)
  ------------------
  |  Branch (4787:13): [True: 0, False: 3]
  ------------------
 4788|      0|            return -1;
 4789|       |        /*
 4790|       |         * specific trap 
 4791|       |         */
 4792|      3|        data =
 4793|      3|            asn_parse_int(data, length, &type,
 4794|      3|                          (long *) &pdu->specific_type,
 4795|      3|                          sizeof(pdu->specific_type));
 4796|      3|        if (data == NULL)
  ------------------
  |  Branch (4796:13): [True: 2, False: 1]
  ------------------
 4797|      2|            return -1;
 4798|       |
 4799|       |        /*
 4800|       |         * timestamp  
 4801|       |         */
 4802|      1|        data = asn_parse_unsigned_int(data, length, &type, &pdu->time,
 4803|      1|                                      sizeof(pdu->time));
 4804|      1|        if (data == NULL)
  ------------------
  |  Branch (4804:13): [True: 1, False: 0]
  ------------------
 4805|      1|            return -1;
 4806|       |
 4807|      0|        break;
 4808|       |
 4809|      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 (4809:5): [True: 0, False: 15]
  ------------------
 4810|      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 (4810:5): [True: 0, False: 15]
  ------------------
 4811|      0|        pdu->flags |= UCD_MSG_FLAG_RESPONSE_PDU;
  ------------------
  |  |  311|      0|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4812|      0|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2440|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4813|       |
 4814|      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 (4814:5): [True: 0, False: 15]
  ------------------
 4815|      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 (4815:5): [True: 0, False: 15]
  ------------------
 4816|      0|#ifndef NETSNMP_NOTIFY_ONLY
 4817|      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 (4817:5): [True: 0, False: 15]
  ------------------
 4818|      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 (4818:5): [True: 0, False: 15]
  ------------------
 4819|      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 (4819:5): [True: 0, False: 15]
  ------------------
 4820|      0|#endif /* ! NETSNMP_NOTIFY_ONLY */
 4821|      0|#ifndef NETSNMP_NO_WRITE_SUPPORT
 4822|      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 (4822:5): [True: 0, False: 15]
  ------------------
 4823|      0|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 4824|       |        /*
 4825|       |         * PDU is not an SNMPv1 TRAP 
 4826|       |         */
 4827|       |
 4828|       |        /*
 4829|       |         * request id 
 4830|       |         */
 4831|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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]
  |  |  ------------------
  ------------------
 4832|      0|        data = asn_parse_int(data, length, &type, &pdu->reqid,
 4833|      0|                             sizeof(pdu->reqid));
 4834|      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]
  |  |  ------------------
  ------------------
 4835|      0|        if (data == NULL) {
  ------------------
  |  Branch (4835:13): [True: 0, False: 0]
  ------------------
 4836|      0|            return -1;
 4837|      0|        }
 4838|       |
 4839|       |        /*
 4840|       |         * error status (getbulk non-repeaters) 
 4841|       |         */
 4842|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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]
  |  |  ------------------
  ------------------
 4843|      0|        data = asn_parse_int(data, length, &type, &pdu->errstat,
 4844|      0|                             sizeof(pdu->errstat));
 4845|      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]
  |  |  ------------------
  ------------------
 4846|      0|        if (data == NULL) {
  ------------------
  |  Branch (4846:13): [True: 0, False: 0]
  ------------------
 4847|      0|            return -1;
 4848|      0|        }
 4849|       |
 4850|       |        /*
 4851|       |         * error index (getbulk max-repetitions) 
 4852|       |         */
 4853|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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]
  |  |  ------------------
  ------------------
 4854|      0|        data = asn_parse_int(data, length, &type, &pdu->errindex,
 4855|      0|                             sizeof(pdu->errindex));
 4856|      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]
  |  |  ------------------
  ------------------
 4857|      0|        if (data == NULL) {
  ------------------
  |  Branch (4857:13): [True: 0, False: 0]
  ------------------
 4858|      0|            return -1;
 4859|      0|        }
 4860|      0|	break;
 4861|       |
 4862|      2|    default:
  ------------------
  |  Branch (4862:5): [True: 2, False: 13]
  ------------------
 4863|      2|        snmp_log(LOG_ERR, "Bad PDU type received: 0x%.2x\n", pdu->command);
 4864|      2|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      2|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4865|      2|        return -1;
 4866|     15|    }
 4867|       |
 4868|       |    /*
 4869|       |     * get header for variable-bindings sequence 
 4870|       |     */
 4871|      0|    DEBUGDUMPSECTION("recv", "VarBindList");
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 4872|      0|    data = asn_parse_sequence(data, length, &type,
 4873|      0|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|      0|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 4874|      0|                              "varbinds");
 4875|      0|    if (data == NULL)
  ------------------
  |  Branch (4875:9): [True: 0, False: 0]
  ------------------
 4876|      0|        goto fail;
 4877|       |
 4878|       |    /*
 4879|       |     * get each varBind sequence 
 4880|       |     */
 4881|      0|    while ((int) *length > 0) {
  ------------------
  |  Branch (4881:12): [True: 0, False: 0]
  ------------------
 4882|      0|        vp = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
  ------------------
  |  |   73|      0|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 4883|      0|        if (NULL == vp)
  ------------------
  |  Branch (4883:13): [True: 0, False: 0]
  ------------------
 4884|      0|            goto fail;
 4885|       |
 4886|      0|        vp->name_length = MAX_OID_LEN;
  ------------------
  |  |  120|      0|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4887|      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]
  |  |  ------------------
  ------------------
 4888|      0|        data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type,
 4889|      0|                                 &vp->val_len, &var_val, length);
 4890|      0|        if (data == NULL)
  ------------------
  |  Branch (4890:13): [True: 0, False: 0]
  ------------------
 4891|      0|            goto fail;
 4892|      0|        if (snmp_set_var_objid(vp, objid, vp->name_length))
  ------------------
  |  Branch (4892:13): [True: 0, False: 0]
  ------------------
 4893|      0|            goto fail;
 4894|       |
 4895|      0|        len = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
 4896|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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]
  |  |  ------------------
  ------------------
 4897|      0|        switch ((short) vp->type) {
 4898|      0|        case ASN_INTEGER:
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4898:9): [True: 0, False: 0]
  ------------------
 4899|      0|            vp->val.integer = (long *) vp->buf;
 4900|      0|            vp->val_len = sizeof(long);
 4901|      0|            p = asn_parse_int(var_val, &len, &vp->type,
 4902|      0|                          (long *) vp->val.integer,
 4903|      0|                          sizeof(*vp->val.integer));
 4904|      0|            if (!p)
  ------------------
  |  Branch (4904:17): [True: 0, False: 0]
  ------------------
 4905|      0|                goto fail;
 4906|      0|            break;
 4907|      0|        case ASN_COUNTER:
  ------------------
  |  |   89|      0|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4907:9): [True: 0, False: 0]
  ------------------
 4908|      0|        case ASN_GAUGE:
  ------------------
  |  |   90|      0|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4908:9): [True: 0, False: 0]
  ------------------
 4909|      0|        case ASN_TIMETICKS:
  ------------------
  |  |   92|      0|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4909:9): [True: 0, False: 0]
  ------------------
 4910|      0|        case ASN_UINTEGER:
  ------------------
  |  |  100|      0|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4910:9): [True: 0, False: 0]
  ------------------
 4911|      0|            vp->val.integer = (long *) vp->buf;
 4912|      0|            vp->val_len = sizeof(u_long);
 4913|      0|            p = asn_parse_unsigned_int(var_val, &len, &vp->type,
 4914|      0|                                   (u_long *) vp->val.integer,
 4915|      0|                                   vp->val_len);
 4916|      0|            if (!p)
  ------------------
  |  Branch (4916:17): [True: 0, False: 0]
  ------------------
 4917|      0|                goto fail;
 4918|      0|            break;
 4919|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4920|      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 (4920:9): [True: 0, False: 0]
  ------------------
 4921|      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 (4921:9): [True: 0, False: 0]
  ------------------
 4922|      0|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4923|      0|        case ASN_COUNTER64:
  ------------------
  |  |   99|      0|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4923:9): [True: 0, False: 0]
  ------------------
 4924|      0|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4925|      0|            vp->val_len = sizeof(struct counter64);
 4926|      0|            p = asn_parse_unsigned_int64(var_val, &len, &vp->type,
 4927|      0|                                     (struct counter64 *) vp->val.
 4928|      0|                                     counter64, vp->val_len);
 4929|      0|            if (!p)
  ------------------
  |  Branch (4929:17): [True: 0, False: 0]
  ------------------
 4930|      0|                goto fail;
 4931|      0|            break;
 4932|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4933|      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 (4933:9): [True: 0, False: 0]
  ------------------
 4934|      0|            vp->val.floatVal = (float *) vp->buf;
 4935|      0|            vp->val_len = sizeof(float);
 4936|      0|            p = asn_parse_float(var_val, &len, &vp->type,
 4937|      0|                            vp->val.floatVal, vp->val_len);
 4938|      0|            if (!p)
  ------------------
  |  Branch (4938:17): [True: 0, False: 0]
  ------------------
 4939|      0|                goto fail;
 4940|      0|            break;
 4941|      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 (4941:9): [True: 0, False: 0]
  ------------------
 4942|      0|            vp->val.doubleVal = (double *) vp->buf;
 4943|      0|            vp->val_len = sizeof(double);
 4944|      0|            p = asn_parse_double(var_val, &len, &vp->type,
 4945|      0|                             vp->val.doubleVal, vp->val_len);
 4946|      0|            if (!p)
  ------------------
  |  Branch (4946:17): [True: 0, False: 0]
  ------------------
 4947|      0|                goto fail;
 4948|      0|            break;
 4949|      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 (4949:9): [True: 0, False: 0]
  ------------------
 4950|      0|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4951|      0|            vp->val_len = sizeof(struct counter64);
 4952|      0|            p = asn_parse_signed_int64(var_val, &len, &vp->type,
 4953|      0|                                   (struct counter64 *) vp->val.counter64,
 4954|      0|                                   sizeof(*vp->val.counter64));
 4955|       |
 4956|      0|            if (!p)
  ------------------
  |  Branch (4956:17): [True: 0, False: 0]
  ------------------
 4957|      0|                goto fail;
 4958|      0|            break;
 4959|      0|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4960|      0|        case ASN_IPADDRESS:
  ------------------
  |  |   88|      0|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4960:9): [True: 0, False: 0]
  ------------------
 4961|      0|            if (vp->val_len != 4)
  ------------------
  |  Branch (4961:17): [True: 0, False: 0]
  ------------------
 4962|      0|                goto fail;
 4963|      0|            NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2440|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4964|      0|        case ASN_OCTET_STR:
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (4964:9): [True: 0, False: 0]
  ------------------
 4965|      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 (4965:9): [True: 0, False: 0]
  ------------------
 4966|      0|        case ASN_NSAP:
  ------------------
  |  |   98|      0|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4966:9): [True: 0, False: 0]
  ------------------
 4967|      0|            if (vp->val_len < sizeof(vp->buf)) {
  ------------------
  |  Branch (4967:17): [True: 0, False: 0]
  ------------------
 4968|      0|                vp->val.string = (u_char *) vp->buf;
 4969|      0|            } else {
 4970|      0|                vp->val.string = (u_char *) malloc(vp->val_len);
 4971|      0|            }
 4972|      0|            if (vp->val.string == NULL) {
  ------------------
  |  Branch (4972:17): [True: 0, False: 0]
  ------------------
 4973|      0|                goto fail;
 4974|      0|            }
 4975|      0|            p = asn_parse_string(var_val, &len, &vp->type, vp->val.string,
 4976|      0|                             &vp->val_len);
 4977|      0|            if (!p)
  ------------------
  |  Branch (4977:17): [True: 0, False: 0]
  ------------------
 4978|      0|                goto fail;
 4979|      0|            break;
 4980|      0|        case ASN_OBJECT_ID:
  ------------------
  |  |   81|      0|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (4980:9): [True: 0, False: 0]
  ------------------
 4981|      0|            vp->val_len = MAX_OID_LEN;
  ------------------
  |  |  120|      0|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4982|      0|            p = asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len);
 4983|      0|            if (!p)
  ------------------
  |  Branch (4983:17): [True: 0, False: 0]
  ------------------
 4984|      0|                goto fail;
 4985|      0|            vp->val_len *= sizeof(oid);
 4986|      0|            vp->val.objid = netsnmp_memdup(objid, vp->val_len);
 4987|      0|            if (vp->val.objid == NULL)
  ------------------
  |  Branch (4987:17): [True: 0, False: 0]
  ------------------
 4988|      0|                goto fail;
 4989|      0|            break;
 4990|      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 (4990:9): [True: 0, False: 0]
  ------------------
 4991|      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 (4991:9): [True: 0, False: 0]
  ------------------
 4992|      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 (4992:9): [True: 0, False: 0]
  ------------------
 4993|      0|        case ASN_NULL:
  ------------------
  |  |   79|      0|#define ASN_NULL	    0x05U
  ------------------
  |  Branch (4993:9): [True: 0, False: 0]
  ------------------
 4994|      0|            break;
 4995|      0|        case ASN_BIT_STR:
  ------------------
  |  |   77|      0|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (4995:9): [True: 0, False: 0]
  ------------------
 4996|      0|            vp->val.bitstring = (u_char *) malloc(vp->val_len);
 4997|      0|            if (vp->val.bitstring == NULL) {
  ------------------
  |  Branch (4997:17): [True: 0, False: 0]
  ------------------
 4998|      0|                goto fail;
 4999|      0|            }
 5000|      0|            p = asn_parse_bitstring(var_val, &len, &vp->type,
 5001|      0|                                vp->val.bitstring, &vp->val_len);
 5002|      0|            if (!p)
  ------------------
  |  Branch (5002:17): [True: 0, False: 0]
  ------------------
 5003|      0|                goto fail;
 5004|      0|            break;
 5005|      0|        default:
  ------------------
  |  Branch (5005:9): [True: 0, False: 0]
  ------------------
 5006|      0|            snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type);
 5007|      0|            goto fail;
 5008|      0|            break;
 5009|      0|        }
 5010|      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]
  |  |  ------------------
  ------------------
 5011|       |
 5012|      0|        if (NULL == vplast) {
  ------------------
  |  Branch (5012:13): [True: 0, False: 0]
  ------------------
 5013|      0|            pdu->variables = vp;
 5014|      0|        } else {
 5015|      0|            vplast->next_variable = vp;
 5016|      0|        }
 5017|      0|        vplast = vp;
 5018|      0|        vp = NULL;
 5019|      0|    }
 5020|      0|    return 0;
 5021|       |
 5022|      0|  fail:
 5023|      0|    {
 5024|      0|        const char *errstr = snmp_api_errstring(SNMPERR_SUCCESS);
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5025|      0|        DEBUGMSGTL(("recv", "error while parsing VarBindList:%s\n", errstr));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 5026|      0|    }
 5027|       |    /** if we were parsing a var, remove it from the pdu and free it */
 5028|      0|    if (vp)
  ------------------
  |  Branch (5028:9): [True: 0, False: 0]
  ------------------
 5029|      0|        snmp_free_var(vp);
 5030|       |
 5031|      0|    return -1;
 5032|      0|}
snmpv3_scopedPDU_parse:
 5043|     18|{
 5044|     18|    u_char          tmp_buf[SNMP_MAX_MSG_SIZE];
 5045|     18|    size_t          tmp_buf_len;
 5046|     18|    u_char          type;
 5047|     18|    size_t          asn_len;
 5048|     18|    u_char         *data;
 5049|       |
 5050|     18|    pdu->command = 0;           /* initialize so we know if it got parsed */
 5051|     18|    asn_len = *length;
 5052|     18|    data = asn_parse_sequence(cp, &asn_len, &type,
 5053|     18|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|     18|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|     18|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 5054|     18|                              "plaintext scopedPDU");
 5055|     18|    if (data == NULL) {
  ------------------
  |  Branch (5055:9): [True: 12, False: 6]
  ------------------
 5056|     12|        return NULL;
 5057|     12|    }
 5058|      6|    *length -= data - cp;
 5059|       |
 5060|       |    /*
 5061|       |     * contextEngineID from scopedPdu  
 5062|       |     */
 5063|      6|    DEBUGDUMPHEADER("recv", "contextEngineID");
  ------------------
  |  |   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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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]
  |  |  ------------------
  ------------------
 5064|      6|    data = asn_parse_string(data, length, &type, pdu->contextEngineID,
 5065|      6|                            &pdu->contextEngineIDLen);
 5066|      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]
  |  |  ------------------
  ------------------
 5067|      6|    if (data == NULL) {
  ------------------
  |  Branch (5067:9): [True: 6, False: 0]
  ------------------
 5068|      6|        ERROR_MSG("error parsing contextEngineID from scopedPdu");
  ------------------
  |  |  188|      6|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 5069|      6|        return NULL;
 5070|      6|    }
 5071|       |
 5072|       |    /*
 5073|       |     * parse contextName from scopedPdu
 5074|       |     */
 5075|      0|    tmp_buf_len = SNMP_MAX_CONTEXT_SIZE;
  ------------------
  |  |  113|      0|#define SNMP_MAX_CONTEXT_SIZE      256
  ------------------
 5076|      0|    DEBUGDUMPHEADER("recv", "contextName");
  ------------------
  |  |   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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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]
  |  |  ------------------
  ------------------
 5077|      0|    data = asn_parse_string(data, length, &type, tmp_buf, &tmp_buf_len);
 5078|      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]
  |  |  ------------------
  ------------------
 5079|      0|    if (data == NULL) {
  ------------------
  |  Branch (5079:9): [True: 0, False: 0]
  ------------------
 5080|      0|        ERROR_MSG("error parsing contextName from scopedPdu");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 5081|      0|        return NULL;
 5082|      0|    }
 5083|       |
 5084|      0|    if (tmp_buf_len) {
  ------------------
  |  Branch (5084:9): [True: 0, False: 0]
  ------------------
 5085|      0|        pdu->contextName = netsnmp_memdup(tmp_buf, tmp_buf_len);
 5086|      0|        pdu->contextNameLen = tmp_buf_len;
 5087|      0|    } else {
 5088|      0|        pdu->contextName = strdup("");
 5089|      0|        pdu->contextNameLen = 0;
 5090|      0|    }
 5091|      0|    if (pdu->contextName == NULL) {
  ------------------
  |  Branch (5091:9): [True: 0, False: 0]
  ------------------
 5092|      0|        ERROR_MSG("error copying contextName from scopedPdu");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 5093|      0|        return NULL;
 5094|      0|    }
 5095|       |
 5096|       |    /*
 5097|       |     * Get the PDU type 
 5098|       |     */
 5099|      0|    asn_len = *length;
 5100|      0|    cp = asn_parse_header(data, &asn_len, &type);
 5101|      0|    if (cp == NULL)
  ------------------
  |  Branch (5101:9): [True: 0, False: 0]
  ------------------
 5102|      0|        return NULL;
 5103|       |
 5104|      0|    pdu->command = type;
 5105|       |
 5106|      0|    return data;
 5107|      0|}
_build_initial_pdu_packet:
 5153|     13|{
 5154|     13|    netsnmp_session *session;
 5155|     13|    struct snmp_internal_session *isp;
 5156|     13|    netsnmp_transport *transport = NULL;
 5157|     13|    u_char         *pktbuf = NULL, *packet = NULL;
 5158|     13|    size_t          pktbuf_len = 0, length = 0, orig_length = 0;
 5159|     13|    int             result, orig_count = 0, curr_count = 0;
 5160|       |
 5161|     13|    if (slp == NULL) {
  ------------------
  |  Branch (5161:9): [True: 0, False: 13]
  ------------------
 5162|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5163|      0|    }
 5164|     13|    session = slp->session;
 5165|       |
 5166|     13|    isp = slp->internal;
 5167|     13|    transport = slp->transport;
 5168|     13|    if (!session || !isp || !transport) {
  ------------------
  |  Branch (5168:9): [True: 0, False: 13]
  |  Branch (5168:21): [True: 0, False: 13]
  |  Branch (5168:29): [True: 0, False: 13]
  ------------------
 5169|      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]
  |  |  ------------------
  ------------------
 5170|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5171|      0|    }
 5172|       |
 5173|     13|    if (pdu == NULL) {
  ------------------
  |  Branch (5173:9): [True: 0, False: 13]
  ------------------
 5174|      0|        session->s_snmp_errno = SNMPERR_NULL_PDU;
  ------------------
  |  |  243|      0|#define SNMPERR_NULL_PDU		(-59)
  ------------------
 5175|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5176|      0|    }
 5177|       |
 5178|     13|    SNMP_FREE(isp->obuf); /* should already be NULL */
  ------------------
  |  |   62|     13|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 13]
  |  |  |  Branch (62:66): [Folded, False: 13]
  |  |  ------------------
  ------------------
 5179|       |
 5180|     13|    session->s_snmp_errno = 0;
 5181|     13|    session->s_errno = 0;
 5182|       |
 5183|       |    /*
 5184|       |     * Check/setup the version.  
 5185|       |     */
 5186|     13|    if (pdu->version == SNMP_DEFAULT_VERSION) {
  ------------------
  |  |   90|     13|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (5186:9): [True: 0, False: 13]
  ------------------
 5187|      0|        if (session->version == SNMP_DEFAULT_VERSION) {
  ------------------
  |  |   90|      0|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (5187:13): [True: 0, False: 0]
  ------------------
 5188|      0|            session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 5189|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5190|      0|        }
 5191|      0|        pdu->version = session->version;
 5192|     13|    } else if (session->version == SNMP_DEFAULT_VERSION) {
  ------------------
  |  |   90|     13|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (5192:16): [True: 13, False: 0]
  ------------------
 5193|       |        /*
 5194|       |         * It's OK  
 5195|       |         */
 5196|     13|    } else if (pdu->version != session->version) {
  ------------------
  |  Branch (5196:16): [True: 0, False: 0]
  ------------------
 5197|       |        /*
 5198|       |         * ENHANCE: we should support multi-lingual sessions  
 5199|       |         */
 5200|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 5201|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5202|      0|    }
 5203|     13|    if (NETSNMP_RUNTIME_PROTOCOL_SKIP(pdu->version)) {
  ------------------
  |  |  246|     13|    (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||        \
  |  |  ------------------
  |  |  |  |  205|     26|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|     26|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  |  |  206|     26|     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|     13|     NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver) ||        \
  |  |  ------------------
  |  |  |  |  215|     26|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|     26|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  |  |  216|     26|     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|     13|     NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver))
  |  |  ------------------
  |  |  |  |  229|     13|    ((pc_ver == SNMP_VERSION_3) &&                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|     13|#define SNMP_VERSION_3     3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (229:6): [True: 13, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  230|     13|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|     13|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (230:6): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  |  |  231|     13|                            NETSNMP_DS_LIB_DISABLE_V3))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|     13|#define NETSNMP_DS_LIB_DISABLE_V3          45 /* disable SNMPv3 */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5204|      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]
  |  |  ------------------
  ------------------
 5205|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 5206|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5207|      0|    }
 5208|       |
 5209|       |    /*
 5210|       |     * do we expect a response?
 5211|       |     */
 5212|     13|    switch (pdu->command) {
 5213|       |
 5214|      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 (5214:9): [True: 0, False: 13]
  ------------------
 5215|      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 (5215:9): [True: 0, False: 13]
  ------------------
 5216|      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 (5216:9): [True: 0, False: 13]
  ------------------
 5217|     13|        case SNMP_MSG_REPORT:
  ------------------
  |  |  147|     13|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (5217:9): [True: 13, False: 0]
  ------------------
 5218|     13|        case AGENTX_MSG_CLEANUPSET:
  ------------------
  |  |   45|     13|#define AGENTX_MSG_CLEANUPSET ((u_char)11)
  ------------------
  |  Branch (5218:9): [True: 0, False: 13]
  ------------------
 5219|     13|        case AGENTX_MSG_RESPONSE:
  ------------------
  |  |   52|     13|#define AGENTX_MSG_RESPONSE    ((u_char)18)
  ------------------
  |  Branch (5219:9): [True: 0, False: 13]
  ------------------
 5220|     13|            pdu->flags &= ~UCD_MSG_FLAG_EXPECT_RESPONSE;
  ------------------
  |  |  312|     13|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
 5221|     13|            break;
 5222|       |            
 5223|      0|        default:
  ------------------
  |  Branch (5223:9): [True: 0, False: 13]
  ------------------
 5224|      0|            pdu->flags |= UCD_MSG_FLAG_EXPECT_RESPONSE;
  ------------------
  |  |  312|      0|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
 5225|      0|            break;
 5226|     13|    }
 5227|       |
 5228|       |    /*
 5229|       |     * Check if we need to perform a v3 engineID probe. Call post probe hook to
 5230|       |     * create user from information in a session even if SNMP_FLAGS_DONT_PROBE
 5231|       |     * is set, as this may indicate that probe was already sent by other means
 5232|       |     * for example asynchronously.
 5233|       |     */
 5234|     13|    if ((pdu->version == SNMP_VERSION_3) &&
  ------------------
  |  |  113|     13|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (5234:9): [True: 13, False: 0]
  ------------------
 5235|     13|        (pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE)) {
  ------------------
  |  |  312|     13|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
  |  Branch (5235:9): [True: 0, False: 13]
  ------------------
 5236|      0|        int rc;
 5237|      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]
  |  |  ------------------
  ------------------
 5238|      0|        rc = snmpv3_engineID_probe(slp, session);
 5239|      0|        if (rc == 0)
  ------------------
  |  Branch (5239:13): [True: 0, False: 0]
  ------------------
 5240|      0|            return 0; /* s_snmp_errno already set */
 5241|      0|    }
 5242|       |
 5243|       |    /*
 5244|       |     * determine max packet size
 5245|       |     */
 5246|     13|    if (pdu->msgMaxSize == 0) {
  ------------------
  |  Branch (5246:9): [True: 0, False: 13]
  ------------------
 5247|      0|        pdu->msgMaxSize = netsnmp_max_send_msg_size();
 5248|      0|        if (pdu->msgMaxSize > transport->msgMaxSize)
  ------------------
  |  Branch (5248:13): [True: 0, False: 0]
  ------------------
 5249|      0|            pdu->msgMaxSize = transport->msgMaxSize;
 5250|      0|        if (pdu->msgMaxSize > session->sndMsgMaxSize)
  ------------------
  |  Branch (5250:13): [True: 0, False: 0]
  ------------------
 5251|      0|            pdu->msgMaxSize = session->sndMsgMaxSize;
 5252|      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]
  |  |  ------------------
  ------------------
 5253|      0|                    pdu->msgMaxSize));
 5254|      0|    }
 5255|     13|    netsnmp_assert(pdu->msgMaxSize > 0);
  ------------------
  |  |   47|     13|#      define netsnmp_assert(x)  do { \
  |  |   48|     13|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 13, False: 0]
  |  |  ------------------
  |  |   49|     13|                 ; \
  |  |   50|     13|              else \
  |  |   51|     13|                 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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     13|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 13]
  |  |  ------------------
  ------------------
 5256|       |
 5257|       |    /*
 5258|       |     * allocate initial packet buffer. Buffer will be grown as needed
 5259|       |     * while building the packet.
 5260|       |     */
 5261|     13|    pktbuf_len = SNMP_MIN_MAX_LEN;
  ------------------
  |  |   48|     13|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
 5262|     13|    if ((pktbuf = (u_char *)malloc(pktbuf_len)) == NULL) {
  ------------------
  |  Branch (5262:9): [True: 0, False: 13]
  ------------------
 5263|      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]
  |  |  ------------------
  ------------------
 5264|      0|                    "couldn't malloc initial packet buffer\n"));
 5265|      0|        session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 5266|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 5267|      0|    }
 5268|       |
 5269|       |#ifdef TEMPORARILY_DISABLED
 5270|       |    /*
 5271|       |     *  NULL variable are allowed in certain PDU types.
 5272|       |     *  In particular, SNMPv3 engineID probes are of this form.
 5273|       |     *  There is an internal PDU flag to indicate that this
 5274|       |     *    is acceptable, but until the construction of engineID
 5275|       |     *    probes can be amended to set this flag, we'll simply
 5276|       |     *    skip this test altogether.
 5277|       |     */
 5278|       |    if (pdu->variables == NULL) {
 5279|       |        switch (pdu->command) {
 5280|       |#ifndef NETSNMP_NO_WRITE_SUPPORT
 5281|       |        case SNMP_MSG_SET:
 5282|       |#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 5283|       |        case SNMP_MSG_GET:
 5284|       |        case SNMP_MSG_GETNEXT:
 5285|       |        case SNMP_MSG_GETBULK:
 5286|       |        case SNMP_MSG_RESPONSE:
 5287|       |        case SNMP_MSG_TRAP2:
 5288|       |        case SNMP_MSG_REPORT:
 5289|       |        case SNMP_MSG_INFORM:
 5290|       |            session->s_snmp_errno = snmp_errno = SNMPERR_NO_VARS;
 5291|       |            return SNMPERR_NO_VARS;
 5292|       |        case SNMP_MSG_TRAP:
 5293|       |            break;
 5294|       |        }
 5295|       |    }
 5296|       |#endif
 5297|       |
 5298|       |
 5299|       |    /*
 5300|       |     * Build the message to send. If a bulk response is too big, switch to
 5301|       |     * forward encoding and set a flag to drop varbinds to make it fit.
 5302|       |     */
 5303|     13|    do {
 5304|     13|        packet = NULL;
 5305|     13|        length = 0;
 5306|     13|        result = netsnmp_build_packet(isp, session, pdu, &pktbuf, &pktbuf_len,
 5307|     13|                                      &packet, &length);
 5308|     13|        if (0 != result)
  ------------------
  |  Branch (5308:13): [True: 0, False: 13]
  ------------------
 5309|      0|            break;
 5310|       |
 5311|     13|        if (orig_count) { /* 2nd pass, see how many varbinds remain */
  ------------------
  |  Branch (5311:13): [True: 0, False: 13]
  ------------------
 5312|      0|            curr_count = count_varbinds(pdu->variables);
 5313|      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]
  |  |  ------------------
  ------------------
 5314|      0|                        curr_count));
 5315|      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]
  |  |  ------------------
  ------------------
 5316|      0|                        orig_length, length, pdu->msgMaxSize));
 5317|      0|        }
 5318|       |
 5319|       |        /** if length is less than max size, we're done (success). */
 5320|     13|        if (length <= pdu->msgMaxSize)
  ------------------
  |  Branch (5320:13): [True: 13, False: 0]
  ------------------
 5321|     13|            break;
 5322|       |
 5323|      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]
  |  |  ------------------
  ------------------
 5324|      0|                    length, pdu->msgMaxSize));
 5325|       |
 5326|       |        /** packet too big. if this is not a bulk request, we're done (err). */
 5327|      0|        if (!bulk) {
  ------------------
  |  Branch (5327:13): [True: 0, False: 0]
  ------------------
 5328|      0|           session->s_snmp_errno = SNMPERR_TOO_LONG;
  ------------------
  |  |  189|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 5329|      0|           break;
 5330|      0|        }
 5331|       |
 5332|       |        /** rebuild bulk response with truncation and fixed size */
 5333|      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
  ------------------
 5334|      0|        pktbuf_len = pdu->msgMaxSize;
 5335|       |
 5336|       |        /** save original number of varbinds & length */
 5337|      0|        if (0 == orig_count) {
  ------------------
  |  Branch (5337:13): [True: 0, False: 0]
  ------------------
 5338|      0|            curr_count = orig_count = count_varbinds(pdu->variables);
 5339|      0|            orig_length = length;
 5340|      0|        }
 5341|       |
 5342|      0|    } while(1);
  ------------------
  |  Branch (5342:13): [True: 0, Folded]
  ------------------
 5343|       |
 5344|     13|    DEBUGMSGTL(("sess_async_send",
  ------------------
  |  |   66|     13|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 13]
  |  |  ------------------
  ------------------
 5345|     13|                "final pktbuf_len after building packet %" NETSNMP_PRIz "u\n",
 5346|     13|                pktbuf_len));
 5347|     13|    if (curr_count != orig_count)
  ------------------
  |  Branch (5347:9): [True: 0, False: 13]
  ------------------
 5348|      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]
  |  |  ------------------
  ------------------
 5349|     13|                    "sending %d of %d varbinds (-%d) from bulk response\n",
 5350|     13|                    curr_count, orig_count, orig_count - curr_count));
 5351|       |
 5352|     13|    if (length > pdu->msgMaxSize) {
  ------------------
  |  Branch (5352:9): [True: 0, False: 13]
  ------------------
 5353|      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]
  |  |  ------------------
  ------------------
 5354|      0|                    "length of packet (%" NETSNMP_PRIz "u) exceeded pdu maximum (%lu)\n",
 5355|      0|                    length, pdu->msgMaxSize));
 5356|      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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5357|      0|    }
 5358|       |
 5359|     13|    if ((SNMPERR_TOO_LONG == session->s_snmp_errno) || (result < 0)) {
  ------------------
  |  |  189|     13|#define SNMPERR_TOO_LONG		(-5)
  ------------------
  |  Branch (5359:9): [True: 0, False: 13]
  |  Branch (5359:56): [True: 0, False: 13]
  ------------------
 5360|      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]
  |  |  ------------------
  ------------------
 5361|      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]
  |  |  ------------------
  ------------------
 5362|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5363|      0|    }
 5364|       |
 5365|     13|    isp->obuf = pktbuf;
 5366|     13|    isp->obuf_size = pktbuf_len;
 5367|     13|    isp->opacket = packet;
 5368|     13|    isp->opacket_len = length;
 5369|       |
 5370|     13|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     13|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5371|     13|}
snmp_sess_send:
 5403|     13|{
 5404|     13|    return snmp_sess_async_send(slp, pdu, NULL, NULL);
 5405|     13|}
snmp_sess_async_send:
 5620|     13|{
 5621|       |
 5622|     13|    return snmp_sess_async_send_cp(slp, pdu, callback, cb_data, 0);
 5623|     13|}
snmp_sess_async_send_cp:
 5629|     13|{
 5630|     13|    int             rc;
 5631|       |
 5632|     13|    if (slp == NULL) {
  ------------------
  |  Branch (5632:9): [True: 0, False: 13]
  ------------------
 5633|      0|        snmp_errno = SNMPERR_BAD_SESSION;       /*MTCRITICAL_RESOURCE */
  ------------------
  |  |  188|      0|#define SNMPERR_BAD_SESSION		(-4)
  ------------------
 5634|      0|        return (0);
 5635|      0|    }
 5636|       |    /*
 5637|       |     * send pdu
 5638|       |     */
 5639|       |
 5640|     13|    rc = _sess_async_send(slp, pdu, callback, cb_data, cp_inc);
 5641|     13|    if (rc == 0)
  ------------------
  |  Branch (5641:9): [True: 0, False: 13]
  ------------------
 5642|      0|        SET_SNMP_ERROR(slp->session->s_snmp_errno);
  ------------------
  |  |   43|      0|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 5643|     13|    return rc;
 5644|     13|}
snmp_free_var_internals:
 5652|     13|{
 5653|     13|    if (!var)
  ------------------
  |  Branch (5653:9): [True: 0, False: 13]
  ------------------
 5654|      0|        return;
 5655|       |
 5656|     13|    if (var->name != var->name_loc)
  ------------------
  |  Branch (5656:9): [True: 0, False: 13]
  ------------------
 5657|      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]
  |  |  ------------------
  ------------------
 5658|     13|    if (var->val.string != var->buf)
  ------------------
  |  Branch (5658:9): [True: 0, False: 13]
  ------------------
 5659|      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]
  |  |  ------------------
  ------------------
 5660|     13|    if (var->data) {
  ------------------
  |  Branch (5660:9): [True: 0, False: 13]
  ------------------
 5661|      0|        if (var->dataFreeHook) {
  ------------------
  |  Branch (5661:13): [True: 0, False: 0]
  ------------------
 5662|      0|            var->dataFreeHook(var->data);
 5663|      0|            var->data = NULL;
 5664|      0|        } else {
 5665|       |            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]
  |  |  ------------------
  ------------------
 5666|      0|        }
 5667|      0|    }
 5668|     13|}
snmp_free_var:
 5672|     13|{
 5673|     13|    snmp_free_var_internals(var);
 5674|     13|    free(var);
 5675|     13|}
snmp_free_varbind:
 5679|    209|{
 5680|    209|    netsnmp_variable_list *ptr;
 5681|    222|    while (var) {
  ------------------
  |  Branch (5681:12): [True: 13, False: 209]
  ------------------
 5682|     13|        ptr = var->next_variable;
 5683|     13|        snmp_free_var(var);
 5684|     13|        var = ptr;
 5685|     13|    }
 5686|    209|}
snmp_free_pdu:
 5693|    196|{
 5694|    196|    struct snmp_secmod_def *sptr;
 5695|       |
 5696|    196|    if (!pdu)
  ------------------
  |  Branch (5696:9): [True: 0, False: 196]
  ------------------
 5697|      0|        return;
 5698|       |
 5699|    196|    free_securityStateRef(pdu);
 5700|       |
 5701|    196|    sptr = find_sec_mod(pdu->securityModel);
 5702|    196|    if (sptr && sptr->pdu_free)
  ------------------
  |  Branch (5702:9): [True: 31, False: 165]
  |  Branch (5702:17): [True: 0, False: 31]
  ------------------
 5703|      0|        (*sptr->pdu_free)(pdu);
 5704|       |
 5705|    196|    snmp_free_varbind(pdu->variables);
 5706|    196|    free(pdu->enterprise);
 5707|    196|    free(pdu->community);
 5708|    196|    free(pdu->contextEngineID);
 5709|    196|    free(pdu->securityEngineID);
 5710|    196|    free(pdu->contextName);
 5711|    196|    free(pdu->securityName);
 5712|    196|    free(pdu->transport_data);
 5713|    196|    free(pdu);
 5714|    196|}
snmp_create_sess_pdu:
 5719|    183|{
 5720|    183|    netsnmp_pdu *pdu = calloc(1, sizeof(netsnmp_pdu));
 5721|    183|    if (pdu == NULL) {
  ------------------
  |  Branch (5721:9): [True: 0, False: 183]
  ------------------
 5722|      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]
  |  |  ------------------
  ------------------
 5723|      0|        return NULL;
 5724|      0|    }
 5725|       |
 5726|       |    /*
 5727|       |     * Save the transport-level data specific to this reception (e.g. UDP
 5728|       |     * source address).  
 5729|       |     */
 5730|       |
 5731|    183|    pdu->transport_data = opaque;
 5732|    183|    pdu->transport_data_length = olength;
 5733|    183|    pdu->tDomain = transport->domain;
 5734|    183|    pdu->tDomainLen = transport->domain_length;
 5735|    183|    return pdu;
 5736|    183|}
snmp_read:
 6125|     56|{
 6126|     56|    netsnmp_large_fd_set lfdset;
 6127|       |
 6128|       |    netsnmp_large_fd_set_init(&lfdset, FD_SETSIZE);
 6129|     56|    netsnmp_copy_fd_set_to_large_fd_set(&lfdset, fdset);
 6130|     56|    snmp_read2(&lfdset);
 6131|     56|    netsnmp_large_fd_set_cleanup(&lfdset);
 6132|     56|}
snmp_read2:
 6136|     56|{
 6137|     56|    struct session_list *slp, *next;
 6138|       |
 6139|     56|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     56|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 56]
  |  |  ------------------
  ------------------
 6140|    112|    for (slp = Sessions; slp; slp = next) {
  ------------------
  |  Branch (6140:26): [True: 56, False: 56]
  ------------------
 6141|     56|        next = slp->next;
 6142|     56|        snmp_sess_read2(slp, fdset);
 6143|     56|    }
 6144|     56|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     56|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 56]
  |  |  ------------------
  ------------------
 6145|     56|}
_sess_read:
 6625|     56|{
 6626|     56|    netsnmp_transport *transport;
 6627|       |
 6628|     56|    if (!slp || !fdset)
  ------------------
  |  Branch (6628:9): [True: 0, False: 56]
  |  Branch (6628:17): [True: 0, False: 56]
  ------------------
 6629|      0|        return 0;
 6630|       |
 6631|     56|    transport = slp->transport;
 6632|       |
 6633|     56|    if (!transport || !NETSNMP_LARGE_FD_ISSET(transport->sock, fdset)) {
  ------------------
  |  |   50|     56|                    netsnmp_large_fd_is_set(fd, fdset)
  ------------------
  |  Branch (6633:9): [True: 0, False: 56]
  |  Branch (6633:23): [True: 0, False: 56]
  ------------------
 6634|      0|        DEBUGMSGTL(("sess_read", "not reading transport socket\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]
  |  |  ------------------
  ------------------
 6635|      0|        return 0;
 6636|      0|    }
 6637|       |
 6638|     56|    return __sess_read(slp);
 6639|     56|}
snmp_sess_read2:
 6661|     56|{
 6662|     56|    netsnmp_session *pss;
 6663|     56|    int             rc;
 6664|       |
 6665|     56|    rc = _sess_read(slp, fdset);
 6666|     56|    pss = slp->session;
 6667|     56|    if (rc && pss->s_snmp_errno) {
  ------------------
  |  Branch (6667:9): [True: 19, False: 37]
  |  Branch (6667:15): [True: 19, False: 0]
  ------------------
 6668|     19|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   43|     19|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 6669|     19|    }
 6670|     56|    return rc;
 6671|     56|}
snmp_select_info:
 6736|     56|{
 6737|       |    return snmp_sess_select_info(NULL, numfds, fdset, timeout, block);
 6738|     56|}
snmp_sess_select_info:
 6756|     56|{
 6757|     56|    return snmp_sess_select_info_flags(slp, numfds, fdset, timeout, block,
 6758|     56|                                       NETSNMP_SELECT_NOFLAGS);
  ------------------
  |  |  198|     56|#define NETSNMP_SELECT_NOFLAGS  0x00
  ------------------
 6759|     56|}
snmp_sess_select_info_flags:
 6767|     56|{
 6768|     56|  int rc;
 6769|     56|  netsnmp_large_fd_set lfdset;
 6770|       |
 6771|     56|  netsnmp_large_fd_set_init(&lfdset, FD_SETSIZE);
 6772|     56|  netsnmp_copy_fd_set_to_large_fd_set(&lfdset, fdset);
 6773|     56|  rc = snmp_sess_select_info2_flags(slp, numfds, &lfdset, timeout,
 6774|     56|                                    block, flags);
 6775|     56|  if (netsnmp_copy_large_fd_set_to_fd_set(fdset, &lfdset) < 0) {
  ------------------
  |  Branch (6775:7): [True: 0, False: 56]
  ------------------
 6776|       |      snmp_log(LOG_ERR,
 6777|      0|	     "Use snmp_sess_select_info2() for processing"
 6778|      0|	     " large file descriptors\n");
 6779|      0|  }
 6780|     56|  netsnmp_large_fd_set_cleanup(&lfdset);
 6781|     56|  return rc;
 6782|     56|}
snmp_sess_select_info2_flags:
 6826|     56|{
 6827|     56|    struct session_list *slp, *next = NULL;
 6828|     56|    netsnmp_request_list *rp;
 6829|     56|    struct timeval  now, earliest, alarm_tm;
 6830|     56|    int             active = 0, requests = 0;
 6831|     56|    int             next_alarm = 0;
 6832|     56|    int             has_pending_data = 0;
 6833|       |
 6834|     56|    timerclear(&earliest);
 6835|       |
 6836|       |    /*
 6837|       |     * For each session examined, add its socket to the fdset,
 6838|       |     * and if it is the earliest timeout to expire, mark it as lowest.
 6839|       |     * If a single session is specified, do just for that session.
 6840|       |     */
 6841|       |
 6842|     56|    DEBUGMSGTL(("sess_select", "for %s session%s: ",
  ------------------
  |  |   66|     56|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     56|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 56]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#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: 56]
  |  |  ------------------
  ------------------
 6843|     56|                sessp ? "single" : "all", sessp ? "" : "s"));
 6844|       |
 6845|    112|    for (slp = sessp ? sessp : Sessions; slp; slp = next) {
  ------------------
  |  Branch (6845:16): [True: 0, False: 56]
  |  Branch (6845:42): [True: 56, False: 56]
  ------------------
 6846|     56|        next = slp->next;
 6847|       |
 6848|     56|        if (slp->transport == NULL) {
  ------------------
  |  Branch (6848:13): [True: 0, False: 56]
  ------------------
 6849|       |            /*
 6850|       |             * Close in progress -- skip this one.  
 6851|       |             */
 6852|      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]
  |  |  ------------------
  ------------------
 6853|      0|            continue;
 6854|      0|        }
 6855|       |
 6856|     56|        if (!NETSNMP_IS_VALID_SOCKET(slp->transport->sock)) {
  ------------------
  |  |   44|     56|#define NETSNMP_IS_VALID_SOCKET(_sock) ((_sock) != -1)
  ------------------
  |  Branch (6856:13): [True: 0, False: 56]
  ------------------
 6857|       |            /*
 6858|       |             * This session was marked for deletion.  
 6859|       |             */
 6860|      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]
  |  |  ------------------
  ------------------
 6861|      0|            if (sessp == NULL) {
  ------------------
  |  Branch (6861:17): [True: 0, False: 0]
  ------------------
 6862|      0|                snmp_close(slp->session);
 6863|      0|            } else {
 6864|      0|                snmp_sess_close(slp);
 6865|      0|            }
 6866|      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]
  |  |  ------------------
  ------------------
 6867|      0|                        sessp ? "single" : "all", sessp ? "" : "s"));
 6868|      0|            continue;
 6869|      0|        }
 6870|       |
 6871|     56|        DEBUGMSG(("sess_select", "%" NETSNMP_FMT_SKT " ",
  ------------------
  |  |   61|     56|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     56|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 56]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 56]
  |  |  ------------------
  ------------------
 6872|     56|                  slp->transport->sock));
 6873|     56|        if ((slp->transport->sock + 1) > *numfds) {
  ------------------
  |  Branch (6873:13): [True: 56, False: 0]
  ------------------
 6874|     56|            *numfds = (slp->transport->sock + 1);
 6875|     56|        }
 6876|       |
 6877|     56|        NETSNMP_LARGE_FD_SET(slp->transport->sock, fdset);
  ------------------
  |  |   35|     56|                    netsnmp_large_fd_setfd(fd, fdset)
  ------------------
 6878|     56|        if (slp->transport->f_pending &&
  ------------------
  |  Branch (6878:13): [True: 0, False: 56]
  ------------------
 6879|      0|            slp->transport->f_pending(slp->transport)) {
  ------------------
  |  Branch (6879:13): [True: 0, False: 0]
  ------------------
 6880|      0|            has_pending_data = 1;
 6881|      0|        }
 6882|     56|        if (slp->internal != NULL && slp->internal->requests) {
  ------------------
  |  Branch (6882:13): [True: 56, False: 0]
  |  Branch (6882:38): [True: 0, False: 56]
  ------------------
 6883|       |            /*
 6884|       |             * Found another session with outstanding requests.  
 6885|       |             */
 6886|      0|            requests++;
 6887|      0|            for (rp = slp->internal->requests; rp; rp = rp->next_request) {
  ------------------
  |  Branch (6887:48): [True: 0, False: 0]
  ------------------
 6888|      0|                if (!timerisset(&earliest)
  ------------------
  |  Branch (6888:21): [True: 0, False: 0]
  ------------------
 6889|      0|                    || (timerisset(&rp->expireM)
  ------------------
  |  Branch (6889:25): [True: 0, False: 0]
  ------------------
 6890|      0|                        && timercmp(&rp->expireM, &earliest, <))) {
  ------------------
  |  Branch (6890:28): [True: 0, False: 0]
  |  Branch (6890:28): [True: 0, False: 0]
  ------------------
 6891|      0|                    earliest = rp->expireM;
 6892|      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]
  |  |  ------------------
  ------------------
 6893|      0|                               (int)earliest.tv_sec, (int)earliest.tv_usec));
 6894|      0|                }
 6895|      0|            }
 6896|      0|        }
 6897|       |
 6898|     56|        active++;
 6899|     56|        if (sessp) {
  ------------------
  |  Branch (6899:13): [True: 0, False: 56]
  ------------------
 6900|       |            /*
 6901|       |             * Single session processing.  
 6902|       |             */
 6903|      0|            break;
 6904|      0|        }
 6905|     56|    }
 6906|     56|    DEBUGMSG(("sess_select", "\n"));
  ------------------
  |  |   61|     56|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     56|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 56]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 56]
  |  |  ------------------
  ------------------
 6907|       |
 6908|     56|    if (has_pending_data) {
  ------------------
  |  Branch (6908:9): [True: 0, False: 56]
  ------------------
 6909|      0|        DEBUGMSGT(("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]
  |  |  ------------------
  ------------------
 6910|      0|                   "pending transport data present, setting timeout to 0\n"));
 6911|      0|        timerclear(timeout);
 6912|      0|        *block = 0;
 6913|      0|        return active;
 6914|      0|    }
 6915|       |
 6916|     56|    netsnmp_get_monotonic_clock(&now);
 6917|       |
 6918|     56|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     56|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (6918:9): [True: 0, False: 56]
  ------------------
 6919|     56|                               NETSNMP_DS_LIB_ALARM_DONT_USE_SIG) &&
  ------------------
  |  |   71|     56|#define NETSNMP_DS_LIB_ALARM_DONT_USE_SIG  11   /* don't use the alarm() signal */
  ------------------
 6920|      0|        !(flags & NETSNMP_SELECT_NOALARMS)) {
  ------------------
  |  |  199|      0|#define NETSNMP_SELECT_NOALARMS 0x01
  ------------------
  |  Branch (6920:9): [True: 0, False: 0]
  ------------------
 6921|      0|        next_alarm = netsnmp_get_next_alarm_time(&alarm_tm, &now);
 6922|      0|        if (next_alarm)
  ------------------
  |  Branch (6922:13): [True: 0, False: 0]
  ------------------
 6923|      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]
  |  |  ------------------
  ------------------
 6924|      0|                       (long)alarm_tm.tv_sec, (long)alarm_tm.tv_usec));
 6925|      0|    }
 6926|     56|    if (next_alarm == 0 && requests == 0) {
  ------------------
  |  Branch (6926:9): [True: 56, False: 0]
  |  Branch (6926:28): [True: 56, False: 0]
  ------------------
 6927|       |        /*
 6928|       |         * If none are active, skip arithmetic.  
 6929|       |         */
 6930|     56|        DEBUGMSGT(("sess_select","blocking:no session requests or alarms.\n"));
  ------------------
  |  |   62|     56|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     56|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 56]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 56]
  |  |  ------------------
  ------------------
 6931|     56|        *block = 1; /* can block - timeout value is undefined if no requests */
 6932|     56|        return active;
 6933|     56|    }
 6934|       |
 6935|      0|    if (next_alarm &&
  ------------------
  |  Branch (6935:9): [True: 0, False: 0]
  ------------------
 6936|      0|        (!timerisset(&earliest) || timercmp(&alarm_tm, &earliest, <)))
  ------------------
  |  Branch (6936:10): [True: 0, False: 0]
  |  Branch (6936:36): [True: 0, False: 0]
  |  Branch (6936:36): [True: 0, False: 0]
  ------------------
 6937|      0|        earliest = alarm_tm;
 6938|       |
 6939|      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]
  |  |  ------------------
  ------------------
 6940|      0|    if (earliest.tv_sec < 0) {
  ------------------
  |  Branch (6940:9): [True: 0, False: 0]
  ------------------
 6941|      0|        time_t overdue_ms = -(earliest.tv_sec * 1000 + earliest.tv_usec / 1000);
 6942|      0|        if (overdue_ms >= 10)
  ------------------
  |  Branch (6942:13): [True: 0, False: 0]
  ------------------
 6943|      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]
  |  |  ------------------
  ------------------
 6944|      0|                       (long) overdue_ms));
 6945|      0|        timerclear(&earliest);
 6946|      0|    } else {
 6947|      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]
  |  |  ------------------
  ------------------
 6948|      0|                   (int)earliest.tv_sec, (int)earliest.tv_usec));
 6949|      0|    }
 6950|       |
 6951|       |    /*
 6952|       |     * if it was blocking before or our delta time is less, reset timeout 
 6953|       |     */
 6954|      0|    if ((*block || (timercmp(&earliest, timeout, <)))) {
  ------------------
  |  Branch (6954:10): [True: 0, False: 0]
  |  Branch (6954:20): [True: 0, False: 0]
  |  Branch (6954:21): [True: 0, False: 0]
  ------------------
 6955|      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]
  |  |  ------------------
  ------------------
 6956|      0|                   "setting timer to %d.%06d sec, clear block (was %d)\n",
 6957|      0|                   (int)earliest.tv_sec, (int)earliest.tv_usec, *block));
 6958|      0|        *timeout = earliest;
 6959|      0|        *block = 0;
 6960|      0|    }
 6961|      0|    return active;
 6962|     56|}
snmp_oid_compare:
 7236|    399|{
 7237|    399|    register int    len;
 7238|    399|    register const oid *name1 = in_name1;
 7239|    399|    register const oid *name2 = in_name2;
 7240|       |
 7241|       |    /*
 7242|       |     * len = minimum of len1 and len2 
 7243|       |     */
 7244|    399|    if (len1 < len2)
  ------------------
  |  Branch (7244:9): [True: 0, False: 399]
  ------------------
 7245|      0|        len = len1;
 7246|    399|    else
 7247|    399|        len = len2;
 7248|       |    /*
 7249|       |     * find first non-matching OID 
 7250|       |     */
 7251|  4.12k|    while (len-- > 0) {
  ------------------
  |  Branch (7251:12): [True: 3.99k, False: 133]
  ------------------
 7252|       |        /*
 7253|       |         * these must be done in separate comparisons, since
 7254|       |         * subtracting them and using that result has problems with
 7255|       |         * subids > 2^31. 
 7256|       |         */
 7257|  3.99k|        if (*(name1) != *(name2)) {
  ------------------
  |  Branch (7257:13): [True: 266, False: 3.72k]
  ------------------
 7258|    266|            if (*(name1) < *(name2))
  ------------------
  |  Branch (7258:17): [True: 133, False: 133]
  ------------------
 7259|    133|                return -1;
 7260|    133|            return 1;
 7261|    266|        }
 7262|  3.72k|        name1++;
 7263|  3.72k|        name2++;
 7264|  3.72k|    }
 7265|       |    /*
 7266|       |     * both OIDs equal up to length of shorter OID 
 7267|       |     */
 7268|    133|    if (len1 < len2)
  ------------------
  |  Branch (7268:9): [True: 0, False: 133]
  ------------------
 7269|      0|        return -1;
 7270|    133|    if (len2 < len1)
  ------------------
  |  Branch (7270:9): [True: 0, False: 133]
  ------------------
 7271|      0|        return 1;
 7272|    133|    return 0;
 7273|    133|}
netsnmp_oid_equals:
 7373|  3.14k|{
 7374|  3.14k|    register const oid *name1 = in_name1;
 7375|  3.14k|    register const oid *name2 = in_name2;
 7376|  3.14k|    register int    len = len1;
 7377|       |
 7378|       |    /*
 7379|       |     * len = minimum of len1 and len2 
 7380|       |     */
 7381|  3.14k|    if (len1 != len2)
  ------------------
  |  Branch (7381:9): [True: 2.17k, False: 974]
  ------------------
 7382|  2.17k|        return 1;
 7383|       |    /*
 7384|       |     * Handle 'null' OIDs
 7385|       |     */
 7386|    974|    if (len1 == 0)
  ------------------
  |  Branch (7386:9): [True: 0, False: 974]
  ------------------
 7387|      0|        return 0;   /* Two null OIDs are (trivially) the same */
 7388|    974|    if (!name1 || !name2)
  ------------------
  |  Branch (7388:9): [True: 0, False: 974]
  |  Branch (7388:19): [True: 0, False: 974]
  ------------------
 7389|      0|        return 1;   /* Otherwise something's wrong, so report a non-match */
 7390|       |    /*
 7391|       |     * find first non-matching OID 
 7392|       |     */
 7393|  8.13k|    while (len-- > 0) {
  ------------------
  |  Branch (7393:12): [True: 8.13k, False: 0]
  ------------------
 7394|       |        /*
 7395|       |         * these must be done in separate comparisons, since
 7396|       |         * subtracting them and using that result has problems with
 7397|       |         * subids > 2^31. 
 7398|       |         */
 7399|  8.13k|        if (*(name1++) != *(name2++))
  ------------------
  |  Branch (7399:13): [True: 974, False: 7.16k]
  ------------------
 7400|    974|            return 1;
 7401|  8.13k|    }
 7402|      0|    return 0;
 7403|    974|}
snmp_pdu_add_variable:
 7513|     13|{
 7514|     13|    return snmp_varlist_add_variable(&pdu->variables, name, name_length,
 7515|     13|                                     type, value, len);
 7516|     13|}
snmp_varlist_add_variable:
 7527|     13|{
 7528|     13|    netsnmp_variable_list *vars, *vtmp;
 7529|     13|    int rc;
 7530|       |
 7531|     13|    if (varlist == NULL)
  ------------------
  |  Branch (7531:9): [True: 0, False: 13]
  ------------------
 7532|      0|        return NULL;
 7533|       |
 7534|     13|    vars = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
  ------------------
  |  |   73|     13|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 7535|     13|    if (vars == NULL)
  ------------------
  |  Branch (7535:9): [True: 0, False: 13]
  ------------------
 7536|      0|        return NULL;
 7537|       |
 7538|     13|    vars->type = type;
 7539|       |
 7540|     13|    rc = snmp_set_var_value( vars, value, len );
 7541|     13|    if (( 0 != rc ) ||
  ------------------
  |  Branch (7541:9): [True: 0, False: 13]
  ------------------
 7542|     13|        (name != NULL && snmp_set_var_objid(vars, name, name_length))) {
  ------------------
  |  Branch (7542:10): [True: 13, False: 0]
  |  Branch (7542:26): [True: 0, False: 13]
  ------------------
 7543|      0|        snmp_free_var(vars);
 7544|      0|        return NULL;
 7545|      0|    }
 7546|       |
 7547|       |    /*
 7548|       |     * put only qualified variable onto varlist 
 7549|       |     */
 7550|     13|    if (*varlist == NULL) {
  ------------------
  |  Branch (7550:9): [True: 13, False: 0]
  ------------------
 7551|     13|        *varlist = vars;
 7552|     13|    } else {
 7553|      0|        for (vtmp = *varlist; vtmp->next_variable;
  ------------------
  |  Branch (7553:31): [True: 0, False: 0]
  ------------------
 7554|      0|             vtmp = vtmp->next_variable);
 7555|       |
 7556|      0|        vtmp->next_variable = vars;
 7557|      0|    }
 7558|       |
 7559|     13|    return vars;
 7560|     13|}
snmp_duplicate_objid:
 8199|    342|{
 8200|    342|    oid            *returnOid;
 8201|    342|    if (objToCopy != NULL && objToCopyLen != 0) {
  ------------------
  |  Branch (8201:9): [True: 342, False: 0]
  |  Branch (8201:30): [True: 342, False: 0]
  ------------------
 8202|    342|        returnOid = (oid *) malloc(objToCopyLen * sizeof(oid));
 8203|    342|        if (returnOid) {
  ------------------
  |  Branch (8203:13): [True: 342, False: 0]
  ------------------
 8204|    342|            memcpy(returnOid, objToCopy, objToCopyLen * sizeof(oid));
 8205|    342|        }
 8206|    342|    } else
 8207|      0|        returnOid = NULL;
 8208|    342|    return returnOid;
 8209|    342|}
snmp_increment_statistic:
 8219|    186|{
 8220|    186|    if (which >= 0 && which < NETSNMP_STAT_MAX_STATS) {
  ------------------
  |  |  710|    186|#define  NETSNMP_STAT_MAX_STATS              (STAT_TLSTM_STATS_END+1)
  |  |  ------------------
  |  |  |  |  706|    186|#define  STAT_TLSTM_STATS_END          STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES
  |  |  |  |  ------------------
  |  |  |  |  |  |  703|    186|#define  STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES              56
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (8220:9): [True: 186, False: 0]
  |  Branch (8220:23): [True: 186, False: 0]
  ------------------
 8221|    186|        statistics[which]++;
 8222|    186|        return statistics[which];
 8223|    186|    }
 8224|      0|    return 0;
 8225|    186|}
snmp_get_statistic:
 8239|     13|{
 8240|     13|    if (which >= 0 && which < NETSNMP_STAT_MAX_STATS)
  ------------------
  |  |  710|     13|#define  NETSNMP_STAT_MAX_STATS              (STAT_TLSTM_STATS_END+1)
  |  |  ------------------
  |  |  |  |  706|     13|#define  STAT_TLSTM_STATS_END          STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES
  |  |  |  |  ------------------
  |  |  |  |  |  |  703|     13|#define  STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES              56
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (8240:9): [True: 13, False: 0]
  |  Branch (8240:23): [True: 13, False: 0]
  ------------------
 8241|     13|        return statistics[which];
 8242|      0|    return 0;
 8243|     13|}
snmp_init_statistics:
 8247|     57|{
 8248|     57|    memset(statistics, 0, sizeof(statistics));
 8249|     57|}
snmp_api.c:_init_snmp:
  719|    171|{
  720|       |
  721|    171|    struct timeval  tv;
  722|    171|    long            tmpReqid, tmpMsgid;
  723|       |
  724|    171|    if (_init_snmp_init_done)
  ------------------
  |  Branch (724:9): [True: 114, False: 57]
  ------------------
  725|    114|        return;
  726|     57|    _init_snmp_init_done = 1;
  727|     57|    Reqid = 1;
  728|       |
  729|     57|    snmp_res_init();            /* initialize the mt locking structures */
  ------------------
  |  |   78|     57|#define snmp_res_init() do {} while (0)
  |  |  ------------------
  |  |  |  Branch (78:38): [Folded, False: 57]
  |  |  ------------------
  ------------------
  730|     57|#ifndef NETSNMP_DISABLE_MIB_LOADING
  731|     57|    netsnmp_init_mib_internals();
  732|     57|#endif /* NETSNMP_DISABLE_MIB_LOADING */
  733|     57|    netsnmp_tdomain_init();
  734|       |
  735|     57|    gettimeofday(&tv, (struct timezone *) 0);
  736|       |    /*
  737|       |     * Now = tv;
  738|       |     */
  739|       |
  740|       |    /*
  741|       |     * get pseudo-random values for request ID and message ID 
  742|       |     */
  743|     57|    netsnmp_srandom((unsigned)(tv.tv_sec ^ tv.tv_usec));
  744|     57|    tmpReqid = netsnmp_random();
  745|     57|    tmpMsgid = netsnmp_random();
  746|       |
  747|       |    /*
  748|       |     * don't allow zero value to repeat init 
  749|       |     */
  750|     57|    if (tmpReqid == 0)
  ------------------
  |  Branch (750:9): [True: 0, False: 57]
  ------------------
  751|      0|        tmpReqid = 1;
  752|     57|    if (tmpMsgid == 0)
  ------------------
  |  Branch (752:9): [True: 0, False: 57]
  ------------------
  753|      0|        tmpMsgid = 1;
  754|     57|    Reqid = tmpReqid;
  755|     57|    Msgid = tmpMsgid;
  756|       |
  757|     57|    netsnmp_register_default_domain("snmp", "udp udp6");
  758|     57|    netsnmp_register_default_domain("snmptrap", "udp udp6");
  759|       |
  760|     57|    netsnmp_register_default_target("snmp", "udp", ":161");
  761|     57|    netsnmp_register_default_target("snmp", "tcp", ":161");
  762|     57|    netsnmp_register_default_target("snmp", "udp6", ":161");
  763|     57|    netsnmp_register_default_target("snmp", "tcp6", ":161");
  764|     57|    netsnmp_register_default_target("snmp", "dtlsudp", ":10161");
  765|     57|    netsnmp_register_default_target("snmp", "tlstcp", ":10161");
  766|     57|    netsnmp_register_default_target("snmp", "ipx", "/36879");
  767|       |
  768|     57|    netsnmp_register_default_target("snmptrap", "udp", ":162");
  769|     57|    netsnmp_register_default_target("snmptrap", "tcp", ":162");
  770|     57|    netsnmp_register_default_target("snmptrap", "udp6", ":162");
  771|     57|    netsnmp_register_default_target("snmptrap", "tcp6", ":162");
  772|     57|    netsnmp_register_default_target("snmptrap", "dtlsudp", ":10162");
  773|     57|    netsnmp_register_default_target("snmptrap", "tlstcp", ":10162");
  774|     57|    netsnmp_register_default_target("snmptrap", "ipx", "/36880");
  775|       |
  776|     57|    netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  777|     57|                       NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH, 16);
  ------------------
  |  |  121|     57|#define NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH    6
  ------------------
  778|     57|    netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES,
  ------------------
  |  |  131|     57|#define NETSNMP_DS_LIB_RETRIES             15
  ------------------
  779|     57|                       DEFAULT_RETRIES);
  ------------------
  |  |  184|     57|#define DEFAULT_RETRIES	    5
  ------------------
  780|     57|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  781|     57|			   NETSNMP_DS_LIB_MIB_ERRORS, 1);
  ------------------
  |  |   59|     57|#define NETSNMP_DS_LIB_MIB_ERRORS          0
  ------------------
  782|       |
  783|     57|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
  784|     57|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  785|     57|			   NETSNMP_DS_LIB_REVERSE_ENCODE,
  ------------------
  |  |   80|     57|#define NETSNMP_DS_LIB_REVERSE_ENCODE      20   /* encode packets from back to front */
  ------------------
  786|     57|			   NETSNMP_DEFAULT_ASNENCODING_DIRECTION);
  ------------------
  |  | 2024|     57|#define NETSNMP_DEFAULT_ASNENCODING_DIRECTION 1 /* 1 = reverse, 0 = forwards */
  ------------------
  787|     57|#endif
  788|     57|}
snmp_api.c:register_default_handlers:
  817|     57|{
  818|     57|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "dumpPacket",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
  819|     57|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DUMP_PACKET);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DUMP_PACKET);
  ------------------
  |  |   63|     57|#define NETSNMP_DS_LIB_DUMP_PACKET         4
  ------------------
  820|     57|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "reverseEncodeBER",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
  821|     57|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_REVERSE_ENCODE);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_REVERSE_ENCODE);
  ------------------
  |  |   80|     57|#define NETSNMP_DS_LIB_REVERSE_ENCODE      20   /* encode packets from back to front */
  ------------------
  822|     57|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "defaultPort",
  ------------------
  |  |   75|     57|#define ASN_INTEGER	    0x02U
  ------------------
  823|     57|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DEFAULT_PORT);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DEFAULT_PORT);
  ------------------
  |  |  117|     57|#define NETSNMP_DS_LIB_DEFAULT_PORT         3
  ------------------
  824|     57|#ifndef NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION
  825|     57|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "disableSNMPv3",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
  826|     57|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V3);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V3);
  ------------------
  |  |  105|     57|#define NETSNMP_DS_LIB_DISABLE_V3          45 /* disable SNMPv3 */
  ------------------
  827|     57|#endif /* NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION */
  828|     57|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
  829|     57|#ifndef NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION
  830|     57|#if !defined(NETSNMP_DISABLE_SNMPV1)
  831|     57|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "disableSNMPv1",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
  832|     57|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V1);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V1);
  ------------------
  |  |  103|     57|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  ------------------
  833|     57|#endif
  834|     57|#if !defined(NETSNMP_DISABLE_SNMPV2C)
  835|     57|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "disableSNMPv2c",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
  836|     57|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V2c);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V2c);
  ------------------
  |  |  104|     57|#define NETSNMP_DS_LIB_DISABLE_V2c         44 /* disable SNMPv2c */
  ------------------
  837|     57|#endif
  838|     57|#endif /* NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION */
  839|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defCommunity",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
  840|     57|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_COMMUNITY);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_COMMUNITY);
  ------------------
  |  |  158|     57|#define NETSNMP_DS_LIB_COMMUNITY         7
  ------------------
  841|     57|#endif /* !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C) */
  842|     57|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "noTokenWarnings",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
  843|     57|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_TOKEN_WARNINGS);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_TOKEN_WARNINGS);
  ------------------
  |  |   77|     57|#define NETSNMP_DS_LIB_NO_TOKEN_WARNINGS   17   /* no warn about unknown config tokens */
  ------------------
  844|     57|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noRangeCheck",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
  845|     57|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_CHECK_RANGE);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_CHECK_RANGE);
  ------------------
  |  |   76|     57|#define NETSNMP_DS_LIB_DONT_CHECK_RANGE    16   /* don't check values for ranges on send */
  ------------------
  846|     57|    netsnmp_ds_register_premib(ASN_OCTET_STR, "snmp", "persistentDir",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
  847|     57|	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PERSISTENT_DIR);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PERSISTENT_DIR);
  ------------------
  |  |  159|     57|#define NETSNMP_DS_LIB_PERSISTENT_DIR    8
  ------------------
  848|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "tempFilePattern",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
  849|     57|	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_TEMP_FILE_PATTERN);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_TEMP_FILE_PATTERN);
  ------------------
  |  |  166|     57|#define NETSNMP_DS_LIB_TEMP_FILE_PATTERN 15
  ------------------
  850|     57|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noDisplayHint",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
  851|     57|	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
  ------------------
  |  |   90|     57|#define NETSNMP_DS_LIB_NO_DISPLAY_HINT     30 /* don't apply DISPLAY-HINTs */
  ------------------
  852|     57|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "16bitIDs",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
  853|     57|	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS);
  ------------------
  |  |   91|     57|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  854|     57|    netsnmp_ds_register_premib(ASN_OCTET_STR, "snmp", "clientaddr",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
  855|     57|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENT_ADDR);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENT_ADDR);
  ------------------
  |  |  165|     57|#define NETSNMP_DS_LIB_CLIENT_ADDR       14
  ------------------
  856|     57|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "clientaddrUsesPort",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
  857|     57|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT);
  ------------------
  |  |  102|     57|#define NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT 42 /* NETSNMP_DS_LIB_CLIENT_ADDR includes address and also port */
  ------------------
  858|     57|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "serverSendBuf",
  ------------------
  |  |   75|     57|#define ASN_INTEGER	    0x02U
  ------------------
  859|     57|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SERVERSENDBUF);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SERVERSENDBUF);
  ------------------
  |  |  122|     57|#define NETSNMP_DS_LIB_SERVERSENDBUF        7 /* send buffer (server) */
  ------------------
  860|     57|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "serverRecvBuf",
  ------------------
  |  |   75|     57|#define ASN_INTEGER	    0x02U
  ------------------
  861|     57|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SERVERRECVBUF);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SERVERRECVBUF);
  ------------------
  |  |  123|     57|#define NETSNMP_DS_LIB_SERVERRECVBUF        8 /* receive buffer (server) */
  ------------------
  862|     57|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "clientSendBuf",
  ------------------
  |  |   75|     57|#define ASN_INTEGER	    0x02U
  ------------------
  863|     57|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENTSENDBUF);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENTSENDBUF);
  ------------------
  |  |  124|     57|#define NETSNMP_DS_LIB_CLIENTSENDBUF        9 /* send buffer (client) */
  ------------------
  864|     57|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "clientRecvBuf",
  ------------------
  |  |   75|     57|#define ASN_INTEGER	    0x02U
  ------------------
  865|     57|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENTRECVBUF);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENTRECVBUF);
  ------------------
  |  |  125|     57|#define NETSNMP_DS_LIB_CLIENTRECVBUF       10 /* receive buffer (client) */
  ------------------
  866|     57|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "sendMessageMaxSize",
  ------------------
  |  |   75|     57|#define ASN_INTEGER	    0x02U
  ------------------
  867|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  868|     57|                               NETSNMP_DS_LIB_MSG_SEND_MAX);
  ------------------
  |  |  132|     57|#define NETSNMP_DS_LIB_MSG_SEND_MAX        16 /* global max response size */
  ------------------
  869|     57|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noPersistentLoad",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
  870|     57|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD);
  ------------------
  |  |   95|     57|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD  35 /* don't load persistent file */
  ------------------
  871|     57|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noPersistentSave",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
  872|     57|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE);
  ------------------
  |  |   96|     57|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE  36 /* don't save persistent file */
  ------------------
  873|     57|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp",
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
  874|     57|                               "noContextEngineIDDiscovery",
  875|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  876|     57|                               NETSNMP_DS_LIB_NO_DISCOVERY);
  ------------------
  |  |   98|     57|#define NETSNMP_DS_LIB_NO_DISCOVERY        38 /* don't support RFC5343 contextEngineID discovery */
  ------------------
  877|     57|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "timeout",
  ------------------
  |  |   75|     57|#define ASN_INTEGER	    0x02U
  ------------------
  878|     57|		               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_TIMEOUT);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_TIMEOUT);
  ------------------
  |  |  130|     57|#define NETSNMP_DS_LIB_TIMEOUT             14
  ------------------
  879|     57|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "retries",
  ------------------
  |  |   75|     57|#define ASN_INTEGER	    0x02U
  ------------------
  880|     57|		               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES);
  ------------------
  |  |  131|     57|#define NETSNMP_DS_LIB_RETRIES             15
  ------------------
  881|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "outputPrecision",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
  882|     57|                               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OUTPUT_PRECISION);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                             NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OUTPUT_PRECISION);
  ------------------
  |  |  186|     57|#define NETSNMP_DS_LIB_OUTPUT_PRECISION  35
  ------------------
  883|       |
  884|       |
  885|     57|    netsnmp_register_service_handlers();
  886|     57|}
snmp_api.c:snmp_sess_copy:
 1407|     57|{
 1408|     57|    struct session_list *psl;
 1409|     57|    psl = _sess_copy(pss);
 1410|     57|    if (!psl) {
  ------------------
  |  Branch (1410:9): [True: 0, False: 57]
  ------------------
 1411|      0|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (1411:13): [True: 0, False: 0]
  ------------------
 1412|      0|            pss->s_snmp_errno = SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1413|      0|        }
 1414|      0|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   43|      0|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 1415|      0|    }
 1416|     57|    return psl;
 1417|     57|}
snmp_api.c:_sess_copy:
 1116|     57|{
 1117|     57|    struct session_list *slp;
 1118|     57|    struct snmp_internal_session *isp;
 1119|     57|    netsnmp_session *session;
 1120|     57|    struct snmp_secmod_def *sptr;
 1121|     57|    char           *cp;
 1122|     57|    u_char         *ucp;
 1123|       |
 1124|     57|    in_session->s_snmp_errno = 0;
 1125|     57|    in_session->s_errno = 0;
 1126|       |
 1127|       |    /*
 1128|       |     * Copy session structure and link into list 
 1129|       |     */
 1130|     57|    slp = calloc(1, sizeof(struct session_list));
 1131|     57|    if (slp == NULL) {
  ------------------
  |  Branch (1131:9): [True: 0, False: 57]
  ------------------
 1132|      0|        in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1133|      0|        return (NULL);
 1134|      0|    }
 1135|       |
 1136|     57|    slp->transport = NULL;
 1137|       |
 1138|     57|    isp = calloc(1, sizeof(struct snmp_internal_session));
 1139|       |
 1140|     57|    if (isp == NULL) {
  ------------------
  |  Branch (1140:9): [True: 0, False: 57]
  ------------------
 1141|      0|        snmp_sess_close(slp);
 1142|      0|        in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1143|      0|        return (NULL);
 1144|      0|    }
 1145|       |
 1146|     57|    slp->internal = isp;
 1147|     57|    slp->session = netsnmp_memdup(in_session, sizeof(netsnmp_session));
 1148|     57|    if (slp->session == NULL) {
  ------------------
  |  Branch (1148:9): [True: 0, False: 57]
  ------------------
 1149|      0|        snmp_sess_close(slp);
 1150|      0|        in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1151|      0|        return (NULL);
 1152|      0|    }
 1153|     57|    session = slp->session;
 1154|       |
 1155|       |    /*
 1156|       |     * zero out pointers so if we have to free the session we wont free mem
 1157|       |     * owned by in_session 
 1158|       |     */
 1159|     57|    session->localname = NULL;
 1160|     57|    session->peername = NULL;
 1161|     57|    session->community = NULL;
 1162|     57|    session->contextEngineID = NULL;
 1163|     57|    session->contextName = NULL;
 1164|     57|    session->securityEngineID = NULL;
 1165|     57|    session->securityName = NULL;
 1166|     57|    session->securityAuthProto = NULL;
 1167|     57|    session->securityAuthLocalKey = NULL;
 1168|     57|    session->securityPrivProto = NULL;
 1169|     57|    session->securityPrivLocalKey = NULL;
 1170|     57|    session->sessUser = NULL;
 1171|     57|    session->paramName = NULL;
 1172|     57|#ifndef NETSNMP_NO_TRAP_STATS
 1173|     57|    session->trap_stats = NULL;
 1174|     57|#endif
 1175|       |    /*
 1176|       |     * session now points to the new structure that still contains pointers to
 1177|       |     * data allocated elsewhere.  Some of this data is copied to space malloc'd
 1178|       |     * here, and the pointer replaced with the new one.
 1179|       |     */
 1180|       |
 1181|     57|    if (in_session->peername != NULL) {
  ------------------
  |  Branch (1181:9): [True: 0, False: 57]
  ------------------
 1182|      0|        session->peername =
 1183|      0|            netsnmp_strdup_and_null((u_char*)in_session->peername,
 1184|      0|                                    strlen(in_session->peername));
 1185|      0|        if (session->peername == NULL) {
  ------------------
  |  Branch (1185:13): [True: 0, False: 0]
  ------------------
 1186|      0|            snmp_sess_close(slp);
 1187|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1188|      0|            return (NULL);
 1189|      0|        }
 1190|      0|    }
 1191|       |
 1192|       |    /*
 1193|       |     * Fill in defaults if necessary 
 1194|       |     */
 1195|     57|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 1196|     57|    if (in_session->community_len != SNMP_DEFAULT_COMMUNITY_LEN) {
  ------------------
  |  |   78|     57|#define SNMP_DEFAULT_COMMUNITY_LEN  0   /* to get a default community name */
  ------------------
  |  Branch (1196:9): [True: 0, False: 57]
  ------------------
 1197|      0|        ucp = netsnmp_memdup(in_session->community, in_session->community_len);
 1198|     57|    } else {
 1199|     57|        if ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1199:13): [True: 0, False: 57]
  ------------------
 1200|     57|					NETSNMP_DS_LIB_COMMUNITY)) != NULL) {
  ------------------
  |  |  158|     57|#define NETSNMP_DS_LIB_COMMUNITY         7
  ------------------
 1201|      0|            session->community_len = strlen(cp);
 1202|      0|            ucp = (u_char *) strdup(cp);
 1203|     57|        } else {
 1204|       |#ifdef NETSNMP_NO_ZEROLENGTH_COMMUNITY
 1205|       |            session->community_len = strlen(DEFAULT_COMMUNITY);
 1206|       |            ucp = netsnmp_memdup(DEFAULT_COMMUNITY, session->community_len);
 1207|       |#else
 1208|     57|            ucp = (u_char *) strdup("");
 1209|     57|#endif
 1210|     57|        }
 1211|     57|    }
 1212|       |
 1213|     57|    if (ucp == NULL) {
  ------------------
  |  Branch (1213:9): [True: 0, False: 57]
  ------------------
 1214|      0|        snmp_sess_close(slp);
 1215|      0|        in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1216|      0|        return (NULL);
 1217|      0|    }
 1218|     57|    session->community = ucp;   /* replace pointer with pointer to new data */
 1219|     57|#endif
 1220|       |
 1221|     57|    if (session->securityLevel <= 0) {
  ------------------
  |  Branch (1221:9): [True: 57, False: 0]
  ------------------
 1222|     57|        session->securityLevel =
 1223|     57|            netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECLEVEL);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                          netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECLEVEL);
  ------------------
  |  |  115|     57|#define NETSNMP_DS_LIB_SECLEVEL             1
  ------------------
 1224|     57|    }
 1225|       |
 1226|     57|    if (in_session->securityEngineIDLen > 0) {
  ------------------
  |  Branch (1226:9): [True: 0, False: 57]
  ------------------
 1227|      0|        ucp = netsnmp_memdup(in_session->securityEngineID,
 1228|      0|                             in_session->securityEngineIDLen);
 1229|      0|        if (ucp == NULL) {
  ------------------
  |  Branch (1229:13): [True: 0, False: 0]
  ------------------
 1230|      0|            snmp_sess_close(slp);
 1231|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1232|      0|            return (NULL);
 1233|      0|        }
 1234|      0|        session->securityEngineID = ucp;
 1235|      0|        session->securityEngineIDLen = in_session->securityEngineIDLen;
 1236|      0|    }
 1237|       |
 1238|     57|    if (in_session->contextEngineIDLen > 0) {
  ------------------
  |  Branch (1238:9): [True: 0, False: 57]
  ------------------
 1239|      0|        ucp = netsnmp_memdup(in_session->contextEngineID,
 1240|      0|                             in_session->contextEngineIDLen);
 1241|      0|        if (ucp == NULL) {
  ------------------
  |  Branch (1241:13): [True: 0, False: 0]
  ------------------
 1242|      0|            snmp_sess_close(slp);
 1243|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1244|      0|            return (NULL);
 1245|      0|        }
 1246|      0|        session->contextEngineID = ucp;
 1247|      0|        session->contextEngineIDLen = in_session->contextEngineIDLen;
 1248|     57|    } else if (in_session->securityEngineIDLen > 0) {
  ------------------
  |  Branch (1248:16): [True: 0, False: 57]
  ------------------
 1249|       |        /*
 1250|       |         * default contextEngineID to securityEngineIDLen if defined 
 1251|       |         */
 1252|      0|        ucp = netsnmp_memdup(in_session->securityEngineID,
 1253|      0|                             in_session->securityEngineIDLen);
 1254|      0|        if (ucp == NULL) {
  ------------------
  |  Branch (1254:13): [True: 0, False: 0]
  ------------------
 1255|      0|            snmp_sess_close(slp);
 1256|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1257|      0|            return (NULL);
 1258|      0|        }
 1259|      0|        session->contextEngineID = ucp;
 1260|      0|        session->contextEngineIDLen = in_session->securityEngineIDLen;
 1261|      0|    }
 1262|       |
 1263|     57|    if (in_session->contextName) {
  ------------------
  |  Branch (1263:9): [True: 0, False: 57]
  ------------------
 1264|      0|        session->contextName = strdup(in_session->contextName);
 1265|      0|        if (session->contextName == NULL) {
  ------------------
  |  Branch (1265:13): [True: 0, False: 0]
  ------------------
 1266|      0|            snmp_sess_close(slp);
 1267|      0|            return (NULL);
 1268|      0|        }
 1269|      0|        session->contextNameLen = in_session->contextNameLen;
 1270|     57|    } else {
 1271|     57|        if ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1271:13): [True: 0, False: 57]
  ------------------
 1272|     57|                                        NETSNMP_DS_LIB_CONTEXT)) != NULL)
  ------------------
  |  |  152|     57|#define NETSNMP_DS_LIB_CONTEXT           1
  ------------------
 1273|      0|            cp = strdup(cp);
 1274|     57|        else
 1275|     57|            cp = strdup(SNMP_DEFAULT_CONTEXT);
  ------------------
  |  |   92|     57|#define SNMP_DEFAULT_CONTEXT        ""
  ------------------
 1276|     57|        if (cp == NULL) {
  ------------------
  |  Branch (1276:13): [True: 0, False: 57]
  ------------------
 1277|      0|            snmp_sess_close(slp);
 1278|      0|            return (NULL);
 1279|      0|        }
 1280|     57|        session->contextName = cp;
 1281|     57|        session->contextNameLen = strlen(cp);
 1282|     57|    }
 1283|       |
 1284|     57|    if (in_session->securityName) {
  ------------------
  |  Branch (1284:9): [True: 0, False: 57]
  ------------------
 1285|      0|        session->securityName = strdup(in_session->securityName);
 1286|      0|        if (session->securityName == NULL) {
  ------------------
  |  Branch (1286:13): [True: 0, False: 0]
  ------------------
 1287|      0|            snmp_sess_close(slp);
 1288|      0|            return (NULL);
 1289|      0|        }
 1290|     57|    } else if ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1290:16): [True: 0, False: 57]
  ------------------
 1291|     57|					   NETSNMP_DS_LIB_SECNAME)) != NULL) {
  ------------------
  |  |  151|     57|#define NETSNMP_DS_LIB_SECNAME           0
  ------------------
 1292|      0|        cp = strdup(cp);
 1293|      0|        if (cp == NULL) {
  ------------------
  |  Branch (1293:13): [True: 0, False: 0]
  ------------------
 1294|      0|            snmp_sess_close(slp);
 1295|      0|            return (NULL);
 1296|      0|        }
 1297|      0|        session->securityName = cp;
 1298|      0|        session->securityNameLen = strlen(cp);
 1299|      0|    }
 1300|       |
 1301|     57|    if (in_session->securityAuthLocalKey) {
  ------------------
  |  Branch (1301:9): [True: 0, False: 57]
  ------------------
 1302|      0|            session->securityAuthLocalKey =
 1303|      0|                netsnmp_memdup(in_session->securityAuthLocalKey,
 1304|      0|                               in_session->securityAuthLocalKeyLen);
 1305|      0|            session->securityAuthLocalKeyLen =
 1306|      0|                in_session->securityAuthLocalKeyLen;
 1307|      0|    }
 1308|       |
 1309|     57|    if (in_session->securityPrivLocalKey) {
  ------------------
  |  Branch (1309:9): [True: 0, False: 57]
  ------------------
 1310|      0|            session->securityPrivLocalKey =
 1311|      0|                netsnmp_memdup(in_session->securityPrivLocalKey,
 1312|      0|                               in_session->securityPrivLocalKeyLen);
 1313|      0|            session->securityPrivLocalKeyLen =
 1314|      0|                in_session->securityPrivLocalKeyLen;
 1315|      0|    }
 1316|       |
 1317|     57|    if (session->transport_configuration) {
  ------------------
  |  Branch (1317:9): [True: 0, False: 57]
  ------------------
 1318|      0|        session->transport_configuration =
 1319|      0|            CONTAINER_DUP(session->transport_configuration, NULL, 0);
 1320|      0|        if (!session->transport_configuration) {
  ------------------
  |  Branch (1320:13): [True: 0, False: 0]
  ------------------
 1321|      0|            snmp_sess_close(slp);
 1322|      0|            return NULL;
 1323|      0|        }
 1324|      0|    }
 1325|       |
 1326|     57|    if (session->retries == SNMP_DEFAULT_RETRIES) {
  ------------------
  |  |   79|     57|#define SNMP_DEFAULT_RETRIES	    -1
  ------------------
  |  Branch (1326:9): [True: 57, False: 0]
  ------------------
 1327|     57|        int retry = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1328|     57|                                       NETSNMP_DS_LIB_RETRIES);
  ------------------
  |  |  131|     57|#define NETSNMP_DS_LIB_RETRIES             15
  ------------------
 1329|     57|        if (retry < 0)
  ------------------
  |  Branch (1329:13): [True: 0, False: 57]
  ------------------
 1330|      0|            session->retries = DEFAULT_RETRIES;
  ------------------
  |  |  184|      0|#define DEFAULT_RETRIES	    5
  ------------------
 1331|     57|        else
 1332|     57|            session->retries = retry;
 1333|     57|    }
 1334|     57|    if (session->timeout == SNMP_DEFAULT_TIMEOUT) {
  ------------------
  |  |   80|     57|#define SNMP_DEFAULT_TIMEOUT	    -1
  ------------------
  |  Branch (1334:9): [True: 57, False: 0]
  ------------------
 1335|     57|        int timeout = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1336|     57|                                         NETSNMP_DS_LIB_TIMEOUT);
  ------------------
  |  |  130|     57|#define NETSNMP_DS_LIB_TIMEOUT             14
  ------------------
 1337|     57|        if (timeout <= 0)
  ------------------
  |  Branch (1337:13): [True: 57, False: 0]
  ------------------
 1338|     57|            session->timeout = DEFAULT_TIMEOUT;
  ------------------
  |  |  185|     57|#define DEFAULT_TIMEOUT	    (1000L * 1000L)
  ------------------
 1339|      0|        else
 1340|      0|            session->timeout = timeout * 1000L * 1000L;
 1341|     57|    }
 1342|     57|    session->sessid = snmp_get_next_sessid();
 1343|       |
 1344|     57|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SESSION_INIT,
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
                  snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SESSION_INIT,
  ------------------
  |  |   29|     57|#define SNMP_CALLBACK_SESSION_INIT		5
  ------------------
 1345|     57|                        session);
 1346|       |
 1347|     57|    if ((sptr = find_sec_mod(session->securityModel)) != NULL) {
  ------------------
  |  Branch (1347:9): [True: 57, False: 0]
  ------------------
 1348|       |        /*
 1349|       |         * security module specific copying 
 1350|       |         */
 1351|     57|        if (sptr->session_setup) {
  ------------------
  |  Branch (1351:13): [True: 57, False: 0]
  ------------------
 1352|     57|            int ret = (*sptr->session_setup) (in_session, session);
 1353|     57|            if (ret != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (1353:17): [True: 0, False: 57]
  ------------------
 1354|      0|                snmp_sess_close(slp);
 1355|      0|                return NULL;
 1356|      0|            }
 1357|     57|        }
 1358|       |
 1359|       |        /*
 1360|       |         * security module specific opening
 1361|       |         */
 1362|     57|        if (sptr->session_open) {
  ------------------
  |  Branch (1362:13): [True: 0, False: 57]
  ------------------
 1363|      0|            int ret = (*sptr->session_open) (session);
 1364|      0|            if (ret != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (1364:17): [True: 0, False: 0]
  ------------------
 1365|      0|                snmp_sess_close(slp);
 1366|      0|                return NULL;
 1367|      0|            }
 1368|      0|        }
 1369|     57|    }
 1370|       |
 1371|     57|#ifndef NETSNMP_NO_WRITE_SUPPORT
 1372|     57|    if (in_session->sessUser) {
  ------------------
  |  Branch (1372:9): [True: 0, False: 57]
  ------------------
 1373|      0|        struct usmUser *user;
 1374|       |
 1375|      0|        user = calloc(1, sizeof(struct usmUser));
 1376|      0|        if (user == NULL) {
  ------------------
  |  Branch (1376:13): [True: 0, False: 0]
  ------------------
 1377|      0|            snmp_sess_close(slp);
 1378|      0|            return NULL;
 1379|      0|        }
 1380|      0|        session->sessUser = usm_cloneFrom_user(in_session->sessUser, user);
 1381|      0|    }
 1382|     57|#endif /* NETSNMP_NO_WRITE_SUPPORT */
 1383|       |
 1384|     57|    if (in_session->paramName) {
  ------------------
  |  Branch (1384:9): [True: 0, False: 57]
  ------------------
 1385|      0|        session->paramName = strdup(in_session->paramName);
 1386|      0|        if (session->paramName == NULL) {
  ------------------
  |  Branch (1386:13): [True: 0, False: 0]
  ------------------
 1387|      0|            snmp_sess_close(slp);
 1388|      0|            return NULL;
 1389|      0|        }
 1390|      0|    }
 1391|     57|#ifndef NETSNMP_NO_TRAP_STATS
 1392|     57|    if (in_session->trap_stats) {
  ------------------
  |  Branch (1392:9): [True: 0, False: 57]
  ------------------
 1393|      0|        session->trap_stats = netsnmp_memdup(in_session->trap_stats,
 1394|      0|                                             sizeof(*in_session->trap_stats));
 1395|      0|        if (session->trap_stats == NULL) {
  ------------------
  |  Branch (1395:13): [True: 0, False: 0]
  ------------------
 1396|      0|            snmp_sess_close(slp);
 1397|      0|            return NULL;
 1398|      0|        }
 1399|      0|    }
 1400|     57|#endif
 1401|       |
 1402|     57|    return (slp);
 1403|     57|}
snmp_api.c:netsnmp_free_transport_config:
 2048|     57|{
 2049|     57|    if (!tc)
  ------------------
  |  Branch (2049:9): [True: 57, False: 0]
  ------------------
 2050|     57|        return;
 2051|       |
 2052|      0|    CONTAINER_CLEAR(tc, netsnmp_free_one_tr_cfg, NULL);
 2053|      0|    CONTAINER_FREE(tc);
 2054|      0|}
snmp_api.c:snmp_free_session:
 2087|     57|{
 2088|     57|    if (!s)
  ------------------
  |  Branch (2088:9): [True: 0, False: 57]
  ------------------
 2089|      0|        return;
 2090|       |
 2091|     57|    netsnmp_cleanup_session(s);
 2092|       |
 2093|       |    /*
 2094|       |     * clear session from any callbacks
 2095|       |     */
 2096|     57|    netsnmp_callback_clear_client_arg(s, 0, 0);
 2097|       |
 2098|     57|    free(s);
 2099|     57|}
snmp_api.c:snmpv3_calc_msg_flags:
 2231|     13|{
 2232|     13|    *flags = 0;
 2233|     13|    if (sec_level == SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|     13|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (2233:9): [True: 0, False: 13]
  ------------------
 2234|      0|        *flags = SNMP_MSG_FLAG_AUTH_BIT;
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
 2235|     13|    else if (sec_level == SNMP_SEC_LEVEL_AUTHPRIV)
  ------------------
  |  |  301|     13|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2235:14): [True: 0, False: 13]
  ------------------
 2236|      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
  ------------------
 2237|       |
 2238|     13|    if (SNMP_CMD_CONFIRMED(msg_command))
  ------------------
  |  |  193|     13|#define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
  |  |  ------------------
  |  |  |  |  141|     26|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
  |  |  ------------------
  |  |  |  |  140|     26|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (193:32): [True: 0, False: 13]
  |  |  |  Branch (193:56): [True: 0, False: 13]
  |  |  ------------------
  |  |  194|     13|                               c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
  |  |  ------------------
  |  |  |  |  126|     26|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                              c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
  |  |  ------------------
  |  |  |  |  125|     26|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (194:32): [True: 0, False: 13]
  |  |  |  Branch (194:57): [True: 0, False: 13]
  |  |  ------------------
  |  |  195|     13|                               c == SNMP_MSG_SET )
  |  |  ------------------
  |  |  |  |  129|     26|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (195:32): [True: 0, False: 13]
  |  |  ------------------
  ------------------
 2239|      0|        *flags |= SNMP_MSG_FLAG_RPRT_BIT;
  ------------------
  |  |  305|      0|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 2240|       |
 2241|     13|    return;
 2242|     13|}
snmp_api.c:_snmp_build:
 2999|     13|{
 3000|     13|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 3001|     13|    u_char         *h0e = NULL;
 3002|     13|    size_t          start_offset = *offset;
 3003|     13|    long            version;
 3004|     13|    int             rc = 0;
 3005|     13|    size_t          length;
 3006|     13|#endif /* support for community based SNMP */
 3007|       |
 3008|     13|    u_char         *cp;
 3009|       |
 3010|     13|    if (NETSNMP_RUNTIME_PROTOCOL_SKIP(pdu->version)) {
  ------------------
  |  |  246|     13|    (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||        \
  |  |  ------------------
  |  |  |  |  205|     26|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|     26|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  |  |  206|     26|     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|     13|     NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver) ||        \
  |  |  ------------------
  |  |  |  |  215|     26|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|     26|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  |  |  216|     26|     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|     13|     NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver))
  |  |  ------------------
  |  |  |  |  229|     13|    ((pc_ver == SNMP_VERSION_3) &&                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|     13|#define SNMP_VERSION_3     3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (229:6): [True: 13, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  230|     13|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|     13|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (230:6): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  |  |  231|     13|                            NETSNMP_DS_LIB_DISABLE_V3))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|     13|#define NETSNMP_DS_LIB_DISABLE_V3          45 /* disable SNMPv3 */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3011|      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]
  |  |  ------------------
  ------------------
 3012|      0|                    (u_int)pdu->version));
 3013|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3014|      0|        return -1;
 3015|      0|    }
 3016|       |
 3017|     13|    session->s_snmp_errno = 0;
 3018|     13|    session->s_errno = 0;
 3019|       |
 3020|     13|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 3021|     13|    if ((pdu->flags & UCD_MSG_FLAG_BULK_TOOBIG) ||
  ------------------
  |  |  321|     13|#define UCD_MSG_FLAG_BULK_TOOBIG          0x010000
  ------------------
  |  Branch (3021:9): [True: 0, False: 13]
  ------------------
 3022|     13|        (0 == netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     13|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3022:9): [True: 0, False: 13]
  ------------------
 3023|     13|                                     NETSNMP_DS_LIB_REVERSE_ENCODE))) {
  ------------------
  |  |   80|     13|#define NETSNMP_DS_LIB_REVERSE_ENCODE      20   /* encode packets from back to front */
  ------------------
 3024|      0|        pdu->flags |= UCD_MSG_FLAG_FORWARD_ENCODE;
  ------------------
  |  |  319|      0|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
 3025|      0|    }
 3026|     13|#endif /* NETSNMP_USE_REVERSE_ASNENCODING */
 3027|       |
 3028|     13|    if (pdu->version == SNMP_VERSION_3) {
  ------------------
  |  |  113|     13|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (3028:9): [True: 13, False: 0]
  ------------------
 3029|     13|        return snmpv3_build(pkt, pkt_len, offset, session, pdu);
 3030|     13|    }
 3031|       |
 3032|      0|    switch (pdu->command) {
 3033|      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 (3033:5): [True: 0, False: 0]
  ------------------
 3034|      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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3035|      0|#ifndef NETSNMP_NOTIFY_ONLY
 3036|      0|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2440|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 3037|      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 (3037:5): [True: 0, False: 0]
  ------------------
 3038|      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 (3038:5): [True: 0, False: 0]
  ------------------
 3039|      0|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2440|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 3040|      0|#endif /* ! NETSNMP_NOTIFY_ONLY */
 3041|      0|#ifndef NETSNMP_NO_WRITE_SUPPORT
 3042|      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 (3042:5): [True: 0, False: 0]
  ------------------
 3043|      0|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 3044|       |        /*
 3045|       |         * all versions support these PDU types 
 3046|       |         */
 3047|       |        /*
 3048|       |         * initialize defaulted PDU fields 
 3049|       |         */
 3050|       |
 3051|      0|        if (pdu->errstat == SNMP_DEFAULT_ERRSTAT)
  ------------------
  |  |   84|      0|#define SNMP_DEFAULT_ERRSTAT	    -1
  ------------------
  |  Branch (3051:13): [True: 0, False: 0]
  ------------------
 3052|      0|            pdu->errstat = 0;
 3053|      0|        if (pdu->errindex == SNMP_DEFAULT_ERRINDEX)
  ------------------
  |  |   85|      0|#define SNMP_DEFAULT_ERRINDEX	    -1
  ------------------
  |  Branch (3053:13): [True: 0, False: 0]
  ------------------
 3054|      0|            pdu->errindex = 0;
 3055|      0|        break;
 3056|       |
 3057|      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 (3057:5): [True: 0, False: 0]
  ------------------
 3058|      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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3059|      0|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2440|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 3060|      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 (3060:5): [True: 0, False: 0]
  ------------------
 3061|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3062|       |        /*
 3063|       |         * not supported in SNMPv1 and SNMPsec 
 3064|       |         */
 3065|      0|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3065:13): [True: 0, False: 0]
  ------------------
 3066|      0|            session->s_snmp_errno = SNMPERR_V2_IN_V1;
  ------------------
  |  |  191|      0|#define SNMPERR_V2_IN_V1		(-7)
  ------------------
 3067|      0|            return -1;
 3068|      0|        }
 3069|      0|#endif
 3070|      0|        if (pdu->errstat == SNMP_DEFAULT_ERRSTAT)
  ------------------
  |  |   84|      0|#define SNMP_DEFAULT_ERRSTAT	    -1
  ------------------
  |  Branch (3070:13): [True: 0, False: 0]
  ------------------
 3071|      0|            pdu->errstat = 0;
 3072|      0|        if (pdu->errindex == SNMP_DEFAULT_ERRINDEX)
  ------------------
  |  |   85|      0|#define SNMP_DEFAULT_ERRINDEX	    -1
  ------------------
  |  Branch (3072:13): [True: 0, False: 0]
  ------------------
 3073|      0|            pdu->errindex = 0;
 3074|      0|        break;
 3075|       |
 3076|      0|#ifndef NETSNMP_NOTIFY_ONLY
 3077|      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 (3077:5): [True: 0, False: 0]
  ------------------
 3078|       |        /*
 3079|       |         * not supported in SNMPv1 and SNMPsec 
 3080|       |         */
 3081|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3082|      0|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3082:13): [True: 0, False: 0]
  ------------------
 3083|      0|            session->s_snmp_errno = SNMPERR_V2_IN_V1;
  ------------------
  |  |  191|      0|#define SNMPERR_V2_IN_V1		(-7)
  ------------------
 3084|      0|            return -1;
 3085|      0|        }
 3086|      0|#endif
 3087|      0|        if (pdu->max_repetitions < 0) {
  ------------------
  |  |  161|      0|#define max_repetitions errindex
  ------------------
  |  Branch (3087:13): [True: 0, False: 0]
  ------------------
 3088|      0|            session->s_snmp_errno = SNMPERR_BAD_REPETITIONS;
  ------------------
  |  |  194|      0|#define SNMPERR_BAD_REPETITIONS		(-10)
  ------------------
 3089|      0|            return -1;
 3090|      0|        }
 3091|      0|        if (pdu->non_repeaters < 0) {
  ------------------
  |  |  160|      0|#define non_repeaters	errstat
  ------------------
  |  Branch (3091:13): [True: 0, False: 0]
  ------------------
 3092|      0|            session->s_snmp_errno = SNMPERR_BAD_REPEATERS;
  ------------------
  |  |  193|      0|#define SNMPERR_BAD_REPEATERS		(-9)
  ------------------
 3093|      0|            return -1;
 3094|      0|        }
 3095|      0|        break;
 3096|      0|#endif /* ! NETSNMP_NOTIFY_ONLY */
 3097|       |
 3098|      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 (3098:5): [True: 0, False: 0]
  ------------------
 3099|       |        /*
 3100|       |         * *only* supported in SNMPv1 and SNMPsec 
 3101|       |         */
 3102|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3103|      0|        if (pdu->version != SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3103:13): [True: 0, False: 0]
  ------------------
 3104|      0|            session->s_snmp_errno = SNMPERR_V1_IN_V2;
  ------------------
  |  |  192|      0|#define SNMPERR_V1_IN_V2		(-8)
  ------------------
 3105|      0|            return -1;
 3106|      0|        }
 3107|      0|#endif
 3108|       |        /*
 3109|       |         * initialize defaulted Trap PDU fields 
 3110|       |         */
 3111|      0|        pdu->reqid = 1;         /* give a bogus non-error reqid for traps */
 3112|      0|        if (pdu->enterprise_length == SNMP_DEFAULT_ENTERPRISE_LENGTH) {
  ------------------
  |  |   88|      0|#define SNMP_DEFAULT_ENTERPRISE_LENGTH	0
  ------------------
  |  Branch (3112:13): [True: 0, False: 0]
  ------------------
 3113|      0|            pdu->enterprise = netsnmp_memdup(DEFAULT_ENTERPRISE,
  ------------------
  |  |  187|      0|#define DEFAULT_ENTERPRISE  default_enterprise
  ------------------
 3114|      0|                                             sizeof(DEFAULT_ENTERPRISE));
  ------------------
  |  |  187|      0|#define DEFAULT_ENTERPRISE  default_enterprise
  ------------------
 3115|      0|            if (pdu->enterprise == NULL) {
  ------------------
  |  Branch (3115:17): [True: 0, False: 0]
  ------------------
 3116|      0|                session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3117|      0|                return -1;
 3118|      0|            }
 3119|      0|            pdu->enterprise_length =
 3120|      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]))]))
  ------------------
 3121|      0|        }
 3122|      0|        if (pdu->time == SNMP_DEFAULT_TIME)
  ------------------
  |  |   89|      0|#define SNMP_DEFAULT_TIME	    0
  ------------------
  |  Branch (3122:13): [True: 0, False: 0]
  ------------------
 3123|      0|            pdu->time = DEFAULT_TIME;
  ------------------
  |  |  188|      0|#define DEFAULT_TIME	    0
  ------------------
 3124|       |        /*
 3125|       |         * don't expect a response 
 3126|       |         */
 3127|      0|        pdu->flags &= (~UCD_MSG_FLAG_EXPECT_RESPONSE);
  ------------------
  |  |  312|      0|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
 3128|      0|        break;
 3129|       |
 3130|      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 (3130:5): [True: 0, False: 0]
  ------------------
 3131|      0|    default:
  ------------------
  |  Branch (3131:5): [True: 0, False: 0]
  ------------------
 3132|      0|        session->s_snmp_errno = SNMPERR_UNKNOWN_PDU;
  ------------------
  |  |  207|      0|#define SNMPERR_UNKNOWN_PDU		(-23)
  ------------------
 3133|      0|        return -1;
 3134|      0|    }
 3135|       |
 3136|       |    /*
 3137|       |     * save length 
 3138|       |     */
 3139|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 3140|      0|    length = *pkt_len;
 3141|      0|#endif
 3142|       |
 3143|       |    /*
 3144|       |     * setup administrative fields based on version 
 3145|       |     */
 3146|       |    /*
 3147|       |     * build the message wrapper and all the administrative fields
 3148|       |     * upto the PDU sequence
 3149|       |     * (note that actual length of message will be inserted later) 
 3150|       |     */
 3151|      0|    switch (pdu->version) {
 3152|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3153|      0|    case SNMP_VERSION_1:
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3153:5): [True: 0, False: 0]
  ------------------
 3154|      0|#endif
 3155|      0|#ifndef NETSNMP_DISABLE_SNMPV2C
 3156|      0|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|      0|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (3156:5): [True: 0, False: 0]
  ------------------
 3157|      0|#endif
 3158|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 3159|       |#ifdef NETSNMP_NO_ZEROLENGTH_COMMUNITY
 3160|       |        if (pdu->community_len == 0) {
 3161|       |            if (session->community_len == 0) {
 3162|       |                session->s_snmp_errno = SNMPERR_BAD_COMMUNITY;
 3163|       |                return -1;
 3164|       |            }
 3165|       |            pdu->community = netsnmp_memdup(session->community,
 3166|       |                                            session->community_len);
 3167|       |            if (pdu->community == NULL) {
 3168|       |                session->s_snmp_errno = SNMPERR_MALLOC;
 3169|       |                return -1;
 3170|       |            }
 3171|       |            pdu->community_len = session->community_len;
 3172|       |        }
 3173|       |#else                           /* !NETSNMP_NO_ZEROLENGTH_COMMUNITY */
 3174|      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 (3174:13): [True: 0, False: 0]
  |  Branch (3174:40): [True: 0, False: 0]
  ------------------
 3175|       |            /*
 3176|       |             * copy session community exactly to pdu community 
 3177|       |             */
 3178|      0|            if (0 == session->community_len) {
  ------------------
  |  Branch (3178:17): [True: 0, False: 0]
  ------------------
 3179|      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]
  |  |  ------------------
  ------------------
 3180|      0|            } else if (pdu->community_len == session->community_len) {
  ------------------
  |  Branch (3180:24): [True: 0, False: 0]
  ------------------
 3181|      0|                memmove(pdu->community,
 3182|      0|                        session->community, session->community_len);
 3183|      0|            } else {
 3184|      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]
  |  |  ------------------
  ------------------
 3185|      0|                pdu->community = netsnmp_memdup(session->community,
 3186|      0|                                                session->community_len);
 3187|      0|                if (pdu->community == NULL) {
  ------------------
  |  Branch (3187:21): [True: 0, False: 0]
  ------------------
 3188|      0|                    session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3189|      0|                    return -1;
 3190|      0|                }
 3191|      0|            }
 3192|      0|            pdu->community_len = session->community_len;
 3193|      0|        }
 3194|      0|#endif                          /* !NETSNMP_NO_ZEROLENGTH_COMMUNITY */
 3195|       |
 3196|      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]
  |  |  ------------------
  ------------------
 3197|      0|                    (1 + pdu->version)));
 3198|      0|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 3199|      0|        if (!(pdu->flags & UCD_MSG_FLAG_FORWARD_ENCODE)) {
  ------------------
  |  |  319|      0|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
  |  Branch (3199:13): [True: 0, False: 0]
  ------------------
 3200|      0|            DEBUGPRINTPDUTYPE("send", pdu->command);
  ------------------
  |  |  440|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3201|      0|            rc = snmp_pdu_realloc_rbuild(pkt, pkt_len, offset, pdu);
 3202|      0|            if (rc == 0) {
  ------------------
  |  Branch (3202:17): [True: 0, False: 0]
  ------------------
 3203|      0|                return -1;
 3204|      0|            }
 3205|       |
 3206|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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]
  |  |  ------------------
  ------------------
 3207|      0|            rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 3208|      0|                                           (u_char) (ASN_UNIVERSAL |
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
 3209|      0|                                                     ASN_PRIMITIVE |
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3210|      0|                                                     ASN_OCTET_STR),
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 3211|      0|                                           pdu->community,
 3212|      0|                                           pdu->community_len);
 3213|      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]
  |  |  ------------------
  ------------------
 3214|      0|            if (rc == 0) {
  ------------------
  |  Branch (3214:17): [True: 0, False: 0]
  ------------------
 3215|      0|                return -1;
 3216|      0|            }
 3217|       |
 3218|       |
 3219|       |            /*
 3220|       |             * Store the version field.  
 3221|       |             */
 3222|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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]
  |  |  ------------------
  ------------------
 3223|       |
 3224|      0|            version = pdu->version;
 3225|      0|            rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3226|      0|                                        (u_char) (ASN_UNIVERSAL |
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
 3227|      0|                                                  ASN_PRIMITIVE |
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3228|      0|                                                  ASN_INTEGER),
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
 3229|      0|                                        (long *) &version,
 3230|      0|                                        sizeof(version));
 3231|      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]
  |  |  ------------------
  ------------------
 3232|      0|            if (rc == 0) {
  ------------------
  |  Branch (3232:17): [True: 0, False: 0]
  ------------------
 3233|      0|                return -1;
 3234|      0|            }
 3235|       |
 3236|       |            /*
 3237|       |             * Build the final sequence.  
 3238|       |             */
 3239|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3240|      0|            if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3240:17): [True: 0, False: 0]
  ------------------
 3241|      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]
  |  |  ------------------
  ------------------
 3242|      0|            } else {
 3243|      0|#endif
 3244|      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]
  |  |  ------------------
  ------------------
 3245|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3246|      0|            }
 3247|      0|#endif
 3248|      0|            rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 3249|      0|                                             (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      0|#define ASN_SEQUENCE	    0x10U
  ------------------
 3250|      0|                                                       ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3251|      0|                                             *offset - start_offset);
 3252|      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]
  |  |  ------------------
  ------------------
 3253|       |
 3254|      0|            if (rc == 0) {
  ------------------
  |  Branch (3254:17): [True: 0, False: 0]
  ------------------
 3255|      0|                return -1;
 3256|      0|            }
 3257|      0|            return 0;
 3258|      0|        } else {
 3259|       |
 3260|      0|#endif                          /* NETSNMP_USE_REVERSE_ASNENCODING */
 3261|       |            /*
 3262|       |             * Save current location and build SEQUENCE tag and length
 3263|       |             * placeholder for SNMP message sequence
 3264|       |             * (actual length will be inserted later) 
 3265|       |             */
 3266|      0|            cp = asn_build_sequence(*pkt, pkt_len,
 3267|      0|                                    (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      0|#define ASN_SEQUENCE	    0x10U
  ------------------
 3268|      0|                                              ASN_CONSTRUCTOR), 0);
  ------------------
  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3269|      0|            if (cp == NULL) {
  ------------------
  |  Branch (3269:17): [True: 0, False: 0]
  ------------------
 3270|      0|                return -1;
 3271|      0|            }
 3272|      0|            h0e = cp;
 3273|       |
 3274|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3275|      0|            if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3275:17): [True: 0, False: 0]
  ------------------
 3276|      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]
  |  |  ------------------
  ------------------
 3277|      0|            } else {
 3278|      0|#endif
 3279|      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]
  |  |  ------------------
  ------------------
 3280|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3281|      0|            }
 3282|      0|#endif
 3283|       |
 3284|       |            /*
 3285|       |             * store the version field 
 3286|       |             */
 3287|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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]
  |  |  ------------------
  ------------------
 3288|       |
 3289|      0|            version = pdu->version;
 3290|      0|            cp = asn_build_int(cp, pkt_len,
 3291|      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
  ------------------
 3292|      0|                                         ASN_INTEGER), (long *) &version,
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
 3293|      0|                               sizeof(version));
 3294|      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]
  |  |  ------------------
  ------------------
 3295|      0|            if (cp == NULL)
  ------------------
  |  Branch (3295:17): [True: 0, False: 0]
  ------------------
 3296|      0|                return -1;
 3297|       |
 3298|       |            /*
 3299|       |             * store the community string 
 3300|       |             */
 3301|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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]
  |  |  ------------------
  ------------------
 3302|      0|            cp = asn_build_string(cp, pkt_len,
 3303|      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
  ------------------
 3304|      0|                                            ASN_OCTET_STR), pdu->community,
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 3305|      0|                                  pdu->community_len);
 3306|      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]
  |  |  ------------------
  ------------------
 3307|      0|            if (cp == NULL)
  ------------------
  |  Branch (3307:17): [True: 0, False: 0]
  ------------------
 3308|      0|                return -1;
 3309|      0|            break;
 3310|       |
 3311|      0|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 3312|      0|        }
 3313|      0|#endif                          /* NETSNMP_USE_REVERSE_ASNENCODING */
 3314|      0|        break;
 3315|      0|#endif /* support for community based SNMP */
 3316|      0|    case SNMP_VERSION_2p:
  ------------------
  |  |  119|      0|#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
  ------------------
  |  Branch (3316:5): [True: 0, False: 0]
  ------------------
 3317|      0|    case SNMP_VERSION_sec:
  ------------------
  |  |  118|      0|#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
  ------------------
  |  Branch (3317:5): [True: 0, False: 0]
  ------------------
 3318|      0|    case SNMP_VERSION_2u:
  ------------------
  |  |  112|      0|#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
  ------------------
  |  Branch (3318:5): [True: 0, False: 0]
  ------------------
 3319|      0|    case SNMP_VERSION_2star:
  ------------------
  |  |  120|      0|#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
  ------------------
  |  Branch (3319:5): [True: 0, False: 0]
  ------------------
 3320|      0|    default:
  ------------------
  |  Branch (3320:5): [True: 0, False: 0]
  ------------------
 3321|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3322|      0|        return -1;
 3323|      0|    }
 3324|       |
 3325|      0|    DEBUGPRINTPDUTYPE("send", pdu->command);
  ------------------
  |  |  440|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3326|      0|    cp = snmp_pdu_build(pdu, cp, pkt_len);
 3327|      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]
  |  |  ------------------
  ------------------
 3328|      0|    if (cp == NULL)
  ------------------
  |  Branch (3328:9): [True: 0, False: 0]
  ------------------
 3329|      0|        return -1;
 3330|       |
 3331|       |    /*
 3332|       |     * insert the actual length of the message sequence 
 3333|       |     */
 3334|      0|    switch (pdu->version) {
 3335|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3336|      0|    case SNMP_VERSION_1:
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3336:5): [True: 0, False: 0]
  ------------------
 3337|      0|#endif
 3338|      0|#ifndef NETSNMP_DISABLE_SNMPV2C
 3339|      0|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|      0|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (3339:5): [True: 0, False: 0]
  ------------------
 3340|      0|#endif
 3341|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 3342|      0|        asn_build_sequence(*pkt, &length,
 3343|      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
  ------------------
 3344|      0|                           cp - h0e);
 3345|      0|        break;
 3346|      0|#endif /* support for community based SNMP */
 3347|       |
 3348|      0|    case SNMP_VERSION_2p:
  ------------------
  |  |  119|      0|#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
  ------------------
  |  Branch (3348:5): [True: 0, False: 0]
  ------------------
 3349|      0|    case SNMP_VERSION_sec:
  ------------------
  |  |  118|      0|#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
  ------------------
  |  Branch (3349:5): [True: 0, False: 0]
  ------------------
 3350|      0|    case SNMP_VERSION_2u:
  ------------------
  |  |  112|      0|#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
  ------------------
  |  Branch (3350:5): [True: 0, False: 0]
  ------------------
 3351|      0|    case SNMP_VERSION_2star:
  ------------------
  |  |  120|      0|#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
  ------------------
  |  Branch (3351:5): [True: 0, False: 0]
  ------------------
 3352|      0|    default:
  ------------------
  |  Branch (3352:5): [True: 0, False: 0]
  ------------------
 3353|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3354|      0|        return -1;
 3355|      0|    }
 3356|      0|    *pkt_len = cp - *pkt;
 3357|      0|    return 0;
 3358|      0|}
snmp_api.c:snmpv3_build:
 2307|     13|{
 2308|     13|    int             ret;
 2309|       |
 2310|     13|    session->s_snmp_errno = 0;
 2311|     13|    session->s_errno = 0;
 2312|       |
 2313|       |    /*
 2314|       |     * do validation for PDU types 
 2315|       |     */
 2316|     13|    switch (pdu->command) {
 2317|      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 (2317:5): [True: 0, False: 13]
  ------------------
 2318|      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 (2318:5): [True: 0, False: 13]
  ------------------
 2319|     13|    case SNMP_MSG_REPORT:
  ------------------
  |  |  147|     13|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2319:5): [True: 13, False: 0]
  ------------------
 2320|     13|        netsnmp_assert(0 == (pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE));
  ------------------
  |  |   47|     13|#      define netsnmp_assert(x)  do { \
  |  |   48|     13|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 13, False: 0]
  |  |  ------------------
  |  |   49|     13|                 ; \
  |  |   50|     13|              else \
  |  |   51|     13|                 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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     13|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2321|     13|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2440|     13|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 2322|     13|    case SNMP_MSG_INFORM:
  ------------------
  |  |  141|     13|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2322:5): [True: 0, False: 13]
  ------------------
 2323|     13|#ifndef NETSNMP_NOTIFY_ONLY
 2324|     13|    case SNMP_MSG_GET:
  ------------------
  |  |  125|     13|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2324:5): [True: 0, False: 13]
  ------------------
 2325|     13|    case SNMP_MSG_GETNEXT:
  ------------------
  |  |  126|     13|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2325:5): [True: 0, False: 13]
  ------------------
 2326|     13|#endif /* ! NETSNMP_NOTIFY_ONLY */
 2327|     13|#ifndef NETSNMP_NO_WRITE_SUPPORT
 2328|     13|    case SNMP_MSG_SET:
  ------------------
  |  |  129|     13|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2328:5): [True: 0, False: 13]
  ------------------
 2329|     13|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 2330|     13|        if (pdu->errstat == SNMP_DEFAULT_ERRSTAT)
  ------------------
  |  |   84|     13|#define SNMP_DEFAULT_ERRSTAT	    -1
  ------------------
  |  Branch (2330:13): [True: 0, False: 13]
  ------------------
 2331|      0|            pdu->errstat = 0;
 2332|     13|        if (pdu->errindex == SNMP_DEFAULT_ERRINDEX)
  ------------------
  |  |   85|     13|#define SNMP_DEFAULT_ERRINDEX	    -1
  ------------------
  |  Branch (2332:13): [True: 0, False: 13]
  ------------------
 2333|      0|            pdu->errindex = 0;
 2334|     13|        break;
 2335|       |
 2336|      0|#ifndef NETSNMP_NOTIFY_ONLY
 2337|      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 (2337:5): [True: 0, False: 13]
  ------------------
 2338|      0|        if (pdu->max_repetitions < 0) {
  ------------------
  |  |  161|      0|#define max_repetitions errindex
  ------------------
  |  Branch (2338:13): [True: 0, False: 0]
  ------------------
 2339|      0|            session->s_snmp_errno = SNMPERR_BAD_REPETITIONS;
  ------------------
  |  |  194|      0|#define SNMPERR_BAD_REPETITIONS		(-10)
  ------------------
 2340|      0|            return -1;
 2341|      0|        }
 2342|      0|        if (pdu->non_repeaters < 0) {
  ------------------
  |  |  160|      0|#define non_repeaters	errstat
  ------------------
  |  Branch (2342:13): [True: 0, False: 0]
  ------------------
 2343|      0|            session->s_snmp_errno = SNMPERR_BAD_REPEATERS;
  ------------------
  |  |  193|      0|#define SNMPERR_BAD_REPEATERS		(-9)
  ------------------
 2344|      0|            return -1;
 2345|      0|        }
 2346|      0|        break;
 2347|      0|#endif /* ! NETSNMP_NOTIFY_ONLY */
 2348|       |
 2349|      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 (2349:5): [True: 0, False: 13]
  ------------------
 2350|      0|        session->s_snmp_errno = SNMPERR_V1_IN_V2;
  ------------------
  |  |  192|      0|#define SNMPERR_V1_IN_V2		(-8)
  ------------------
 2351|      0|        return -1;
 2352|       |
 2353|      0|    default:
  ------------------
  |  Branch (2353:5): [True: 0, False: 13]
  ------------------
 2354|      0|        session->s_snmp_errno = SNMPERR_UNKNOWN_PDU;
  ------------------
  |  |  207|      0|#define SNMPERR_UNKNOWN_PDU		(-23)
  ------------------
 2355|      0|        return -1;
 2356|     13|    }
 2357|       |
 2358|       |    /* Do we need to set the session security engineid? */
 2359|     13|    if (pdu->securityEngineIDLen == 0) {
  ------------------
  |  Branch (2359:9): [True: 0, False: 13]
  ------------------
 2360|      0|        if (session->securityEngineIDLen) {
  ------------------
  |  Branch (2360:13): [True: 0, False: 0]
  ------------------
 2361|      0|            snmpv3_clone_engineID(&pdu->securityEngineID,
 2362|      0|                                  &pdu->securityEngineIDLen,
 2363|      0|                                  session->securityEngineID,
 2364|      0|                                  session->securityEngineIDLen);
 2365|      0|        }
 2366|      0|    }
 2367|       |    
 2368|       |    /* Do we need to set the session context engineid? */
 2369|     13|    if (pdu->contextEngineIDLen == 0) {
  ------------------
  |  Branch (2369:9): [True: 0, False: 13]
  ------------------
 2370|      0|        if (session->contextEngineIDLen) {
  ------------------
  |  Branch (2370:13): [True: 0, False: 0]
  ------------------
 2371|      0|            snmpv3_clone_engineID(&pdu->contextEngineID,
 2372|      0|                                  &pdu->contextEngineIDLen,
 2373|      0|                                  session->contextEngineID,
 2374|      0|                                  session->contextEngineIDLen);
 2375|      0|        } else if (pdu->securityEngineIDLen) {
  ------------------
  |  Branch (2375:20): [True: 0, False: 0]
  ------------------
 2376|      0|            snmpv3_clone_engineID(&pdu->contextEngineID,
 2377|      0|                                  &pdu->contextEngineIDLen,
 2378|      0|                                  pdu->securityEngineID,
 2379|      0|                                  pdu->securityEngineIDLen);
 2380|      0|        }
 2381|      0|    }
 2382|       |
 2383|     13|    if (pdu->contextName == NULL) {
  ------------------
  |  Branch (2383:9): [True: 0, False: 13]
  ------------------
 2384|      0|        if (!session->contextName) {
  ------------------
  |  Branch (2384:13): [True: 0, False: 0]
  ------------------
 2385|      0|            session->s_snmp_errno = SNMPERR_BAD_CONTEXT;
  ------------------
  |  |  201|      0|#define SNMPERR_BAD_CONTEXT		(-17)
  ------------------
 2386|      0|            return -1;
 2387|      0|        }
 2388|      0|        pdu->contextName = strdup(session->contextName);
 2389|      0|        if (pdu->contextName == NULL) {
  ------------------
  |  Branch (2389:13): [True: 0, False: 0]
  ------------------
 2390|      0|            session->s_snmp_errno = SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 2391|      0|            return -1;
 2392|      0|        }
 2393|      0|        pdu->contextNameLen = session->contextNameLen;
 2394|      0|    }
 2395|     13|    if (pdu->securityModel == SNMP_DEFAULT_SECMODEL) {
  ------------------
  |  |   91|     13|#define SNMP_DEFAULT_SECMODEL	    -1
  ------------------
  |  Branch (2395:9): [True: 0, False: 13]
  ------------------
 2396|      0|        pdu->securityModel = session->securityModel;
 2397|      0|        if (pdu->securityModel == SNMP_DEFAULT_SECMODEL) {
  ------------------
  |  |   91|      0|#define SNMP_DEFAULT_SECMODEL	    -1
  ------------------
  |  Branch (2397:13): [True: 0, False: 0]
  ------------------
 2398|      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
  ------------------
 2399|       |            
 2400|      0|            if (pdu->securityModel <= 0) {
  ------------------
  |  Branch (2400:17): [True: 0, False: 0]
  ------------------
 2401|      0|                pdu->securityModel = SNMP_SEC_MODEL_USM;
  ------------------
  |  |  295|      0|#define SNMP_SEC_MODEL_USM		3
  ------------------
 2402|      0|            }
 2403|      0|        }
 2404|      0|    }
 2405|     13|    if (pdu->securityNameLen == 0 && pdu->securityName == NULL) {
  ------------------
  |  Branch (2405:9): [True: 13, False: 0]
  |  Branch (2405:38): [True: 0, False: 13]
  ------------------
 2406|      0|        if (session->securityModel != SNMP_SEC_MODEL_TSM &&
  ------------------
  |  |  296|      0|#define SNMP_SEC_MODEL_TSM              4
  ------------------
  |  Branch (2406:13): [True: 0, False: 0]
  ------------------
 2407|      0|            session->securityNameLen == 0) {
  ------------------
  |  Branch (2407:13): [True: 0, False: 0]
  ------------------
 2408|      0|            session->s_snmp_errno = SNMPERR_BAD_SEC_NAME;
  ------------------
  |  |  211|      0|#define SNMPERR_BAD_SEC_NAME 		(-27)
  ------------------
 2409|      0|            return -1;
 2410|      0|        }
 2411|      0|        if (session->securityName) {
  ------------------
  |  Branch (2411:13): [True: 0, False: 0]
  ------------------
 2412|      0|            pdu->securityName = strdup(session->securityName);
 2413|      0|            if (pdu->securityName == NULL) {
  ------------------
  |  Branch (2413:17): [True: 0, False: 0]
  ------------------
 2414|      0|                session->s_snmp_errno = SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 2415|      0|                return -1;
 2416|      0|            }
 2417|      0|            pdu->securityNameLen = session->securityNameLen;
 2418|      0|        } else {
 2419|      0|            pdu->securityName = strdup("");
 2420|      0|            session->securityName = strdup("");
 2421|      0|        }
 2422|      0|    }
 2423|     13|    if (pdu->securityLevel == 0) {
  ------------------
  |  Branch (2423:9): [True: 0, False: 13]
  ------------------
 2424|      0|        if (session->securityLevel == 0) {
  ------------------
  |  Branch (2424:13): [True: 0, False: 0]
  ------------------
 2425|      0|            session->s_snmp_errno = SNMPERR_BAD_SEC_LEVEL;
  ------------------
  |  |  212|      0|#define SNMPERR_BAD_SEC_LEVEL 		(-28)
  ------------------
 2426|      0|            return -1;
 2427|      0|        }
 2428|      0|        pdu->securityLevel = session->securityLevel;
 2429|      0|    }
 2430|     13|    DEBUGMSGTL(("snmp_build",
  ------------------
  |  |   66|     13|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#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: 13]
  |  |  ------------------
  ------------------
 2431|     13|                "Building SNMPv3 message (secName:\"%s\", secLevel:%s)...\n",
 2432|     13|                ((session->securityName) ? (char *) session->securityName :
 2433|     13|                 ((pdu->securityName) ? (char *) pdu->securityName :
 2434|     13|                  "ERROR: undefined")), secLevelName[pdu->securityLevel]));
 2435|       |
 2436|     13|    DEBUGDUMPSECTION("send", "SNMPv3 Message");
  ------------------
  |  |   81|     13|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 13]
  |  |  ------------------
  ------------------
 2437|     13|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 2438|     13|    if (!(pdu->flags & UCD_MSG_FLAG_FORWARD_ENCODE)) {
  ------------------
  |  |  319|     13|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
  |  Branch (2438:9): [True: 13, False: 0]
  ------------------
 2439|     13|        ret = snmpv3_packet_realloc_rbuild(pkt, pkt_len, offset,
 2440|     13|                                           session, pdu, NULL, 0);
 2441|     13|    } else {
 2442|      0|#endif
 2443|      0|        ret = snmpv3_packet_build(session, pdu, *pkt, pkt_len, NULL, 0);
 2444|      0|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 2445|      0|    }
 2446|     13|#endif
 2447|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2448|     13|    if (-1 != ret) {
  ------------------
  |  Branch (2448:9): [True: 13, False: 0]
  ------------------
 2449|     13|        session->s_snmp_errno = ret;
 2450|     13|    }
 2451|       |
 2452|     13|    return ret;
 2453|       |
 2454|     13|}                               /* end snmpv3_build() */
snmp_api.c:free_securityStateRef:
 4196|    248|{
 4197|    248|    struct snmp_secmod_def *sptr;
 4198|       |
 4199|    248|    if (!pdu->securityStateRef)
  ------------------
  |  Branch (4199:9): [True: 248, False: 0]
  ------------------
 4200|    248|        return;
 4201|       |
 4202|      0|    sptr = find_sec_mod(pdu->securityModel);
 4203|      0|    if (sptr) {
  ------------------
  |  Branch (4203:9): [True: 0, False: 0]
  ------------------
 4204|      0|        if (sptr->pdu_free_state_ref) {
  ------------------
  |  Branch (4204:13): [True: 0, False: 0]
  ------------------
 4205|      0|            (*sptr->pdu_free_state_ref) (pdu->securityStateRef);
 4206|      0|        } else {
 4207|      0|            snmp_log(LOG_ERR,
 4208|      0|                     "Security Model %d can't free state references\n",
 4209|      0|                     pdu->securityModel);
 4210|      0|	}
 4211|      0|    } else {
 4212|      0|	snmp_log(LOG_ERR,
 4213|      0|		 "Can't find security model to free ptr: %d\n",
 4214|      0|		 pdu->securityModel);
 4215|      0|    }
 4216|       |    pdu->securityStateRef = NULL;
 4217|      0|}
snmp_api.c:_snmp_parse:
 4422|    183|{
 4423|    183|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4424|    183|    u_char          community[COMMUNITY_MAX_LEN];
 4425|    183|    size_t          community_length = COMMUNITY_MAX_LEN;
  ------------------
  |  |   41|    183|#define COMMUNITY_MAX_LEN	256
  ------------------
 4426|    183|#endif
 4427|    183|    int             result = -1;
 4428|       |
 4429|    183|    static const oid snmpEngineIDoid[]   = { 1,3,6,1,6,3,10,2,1,1,0};
 4430|    183|    static size_t   snmpEngineIDoid_len = 11;
 4431|       |
 4432|    183|    static char     ourEngineID[SNMP_SEC_PARAM_BUF_SIZE];
 4433|    183|    static size_t   ourEngineID_len = sizeof(ourEngineID);
 4434|       |
 4435|    183|    netsnmp_pdu    *pdu2 = NULL;
 4436|       |
 4437|    183|    session->s_snmp_errno = 0;
 4438|    183|    session->s_errno = 0;
 4439|       |
 4440|       |    /*
 4441|       |     * Ensure all incoming PDUs have a unique means of identification 
 4442|       |     * (This is not restricted to AgentX handling,
 4443|       |     * though that is where the need becomes visible)   
 4444|       |     */
 4445|    183|    pdu->transid = snmp_get_next_transid();
 4446|       |
 4447|    183|    if (session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |   90|    183|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4447:9): [True: 0, False: 183]
  ------------------
 4448|      0|        pdu->version = session->version;
 4449|    183|    } else {
 4450|    183|        pdu->version = snmp_parse_version(data, length);
 4451|    183|    }
 4452|       |
 4453|    183|    switch (pdu->version) {
 4454|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4455|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4456|     16|    case SNMP_VERSION_1:
  ------------------
  |  |  107|     16|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4456:5): [True: 16, False: 167]
  ------------------
 4457|     16|#endif
 4458|     16|#ifndef NETSNMP_DISABLE_SNMPV2C
 4459|     16|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|     16|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (4459:5): [True: 0, False: 183]
  ------------------
 4460|     16|#endif
 4461|     16|        NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pdu->version,unsupported_version);
  ------------------
  |  |  220|     16|#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pc_ver, pc_target) do {    \
  |  |  221|     16|        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||                \
  |  |  ------------------
  |  |  |  |  205|     32|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|     32|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 16, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  206|     32|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|     16|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (206:6): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  |  |  207|     16|                            NETSNMP_DS_LIB_DISABLE_V1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|     16|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  222|     16|            NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver)) {                \
  |  |  ------------------
  |  |  |  |  215|     16|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|     32|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  |  |  216|     16|     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|     16|    } while(0)
  |  |  ------------------
  |  |  |  Branch (226:13): [Folded, False: 16]
  |  |  ------------------
  ------------------
 4462|     16|        DEBUGMSGTL(("snmp_api", "Parsing SNMPv%ld message...\n",
  ------------------
  |  |   66|     16|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     16|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 16]
  |  |  ------------------
  ------------------
 4463|     16|                    (1 + pdu->version)));
 4464|       |
 4465|       |        /*
 4466|       |         * authenticates message and returns length if valid 
 4467|       |         */
 4468|     16|#ifndef NETSNMP_DISABLE_SNMPV1
 4469|     16|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|     16|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4469:13): [True: 16, False: 0]
  ------------------
 4470|     16|            DEBUGDUMPSECTION("recv", "SNMPv1 message\n");
  ------------------
  |  |   81|     16|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     16|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 16]
  |  |  ------------------
  ------------------
 4471|     16|        } else {
 4472|      0|#endif
 4473|      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]
  |  |  ------------------
  ------------------
 4474|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4475|      0|        }
 4476|     16|#endif
 4477|     16|        data = snmp_comstr_parse(data, &length,
 4478|     16|                                 community, &community_length,
 4479|     16|                                 &pdu->version);
 4480|     16|        if (data == NULL)
  ------------------
  |  Branch (4480:13): [True: 0, False: 16]
  ------------------
 4481|      0|            return -1;
 4482|       |
 4483|     16|        if (pdu->version != session->version &&
  ------------------
  |  Branch (4483:13): [True: 16, False: 0]
  ------------------
 4484|     16|            session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |   90|     16|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4484:13): [True: 0, False: 16]
  ------------------
 4485|      0|            session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4486|      0|            return -1;
 4487|      0|        }
 4488|       |
 4489|       |        /*
 4490|       |         * maybe get the community string. 
 4491|       |         */
 4492|     16|        pdu->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|     16|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4493|     16|        pdu->securityModel = 
 4494|     16|#ifndef NETSNMP_DISABLE_SNMPV1
 4495|     16|            (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  107|     16|#define SNMP_VERSION_1	   0
  ------------------
                          (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  293|     16|#define SNMP_SEC_MODEL_SNMPv1		1
  ------------------
  |  Branch (4495:13): [True: 16, False: 0]
  ------------------
 4496|     16|#endif
 4497|     16|                                               SNMP_SEC_MODEL_SNMPv2c;
  ------------------
  |  |  294|     16|#define SNMP_SEC_MODEL_SNMPv2c		2
  ------------------
 4498|     16|        SNMP_FREE(pdu->community);
  ------------------
  |  |   62|     16|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 16]
  |  |  |  Branch (62:66): [Folded, False: 16]
  |  |  ------------------
  ------------------
 4499|     16|        pdu->community_len = 0;
 4500|     16|        pdu->community = (u_char *) 0;
 4501|     16|        if (community_length) {
  ------------------
  |  Branch (4501:13): [True: 2, False: 14]
  ------------------
 4502|      2|            pdu->community_len = community_length;
 4503|      2|            pdu->community = netsnmp_memdup(community, community_length);
 4504|      2|            if (pdu->community == NULL) {
  ------------------
  |  Branch (4504:17): [True: 0, False: 2]
  ------------------
 4505|      0|                session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4506|      0|                return -1;
 4507|      0|            }
 4508|      2|        }
 4509|     16|        if (session->authenticator) {
  ------------------
  |  Branch (4509:13): [True: 0, False: 16]
  ------------------
 4510|      0|            data = session->authenticator(data, &length,
 4511|      0|                                          community, community_length);
 4512|      0|            if (data == NULL) {
  ------------------
  |  Branch (4512:17): [True: 0, False: 0]
  ------------------
 4513|      0|                session->s_snmp_errno = SNMPERR_AUTHENTICATION_FAILURE;
  ------------------
  |  |  219|      0|#define SNMPERR_AUTHENTICATION_FAILURE 	(-35)
  ------------------
 4514|      0|                return -1;
 4515|      0|            }
 4516|      0|        }
 4517|       |
 4518|     16|        DEBUGDUMPSECTION("recv", "PDU");
  ------------------
  |  |   81|     16|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     16|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 16]
  |  |  ------------------
  ------------------
 4519|     16|        result = snmp_pdu_parse(pdu, data, &length);
 4520|     16|        if (result < 0) {
  ------------------
  |  Branch (4520:13): [True: 16, False: 0]
  ------------------
 4521|       |            /*
 4522|       |             * This indicates a parse error.  
 4523|       |             */
 4524|     16|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     16|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4525|     16|        }
 4526|     16|        DEBUGINDENTADD(-6);
  ------------------
  |  |   73|     16|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     16|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 16]
  |  |  ------------------
  ------------------
 4527|     16|        break;
 4528|      0|#endif /* support for community based SNMP */
 4529|       |
 4530|     39|    case SNMP_VERSION_3:
  ------------------
  |  |  113|     39|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (4530:5): [True: 39, False: 144]
  ------------------
 4531|     39|        NETSNMP_RUNTIME_PROTOCOL_CHECK_V3(SNMP_VERSION_3,unsupported_version);
  ------------------
  |  |  233|     39|#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V3(pc_ver, pc_target) do {      \
  |  |  234|     39|        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver)) {                \
  |  |  ------------------
  |  |  |  |  229|     39|    ((pc_ver == SNMP_VERSION_3) &&                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|     39|#define SNMP_VERSION_3     3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (229:6): [True: 39, Folded]
  |  |  |  |  ------------------
  |  |  |  |  230|     39|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|     39|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (230:6): [True: 0, False: 39]
  |  |  |  |  ------------------
  |  |  |  |  231|     39|                            NETSNMP_DS_LIB_DISABLE_V3))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|     39|#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|     39|    } while(0)
  |  |  ------------------
  |  |  |  Branch (238:13): [Folded, False: 39]
  |  |  ------------------
  ------------------
 4532|     39|        result = snmpv3_parse(pdu, data, &length, NULL, session);
 4533|     39|        DEBUGMSGTL(("snmp_parse",
  ------------------
  |  |   66|     39|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     39|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 39]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 39]
  |  |  ------------------
  ------------------
 4534|     39|                    "Parsed SNMPv3 message (secName:%s, secLevel:%s): %s\n",
 4535|     39|                    pdu->securityName, secLevelName[pdu->securityLevel],
 4536|     39|                    snmp_api_errstring(result)));
 4537|       |
 4538|     39|        if (result == SNMPERR_USM_UNKNOWNSECURITYNAME) {
  ------------------
  |  |  227|     39|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (4538:13): [True: 0, False: 39]
  ------------------
 4539|      0|            snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
  ------------------
  |  |   19|      0|#define SNMP_CALLBACK_APPLICATION 1
  ------------------
 4540|      0|                                SNMPD_CALLBACK_AUTH_FAILURE, pdu);
  ------------------
  |  |   21|      0|#define SNMPD_CALLBACK_AUTH_FAILURE             17
  ------------------
 4541|      0|        }
 4542|       |        
 4543|     39|        if (result) {
  ------------------
  |  Branch (4543:13): [True: 39, False: 0]
  ------------------
 4544|     39|            struct snmp_secmod_def *secmod =
 4545|     39|                find_sec_mod(pdu->securityModel);
 4546|     39|            if (!slp) {
  ------------------
  |  Branch (4546:17): [True: 0, False: 39]
  ------------------
 4547|      0|                session->s_snmp_errno = result;
 4548|     39|            } else {
 4549|       |                /*
 4550|       |                 * Call the security model to special handle any errors
 4551|       |                 */
 4552|       |
 4553|     39|                if (secmod && secmod->handle_report) {
  ------------------
  |  Branch (4553:21): [True: 18, False: 21]
  |  Branch (4553:31): [True: 18, False: 0]
  ------------------
 4554|     18|                    (*secmod->handle_report)(slp, slp->transport, session,
 4555|     18|                                             result, pdu);
 4556|     18|                }
 4557|     39|            }
 4558|     39|            free_securityStateRef(pdu);
 4559|     39|        }
 4560|       |
 4561|       |        /* Implement RFC5343 here for two reasons:
 4562|       |           1) From a security perspective it handles this otherwise
 4563|       |              always approved request earlier.  It bypasses the need
 4564|       |              for authorization to the snmpEngineID scalar, which is
 4565|       |              what is what RFC3415 appendix A species as ok.  Note
 4566|       |              that we haven't bypassed authentication since if there
 4567|       |              was an authentication error it would have been handled
 4568|       |              above in the if(result) part at the latest.
 4569|       |           2) From an application point of view if we let this request
 4570|       |              get all the way to the application, it'd require that
 4571|       |              all application types supporting discovery also fire up
 4572|       |              a minimal agent in order to handle just this request
 4573|       |              which seems like overkill.  Though there is no other
 4574|       |              application types that currently need discovery (NRs
 4575|       |              accept notifications from contextEngineIDs that derive
 4576|       |              from the NO not the NR).  Also a lame excuse for doing
 4577|       |              it here.
 4578|       |           3) Less important technically, but the net-snmp agent
 4579|       |              doesn't currently handle registrations of different
 4580|       |              engineIDs either and it would have been a lot more work
 4581|       |              to implement there since we'd need to support that
 4582|       |              first. :-/ Supporting multiple context engineIDs should
 4583|       |              be done anyway, so it's not a valid excuse here.
 4584|       |           4) There is a lot less to do if we trump the agent at this
 4585|       |              point; IE, the agent does a lot more unnecessary
 4586|       |              processing when the only thing that should ever be in
 4587|       |              this context by definition is the single scalar.
 4588|       |        */
 4589|       |
 4590|       |        /* special RFC5343 engineID discovery engineID check */
 4591|     39|        if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     39|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (4591:13): [True: 39, False: 0]
  ------------------
 4592|     39|                                    NETSNMP_DS_LIB_NO_DISCOVERY) &&
  ------------------
  |  |   98|     39|#define NETSNMP_DS_LIB_NO_DISCOVERY        38 /* don't support RFC5343 contextEngineID discovery */
  ------------------
 4593|     39|            SNMP_MSG_RESPONSE       != pdu->command &&
  ------------------
  |  |  127|     39|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   92|     39|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   96|     39|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4593:13): [True: 39, False: 0]
  ------------------
 4594|     39|            NULL                    != pdu->contextEngineID &&
  ------------------
  |  Branch (4594:13): [True: 18, False: 21]
  ------------------
 4595|     18|            pdu->contextEngineIDLen == 5 &&
  ------------------
  |  Branch (4595:13): [True: 0, False: 18]
  ------------------
 4596|      0|            pdu->contextEngineID[0] == 0x80 &&
  ------------------
  |  Branch (4596:13): [True: 0, False: 0]
  ------------------
 4597|      0|            pdu->contextEngineID[1] == 0x00 &&
  ------------------
  |  Branch (4597:13): [True: 0, False: 0]
  ------------------
 4598|      0|            pdu->contextEngineID[2] == 0x00 &&
  ------------------
  |  Branch (4598:13): [True: 0, False: 0]
  ------------------
 4599|      0|            pdu->contextEngineID[3] == 0x00 &&
  ------------------
  |  Branch (4599:13): [True: 0, False: 0]
  ------------------
 4600|      0|            pdu->contextEngineID[4] == 0x06) {
  ------------------
  |  Branch (4600:13): [True: 0, False: 0]
  ------------------
 4601|       |
 4602|       |            /* define a result so it doesn't get past us at this point
 4603|       |               and gets dropped by future parts of the stack */
 4604|      0|            result = SNMPERR_JUST_A_CONTEXT_PROBE;
  ------------------
  |  |  250|      0|#define SNMPERR_JUST_A_CONTEXT_PROBE    (-66)
  ------------------
 4605|       |
 4606|      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]
  |  |  ------------------
  ------------------
 4607|       |            /* ensure exactly one variable */
 4608|      0|            if (NULL != pdu->variables &&
  ------------------
  |  Branch (4608:17): [True: 0, False: 0]
  ------------------
 4609|      0|                NULL == pdu->variables->next_variable &&
  ------------------
  |  Branch (4609:17): [True: 0, False: 0]
  ------------------
 4610|       |
 4611|       |                /* if it's a GET, match it exactly */
 4612|      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 (4612:19): [True: 0, False: 0]
  ------------------
 4613|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4613:19): [True: 0, False: 0]
  ------------------
 4614|      0|                                   snmpEngineIDoid_len,
 4615|      0|                                   pdu->variables->name,
 4616|      0|                                   pdu->variables->name_length) == 0)
 4617|       |                 /* if it's a GETNEXT ensure it's less than the engineID oid */
 4618|      0|                 ||
 4619|      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 (4619:19): [True: 0, False: 0]
  ------------------
 4620|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4620:19): [True: 0, False: 0]
  ------------------
 4621|      0|                                   snmpEngineIDoid_len,
 4622|      0|                                   pdu->variables->name,
 4623|      0|                                   pdu->variables->name_length) > 0)
 4624|      0|                    )) {
 4625|       |
 4626|      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]
  |  |  ------------------
  ------------------
 4627|      0|                            "  One correct variable found\n"));
 4628|       |
 4629|       |                /* Note: we're explicitly not handling a GETBULK.  Deal. */
 4630|       |
 4631|       |                /* set up the response */
 4632|      0|                pdu2 = snmp_clone_pdu(pdu);
 4633|       |
 4634|       |                /* free the current varbind */
 4635|      0|                snmp_free_varbind(pdu2->variables);
 4636|       |
 4637|       |                /* set the variables */
 4638|      0|                pdu2->variables = NULL;
 4639|      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
  |  |  ------------------
  ------------------
 4640|      0|                pdu2->errstat = 0;
 4641|      0|                pdu2->errindex = 0;
 4642|       |
 4643|      0|                ourEngineID_len =
 4644|      0|                    snmpv3_get_engineID((u_char*)ourEngineID, ourEngineID_len);
 4645|      0|                if (0 != ourEngineID_len) {
  ------------------
  |  Branch (4645:21): [True: 0, False: 0]
  ------------------
 4646|       |
 4647|      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]
  |  |  ------------------
  ------------------
 4648|      0|                                "  responding with our engineID\n"));
 4649|       |
 4650|      0|                    snmp_pdu_add_variable(pdu2,
 4651|      0|                                          snmpEngineIDoid, snmpEngineIDoid_len,
 4652|      0|                                          ASN_OCTET_STR,
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 4653|      0|                                          ourEngineID, ourEngineID_len);
 4654|       |                    
 4655|       |                    /* send the response */
 4656|      0|                    if (0 == snmp_sess_send(slp, pdu2)) {
  ------------------
  |  Branch (4656:25): [True: 0, False: 0]
  ------------------
 4657|       |
 4658|      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]
  |  |  ------------------
  ------------------
 4659|      0|                                    "  sent it off!\n"));
 4660|       |
 4661|      0|                        snmp_free_pdu(pdu2);
 4662|       |                        
 4663|      0|                        snmp_log(LOG_ERR, "sending a response to the context engineID probe failed\n");
 4664|      0|                    }
 4665|      0|                } else {
 4666|      0|                    snmp_log(LOG_ERR, "failed to get our own engineID!\n");
 4667|      0|                    snmp_free_pdu(pdu2);
 4668|      0|                }
 4669|      0|            } else {
 4670|      0|                snmp_log(LOG_WARNING,
 4671|      0|                         "received an odd context engineID probe\n");
 4672|      0|            }
 4673|      0|        }
 4674|       |
 4675|     39|        break;
 4676|    123|    case SNMPERR_BAD_VERSION:
  ------------------
  |  |  198|    123|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
  |  Branch (4676:5): [True: 123, False: 60]
  ------------------
 4677|    123|        ERROR_MSG("error parsing snmp message version");
  ------------------
  |  |  188|    123|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4678|    123|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|    123|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4679|    123|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|    123|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4680|    123|        break;
 4681|       |
 4682|      0|        unsupported_version:  /* goto label */
 4683|      0|    case SNMP_VERSION_sec:
  ------------------
  |  |  118|      0|#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4683:5): [True: 0, False: 183]
  ------------------
 4684|      0|    case SNMP_VERSION_2u:
  ------------------
  |  |  112|      0|#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
  ------------------
  |  Branch (4684:5): [True: 0, False: 183]
  ------------------
 4685|      0|    case SNMP_VERSION_2star:
  ------------------
  |  |  120|      0|#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4685:5): [True: 0, False: 183]
  ------------------
 4686|      0|    case SNMP_VERSION_2p:
  ------------------
  |  |  119|      0|#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
  ------------------
  |  Branch (4686:5): [True: 0, False: 183]
  ------------------
 4687|      5|    default:
  ------------------
  |  Branch (4687:5): [True: 5, False: 178]
  ------------------
 4688|      5|        ERROR_MSG("unsupported snmp message version");
  ------------------
  |  |  188|      5|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4689|      5|        snmp_increment_statistic(STAT_SNMPINBADVERSIONS);
  ------------------
  |  |  634|      5|#define  STAT_SNMPINBADVERSIONS              11
  ------------------
 4690|       |
 4691|       |        /*
 4692|       |         * need better way to determine OS independent
 4693|       |         * INT32_MAX value, for now hardcode
 4694|       |         */
 4695|      5|        if (pdu->version < 0 || pdu->version > 2147483647) {
  ------------------
  |  Branch (4695:13): [True: 1, False: 4]
  |  Branch (4695:33): [True: 0, False: 4]
  ------------------
 4696|      1|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      1|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4697|      1|        }
 4698|      5|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      5|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4699|      5|        break;
 4700|    183|    }
 4701|       |
 4702|    183|    return result;
 4703|    183|}
snmp_api.c:snmp_parse_version:
 3832|    183|{
 3833|    183|    u_char          type;
 3834|    183|    long            version = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|    183|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3835|       |
 3836|    183|    data = asn_parse_sequence(data, &length, &type,
 3837|    183|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "version");
  ------------------
  |  |   84|    183|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "version");
  ------------------
  |  |   96|    183|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3838|    183|    if (data) {
  ------------------
  |  Branch (3838:9): [True: 183, False: 0]
  ------------------
 3839|    183|        DEBUGDUMPHEADER("recv", "SNMP Version");
  ------------------
  |  |   79|    183|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    183|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 183]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 183]
  |  |  ------------------
  ------------------
 3840|    183|        data =
 3841|    183|            asn_parse_int(data, &length, &type, &version, sizeof(version));
 3842|    183|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    183|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    183|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 183]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 183]
  |  |  ------------------
  ------------------
 3843|    183|        if (!data || type != ASN_INTEGER) {
  ------------------
  |  |   75|     60|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3843:13): [True: 123, False: 60]
  |  Branch (3843:22): [True: 0, False: 60]
  ------------------
 3844|    123|            return SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|    123|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3845|    123|        }
 3846|    183|    }
 3847|     60|    return version;
 3848|    183|}
snmp_api.c:netsnmp_build_packet:
 5118|     13|{
 5119|     13|    size_t offset = 0;
 5120|     13|    int    result;
 5121|       |
 5122|     13|    if (isp && isp->hook_realloc_build) {
  ------------------
  |  Branch (5122:9): [True: 13, False: 0]
  |  Branch (5122:16): [True: 0, False: 13]
  ------------------
 5123|      0|        result = isp->hook_realloc_build(sp, pdu, pktbuf_p, pktbuf_len_p,
 5124|      0|                                         &offset);
 5125|       |
 5126|      0|        *pkt_p = *pktbuf_p;
 5127|      0|        *len_p = offset;
 5128|     13|    } else if (isp && isp->hook_build) {
  ------------------
  |  Branch (5128:16): [True: 13, False: 0]
  |  Branch (5128:23): [True: 0, False: 13]
  ------------------
 5129|      0|        *pkt_p = *pktbuf_p;
 5130|      0|        *len_p = *pktbuf_len_p;
 5131|      0|        result = isp->hook_build(sp, pdu, *pktbuf_p, len_p);
 5132|     13|    } else {
 5133|     13|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 5134|     13|        if (!(pdu->flags & UCD_MSG_FLAG_FORWARD_ENCODE)) {
  ------------------
  |  |  319|     13|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
  |  Branch (5134:13): [True: 13, False: 0]
  ------------------
 5135|     13|            result = snmp_build(pktbuf_p, pktbuf_len_p, &offset, sp, pdu);
 5136|     13|            *pkt_p = *pktbuf_p + *pktbuf_len_p - offset;
 5137|     13|            *len_p = offset;
 5138|     13|        } else {
 5139|      0|#endif
 5140|      0|            *pkt_p = *pktbuf_p;
 5141|      0|            *len_p = *pktbuf_len_p;
 5142|      0|            result = snmp_build(pktbuf_p, len_p, &offset, sp, pdu);
 5143|      0|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 5144|      0|        }
 5145|     13|#endif
 5146|     13|    }
 5147|       |
 5148|     13|    return result;
 5149|     13|}
snmp_api.c:_sess_async_send:
 5441|     13|{
 5442|     13|    netsnmp_session *session;
 5443|     13|    struct snmp_internal_session *isp;
 5444|     13|    netsnmp_transport *transport = NULL;
 5445|     13|    int             result;
 5446|     13|    long            reqid;
 5447|       |
 5448|     13|    if (slp == NULL || NULL == slp->session || NULL ==slp->internal ||
  ------------------
  |  Branch (5448:9): [True: 0, False: 13]
  |  Branch (5448:24): [True: 0, False: 13]
  |  Branch (5448:48): [True: 0, False: 13]
  ------------------
 5449|     13|                NULL == slp->transport) {
  ------------------
  |  Branch (5449:17): [True: 0, False: 13]
  ------------------
 5450|      0|        return 0;
 5451|      0|    }
 5452|       |
 5453|     13|    session = slp->session;
 5454|     13|    isp = slp->internal;
 5455|     13|    transport = slp->transport;
 5456|       |
 5457|     13|    if (NULL == isp->opacket) {
  ------------------
  |  Branch (5457:9): [True: 13, False: 0]
  ------------------
 5458|     13|        result = _build_initial_pdu_packet(slp, pdu, 0);
 5459|     13|        if ((SNMPERR_SUCCESS != result) || (NULL == isp->opacket)) {
  ------------------
  |  |  184|     13|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (5459:13): [True: 0, False: 13]
  |  Branch (5459:44): [True: 0, False: 13]
  ------------------
 5460|      0|            if (callback) {
  ------------------
  |  Branch (5460:17): [True: 0, False: 0]
  ------------------
 5461|      0|                switch (session->s_snmp_errno) {
 5462|       |                    /*
 5463|       |                     * some of these probably don't make sense here, but
 5464|       |                     * it's a rough first cut.
 5465|       |                     */
 5466|      0|                    case SNMPERR_BAD_ENG_ID:
  ------------------
  |  |  210|      0|#define SNMPERR_BAD_ENG_ID 		(-26)
  ------------------
  |  Branch (5466:21): [True: 0, False: 0]
  ------------------
 5467|      0|                    case SNMPERR_BAD_SEC_LEVEL:
  ------------------
  |  |  212|      0|#define SNMPERR_BAD_SEC_LEVEL 		(-28)
  ------------------
  |  Branch (5467:21): [True: 0, False: 0]
  ------------------
 5468|      0|                    case SNMPERR_UNKNOWN_SEC_MODEL:
  ------------------
  |  |  214|      0|#define SNMPERR_UNKNOWN_SEC_MODEL 	(-30)
  ------------------
  |  Branch (5468:21): [True: 0, False: 0]
  ------------------
 5469|      0|                    case SNMPERR_UNKNOWN_ENG_ID:
  ------------------
  |  |  216|      0|#define SNMPERR_UNKNOWN_ENG_ID          (-32)
  ------------------
  |  Branch (5469:21): [True: 0, False: 0]
  ------------------
 5470|      0|                    case SNMPERR_UNKNOWN_USER_NAME:
  ------------------
  |  |  217|      0|#define SNMPERR_UNKNOWN_USER_NAME 	(-33)
  ------------------
  |  Branch (5470:21): [True: 0, False: 0]
  ------------------
 5471|      0|                    case SNMPERR_UNSUPPORTED_SEC_LEVEL:
  ------------------
  |  |  218|      0|#define SNMPERR_UNSUPPORTED_SEC_LEVEL 	(-34)
  ------------------
  |  Branch (5471:21): [True: 0, False: 0]
  ------------------
 5472|      0|                    case SNMPERR_AUTHENTICATION_FAILURE:
  ------------------
  |  |  219|      0|#define SNMPERR_AUTHENTICATION_FAILURE 	(-35)
  ------------------
  |  Branch (5472:21): [True: 0, False: 0]
  ------------------
 5473|      0|                    case SNMPERR_NOT_IN_TIME_WINDOW:
  ------------------
  |  |  220|      0|#define SNMPERR_NOT_IN_TIME_WINDOW 	(-36)
  ------------------
  |  Branch (5473:21): [True: 0, False: 0]
  ------------------
 5474|      0|                    case SNMPERR_USM_GENERICERROR:
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
  |  Branch (5474:21): [True: 0, False: 0]
  ------------------
 5475|      0|                    case SNMPERR_USM_UNKNOWNSECURITYNAME:
  ------------------
  |  |  227|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (5475:21): [True: 0, False: 0]
  ------------------
 5476|      0|                    case SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL:
  ------------------
  |  |  228|      0|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
  |  Branch (5476:21): [True: 0, False: 0]
  ------------------
 5477|      0|                    case SNMPERR_USM_ENCRYPTIONERROR:
  ------------------
  |  |  229|      0|#define SNMPERR_USM_ENCRYPTIONERROR		(-45)
  ------------------
  |  Branch (5477:21): [True: 0, False: 0]
  ------------------
 5478|      0|                    case SNMPERR_USM_AUTHENTICATIONFAILURE:
  ------------------
  |  |  230|      0|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
  |  Branch (5478:21): [True: 0, False: 0]
  ------------------
 5479|      0|                    case SNMPERR_USM_PARSEERROR:
  ------------------
  |  |  231|      0|#define SNMPERR_USM_PARSEERROR			(-47)
  ------------------
  |  Branch (5479:21): [True: 0, False: 0]
  ------------------
 5480|      0|                    case SNMPERR_USM_UNKNOWNENGINEID:
  ------------------
  |  |  232|      0|#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
  ------------------
  |  Branch (5480:21): [True: 0, False: 0]
  ------------------
 5481|      0|                    case SNMPERR_USM_NOTINTIMEWINDOW:
  ------------------
  |  |  233|      0|#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
  ------------------
  |  Branch (5481:21): [True: 0, False: 0]
  ------------------
 5482|      0|                        callback(NETSNMP_CALLBACK_OP_SEC_ERROR, session,
  ------------------
  |  |  325|      0|#define NETSNMP_CALLBACK_OP_SEC_ERROR		7
  ------------------
 5483|      0|                                 pdu->reqid, pdu, cb_data);
 5484|      0|                        break;
 5485|      0|                    case SNMPERR_TIMEOUT: /* engineID probe timed out */
  ------------------
  |  |  208|      0|#define SNMPERR_TIMEOUT 		(-24)
  ------------------
  |  Branch (5485:21): [True: 0, False: 0]
  ------------------
 5486|      0|                        callback(NETSNMP_CALLBACK_OP_TIMED_OUT, session,
  ------------------
  |  |  320|      0|#define NETSNMP_CALLBACK_OP_TIMED_OUT		2
  ------------------
 5487|      0|                                 pdu->reqid, pdu, cb_data);
 5488|      0|                        break;
 5489|      0|                    default:
  ------------------
  |  Branch (5489:21): [True: 0, False: 0]
  ------------------
 5490|      0|                        callback(NETSNMP_CALLBACK_OP_SEND_FAILED, session,
  ------------------
  |  |  321|      0|#define NETSNMP_CALLBACK_OP_SEND_FAILED		3
  ------------------
 5491|      0|                                 pdu->reqid, pdu, cb_data);
 5492|      0|                        break;
 5493|      0|                }
 5494|      0|            }
 5495|       |            /** no packet to send?? */
 5496|      0|            return 0;
 5497|      0|        }
 5498|     13|    }
 5499|       |
 5500|       |    /*
 5501|       |     * Send the message.  
 5502|       |     */
 5503|       |
 5504|     13|    DEBUGMSGTL(("sess_process_packet", "sending message id#%ld reqid#%ld len %"
  ------------------
  |  |   66|     13|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 13]
  |  |  ------------------
  ------------------
 5505|     13|                NETSNMP_PRIz "u\n", pdu->msgid, pdu->reqid, isp->opacket_len));
 5506|     13|    result = netsnmp_transport_send(transport, isp->opacket, isp->opacket_len,
 5507|     13|                                    &(pdu->transport_data),
 5508|     13|                                    &(pdu->transport_data_length));
 5509|       |
 5510|     13|    SNMP_FREE(isp->obuf);
  ------------------
  |  |   62|     13|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 13, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 13]
  |  |  ------------------
  ------------------
 5511|     13|    isp->opacket = NULL; /* opacket was in obuf, so no free needed */
 5512|     13|    isp->opacket_len = 0;
 5513|       |
 5514|     13|    if (result < 0) {
  ------------------
  |  Branch (5514:9): [True: 0, False: 13]
  ------------------
 5515|      0|        session->s_snmp_errno = SNMPERR_BAD_SENDTO;
  ------------------
  |  |  196|      0|#define SNMPERR_BAD_SENDTO		(-12)
  ------------------
 5516|      0|        session->s_errno = errno;
 5517|      0|        if (callback)
  ------------------
  |  Branch (5517:13): [True: 0, False: 0]
  ------------------
 5518|      0|            callback(NETSNMP_CALLBACK_OP_SEND_FAILED, session,
  ------------------
  |  |  321|      0|#define NETSNMP_CALLBACK_OP_SEND_FAILED		3
  ------------------
 5519|      0|                     pdu->reqid, pdu, cb_data);
 5520|      0|        return 0;
 5521|      0|    }
 5522|       |
 5523|     13|    reqid = pdu->reqid;
 5524|       |
 5525|       |    /*
 5526|       |     * Bug 2387: 0 is a valid request id, so since reqid is used as a return
 5527|       |     * code with 0 meaning an error, set reqid to 1 if there is no error. This
 5528|       |     * does not affect the request id in the packet and fixes a memory leak
 5529|       |     * for incoming PDUs with a request id of 0. This could cause some
 5530|       |     * confusion if the caller is expecting the request id to match the
 5531|       |     * return code, as the documentation states it will. Most example code
 5532|       |     * just checks for non-zero, so hopefully this wont be an issue.
 5533|       |     */
 5534|     13|    if (0 == reqid && (SNMPERR_SUCCESS == session->s_snmp_errno))
  ------------------
  |  |  184|     13|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (5534:9): [True: 13, False: 0]
  |  Branch (5534:23): [True: 13, False: 0]
  ------------------
 5535|     13|        ++reqid;
 5536|       |
 5537|       |    /*
 5538|       |     * Add to pending requests list if we expect a response.  
 5539|       |     */
 5540|     13|    if (pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE) {
  ------------------
  |  |  312|     13|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
  |  Branch (5540:9): [True: 0, False: 13]
  ------------------
 5541|      0|        netsnmp_request_list *rp;
 5542|      0|        struct timeval  tv;
 5543|       |
 5544|      0|        rp = calloc(1, sizeof(netsnmp_request_list));
 5545|      0|        if (rp == NULL) {
  ------------------
  |  Branch (5545:13): [True: 0, False: 0]
  ------------------
 5546|      0|            session->s_snmp_errno = SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5547|      0|            return 0;
 5548|      0|        }
 5549|       |
 5550|      0|        netsnmp_get_monotonic_clock(&tv);
 5551|      0|        rp->pdu = pdu;
 5552|      0|        rp->request_id = pdu->reqid;
 5553|      0|        rp->message_id = pdu->msgid;
 5554|      0|        rp->callback = callback;
 5555|      0|        if (cp_inc && cb_data) {
  ------------------
  |  Branch (5555:13): [True: 0, False: 0]
  |  Branch (5555:23): [True: 0, False: 0]
  ------------------
 5556|      0|            netsnmp_refcnt_void *aux_cb_data = (netsnmp_refcnt_void*) cb_data;
 5557|      0|            aux_cb_data->refcnt++;
 5558|      0|            rp->cb_data_refcounted = 1;
 5559|      0|	}
 5560|      0|        rp->cb_data = cb_data;
 5561|      0|        rp->retries = 0;
 5562|      0|        if (pdu->flags & UCD_MSG_FLAG_PDU_TIMEOUT) {
  ------------------
  |  |  315|      0|#define UCD_MSG_FLAG_PDU_TIMEOUT            0x1000
  ------------------
  |  Branch (5562:13): [True: 0, False: 0]
  ------------------
 5563|      0|            rp->timeout = pdu->time * 1000000L;
 5564|      0|        } else {
 5565|      0|            rp->timeout = session->timeout;
 5566|      0|        }
 5567|      0|        rp->timeM = tv;
 5568|      0|        tv.tv_usec += rp->timeout;
 5569|      0|        tv.tv_sec += tv.tv_usec / 1000000L;
 5570|      0|        tv.tv_usec %= 1000000L;
 5571|      0|        rp->expireM = tv;
 5572|       |
 5573|       |        /*
 5574|       |         * XX lock should be per session ! 
 5575|       |         */
 5576|      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]
  |  |  ------------------
  ------------------
 5577|      0|        if (isp->requestsEnd) {
  ------------------
  |  Branch (5577:13): [True: 0, False: 0]
  ------------------
 5578|      0|            rp->next_request = isp->requestsEnd->next_request;
 5579|      0|            isp->requestsEnd->next_request = rp;
 5580|      0|            isp->requestsEnd = rp;
 5581|      0|        } else {
 5582|      0|            rp->next_request = isp->requests;
 5583|      0|            isp->requests = rp;
 5584|      0|            isp->requestsEnd = rp;
 5585|      0|        }
 5586|      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]
  |  |  ------------------
  ------------------
 5587|     13|    } else {
 5588|       |        /*
 5589|       |         * No response expected...  
 5590|       |         */
 5591|     13|        if (reqid) {
  ------------------
  |  Branch (5591:13): [True: 13, False: 0]
  ------------------
 5592|       |            /*
 5593|       |             * Free v1 or v2 TRAP PDU iff no error  
 5594|       |             */
 5595|     13|            snmp_free_pdu(pdu);
 5596|     13|        }
 5597|     13|    }
 5598|       |
 5599|     13|    return reqid;
 5600|     13|}
snmp_api.c:__sess_read:
 6294|     56|{
 6295|     56|    netsnmp_session *sp = slp ? slp->session : NULL;
  ------------------
  |  Branch (6295:27): [True: 56, False: 0]
  ------------------
 6296|     56|    struct snmp_internal_session *isp = slp ? slp->internal : NULL;
  ------------------
  |  Branch (6296:41): [True: 56, False: 0]
  ------------------
 6297|     56|    netsnmp_transport *transport = slp ? slp->transport : NULL;
  ------------------
  |  Branch (6297:36): [True: 56, False: 0]
  ------------------
 6298|     56|    size_t          pdulen = 0, rxbuf_len = SNMP_MAX_RCV_MSG_SIZE;
  ------------------
  |  |  108|     56|#define SNMP_MAX_RCV_MSG_SIZE      65536
  ------------------
 6299|     56|    u_char         *rxbuf = NULL;
 6300|     56|    int             length = 0, olength = 0, rc = 0;
 6301|     56|    void           *opaque = NULL;
 6302|       |
 6303|     56|    if (NULL == slp || NULL == sp || NULL == isp || NULL == transport) {
  ------------------
  |  Branch (6303:9): [True: 0, False: 56]
  |  Branch (6303:24): [True: 0, False: 56]
  |  Branch (6303:38): [True: 0, False: 56]
  |  Branch (6303:53): [True: 0, False: 56]
  ------------------
 6304|      0|        snmp_log(LOG_ERR, "bad parameters to __sess_read\n");
 6305|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 6306|      0|    }
 6307|       |
 6308|       |    /* to avoid subagent crash */
 6309|     56|    if (!NETSNMP_IS_VALID_SOCKET(transport->sock)) {
  ------------------
  |  |   44|     56|#define NETSNMP_IS_VALID_SOCKET(_sock) ((_sock) != -1)
  ------------------
  |  Branch (6309:9): [True: 0, False: 56]
  ------------------
 6310|      0|        snmp_log(LOG_INFO, "transport->sock is invalid\n");
 6311|      0|        return 0; 
 6312|      0|    }
 6313|       |
 6314|     56|    sp->s_snmp_errno = 0;
 6315|     56|    sp->s_errno = 0;
 6316|       |
 6317|     56|    if (transport->flags & NETSNMP_TRANSPORT_FLAG_LISTEN)
  ------------------
  |  |   52|     56|#define		NETSNMP_TRANSPORT_FLAG_LISTEN	 0x02
  ------------------
  |  Branch (6317:9): [True: 0, False: 56]
  ------------------
 6318|      0|        return _sess_read_accept(slp);
 6319|       |
 6320|     56|    if (!(transport->flags & NETSNMP_TRANSPORT_FLAG_STREAM)) {
  ------------------
  |  |   51|     56|#define		NETSNMP_TRANSPORT_FLAG_STREAM	 0x01
  ------------------
  |  Branch (6320:9): [True: 56, False: 0]
  ------------------
 6321|     56|        snmp_rcv_packet rcvp;
 6322|     56|        u_char *pptr;
 6323|     56|        size_t len_remaining, pdulen;
 6324|     56|        void *ocopy = NULL;
 6325|       |
 6326|     56|        memset(&rcvp, 0x0, sizeof(rcvp));
 6327|       |
 6328|       |        /** read the packet */
 6329|     56|        rc = _sess_read_dgram_packet(slp, &rcvp);
 6330|     56|        if (-1 == rc) /* protocol error */
  ------------------
  |  Branch (6330:13): [True: 0, False: 56]
  ------------------
 6331|      0|            return -1;
 6332|     56|        else if (-2 == rc) /* no packet to process */
  ------------------
  |  Branch (6332:18): [True: 0, False: 56]
  ------------------
 6333|      0|            return 0;
 6334|       |
 6335|     56|        pptr = rcvp.packet;
 6336|     56|        len_remaining = rcvp.packet_len;
 6337|     56|        rc = 0;
 6338|       |
 6339|    239|        while (len_remaining > 0) {
  ------------------
  |  Branch (6339:16): [True: 236, False: 3]
  ------------------
 6340|    236|            if (isp->check_packet) {
  ------------------
  |  Branch (6340:17): [True: 0, False: 236]
  ------------------
 6341|      0|                pdulen = isp->check_packet(pptr, len_remaining);
 6342|    236|            } else {
 6343|    236|                pdulen = asn_check_packet(pptr, len_remaining);
 6344|    236|            }
 6345|    236|            if (pdulen == 0 || pdulen > len_remaining || pdulen > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|    183|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (6345:17): [True: 24, False: 212]
  |  Branch (6345:32): [True: 29, False: 183]
  |  Branch (6345:58): [True: 0, False: 183]
  ------------------
 6346|       |                /* Not a valid packet or incomplete in datagram mode */
 6347|     53|                if (pptr == rcvp.packet) {
  ------------------
  |  Branch (6347:21): [True: 37, False: 16]
  ------------------
 6348|     37|                    SNMP_FREE(rcvp.opaque);
  ------------------
  |  |   62|     37|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 37, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 37]
  |  |  ------------------
  ------------------
 6349|     37|                }
 6350|     53|                break;
 6351|     53|            }
 6352|    183|            if (pdulen < len_remaining) {
  ------------------
  |  Branch (6352:17): [True: 180, False: 3]
  ------------------
 6353|    180|                if (rcvp.olength > 0 && rcvp.opaque != NULL) {
  ------------------
  |  Branch (6353:21): [True: 180, False: 0]
  |  Branch (6353:41): [True: 180, False: 0]
  ------------------
 6354|    180|                    ocopy = malloc(rcvp.olength);
 6355|    180|                    if (ocopy != NULL) {
  ------------------
  |  Branch (6355:25): [True: 180, False: 0]
  ------------------
 6356|    180|                        memcpy(ocopy, rcvp.opaque, rcvp.olength);
 6357|    180|                    }
 6358|    180|                }
 6359|    180|            } else {
 6360|      3|                ocopy = rcvp.opaque;
 6361|      3|                rcvp.opaque = NULL;
 6362|      3|            }
 6363|    183|            rc = _sess_process_packet(slp, sp, isp, transport,
 6364|    183|                                      ocopy, ocopy ? rcvp.olength : 0,
  ------------------
  |  Branch (6364:46): [True: 183, False: 0]
  ------------------
 6365|    183|                                      pptr, pdulen);
 6366|    183|            ocopy = NULL;
 6367|    183|            pptr += pdulen;
 6368|    183|            len_remaining -= pdulen;
 6369|    183|        }
 6370|     56|        SNMP_FREE(rcvp.packet);
  ------------------
  |  |   62|     56|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 56, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 56]
  |  |  ------------------
  ------------------
 6371|     56|        SNMP_FREE(rcvp.opaque);
  ------------------
  |  |   62|     56|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 16, False: 40]
  |  |  |  Branch (62:66): [Folded, False: 56]
  |  |  ------------------
  ------------------
 6372|     56|        return rc;
 6373|     56|    }
 6374|       |
 6375|       |    /** stream transport */
 6376|       |
 6377|      0|        if (isp->packet == NULL) {
  ------------------
  |  Branch (6377:13): [True: 0, False: 0]
  ------------------
 6378|       |            /*
 6379|       |             * We have no saved packet.  Allocate one.  
 6380|       |             */
 6381|      0|            if ((isp->packet = (u_char *) malloc(rxbuf_len)) == NULL) {
  ------------------
  |  Branch (6381:17): [True: 0, False: 0]
  ------------------
 6382|      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]
  |  |  ------------------
  ------------------
 6383|      0|                            "u bytes for rxbuf\n", rxbuf_len));
 6384|      0|                return 0;
 6385|      0|            } else {
 6386|      0|                rxbuf = isp->packet;
 6387|      0|                isp->packet_size = rxbuf_len;
 6388|      0|                isp->packet_len = 0;
 6389|      0|            }
 6390|      0|        } else {
 6391|       |            /*
 6392|       |             * We have saved a partial packet from last time.  Extend that, if
 6393|       |             * necessary, and receive new data after the old data.  
 6394|       |             */
 6395|      0|            u_char         *newbuf;
 6396|       |
 6397|      0|            if (isp->packet_size < isp->packet_len + rxbuf_len) {
  ------------------
  |  Branch (6397:17): [True: 0, False: 0]
  ------------------
 6398|      0|                newbuf =
 6399|      0|                    (u_char *) realloc(isp->packet,
 6400|      0|                                       isp->packet_len + rxbuf_len);
 6401|      0|                if (newbuf == NULL) {
  ------------------
  |  Branch (6401:21): [True: 0, False: 0]
  ------------------
 6402|      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]
  |  |  ------------------
  ------------------
 6403|      0|                                "can't malloc %" NETSNMP_PRIz
 6404|      0|                                "u more for rxbuf (%" NETSNMP_PRIz "u tot)\n",
 6405|      0|                                rxbuf_len, isp->packet_len + rxbuf_len));
 6406|      0|                    return 0;
 6407|      0|                } else {
 6408|      0|                    isp->packet = newbuf;
 6409|      0|                    isp->packet_size = isp->packet_len + rxbuf_len;
 6410|      0|                    rxbuf = isp->packet + isp->packet_len;
 6411|      0|                }
 6412|      0|            } else {
 6413|      0|                rxbuf = isp->packet + isp->packet_len;
 6414|      0|                rxbuf_len = isp->packet_size - isp->packet_len;
 6415|      0|            }
 6416|      0|        }
 6417|       |
 6418|      0|    length = netsnmp_transport_recv(transport, rxbuf, rxbuf_len, &opaque,
 6419|      0|                                    &olength);
 6420|       |
 6421|      0|    if (0 == length && transport->flags & NETSNMP_TRANSPORT_FLAG_EMPTY_PKT) {
  ------------------
  |  |   56|      0|#define		NETSNMP_TRANSPORT_FLAG_EMPTY_PKT 0x10
  ------------------
  |  Branch (6421:9): [True: 0, False: 0]
  |  Branch (6421:24): [True: 0, False: 0]
  ------------------
 6422|       |        /* this allows for a transport that needs to return from
 6423|       |         * packet processing that doesn't necessarily have any
 6424|       |         * consumable data in it. */
 6425|       |
 6426|       |        /* reset the flag since it's a per-message flag */
 6427|      0|        transport->flags &= (~NETSNMP_TRANSPORT_FLAG_EMPTY_PKT);
  ------------------
  |  |   56|      0|#define		NETSNMP_TRANSPORT_FLAG_EMPTY_PKT 0x10
  ------------------
 6428|       |
 6429|      0|        return 0;
 6430|      0|    }
 6431|       |
 6432|       |    /*
 6433|       |     * Remote end closed connection.  
 6434|       |     */
 6435|      0|    if (length <= 0) {
  ------------------
  |  Branch (6435:9): [True: 0, False: 0]
  ------------------
 6436|       |        /*
 6437|       |         * Alert the application if possible.  
 6438|       |         */
 6439|      0|        if (sp->callback != NULL) {
  ------------------
  |  Branch (6439:13): [True: 0, False: 0]
  ------------------
 6440|      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]
  |  |  ------------------
  ------------------
 6441|      0|            (void) sp->callback(NETSNMP_CALLBACK_OP_DISCONNECT, sp, 0,
  ------------------
  |  |  323|      0|#define NETSNMP_CALLBACK_OP_DISCONNECT		5
  ------------------
 6442|      0|                                NULL, sp->callback_magic);
 6443|      0|        }
 6444|       |        /*
 6445|       |         * Close socket and mark session for deletion.  
 6446|       |         */
 6447|      0|        DEBUGMSGTL(("sess_read", "fd %" NETSNMP_FMT_SKT " closed\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]
  |  |  ------------------
  ------------------
 6448|      0|                    transport->sock));
 6449|      0|        transport->f_close(transport);
 6450|      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]
  |  |  ------------------
  ------------------
 6451|      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]
  |  |  ------------------
  ------------------
 6452|      0|        return -1;
 6453|      0|    }
 6454|       |
 6455|      0|    {
 6456|      0|        u_char *pptr = isp->packet;
 6457|      0|	void *ocopy = NULL;
 6458|       |
 6459|      0|        isp->packet_len += length;
 6460|       |
 6461|      0|        while (isp->packet_len > 0) {
  ------------------
  |  Branch (6461:16): [True: 0, False: 0]
  ------------------
 6462|       |
 6463|       |            /*
 6464|       |             * Get the total data length we're expecting (and need to wait
 6465|       |             * for).
 6466|       |             */
 6467|      0|            if (isp->check_packet) {
  ------------------
  |  Branch (6467:17): [True: 0, False: 0]
  ------------------
 6468|      0|                pdulen = isp->check_packet(pptr, isp->packet_len);
 6469|      0|            } else {
 6470|      0|                pdulen = asn_check_packet(pptr, isp->packet_len);
 6471|      0|            }
 6472|       |
 6473|      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]
  |  |  ------------------
  ------------------
 6474|      0|                        "  loop packet_len %" NETSNMP_PRIz "u, PDU length %"
 6475|      0|                        NETSNMP_PRIz "u\n", isp->packet_len, pdulen));
 6476|       |
 6477|      0|            if (pdulen > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (6477:17): [True: 0, False: 0]
  ------------------
 6478|       |                /*
 6479|       |                 * Illegal length, drop the connection.  
 6480|       |                 */
 6481|      0|                snmp_log(LOG_ERR, 
 6482|      0|			 "Received broken packet. Closing session.\n");
 6483|      0|		if (sp->callback != NULL) {
  ------------------
  |  Branch (6483:7): [True: 0, False: 0]
  ------------------
 6484|      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]
  |  |  ------------------
  ------------------
 6485|      0|			      "perform callback with op=DISCONNECT\n"));
 6486|      0|		  (void)sp->callback(NETSNMP_CALLBACK_OP_DISCONNECT,
  ------------------
  |  |  323|      0|#define NETSNMP_CALLBACK_OP_DISCONNECT		5
  ------------------
 6487|      0|				     sp, 0, NULL, sp->callback_magic);
 6488|      0|		}
 6489|      0|		DEBUGMSGTL(("sess_read", "fd %" NETSNMP_FMT_SKT " closed\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]
  |  |  ------------------
  ------------------
 6490|      0|                            transport->sock));
 6491|      0|                transport->f_close(transport);
 6492|      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]
  |  |  ------------------
  ------------------
 6493|       |                /** XXX-rks: why no SNMP_FREE(isp->packet); ?? */
 6494|      0|                return -1;
 6495|      0|            }
 6496|       |
 6497|      0|            if (pdulen > isp->packet_len || pdulen == 0) {
  ------------------
  |  Branch (6497:17): [True: 0, False: 0]
  |  Branch (6497:45): [True: 0, False: 0]
  ------------------
 6498|       |                /*
 6499|       |                 * We don't have a complete packet yet.  If we've already
 6500|       |                 * processed a packet, break out so we'll shift this packet
 6501|       |                 * to the start of the buffer. If we're already at the
 6502|       |                 * start, simply return and wait for more data to arrive.
 6503|       |                 */
 6504|      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]
  |  |  ------------------
  ------------------
 6505|      0|                            "pkt not complete (need %" NETSNMP_PRIz "u got %"
 6506|      0|                            NETSNMP_PRIz "u so far)\n", pdulen,
 6507|      0|                            isp->packet_len));
 6508|       |
 6509|      0|                if (pptr != isp->packet)
  ------------------
  |  Branch (6509:21): [True: 0, False: 0]
  ------------------
 6510|      0|                    break; /* opaque freed for us outside of loop. */
 6511|       |
 6512|      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]
  |  |  ------------------
  ------------------
 6513|      0|                return 0;
 6514|      0|            }
 6515|       |
 6516|       |            /*  We have *at least* one complete packet in the buffer now.  If
 6517|       |		we have possibly more than one packet, we must copy the opaque
 6518|       |		pointer because we may need to reuse it for a later packet.  */
 6519|       |
 6520|      0|	    if (pdulen < isp->packet_len) {
  ------------------
  |  Branch (6520:10): [True: 0, False: 0]
  ------------------
 6521|      0|		if (olength > 0 && opaque != NULL) {
  ------------------
  |  Branch (6521:7): [True: 0, False: 0]
  |  Branch (6521:22): [True: 0, False: 0]
  ------------------
 6522|      0|		    ocopy = malloc(olength);
 6523|      0|		    if (ocopy != NULL) {
  ------------------
  |  Branch (6523:11): [True: 0, False: 0]
  ------------------
 6524|      0|			memcpy(ocopy, opaque, olength);
 6525|      0|		    }
 6526|      0|		}
 6527|      0|	    } else if (pdulen == isp->packet_len) {
  ------------------
  |  Branch (6527:17): [True: 0, False: 0]
  ------------------
 6528|       |		/*  Common case -- exactly one packet.  No need to copy the
 6529|       |		    opaque pointer.  */
 6530|      0|		ocopy = opaque;
 6531|      0|		opaque = NULL;
 6532|      0|	    }
 6533|       |
 6534|      0|            if ((rc = _sess_process_packet(slp, sp, isp, transport,
  ------------------
  |  Branch (6534:17): [True: 0, False: 0]
  ------------------
 6535|      0|                                           ocopy, ocopy?olength:0, pptr,
  ------------------
  |  Branch (6535:51): [True: 0, False: 0]
  ------------------
 6536|      0|                                           pdulen))) {
 6537|       |                /*
 6538|       |                 * Something went wrong while processing this packet -- set the
 6539|       |                 * errno.  
 6540|       |                 */
 6541|      0|                if (sp->s_snmp_errno != 0) {
  ------------------
  |  Branch (6541:21): [True: 0, False: 0]
  ------------------
 6542|      0|                    SET_SNMP_ERROR(sp->s_snmp_errno);
  ------------------
  |  |   43|      0|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 6543|      0|                }
 6544|      0|            }
 6545|       |
 6546|       |	    /*  ocopy has been free()d by _sess_process_packet by this point,
 6547|       |		so set it to NULL.  */
 6548|       |
 6549|      0|	    ocopy = NULL;
 6550|       |
 6551|       |	    /*  Step past the packet we've just dealt with.  */
 6552|       |
 6553|      0|            pptr += pdulen;
 6554|      0|            isp->packet_len -= pdulen;
 6555|      0|        }
 6556|       |
 6557|       |	/*  If we had more than one packet, then we were working with copies
 6558|       |	    of the opaque pointer, so we still need to free() the opaque
 6559|       |	    pointer itself.  */
 6560|       |
 6561|      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]
  |  |  ------------------
  ------------------
 6562|       |
 6563|      0|        if (isp->packet_len >= SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (6563:13): [True: 0, False: 0]
  ------------------
 6564|       |            /*
 6565|       |             * Obviously this should never happen!  
 6566|       |             */
 6567|      0|            snmp_log(LOG_ERR,
 6568|      0|                     "too large packet_len = %" NETSNMP_PRIz
 6569|      0|                     "u, dropping connection %" NETSNMP_FMT_SKT "\n",
 6570|      0|                     isp->packet_len, transport->sock);
 6571|      0|            transport->f_close(transport);
 6572|       |            /** XXX-rks: why no SNMP_FREE(isp->packet); ?? */
 6573|      0|            return -1;
 6574|      0|        } else if (isp->packet_len == 0) {
  ------------------
  |  Branch (6574:20): [True: 0, False: 0]
  ------------------
 6575|       |            /*
 6576|       |             * This is good: it means the packet buffer contained an integral
 6577|       |             * number of PDUs, so we don't have to save any data for next
 6578|       |             * time.  We can free() the buffer now to keep the memory
 6579|       |             * footprint down.
 6580|       |             */
 6581|      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]
  |  |  ------------------
  ------------------
 6582|      0|            isp->packet_size = 0;
 6583|      0|            isp->packet_len = 0;
 6584|      0|            return rc;
 6585|      0|        }
 6586|       |
 6587|       |        /*
 6588|       |         * If we get here, then there is a partial packet of length
 6589|       |         * isp->packet_len bytes starting at pptr left over.  Move that to the
 6590|       |         * start of the buffer, and then realloc() the buffer down to size to
 6591|       |         * reduce the memory footprint.  
 6592|       |         */
 6593|       |
 6594|      0|        memmove(isp->packet, pptr, isp->packet_len);
 6595|      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]
  |  |  ------------------
  ------------------
 6596|      0|                    "end: memmove(%p, %p, %" NETSNMP_PRIz "u); realloc(%p, %"
 6597|      0|                    NETSNMP_PRIz "u)\n",
 6598|      0|                    isp->packet, pptr, isp->packet_len,
 6599|      0|		    isp->packet, isp->packet_len));
 6600|       |
 6601|      0|        if ((rxbuf = (u_char *)realloc(isp->packet, isp->packet_len)) == NULL) {
  ------------------
  |  Branch (6601:13): [True: 0, False: 0]
  ------------------
 6602|       |            /*
 6603|       |             * I don't see why this should ever fail, but it's not a big deal.
 6604|       |             */
 6605|      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]
  |  |  ------------------
  ------------------
 6606|      0|        } else {
 6607|      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]
  |  |  ------------------
  ------------------
 6608|      0|                        isp->packet, rxbuf));
 6609|      0|            isp->packet = rxbuf;
 6610|      0|            isp->packet_size = isp->packet_len;
 6611|      0|        }
 6612|      0|    }
 6613|       |
 6614|      0|    return rc;
 6615|      0|}
snmp_api.c:_sess_read_dgram_packet:
 6236|     56|{
 6237|     56|    netsnmp_session *sp = slp ? slp->session : NULL;
  ------------------
  |  Branch (6237:27): [True: 56, False: 0]
  ------------------
 6238|     56|    struct snmp_internal_session *isp = slp ? slp->internal : NULL;
  ------------------
  |  Branch (6238:41): [True: 56, False: 0]
  ------------------
 6239|     56|    netsnmp_transport *transport = slp ? slp->transport : NULL;
  ------------------
  |  Branch (6239:36): [True: 56, False: 0]
  ------------------
 6240|       |
 6241|     56|    if (!sp || !isp || !transport || !rcvp ) {
  ------------------
  |  Branch (6241:9): [True: 0, False: 56]
  |  Branch (6241:16): [True: 0, False: 56]
  |  Branch (6241:24): [True: 0, False: 56]
  |  Branch (6241:38): [True: 0, False: 56]
  ------------------
 6242|      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]
  |  |  ------------------
  ------------------
 6243|      0|        return -2;
 6244|      0|    }
 6245|       |
 6246|     56|    if (transport->flags & NETSNMP_TRANSPORT_FLAG_STREAM)
  ------------------
  |  |   51|     56|#define		NETSNMP_TRANSPORT_FLAG_STREAM	 0x01
  ------------------
  |  Branch (6246:9): [True: 0, False: 56]
  ------------------
 6247|      0|        return -2;
 6248|       |
 6249|     56|    if (NULL != rcvp->packet) {
  ------------------
  |  Branch (6249:9): [True: 0, False: 56]
  ------------------
 6250|      0|        snmp_log(LOG_WARNING, "overwriting existing saved packet; sess %p\n",
 6251|      0|                 sp);
 6252|      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]
  |  |  ------------------
  ------------------
 6253|      0|    }
 6254|       |
 6255|     56|    if ((rcvp->packet = (u_char *) malloc(SNMP_MAX_RCV_MSG_SIZE)) == NULL) {
  ------------------
  |  |  108|     56|#define SNMP_MAX_RCV_MSG_SIZE      65536
  ------------------
  |  Branch (6255:9): [True: 0, False: 56]
  ------------------
 6256|      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]
  |  |  ------------------
  ------------------
 6257|      0|                    SNMP_MAX_RCV_MSG_SIZE));
 6258|      0|        return -2;
 6259|      0|    }
 6260|       |
 6261|     56|    rcvp->packet_len = netsnmp_transport_recv(transport, rcvp->packet,
 6262|     56|                                              SNMP_MAX_RCV_MSG_SIZE,
  ------------------
  |  |  108|     56|#define SNMP_MAX_RCV_MSG_SIZE      65536
  ------------------
 6263|     56|                                              &rcvp->opaque, &rcvp->olength);
 6264|     56|    if (rcvp->packet_len == -1) {
  ------------------
  |  Branch (6264:9): [True: 0, False: 56]
  ------------------
 6265|      0|        sp->s_snmp_errno = SNMPERR_BAD_RECVFROM;
  ------------------
  |  |  209|      0|#define SNMPERR_BAD_RECVFROM 		(-25)
  ------------------
 6266|      0|        sp->s_errno = errno;
 6267|      0|        snmp_set_detail(strerror(errno));
 6268|      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]
  |  |  ------------------
  ------------------
 6269|      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]
  |  |  ------------------
  ------------------
 6270|      0|        return -1;
 6271|      0|    }
 6272|       |
 6273|     56|    if (0 == rcvp->packet_len &&
  ------------------
  |  Branch (6273:9): [True: 0, False: 56]
  ------------------
 6274|      0|        transport->flags & NETSNMP_TRANSPORT_FLAG_EMPTY_PKT) {
  ------------------
  |  |   56|      0|#define		NETSNMP_TRANSPORT_FLAG_EMPTY_PKT 0x10
  ------------------
  |  Branch (6274:9): [True: 0, False: 0]
  ------------------
 6275|       |        /* this allows for a transport that needs to return from
 6276|       |         * packet processing that doesn't necessarily have any
 6277|       |         * consumable data in it. */
 6278|       |
 6279|       |        /* reset the flag since it's a per-message flag */
 6280|      0|        transport->flags &= (~NETSNMP_TRANSPORT_FLAG_EMPTY_PKT);
  ------------------
  |  |   56|      0|#define		NETSNMP_TRANSPORT_FLAG_EMPTY_PKT 0x10
  ------------------
 6281|       |
 6282|       |        /** free packet */
 6283|      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]
  |  |  ------------------
  ------------------
 6284|      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]
  |  |  ------------------
  ------------------
 6285|       |
 6286|      0|        return -2;
 6287|      0|    }
 6288|       |
 6289|     56|    return 0;
 6290|     56|}
snmp_api.c:_sess_process_packet:
 6076|    183|{
 6077|    183|    netsnmp_pdu         *pdu;
 6078|    183|    int                  rc;
 6079|       |
 6080|    183|    pdu = _sess_process_packet_parse_pdu(slp, sp, isp, transport, opaque,
 6081|    183|                                         olength, packetptr, length);
 6082|    183|    if (NULL == pdu)
  ------------------
  |  Branch (6082:9): [True: 183, False: 0]
  ------------------
 6083|    183|        return -1;
 6084|       |
 6085|       |    /*
 6086|       |     * find session to process pdu. usually that will be the current session,
 6087|       |     * but with the introduction of shared transports, another session may
 6088|       |     * have the same socket.
 6089|       |     */
 6090|      0|    do {
 6091|      0|        rc = _sess_process_packet_handle_pdu(slp, sp, isp, transport, pdu);
 6092|      0|        if (-2 != rc || !(transport->flags & NETSNMP_TRANSPORT_FLAG_SHARED))
  ------------------
  |  |   58|      0|#define		NETSNMP_TRANSPORT_FLAG_SHARED	 0x40
  ------------------
  |  Branch (6092:13): [True: 0, False: 0]
  |  Branch (6092:25): [True: 0, False: 0]
  ------------------
 6093|      0|            break;
 6094|       |
 6095|       |        /** -2 means pdu not in request list. check other sessions */
 6096|      0|        do  {
 6097|      0|            slp = slp->next;
 6098|      0|        } while (slp && slp->transport->sock != transport->sock);
  ------------------
  |  Branch (6098:18): [True: 0, False: 0]
  |  Branch (6098:25): [True: 0, False: 0]
  ------------------
 6099|      0|        if (!slp)
  ------------------
  |  Branch (6099:13): [True: 0, False: 0]
  ------------------
 6100|      0|            break; /* no more sessions with same socket */
 6101|       |
 6102|      0|        sp = slp->session;
 6103|      0|        isp = slp->internal;
 6104|      0|        transport = slp->transport;
 6105|      0|    } while(slp);
  ------------------
  |  Branch (6105:13): [True: 0, False: 0]
  ------------------
 6106|       |
 6107|      0|    if (-2 == rc) { /* did not find session for pdu */
  ------------------
  |  Branch (6107:9): [True: 0, False: 0]
  ------------------
 6108|      0|        snmp_increment_statistic(STAT_SNMPUNKNOWNPDUHANDLERS);
  ------------------
  |  |  613|      0|#define   STAT_SNMPUNKNOWNPDUHANDLERS        2
  ------------------
 6109|      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]
  |  |  ------------------
  ------------------
 6110|      0|        snmp_free_pdu(pdu);
 6111|      0|    }
 6112|       |
 6113|      0|  return rc;
 6114|    183|}
snmp_api.c:_sess_process_packet_parse_pdu:
 5748|    183|{
 5749|    183|  netsnmp_pdu    *pdu;
 5750|    183|  int             ret = 0;
 5751|    183|  int             dump = 0, filter = 0;
 5752|       |
 5753|    183|  debug_indent_reset();
 5754|       |
 5755|    183|  DEBUGMSGTL(("sess_process_packet",
  ------------------
  |  |   66|    183|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    183|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 183]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 183]
  |  |  ------------------
  ------------------
 5756|    183|	      "session %p fd %" NETSNMP_FMT_SKT " pkt %p length %d\n", slp,
 5757|    183|	      transport->sock, packetptr, length));
 5758|       |
 5759|    183|  dump = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    183|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 5760|    183|                                NETSNMP_DS_LIB_DUMP_PACKET);
  ------------------
  |  |   63|    183|#define NETSNMP_DS_LIB_DUMP_PACKET         4
  ------------------
 5761|    183|#ifndef NETSNMP_FEATURE_REMOVE_FILTER_SOURCE
 5762|    183|  filter = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    183|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 5763|    183|                                  NETSNMP_DS_LIB_FILTER_TYPE);
  ------------------
  |  |  133|    183|#define NETSNMP_DS_LIB_FILTER_TYPE         17 /* 0=NONE, 1=whitelist, -1=blacklist */
  ------------------
 5764|    183|#endif
 5765|    183|  if (dump || filter) {
  ------------------
  |  Branch (5765:7): [True: 0, False: 183]
  |  Branch (5765:15): [True: 0, False: 183]
  ------------------
 5766|      0|      int filtered = 0;
 5767|      0|      char *addrtxt = netsnmp_transport_peer_string(transport, opaque, olength);
 5768|       |
 5769|      0|      if (!addrtxt) {
  ------------------
  |  Branch (5769:11): [True: 0, False: 0]
  ------------------
 5770|      0|          DEBUGMSGTL(("sess_process_packet",
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 5771|      0|                      "Failed to resolve peer address\n"));
 5772|      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]
  |  |  ------------------
  ------------------
 5773|      0|          return NULL;
 5774|      0|      }
 5775|       |
 5776|      0|      snmp_log(LOG_DEBUG, "\nReceived %d byte packet from %s\n",
 5777|      0|               length, addrtxt);
 5778|       |
 5779|      0|      if (dump)
  ------------------
  |  Branch (5779:11): [True: 0, False: 0]
  ------------------
 5780|      0|          xdump(packetptr, length, "");
 5781|       |
 5782|      0|#ifndef NETSNMP_FEATURE_REMOVE_FILTER_SOURCE
 5783|      0|      if (filter) {
  ------------------
  |  Branch (5783:11): [True: 0, False: 0]
  ------------------
 5784|      0|          char *sourceaddr = NULL, *c = strchr(addrtxt, '[');
 5785|      0|          const char *dropstr = NULL;
 5786|      0|          if (c) {
  ------------------
  |  Branch (5786:15): [True: 0, False: 0]
  ------------------
 5787|      0|              sourceaddr = ++c;
 5788|      0|              c = strchr(sourceaddr, ']');
 5789|      0|              if (c)
  ------------------
  |  Branch (5789:19): [True: 0, False: 0]
  ------------------
 5790|      0|                  *c = 0;
 5791|      0|              filtered = netsnmp_transport_filter_check(sourceaddr);
 5792|      0|          }
 5793|      0|          else if (!strncmp(addrtxt, "callback", 8)) {
  ------------------
  |  Branch (5793:20): [True: 0, False: 0]
  ------------------
 5794|       |              /* do not filter internal request */
 5795|      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]
  |  |  ------------------
  ------------------
 5796|      0|                          "bypass packet from %s \n",
 5797|      0|                          addrtxt));
 5798|      0|              filtered = 1;
 5799|      0|          }
 5800|      0|          if ((filter == -1) && filtered)
  ------------------
  |  Branch (5800:15): [True: 0, False: 0]
  |  Branch (5800:33): [True: 0, False: 0]
  ------------------
 5801|      0|              dropstr = "matched blacklist";
 5802|      0|          else if ((filter == 1) && !filtered)
  ------------------
  |  Branch (5802:20): [True: 0, False: 0]
  |  Branch (5802:37): [True: 0, False: 0]
  ------------------
 5803|      0|              dropstr = "didn't match whitelist";
 5804|      0|          if (dropstr) {
  ------------------
  |  Branch (5804:15): [True: 0, False: 0]
  ------------------
 5805|      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]
  |  |  ------------------
  ------------------
 5806|      0|                          "packet from %s %s\n",
 5807|      0|                          sourceaddr ? sourceaddr : "UNKNOWN", dropstr));
 5808|      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]
  |  |  ------------------
  ------------------
 5809|      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]
  |  |  ------------------
  ------------------
 5810|      0|              return NULL;
 5811|      0|          }
 5812|      0|      }
 5813|      0|#endif
 5814|       |
 5815|      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]
  |  |  ------------------
  ------------------
 5816|      0|  }
 5817|       |
 5818|       |  /*
 5819|       |   * Do transport-level filtering (e.g. IP-address based allow/deny).  
 5820|       |   */
 5821|       |
 5822|    183|  if (isp->hook_pre) {
  ------------------
  |  Branch (5822:7): [True: 0, False: 183]
  ------------------
 5823|      0|    if (isp->hook_pre(sp, transport, opaque, olength) == 0) {
  ------------------
  |  Branch (5823:9): [True: 0, False: 0]
  ------------------
 5824|      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]
  |  |  ------------------
  ------------------
 5825|      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]
  |  |  ------------------
  ------------------
 5826|      0|      return NULL;
 5827|      0|    }
 5828|      0|  }
 5829|       |
 5830|    183|  if (isp->hook_create_pdu) {
  ------------------
  |  Branch (5830:7): [True: 0, False: 183]
  ------------------
 5831|      0|    pdu = isp->hook_create_pdu(transport, opaque, olength);
 5832|    183|  } else {
 5833|    183|    pdu = snmp_create_sess_pdu(transport, opaque, olength);
 5834|    183|  }
 5835|       |
 5836|    183|  if (pdu == NULL) {
  ------------------
  |  Branch (5836:7): [True: 0, False: 183]
  ------------------
 5837|      0|    snmp_log(LOG_ERR, "pdu failed to be created\n");
 5838|      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]
  |  |  ------------------
  ------------------
 5839|      0|    return NULL;
 5840|      0|  }
 5841|       |
 5842|       |  /* if the transport was a magic tunnel, mark the PDU as having come
 5843|       |     through one. */
 5844|    183|  if (transport->flags & NETSNMP_TRANSPORT_FLAG_TUNNELED) {
  ------------------
  |  |   53|    183|#define		NETSNMP_TRANSPORT_FLAG_TUNNELED	 0x04
  ------------------
  |  Branch (5844:7): [True: 0, False: 183]
  ------------------
 5845|      0|      pdu->flags |= UCD_MSG_FLAG_TUNNELED;
  ------------------
  |  |  317|      0|#define UCD_MSG_FLAG_TUNNELED               0x4000
  ------------------
 5846|      0|  }
 5847|       |
 5848|    183|  if (isp->hook_parse) {
  ------------------
  |  Branch (5848:7): [True: 0, False: 183]
  ------------------
 5849|      0|    ret = isp->hook_parse(sp, pdu, packetptr, length);
 5850|    183|  } else {
 5851|    183|    ret = snmp_parse(slp, sp, pdu, packetptr, length);
 5852|    183|  }
 5853|       |
 5854|    183|  DEBUGMSGTL(("sess_process_packet", "received message id#%ld reqid#%ld len "
  ------------------
  |  |   66|    183|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    183|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 183]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 183]
  |  |  ------------------
  ------------------
 5855|    183|              "%u\n", pdu->msgid, pdu->reqid, length));
 5856|       |
 5857|    183|  if (ret != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|    183|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
  |  Branch (5857:7): [True: 183, False: 0]
  ------------------
 5858|    183|    DEBUGMSGTL(("sess_process_packet", "parse fail\n"));
  ------------------
  |  |   66|    183|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    183|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 183]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 183]
  |  |  ------------------
  ------------------
 5859|    183|  }
 5860|       |
 5861|    183|  if (isp->hook_post) {
  ------------------
  |  Branch (5861:7): [True: 0, False: 183]
  ------------------
 5862|      0|    if (isp->hook_post(sp, pdu, ret) == 0) {
  ------------------
  |  Branch (5862:9): [True: 0, False: 0]
  ------------------
 5863|      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]
  |  |  ------------------
  ------------------
 5864|      0|      ret = SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 5865|      0|    }
 5866|      0|  }
 5867|       |
 5868|    183|  if (ret != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|    183|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
  |  Branch (5868:7): [True: 183, False: 0]
  ------------------
 5869|    183|    snmp_free_pdu(pdu);
 5870|    183|    return NULL;
 5871|    183|  }
 5872|       |
 5873|      0|  return pdu;
 5874|    183|}

snmp_comstr_parse:
  109|     16|{
  110|     16|    u_char          type;
  111|     16|    long            ver;
  112|     16|    size_t          origlen = *slen;
  113|       |
  114|       |    /*
  115|       |     * Message is an ASN.1 SEQUENCE.
  116|       |     */
  117|     16|    data = asn_parse_sequence(data, length, &type,
  118|     16|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|     16|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|     16|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
  119|     16|                              "auth message");
  120|     16|    if (data == NULL) {
  ------------------
  |  Branch (120:9): [True: 0, False: 16]
  ------------------
  121|      0|        return NULL;
  122|      0|    }
  123|       |
  124|       |    /*
  125|       |     * First field is the version.
  126|       |     */
  127|     16|    DEBUGDUMPHEADER("recv", "SNMP version");
  ------------------
  |  |   79|     16|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     16|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 16]
  |  |  ------------------
  ------------------
  128|     16|    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
  129|     16|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     16|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     16|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 16]
  |  |  ------------------
  ------------------
  130|     16|    *version = ver;
  131|     16|    if (data == NULL) {
  ------------------
  |  Branch (131:9): [True: 0, False: 16]
  ------------------
  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|     16|    DEBUGDUMPHEADER("recv", "community string");
  ------------------
  |  |   79|     16|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     16|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 16]
  |  |  ------------------
  ------------------
  140|     16|    data = asn_parse_string(data, length, &type, psid, slen);
  141|     16|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     16|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     16|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 16]
  |  |  ------------------
  ------------------
  142|     16|    if (data == NULL) {
  ------------------
  |  Branch (142:9): [True: 0, False: 16]
  ------------------
  143|      0|        ERROR_MSG("bad parse of community");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  144|      0|        return NULL;
  145|      0|    }
  146|     16|    psid[SNMP_MIN(*slen, origlen - 1)] = '\0';
  ------------------
  |  |  111|     16|#define SNMP_MIN(a,b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (111:24): [True: 0, False: 16]
  |  |  ------------------
  ------------------
  147|     16|    return (u_char *) data;
  148|       |
  149|     16|}                               /* end snmp_comstr_parse() */

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

debug_indent_reset:
  112|    183|{
  113|    183|    if (debugindent != 0)
  ------------------
  |  Branch (113:9): [True: 0, False: 183]
  ------------------
  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|    183|    debugindent = 0;
  116|    183|}
debug_is_token_registered:
  303|     69|{
  304|     69|    int             i, rc;
  305|       |
  306|       |    /*
  307|       |     * debugging flag is on or off
  308|       |     */
  309|     69|    if (!dodebug)
  ------------------
  |  Branch (309:9): [True: 69, False: 0]
  ------------------
  310|     69|        return SNMPERR_GENERR;
  ------------------
  |  |  185|     69|#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;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  317|      0|    }
  318|      0|    else
  319|      0|        rc = SNMPERR_GENERR; /* ! found = err */
  ------------------
  |  |  185|      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 */
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  329|      0|            else
  330|      0|                return SNMPERR_GENERR; /* excluded */
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  331|      0|        }
  332|      0|    }
  333|      0|    return rc;
  334|      0|}
snmp_get_do_debugging:
  551|  32.5k|{
  552|  32.5k|    return dodebug;
  553|  32.5k|}
snmp_debug_shutdown:
  569|     57|{
  570|     57|    int i;
  571|       |
  572|     57|    for (i = 0; i < debug_num_tokens; i++)
  ------------------
  |  Branch (572:17): [True: 0, False: 57]
  ------------------
  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|     57|}
snmp_debug_init:
  722|     57|{
  723|       |#ifdef HAVE_WOLFSSL_WOLFCRYPT_LOGGING_H
  724|       |    wolfSSL_Debugging_ON();
  725|       |    wolfSSL_SetLoggingCb(snmp_log_wolfssl_msg);
  726|       |#endif
  727|       |
  728|     57|    register_prenetsnmp_mib_handler("snmp", "doDebugging",
  729|     57|                                    debug_config_turn_on_debugging, NULL,
  730|     57|                                    "(1|0)");
  731|     57|    register_prenetsnmp_mib_handler("snmp", "debugTokens",
  732|     57|                                    debug_config_register_tokens, NULL,
  733|     57|                                    "token[,token...]");
  734|     57|#ifndef NETSNMP_DISABLE_DYNAMIC_LOG_LEVEL
  735|     57|    register_prenetsnmp_mib_handler("snmp", "debugLogLevel",
  736|       |                                    debug_config_debug_log_level, NULL,
  737|     57|                                    "(emerg|alert|crit|err|warning|notice|info|debug)");
  738|     57|#endif /* NETSNMP_DISABLE_DYNAMIC_LOG_LEVEL */
  739|     57|}

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

init_snmp_logging:
  168|     57|{
  169|     57|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "logTimestamp", 
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
  170|     57|			 NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_LOG_TIMESTAMP);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              			 NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_LOG_TIMESTAMP);
  ------------------
  |  |   64|     57|#define NETSNMP_DS_LIB_LOG_TIMESTAMP       5
  ------------------
  171|     57|    register_prenetsnmp_mib_handler("snmp", "logOption",
  172|     57|                                    parse_config_logOption, NULL, "string");
  173|       |
  174|     57|}
shutdown_snmp_logging:
  178|     57|{
  179|     57|   snmp_disable_log();
  180|     57|   while(NULL != logh_head)
  ------------------
  |  Branch (180:10): [True: 0, False: 57]
  ------------------
  181|      0|      netsnmp_remove_loghandler( logh_head );
  182|     57|}
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|     57|{
  691|     57|    netsnmp_log_handler *logh;
  692|       |
  693|     57|    for (logh = logh_head; logh; logh = logh->next) {
  ------------------
  |  Branch (693:28): [True: 0, False: 57]
  ------------------
  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|     57|}
log_handler_stdouterr:
 1101|  2.79k|{
 1102|  2.79k|    static int      newline = 1;	 /* MTCRITICAL_RESOURCE */
 1103|  2.79k|    const char     *newline_ptr;
 1104|  2.79k|    char            sbuf[40];
 1105|       |
 1106|  2.79k|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|  2.79k|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1106:9): [True: 0, False: 2.79k]
  ------------------
 1107|  2.79k|                               NETSNMP_DS_LIB_LOG_TIMESTAMP) && newline) {
  ------------------
  |  |   64|  2.79k|#define NETSNMP_DS_LIB_LOG_TIMESTAMP       5
  ------------------
  |  Branch (1107:65): [True: 0, False: 0]
  ------------------
 1108|      0|        sprintf_stamp(NULL, sbuf);
 1109|  2.79k|    } else {
 1110|  2.79k|        strcpy(sbuf, "");
 1111|  2.79k|    }
 1112|       |    /*
 1113|       |     * Remember whether or not the current line ends with a newline for the
 1114|       |     * next call of log_handler_stdouterr().
 1115|       |     */
 1116|  2.79k|    newline_ptr = strrchr(str, '\n');
 1117|  2.79k|    newline = newline_ptr && newline_ptr[1] == 0;
  ------------------
  |  Branch (1117:15): [True: 2.79k, False: 0]
  |  Branch (1117:30): [True: 2.79k, False: 0]
  ------------------
 1118|       |
 1119|  2.79k|    if (logh->imagic)
  ------------------
  |  Branch (1119:9): [True: 0, False: 2.79k]
  ------------------
 1120|      0|       printf(         "%s%s", sbuf, str);
 1121|  2.79k|    else
 1122|  2.79k|       fprintf(stderr, "%s%s", sbuf, str);
 1123|       |
 1124|  2.79k|    return 1;
 1125|  2.79k|}
snmp_log_string:
 1292|  2.79k|{
 1293|  2.79k|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1294|  2.79k|    static int stderr_enabled = 0;
 1295|  2.79k|    static netsnmp_log_handler lh = { 1, 0, 0, 0, "stderr",
 1296|  2.79k|                                      log_handler_stdouterr, 0, NULL,  NULL,
 1297|  2.79k|                                      NULL };
 1298|  2.79k|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1299|  2.79k|    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|  2.79k|    if (0 == logh_enabled) {
  ------------------
  |  Branch (1305:9): [True: 2.79k, False: 0]
  ------------------
 1306|  2.79k|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1307|  2.79k|        if (!stderr_enabled) {
  ------------------
  |  Branch (1307:13): [True: 1, False: 2.79k]
  ------------------
 1308|      1|            ++stderr_enabled;
 1309|      1|            netsnmp_set_line_buffering(stderr);
 1310|      1|        }
 1311|  2.79k|        log_handler_stdouterr( &lh, priority, str );
 1312|  2.79k|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1313|       |
 1314|  2.79k|        return;
 1315|  2.79k|    }
 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|  2.79k|{
 1380|  2.79k|    char           *buffer = NULL;
 1381|  2.79k|    int             length;
 1382|       |
 1383|  2.79k|    length = vasprintf(&buffer, format, ap);
 1384|  2.79k|    if (length < 0) {
  ------------------
  |  Branch (1384:9): [True: 0, False: 2.79k]
  ------------------
 1385|      0|        snmp_log_string(LOG_ERR, "Could not format log-string\n");
 1386|      0|        return -1;
 1387|      0|    }
 1388|       |
 1389|  2.79k|    snmp_log_string(priority, buffer);
 1390|  2.79k|    free(buffer);
 1391|  2.79k|    return 0;
 1392|  2.79k|}
snmp_log:
 1403|  2.79k|{
 1404|  2.79k|    va_list         ap;
 1405|  2.79k|    int             ret;
 1406|  2.79k|    va_start(ap, format);
 1407|  2.79k|    ret = snmp_vlog(priority, format, ap);
 1408|       |    va_end(ap);
 1409|  2.79k|    return (ret);
 1410|  2.79k|}

netsnmp_init_openssl:
  118|     58|void netsnmp_init_openssl(void) {
  119|       |
  120|       |    /* avoid duplicate calls */
  121|     58|    if (have_started_already)
  ------------------
  |  Branch (121:9): [True: 57, False: 1]
  ------------------
  122|     57|        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|     57|{
   49|     57|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
   50|     57|                           SNMP_CALLBACK_SESSION_INIT, set_default_secmod,
  ------------------
  |  |   29|     57|#define SNMP_CALLBACK_SESSION_INIT		5
  ------------------
   51|     57|                           NULL);
   52|       |
   53|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defSecurityModel",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
   54|     57|			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECMODEL);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECMODEL);
  ------------------
  |  |  161|     57|#define NETSNMP_DS_LIB_SECMODEL          10
  ------------------
   55|       |    /*
   56|       |     * this file is generated by configure for all the stuff we're using 
   57|       |     */
   58|     57|#include "snmpsm_init.h"
  ------------------
  |  |    1|       |/* This file is automatically generated by configure.  Do not modify by hand. */
  |  |    2|     57|init_usm();
  |  |    3|     57|init_tsm();
  |  |    4|     57|init_ksm();
  ------------------
   59|     57|}
shutdown_secmod:
   63|     57|{
   64|     57|    #include "snmpsm_shutdown.h"
  ------------------
  |  |    1|       |/* This file is automatically generated by configure.  Do not modify by hand. */
  |  |    2|     57|shutdown_usm();
  |  |    3|     57|shutdown_tsm();
  |  |    4|     57|shutdown_ksm();
  ------------------
   65|     57|}
register_sec_mod:
   70|    171|{
   71|    171|    int             result = 0;
   72|    171|    struct snmp_secmod_list *sptr;
   73|    171|    char           *othername, *modname2 = NULL;
   74|       |
   75|    342|    for (sptr = registered_services; sptr; sptr = sptr->next) {
  ------------------
  |  Branch (75:38): [True: 171, False: 171]
  ------------------
   76|    171|        if (sptr->securityModel == secmod) {
  ------------------
  |  Branch (76:13): [True: 0, False: 171]
  ------------------
   77|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
   78|      0|        }
   79|    171|    }
   80|    171|    sptr = SNMP_MALLOC_STRUCT(snmp_secmod_list);
  ------------------
  |  |   69|    171|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
   81|    171|    if (sptr == NULL)
  ------------------
  |  Branch (81:9): [True: 0, False: 171]
  ------------------
   82|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
   83|    171|    sptr->secDef = newdef;
   84|    171|    sptr->securityModel = secmod;
   85|    171|    sptr->next = registered_services;
   86|    171|    registered_services = sptr;
   87|    171|    modname2 = strdup(modname);
   88|    171|    if (!modname2)
  ------------------
  |  Branch (88:9): [True: 0, False: 171]
  ------------------
   89|      0|        result = SE_NOMEM;
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
   90|    171|    else
   91|    171|        result = se_add_pair_to_slist("snmp_secmods", modname2, secmod);
   92|    171|    if (result != SE_OK) {
  ------------------
  |  |   42|    171|#define SE_OK            0
  ------------------
  |  Branch (92:9): [True: 0, False: 171]
  ------------------
   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;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  113|      0|    }
  114|    171|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|    171|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  115|    171|}
unregister_sec_mod:
  121|     57|{
  122|     57|    struct snmp_secmod_list *sptr, *lptr;
  123|       |
  124|     57|    for (sptr = registered_services, lptr = NULL; sptr;
  ------------------
  |  Branch (124:51): [True: 0, False: 57]
  ------------------
  125|     57|         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;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  134|      0|        }
  135|      0|    }
  136|       |    /*
  137|       |     * not registered 
  138|       |     */
  139|     57|    return SNMPERR_GENERR;
  ------------------
  |  |  185|     57|#define SNMPERR_GENERR			(-1)
  ------------------
  140|     57|}
clear_sec_mod:
  145|     57|{
  146|     57|    struct snmp_secmod_list *tmp = registered_services, *next = NULL;
  147|       |
  148|    228|    while (tmp != NULL) {
  ------------------
  |  Branch (148:12): [True: 171, False: 57]
  ------------------
  149|    171|	next = tmp->next;
  150|    171|	SNMP_FREE(tmp->secDef);
  ------------------
  |  |   62|    171|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 171, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 171]
  |  |  ------------------
  ------------------
  151|    171|	SNMP_FREE(tmp);
  ------------------
  |  |   62|    171|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 171, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 171]
  |  |  ------------------
  ------------------
  152|    171|	tmp = next;
  153|    171|    }
  154|       |    registered_services = NULL;
  155|     57|}
find_sec_mod:
  160|    393|{
  161|    393|    struct snmp_secmod_list *sptr;
  162|       |
  163|  1.36k|    for (sptr = registered_services; sptr; sptr = sptr->next) {
  ------------------
  |  Branch (163:38): [True: 1.17k, False: 186]
  ------------------
  164|  1.17k|        if (sptr->securityModel == secmod) {
  ------------------
  |  Branch (164:13): [True: 207, False: 972]
  ------------------
  165|    207|            return sptr->secDef;
  166|    207|        }
  167|  1.17k|    }
  168|       |    /*
  169|       |     * not registered 
  170|       |     */
  171|    186|    return NULL;
  172|    393|}
snmp_secmod.c:set_default_secmod:
  189|     57|{
  190|     57|    netsnmp_session *sess = (netsnmp_session *) serverarg;
  191|     57|    char           *cptr;
  192|     57|    int             model;
  193|       |
  194|     57|    if (!sess)
  ------------------
  |  Branch (194:9): [True: 0, False: 57]
  ------------------
  195|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  196|     57|    if (sess->securityModel == SNMP_DEFAULT_SECMODEL) {
  ------------------
  |  |   91|     57|#define SNMP_DEFAULT_SECMODEL	    -1
  ------------------
  |  Branch (196:9): [True: 57, False: 0]
  ------------------
  197|     57|        if ((cptr = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (197:13): [True: 0, False: 57]
  ------------------
  198|     57|					  NETSNMP_DS_LIB_SECMODEL)) != NULL) {
  ------------------
  |  |  161|     57|#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;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  208|      0|            }
  209|     57|        } else {
  210|     57|            sess->securityModel = NETSNMP_SECMOD_DEFAULT_MODEL;
  ------------------
  |  |  177|     57|#define NETSNMP_SECMOD_DEFAULT_MODEL  USM_SEC_MODEL_NUMBER
  |  |  ------------------
  |  |  |  |   40|     57|#define USM_SEC_MODEL_NUMBER            SNMP_SEC_MODEL_USM
  |  |  |  |  ------------------
  |  |  |  |  |  |  295|     57|#define SNMP_SEC_MODEL_USM		3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  211|     57|        }
  212|     57|    }
  213|     57|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  214|     57|}

netsnmp_register_default_domain:
   60|    114|{
   61|    114|    struct netsnmp_lookup_domain *run = domains, *prev = NULL;
   62|    114|    int res = 0;
   63|       |
   64|    171|    while (run != NULL && strcmp(run->application, application) < 0) {
  ------------------
  |  Branch (64:12): [True: 57, False: 114]
  |  Branch (64:27): [True: 57, False: 0]
  ------------------
   65|     57|	prev = run;
   66|     57|	run = run->next;
   67|     57|    }
   68|    114|    if (run && strcmp(run->application, application) == 0) {
  ------------------
  |  Branch (68:9): [True: 0, False: 114]
  |  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|    114|    } else {
   75|    114|	run = SNMP_MALLOC_STRUCT(netsnmp_lookup_domain);
  ------------------
  |  |   69|    114|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
   76|    114|	run->application = strdup(application);
   77|    114|	run->userDomain = NULL;
   78|    114|	if (prev) {
  ------------------
  |  Branch (78:6): [True: 57, False: 57]
  ------------------
   79|     57|	    run->next = prev->next;
   80|     57|	    prev->next = run;
   81|     57|	} else {
   82|     57|	    run->next = domains;
   83|     57|	    domains = run;
   84|     57|	}
   85|    114|    }
   86|    114|    if (domain) {
  ------------------
  |  Branch (86:9): [True: 114, False: 0]
  ------------------
   87|    114|        run->domain = create_word_array(domain);
   88|    114|    } 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|    114|    return res;
   97|    114|}
netsnmp_clear_default_domain:
  101|     57|{
  102|    171|    while (domains) {
  ------------------
  |  Branch (102:12): [True: 114, False: 57]
  ------------------
  103|    114|	struct netsnmp_lookup_domain *tmp = domains;
  104|    114|	domains = domains->next;
  105|    114|	free(tmp->application);
  106|    114|        destroy_word_array(tmp->userDomain);
  107|    114|        destroy_word_array(tmp->domain);
  108|    114|	free(tmp);
  109|    114|    }
  110|     57|}
netsnmp_lookup_default_domains:
  186|     57|{
  187|     57|    const char * const * res;
  188|       |
  189|     57|    if (application == NULL)
  ------------------
  |  Branch (189:9): [True: 0, False: 57]
  ------------------
  190|      0|	res = NULL;
  191|     57|    else {
  192|     57|        struct netsnmp_lookup_domain *run = domains;
  193|       |
  194|    171|	while (run && strcmp(run->application, application) < 0)
  ------------------
  |  Branch (194:9): [True: 114, False: 57]
  |  Branch (194:16): [True: 114, False: 0]
  ------------------
  195|    114|	    run = run->next;
  196|     57|	if (run && strcmp(run->application, application) == 0)
  ------------------
  |  Branch (196:6): [True: 0, False: 57]
  |  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|     57|	else
  202|     57|	    res = NULL;
  203|     57|    }
  204|     57|    DEBUGMSGTL(("defaults",
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#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: 57]
  |  |  ------------------
  ------------------
  205|     57|                "netsnmp_lookup_default_domain(\"%s\") ->",
  206|     57|                application ? application : "[NIL]"));
  207|     57|    if (res) {
  ------------------
  |  Branch (207:9): [True: 0, False: 57]
  ------------------
  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|     57|        DEBUGMSG(("defaults", " \"[NIL]\"\n"));
  ------------------
  |  |   61|     57|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 57]
  |  |  ------------------
  ------------------
  216|     57|    return res;
  217|     57|}
netsnmp_register_default_target:
  248|    798|{
  249|    798|    struct netsnmp_lookup_target *run = targets, *prev = NULL;
  250|    798|    int i = 0, res = 0;
  251|  4.38k|    while (run && ((i = strcmp(run->application, application)) < 0 ||
  ------------------
  |  Branch (251:12): [True: 4.16k, False: 228]
  |  Branch (251:20): [True: 2.79k, False: 1.36k]
  ------------------
  252|  3.59k|		   (i == 0 && strcmp(run->domain, domain) < 0))) {
  ------------------
  |  Branch (252:7): [True: 1.36k, False: 0]
  |  Branch (252:17): [True: 798, False: 570]
  ------------------
  253|  3.59k|	prev = run;
  254|  3.59k|	run = run->next;
  255|  3.59k|    }
  256|    798|    if (run && i == 0 && strcmp(run->domain, domain) == 0) {
  ------------------
  |  Branch (256:9): [True: 570, False: 228]
  |  Branch (256:16): [True: 570, False: 0]
  |  Branch (256:26): [True: 0, False: 570]
  ------------------
  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|    798|    } else {
  263|    798|	run = SNMP_MALLOC_STRUCT(netsnmp_lookup_target);
  ------------------
  |  |   69|    798|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  264|    798|	run->application = strdup(application);
  265|    798|	run->domain = strdup(domain);
  266|    798|	run->userTarget = NULL;
  267|    798|	if (prev) {
  ------------------
  |  Branch (267:6): [True: 627, False: 171]
  ------------------
  268|    627|	    run->next = prev->next;
  269|    627|	    prev->next = run;
  270|    627|	} else {
  271|    171|	    run->next = targets;
  272|    171|	    targets = run;
  273|    171|	}
  274|    798|    }
  275|    798|    if (target) {
  ------------------
  |  Branch (275:9): [True: 798, False: 0]
  ------------------
  276|    798|	run->target = strdup(target);
  277|    798|    } 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|    798|    return res;
  287|    798|}
netsnmp_clear_default_target:
  294|     57|{
  295|    855|    while (targets) {
  ------------------
  |  Branch (295:12): [True: 798, False: 57]
  ------------------
  296|    798|	struct netsnmp_lookup_target *tmp = targets;
  297|    798|	targets = targets->next;
  298|    798|	free(tmp->application);
  299|    798|	free(tmp->domain);
  300|    798|	free(tmp->userTarget);
  301|    798|	free(tmp->target);
  302|    798|	free(tmp);
  303|    798|    }
  304|     57|}
netsnmp_lookup_default_target:
  397|     57|{
  398|     57|    int i = 0;
  399|     57|    struct netsnmp_lookup_target *run = targets;
  400|     57|    const char *res;
  401|       |
  402|     57|    if (application == NULL || domain == NULL)
  ------------------
  |  Branch (402:9): [True: 0, False: 57]
  |  Branch (402:32): [True: 0, False: 57]
  ------------------
  403|      0|	res = NULL;
  404|     57|    else {
  405|    855|	while (run && ((i = strcmp(run->application, application)) < 0 ||
  ------------------
  |  Branch (405:9): [True: 798, False: 57]
  |  Branch (405:17): [True: 798, 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|    798|	    run = run->next;
  408|     57|	if (run && i == 0 && strcmp(run->domain, domain) == 0)
  ------------------
  |  Branch (408:6): [True: 0, False: 57]
  |  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|     57|	else
  414|     57|	    res = NULL;
  415|     57|    }
  416|     57|    DEBUGMSGTL(("defaults",
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#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: 57]
  |  |  ------------------
  ------------------
  417|     57|		"netsnmp_lookup_default_target(\"%s\", \"%s\") -> \"%s\"\n",
  418|     57|		application ? application : "[NIL]",
  419|     57|		domain ? domain : "[NIL]",
  420|     57|		res ? res : "[NIL]"));
  421|     57|    return res;
  422|     57|}
netsnmp_register_service_handlers:
  426|     57|{
  427|     57|    register_config_handler("snmp:", "defDomain",
  428|     57|			    netsnmp_register_user_domain,
  429|     57|			    netsnmp_clear_user_domain,
  430|     57|			    "application domain");
  431|     57|    register_config_handler("snmp:", "defTarget",
  432|     57|			    netsnmp_register_user_target,
  433|     57|			    netsnmp_clear_user_target,
  434|     57|			    "application domain target");
  435|     57|}
snmp_service.c:destroy_word_array:
   38|    228|{
   39|    228|    if (arr) {
  ------------------
  |  Branch (39:9): [True: 114, False: 114]
  ------------------
   40|    114|        char** run = arr;
   41|    342|        while(*run) {
  ------------------
  |  Branch (41:15): [True: 228, False: 114]
  ------------------
   42|    228|            free(*run);
   43|    228|            ++run;
   44|    228|        }
   45|    114|        free(arr);
   46|    114|    }
   47|    228|}
snmp_service.c:create_word_array:
   28|    114|{
   29|    114|    size_t tmplen = strlen(cptr);
   30|    114|    char* tmp = (char*)malloc(tmplen + 1);
   31|    114|    char** res = create_word_array_helper(cptr, 0, tmp, tmplen + 1);
   32|    114|    free(tmp);
   33|    114|    return res;
   34|    114|}
snmp_service.c:create_word_array_helper:
   11|    228|{
   12|    228|    char* item;
   13|    228|    char** res;
   14|    228|    cptr = copy_nword_const(cptr, tmp, tmplen);
   15|    228|    item = strdup(tmp);
   16|    228|    if (cptr)
  ------------------
  |  Branch (16:9): [True: 114, False: 114]
  ------------------
   17|    114|        res = create_word_array_helper(cptr, idx + 1, tmp, tmplen);
   18|    114|    else {
   19|    114|        res = (char**)malloc(sizeof(char*) * (idx + 2));
   20|       |        res[idx + 1] = NULL;
   21|    114|    }
   22|    228|    res[idx] = item;
   23|    228|    return res;
   24|    228|}
snmp_service.c:netsnmp_clear_user_domain:
  161|    228|{
  162|    228|    struct netsnmp_lookup_domain *run = domains, *prev = NULL;
  163|       |
  164|    684|    while (run) {
  ------------------
  |  Branch (164:12): [True: 456, False: 228]
  ------------------
  165|    456|	if (run->userDomain != NULL) {
  ------------------
  |  Branch (165:6): [True: 0, False: 456]
  ------------------
  166|      0|            destroy_word_array(run->userDomain);
  167|      0|	    run->userDomain = NULL;
  168|      0|	}
  169|    456|	if (run->domain == NULL) {
  ------------------
  |  Branch (169:6): [True: 0, False: 456]
  ------------------
  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|    456|	} else {
  178|    456|	    prev = run;
  179|    456|	    run = run->next;
  180|    456|	}
  181|    456|    }
  182|    228|}
snmp_service.c:netsnmp_clear_user_target:
  371|    228|{
  372|    228|    struct netsnmp_lookup_target *run = targets, *prev = NULL;
  373|       |
  374|  3.42k|    while (run) {
  ------------------
  |  Branch (374:12): [True: 3.19k, False: 228]
  ------------------
  375|  3.19k|	if (run->userTarget != NULL) {
  ------------------
  |  Branch (375:6): [True: 0, False: 3.19k]
  ------------------
  376|      0|	    free(run->userTarget);
  377|      0|	    run->userTarget = NULL;
  378|      0|	}
  379|  3.19k|	if (run->target == NULL) {
  ------------------
  |  Branch (379:6): [True: 0, False: 3.19k]
  ------------------
  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.19k|	} else {
  389|  3.19k|	    prev = run;
  390|  3.19k|	    run = run->next;
  391|  3.19k|	}
  392|  3.19k|    }
  393|    228|}

init_snmp_transport:
  124|     57|{
  125|     57|    netsnmp_ds_register_config(ASN_BOOLEAN,
  ------------------
  |  |   72|     57|#define ASN_BOOLEAN	    0x01U
  ------------------
  126|     57|                               "snmp", "dontLoadHostConfig",
  127|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  128|     57|                               NETSNMP_DS_LIB_DONT_LOAD_HOST_FILES);
  ------------------
  |  |  100|     57|#define NETSNMP_DS_LIB_DONT_LOAD_HOST_FILES 40 /* don't read host.conf files */
  ------------------
  129|     57|#ifndef NETSNMP_FEATURE_REMOVE_FILTER_SOURCE
  130|     57|    register_app_config_handler("sourceFilterType",
  131|     57|                                netsnmp_transport_parse_filterType,
  132|       |                                NULL, "none|whitelist|blacklist");
  133|     57|    register_app_config_handler("sourceFilterAddress",
  134|     57|                                netsnmp_transport_parse_filter,
  135|     57|                                netsnmp_transport_filter_cleanup,
  136|     57|                                "host");
  137|     57|#endif /* NETSNMP_FEATURE_REMOVE_FILTER_SOURCE */
  138|     57|}
shutdown_snmp_transport:
  142|     57|{
  143|     57|#ifndef NETSNMP_FEATURE_REMOVE_FILTER_SOURCE
  144|     57|    netsnmp_transport_filter_cleanup();
  145|     57|#endif
  146|     57|}
netsnmp_transport_alloc:
  231|     57|{
  232|     57|    netsnmp_transport *transport;
  233|       |
  234|     57|    transport = SNMP_MALLOC_TYPEDEF(netsnmp_transport);
  ------------------
  |  |   73|     57|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  235|     57|    if (!transport)
  ------------------
  |  Branch (235:9): [True: 0, False: 57]
  ------------------
  236|      0|        return NULL;
  237|     57|    transport->sock = NETSNMP_INVALID_SOCKET;
  ------------------
  |  |   43|     57|#define NETSNMP_INVALID_SOCKET -1
  ------------------
  238|     57|    return transport;
  239|     57|}
netsnmp_transport_free:
  243|    114|{
  244|    114|    if (NULL == t)
  ------------------
  |  Branch (244:9): [True: 57, False: 57]
  ------------------
  245|     57|        return;
  246|       |
  247|     57|#ifndef FEATURE_REMOVE_TRANSPORT_CACHE
  248|       |    /** don't free a transport that is currently shared */
  249|     57|    if (netsnmp_transport_cache_remove(t) == 1)
  ------------------
  |  Branch (249:9): [True: 0, False: 57]
  ------------------
  250|      0|        return;
  251|     57|#endif
  252|       |
  253|     57|    SNMP_FREE(t->local);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  254|     57|    SNMP_FREE(t->remote);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 57]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  255|     57|    SNMP_FREE(t->data);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 57]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  256|     57|    netsnmp_transport_free(t->base_transport);
  257|       |
  258|       |    SNMP_FREE(t);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  259|     57|}
netsnmp_transport_filter_cleanup:
  381|    228|{
  382|    228|    if (NULL == filtered)
  ------------------
  |  Branch (382:9): [True: 228, False: 0]
  ------------------
  383|    228|        return;
  384|      0|    CONTAINER_CLEAR(filtered, filtered->free_item, NULL);
  385|      0|    CONTAINER_FREE(filtered);
  386|       |    filtered = NULL;
  387|      0|}
netsnmp_transport_send:
  416|     13|{
  417|     13|    int dumpPacket, debugLength;
  418|       |
  419|     13|    if ((NULL == t) || (NULL == t->f_send)) {
  ------------------
  |  Branch (419:9): [True: 0, False: 13]
  |  Branch (419:24): [True: 0, False: 13]
  ------------------
  420|      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]
  |  |  ------------------
  ------------------
  421|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  422|      0|    }
  423|       |
  424|     13|    dumpPacket = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     13|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  425|     13|                                        NETSNMP_DS_LIB_DUMP_PACKET);
  ------------------
  |  |   63|     13|#define NETSNMP_DS_LIB_DUMP_PACKET         4
  ------------------
  426|     13|    debugLength = (SNMPERR_SUCCESS ==
  ------------------
  |  |  184|     13|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  427|     13|                   debug_is_token_registered("transport:send"));
  428|       |
  429|     13|    if (dumpPacket | debugLength) {
  ------------------
  |  Branch (429:9): [True: 0, False: 13]
  ------------------
  430|      0|        char *str = netsnmp_transport_peer_string(t,
  431|      0|                                                  opaque ? *opaque : NULL,
  ------------------
  |  Branch (431:51): [True: 0, False: 0]
  ------------------
  432|      0|                                                  olength ? *olength : 0);
  ------------------
  |  Branch (432:51): [True: 0, False: 0]
  ------------------
  433|      0|        if (debugLength)
  ------------------
  |  Branch (433:13): [True: 0, False: 0]
  ------------------
  434|      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]
  |  |  ------------------
  ------------------
  435|      0|                          (unsigned long)length, str));
  436|      0|        if (dumpPacket)
  ------------------
  |  Branch (436:13): [True: 0, False: 0]
  ------------------
  437|      0|            snmp_log(LOG_DEBUG, "\nSending %lu bytes to %s\n", 
  438|      0|                     (unsigned long)length, str);
  439|      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]
  |  |  ------------------
  ------------------
  440|      0|    }
  441|     13|    if (dumpPacket)
  ------------------
  |  Branch (441:9): [True: 0, False: 13]
  ------------------
  442|      0|        xdump(packet, length, "");
  443|       |
  444|     13|    return t->f_send(t, packet, length, opaque, olength);
  445|     13|}
netsnmp_transport_recv:
  450|     56|{
  451|     56|    int debugLength;
  452|       |
  453|     56|    if ((NULL == t) || (NULL == t->f_recv)) {
  ------------------
  |  Branch (453:9): [True: 0, False: 56]
  |  Branch (453:24): [True: 0, False: 56]
  ------------------
  454|      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]
  |  |  ------------------
  ------------------
  455|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  456|      0|    }
  457|       |
  458|     56|    length = t->f_recv(t, packet, length, opaque, olength);
  459|       |
  460|     56|    if (length <=0)
  ------------------
  |  Branch (460:9): [True: 0, False: 56]
  ------------------
  461|      0|        return length; /* don't log timeouts/socket closed */
  462|       |
  463|     56|    debugLength = (SNMPERR_SUCCESS ==
  ------------------
  |  |  184|     56|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  464|     56|                   debug_is_token_registered("transport:recv"));
  465|       |
  466|     56|    if (debugLength) {
  ------------------
  |  Branch (466:9): [True: 0, False: 56]
  ------------------
  467|      0|        char *str = netsnmp_transport_peer_string(t,
  468|      0|                                                  opaque ? *opaque : NULL,
  ------------------
  |  Branch (468:51): [True: 0, False: 0]
  ------------------
  469|      0|                                                  olength ? *olength : 0);
  ------------------
  |  Branch (469:51): [True: 0, False: 0]
  ------------------
  470|      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]
  |  |  ------------------
  ------------------
  471|      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]
  |  |  ------------------
  ------------------
  472|      0|    }
  473|       |
  474|     56|    return length;
  475|     56|}
netsnmp_tdomain_init:
  503|     57|{
  504|     57|    DEBUGMSGTL(("tdomain", "netsnmp_tdomain_init() called\n"));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
  505|       |
  506|       |/* include the configure generated list of constructor calls */
  507|     57|#include "transports/snmp_transport_inits.h"
  ------------------
  |  |    1|       |/* This file is automatically generated by configure.  Do not modify by hand. */
  |  |    2|     57|netsnmp_tlsbase_ctor();
  |  |    3|     57|netsnmp_tlstcp_ctor();
  |  |    4|     57|netsnmp_dtlsudp_ctor();
  |  |    5|     57|netsnmp_udpshared_ctor();
  |  |    6|     57|netsnmp_std_ctor();
  |  |    7|     57|netsnmp_ipx_ctor();
  |  |    8|     57|netsnmp_aal5pvc_ctor();
  |  |    9|     57|netsnmp_udpipv6_ctor();
  |  |   10|     57|netsnmp_tcpipv6_ctor();
  |  |   11|     57|netsnmp_udp_ctor();
  |  |   12|     57|netsnmp_tcp_ctor();
  |  |   13|     57|netsnmp_alias_ctor();
  |  |   14|     57|netsnmp_unix_ctor();
  ------------------
  508|       |
  509|     57|    netsnmp_tdomain_dump();
  510|       |
  511|       |
  512|     57|}
netsnmp_clear_tdomain_list:
  516|     57|{
  517|     57|    netsnmp_tdomain *list = domain_list, *next = NULL;
  518|     57|    DEBUGMSGTL(("tdomain", "clear_tdomain_list() called\n"));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
  519|       |
  520|    685|    while (list != NULL) {
  ------------------
  |  Branch (520:12): [True: 628, False: 57]
  ------------------
  521|    628|	next = list->next;
  522|    628|	SNMP_FREE(list->prefix);
  ------------------
  |  |   62|    628|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 628, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 628]
  |  |  ------------------
  ------------------
  523|       |        /* attention!! list itself is not in the heap, so we must not free it! */
  524|    628|	list = next;
  525|    628|    }
  526|       |    domain_list = NULL;
  527|     57|}
netsnmp_tdomain_register:
  554|    628|{
  555|    628|    netsnmp_tdomain **prevNext = &domain_list, *d;
  556|       |
  557|    628|    if (n != NULL) {
  ------------------
  |  Branch (557:9): [True: 628, False: 0]
  ------------------
  558|  3.77k|        for (d = domain_list; d != NULL; d = d->next) {
  ------------------
  |  Branch (558:31): [True: 3.14k, False: 628]
  ------------------
  559|  3.14k|            if (netsnmp_oid_equals(n->name, n->name_length,
  ------------------
  |  Branch (559:17): [True: 0, False: 3.14k]
  ------------------
  560|  3.14k|                                d->name, d->name_length) == 0) {
  561|       |                /*
  562|       |                 * Already registered.  
  563|       |                 */
  564|      0|                return 0;
  565|      0|            }
  566|  3.14k|            prevNext = &(d->next);
  567|  3.14k|        }
  568|    628|        n->next = NULL;
  569|    628|        *prevNext = n;
  570|    628|        return 1;
  571|    628|    } else {
  572|      0|        return 0;
  573|      0|    }
  574|    628|}
netsnmp_tdomain_transport_tspec:
  643|     57|{
  644|     57|    const char *application, *str, *default_domain, *default_target, *source;
  645|     57|    int local;
  646|     57|    netsnmp_tdomain    *match = NULL;
  647|     57|    const char         *addr = NULL;
  648|     57|    const char * const *spec = NULL;
  649|     57|    int                 any_found = 0;
  650|     57|    char buf[SNMP_MAXPATH];
  651|     57|    const char **lspec = NULL;
  652|     57|    char *tokenized_domain = NULL;
  653|       |
  654|     57|    application = tspec->application;
  655|     57|    str = tspec->target;
  656|     57|    local = tspec->flags & NETSNMP_TSPEC_LOCAL;
  ------------------
  |  |  117|     57|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  657|     57|    default_domain = tspec->default_domain;
  658|     57|    default_target = tspec->default_target;
  659|     57|    source = tspec->source;
  660|       |    /** transport_config = tspec->transport_config; not used yet */
  661|       |
  662|     57|    DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#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: 57]
  |  |  ------------------
  ------------------
  663|     57|                "tdomain_transport_spec(\"%s\", \"%s\", %d, \"%s\", \"%s\", \"%s\")\n",
  664|     57|                application, str ? str : "[NIL]", local,
  665|     57|                default_domain ? default_domain : "[NIL]",
  666|     57|                default_target ? default_target : "[NIL]",
  667|     57|                source ? source : "[NIL]"));
  668|       |
  669|       |    /* see if we can load a host-name specific set of conf files */
  670|     57|    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (670:9): [True: 57, False: 0]
  ------------------
  671|     57|                                NETSNMP_DS_LIB_DONT_LOAD_HOST_FILES) &&
  ------------------
  |  |  100|     57|#define NETSNMP_DS_LIB_DONT_LOAD_HOST_FILES 40 /* don't read host.conf files */
  ------------------
  672|     57|        netsnmp_is_fqdn(str)) {
  ------------------
  |  Branch (672:9): [True: 0, False: 57]
  ------------------
  673|      0|        static int have_added_handler = 0;
  674|      0|        char *newhost;
  675|      0|        struct config_line *config_handlers;
  676|      0|        struct config_files file_names;
  677|      0|        char *prev_hostname;
  678|       |
  679|       |        /* register a "transport" specifier */
  680|      0|        if (!have_added_handler) {
  ------------------
  |  Branch (680:13): [True: 0, False: 0]
  ------------------
  681|      0|            have_added_handler = 1;
  682|      0|            netsnmp_ds_register_config(ASN_OCTET_STR,
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
  683|      0|                                       "snmp", "transport",
  684|      0|                                       NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  685|      0|                                       NETSNMP_DS_LIB_HOSTNAME);
  ------------------
  |  |  178|      0|#define NETSNMP_DS_LIB_HOSTNAME          27
  ------------------
  686|      0|        }
  687|       |
  688|       |        /* we save on specific setting that we don't allow to change
  689|       |           from one transport creation to the next; ie, we don't want
  690|       |           the "transport" specifier to be a default.  It should be a
  691|       |           single invocation use only */
  692|      0|        prev_hostname = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  693|      0|                                              NETSNMP_DS_LIB_HOSTNAME);
  ------------------
  |  |  178|      0|#define NETSNMP_DS_LIB_HOSTNAME          27
  ------------------
  694|      0|        if (prev_hostname)
  ------------------
  |  Branch (694:13): [True: 0, False: 0]
  ------------------
  695|      0|            prev_hostname = strdup(prev_hostname);
  696|       |
  697|       |        /* read in the hosts/STRING.conf files */
  698|      0|        config_handlers = read_config_get_handlers("snmp");
  699|      0|        snprintf(buf, sizeof(buf)-1, "hosts/%s", str);
  700|      0|        file_names.fileHeader = buf;
  701|      0|        file_names.start = config_handlers;
  702|      0|        file_names.next = NULL;
  703|      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]
  |  |  ------------------
  ------------------
  704|      0|                    buf));
  705|      0|        read_config_files_of_type(EITHER_CONFIG, &file_names);
  ------------------
  |  |   16|      0|#define EITHER_CONFIG 2
  ------------------
  706|       |
  707|      0|        if (NULL !=
  ------------------
  |  Branch (707:13): [True: 0, False: 0]
  ------------------
  708|      0|            (newhost = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  709|      0|                                             NETSNMP_DS_LIB_HOSTNAME))) {
  ------------------
  |  |  178|      0|#define NETSNMP_DS_LIB_HOSTNAME          27
  ------------------
  710|      0|            strlcpy(buf, newhost, sizeof(buf));
  711|      0|            str = buf;
  712|      0|        }
  713|       |
  714|      0|        netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  715|      0|                              NETSNMP_DS_LIB_HOSTNAME,
  ------------------
  |  |  178|      0|#define NETSNMP_DS_LIB_HOSTNAME          27
  ------------------
  716|      0|                              prev_hostname);
  717|      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]
  |  |  ------------------
  ------------------
  718|      0|    }
  719|       |
  720|       |    /* First try - assume that there is a domain in str (domain:target) */
  721|       |
  722|     57|    if (str != NULL) {
  ------------------
  |  Branch (722:9): [True: 57, False: 0]
  ------------------
  723|     57|        const char *cp;
  724|     57|        if ((cp = strchr(str, ':')) != NULL) {
  ------------------
  |  Branch (724:13): [True: 57, False: 0]
  ------------------
  725|     57|            char* mystring = (char*)malloc(cp + 1 - str);
  726|     57|            if (mystring == NULL)
  ------------------
  |  Branch (726:17): [True: 0, False: 57]
  ------------------
  727|      0|                return NULL;
  728|     57|            memcpy(mystring, str, cp - str);
  729|     57|            mystring[cp - str] = '\0';
  730|     57|            addr = cp + 1;
  731|       |
  732|     57|            match = find_tdomain(mystring);
  733|     57|            free(mystring);
  734|     57|        }
  735|     57|    }
  736|       |
  737|       |    /*
  738|       |     * Second try, if there is no domain in str (target), then try the
  739|       |     * default domain
  740|       |     */
  741|       |
  742|     57|    if (match == NULL) {
  ------------------
  |  Branch (742:9): [True: 57, False: 0]
  ------------------
  743|     57|        addr = str;
  744|     57|        if (addr && *addr == '/') {
  ------------------
  |  Branch (744:13): [True: 57, False: 0]
  |  Branch (744:21): [True: 0, False: 57]
  ------------------
  745|      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]
  |  |  ------------------
  ------------------
  746|      0|                        "Address starts with '/', so assume \"unix\" "
  747|      0|                        "domain\n"));
  748|      0|            match = find_tdomain("unix");
  749|     57|        } else if (default_domain) {
  ------------------
  |  Branch (749:20): [True: 0, False: 57]
  ------------------
  750|      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]
  |  |  ------------------
  ------------------
  751|      0|                        "Use user specified default domain \"%s\"\n",
  752|      0|                        default_domain));
  753|      0|            if (!strchr(default_domain, ','))
  ------------------
  |  Branch (753:17): [True: 0, False: 0]
  ------------------
  754|      0|                match = find_tdomain(default_domain);
  755|      0|            else {
  756|      0|                int commas = 0;
  757|      0|                const char *cp = default_domain;
  758|      0|                char *ptr = NULL;
  759|      0|                tokenized_domain = strdup(default_domain);
  760|      0|                if (!tokenized_domain)
  ------------------
  |  Branch (760:21): [True: 0, False: 0]
  ------------------
  761|      0|                    return NULL;
  762|       |
  763|      0|                while (*++cp) if (*cp == ',') commas++;
  ------------------
  |  Branch (763:24): [True: 0, False: 0]
  |  Branch (763:35): [True: 0, False: 0]
  ------------------
  764|      0|                lspec = calloc(commas+2, sizeof(char *));
  765|      0|                if (!lspec) {
  ------------------
  |  Branch (765:21): [True: 0, False: 0]
  ------------------
  766|      0|                    free(tokenized_domain);
  767|      0|                    return NULL;
  768|      0|                }
  769|      0|                commas = 1;
  770|      0|                lspec[0] = strtok_r(tokenized_domain, ",", &ptr);
  771|      0|                while ((lspec[commas++] = strtok_r(NULL, ",", &ptr)))
  ------------------
  |  Branch (771:24): [True: 0, False: 0]
  ------------------
  772|      0|                    ;
  773|      0|                spec = lspec;
  774|      0|            }
  775|     57|        } else {
  776|     57|            spec = netsnmp_lookup_default_domains(application);
  777|     57|            if (spec == NULL) {
  ------------------
  |  Branch (777:17): [True: 57, False: 0]
  ------------------
  778|     57|                DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
  779|     57|                            "No default domain found, assume \"udp\"\n"));
  780|     57|                match = find_tdomain("udp");
  781|     57|            } else {
  782|      0|                const char * const * r = spec;
  783|      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]
  |  |  ------------------
  ------------------
  784|      0|                            "Use application default domains"));
  785|      0|                while(*r) {
  ------------------
  |  Branch (785:23): [True: 0, False: 0]
  ------------------
  786|      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]
  |  |  ------------------
  ------------------
  787|      0|                    ++r;
  788|      0|                }
  789|      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]
  |  |  ------------------
  ------------------
  790|      0|            }
  791|     57|        }
  792|     57|    }
  793|       |
  794|     57|    for(;;) {
  795|     57|        if (match) {
  ------------------
  |  Branch (795:13): [True: 57, False: 0]
  ------------------
  796|     57|            netsnmp_transport *t = NULL;
  797|     57|            const char* addr2;
  798|       |
  799|     57|            any_found = 1;
  800|       |            /*
  801|       |             * Ok, we know what domain to try, lets see what default data
  802|       |             * should be used with it
  803|       |             */
  804|     57|            if (default_target != NULL)
  ------------------
  |  Branch (804:17): [True: 0, False: 57]
  ------------------
  805|      0|                addr2 = default_target;
  806|     57|            else
  807|     57|                addr2 = netsnmp_lookup_default_target(application,
  808|     57|                                                      match->prefix[0]);
  809|     57|            DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#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: 57]
  |  |  ------------------
  ------------------
  810|     57|                        "trying domain \"%s\" address \"%s\" "
  811|     57|                        "default address \"%s\"\n",
  812|     57|                        match->prefix[0], addr ? addr : "[NIL]",
  813|     57|                        addr2 ? addr2 : "[NIL]"));
  814|     57|            if (match->f_create_from_tspec) {
  ------------------
  |  Branch (814:17): [True: 57, False: 0]
  ------------------
  815|     57|                netsnmp_tdomain_spec tspec_tmp;
  816|     57|                memcpy(&tspec_tmp, tspec, sizeof(tspec_tmp));
  817|       |                /** if we didn't have a default target but looked one up,
  818|       |                 *  copy the spec and use the found default. */
  819|     57|                if ((default_target == NULL) && (addr2 != NULL))
  ------------------
  |  Branch (819:21): [True: 57, False: 0]
  |  Branch (819:49): [True: 0, False: 57]
  ------------------
  820|      0|                    tspec_tmp.default_target = addr2;
  821|     57|                if (addr != tspec_tmp.target)
  ------------------
  |  Branch (821:21): [True: 0, False: 57]
  ------------------
  822|      0|                    tspec_tmp.target = addr;
  823|     57|                t = match->f_create_from_tspec(&tspec_tmp);
  824|     57|            }
  825|      0|            else {
  826|       |#if 0 /** remove warning until all transports implement tspec */
  827|       |                NETSNMP_LOGONCE((LOG_WARNING,
  828|       |                                 "transport domain %s uses deprecated f_create function\n",
  829|       |                                 match->prefix[0]));
  830|       |#endif
  831|      0|                if (match->f_create_from_tstring) {
  ------------------
  |  Branch (831:21): [True: 0, False: 0]
  ------------------
  832|      0|                    t = match->f_create_from_tstring(addr, local);
  833|      0|                }
  834|      0|                else
  835|      0|                    t = match->f_create_from_tstring_new(addr, local, addr2);
  836|      0|            }
  837|     57|            if (t) {
  ------------------
  |  Branch (837:17): [True: 57, False: 0]
  ------------------
  838|     57|                if (lspec) {
  ------------------
  |  Branch (838:21): [True: 0, False: 57]
  ------------------
  839|      0|                    free(tokenized_domain);
  840|      0|                    free(lspec);
  841|      0|                }
  842|     57|                return t;
  843|     57|            }
  844|     57|        }
  845|      0|        addr = str;
  846|      0|        if (spec && *spec)
  ------------------
  |  Branch (846:13): [True: 0, False: 0]
  |  Branch (846:21): [True: 0, False: 0]
  ------------------
  847|      0|            match = find_tdomain(*spec++);
  848|      0|        else
  849|      0|            break;
  850|      0|    }
  851|      0|    if (!any_found)
  ------------------
  |  Branch (851:9): [True: 0, False: 0]
  ------------------
  852|      0|        snmp_log(LOG_ERR, "No support for any checked transport domain\n");
  853|      0|    if (lspec) {
  ------------------
  |  Branch (853:9): [True: 0, False: 0]
  ------------------
  854|      0|        free(tokenized_domain);
  855|      0|        free(lspec);
  856|      0|    }
  857|       |    return NULL;
  858|     57|}
netsnmp_tdomain_transport_full:
  865|     57|{
  866|     57|    netsnmp_tdomain_spec tspec;
  867|     57|    memset(&tspec, 0x0, sizeof(tspec));
  868|     57|    tspec.application = application;
  869|     57|    tspec.target = str;
  870|     57|    if (local)
  ------------------
  |  Branch (870:9): [True: 57, False: 0]
  ------------------
  871|     57|        tspec.flags |= NETSNMP_TSPEC_LOCAL;
  ------------------
  |  |  117|     57|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  872|     57|    tspec.default_domain = default_domain;
  873|     57|    tspec.default_target = default_target;
  874|     57|    tspec.source = NULL;
  875|       |    tspec.transport_config = NULL;
  876|     57|    return netsnmp_tdomain_transport_tspec(&tspec);
  877|     57|}
netsnmp_transport_open_server:
  936|     57|{
  937|     57|    return netsnmp_tdomain_transport_full(application, str, 1, NULL, NULL);
  938|     57|}
_tc_find_transport:
 1240|     57|{
 1241|       |    /*
 1242|       |     * we shouldn't really have that many transports, so instead of
 1243|       |     * using an additional key, just iterate over the whole container.
 1244|       |     */
 1245|     57|    netsnmp_iterator  *itr;
 1246|     57|    trans_cache *tc;
 1247|       |
 1248|     57|    DEBUGMSGTL(("transport:cache:find_transport", "%p\n", t));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 1249|       |
 1250|     57|    if (NULL == _container)
  ------------------
  |  Branch (1250:9): [True: 57, False: 0]
  ------------------
 1251|     57|        return NULL;
 1252|       |
 1253|      0|    itr = CONTAINER_ITERATOR(_container);
  ------------------
  |  |  404|      0|#define CONTAINER_ITERATOR(x)       (x)->get_iterator(x)
  ------------------
 1254|      0|    if (NULL == itr) {
  ------------------
  |  Branch (1254:9): [True: 0, False: 0]
  ------------------
 1255|      0|        snmp_log(LOG_ERR, "could not get iterator for transport cache\n");
 1256|      0|        return NULL;
 1257|      0|    }
 1258|       |
 1259|      0|    tc = ITERATOR_FIRST(itr);
  ------------------
  |  |  546|      0|#define ITERATOR_FIRST(x)  x->first(x)
  ------------------
 1260|      0|    for( ; tc; tc = ITERATOR_NEXT(itr))
  ------------------
  |  |  547|      0|#define ITERATOR_NEXT(x)   x->next(x)
  ------------------
  |  Branch (1260:12): [True: 0, False: 0]
  ------------------
 1261|      0|        if (tc->t == t)
  ------------------
  |  Branch (1261:13): [True: 0, False: 0]
  ------------------
 1262|      0|            break;
 1263|      0|    ITERATOR_RELEASE(itr);
  ------------------
  |  |  550|      0|#define ITERATOR_RELEASE(x) do { x->release(x); x = NULL; } while(0)
  |  |  ------------------
  |  |  |  Branch (550:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1264|       |
 1265|      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]
  |  |  ------------------
  ------------------
 1266|       |
 1267|      0|    return tc;
 1268|      0|}
netsnmp_transport_cache_remove:
 1272|     57|{
 1273|     57|    trans_cache *tc;
 1274|       |
 1275|     57|    DEBUGMSGTL(("transport:cache:close", "%p\n", t));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 1276|       |
 1277|     57|    if (NULL == t)
  ------------------
  |  Branch (1277:9): [True: 0, False: 57]
  ------------------
 1278|      0|        return 0;
 1279|       |
 1280|       |    /** transport in cache? */
 1281|     57|    tc = _tc_find_transport(t);
 1282|     57|    if (NULL == tc) {
  ------------------
  |  Branch (1282:9): [True: 57, False: 0]
  ------------------
 1283|     57|        DEBUGMSGTL(("transport:cache:close", "%p not found in cache\n", t));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 1284|     57|        return 0;
 1285|     57|    }
 1286|       |
 1287|      0|    --tc->count;
 1288|       |
 1289|       |    /** still in use? */
 1290|      0|    if (tc->count > 0) {
  ------------------
  |  Branch (1290:9): [True: 0, False: 0]
  ------------------
 1291|      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]
  |  |  ------------------
  ------------------
 1292|      0|                    tc->count, t));
 1293|      0|        return 1;
 1294|      0|    }
 1295|       |
 1296|       |    /** unbalanced get/close? */
 1297|      0|    if (tc->count < 0)
  ------------------
  |  Branch (1297:9): [True: 0, False: 0]
  ------------------
 1298|      0|        snmp_log(LOG_WARNING, "transport cache get/close mismatch\n");
 1299|       |
 1300|      0|    _tc_remove(tc);
 1301|      0|    _tc_free(tc); /* also does close */
 1302|       |
 1303|      0|    return 0;
 1304|      0|}
snmp_transport.c:netsnmp_tdomain_dump:
  532|     57|{
  533|     57|    netsnmp_tdomain *d;
  534|     57|    int i = 0;
  535|       |
  536|     57|    DEBUGMSGTL(("tdomain", "domain_list -> "));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
  537|    685|    for (d = domain_list; d != NULL; d = d->next) {
  ------------------
  |  Branch (537:27): [True: 628, False: 57]
  ------------------
  538|    628|        DEBUGMSG(("tdomain", "{ "));
  ------------------
  |  |   61|    628|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    628|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 628]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 628]
  |  |  ------------------
  ------------------
  539|    628|        DEBUGMSGOID(("tdomain", d->name, d->name_length));
  ------------------
  |  |   67|    628|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    628|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 628]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 628]
  |  |  ------------------
  ------------------
  540|    628|        DEBUGMSG(("tdomain", ", \""));
  ------------------
  |  |   61|    628|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    628|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 628]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 628]
  |  |  ------------------
  ------------------
  541|  1.82k|        for (i = 0; d->prefix[i] != NULL; i++) {
  ------------------
  |  Branch (541:21): [True: 1.19k, False: 628]
  ------------------
  542|  1.19k|            DEBUGMSG(("tdomain", "%s%s", d->prefix[i],
  ------------------
  |  |   61|  1.19k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.19k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.19k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:56): [True: 0, False: 0]
  |  |  |  Branch (61:67): [Folded, False: 1.19k]
  |  |  ------------------
  ------------------
  543|  1.19k|		      (d->prefix[i + 1]) ? "/" : ""));
  544|  1.19k|        }
  545|    628|        DEBUGMSG(("tdomain", "\" } -> "));
  ------------------
  |  |   61|    628|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    628|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 628]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 628]
  |  |  ------------------
  ------------------
  546|    628|    }
  547|     57|    DEBUGMSG(("tdomain", "[NIL]\n"));
  ------------------
  |  |   61|     57|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 57]
  |  |  ------------------
  ------------------
  548|     57|}
snmp_transport.c:netsnmp_is_fqdn:
  623|     57|{
  624|     57|    if (!thename)
  ------------------
  |  Branch (624:9): [True: 0, False: 57]
  ------------------
  625|      0|        return 0;
  626|    570|    while(*thename) {
  ------------------
  |  Branch (626:11): [True: 570, False: 0]
  ------------------
  627|    570|        if (*thename != '.' && !isupper((unsigned char)*thename) &&
  ------------------
  |  Branch (627:13): [True: 399, False: 171]
  |  Branch (627:32): [True: 399, False: 0]
  ------------------
  628|    399|            !islower((unsigned char)*thename) &&
  ------------------
  |  Branch (628:13): [True: 399, False: 0]
  ------------------
  629|    399|            !isdigit((unsigned char)*thename) && *thename != '-') {
  ------------------
  |  Branch (629:13): [True: 57, False: 342]
  |  Branch (629:50): [True: 57, False: 0]
  ------------------
  630|     57|            return 0;
  631|     57|        }
  632|    513|        thename++;
  633|    513|    }
  634|      0|    return 1;
  635|     57|}
snmp_transport.c:find_tdomain:
  605|    114|{
  606|    114|    netsnmp_tdomain *d;
  607|  1.14k|    for (d = domain_list; d != NULL; d = d->next) {
  ------------------
  |  Branch (607:27): [True: 1.08k, False: 57]
  ------------------
  608|  1.08k|        int i;
  609|  3.25k|        for (i = 0; d->prefix[i] != NULL; i++)
  ------------------
  |  Branch (609:21): [True: 2.22k, False: 1.02k]
  ------------------
  610|  2.22k|            if (strcasecmp(d->prefix[i], spec) == 0) {
  ------------------
  |  Branch (610:17): [True: 57, False: 2.16k]
  ------------------
  611|     57|                DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
  612|     57|                            "Found domain \"%s\" from specifier \"%s\"\n",
  613|     57|                            d->prefix[0], spec));
  614|     57|                return d;
  615|     57|            }
  616|  1.08k|    }
  617|     57|    DEBUGMSGTL(("tdomain", "Found no domain from specifier \"%s\"\n", spec));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
  618|       |    return NULL;
  619|    114|}

init_ksm:
  218|     57|{
  219|     57|    krb5_error_code retval;
  220|     57|    struct snmp_secmod_def *def;
  221|     57|    int             i;
  222|       |
  223|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defKSMKeytab",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
  224|     57|                               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_KSM_KEYTAB);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                             NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_KSM_KEYTAB);
  ------------------
  |  |  172|     57|#define NETSNMP_DS_LIB_KSM_KEYTAB        21
  ------------------
  225|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defKSMServiceName",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
  226|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  227|     57|			       NETSNMP_DS_LIB_KSM_SERVICE_NAME);
  ------------------
  |  |  173|     57|#define NETSNMP_DS_LIB_KSM_SERVICE_NAME  22
  ------------------
  228|     57|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
  229|     57|			   SNMP_CALLBACK_POST_READ_CONFIG,
  ------------------
  |  |   24|     57|#define SNMP_CALLBACK_POST_READ_CONFIG	        0
  ------------------
  230|     57|			   init_snmpksm_post_config, NULL);
  231|       |
  232|       |
  233|     57|    if (kcontext == NULL) {
  ------------------
  |  Branch (233:9): [True: 57, False: 0]
  ------------------
  234|     57|        retval = krb5_init_context(&kcontext);
  235|       |
  236|     57|        if (retval) {
  ------------------
  |  Branch (236:13): [True: 0, False: 57]
  ------------------
  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|     57|    }
  242|       |
  243|  3.70k|    for (i = 0; i < HASHSIZE; i++)
  ------------------
  |  |  129|  3.70k|#define HASHSIZE	64
  ------------------
  |  Branch (243:17): [True: 3.64k, False: 57]
  ------------------
  244|  3.64k|        ksm_hash_table[i] = NULL;
  245|       |
  246|     57|    def = SNMP_MALLOC_STRUCT(snmp_secmod_def);
  ------------------
  |  |   69|     57|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  247|       |
  248|     57|    if (!def) {
  ------------------
  |  Branch (248:9): [True: 0, False: 57]
  ------------------
  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|     57|    def->encode_reverse = ksm_rgenerate_out_msg;
  255|     57|    def->decode = ksm_process_in_msg;
  256|     57|    def->session_open = ksm_session_init;
  257|     57|    def->pdu_free_state_ref = ksm_free_state_ref;
  258|     57|    def->pdu_free = ksm_free_pdu;
  259|     57|    def->pdu_clone = ksm_clone_pdu;
  260|       |
  261|     57|    register_sec_mod(NETSNMP_SEC_MODEL_KSM, "ksm", def);
  ------------------
  |  |   13|     57|#define NETSNMP_SEC_MODEL_KSM     2066432
  ------------------
  262|     57|}
shutdown_ksm:
  265|     57|{
  266|     57|    unregister_sec_mod(NETSNMP_SEC_MODEL_KSM);
  ------------------
  |  |   13|     57|#define NETSNMP_SEC_MODEL_KSM     2066432
  ------------------
  267|     57|    if (kcontext)
  ------------------
  |  Branch (267:9): [True: 57, False: 0]
  ------------------
  268|     57|        krb5_free_context(kcontext);
  269|       |    kcontext = NULL;
  270|     57|}
snmpksm.c:init_snmpksm_post_config:
  169|     57|{
  170|       |
  171|     57|    if (kcontext == NULL) {
  ------------------
  |  Branch (171:9): [True: 0, False: 57]
  ------------------
  172|       |	/* not reached, I'd imagine */
  173|      0|        return SNMPERR_KRB5;
  ------------------
  |  |  247|      0|#define SNMPERR_KRB5			(-63)
  ------------------
  174|      0|    }
  175|       |
  176|     57|    if (service_name == NULL) {
  ------------------
  |  Branch (176:9): [True: 1, False: 56]
  ------------------
  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|     57|    if (keytab_setup == 0) {
  ------------------
  |  Branch (188:9): [True: 1, False: 56]
  ------------------
  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;
  ------------------
  |  |  247|      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|     57|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  209|     57|}

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

usm_get_user2:
  517|     13|{
  518|     13|    DEBUGMSGTL(("usm", "getting user %.*s\n", (int)nameLen,
  ------------------
  |  |   66|     13|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 13]
  |  |  ------------------
  ------------------
  519|     13|                (const char *)name));
  520|     13|    return usm_get_user_from_list(engineID, engineIDLen, name, nameLen,
  521|     13|                                  userList, 1);
  522|     13|}
usm_free_user:
  749|    171|{
  750|    171|    if (user == NULL)
  ------------------
  |  Branch (750:9): [True: 114, False: 57]
  ------------------
  751|    114|        return NULL;
  752|       |
  753|     57|    SNMP_FREE(user->engineID);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 57]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  754|     57|    SNMP_FREE(user->name);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  755|     57|    SNMP_FREE(user->secName);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  756|     57|    SNMP_FREE(user->cloneFrom);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  757|     57|    SNMP_FREE(user->userPublicString);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 57]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  758|     57|    SNMP_FREE(user->authProtocol);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  759|     57|    SNMP_FREE(user->privProtocol);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  760|       |
  761|     57|    if (user->authKey != NULL) {
  ------------------
  |  Branch (761:9): [True: 0, False: 57]
  ------------------
  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|     57|    if (user->privKey != NULL) {
  ------------------
  |  Branch (766:9): [True: 0, False: 57]
  ------------------
  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|     57|    if (user->authKeyKu != NULL) {
  ------------------
  |  Branch (771:9): [True: 0, False: 57]
  ------------------
  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|     57|    if (user->privKeyKu != NULL) {
  ------------------
  |  Branch (776:9): [True: 0, False: 57]
  ------------------
  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|     57|#ifdef NETSNMP_USE_OPENSSL
  782|     57|    if (user->usmDHUserAuthKeyChange)
  ------------------
  |  Branch (782:9): [True: 0, False: 57]
  ------------------
  783|      0|    {
  784|      0|        DH_free(user->usmDHUserAuthKeyChange);
  785|      0|        user->usmDHUserAuthKeyChange = NULL;
  786|      0|    }
  787|       |
  788|     57|    if (user->usmDHUserPrivKeyChange)
  ------------------
  |  Branch (788:9): [True: 0, False: 57]
  ------------------
  789|      0|    {
  790|      0|        DH_free(user->usmDHUserPrivKeyChange);
  791|      0|        user->usmDHUserPrivKeyChange = NULL;
  792|      0|    }
  793|     57|#endif
  794|       |
  795|       |    /*
  796|       |     * FIX  Why not put this check *first?*
  797|       |     */
  798|     57|    if (user->prev != NULL && user->prev != (struct usmUser *)-1) {   /* ack, this shouldn't happen */
  ------------------
  |  Branch (798:9): [True: 0, False: 57]
  |  Branch (798:31): [True: 0, False: 0]
  ------------------
  799|      0|        user->prev->next = user->next;
  800|      0|    }
  801|     57|    if (user->next != NULL && user->next != (struct usmUser *)-1) {
  ------------------
  |  Branch (801:9): [True: 0, False: 57]
  |  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|     57|    SNMP_ZERO(user, sizeof(*user));
  ------------------
  |  |   77|     57|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 57, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 57]
  |  |  ------------------
  ------------------
  811|     57|    SNMP_FREE(user);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  812|       |
  813|     57|    return NULL;                /* for convenience to returns from calling functions */
  814|       |
  815|    171|}                               /* end usm_free_user() */
usm_create_user:
 4154|     57|{
 4155|     57|    struct usmUser *newUser;
 4156|       |
 4157|       |    /*
 4158|       |     * create the new user 
 4159|       |     */
 4160|     57|    newUser = calloc(1, sizeof(struct usmUser));
 4161|     57|    if (newUser == NULL)
  ------------------
  |  Branch (4161:9): [True: 0, False: 57]
  ------------------
 4162|      0|        return NULL;
 4163|       |
 4164|       |    /*
 4165|       |     * fill the auth/priv protocols 
 4166|       |     */
 4167|     57|    if ((newUser->authProtocol =
  ------------------
  |  Branch (4167:9): [True: 0, False: 57]
  ------------------
 4168|     57|         snmp_duplicate_objid(usmNoAuthProtocol,
 4169|     57|                              OID_LENGTH(usmNoAuthProtocol))) ==
  ------------------
  |  |   64|     57|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     57|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 4170|     57|        NULL)
 4171|      0|        return usm_free_user(newUser);
 4172|     57|    newUser->authProtocolLen = OID_LENGTH(usmNoAuthProtocol);
  ------------------
  |  |   64|     57|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     57|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 4173|       |
 4174|     57|    if ((newUser->privProtocol =
  ------------------
  |  Branch (4174:9): [True: 0, False: 57]
  ------------------
 4175|     57|         snmp_duplicate_objid(usmNoPrivProtocol,
 4176|     57|                              OID_LENGTH(usmNoPrivProtocol))) ==
  ------------------
  |  |   64|     57|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     57|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 4177|     57|        NULL)
 4178|      0|        return usm_free_user(newUser);
 4179|     57|    newUser->privProtocolLen = OID_LENGTH(usmNoPrivProtocol);
  ------------------
  |  |   64|     57|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     57|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 4180|       |
 4181|       |    /*
 4182|       |     * set the storage type to nonvolatile, and the status to ACTIVE 
 4183|       |     */
 4184|     57|    newUser->userStorageType = ST_NONVOLATILE;
  ------------------
  |  |   52|     57|#define ST_NONVOLATILE	3
  ------------------
 4185|     57|    newUser->userStatus = RS_ACTIVE;
  ------------------
  |  |   35|     57|#define RS_ACTIVE	        1
  ------------------
 4186|     57|    return newUser;
 4187|       |
 4188|     57|}                               /* end usm_clone_user() */
get_default_authtype:
 5133|    114|{
 5134|    114|    if (defaultAuthType == NULL) {
  ------------------
  |  Branch (5134:9): [True: 1, False: 113]
  ------------------
 5135|      1|        defaultAuthType = SNMP_DEFAULT_AUTH_PROTO;
  ------------------
  |  |   94|      1|#define SNMP_DEFAULT_AUTH_PROTO     usmHMACMD5AuthProtocol
  ------------------
 5136|      1|        defaultAuthTypeLen = SNMP_DEFAULT_AUTH_PROTOLEN;
  ------------------
  |  |   98|      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]))]))
  |  |  ------------------
  ------------------
 5137|      1|    }
 5138|    114|    if (len)
  ------------------
  |  Branch (5138:9): [True: 57, False: 57]
  ------------------
 5139|     57|        *len = defaultAuthTypeLen;
 5140|    114|    return defaultAuthType;
 5141|    114|}
get_default_privtype:
 5155|    114|{
 5156|    114|    if (defaultPrivType == NULL) {
  ------------------
  |  Branch (5156:9): [True: 1, False: 113]
  ------------------
 5157|      1|        defaultPrivType = SNMP_DEFAULT_PRIV_PROTO;
  ------------------
  |  |  100|      1|#define SNMP_DEFAULT_PRIV_PROTO     usmDESPrivProtocol
  ------------------
 5158|      1|        defaultPrivTypeLen = SNMP_DEFAULT_PRIV_PROTOLEN;
  ------------------
  |  |  104|      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]))]))
  |  |  ------------------
  ------------------
 5159|      1|    }
 5160|    114|    if (len)
  ------------------
  |  Branch (5160:9): [True: 57, False: 57]
  ------------------
 5161|     57|        *len = defaultPrivTypeLen;
 5162|    114|    return defaultPrivType;
 5163|    114|}
init_usm:
 5255|     57|{
 5256|     57|    struct snmp_secmod_def *def;
 5257|     57|    char *type;
 5258|       |
 5259|     57|    DEBUGMSGTL(("init_usm", "unit_usm: %" NETSNMP_PRIo "u %" NETSNMP_PRIo "u\n",
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 5260|     57|                usmNoPrivProtocol[0], usmNoPrivProtocol[1]));
 5261|       |
 5262|     57|    sc_init();                  /* initialize scapi code */
 5263|       |
 5264|       |    /*
 5265|       |     * register ourselves as a security service
 5266|       |     */
 5267|     57|    def = SNMP_MALLOC_STRUCT(snmp_secmod_def);
  ------------------
  |  |   69|     57|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
 5268|     57|    if (def == NULL)
  ------------------
  |  Branch (5268:9): [True: 0, False: 57]
  ------------------
 5269|      0|        return;
 5270|       |    /*
 5271|       |     * XXX: def->init_sess_secmod move stuff from snmp_api.c
 5272|       |     */
 5273|     57|    def->encode_reverse = usm_secmod_rgenerate_out_msg;
 5274|     57|    def->encode_forward = usm_secmod_generate_out_msg;
 5275|     57|    def->decode = usm_secmod_process_in_msg;
 5276|     57|    def->pdu_clone = usm_clone;
 5277|     57|    def->pdu_free_state_ref = usm_free_usmStateReference;
 5278|     57|    def->session_setup = usm_session_init;
 5279|     57|    def->handle_report = usm_handle_report;
 5280|     57|    def->probe_engineid = usm_discover_engineid;
 5281|     57|    def->post_probe_engineid = usm_create_user_from_session_hook;
 5282|     57|    if (register_sec_mod(USM_SEC_MODEL_NUMBER, "usm", def) != SNMPERR_SUCCESS) {
  ------------------
  |  |   40|     57|#define USM_SEC_MODEL_NUMBER            SNMP_SEC_MODEL_USM
  |  |  ------------------
  |  |  |  |  295|     57|#define SNMP_SEC_MODEL_USM		3
  |  |  ------------------
  ------------------
                  if (register_sec_mod(USM_SEC_MODEL_NUMBER, "usm", def) != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (5282:9): [True: 0, False: 57]
  ------------------
 5283|      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]
  |  |  ------------------
  ------------------
 5284|      0|        snmp_log(LOG_ERR, "could not register usm sec mod\n");
 5285|      0|        return;
 5286|      0|    }
 5287|       |
 5288|     57|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 5289|     57|                           SNMP_CALLBACK_POST_PREMIB_READ_CONFIG,
  ------------------
  |  |   27|     57|#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG	3
  ------------------
 5290|     57|                           init_usm_post_config, NULL);
 5291|       |
 5292|     57|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 5293|     57|                           SNMP_CALLBACK_SHUTDOWN,
  ------------------
  |  |   26|     57|#define SNMP_CALLBACK_SHUTDOWN		        2
  ------------------
 5294|     57|                           deinit_usm_post_config, NULL);
 5295|       |
 5296|     57|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 5297|     57|                           SNMP_CALLBACK_SHUTDOWN,
  ------------------
  |  |   26|     57|#define SNMP_CALLBACK_SHUTDOWN		        2
  ------------------
 5298|     57|                           free_engineID, NULL);
 5299|       |
 5300|     57|    register_config_handler("snmp", "defAuthType", snmpv3_authtype_conf,
 5301|     57|                            NULL, "MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224");
 5302|     57|    register_config_handler("snmp", "defPrivType", snmpv3_privtype_conf,
 5303|     57|                            NULL,
 5304|     57|                            "DES"
 5305|     57|#ifdef HAVE_AES
 5306|     57|                            "|AES|AES-128"
 5307|     57|#ifdef NETSNMP_DRAFT_BLUMENTHAL_AES_04
 5308|     57|                            "|AES-192|AES-256"
 5309|     57|#endif /* NETSNMP_DRAFT_BLUMENTHAL_AES_04 */
 5310|       |#else
 5311|       |                            " (AES support not available)"
 5312|       |#endif
 5313|     57|                           );
 5314|       |
 5315|       |    /*
 5316|       |     * Free stuff at shutdown time
 5317|       |     */
 5318|     57|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 5319|     57|                           SNMP_CALLBACK_SHUTDOWN,
  ------------------
  |  |   26|     57|#define SNMP_CALLBACK_SHUTDOWN		        2
  ------------------
 5320|     57|                           free_enginetime_on_shutdown, NULL);
 5321|       |
 5322|       |
 5323|     57|    type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE);
  ------------------
  |  |  157|     57|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
 5324|       |
 5325|     57|    register_config_handler(type, "userSetAuthPass", usm_set_password,
 5326|     57|                            NULL, NULL);
 5327|     57|    register_config_handler(type, "userSetPrivPass", usm_set_password,
 5328|     57|                            NULL, NULL);
 5329|     57|    register_config_handler(type, "userSetAuthKey", usm_set_password, NULL,
 5330|     57|                            NULL);
 5331|     57|    register_config_handler(type, "userSetPrivKey", usm_set_password, NULL,
 5332|     57|                            NULL);
 5333|     57|    register_config_handler(type, "userSetAuthLocalKey", usm_set_password,
 5334|     57|                            NULL, NULL);
 5335|     57|    register_config_handler(type, "userSetPrivLocalKey", usm_set_password,
 5336|     57|                            NULL, NULL);
 5337|     57|}
shutdown_usm:
 5341|     57|{
 5342|     57|    free_etimelist();
 5343|     57|    clear_user_list();
 5344|     57|}
snmpusm.c:usm_get_user_from_list:
  482|     13|{
  483|     13|    struct usmUser *ptr;
  484|       |
  485|     13|    for (ptr = puserList; ptr != NULL; ptr = ptr->next) {
  ------------------
  |  Branch (485:27): [True: 0, False: 13]
  ------------------
  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|     13|    if (use_default && !strcmp(name, "")) {
  ------------------
  |  Branch (507:9): [True: 13, False: 0]
  |  Branch (507:24): [True: 13, False: 0]
  ------------------
  508|     13|        DEBUGMSGTL(("usm", "return noNameUser\n"));
  ------------------
  |  |   66|     13|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 13]
  |  |  ------------------
  ------------------
  509|     13|        return noNameUser;
  510|     13|    }
  511|      0|    return NULL;
  512|     13|}
snmpusm.c:usm_secmod_rgenerate_out_msg:
 2431|     13|{
 2432|     13|    if (!parms)
  ------------------
  |  Branch (2432:9): [True: 0, False: 13]
  ------------------
 2433|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 2434|       |
 2435|     13|    return usm_rgenerate_out_msg(parms->msgProcModel,
 2436|     13|                                 parms->globalData, parms->globalDataLen,
 2437|     13|                                 parms->maxMsgSize, parms->secModel,
 2438|     13|                                 parms->secEngineID, parms->secEngineIDLen,
 2439|     13|                                 parms->secName, parms->secNameLen,
 2440|     13|                                 parms->secLevel,
 2441|     13|                                 parms->scopedPdu, parms->scopedPduLen,
 2442|     13|                                 parms->secStateRef,
 2443|     13|                                 parms->session->sessUser,
 2444|     13|                                 parms->wholeMsg, parms->wholeMsgLen,
 2445|     13|                                 parms->wholeMsgOffset);
 2446|     13|}
snmpusm.c:usm_rgenerate_out_msg:
 1977|     13|{
 1978|     13|    size_t          msgAuthParmLen = 0;
 1979|     13|    u_int           boots_uint;
 1980|     13|    u_int           time_uint;
 1981|     13|    long            boots_long;
 1982|     13|    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|     13|    const char     *theName = NULL;
 1993|     13|    u_int           theNameLength = 0;
 1994|     13|    const u_char   *theEngineID = NULL;
 1995|     13|    u_int           theEngineIDLength = 0;
 1996|     13|    u_char         *theAuthKey = NULL;
 1997|     13|    u_int           theAuthKeyLength = 0;
 1998|     13|    const oid      *theAuthProtocol = NULL;
 1999|     13|    u_int           theAuthProtocolLength = 0;
 2000|     13|    u_char         *thePrivKey = NULL;
 2001|     13|    u_int           thePrivKeyLength = 0;
 2002|     13|    const oid      *thePrivProtocol = NULL;
 2003|     13|    u_int           thePrivProtocolLength = 0;
 2004|     13|    int             theSecLevel = 0;    /* No defined const for bad
 2005|       |                                         * value (other then err). */
 2006|     13|    size_t          salt_length = 0, save_salt_length = 0;
 2007|     13|    u_char          salt[BYTESIZE(USM_MAX_SALT_LENGTH)];
 2008|     13|    u_char          authParams[USM_MAX_AUTHSIZE];
 2009|     13|    u_char          iv[BYTESIZE(USM_MAX_SALT_LENGTH)];
 2010|     13|    size_t          sp_offset = 0, mac_offset = 0;
 2011|     13|    int             rc = 0;
 2012|       |
 2013|     13|    DEBUGMSGTL(("usm", "USM processing has begun (offset %d)\n", (int)*offset));
  ------------------
  |  |   66|     13|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2014|       |
 2015|     13|    if (secStateRef != NULL) {
  ------------------
  |  Branch (2015:9): [True: 0, False: 13]
  ------------------
 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|     13|    else {
 2046|     13|        struct usmUser *user;
 2047|       |
 2048|       |        /*
 2049|       |         * we do allow an unknown user name for
 2050|       |         * unauthenticated requests. 
 2051|       |         */
 2052|     13|        if (sessUser)
  ------------------
  |  Branch (2052:13): [True: 0, False: 13]
  ------------------
 2053|      0|            user = sessUser;
 2054|     13|        else
 2055|     13|            user = usm_get_user2(secEngineID, secEngineIDLen, secName, secNameLen);
 2056|       |
 2057|     13|        if (user == NULL && secLevel != SNMP_SEC_LEVEL_NOAUTH) {
  ------------------
  |  |  299|      0|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
  |  Branch (2057:13): [True: 0, False: 13]
  |  Branch (2057:29): [True: 0, False: 0]
  ------------------
 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;
  ------------------
  |  |  227|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
 2060|      0|        }
 2061|       |
 2062|     13|        theName = secName;
 2063|     13|        theNameLength = secNameLen;
 2064|     13|        theEngineID = secEngineID;
 2065|     13|        theSecLevel = secLevel;
 2066|     13|        theEngineIDLength = secEngineIDLen;
 2067|     13|        if (user) {
  ------------------
  |  Branch (2067:13): [True: 13, False: 0]
  ------------------
 2068|     13|            theAuthProtocol = user->authProtocol;
 2069|     13|            theAuthProtocolLength = user->authProtocolLen;
 2070|     13|            theAuthKey = user->authKey;
 2071|     13|            theAuthKeyLength = user->authKeyLen;
 2072|     13|            thePrivProtocol = user->privProtocol;
 2073|     13|            thePrivProtocolLength = user->privProtocolLen;
 2074|     13|            thePrivKey = user->privKey;
 2075|     13|            thePrivKeyLength = user->privKeyLen;
 2076|     13|        } else {
 2077|       |            /*
 2078|       |             * unknown users can not do authentication (obviously) 
 2079|       |             */
 2080|      0|            theAuthProtocol = usmNoAuthProtocol;
 2081|      0|            theAuthProtocolLength =
 2082|      0|                OID_LENGTH(usmNoAuthProtocol);
  ------------------
  |  |   64|      0|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      0|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 2083|      0|            theAuthKey = NULL;
 2084|      0|            theAuthKeyLength = 0;
 2085|      0|            thePrivProtocol = usmNoPrivProtocol;
 2086|      0|            thePrivProtocolLength =
 2087|      0|                OID_LENGTH(usmNoPrivProtocol);
  ------------------
  |  |   64|      0|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      0|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 2088|      0|            thePrivKey = NULL;
 2089|      0|            thePrivKeyLength = 0;
 2090|      0|        }
 2091|     13|    }                           /* 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|     13|    if (usm_check_secLevel_vs_protocols(theSecLevel,
  ------------------
  |  Branch (2103:9): [True: 0, False: 13]
  ------------------
 2104|     13|                                        theAuthProtocol,
 2105|     13|                                        theAuthProtocolLength,
 2106|     13|                                        thePrivProtocol,
 2107|     13|                                        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;
  ------------------
  |  |  228|      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|     13|    if (get_enginetime(theEngineID, theEngineIDLength,
  ------------------
  |  Branch (2121:9): [True: 0, False: 13]
  ------------------
 2122|     13|                       &boots_uint, &time_uint, FALSE) == -1) {
  ------------------
  |  |  125|     13|#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|     13|    boots_long = boots_uint;
 2127|     13|    time_long = time_uint;
 2128|       |
 2129|     13|    if (theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|     13|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2129:9): [True: 0, False: 13]
  ------------------
 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;
  ------------------
  |  |  246|      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;
  ------------------
  |  |  226|      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 || thePrivKeyLength < 16 ||
  ------------------
  |  Branch (2169:17): [True: 0, False: 0]
  |  Branch (2169:32): [True: 0, False: 0]
  ------------------
 2170|      0|                (usm_set_salt(salt, &salt_length,
  ------------------
  |  Branch (2170:17): [True: 0, False: 0]
  ------------------
 2171|      0|                              thePrivKey + 8,
 2172|      0|                              thePrivKeyLength - 8,
 2173|      0|                              iv) == -1)) {
 2174|      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]
  |  |  ------------------
  ------------------
 2175|      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]
  |  |  ------------------
  ------------------
 2176|      0|                return SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 2177|      0|            }
 2178|      0|        }
 2179|      0|#endif
 2180|       |#ifdef NETSNMP_ENABLE_TESTING_CODE
 2181|       |        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
 2182|       |            dump_chunk("usm/dump", "This data was encrypted:",
 2183|       |                       scopedPdu, scopedPduLen);
 2184|       |        }
 2185|       |#endif
 2186|       |
 2187|      0|        if (sc_encrypt(thePrivProtocol, thePrivProtocolLength,
  ------------------
  |  Branch (2187:13): [True: 0, False: 0]
  ------------------
 2188|      0|                       thePrivKey, thePrivKeyLength,
 2189|      0|                       salt, salt_length,
 2190|      0|                       scopedPdu, scopedPduLen,
 2191|      0|                       ciphertext, &ciphertextlen) != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|      0|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
 2192|      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]
  |  |  ------------------
  ------------------
 2193|      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]
  |  |  ------------------
  ------------------
 2194|      0|            return SNMPERR_USM_ENCRYPTIONERROR;
  ------------------
  |  |  229|      0|#define SNMPERR_USM_ENCRYPTIONERROR		(-45)
  ------------------
 2195|      0|        }
 2196|       |
 2197|       |        /*
 2198|       |         * Write the encrypted scopedPdu back into the packet buffer.  
 2199|       |         */
 2200|       |
 2201|      0|        *offset = 0;
 2202|      0|        rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2203|      0|                                       (u_char) (ASN_UNIVERSAL |
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
 2204|      0|                                                 ASN_PRIMITIVE |
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2205|      0|                                                 ASN_OCTET_STR),
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 2206|      0|                                       ciphertext, ciphertextlen);
 2207|      0|        if (rc == 0) {
  ------------------
  |  Branch (2207:13): [True: 0, False: 0]
  ------------------
 2208|      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]
  |  |  ------------------
  ------------------
 2209|      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]
  |  |  ------------------
  ------------------
 2210|      0|            return SNMPERR_USM_ENCRYPTIONERROR;
  ------------------
  |  |  229|      0|#define SNMPERR_USM_ENCRYPTIONERROR		(-45)
  ------------------
 2211|      0|        }
 2212|       |
 2213|       |#ifdef NETSNMP_ENABLE_TESTING_CODE
 2214|       |        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
 2215|       |            dump_chunk("usm/dump", "salt + Encrypted form: ", salt,
 2216|       |                       salt_length);
 2217|       |            dump_chunk("usm/dump", "wholeMsg:",
 2218|       |                       (*wholeMsg + *wholeMsgLen - *offset), *offset);
 2219|       |        }
 2220|       |#endif
 2221|       |
 2222|      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]
  |  |  ------------------
  ------------------
 2223|      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]
  |  |  ------------------
  ------------------
 2224|     13|    } else {
 2225|       |        /*
 2226|       |         * theSecLevel != SNMP_SEC_LEVEL_AUTHPRIV  
 2227|       |         */
 2228|     13|    }
 2229|       |
 2230|       |    /*
 2231|       |     * Start encoding the msgSecurityParameters.  
 2232|       |     */
 2233|       |
 2234|     13|    sp_offset = *offset;
 2235|       |
 2236|     13|    DEBUGDUMPHEADER("send", "msgPrivacyParameters");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 2237|       |    /*
 2238|       |     * msgPrivacyParameters (warning: assumes DES salt).  
 2239|       |     */
 2240|     13|    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2241|     13|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2242|     13|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|     13|#define ASN_OCTET_STR	    0x04U
  ------------------
 2243|     13|                                   iv,
 2244|     13|                                   save_salt_length);
 2245|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2246|     13|    if (rc == 0) {
  ------------------
  |  Branch (2246:9): [True: 0, False: 13]
  ------------------
 2247|      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]
  |  |  ------------------
  ------------------
 2248|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  189|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2249|      0|    }
 2250|       |
 2251|     13|    DEBUGDUMPHEADER("send", "msgAuthenticationParameters");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 2252|       |    /*
 2253|       |     * msgAuthenticationParameters.
 2254|       |     */
 2255|     13|    if (theSecLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
  ------------------
  |  |  300|     26|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (2255:9): [True: 0, False: 13]
  ------------------
 2256|     13|        || theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|     13|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2256:12): [True: 0, False: 13]
  ------------------
 2257|      0|        memset(authParams, 0, sizeof(authParams));
 2258|      0|        msgAuthParmLen =
 2259|      0|            sc_get_auth_maclen(sc_get_authtype(theAuthProtocol,
 2260|      0|                                               theAuthProtocolLength));
 2261|      0|    }
 2262|       |
 2263|     13|    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2264|     13|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2265|     13|                                             | ASN_OCTET_STR), authParams,
  ------------------
  |  |   78|     13|#define ASN_OCTET_STR	    0x04U
  ------------------
 2266|     13|                                   msgAuthParmLen);
 2267|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2268|     13|    if (rc == 0) {
  ------------------
  |  Branch (2268:9): [True: 0, False: 13]
  ------------------
 2269|      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]
  |  |  ------------------
  ------------------
 2270|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  189|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2271|      0|    }
 2272|       |
 2273|       |    /*
 2274|       |     * Remember where to put the actual HMAC we calculate later on.  An
 2275|       |     * encoded OCTET STRING of length USM_MD5_AND_SHA_AUTH_LEN has an ASN.1
 2276|       |     * header of length 2, hence the fudge factor.  This works as long as
 2277|       |     * auth lengths stay < 127.
 2278|       |     */
 2279|     13|    mac_offset = *offset - 2;
 2280|       |
 2281|       |    /*
 2282|       |     * msgUserName.  
 2283|       |     */
 2284|     13|    DEBUGDUMPHEADER("send", "msgUserName");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 2285|     13|    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2286|     13|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2287|     13|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|     13|#define ASN_OCTET_STR	    0x04U
  ------------------
 2288|     13|                                   (const u_char *) theName, theNameLength);
 2289|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2290|     13|    if (rc == 0) {
  ------------------
  |  Branch (2290:9): [True: 0, False: 13]
  ------------------
 2291|      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]
  |  |  ------------------
  ------------------
 2292|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  189|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2293|      0|    }
 2294|       |
 2295|       |    /*
 2296|       |     * msgAuthoritativeEngineTime.  
 2297|       |     */
 2298|     13|    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineTime");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 2299|     13|    rc = asn_realloc_rbuild_int(wholeMsg, wholeMsgLen, offset, 1,
 2300|     13|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2301|     13|                                          ASN_INTEGER), &time_long,
  ------------------
  |  |   75|     13|#define ASN_INTEGER	    0x02U
  ------------------
 2302|     13|                                sizeof(long));
 2303|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2304|     13|    if (rc == 0) {
  ------------------
  |  Branch (2304:9): [True: 0, False: 13]
  ------------------
 2305|      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]
  |  |  ------------------
  ------------------
 2306|      0|                    "building msgAuthoritativeEngineTime failed.\n"));
 2307|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  189|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2308|      0|    }
 2309|       |
 2310|       |    /*
 2311|       |     * msgAuthoritativeEngineBoots.  
 2312|       |     */
 2313|     13|    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineBoots");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 2314|     13|    rc = asn_realloc_rbuild_int(wholeMsg, wholeMsgLen, offset, 1,
 2315|     13|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2316|     13|                                          ASN_INTEGER), &boots_long,
  ------------------
  |  |   75|     13|#define ASN_INTEGER	    0x02U
  ------------------
 2317|     13|                                sizeof(long));
 2318|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2319|     13|    if (rc == 0) {
  ------------------
  |  Branch (2319:9): [True: 0, False: 13]
  ------------------
 2320|      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]
  |  |  ------------------
  ------------------
 2321|      0|                    "building msgAuthoritativeEngineBoots failed.\n"));
 2322|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  189|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2323|      0|    }
 2324|       |
 2325|     13|    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineID");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 2326|     13|    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2327|     13|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2328|     13|                                             | ASN_OCTET_STR), theEngineID,
  ------------------
  |  |   78|     13|#define ASN_OCTET_STR	    0x04U
  ------------------
 2329|     13|                                   theEngineIDLength);
 2330|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2331|     13|    if (rc == 0) {
  ------------------
  |  Branch (2331:9): [True: 0, False: 13]
  ------------------
 2332|      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]
  |  |  ------------------
  ------------------
 2333|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  189|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2334|      0|    }
 2335|       |
 2336|       |    /*
 2337|       |     * USM msgSecurityParameters sequence header  
 2338|       |     */
 2339|     13|    rc = asn_realloc_rbuild_sequence(wholeMsg, wholeMsgLen, offset, 1,
 2340|     13|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|     13|#define ASN_SEQUENCE	    0x10U
  ------------------
 2341|     13|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2342|     13|                                     *offset - sp_offset);
 2343|     13|    if (rc == 0) {
  ------------------
  |  Branch (2343:9): [True: 0, False: 13]
  ------------------
 2344|      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]
  |  |  ------------------
  ------------------
 2345|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  189|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2346|      0|    }
 2347|       |
 2348|       |    /*
 2349|       |     * msgSecurityParameters OCTET STRING wrapper.  
 2350|       |     */
 2351|     13|    rc = asn_realloc_rbuild_header(wholeMsg, wholeMsgLen, offset, 1,
 2352|     13|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2353|     13|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|     13|#define ASN_OCTET_STR	    0x04U
  ------------------
 2354|     13|                                   *offset - sp_offset);
 2355|       |
 2356|     13|    if (rc == 0) {
  ------------------
  |  Branch (2356:9): [True: 0, False: 13]
  ------------------
 2357|      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]
  |  |  ------------------
  ------------------
 2358|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  189|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2359|      0|    }
 2360|       |
 2361|       |    /*
 2362|       |     * Copy in the msgGlobalData and msgVersion.  
 2363|       |     */
 2364|     13|    while ((*wholeMsgLen - *offset) < globalDataLen) {
  ------------------
  |  Branch (2364:12): [True: 0, False: 13]
  ------------------
 2365|      0|        if (!asn_realloc(wholeMsg, wholeMsgLen)) {
  ------------------
  |  Branch (2365:13): [True: 0, False: 0]
  ------------------
 2366|      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]
  |  |  ------------------
  ------------------
 2367|      0|            return SNMPERR_TOO_LONG;
  ------------------
  |  |  189|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2368|      0|        }
 2369|      0|    }
 2370|       |
 2371|     13|    *offset += globalDataLen;
 2372|     13|    memcpy(*wholeMsg + *wholeMsgLen - *offset, globalData, globalDataLen);
 2373|       |
 2374|       |    /*
 2375|       |     * Total packet sequence.  
 2376|       |     */
 2377|     13|    rc = asn_realloc_rbuild_sequence(wholeMsg, wholeMsgLen, offset, 1,
 2378|     13|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|     13|#define ASN_SEQUENCE	    0x10U
  ------------------
 2379|     13|                                               ASN_CONSTRUCTOR), *offset);
  ------------------
  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2380|     13|    if (rc == 0) {
  ------------------
  |  Branch (2380:9): [True: 0, False: 13]
  ------------------
 2381|      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]
  |  |  ------------------
  ------------------
 2382|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  189|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2383|      0|    }
 2384|       |
 2385|       |    /*
 2386|       |     * Now consider / do authentication.  
 2387|       |     */
 2388|       |
 2389|     13|    if (theSecLevel == SNMP_SEC_LEVEL_AUTHNOPRIV ||
  ------------------
  |  |  300|     26|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (2389:9): [True: 0, False: 13]
  ------------------
 2390|     13|        theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|     13|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2390:9): [True: 0, False: 13]
  ------------------
 2391|      0|        size_t          temp_sig_len = msgAuthParmLen;
 2392|      0|        u_char         *temp_sig = (u_char *) malloc(temp_sig_len);
 2393|      0|        u_char         *proto_msg = *wholeMsg + *wholeMsgLen - *offset;
 2394|      0|        size_t          proto_msg_len = *offset;
 2395|       |
 2396|       |
 2397|      0|        if (temp_sig == NULL) {
  ------------------
  |  Branch (2397:13): [True: 0, False: 0]
  ------------------
 2398|      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]
  |  |  ------------------
  ------------------
 2399|      0|            return SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 2400|      0|        }
 2401|       |
 2402|      0|        if (sc_generate_keyed_hash(theAuthProtocol, theAuthProtocolLength,
  ------------------
  |  Branch (2402:13): [True: 0, False: 0]
  ------------------
 2403|      0|                                   theAuthKey, theAuthKeyLength,
 2404|      0|                                   proto_msg, proto_msg_len,
 2405|      0|                                   temp_sig, &temp_sig_len)
 2406|      0|            != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|      0|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
 2407|      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]
  |  |  ------------------
  ------------------
 2408|      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]
  |  |  ------------------
  ------------------
 2409|      0|            return SNMPERR_USM_AUTHENTICATIONFAILURE;
  ------------------
  |  |  230|      0|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
 2410|      0|        }
 2411|       |
 2412|      0|        if (temp_sig_len != msgAuthParmLen) {
  ------------------
  |  Branch (2412:13): [True: 0, False: 0]
  ------------------
 2413|      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]
  |  |  ------------------
  ------------------
 2414|      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]
  |  |  ------------------
  ------------------
 2415|      0|            return SNMPERR_USM_AUTHENTICATIONFAILURE;
  ------------------
  |  |  230|      0|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
 2416|      0|        }
 2417|       |
 2418|      0|        memcpy(*wholeMsg + *wholeMsgLen - mac_offset, temp_sig,
 2419|      0|               msgAuthParmLen);
 2420|      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]
  |  |  ------------------
  ------------------
 2421|      0|    }
 2422|       |    /*
 2423|       |     * endif -- create keyed hash 
 2424|       |     */
 2425|     13|    DEBUGMSGTL(("usm", "USM processing completed.\n"));
  ------------------
  |  |   66|     13|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2426|     13|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     13|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 2427|     13|}                               /* end usm_rgenerate_out_msg() */
snmpusm.c:usm_check_secLevel_vs_protocols:
 1356|     13|{
 1357|       |
 1358|     13|    if (level == SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|     26|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (1358:9): [True: 0, False: 13]
  ------------------
 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|     13|    if ((level == SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|     26|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (1371:10): [True: 0, False: 13]
  ------------------
 1372|     13|         || level == SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|     13|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (1372:13): [True: 0, False: 13]
  ------------------
 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|     13|    return 0;
 1387|       |
 1388|     13|}                               /* end usm_check_secLevel_vs_protocols() */
snmpusm.c:usm_secmod_process_in_msg:
 3358|     18|{
 3359|     18|    if (!parms)
  ------------------
  |  Branch (3359:9): [True: 0, False: 18]
  ------------------
 3360|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 3361|       |
 3362|     18|    return usm_process_in_msg(parms->msgProcModel,
 3363|     18|                              parms->maxMsgSize,
 3364|     18|                              parms->secParams,
 3365|     18|                              parms->secModel,
 3366|     18|                              parms->secLevel,
 3367|     18|                              parms->wholeMsg,
 3368|     18|                              parms->wholeMsgLen,
 3369|     18|                              parms->secEngineID,
 3370|     18|                              parms->secEngineIDLen,
 3371|     18|                              parms->secName,
 3372|     18|                              parms->secNameLen,
 3373|     18|                              parms->scopedPdu,
 3374|     18|                              parms->scopedPduLen,
 3375|     18|                              parms->maxSizeResponse,
 3376|     18|                              parms->secStateRef,
 3377|     18|                              parms->sess, parms->msg_flags);
 3378|     18|}
snmpusm.c:usm_process_in_msg:
 2957|     18|{                               /* IN     - v3 Message flags.              */
 2958|     18|    size_t          remaining = wholeMsgLen - (secParams - wholeMsg);
 2959|     18|    u_int           boots_uint;
 2960|     18|    u_int           time_uint;
 2961|     18|#ifdef HAVE_AES
 2962|     18|    u_int           net_boots, net_time;
 2963|     18|#endif
 2964|     18|#ifndef NETSNMP_DISABLE_DES
 2965|     18|    int             i;
 2966|     18|#endif
 2967|     18|    u_char          signature[USM_MAX_AUTHSIZE];
 2968|     18|    size_t          signature_length = USM_MAX_AUTHSIZE;
  ------------------
  |  |   38|     18|#define USM_MAX_AUTHSIZE                USM_HMAC384SHA512_AUTH_LEN
  |  |  ------------------
  |  |  |  |   37|     18|#define USM_HMAC384SHA512_AUTH_LEN      48      /* SHOULD */
  |  |  ------------------
  ------------------
 2969|     18|    u_char          salt[BYTESIZE(USM_MAX_SALT_LENGTH)];
 2970|     18|    size_t          salt_length = BYTESIZE(USM_MAX_SALT_LENGTH);
  ------------------
  |  |   55|     18|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 2971|     18|    u_char          iv[BYTESIZE(USM_MAX_SALT_LENGTH)];
 2972|     18|    u_int           iv_length = BYTESIZE(USM_MAX_SALT_LENGTH);
  ------------------
  |  |   55|     18|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 2973|     18|    u_char         *data_ptr;
 2974|     18|    u_char         *value_ptr;
 2975|     18|    u_char          type_value;
 2976|     18|    u_char         *end_of_overhead = NULL;
 2977|     18|    int             error;
 2978|     18|    int             rc = 0;
 2979|     18|    struct usmStateReference **secStateRef =
 2980|     18|        (struct usmStateReference **) secStateRf;
 2981|       |
 2982|     18|    struct usmUser *user;
 2983|       |
 2984|       |
 2985|     18|    DEBUGMSGTL(("usm", "USM processing begun...\n"));
  ------------------
  |  |   66|     18|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     18|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 18]
  |  |  ------------------
  ------------------
 2986|       |
 2987|     18|    netsnmp_assert(secStateRef);
  ------------------
  |  |   47|     18|#      define netsnmp_assert(x)  do { \
  |  |   48|     18|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 18, False: 0]
  |  |  ------------------
  |  |   49|     18|                 ; \
  |  |   50|     18|              else \
  |  |   51|     18|                 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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     18|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 18]
  |  |  ------------------
  ------------------
 2988|       |
 2989|     18|    usm_free_usmStateReference(*secStateRef);
 2990|     18|    *secStateRef = usm_malloc_usmStateReference();
 2991|     18|    if (*secStateRef == NULL) {
  ------------------
  |  Branch (2991:9): [True: 0, False: 18]
  ------------------
 2992|      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]
  |  |  ------------------
  ------------------
 2993|      0|        return SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 2994|      0|    }
 2995|       |
 2996|       |    /*
 2997|       |     * Make sure the *secParms is an OCTET STRING.
 2998|       |     * Extract the user name, engine ID, and security level.
 2999|       |     */
 3000|     18|    if ((rc = usm_parse_security_parameters(secParams, remaining,
  ------------------
  |  Branch (3000:9): [True: 12, False: 6]
  ------------------
 3001|     18|                                            secEngineID, secEngineIDLen,
 3002|     18|                                            &boots_uint, &time_uint,
 3003|     18|                                            secName, secNameLen,
 3004|     18|                                            signature, &signature_length,
 3005|     18|                                            salt, &salt_length,
 3006|     18|                                            &data_ptr)) < 0) {
 3007|     12|        DEBUGMSGTL(("usm", "Parsing failed (rc %d).\n", rc));
  ------------------
  |  |   66|     12|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     12|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 12]
  |  |  ------------------
  ------------------
 3008|     12|        if (rc == -2) {
  ------------------
  |  Branch (3008:13): [True: 7, False: 5]
  ------------------
 3009|       |            /*
 3010|       |             * This indicates a decryptionError.  
 3011|       |             */
 3012|      7|            snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  625|      7|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3013|      7|            error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  234|      7|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3014|      7|        } else {
 3015|      5|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      5|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3016|      5|            error = SNMPERR_USM_PARSEERROR;
  ------------------
  |  |  231|      5|#define SNMPERR_USM_PARSEERROR			(-47)
  ------------------
 3017|      5|        }
 3018|     12|        goto err;
 3019|     12|    }
 3020|       |
 3021|       |    /*
 3022|       |     * RFC 2574 section 8.3.2
 3023|       |     * 1)  If the privParameters field is not an 8-octet OCTET STRING,
 3024|       |     * then an error indication (decryptionError) is returned to the
 3025|       |     * calling module.
 3026|       |     */
 3027|      6|    if ((secLevel == SNMP_SEC_LEVEL_AUTHPRIV) && (salt_length != 8)) {
  ------------------
  |  |  301|      6|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3027:9): [True: 0, False: 6]
  |  Branch (3027:50): [True: 0, False: 0]
  ------------------
 3028|      0|        snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  625|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3029|      0|        error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  234|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3030|      0|        goto err;
 3031|      0|    }
 3032|       |
 3033|      6|    if (secLevel != SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      6|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3033:9): [True: 6, False: 0]
  ------------------
 3034|       |        /*
 3035|       |         * pull these out now so reports can use them 
 3036|       |         */
 3037|      6|        *scopedPdu = data_ptr;
 3038|      6|        *scopedPduLen = wholeMsgLen - (data_ptr - wholeMsg);
 3039|      6|        end_of_overhead = data_ptr;
 3040|      6|    }
 3041|       |
 3042|       |    /*
 3043|       |     * Cache the name, engine ID, and security level,
 3044|       |     * * per step 2 (section 3.2)
 3045|       |     */
 3046|      6|    if (usm_set_usmStateReference_name
  ------------------
  |  Branch (3046:9): [True: 0, False: 6]
  ------------------
 3047|      6|        (*secStateRef, secName, *secNameLen) == -1) {
 3048|      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]
  |  |  ------------------
  ------------------
 3049|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3050|      0|        goto err;
 3051|      0|    }
 3052|       |
 3053|      6|    if (usm_set_usmStateReference_engine_id
  ------------------
  |  Branch (3053:9): [True: 0, False: 6]
  ------------------
 3054|      6|        (*secStateRef, secEngineID, *secEngineIDLen) == -1) {
 3055|      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]
  |  |  ------------------
  ------------------
 3056|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3057|      0|        goto err;
 3058|      0|    }
 3059|       |
 3060|      6|    if (usm_set_usmStateReference_sec_level(*secStateRef, secLevel) ==
  ------------------
  |  Branch (3060:9): [True: 0, False: 6]
  ------------------
 3061|      6|        -1) {
 3062|      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]
  |  |  ------------------
  ------------------
 3063|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3064|      0|        goto err;
 3065|      0|    }
 3066|       |
 3067|       |    /*
 3068|       |     * Locate the engine ID record.
 3069|       |     * If it is unknown, then either create one or note this as an error.
 3070|       |     */
 3071|      6|    if ((sess && (sess->isAuthoritative == SNMP_SESS_AUTHORITATIVE ||
  ------------------
  |  |  125|     12|#define SNMP_SESS_AUTHORITATIVE    1    /* don't learn engineIDs */
  ------------------
  |  Branch (3071:10): [True: 6, False: 0]
  |  Branch (3071:19): [True: 0, False: 6]
  ------------------
 3072|      6|                  (sess->isAuthoritative == SNMP_SESS_UNKNOWNAUTH &&
  ------------------
  |  |  126|     12|#define SNMP_SESS_UNKNOWNAUTH      2    /* sometimes (like NRs) */
  ------------------
  |  Branch (3072:20): [True: 6, False: 0]
  ------------------
 3073|      6|                   (msg_flags & SNMP_MSG_FLAG_RPRT_BIT)))) ||
  ------------------
  |  |  305|      6|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3073:20): [True: 6, False: 0]
  ------------------
 3074|      6|        (!sess && (msg_flags & SNMP_MSG_FLAG_RPRT_BIT))) {
  ------------------
  |  |  305|      0|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3074:10): [True: 0, False: 0]
  |  Branch (3074:19): [True: 0, False: 0]
  ------------------
 3075|      6|        if (ISENGINEKNOWN(secEngineID, *secEngineIDLen) == FALSE) {
  ------------------
  |  |   82|      6|	( (get_enginetime(e, e_l,				\
  |  |  ------------------
  |  |  |  Branch (82:4): [True: 0, False: 6]
  |  |  ------------------
  |  |   83|      6|		&dummy_eboot, &dummy_etime, TRUE) == SNMPERR_SUCCESS)	\
  |  |  ------------------
  |  |  |  |  128|      6|#define TRUE  1
  |  |  ------------------
  |  |               		&dummy_eboot, &dummy_etime, TRUE) == SNMPERR_SUCCESS)	\
  |  |  ------------------
  |  |  |  |  184|      6|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |   84|      6|		? TRUE						\
  |  |  ------------------
  |  |  |  |  128|      0|#define TRUE  1
  |  |  ------------------
  |  |   85|      6|		: FALSE )
  |  |  ------------------
  |  |  |  |  125|      6|#define FALSE 0
  |  |  ------------------
  ------------------
                      if (ISENGINEKNOWN(secEngineID, *secEngineIDLen) == FALSE) {
  ------------------
  |  |  125|      6|#define FALSE 0
  ------------------
  |  Branch (3075:13): [True: 6, False: 0]
  ------------------
 3076|      6|            DEBUGMSGTL(("usm", "Unknown Engine ID.\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]
  |  |  ------------------
  ------------------
 3077|      6|            snmp_increment_statistic(STAT_USMSTATSUNKNOWNENGINEIDS);
  ------------------
  |  |  623|      6|#define   STAT_USMSTATSUNKNOWNENGINEIDS      6
  ------------------
 3078|      6|            error = SNMPERR_USM_UNKNOWNENGINEID;
  ------------------
  |  |  232|      6|#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
  ------------------
 3079|      6|            goto err;
 3080|      6|        }
 3081|      6|    } else {
 3082|      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)	\
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (88:4): [True: 0, False: 0]
  |  |  ------------------
  |  |   89|      0|		? SNMPERR_SUCCESS				\
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |   90|      0|		: SNMPERR_GENERR )
  |  |  ------------------
  |  |  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  ------------------
  |  Branch (3082:13): [True: 0, False: 0]
  ------------------
 3083|      0|            != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3084|      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]
  |  |  ------------------
  ------------------
 3085|      0|            error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3086|      0|            goto err;
 3087|      0|        }
 3088|       |
 3089|      0|    }
 3090|       |
 3091|       |
 3092|       |    /*
 3093|       |     * Locate the User record.
 3094|       |     * If the user/engine ID is unknown, report this as an error.
 3095|       |     */
 3096|      0|    if (sess && sess->sessUser)
  ------------------
  |  Branch (3096:9): [True: 0, False: 0]
  |  Branch (3096:17): [True: 0, False: 0]
  ------------------
 3097|      0|        user = sess->sessUser;
 3098|      0|    else
 3099|      0|        user = usm_get_user_from_list(secEngineID, *secEngineIDLen,
 3100|      0|                                       secName, *secNameLen, userList,
 3101|      0|                                       (((sess && sess->isAuthoritative ==
  ------------------
  |  Branch (3101:43): [True: 0, False: 0]
  |  Branch (3101:51): [True: 0, False: 0]
  ------------------
 3102|      0|                                          SNMP_SESS_AUTHORITATIVE) ||
  ------------------
  |  |  125|      0|#define SNMP_SESS_AUTHORITATIVE    1    /* don't learn engineIDs */
  ------------------
 3103|      0|                                         (!sess)) ? 0 : 1));
  ------------------
  |  Branch (3103:42): [True: 0, False: 0]
  ------------------
 3104|       |
 3105|      0|    if (user == NULL) {
  ------------------
  |  Branch (3105:9): [True: 0, False: 0]
  ------------------
 3106|      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]
  |  |  ------------------
  ------------------
 3107|      0|        snmp_increment_statistic(STAT_USMSTATSUNKNOWNUSERNAMES);
  ------------------
  |  |  622|      0|#define   STAT_USMSTATSUNKNOWNUSERNAMES      5
  ------------------
 3108|      0|        error = SNMPERR_USM_UNKNOWNSECURITYNAME;
  ------------------
  |  |  227|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
 3109|      0|        goto err;
 3110|      0|    }
 3111|       |
 3112|       |    /* ensure the user is active */
 3113|      0|    if (user->userStatus != RS_ACTIVE) {
  ------------------
  |  |   35|      0|#define RS_ACTIVE	        1
  ------------------
  |  Branch (3113:9): [True: 0, False: 0]
  ------------------
 3114|      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]
  |  |  ------------------
  ------------------
 3115|      0|        error = SNMPERR_USM_UNKNOWNSECURITYNAME;
  ------------------
  |  |  227|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
 3116|      0|        goto err;
 3117|      0|    }
 3118|       |
 3119|       |    /*
 3120|       |     * Make sure the security level is appropriate.
 3121|       |     */
 3122|       |
 3123|      0|    rc = usm_check_secLevel(secLevel, user);
 3124|      0|    if (1 == rc) {
  ------------------
  |  Branch (3124:9): [True: 0, False: 0]
  ------------------
 3125|      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]
  |  |  ------------------
  ------------------
 3126|      0|                    secLevel));
 3127|      0|        snmp_increment_statistic(STAT_USMSTATSUNSUPPORTEDSECLEVELS);
  ------------------
  |  |  620|      0|#define   STAT_USMSTATSUNSUPPORTEDSECLEVELS  3
  ------------------
 3128|      0|        error = SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL;
  ------------------
  |  |  228|      0|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
 3129|      0|        goto err;
 3130|      0|    } else if (rc != 0) {
  ------------------
  |  Branch (3130:16): [True: 0, False: 0]
  ------------------
 3131|      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]
  |  |  ------------------
  ------------------
 3132|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3133|      0|        goto err;
 3134|      0|    }
 3135|       |
 3136|       |    /*
 3137|       |     * Check the authentication credentials of the message.
 3138|       |     */
 3139|      0|    if (secLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
  ------------------
  |  |  300|      0|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (3139:9): [True: 0, False: 0]
  ------------------
 3140|      0|        || secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3140:12): [True: 0, False: 0]
  ------------------
 3141|      0|        if (sc_check_keyed_hash(user->authProtocol, user->authProtocolLen,
  ------------------
  |  Branch (3141:13): [True: 0, False: 0]
  ------------------
 3142|      0|                                user->authKey, user->authKeyLen,
 3143|      0|                                wholeMsg, wholeMsgLen,
 3144|      0|                                signature, signature_length)
 3145|      0|            != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|      0|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
 3146|      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]
  |  |  ------------------
  ------------------
 3147|      0|            snmp_increment_statistic(STAT_USMSTATSWRONGDIGESTS);
  ------------------
  |  |  624|      0|#define   STAT_USMSTATSWRONGDIGESTS          7
  ------------------
 3148|      0|	    snmp_log(LOG_WARNING, "Authentication failed for %s\n",
 3149|      0|				user->name);
 3150|      0|            error = SNMPERR_USM_AUTHENTICATIONFAILURE;
  ------------------
  |  |  230|      0|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
 3151|      0|            goto err;
 3152|      0|        }
 3153|       |
 3154|      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]
  |  |  ------------------
  ------------------
 3155|      0|    }
 3156|       |
 3157|       |
 3158|       |    /*
 3159|       |     * Steps 10-11  user is already set - relocated before timeliness 
 3160|       |     * check in case it fails - still save user data for response.
 3161|       |     *
 3162|       |     * Cache the keys and protocol oids, per step 11 (s3.2).
 3163|       |     */
 3164|      0|    if (usm_set_usmStateReference_auth_protocol(*secStateRef,
  ------------------
  |  Branch (3164:9): [True: 0, False: 0]
  ------------------
 3165|      0|                                                user->authProtocol,
 3166|      0|                                                user->
 3167|      0|                                                authProtocolLen) == -1) {
 3168|      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]
  |  |  ------------------
  ------------------
 3169|      0|                    "Couldn't cache authentication protocol."));
 3170|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3171|      0|        goto err;
 3172|      0|    }
 3173|       |
 3174|      0|    if (usm_set_usmStateReference_auth_key(*secStateRef,
  ------------------
  |  Branch (3174:9): [True: 0, False: 0]
  ------------------
 3175|      0|                                           user->authKey,
 3176|      0|                                           user->authKeyLen) == -1) {
 3177|      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]
  |  |  ------------------
  ------------------
 3178|      0|                    "Couldn't cache authentication key."));
 3179|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3180|      0|        goto err;
 3181|      0|    }
 3182|       |
 3183|      0|    if (usm_set_usmStateReference_priv_protocol(*secStateRef,
  ------------------
  |  Branch (3183:9): [True: 0, False: 0]
  ------------------
 3184|      0|                                                user->privProtocol,
 3185|      0|                                                user->
 3186|      0|                                                privProtocolLen) == -1) {
 3187|      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]
  |  |  ------------------
  ------------------
 3188|      0|                    "Couldn't cache privacy protocol."));
 3189|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3190|      0|        goto err;
 3191|      0|    }
 3192|       |
 3193|      0|    if (usm_set_usmStateReference_priv_key(*secStateRef,
  ------------------
  |  Branch (3193:9): [True: 0, False: 0]
  ------------------
 3194|      0|                                           user->privKey,
 3195|      0|                                           user->privKeyLen) == -1) {
 3196|      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]
  |  |  ------------------
  ------------------
 3197|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3198|      0|        goto err;
 3199|      0|    }
 3200|       |
 3201|       |
 3202|       |    /*
 3203|       |     * Perform the timeliness/time manager functions.
 3204|       |     */
 3205|      0|    if (secLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
  ------------------
  |  |  300|      0|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (3205:9): [True: 0, False: 0]
  ------------------
 3206|      0|        || secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3206:12): [True: 0, False: 0]
  ------------------
 3207|      0|        if (usm_check_and_update_timeliness(secEngineID, *secEngineIDLen,
  ------------------
  |  Branch (3207:13): [True: 0, False: 0]
  ------------------
 3208|      0|                                            boots_uint, time_uint,
 3209|      0|                                            &error) == -1) {
 3210|      0|            goto err;
 3211|      0|        }
 3212|      0|    }
 3213|      0|#ifdef							LCD_TIME_SYNC_OPT
 3214|       |    /*
 3215|       |     * Cache the unauthenticated time to use in case we don't have
 3216|       |     * anything better - this guess will be no worse than (0,0)
 3217|       |     * that we normally use.
 3218|       |     */
 3219|      0|    else {
 3220|      0|        set_enginetime(secEngineID, *secEngineIDLen,
 3221|      0|                       boots_uint, time_uint, FALSE);
  ------------------
  |  |  125|      0|#define FALSE 0
  ------------------
 3222|      0|    }
 3223|      0|#endif                          /* LCD_TIME_SYNC_OPT */
 3224|       |
 3225|       |
 3226|       |    /*
 3227|       |     * If needed, decrypt the scoped PDU.
 3228|       |     */
 3229|      0|    if (secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3229:9): [True: 0, False: 0]
  ------------------
 3230|      0|        int priv_type = sc_get_privtype(user->privProtocol,
 3231|      0|                                        user->privProtocolLen);
 3232|      0|        remaining = wholeMsgLen - (data_ptr - wholeMsg);
 3233|       |
 3234|      0|        if ((value_ptr = asn_parse_sequence(data_ptr, &remaining,
  ------------------
  |  Branch (3234:13): [True: 0, False: 0]
  ------------------
 3235|      0|                                            &type_value,
 3236|      0|                                            (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                          (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3237|      0|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 3238|      0|                                            "encrypted sPDU")) == NULL) {
 3239|      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]
  |  |  ------------------
  ------------------
 3240|      0|                        "Failed while parsing encrypted sPDU."));
 3241|      0|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3242|      0|            usm_free_usmStateReference(*secStateRef);
 3243|      0|            *secStateRef = NULL;
 3244|      0|            error = SNMPERR_USM_PARSEERROR;
  ------------------
  |  |  231|      0|#define SNMPERR_USM_PARSEERROR			(-47)
  ------------------
 3245|      0|            goto err;
 3246|      0|        }
 3247|       |
 3248|      0|#ifndef NETSNMP_DISABLE_DES
 3249|      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 (3249:13): [True: 0, False: 0]
  ------------------
 3250|       |            /*
 3251|       |             * From RFC2574:
 3252|       |             * 
 3253|       |             * "Before decryption, the encrypted data length is verified.
 3254|       |             * If the length of the OCTET STRING to be decrypted is not
 3255|       |             * an integral multiple of 8 octets, the decryption process
 3256|       |             * is halted and an appropriate exception noted."  
 3257|       |             */
 3258|       |
 3259|      0|            if (remaining % 8 != 0) {
  ------------------
  |  Branch (3259:17): [True: 0, False: 0]
  ------------------
 3260|      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]
  |  |  ------------------
  ------------------
 3261|      0|                            "Ciphertext is %lu bytes, not an integer multiple of 8 (rem %lu)\n",
 3262|      0|                            (unsigned long)remaining, (unsigned long)remaining % 8));
 3263|      0|                snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  625|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3264|      0|                usm_free_usmStateReference(*secStateRef);
 3265|      0|                *secStateRef = NULL;
 3266|      0|                error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  234|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3267|      0|                goto err;
 3268|      0|            }
 3269|       |
 3270|      0|            end_of_overhead = value_ptr;
 3271|       |
 3272|      0|            if ( !user->privKey ) {
  ------------------
  |  Branch (3272:18): [True: 0, False: 0]
  ------------------
 3273|      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]
  |  |  ------------------
  ------------------
 3274|      0|                snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  625|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3275|      0|                usm_free_usmStateReference(*secStateRef);
 3276|      0|                *secStateRef = NULL;
 3277|      0|                error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  234|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3278|      0|                goto err;
 3279|      0|            }
 3280|       |
 3281|       |            /*
 3282|       |             * XOR the salt with the last (iv_length) bytes
 3283|       |             * of the priv_key to obtain the IV.
 3284|       |             */
 3285|      0|            iv_length = BYTESIZE(USM_DES_SALT_LENGTH);
  ------------------
  |  |   55|      0|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 3286|      0|            for (i = 0; i < (int) iv_length; i++)
  ------------------
  |  Branch (3286:25): [True: 0, False: 0]
  ------------------
 3287|      0|                iv[i] = salt[i] ^ user->privKey[iv_length + i];
 3288|      0|        }
 3289|      0|#endif
 3290|      0|#ifdef HAVE_AES
 3291|      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 (3291:13): [True: 0, False: 0]
  ------------------
 3292|      0|            iv_length = BYTESIZE(USM_AES_SALT_LENGTH);
  ------------------
  |  |   55|      0|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 3293|      0|            net_boots = ntohl(boots_uint);
 3294|      0|            net_time = ntohl(time_uint);
 3295|      0|            memcpy(iv, &net_boots, 4);
 3296|      0|            memcpy(iv+4, &net_time, 4);
 3297|      0|            memcpy(iv+8, salt, salt_length);
 3298|      0|        }
 3299|      0|#endif
 3300|       |
 3301|       |#ifdef NETSNMP_ENABLE_TESTING_CODE
 3302|       |        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
 3303|       |            dump_chunk("usm/dump", "Cypher Text", value_ptr, remaining);
 3304|       |            dump_chunk("usm/dump", "salt + Encrypted form:",
 3305|       |                       salt, salt_length);
 3306|       |            dump_chunk("usm/dump", "IV + Encrypted form:", iv, iv_length);
 3307|       |        }
 3308|       |#endif
 3309|      0|        if (sc_decrypt(user->privProtocol, user->privProtocolLen,
  ------------------
  |  Branch (3309:13): [True: 0, False: 0]
  ------------------
 3310|      0|                       user->privKey, user->privKeyLen,
 3311|      0|                       iv, iv_length,
 3312|      0|                       value_ptr, remaining, *scopedPdu, scopedPduLen)
 3313|      0|            != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|      0|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
 3314|      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]
  |  |  ------------------
  ------------------
 3315|      0|            snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  625|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3316|      0|            error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  234|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3317|      0|            goto err;
 3318|      0|        }
 3319|       |#ifdef NETSNMP_ENABLE_TESTING_CODE
 3320|       |        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
 3321|       |            dump_chunk("usm/dump", "Decrypted chunk:",
 3322|       |                       *scopedPdu, *scopedPduLen);
 3323|       |        }
 3324|       |#endif
 3325|      0|    }
 3326|       |    /*
 3327|       |     * sPDU is plaintext.
 3328|       |     */
 3329|      0|    else {
 3330|      0|        *scopedPdu = data_ptr;
 3331|      0|        *scopedPduLen = wholeMsgLen - (data_ptr - wholeMsg);
 3332|      0|        end_of_overhead = data_ptr;
 3333|       |
 3334|      0|    }                           /* endif -- PDU decryption */
 3335|       |
 3336|       |
 3337|       |    /*
 3338|       |     * Calculate the biggest sPDU for the response (i.e., whole - ovrhd).
 3339|       |     *
 3340|       |     * FIX  Correct? 
 3341|       |     */
 3342|      0|    *maxSizeResponse = maxMsgSize - (end_of_overhead - wholeMsg);
 3343|       |
 3344|       |
 3345|      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]
  |  |  ------------------
  ------------------
 3346|       |
 3347|      0|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3348|       |
 3349|     18|err:
 3350|     18|    usm_free_usmStateReference(*secStateRef);
 3351|     18|    *secStateRef = NULL;
 3352|       |    netsnmp_assert(error != SNMPERR_SUCCESS);
  ------------------
  |  |   47|     18|#      define netsnmp_assert(x)  do { \
  |  |   48|     18|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 18, False: 0]
  |  |  ------------------
  |  |   49|     18|                 ; \
  |  |   50|     18|              else \
  |  |   51|     18|                 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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1724|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     18|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 18]
  |  |  ------------------
  ------------------
 3353|     18|    return error;
 3354|      0|}                               /* end usm_process_in_msg() */
snmpusm.c:usm_malloc_usmStateReference:
  288|     18|{
  289|     18|    struct usmStateReference *retval;
  290|       |
  291|     18|    retval = calloc(1, sizeof(struct usmStateReference));
  292|     18|    if (retval)
  ------------------
  |  Branch (292:9): [True: 18, False: 0]
  ------------------
  293|     18|        retval->refcnt = 1;
  294|       |
  295|     18|    return retval;
  296|     18|}                               /* end usm_malloc_usmStateReference() */
snmpusm.c:usm_parse_security_parameters:
 2477|     18|{
 2478|     18|    u_char         *parse_ptr = secParams;
 2479|     18|    u_char         *value_ptr;
 2480|     18|    u_char         *next_ptr;
 2481|     18|    u_char          type_value;
 2482|       |
 2483|     18|    size_t          octet_string_length = remaining;
 2484|     18|    size_t          sequence_length;
 2485|     18|    size_t          remaining_bytes;
 2486|       |
 2487|     18|    long            boots_long;
 2488|     18|    long            time_long;
 2489|       |
 2490|     18|    u_int           origNameLen;
 2491|       |
 2492|       |
 2493|       |    /*
 2494|       |     * Eat the first octet header.
 2495|       |     */
 2496|     18|    if ((value_ptr = asn_parse_sequence(parse_ptr, &octet_string_length,
  ------------------
  |  Branch (2496:9): [True: 2, False: 16]
  ------------------
 2497|     18|                                        &type_value,
 2498|     18|                                        (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|     18|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                      (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|     18|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2499|     18|                                         ASN_OCTET_STR),
  ------------------
  |  |   78|     18|#define ASN_OCTET_STR	    0x04U
  ------------------
 2500|     18|                                        "usm first octet")) == NULL) {
 2501|       |        /*
 2502|       |         * RETURN parse error 
 2503|      2|         */ return -1;
 2504|      2|    }
 2505|       |
 2506|       |
 2507|       |    /*
 2508|       |     * Eat the sequence header.
 2509|       |     */
 2510|     16|    parse_ptr = value_ptr;
 2511|     16|    sequence_length = octet_string_length;
 2512|       |
 2513|     16|    if ((value_ptr = asn_parse_sequence(parse_ptr, &sequence_length,
  ------------------
  |  Branch (2513:9): [True: 0, False: 16]
  ------------------
 2514|     16|                                        &type_value,
 2515|     16|                                        (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|     16|#define ASN_SEQUENCE	    0x10U
  ------------------
                                                      (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|     16|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2516|     16|                                        "usm sequence")) == NULL) {
 2517|       |        /*
 2518|       |         * RETURN parse error 
 2519|      0|         */ return -1;
 2520|      0|    }
 2521|       |
 2522|       |
 2523|       |    /*
 2524|       |     * Retrieve the engineID.
 2525|       |     */
 2526|     16|    parse_ptr = value_ptr;
 2527|     16|    remaining_bytes = sequence_length;
 2528|       |
 2529|     16|    DEBUGDUMPHEADER("recv", "msgAuthoritativeEngineID");
  ------------------
  |  |   79|     16|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     16|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 16]
  |  |  ------------------
  ------------------
 2530|     16|    if ((next_ptr
  ------------------
  |  Branch (2530:9): [True: 0, False: 16]
  ------------------
 2531|     16|         = asn_parse_string(parse_ptr, &remaining_bytes, &type_value,
 2532|     16|                            secEngineID, secEngineIDLen)) == NULL) {
 2533|      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]
  |  |  ------------------
  ------------------
 2534|       |        /*
 2535|       |         * RETURN parse error 
 2536|      0|         */ return -1;
 2537|      0|    }
 2538|     16|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     16|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     16|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 16]
  |  |  ------------------
  ------------------
 2539|       |
 2540|     16|    if (type_value !=
  ------------------
  |  Branch (2540:9): [True: 0, False: 16]
  ------------------
 2541|     16|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   90|     16|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   95|     16|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   78|     16|#define ASN_OCTET_STR	    0x04U
  ------------------
 2542|       |        /*
 2543|       |         * RETURN parse error 
 2544|      0|         */ return -1;
 2545|      0|    }
 2546|       |
 2547|       |
 2548|       |    /*
 2549|       |     * Retrieve the engine boots, notice switch in the way next_ptr and
 2550|       |     * remaining_bytes are used (to accommodate the asn code).
 2551|       |     */
 2552|     16|    DEBUGDUMPHEADER("recv", "msgAuthoritativeEngineBoots");
  ------------------
  |  |   79|     16|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     16|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 16]
  |  |  ------------------
  ------------------
 2553|     16|    if ((next_ptr = asn_parse_int(next_ptr, &remaining_bytes, &type_value,
  ------------------
  |  Branch (2553:9): [True: 0, False: 16]
  ------------------
 2554|     16|                                  &boots_long, sizeof(long))) == NULL) {
 2555|      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]
  |  |  ------------------
  ------------------
 2556|       |        /*
 2557|       |         * RETURN parse error 
 2558|      0|         */ return -1;
 2559|      0|    }
 2560|     16|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     16|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     16|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 16]
  |  |  ------------------
  ------------------
 2561|       |
 2562|     16|    if (type_value !=
  ------------------
  |  Branch (2562:9): [True: 0, False: 16]
  ------------------
 2563|     16|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   90|     16|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   95|     16|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   75|     16|#define ASN_INTEGER	    0x02U
  ------------------
 2564|      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]
  |  |  ------------------
  ------------------
 2565|       |        /*
 2566|       |         * RETURN parse error 
 2567|      0|         */ return -1;
 2568|      0|    }
 2569|       |
 2570|     16|    *boots_uint = (u_int) boots_long;
 2571|       |
 2572|       |
 2573|       |    /*
 2574|       |     * Retrieve the time value.
 2575|       |     */
 2576|     16|    DEBUGDUMPHEADER("recv", "msgAuthoritativeEngineTime");
  ------------------
  |  |   79|     16|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     16|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 16]
  |  |  ------------------
  ------------------
 2577|     16|    if ((next_ptr = asn_parse_int(next_ptr, &remaining_bytes, &type_value,
  ------------------
  |  Branch (2577:9): [True: 1, False: 15]
  ------------------
 2578|     16|                                  &time_long, sizeof(long))) == NULL) {
 2579|       |        /*
 2580|       |         * RETURN parse error 
 2581|      1|         */ return -1;
 2582|      1|    }
 2583|     15|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     15|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     15|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 15]
  |  |  ------------------
  ------------------
 2584|       |
 2585|     15|    if (type_value !=
  ------------------
  |  Branch (2585:9): [True: 0, False: 15]
  ------------------
 2586|     15|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   90|     15|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   95|     15|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   75|     15|#define ASN_INTEGER	    0x02U
  ------------------
 2587|       |        /*
 2588|       |         * RETURN parse error 
 2589|      0|         */ return -1;
 2590|      0|    }
 2591|       |
 2592|     15|    *time_uint = (u_int) time_long;
 2593|       |
 2594|     15|    if (*boots_uint > ENGINEBOOT_MAX || *time_uint > ENGINETIME_MAX) {
  ------------------
  |  |  183|     30|#define ENGINEBOOT_MAX	2147483647      /* ((2^31)-1) */
  ------------------
                  if (*boots_uint > ENGINEBOOT_MAX || *time_uint > ENGINETIME_MAX) {
  ------------------
  |  |  182|     14|#define ENGINETIME_MAX	2147483647      /* ((2^31)-1) */
  ------------------
  |  Branch (2594:9): [True: 1, False: 14]
  |  Branch (2594:41): [True: 1, False: 13]
  ------------------
 2595|      2|        return -1;
 2596|      2|    }
 2597|       |
 2598|       |    /*
 2599|       |     * Retrieve the secName.
 2600|       |     */
 2601|     13|    origNameLen = *secNameLen;
 2602|       |
 2603|       |
 2604|     13|    DEBUGDUMPHEADER("recv", "msgUserName");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 2605|     13|    if ((next_ptr
  ------------------
  |  Branch (2605:9): [True: 0, False: 13]
  ------------------
 2606|     13|         = asn_parse_string(next_ptr, &remaining_bytes, &type_value,
 2607|     13|                            (u_char *) secName, secNameLen)) == NULL) {
 2608|      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]
  |  |  ------------------
  ------------------
 2609|       |        /*
 2610|       |         * RETURN parse error 
 2611|      0|         */ return -1;
 2612|      0|    }
 2613|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2614|       |
 2615|       |    /*
 2616|       |     * FIX -- doesn't this also indicate a buffer overrun?
 2617|       |     */
 2618|     13|    if (origNameLen < *secNameLen + 1) {
  ------------------
  |  Branch (2618:9): [True: 0, False: 13]
  ------------------
 2619|       |        /*
 2620|       |         * RETURN parse error, but it's really a parameter error 
 2621|       |         */
 2622|      0|        return -1;
 2623|      0|    }
 2624|       |
 2625|     13|    if (*secNameLen > 32) {
  ------------------
  |  Branch (2625:9): [True: 0, False: 13]
  ------------------
 2626|       |        /*
 2627|       |         * This is a USM-specific limitation over and above the above
 2628|       |         * limitation (which will probably default to the length of an
 2629|       |         * SnmpAdminString, i.e. 255).  See RFC 2574, sec. 2.4.  
 2630|       |         */
 2631|      0|        return -1;
 2632|      0|    }
 2633|       |
 2634|     13|    secName[*secNameLen] = '\0';
 2635|       |
 2636|     13|    if (type_value !=
  ------------------
  |  Branch (2636:9): [True: 0, False: 13]
  ------------------
 2637|     13|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   78|     13|#define ASN_OCTET_STR	    0x04U
  ------------------
 2638|       |        /*
 2639|       |         * RETURN parse error 
 2640|      0|         */ return -1;
 2641|      0|    }
 2642|       |
 2643|       |
 2644|       |    /*
 2645|       |     * Retrieve the signature and blank it if there.
 2646|       |     */
 2647|     13|    DEBUGDUMPHEADER("recv", "msgAuthenticationParameters");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 2648|     13|    if ((next_ptr
  ------------------
  |  Branch (2648:9): [True: 0, False: 13]
  ------------------
 2649|     13|         = asn_parse_string(next_ptr, &remaining_bytes, &type_value,
 2650|     13|                            signature, signature_length)) == NULL) {
 2651|      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]
  |  |  ------------------
  ------------------
 2652|       |        /*
 2653|       |         * RETURN parse error 
 2654|      0|         */ return -1;
 2655|      0|    }
 2656|     13|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     13|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 13]
  |  |  ------------------
  ------------------
 2657|       |
 2658|     13|    if (type_value !=
  ------------------
  |  Branch (2658:9): [True: 0, False: 13]
  ------------------
 2659|     13|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   90|     13|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   95|     13|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   78|     13|#define ASN_OCTET_STR	    0x04U
  ------------------
 2660|       |        /*
 2661|       |         * RETURN parse error 
 2662|      0|         */ return -1;
 2663|      0|    }
 2664|       |
 2665|     13|    if (*signature_length != 0) {       /* Blanking for authentication step later */
  ------------------
  |  Branch (2665:9): [True: 13, False: 0]
  ------------------
 2666|     13|        memset(next_ptr - (u_long) * signature_length,
 2667|     13|               0, *signature_length);
 2668|     13|    }
 2669|       |
 2670|       |
 2671|       |    /*
 2672|       |     * Retrieve the salt.
 2673|       |     *
 2674|       |     * Note that the next ptr is where the data section starts.
 2675|       |     */
 2676|     13|    DEBUGDUMPHEADER("recv", "msgPrivacyParameters");
  ------------------
  |  |   79|     13|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     13|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      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: 13]
  |  |  ------------------
  ------------------
 2677|     13|    if ((*data_ptr
  ------------------
  |  Branch (2677:9): [True: 7, False: 6]
  ------------------
 2678|     13|         = asn_parse_string(next_ptr, &remaining_bytes, &type_value,
 2679|     13|                            salt, salt_length)) == NULL) {
 2680|      7|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      7|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      7|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 7]
  |  |  ------------------
  ------------------
 2681|       |        /*
 2682|       |         * RETURN parse error 
 2683|      7|         */ return -2;
 2684|      7|    }
 2685|      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]
  |  |  ------------------
  ------------------
 2686|       |
 2687|      6|    if (type_value !=
  ------------------
  |  Branch (2687:9): [True: 0, False: 6]
  ------------------
 2688|      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
  ------------------
 2689|       |        /*
 2690|       |         * RETURN parse error 
 2691|      0|         */ return -2;
 2692|      0|    }
 2693|       |
 2694|      6|    return 0;
 2695|       |
 2696|      6|}                               /* end usm_parse_security_parameters() */
snmpusm.c:usm_set_usmStateReference_name:
  356|      6|{
  357|       |    MAKE_ENTRY(ref, char, name, name_len, usr_name, usr_name_length);
  ------------------
  |  |  248|      6|#define MAKE_ENTRY(ref, type, item, len, field, field_len)      \
  |  |  249|      6|do {                                                            \
  |  |  250|      6|	if (ref == NULL)                                        \
  |  |  ------------------
  |  |  |  Branch (250:6): [True: 0, False: 6]
  |  |  ------------------
  |  |  251|      6|		return -1;                                      \
  |  |  252|      6|	if (ref->field != NULL)	{                               \
  |  |  ------------------
  |  |  |  Branch (252:6): [True: 0, False: 6]
  |  |  ------------------
  |  |  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|      6|	ref->field_len = 0;                                     \
  |  |  257|      6|        if (len == 0 || item == NULL)                           \
  |  |  ------------------
  |  |  |  Branch (257:13): [True: 6, False: 0]
  |  |  |  Branch (257:25): [True: 0, False: 0]
  |  |  ------------------
  |  |  258|      6|		return 0;                                       \
  |  |  259|      6|	ref->field = netsnmp_memdup(item, len * sizeof(type));  \
  |  |  260|      0|        if (ref->field == NULL)                                 \
  |  |  ------------------
  |  |  |  Branch (260:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  261|      0|		return -1;                                      \
  |  |  262|      0|                                                                \
  |  |  263|      0|	ref->field_len = len;                                   \
  |  |  264|      0|	return 0;                                               \
  |  |  265|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (265:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  358|      6|}
snmpusm.c:usm_set_usmStateReference_engine_id:
  364|      6|{
  365|       |    MAKE_ENTRY(ref, u_char, engine_id, engine_id_len,
  ------------------
  |  |  248|      6|#define MAKE_ENTRY(ref, type, item, len, field, field_len)      \
  |  |  249|      6|do {                                                            \
  |  |  250|      6|	if (ref == NULL)                                        \
  |  |  ------------------
  |  |  |  Branch (250:6): [True: 0, False: 6]
  |  |  ------------------
  |  |  251|      6|		return -1;                                      \
  |  |  252|      6|	if (ref->field != NULL)	{                               \
  |  |  ------------------
  |  |  |  Branch (252:6): [True: 0, False: 6]
  |  |  ------------------
  |  |  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|      6|	ref->field_len = 0;                                     \
  |  |  257|      6|        if (len == 0 || item == NULL)                           \
  |  |  ------------------
  |  |  |  Branch (257:13): [True: 0, False: 6]
  |  |  |  Branch (257:25): [True: 0, False: 6]
  |  |  ------------------
  |  |  258|      6|		return 0;                                       \
  |  |  259|      6|	ref->field = netsnmp_memdup(item, len * sizeof(type));  \
  |  |  260|      6|        if (ref->field == NULL)                                 \
  |  |  ------------------
  |  |  |  Branch (260:13): [True: 0, False: 6]
  |  |  ------------------
  |  |  261|      6|		return -1;                                      \
  |  |  262|      6|                                                                \
  |  |  263|      6|	ref->field_len = len;                                   \
  |  |  264|      6|	return 0;                                               \
  |  |  265|      6|} while (0)
  |  |  ------------------
  |  |  |  Branch (265:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  366|      6|               usr_engine_id, usr_engine_id_length);
  367|      6|}
snmpusm.c:usm_set_usmStateReference_sec_level:
  406|      6|{
  407|      6|    if (ref == NULL)
  ------------------
  |  Branch (407:9): [True: 0, False: 6]
  ------------------
  408|      0|        return -1;
  409|      6|    ref->usr_sec_level = sec_level;
  410|      6|    return 0;
  411|      6|}
snmpusm.c:usm_clone:
  300|     13|{
  301|     13|    struct usmStateReference *ref = pdu->securityStateRef;
  302|     13|    struct usmStateReference **new_ref =
  303|     13|        (struct usmStateReference **)&new_pdu->securityStateRef;
  304|     13|    int ret = 0;
  305|       |
  306|     13|    if (!ref)
  ------------------
  |  Branch (306:9): [True: 13, False: 0]
  ------------------
  307|     13|        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|        *new_ref = ref;
  313|      0|        ref->refcnt++;
  314|      0|    }
  315|       |
  316|      0|    return ret;
  317|     13|}
snmpusm.c:usm_free_usmStateReference:
  321|     54|{
  322|     54|    struct usmStateReference *ref = old;
  323|       |
  324|     54|    if (!ref)
  ------------------
  |  Branch (324:9): [True: 36, False: 18]
  ------------------
  325|     36|        return;
  326|       |
  327|     18|    if (--ref->refcnt > 0)
  ------------------
  |  Branch (327:9): [True: 0, False: 18]
  ------------------
  328|      0|        return;
  329|       |
  330|     18|    SNMP_FREE(ref->usr_name);
  ------------------
  |  |   62|     18|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 18]
  |  |  |  Branch (62:66): [Folded, False: 18]
  |  |  ------------------
  ------------------
  331|     18|    SNMP_FREE(ref->usr_engine_id);
  ------------------
  |  |   62|     18|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 6, False: 12]
  |  |  |  Branch (62:66): [Folded, False: 18]
  |  |  ------------------
  ------------------
  332|     18|    SNMP_FREE(ref->usr_auth_protocol);
  ------------------
  |  |   62|     18|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 18]
  |  |  |  Branch (62:66): [Folded, False: 18]
  |  |  ------------------
  ------------------
  333|     18|    SNMP_FREE(ref->usr_priv_protocol);
  ------------------
  |  |   62|     18|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 18]
  |  |  |  Branch (62:66): [Folded, False: 18]
  |  |  ------------------
  ------------------
  334|       |
  335|     18|    if (ref->usr_auth_key_length && ref->usr_auth_key) {
  ------------------
  |  Branch (335:9): [True: 0, False: 18]
  |  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|     18|    if (ref->usr_priv_key_length && ref->usr_priv_key) {
  ------------------
  |  Branch (339:9): [True: 0, False: 18]
  |  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|     18|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 18, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 18]
  |  |  ------------------
  ------------------
  345|     18|}                               /* end usm_free_usmStateReference() */
snmpusm.c:usm_session_init:
 3461|     57|{
 3462|     57|    char *cp;
 3463|     57|    size_t i;
 3464|       |    
 3465|     57|    if (in_session->securityAuthProtoLen > 0) {
  ------------------
  |  Branch (3465:9): [True: 0, False: 57]
  ------------------
 3466|      0|        session->securityAuthProto =
 3467|      0|            snmp_duplicate_objid(in_session->securityAuthProto,
 3468|      0|                                 in_session->securityAuthProtoLen);
 3469|      0|        if (session->securityAuthProto == NULL) {
  ------------------
  |  Branch (3469:13): [True: 0, False: 0]
  ------------------
 3470|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3471|      0|            return SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3472|      0|        }
 3473|     57|    } else if (get_default_authtype(&i) != NULL) {
  ------------------
  |  Branch (3473:16): [True: 57, False: 0]
  ------------------
 3474|     57|        session->securityAuthProto =
 3475|     57|            snmp_duplicate_objid(get_default_authtype(NULL), i);
 3476|     57|        session->securityAuthProtoLen = i;
 3477|     57|    }
 3478|       |
 3479|     57|    if (in_session->securityPrivProtoLen > 0) {
  ------------------
  |  Branch (3479:9): [True: 0, False: 57]
  ------------------
 3480|      0|        session->securityPrivProto =
 3481|      0|            snmp_duplicate_objid(in_session->securityPrivProto,
 3482|      0|                                 in_session->securityPrivProtoLen);
 3483|      0|        if (session->securityPrivProto == NULL) {
  ------------------
  |  Branch (3483:13): [True: 0, False: 0]
  ------------------
 3484|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3485|      0|            return SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3486|      0|        }
 3487|     57|    } else if (get_default_privtype(&i) != NULL) {
  ------------------
  |  Branch (3487:16): [True: 57, False: 0]
  ------------------
 3488|     57|        session->securityPrivProto =
 3489|     57|            snmp_duplicate_objid(get_default_privtype(NULL), i);
 3490|     57|        session->securityPrivProtoLen = i;
 3491|     57|    }
 3492|       |
 3493|     57|    if ((in_session->securityAuthKeyLen <= 0) &&
  ------------------
  |  Branch (3493:9): [True: 57, False: 0]
  ------------------
 3494|     57|        ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3494:9): [True: 0, False: 57]
  ------------------
 3495|     57|				     NETSNMP_DS_LIB_AUTHMASTERKEY)))) {
  ------------------
  |  |  167|     57|#define NETSNMP_DS_LIB_AUTHMASTERKEY     16
  ------------------
 3496|      0|        size_t buflen = sizeof(session->securityAuthKey);
 3497|      0|        u_char *tmpp = session->securityAuthKey;
 3498|      0|        session->securityAuthKeyLen = 0;
 3499|       |        /* it will be a hex string */
 3500|      0|        if (!snmp_hex_to_binary(&tmpp, &buflen,
  ------------------
  |  Branch (3500:13): [True: 0, False: 0]
  ------------------
 3501|      0|                                &session->securityAuthKeyLen, 0, cp)) {
 3502|      0|            snmp_set_detail("error parsing authentication master key");
 3503|      0|            return SNMP_ERR_GENERR;
  ------------------
  |  |  217|      0|#define SNMP_ERR_GENERR	                (5)
  ------------------
 3504|      0|        }
 3505|     57|    } else if ((in_session->securityAuthKeyLen <= 0) &&
  ------------------
  |  Branch (3505:16): [True: 57, False: 0]
  ------------------
 3506|     57|               ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3506:17): [True: 0, False: 57]
  ------------------
 3507|     57|                                            NETSNMP_DS_LIB_AUTHPASSPHRASE)) ||
  ------------------
  |  |  154|     57|#define NETSNMP_DS_LIB_AUTHPASSPHRASE    3
  ------------------
 3508|     57|                (cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3508:17): [True: 0, False: 57]
  ------------------
 3509|     57|                                            NETSNMP_DS_LIB_PASSPHRASE)))) {
  ------------------
  |  |  153|     57|#define NETSNMP_DS_LIB_PASSPHRASE        2
  ------------------
 3510|      0|        session->securityAuthKeyLen = USM_AUTH_KU_LEN;
  ------------------
  |  |  271|      0|#define USM_AUTH_KU_LEN     64
  ------------------
 3511|      0|        if (generate_Ku(session->securityAuthProto,
  ------------------
  |  Branch (3511:13): [True: 0, False: 0]
  ------------------
 3512|      0|                        session->securityAuthProtoLen,
 3513|      0|                        (u_char *) cp, strlen(cp),
 3514|      0|                        session->securityAuthKey,
 3515|      0|                        &session->securityAuthKeyLen) != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3516|      0|            snmp_set_detail
 3517|      0|                ("Error generating a key (Ku) from the supplied authentication pass phrase.");
 3518|      0|            return SNMP_ERR_GENERR;
  ------------------
  |  |  217|      0|#define SNMP_ERR_GENERR	                (5)
  ------------------
 3519|      0|        }
 3520|      0|    }
 3521|       |
 3522|       |    
 3523|     57|    if ((in_session->securityPrivKeyLen <= 0) &&
  ------------------
  |  Branch (3523:9): [True: 57, False: 0]
  ------------------
 3524|     57|        ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3524:9): [True: 0, False: 57]
  ------------------
 3525|     57|				     NETSNMP_DS_LIB_PRIVMASTERKEY)))) {
  ------------------
  |  |  168|     57|#define NETSNMP_DS_LIB_PRIVMASTERKEY     17
  ------------------
 3526|      0|        size_t buflen = sizeof(session->securityPrivKey);
 3527|      0|        u_char *tmpp = session->securityPrivKey;
 3528|      0|        session->securityPrivKeyLen = 0;
 3529|       |        /* it will be a hex string */
 3530|      0|        if (!snmp_hex_to_binary(&tmpp, &buflen,
  ------------------
  |  Branch (3530:13): [True: 0, False: 0]
  ------------------
 3531|      0|                                &session->securityPrivKeyLen, 0, cp)) {
 3532|      0|            snmp_set_detail("error parsing encryption master key");
 3533|      0|            return SNMP_ERR_GENERR;
  ------------------
  |  |  217|      0|#define SNMP_ERR_GENERR	                (5)
  ------------------
 3534|      0|        }
 3535|     57|    } else if ((in_session->securityPrivKeyLen <= 0) &&
  ------------------
  |  Branch (3535:16): [True: 57, False: 0]
  ------------------
 3536|     57|               ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3536:17): [True: 0, False: 57]
  ------------------
 3537|     57|                                            NETSNMP_DS_LIB_PRIVPASSPHRASE)) ||
  ------------------
  |  |  155|     57|#define NETSNMP_DS_LIB_PRIVPASSPHRASE    4
  ------------------
 3538|     57|                (cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3538:17): [True: 0, False: 57]
  ------------------
 3539|     57|                                            NETSNMP_DS_LIB_PASSPHRASE)))) {
  ------------------
  |  |  153|     57|#define NETSNMP_DS_LIB_PASSPHRASE        2
  ------------------
 3540|      0|        session->securityPrivKeyLen = USM_PRIV_KU_LEN;
  ------------------
  |  |  272|      0|#define USM_PRIV_KU_LEN     64
  ------------------
 3541|      0|        if (generate_Ku(session->securityAuthProto,
  ------------------
  |  Branch (3541:13): [True: 0, False: 0]
  ------------------
 3542|      0|                        session->securityAuthProtoLen,
 3543|      0|                        (u_char *) cp, strlen(cp),
 3544|      0|                        session->securityPrivKey,
 3545|      0|                        &session->securityPrivKeyLen) != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3546|      0|            snmp_set_detail
 3547|      0|                ("Error generating a key (Ku) from the supplied privacy pass phrase.");
 3548|      0|            return SNMP_ERR_GENERR;
  ------------------
  |  |  217|      0|#define SNMP_ERR_GENERR	                (5)
  ------------------
 3549|      0|        }
 3550|      0|    }
 3551|       |
 3552|     57|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3553|     57|}
snmpusm.c:usm_handle_report:
 3384|     18|{
 3385|       |    /*
 3386|       |     * handle reportable errors 
 3387|       |     */
 3388|       |
 3389|       |    /* this will get in our way */
 3390|     18|    usm_free_usmStateReference(pdu->securityStateRef);
 3391|     18|    pdu->securityStateRef = NULL;
 3392|       |
 3393|     18|    switch (result) {
  ------------------
  |  Branch (3393:13): [True: 13, False: 5]
  ------------------
 3394|      0|    case SNMPERR_USM_AUTHENTICATIONFAILURE:
  ------------------
  |  |  230|      0|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
  |  Branch (3394:5): [True: 0, False: 18]
  ------------------
 3395|      0|    {
 3396|      0|        int res = session->s_snmp_errno;
 3397|      0|        session->s_snmp_errno = result;
 3398|      0|        if (session->callback) {
  ------------------
  |  Branch (3398:13): [True: 0, False: 0]
  ------------------
 3399|      0|            session->callback(NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE,
  ------------------
  |  |  319|      0|#define NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE	1
  ------------------
 3400|      0|                              session, pdu->reqid, pdu,
 3401|      0|                              session->callback_magic);
 3402|      0|        }
 3403|      0|        session->s_snmp_errno = res;
 3404|      0|    }  
 3405|      0|    NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2440|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 3406|      6|    case SNMPERR_USM_UNKNOWNENGINEID:
  ------------------
  |  |  232|      6|#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
  ------------------
  |  Branch (3406:5): [True: 6, False: 12]
  ------------------
 3407|      6|    case SNMPERR_USM_UNKNOWNSECURITYNAME:
  ------------------
  |  |  227|      6|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (3407:5): [True: 0, False: 18]
  ------------------
 3408|      6|    case SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL:
  ------------------
  |  |  228|      6|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
  |  Branch (3408:5): [True: 0, False: 18]
  ------------------
 3409|      6|    case SNMPERR_USM_NOTINTIMEWINDOW:
  ------------------
  |  |  233|      6|#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
  ------------------
  |  Branch (3409:5): [True: 0, False: 18]
  ------------------
 3410|     13|    case SNMPERR_USM_DECRYPTIONERROR:
  ------------------
  |  |  234|     13|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
  |  Branch (3410:5): [True: 7, False: 11]
  ------------------
 3411|       |
 3412|     13|        if (SNMP_CMD_CONFIRMED(pdu->command) ||
  ------------------
  |  |  193|     26|#define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
  |  |  ------------------
  |  |  |  |  141|     26|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
  |  |  ------------------
  |  |  |  |  140|     26|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (193:32): [True: 0, False: 13]
  |  |  |  Branch (193:56): [True: 0, False: 13]
  |  |  ------------------
  |  |  194|     13|                               c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
  |  |  ------------------
  |  |  |  |  126|     26|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                              c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
  |  |  ------------------
  |  |  |  |  125|     26|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (194:32): [True: 0, False: 13]
  |  |  |  Branch (194:57): [True: 0, False: 13]
  |  |  ------------------
  |  |  195|     26|                               c == SNMP_MSG_SET )
  |  |  ------------------
  |  |  |  |  129|     26|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|     13|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|     13|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (195:32): [True: 0, False: 13]
  |  |  ------------------
  ------------------
 3413|     13|            (pdu->command == 0
  ------------------
  |  Branch (3413:14): [True: 13, False: 0]
  ------------------
 3414|     13|             && (pdu->flags & SNMP_MSG_FLAG_RPRT_BIT))) {
  ------------------
  |  |  305|     13|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3414:17): [True: 13, False: 0]
  ------------------
 3415|     13|            netsnmp_pdu    *pdu2;
 3416|     13|            int             flags = pdu->flags;
 3417|       |
 3418|     13|            pdu->flags |= UCD_MSG_FLAG_FORCE_PDU_COPY;
  ------------------
  |  |  313|     13|#define UCD_MSG_FLAG_FORCE_PDU_COPY          0x400
  ------------------
 3419|     13|            pdu2 = snmp_clone_pdu(pdu);
 3420|     13|            pdu->flags = pdu2->flags = flags;
 3421|     13|            snmpv3_make_report(pdu2, result);
 3422|     13|            if (0 == snmp_sess_send(slp, pdu2)) {
  ------------------
  |  Branch (3422:17): [True: 0, False: 13]
  ------------------
 3423|      0|                snmp_free_pdu(pdu2);
 3424|       |                /*
 3425|       |                 * TODO: indicate error 
 3426|       |                 */
 3427|      0|            }
 3428|     13|        }
 3429|     13|        break;
 3430|     18|    }       
 3431|     18|}
snmpusm.c:init_usm_post_config:
 5191|     57|{
 5192|     57|    size_t          salt_integer_len = sizeof(salt_integer);
 5193|     57|    uint64_t        current_time;
 5194|       |
 5195|     57|    if (sc_random((u_char *) & salt_integer, &salt_integer_len) !=
  ------------------
  |  Branch (5195:9): [True: 0, False: 57]
  ------------------
 5196|     57|        SNMPERR_SUCCESS) {
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5197|      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]
  |  |  ------------------
  ------------------
 5198|      0|        current_time = time(NULL);
 5199|      0|        salt_integer = current_time;
 5200|      0|    }
 5201|       |
 5202|     57|#ifdef HAVE_AES
 5203|     57|    salt_integer_len = sizeof (salt_integer64_1);
 5204|     57|    if (sc_random((u_char *) & salt_integer64_1, &salt_integer_len) !=
  ------------------
  |  Branch (5204:9): [True: 0, False: 57]
  ------------------
 5205|     57|        SNMPERR_SUCCESS) {
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5206|      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]
  |  |  ------------------
  ------------------
 5207|      0|        current_time = time(NULL);
 5208|      0|        salt_integer64_1 = current_time;
 5209|      0|    }
 5210|     57|    salt_integer_len = sizeof (salt_integer64_1);
 5211|     57|    if (sc_random((u_char *) & salt_integer64_2, &salt_integer_len) !=
  ------------------
  |  Branch (5211:9): [True: 0, False: 57]
  ------------------
 5212|     57|        SNMPERR_SUCCESS) {
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5213|      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]
  |  |  ------------------
  ------------------
 5214|      0|        current_time = time(NULL);
 5215|      0|        salt_integer64_2 = current_time;
 5216|      0|    }
 5217|     57|#endif
 5218|       |
 5219|       |    // Free noNameUser before it is assigned
 5220|     57|    usm_free_user(noNameUser);
 5221|       |
 5222|     57|#ifndef NETSNMP_DISABLE_MD5
 5223|     57|    noNameUser = usm_create_initial_user("", usmHMACMD5AuthProtocol,
 5224|     57|                                         OID_LENGTH(usmHMACMD5AuthProtocol),
  ------------------
  |  |   64|     57|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     57|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 5225|     57|                                         SNMP_DEFAULT_PRIV_PROTO,
  ------------------
  |  |  100|     57|#define SNMP_DEFAULT_PRIV_PROTO     usmDESPrivProtocol
  ------------------
 5226|     57|                                         SNMP_DEFAULT_PRIV_PROTOLEN);
  ------------------
  |  |  104|     57|#define SNMP_DEFAULT_PRIV_PROTOLEN  OID_LENGTH(SNMP_DEFAULT_PRIV_PROTO)
  |  |  ------------------
  |  |  |  |   64|     57|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |  |  |   65|     57|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  |  |  ------------------
  ------------------
 5227|       |#else
 5228|       |    noNameUser = usm_create_initial_user("", usmHMACSHA1AuthProtocol,
 5229|       |                                         OID_LENGTH(usmHMACSHA1AuthProtocol),
 5230|       |                                         SNMP_DEFAULT_PRIV_PROTO,
 5231|       |                                         SNMP_DEFAULT_PRIV_PROTOLEN);
 5232|       |#endif
 5233|       |
 5234|     57|    if ( noNameUser ) {
  ------------------
  |  Branch (5234:10): [True: 57, False: 0]
  ------------------
 5235|     57|        SNMP_FREE(noNameUser->engineID);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
 5236|     57|        noNameUser->engineIDLen = 0;
 5237|     57|    }
 5238|       |
 5239|     57|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5240|     57|}                               /* end init_usm_post_config() */
snmpusm.c:usm_create_initial_user:
 4199|     57|{
 4200|     57|    struct usmUser *newUser = usm_create_user();
 4201|     57|    if (newUser == NULL)
  ------------------
  |  Branch (4201:9): [True: 0, False: 57]
  ------------------
 4202|      0|        return NULL;
 4203|       |
 4204|     57|    if ((newUser->name = strdup(name)) == NULL)
  ------------------
  |  Branch (4204:9): [True: 0, False: 57]
  ------------------
 4205|      0|        return usm_free_user(newUser);
 4206|       |
 4207|     57|    if ((newUser->secName = strdup(name)) == NULL)
  ------------------
  |  Branch (4207:9): [True: 0, False: 57]
  ------------------
 4208|      0|        return usm_free_user(newUser);
 4209|       |
 4210|     57|    if ((newUser->engineID =
  ------------------
  |  Branch (4210:9): [True: 0, False: 57]
  ------------------
 4211|     57|         snmpv3_generate_engineID(&newUser->engineIDLen)) == NULL)
 4212|      0|        return usm_free_user(newUser);
 4213|       |
 4214|     57|    if ((newUser->cloneFrom = (oid *) malloc(sizeof(oid) * 2)) == NULL)
  ------------------
  |  Branch (4214:9): [True: 0, False: 57]
  ------------------
 4215|      0|        return usm_free_user(newUser);
 4216|     57|    newUser->cloneFrom[0] = 0;
 4217|     57|    newUser->cloneFrom[1] = 0;
 4218|     57|    newUser->cloneFromLen = 2;
 4219|       |
 4220|     57|    SNMP_FREE(newUser->privProtocol);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
 4221|     57|    if ((newUser->privProtocol = snmp_duplicate_objid(privProtocol,
  ------------------
  |  Branch (4221:9): [True: 0, False: 57]
  ------------------
 4222|     57|                                                      privProtocolLen)) ==
 4223|     57|        NULL) {
 4224|      0|        return usm_free_user(newUser);
 4225|      0|    }
 4226|     57|    newUser->privProtocolLen = privProtocolLen;
 4227|       |
 4228|     57|    SNMP_FREE(newUser->authProtocol);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
 4229|     57|    if ((newUser->authProtocol = snmp_duplicate_objid(authProtocol,
  ------------------
  |  Branch (4229:9): [True: 0, False: 57]
  ------------------
 4230|     57|                                                      authProtocolLen)) ==
 4231|     57|        NULL) {
 4232|      0|        return usm_free_user(newUser);
 4233|      0|    }
 4234|     57|    newUser->authProtocolLen = authProtocolLen;
 4235|       |
 4236|     57|    newUser->userStatus = RS_ACTIVE;
  ------------------
  |  |   35|     57|#define RS_ACTIVE	        1
  ------------------
 4237|     57|    newUser->userStorageType = ST_READONLY;
  ------------------
  |  |   54|     57|#define ST_READONLY	5
  ------------------
 4238|       |
 4239|     57|    return newUser;
 4240|     57|}
snmpusm.c:deinit_usm_post_config:
 5245|     57|{
 5246|     57|    usm_free_user(noNameUser);
 5247|     57|    noNameUser = NULL;
 5248|       |
 5249|     57|    DEBUGMSGTL(("deinit_usm_post_config", "initial user removed\n"));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 5250|     57|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5251|     57|}                               /* end deinit_usm_post_config() */
snmpusm.c:free_enginetime_on_shutdown:
  274|     57|{
  275|     57|    u_char engineID[SNMP_MAX_ENG_SIZE];
  276|     57|    size_t engineID_len = sizeof(engineID);
  277|       |
  278|     57|    DEBUGMSGTL(("snmpv3", "free enginetime callback called\n"));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
  279|       |
  280|     57|    engineID_len = snmpv3_get_engineID(engineID, engineID_len);
  281|     57|    if (engineID_len > 0)
  ------------------
  |  Branch (281:9): [True: 0, False: 57]
  ------------------
  282|      0|	free_enginetime(engineID, engineID_len);
  283|     57|    return 0;
  284|     57|}
snmpusm.c:clear_user_list:
 4047|     57|{
 4048|     57|    struct usmUser *tmp = userList, *next = NULL;
 4049|       |
 4050|     57|    while (tmp != NULL) {
  ------------------
  |  Branch (4050:12): [True: 0, False: 57]
  ------------------
 4051|      0|	next = tmp->next;
 4052|      0|	usm_free_user(tmp);
 4053|      0|	tmp = next;
 4054|      0|    }
 4055|     57|    userList = NULL;
 4056|       |
 4057|     57|}

setup_engineID:
  471|     57|{
  472|     57|    int             enterpriseid = htonl(NETSNMP_ENTERPRISE_OID),
  473|     57|        netsnmpoid = htonl(NETSNMP_OID),
  474|     57|        localsetup = (eidp) ? 0 : 1;
  ------------------
  |  Branch (474:22): [True: 0, False: 57]
  ------------------
  475|       |
  476|       |    /*
  477|       |     * Use local engineID if *eidp == NULL.  
  478|       |     */
  479|     57|#ifdef HAVE_GETHOSTNAME
  480|     57|    u_char          buf[SNMP_MAXBUF_SMALL];
  481|     57|    struct hostent *hent = NULL;
  482|     57|#endif
  483|     57|    u_char         *bufp = NULL;
  484|     57|    size_t          len;
  485|     57|    int             localEngineIDType = engineIDType;
  486|     57|    int             tmpint;
  487|     57|    time_t          tmptime;
  488|       |
  489|     57|    engineIDIsSet = 1;
  490|       |
  491|     57|#ifdef HAVE_GETHOSTNAME
  492|     57|#ifdef AF_INET6
  493|       |    /*
  494|       |     * see if they selected IPV4 or IPV6 support 
  495|       |     */
  496|     57|    if ((ENGINEID_TYPE_IPV6 == localEngineIDType) ||
  ------------------
  |  |   20|     57|#define ENGINEID_TYPE_IPV6    2
  ------------------
  |  Branch (496:9): [True: 0, False: 57]
  ------------------
  497|     57|        (ENGINEID_TYPE_IPV4 == localEngineIDType)) {
  ------------------
  |  |   19|     57|#define ENGINEID_TYPE_IPV4    1
  ------------------
  |  Branch (497:9): [True: 0, False: 57]
  ------------------
  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|     57|#endif                          /* HAVE_GETHOSTNAME */
  529|       |
  530|       |    /*
  531|       |     * Determine if we have text and if so setup our localEngineIDType
  532|       |     * * appropriately.  
  533|       |     */
  534|     57|    if (NULL != text) {
  ------------------
  |  Branch (534:9): [True: 0, False: 57]
  ------------------
  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|     57|    len = 5;                    /* always have 5 leading bytes */
  541|     57|    switch (localEngineIDType) {
  542|      0|    case ENGINEID_TYPE_TEXT:
  ------------------
  |  |   22|      0|#define ENGINEID_TYPE_TEXT    4
  ------------------
  |  Branch (542:5): [True: 0, False: 57]
  ------------------
  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: 57]
  ------------------
  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: 57]
  ------------------
  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: 57]
  ------------------
  559|      0|        len += 16;              /* + 16 byte IPV6 address */
  560|      0|        break;
  561|     57|    case ENGINEID_TYPE_NETSNMP_RND:        /* Net-SNMP specific encoding */
  ------------------
  |  |   24|     57|#define ENGINEID_TYPE_NETSNMP_RND 128
  ------------------
  |  Branch (561:5): [True: 57, False: 0]
  ------------------
  562|     57|        if (engineID)           /* already setup, keep current value */
  ------------------
  |  Branch (562:13): [True: 0, False: 57]
  ------------------
  563|      0|            return engineIDLength;
  564|     57|        if (oldEngineID) {
  ------------------
  |  Branch (564:13): [True: 0, False: 57]
  ------------------
  565|      0|            len = oldEngineIDLength;
  566|     57|        } else {
  567|     57|            len += sizeof(int) + sizeof(time_t);
  568|     57|        }
  569|     57|        break;
  570|      0|    default:
  ------------------
  |  Branch (570:5): [True: 0, False: 57]
  ------------------
  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|     57|    }                           /* switch */
  578|       |
  579|       |
  580|       |    /*
  581|       |     * Allocate memory and store enterprise ID.
  582|       |     */
  583|     57|    if (len == 0) {
  ------------------
  |  Branch (583:9): [True: 0, False: 57]
  ------------------
  584|      0|        snmp_log(LOG_ERR, "%s(): len == 0\n", __func__);
  585|      0|        return -1;
  586|      0|    }
  587|     57|    bufp = calloc(1, len);
  588|     57|    if (bufp == NULL) {
  ------------------
  |  Branch (588:9): [True: 0, False: 57]
  ------------------
  589|      0|        snmp_log_perror("setup_engineID() calloc()");
  590|      0|        return -1;
  591|      0|    }
  592|     57|    if (localEngineIDType == ENGINEID_TYPE_NETSNMP_RND)
  ------------------
  |  |   24|     57|#define ENGINEID_TYPE_NETSNMP_RND 128
  ------------------
  |  Branch (592:9): [True: 57, False: 0]
  ------------------
  593|       |        /*
  594|       |         * we must use the net-snmp enterprise id here, regardless 
  595|       |         */
  596|     57|        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|     57|    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|     57|    switch (localEngineIDType) {
  609|     57|    case ENGINEID_TYPE_NETSNMP_RND:
  ------------------
  |  |   24|     57|#define ENGINEID_TYPE_NETSNMP_RND 128
  ------------------
  |  Branch (609:5): [True: 57, False: 0]
  ------------------
  610|     57|        if (oldEngineID) {
  ------------------
  |  Branch (610:13): [True: 0, False: 57]
  ------------------
  611|       |            /*
  612|       |             * keep our previous notion of the engineID 
  613|       |             */
  614|      0|            memcpy(bufp, oldEngineID, oldEngineIDLength);
  615|     57|        } 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|     57|            bufp[4] = ENGINEID_TYPE_NETSNMP_RND;
  ------------------
  |  |   24|     57|#define ENGINEID_TYPE_NETSNMP_RND 128
  ------------------
  628|     57|            tmpint = netsnmp_random();
  629|     57|            memcpy(bufp + 5, &tmpint, sizeof(tmpint));
  630|     57|            tmptime = time(NULL);
  631|     57|            memcpy(bufp + 5 + sizeof(tmpint), &tmptime, sizeof(tmptime));
  632|     57|        }
  633|     57|        break;
  634|      0|    case ENGINEID_TYPE_TEXT:
  ------------------
  |  |   22|      0|#define ENGINEID_TYPE_TEXT    4
  ------------------
  |  Branch (634:5): [True: 0, False: 57]
  ------------------
  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: 57]
  ------------------
  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: 57]
  ------------------
  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: 57]
  ------------------
  671|      0|    default:
  ------------------
  |  Branch (671:5): [True: 0, False: 57]
  ------------------
  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|     57|    }
  694|       |
  695|       |    /*
  696|       |     * Pass the string back to the calling environment, or use it for
  697|       |     * our local engineID.
  698|       |     */
  699|     57|    if (localsetup) {
  ------------------
  |  Branch (699:9): [True: 57, False: 0]
  ------------------
  700|     57|        SNMP_FREE(engineID);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 57]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  701|     57|        engineID = bufp;
  702|     57|        engineIDLength = len;
  703|       |
  704|     57|    } else {
  705|      0|        *eidp = bufp;
  706|      0|    }
  707|       |
  708|       |
  709|     57|    return len;
  710|       |
  711|     57|}                               /* end setup_engineID() */
free_engineID:
  716|     57|{
  717|     57|    SNMP_FREE(engineID);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  718|     57|    SNMP_FREE(engineIDNic);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 57]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  719|       |    SNMP_FREE(oldEngineID);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 57]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
  720|     57|    engineIDIsSet = 0;
  721|     57|    return 0;
  722|     57|}
init_snmpv3:
  988|     57|{
  989|     57|    netsnmp_get_monotonic_clock(&snmpv3starttime);
  990|       |
  991|     57|    if (!type)
  ------------------
  |  Branch (991:9): [True: 0, False: 57]
  ------------------
  992|      0|        type = "__snmpapp__";
  993|       |
  994|       |    /*
  995|       |     * we need to be called back later 
  996|       |     */
  997|     57|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
  998|     57|                           SNMP_CALLBACK_POST_READ_CONFIG,
  ------------------
  |  |   24|     57|#define SNMP_CALLBACK_POST_READ_CONFIG	        0
  ------------------
  999|     57|                           init_snmpv3_post_config, NULL);
 1000|       |
 1001|     57|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1002|     57|                           SNMP_CALLBACK_POST_PREMIB_READ_CONFIG,
  ------------------
  |  |   27|     57|#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG	3
  ------------------
 1003|     57|                           init_snmpv3_post_premib_config, NULL);
 1004|       |    /*
 1005|       |     * we need to be called back later 
 1006|       |     */
 1007|     57|    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
                  snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
  ------------------
  |  |   25|     57|#define SNMP_CALLBACK_STORE_DATA	        1
  ------------------
 1008|     57|                           snmpv3_store, (void *) strdup(type));
 1009|       |
 1010|       |    /*
 1011|       |     * initialize submodules 
 1012|       |     */
 1013|       |    /*
 1014|       |     * NOTE: this must be after the callbacks are registered above,
 1015|       |     * since they need to be called before the USM callbacks. 
 1016|       |     */
 1017|     57|    init_secmod();
 1018|       |
 1019|       |    /*
 1020|       |     * register all our configuration handlers (ack, there's a lot) 
 1021|       |     */
 1022|       |
 1023|       |    /*
 1024|       |     * handle engineID setup before everything else which may depend on it 
 1025|       |     */
 1026|     57|    register_prenetsnmp_mib_handler(type, "engineID", engineID_conf, NULL,
 1027|     57|                                    "string");
 1028|     57|    register_prenetsnmp_mib_handler(type, "oldEngineID", oldengineID_conf,
 1029|     57|                                    NULL, NULL);
 1030|     57|    register_prenetsnmp_mib_handler(type, "exactEngineID", exactEngineID_conf,
 1031|     57|                                    NULL, NULL);
 1032|     57|    register_prenetsnmp_mib_handler(type, "engineIDType",
 1033|     57|                                    engineIDType_conf, NULL, "num");
 1034|     57|    register_prenetsnmp_mib_handler(type, "engineIDNic", engineIDNic_conf,
 1035|     57|                                    NULL, "string");
 1036|     57|    register_config_handler(type, "engineBoots", engineBoots_conf, NULL,
 1037|     57|                            NULL);
 1038|       |
 1039|       |    /*
 1040|       |     * default store config entries 
 1041|       |     */
 1042|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defSecurityName",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
 1043|     57|			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECNAME);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECNAME);
  ------------------
  |  |  151|     57|#define NETSNMP_DS_LIB_SECNAME           0
  ------------------
 1044|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defContext", 
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
 1045|     57|			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CONTEXT);
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CONTEXT);
  ------------------
  |  |  152|     57|#define NETSNMP_DS_LIB_CONTEXT           1
  ------------------
 1046|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defPassphrase",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
 1047|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1048|     57|                               NETSNMP_DS_LIB_PASSPHRASE);
  ------------------
  |  |  153|     57|#define NETSNMP_DS_LIB_PASSPHRASE        2
  ------------------
 1049|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defAuthPassphrase",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
 1050|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1051|     57|                               NETSNMP_DS_LIB_AUTHPASSPHRASE);
  ------------------
  |  |  154|     57|#define NETSNMP_DS_LIB_AUTHPASSPHRASE    3
  ------------------
 1052|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defPrivPassphrase",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
 1053|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1054|     57|                               NETSNMP_DS_LIB_PRIVPASSPHRASE);
  ------------------
  |  |  155|     57|#define NETSNMP_DS_LIB_PRIVPASSPHRASE    4
  ------------------
 1055|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defAuthMasterKey",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
 1056|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1057|     57|                               NETSNMP_DS_LIB_AUTHMASTERKEY);
  ------------------
  |  |  167|     57|#define NETSNMP_DS_LIB_AUTHMASTERKEY     16
  ------------------
 1058|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defPrivMasterKey",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
 1059|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1060|     57|                               NETSNMP_DS_LIB_PRIVMASTERKEY);
  ------------------
  |  |  168|     57|#define NETSNMP_DS_LIB_PRIVMASTERKEY     17
  ------------------
 1061|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defAuthLocalizedKey",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
 1062|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1063|     57|                               NETSNMP_DS_LIB_AUTHLOCALIZEDKEY);
  ------------------
  |  |  169|     57|#define NETSNMP_DS_LIB_AUTHLOCALIZEDKEY  18
  ------------------
 1064|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defPrivLocalizedKey",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
 1065|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1066|     57|                               NETSNMP_DS_LIB_PRIVLOCALIZEDKEY);
  ------------------
  |  |  170|     57|#define NETSNMP_DS_LIB_PRIVLOCALIZEDKEY  19
  ------------------
 1067|     57|    register_config_handler("snmp", "defVersion", version_conf, NULL,
 1068|     57|                            "1|2c|3");
 1069|       |
 1070|     57|    register_config_handler("snmp", "defSecurityLevel",
 1071|       |                            snmpv3_secLevel_conf, NULL,
 1072|     57|                            "noAuthNoPriv|authNoPriv|authPriv");
 1073|     57|}
init_snmpv3_post_config:
 1083|     57|{
 1084|       |
 1085|     57|    size_t          engineIDLen;
 1086|     57|    u_char         *c_engineID;
 1087|     57|    u_long          localEngineTime;
 1088|     57|    u_long          localEngineBoots;
 1089|       |
 1090|     57|    c_engineID = snmpv3_generate_engineID(&engineIDLen);
 1091|       |
 1092|     57|    if (!c_engineID || engineIDLen == 0) {
  ------------------
  |  Branch (1092:9): [True: 0, False: 57]
  |  Branch (1092:24): [True: 0, False: 57]
  ------------------
 1093|       |        /*
 1094|       |         * Something went wrong - help! 
 1095|       |         */
 1096|      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]
  |  |  ------------------
  ------------------
 1097|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1098|      0|    }
 1099|       |
 1100|       |    /*
 1101|       |     * if our engineID has changed at all, the boots record must be set to 1 
 1102|       |     */
 1103|     57|    if (engineIDLen != oldEngineIDLength ||
  ------------------
  |  Branch (1103:9): [True: 57, False: 0]
  ------------------
 1104|      0|        oldEngineID == NULL || c_engineID == NULL ||
  ------------------
  |  Branch (1104:9): [True: 0, False: 0]
  |  Branch (1104:32): [True: 0, False: 0]
  ------------------
 1105|     57|        memcmp(oldEngineID, c_engineID, engineIDLen) != 0) {
  ------------------
  |  Branch (1105:9): [True: 0, False: 0]
  ------------------
 1106|     57|        engineBoots = 1;
 1107|     57|    }
 1108|       |
 1109|     57|#ifdef NETSNMP_SECMOD_USM
 1110|       |    /*
 1111|       |     * for USM set our local engineTime in the LCD timing cache 
 1112|       |     */
 1113|     57|    localEngineTime = snmpv3_local_snmpEngineTime();
 1114|     57|    localEngineBoots = snmpv3_local_snmpEngineBoots();
 1115|     57|    set_enginetime(c_engineID, engineIDLen,
 1116|     57|                   localEngineBoots,
 1117|     57|                   localEngineTime, TRUE);
  ------------------
  |  |  128|     57|#define TRUE  1
  ------------------
 1118|     57|#endif /* NETSNMP_SECMOD_USM */
 1119|       |
 1120|     57|    SNMP_FREE(c_engineID);
  ------------------
  |  |   62|     57|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 57, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 57]
  |  |  ------------------
  ------------------
 1121|     57|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1122|     57|}
init_snmpv3_post_premib_config:
 1127|     57|{
 1128|     57|    if (!engineIDIsSet)
  ------------------
  |  Branch (1128:9): [True: 57, False: 0]
  ------------------
 1129|     57|        setup_engineID(NULL, NULL);
 1130|       |
 1131|     57|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1132|     57|}
snmpv3_store:
 1142|     57|{
 1143|     57|    char            line[SNMP_MAXBUF_SMALL];
 1144|     57|    u_char          c_engineID[SNMP_MAXBUF_SMALL];
 1145|     57|    int             engineIDLen;
 1146|     57|    const char     *type = (const char *) clientarg;
 1147|       |
 1148|     57|    if (type == NULL)           /* should never happen, since the arg is ours */
  ------------------
  |  Branch (1148:9): [True: 0, False: 57]
  ------------------
 1149|      0|        type = "unknown";
 1150|       |
 1151|     57|    sprintf(line, "engineBoots %ld", engineBoots);
 1152|     57|    read_config_store(type, line);
 1153|       |
 1154|     57|    engineIDLen = snmpv3_get_engineID(c_engineID, SNMP_MAXBUF_SMALL);
  ------------------
  |  |   45|     57|#define SNMP_MAXBUF_SMALL	512
  ------------------
 1155|       |
 1156|     57|    if (engineIDLen) {
  ------------------
  |  Branch (1156:9): [True: 57, False: 0]
  ------------------
 1157|       |        /*
 1158|       |         * store the engineID used for this run 
 1159|       |         */
 1160|     57|        sprintf(line, "oldEngineID ");
 1161|     57|        read_config_save_octet_string(line + strlen(line), c_engineID,
 1162|     57|                                      engineIDLen);
 1163|     57|        read_config_store(type, line);
 1164|     57|    }
 1165|     57|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1166|     57|}                               /* snmpv3_store() */
snmpv3_local_snmpEngineBoots:
 1170|     57|{
 1171|     57|    return engineBoots;
 1172|     57|}
snmpv3_get_engineID:
 1192|    254|{
 1193|       |    /*
 1194|       |     * Sanity check.
 1195|       |     */
 1196|    254|    if (!buf || (buflen < engineIDLength)) {
  ------------------
  |  Branch (1196:9): [True: 0, False: 254]
  |  Branch (1196:17): [True: 0, False: 254]
  ------------------
 1197|      0|        return 0;
 1198|      0|    }
 1199|    254|    if (!engineID) {
  ------------------
  |  Branch (1199:9): [True: 57, False: 197]
  ------------------
 1200|     57|        return 0;
 1201|     57|    }
 1202|       |
 1203|    197|    memcpy(buf, engineID, engineIDLength);
 1204|    197|    return engineIDLength;
 1205|       |
 1206|    254|}                               /* end snmpv3_get_engineID() */
snmpv3_generate_engineID:
 1262|    140|{
 1263|    140|    u_char         *newID;
 1264|    140|    newID = (u_char *) malloc(engineIDLength);
 1265|       |
 1266|    140|    if (newID) {
  ------------------
  |  Branch (1266:9): [True: 140, False: 0]
  ------------------
 1267|    140|        *length = snmpv3_get_engineID(newID, engineIDLength);
 1268|    140|        if (*length == 0) {
  ------------------
  |  Branch (1268:13): [True: 0, False: 140]
  ------------------
 1269|      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]
  |  |  ------------------
  ------------------
 1270|      0|            newID = NULL;
 1271|      0|        }
 1272|    140|    }
 1273|    140|    return newID;
 1274|       |
 1275|    140|}                               /* end snmpv3_generate_engineID() */
snmpv3_local_snmpEngineTime:
 1289|    127|{
 1290|       |#ifdef NETSNMP_FEATURE_CHECKING
 1291|       |    netsnmp_feature_require(calculate_sectime_diff)
 1292|       |#endif /* NETSNMP_FEATURE_CHECKING */
 1293|       |
 1294|    127|    static uint32_t last_engineTime;
 1295|    127|    struct timeval  now;
 1296|    127|    uint32_t engineTime;
 1297|       |
 1298|    127|    netsnmp_get_monotonic_clock(&now);
 1299|    127|    engineTime = calculate_sectime_diff(&now, &snmpv3starttime) & 0x7fffffffL;
 1300|    127|    if (engineTime < last_engineTime)
  ------------------
  |  Branch (1300:9): [True: 0, False: 127]
  ------------------
 1301|      0|        engineBoots++;
 1302|    127|    last_engineTime = engineTime;
 1303|    127|    return engineTime;
 1304|    127|}

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

netsnmp_gethostbyname_v4:
  773|     57|{
  774|     57|#ifdef HAVE_GETADDRINFO
  775|     57|    struct addrinfo *addrs = NULL;
  776|     57|    struct addrinfo hint;
  777|     57|    int             err;
  778|       |
  779|     57|    memset(&hint, 0, sizeof hint);
  780|     57|    hint.ai_flags = 0;
  781|     57|    hint.ai_family = PF_INET;
  782|     57|    hint.ai_socktype = SOCK_DGRAM;
  783|     57|    hint.ai_protocol = 0;
  784|       |
  785|     57|    err = netsnmp_getaddrinfo(name, NULL, &hint, &addrs);
  786|     57|    if (err != 0) {
  ------------------
  |  Branch (786:9): [True: 0, False: 57]
  ------------------
  787|      0|        return -1;
  788|      0|    }
  789|       |
  790|     57|    if (addrs != NULL) {
  ------------------
  |  Branch (790:9): [True: 57, False: 0]
  ------------------
  791|     57|        memcpy(addr_out,
  792|     57|               &((struct sockaddr_in *) addrs->ai_addr)->sin_addr,
  793|     57|               sizeof(in_addr_t));
  794|     57|        freeaddrinfo(addrs);
  795|     57|    } 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|     57|    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|     57|}
netsnmp_getaddrinfo:
  843|     57|{
  844|     57|#ifdef HAVE_GETADDRINFO
  845|     57|    struct addrinfo *addrs = NULL;
  846|     57|    struct addrinfo hint;
  847|     57|    int             err;
  848|       |#ifdef DNSSEC_LOCAL_VALIDATION
  849|       |    val_status_t    val_status;
  850|       |#endif
  851|       |
  852|     57|    DEBUGMSGTL(("dns:getaddrinfo", "looking up "));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
  853|     57|    if (name)
  ------------------
  |  Branch (853:9): [True: 57, False: 0]
  ------------------
  854|     57|        DEBUGMSG(("dns:getaddrinfo", "\"%s\"", name));
  ------------------
  |  |   61|     57|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 57]
  |  |  ------------------
  ------------------
  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|     57|    if (service)
  ------------------
  |  Branch (858:9): [True: 0, False: 57]
  ------------------
  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|     57|    if (hints)
  ------------------
  |  Branch (861:9): [True: 57, False: 0]
  ------------------
  862|     57|	DEBUGMSG(("dns:getaddrinfo",
  ------------------
  |  |   61|     57|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  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: 57]
  |  |  ------------------
  ------------------
  863|     57|                  " with hints ({.ai_flags = %#x, .ai_family = %s})",
  864|     57|                  hints->ai_flags, hints->ai_family == 0 ? "0" :
  865|     57|                  hints->ai_family == AF_INET ? "AF_INET" :
  866|     57|                  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|     57|    DEBUGMSG(("dns:getaddrinfo", "\n"));
  ------------------
  |  |   61|     57|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 57]
  |  |  ------------------
  ------------------
  871|       |
  872|     57|    if (NULL == hints) {
  ------------------
  |  Branch (872:9): [True: 0, False: 57]
  ------------------
  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|     57|    } else {
  880|     57|        memcpy(&hint, hints, sizeof hint);
  881|     57|    }
  882|       |
  883|     57|#ifndef DNSSEC_LOCAL_VALIDATION
  884|     57|    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|     57|    *res = addrs;
  913|     57|    DEBUGIF("dns:getaddrinfo") {
  ------------------
  |  |  145|     57|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|    114|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  184|      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|     57|    return err;
  943|       |#else
  944|       |    NETSNMP_LOGONCE((LOG_ERR, "getaddrinfo not available"));
  945|       |    return EAI_FAIL;
  946|       |#endif /* getaddrinfo */
  947|     57|}
calculate_sectime_diff:
 1176|    127|{
 1177|    127|    struct timeval  diff;
 1178|       |
 1179|    127|    NETSNMP_TIMERSUB(now, then, &diff);
  ------------------
  |  |  173|    127|#define NETSNMP_TIMERSUB(a, b, res) do {                        \
  |  |  174|    127|    (res)->tv_sec  = (a)->tv_sec  - (b)->tv_sec - 1;            \
  |  |  175|    127|    (res)->tv_usec = (a)->tv_usec - (b)->tv_usec + 1000000L;    \
  |  |  176|    127|    if ((res)->tv_usec >= 1000000L) {                           \
  |  |  ------------------
  |  |  |  Branch (176:9): [True: 127, False: 0]
  |  |  ------------------
  |  |  177|    127|        (res)->tv_usec -= 1000000L;                             \
  |  |  178|    127|        (res)->tv_sec++;                                        \
  |  |  179|    127|    }                                                           \
  |  |  180|    127|} while (0)
  |  |  ------------------
  |  |  |  Branch (180:10): [Folded, False: 127]
  |  |  ------------------
  ------------------
 1180|    127|    return (u_int)(diff.tv_sec + (diff.tv_usec >= 500000L));
 1181|    127|}
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;
  ------------------
  |  |  185|      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;
  ------------------
  |  |  184|      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|     57|{
 1385|     57|#ifdef HAVE_SYS_UTSNAME_H
 1386|     57|  static int printOSonce = 1;
 1387|     57|  struct utsname utsbuf;
 1388|     57|  if ( 0 > uname(&utsbuf))
  ------------------
  |  Branch (1388:8): [True: 0, False: 57]
  ------------------
 1389|      0|    return -1;
 1390|       |
 1391|     57|  if (printOSonce) {
  ------------------
  |  Branch (1391:7): [True: 1, False: 56]
  ------------------
 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|     57|  if (0 != strcasecmp(utsbuf.sysname, ospmname)) return -1;
  ------------------
  |  Branch (1397:7): [True: 0, False: 57]
  ------------------
 1398|       |
 1399|       |  /* Required to match only the leading characters */
 1400|     57|  return strncasecmp(utsbuf.release, ospmrelprefix, strlen(ospmrelprefix));
 1401|       |
 1402|       |#else
 1403|       |
 1404|       |  return -1;
 1405|       |
 1406|       |#endif /* HAVE_SYS_UTSNAME_H */
 1407|     57|}

netsnmp_memdup:
  279|    145|{
  280|    145|    void *to = NULL;
  281|       |
  282|    145|    if (from) {
  ------------------
  |  Branch (282:9): [True: 145, False: 0]
  ------------------
  283|    145|        to = malloc(size);
  284|    145|        if (to)
  ------------------
  |  Branch (284:13): [True: 145, False: 0]
  ------------------
  285|    145|            memcpy(to, from, size);
  286|    145|    }
  287|    145|    return to;
  288|    145|}                               /* end netsnmp_memdup() */
netsnmp_get_monotonic_clock:
  948|    297|{
  949|    297|#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
  950|    297|    struct timespec ts;
  951|    297|    int res;
  952|       |
  953|    297|    res = clock_gettime(CLOCK_MONOTONIC, &ts);
  954|    297|    if (res >= 0) {
  ------------------
  |  Branch (954:9): [True: 297, False: 0]
  ------------------
  955|    297|        tv->tv_sec = ts.tv_sec;
  956|    297|        tv->tv_usec = ts.tv_nsec / 1000;
  957|    297|    } 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|    297|}
netsnmp_getenv:
 1187|    287|{
 1188|    287|#if !defined (WIN32) && !defined (cygwin)
 1189|    287|  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|    287|}
netsnmp_gethomedir:
 1417|     58|const char *netsnmp_gethomedir(void) {
 1418|     58|    const char *homepath = netsnmp_getenv("HOME");
 1419|       |#ifdef _WIN32
 1420|       |    if (!homepath)
 1421|       |        homepath = netsnmp_getenv("USERPROFILE");
 1422|       |#endif
 1423|     58|    return homepath;
 1424|     58|}

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

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

netsnmp_dtlsudp_ctor:
 1711|     57|{
 1712|     57|    static const char indexname[] = "_netsnmp_addr_info";
 1713|     57|    static const char *prefixes[] = { "dtlsudp", "dtls"
 1714|     57|#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
 1715|     57|                                      , "dtlsudp6", "dtls6"
 1716|     57|#endif
 1717|     57|    };
 1718|     57|    int i, num_prefixes = sizeof(prefixes) / sizeof(char *);
 1719|     57|#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
 1720|     57|    static const char indexname6[] = "_netsnmp_addr_info6";
 1721|     57|#endif
 1722|       |
 1723|     57|    DEBUGMSGTL(("dtlsudp", "registering DTLS constructor\n"));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 1724|       |
 1725|       |    /* config settings */
 1726|       |
 1727|     57|#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
 1728|     57|    if (!openssl_addr_index6)
  ------------------
  |  Branch (1728:9): [True: 1, False: 56]
  ------------------
 1729|      1|        openssl_addr_index6 =
 1730|      1|            SSL_get_ex_new_index(0, NETSNMP_REMOVE_CONST(void *, indexname6),
 1731|     57|                                 NULL, NULL, NULL);
 1732|     57|#endif
 1733|       |
 1734|     57|    dtlsudpDomain.name = netsnmpDTLSUDPDomain;
 1735|     57|    dtlsudpDomain.name_length = netsnmpDTLSUDPDomain_len;
 1736|     57|    dtlsudpDomain.prefix = calloc(num_prefixes + 1, sizeof(char *));
 1737|     57|    if (!dtlsudpDomain.prefix) {
  ------------------
  |  Branch (1737:9): [True: 0, False: 57]
  ------------------
 1738|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
 1739|      0|        return;
 1740|      0|    }
 1741|    285|    for (i = 0; i < num_prefixes; ++ i)
  ------------------
  |  Branch (1741:17): [True: 228, False: 57]
  ------------------
 1742|    228|        dtlsudpDomain.prefix[i] = prefixes[i];
 1743|       |
 1744|     57|    dtlsudpDomain.f_create_from_tstring_new = netsnmp_dtlsudp_create_tstring;
 1745|     57|    dtlsudpDomain.f_create_from_ostring     = netsnmp_dtlsudp_create_ostring;
 1746|       |
 1747|     57|    if (!openssl_addr_index)
  ------------------
  |  Branch (1747:9): [True: 1, False: 56]
  ------------------
 1748|      1|        openssl_addr_index =
 1749|      1|            SSL_get_ex_new_index(0, NETSNMP_REMOVE_CONST(void *, indexname),
 1750|     57|                                 NULL, NULL, NULL);
 1751|       |
 1752|     57|    netsnmp_tdomain_register(&dtlsudpDomain);
 1753|     57|}

netsnmp_parse_ep_str:
   31|     57|{
   32|     57|    char *dup, *cp, *addrstr = NULL, *iface = NULL, *portstr = NULL;
   33|     57|    unsigned port;
   34|       |
   35|     57|    if (!endpoint)
  ------------------
  |  Branch (35:9): [True: 0, False: 57]
  ------------------
   36|      0|        return 0;
   37|       |
   38|     57|    dup = strdup(endpoint);
   39|     57|    if (!dup)
  ------------------
  |  Branch (39:9): [True: 0, False: 57]
  ------------------
   40|      0|        return 0;
   41|       |
   42|     57|    cp = dup;
   43|     57|    if (netsnmp_isnumber(cp)) {
  ------------------
  |  Branch (43:9): [True: 0, False: 57]
  ------------------
   44|      0|        portstr = cp;
   45|     57|    } else {
   46|     57|        if (*cp == '[') {
  ------------------
  |  Branch (46:13): [True: 0, False: 57]
  ------------------
   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|     57|        } else if (*cp != '@' && (*cp != ':' || cp[1] == ':')) {
  ------------------
  |  Branch (55:20): [True: 57, False: 0]
  |  Branch (55:35): [True: 57, False: 0]
  |  Branch (55:49): [True: 0, False: 0]
  ------------------
   56|     57|            addrstr = cp;
   57|     57|            cp = strchr(addrstr, '@');
   58|     57|            if (!cp) {
  ------------------
  |  Branch (58:17): [True: 57, False: 0]
  ------------------
   59|     57|                cp = strrchr(addrstr, ':');
   60|     57|                if (cp && strchr(dup, ':') < cp)
  ------------------
  |  Branch (60:21): [True: 57, False: 0]
  |  Branch (60:27): [True: 0, False: 57]
  ------------------
   61|      0|                    cp = NULL;
   62|     57|            }
   63|     57|        }
   64|     57|        if (cp && *cp == '@') {
  ------------------
  |  Branch (64:13): [True: 57, False: 0]
  |  Branch (64:19): [True: 0, False: 57]
  ------------------
   65|      0|            *cp = '\0';
   66|      0|            iface = cp + 1;
   67|      0|            cp = strchr(cp + 1, ':');
   68|      0|        }
   69|     57|        if (cp && *cp == ':') {
  ------------------
  |  Branch (69:13): [True: 57, False: 0]
  |  Branch (69:19): [True: 57, False: 0]
  ------------------
   70|     57|            *cp++ = '\0';
   71|     57|            portstr = cp;
   72|     57|            if (!netsnmp_isnumber(cp))
  ------------------
  |  Branch (72:17): [True: 0, False: 57]
  ------------------
   73|      0|                goto err;
   74|     57|        } 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|     57|    }
   78|       |
   79|     57|    if (addrstr) {
  ------------------
  |  Branch (79:9): [True: 57, False: 0]
  ------------------
   80|     57|        ep_str->addr = strdup(addrstr);
   81|     57|        if (!ep_str->addr)
  ------------------
  |  Branch (81:13): [True: 0, False: 57]
  ------------------
   82|      0|            goto err;
   83|     57|    }
   84|     57|    if (iface)
  ------------------
  |  Branch (84:9): [True: 0, False: 57]
  ------------------
   85|      0|        strlcpy(ep_str->iface, iface, sizeof(ep_str->iface));
   86|     57|    if (portstr) {
  ------------------
  |  Branch (86:9): [True: 57, False: 0]
  ------------------
   87|     57|        port = atoi(portstr);
   88|     57|        if (port <= 0xffff)
  ------------------
  |  Branch (88:13): [True: 57, False: 0]
  ------------------
   89|     57|            strlcpy(ep_str->port, portstr, sizeof(ep_str->port));
   90|      0|        else
   91|      0|            goto err;
   92|     57|    }
   93|       |
   94|     57|    free(dup);
   95|     57|    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|     57|}
netsnmp_bindtodevice:
  105|     57|{
  106|       |    /* If no interface name has been specified, report success. */
  107|     57|    if (!iface || iface[0] == '\0')
  ------------------
  |  Branch (107:9): [True: 0, False: 57]
  |  Branch (107:19): [True: 57, False: 0]
  ------------------
  108|     57|        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(sock, 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|     57|    }
  125|       |#else
  126|       |    errno = EINVAL;
  127|       |    return -1;
  128|       |#endif
  129|     57|}
netsnmp_ipbase_session_init:
  132|     57|                            struct snmp_session *sess) {
  133|     57|    union {
  134|     57|        struct sockaddr     sa;
  135|     57|        struct sockaddr_in  sin;
  136|     57|        struct sockaddr_in6 sin6;
  137|     57|    } ss;
  138|     57|    socklen_t len = sizeof(ss);
  139|       |
  140|     57|    if (!sess) {
  ------------------
  |  Branch (140:9): [True: 0, False: 57]
  ------------------
  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;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  143|      0|    }
  144|       |
  145|     57|    if (getsockname(transport->sock, (struct sockaddr *)&ss, &len) == -1) {
  ------------------
  |  Branch (145:9): [True: 0, False: 57]
  ------------------
  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;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  148|      0|    }
  149|     57|    switch (ss.sa.sa_family) {
  150|     57|    case AF_INET:
  ------------------
  |  Branch (150:5): [True: 57, False: 0]
  ------------------
  151|     57|        sess->local_port = ntohs(ss.sin.sin_port);
  152|     57|        break;
  153|      0|    case AF_INET6:
  ------------------
  |  Branch (153:5): [True: 0, False: 57]
  ------------------
  154|      0|        sess->local_port = ntohs(ss.sin6.sin6_port);
  155|      0|        break;
  156|      0|    default:
  ------------------
  |  Branch (156:5): [True: 0, False: 57]
  ------------------
  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;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  160|     57|    }
  161|       |
  162|     57|    DEBUGMSGTL(("netsnmp_ipbase", "local port number %d\n", sess->local_port));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
  163|       |
  164|     57|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     57|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  165|     57|}
snmpIPBaseDomain.c:netsnmp_isnumber:
   12|    114|{
   13|    114|    if (!*cp)
  ------------------
  |  Branch (13:9): [True: 0, False: 114]
  ------------------
   14|      0|        return 0;
   15|       |
   16|    114|    while (isdigit((unsigned char)*cp))
  ------------------
  |  Branch (16:12): [True: 399, False: 114]
  ------------------
   17|    399|        cp++;
   18|    114|    return *cp == '\0';
   19|    114|}

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

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

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

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

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

netsnmp_tcpipv6_ctor:
  384|     57|{
  385|     57|    tcp6Domain.name = netsnmp_TCPIPv6Domain;
  386|     57|    tcp6Domain.name_length = OID_LENGTH(netsnmp_TCPIPv6Domain);
  ------------------
  |  |   64|     57|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     57|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  387|     57|    tcp6Domain.f_create_from_tstring_new = netsnmp_tcp6_create_tstring;
  388|     57|    tcp6Domain.f_create_from_ostring     = netsnmp_tcp6_create_ostring;
  389|     57|    tcp6Domain.prefix = calloc(4, sizeof(char *));
  390|     57|    if (!tcp6Domain.prefix) {
  ------------------
  |  Branch (390:9): [True: 0, False: 57]
  ------------------
  391|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  392|      0|        return;
  393|      0|    }
  394|     57|    tcp6Domain.prefix[0] = "tcp6";
  395|     57|    tcp6Domain.prefix[1] = "tcpv6";
  396|     57|    tcp6Domain.prefix[2] = "tcpipv6";
  397|       |
  398|     57|    netsnmp_tdomain_register(&tcp6Domain);
  399|     57|}

netsnmp_tlsbase_ctor:
  987|     57|netsnmp_tlsbase_ctor(void) {
  988|       |
  989|       |    /* bootstrap ssl since we'll need it */
  990|     57|    netsnmp_init_openssl();
  991|       |
  992|       |    /* the private client cert to authenticate with */
  993|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "extraX509SubDir",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
  994|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  995|     57|                               NETSNMP_DS_LIB_CERT_EXTRA_SUBDIR);
  ------------------
  |  |  177|     57|#define NETSNMP_DS_LIB_CERT_EXTRA_SUBDIR 26
  ------------------
  996|       |
  997|       |    /* Do we have a CRL list? */
  998|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "x509CRLFile",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
  999|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1000|     57|                               NETSNMP_DS_LIB_X509_CRL_FILE);
  ------------------
  |  |  179|     57|#define NETSNMP_DS_LIB_X509_CRL_FILE     28
  ------------------
 1001|       |
 1002|       |    /* What TLS algorithms should be use */
 1003|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "tlsAlgorithms",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
 1004|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1005|     57|                               NETSNMP_DS_LIB_TLS_ALGORITMS);
  ------------------
  |  |  180|     57|#define NETSNMP_DS_LIB_TLS_ALGORITMS     29
  ------------------
 1006|       |
 1007|       |    /* What TLS version should be used at least */
 1008|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "tlsMinVersion",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
 1009|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1010|     57|                               NETSNMP_DS_LIB_TLS_MIN_VERSION);
  ------------------
  |  |  187|     57|#define NETSNMP_DS_LIB_TLS_MIN_VERSION   36
  ------------------
 1011|       |
 1012|       |    /* What TLS version should be used at max */
 1013|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "tlsMaxVersion",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
 1014|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1015|     57|                               NETSNMP_DS_LIB_TLS_MAX_VERSION);
  ------------------
  |  |  188|     57|#define NETSNMP_DS_LIB_TLS_MAX_VERSION   37
  ------------------
 1016|       |
 1017|       |    /*
 1018|       |     * for the client
 1019|       |     */
 1020|       |
 1021|       |    /* the public client cert to authenticate with */
 1022|     57|    register_config_handler("snmp", "clientCert", _parse_client_cert, NULL,
 1023|     57|                            NULL);
 1024|       |
 1025|       |    /*
 1026|       |     * for the server
 1027|       |     */
 1028|       |
 1029|       |    /* The X509 server key to use */
 1030|     57|    register_config_handler("snmp", "serverCert", _parse_server_cert, NULL,
 1031|     57|                            NULL);
 1032|       |    /*
 1033|       |     * remove cert config ambiguity: localCert, peerCert
 1034|       |     */
 1035|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "localCert",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
 1036|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1037|     57|                               NETSNMP_DS_LIB_TLS_LOCAL_CERT);
  ------------------
  |  |  181|     57|#define NETSNMP_DS_LIB_TLS_LOCAL_CERT    30
  ------------------
 1038|     57|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "peerCert",
  ------------------
  |  |   78|     57|#define ASN_OCTET_STR	    0x04U
  ------------------
 1039|     57|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     57|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1040|     57|                               NETSNMP_DS_LIB_TLS_PEER_CERT);
  ------------------
  |  |  182|     57|#define NETSNMP_DS_LIB_TLS_PEER_CERT     31
  ------------------
 1041|       |
 1042|       |    /*
 1043|       |     * register our boot-strapping needs
 1044|       |     */
 1045|     57|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     57|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1046|     57|			   SNMP_CALLBACK_POST_PREMIB_READ_CONFIG,
  ------------------
  |  |   27|     57|#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG	3
  ------------------
 1047|     57|			   tls_bootstrap, NULL);
 1048|       |
 1049|     57|}
snmpTLSBaseDomain.c:tls_bootstrap:
  939|     57|tls_bootstrap(int majorid, int minorid, void *serverarg, void *clientarg) {
  940|     57|    char indexname[] = "_netsnmp_verify_info";
  941|       |
  942|       |    /* don't do this more than once */
  943|     57|    if (have_done_bootstrap)
  ------------------
  |  Branch (943:9): [True: 56, False: 1]
  ------------------
  944|     56|        return 0;
  945|      1|    have_done_bootstrap = 1;
  946|       |
  947|      1|    netsnmp_certs_load();
  948|       |
  949|      1|    openssl_local_index =
  950|      1|        SSL_get_ex_new_index(0, indexname, NULL, NULL, verify_info_free);
  951|       |
  952|      1|    return 0;
  953|     57|}

netsnmp_tlstcp_ctor:
 1197|     57|{
 1198|     57|    DEBUGMSGTL(("tlstcp", "registering TLS constructor\n"));
  ------------------
  |  |   66|     57|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 57]
  |  |  ------------------
  ------------------
 1199|       |
 1200|       |    /* config settings */
 1201|       |
 1202|     57|    tlstcpDomain.name = netsnmpTLSTCPDomain;
 1203|     57|    tlstcpDomain.name_length = netsnmpTLSTCPDomain_len;
 1204|     57|    tlstcpDomain.prefix = calloc(3, sizeof(char *));
 1205|     57|    if (!tlstcpDomain.prefix) {
  ------------------
  |  Branch (1205:9): [True: 0, False: 57]
  ------------------
 1206|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
 1207|      0|        return;
 1208|      0|    }
 1209|     57|    tlstcpDomain.prefix[0] = "tlstcp";
 1210|     57|    tlstcpDomain.prefix[1] = "tls";
 1211|       |
 1212|     57|    tlstcpDomain.f_create_from_tstring_new = netsnmp_tlstcp_create_tstring;
 1213|     57|    tlstcpDomain.f_create_from_ostring     = netsnmp_tlstcp_create_ostring;
 1214|       |
 1215|     57|    netsnmp_tdomain_register(&tlstcpDomain);
 1216|     57|}

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

netsnmp_udp_recvfrom:
  169|     56|{
  170|       |    /** udpipv4 just calls udpbase. should we skip directly to there? */
  171|     56|    return netsnmp_udpipv4_recvfrom(sock, buf, len, from, fromlen, dstip, dstlen,
  172|     56|                                    if_index);
  173|     56|}
netsnmp_udp_sendto:
  178|     13|{
  179|       |    /** udpipv4 just calls udpbase. should we skip directly to there? */
  180|     13|    return netsnmp_udpipv4_sendto(sock, srcip, if_index, remote, data, len);
  181|     13|}
netsnmp_udp_create_tspec:
  701|     57|{
  702|     57|    netsnmp_transport *t = netsnmp_udpipv4base_tspec_transport(tspec);
  703|     57|    if (NULL != t) {
  ------------------
  |  Branch (703:9): [True: 57, False: 0]
  ------------------
  704|     57|        netsnmp_udp_transport_base(t);
  705|     57|    }
  706|     57|    return t;
  707|       |
  708|     57|}
netsnmp_udp_ctor:
  724|     57|{
  725|     57|    udpDomain.name = netsnmpUDPDomain;
  726|     57|    udpDomain.name_length = netsnmpUDPDomain_len;
  727|     57|    udpDomain.prefix = calloc(2, sizeof(char *));
  728|     57|    if (!udpDomain.prefix) {
  ------------------
  |  Branch (728:9): [True: 0, False: 57]
  ------------------
  729|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  730|      0|        return;
  731|      0|    }
  732|     57|    udpDomain.prefix[0] = "udp";
  733|       |
  734|     57|    udpDomain.f_create_from_tstring_new = netsnmp_udp_create_tstring;
  735|     57|    udpDomain.f_create_from_tspec       = netsnmp_udp_create_tspec;
  736|     57|    udpDomain.f_create_from_ostring     = netsnmp_udp_create_ostring;
  737|       |
  738|     57|    netsnmp_tdomain_register(&udpDomain);
  739|     57|}
snmpUDPDomain.c:netsnmp_udp_transport_base:
  190|     57|{
  191|     57|    if (NULL == t) {
  ------------------
  |  Branch (191:9): [True: 0, False: 57]
  ------------------
  192|      0|        return NULL;
  193|      0|    }
  194|       |
  195|       |    /*
  196|       |     * Set Domain
  197|       |     */
  198|       |
  199|     57|    t->domain = netsnmpUDPDomain;
  200|     57|    t->domain_length = netsnmpUDPDomain_len;
  201|       |
  202|       |    /*
  203|       |     * 16-bit length field, 8 byte UDP header, 20 byte IPv4 header  
  204|       |     */
  205|       |
  206|     57|    t->msgMaxSize = 0xffff - 8 - 20;
  207|     57|    t->f_recv     = netsnmp_udpbase_recv;
  208|     57|    t->f_send     = netsnmp_udpbase_send;
  209|     57|    t->f_close    = netsnmp_socketbase_close;
  210|     57|    t->f_accept   = NULL;
  211|     57|    t->f_setup_session = netsnmp_ipbase_session_init;
  212|     57|    t->f_fmtaddr  = netsnmp_udp_fmtaddr;
  213|     57|    t->f_get_taddr = netsnmp_ipv4_get_taddr;
  214|       |
  215|     57|    return t;
  216|     57|}

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

netsnmp_udpipv6_ctor:
 1248|     57|{
 1249|     57|    udp6Domain.name = netsnmp_UDPIPv6Domain;
 1250|     57|    udp6Domain.name_length = OID_LENGTH(netsnmp_UDPIPv6Domain);
  ------------------
  |  |   64|     57|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     57|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 1251|     57|    udp6Domain.f_create_from_tstring_new = netsnmp_udp6_create_tstring;
 1252|     57|    udp6Domain.f_create_from_tspec       = netsnmp_udp6_create_tspec;
 1253|     57|    udp6Domain.f_create_from_ostring     = netsnmp_udp6_create_ostring;
 1254|     57|    udp6Domain.prefix = calloc(5, sizeof(char *));
 1255|     57|    if (!udp6Domain.prefix) {
  ------------------
  |  Branch (1255:9): [True: 0, False: 57]
  ------------------
 1256|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
 1257|      0|        return;
 1258|      0|    }
 1259|     57|    udp6Domain.prefix[0] = "udp6";
 1260|     57|    udp6Domain.prefix[1] = "ipv6";
 1261|     57|    udp6Domain.prefix[2] = "udpv6";
 1262|     57|    udp6Domain.prefix[3] = "udpipv6";
 1263|       |
 1264|     57|    netsnmp_tdomain_register(&udp6Domain);
 1265|     57|}

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

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

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

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

