snmp_input:
 1153|      6|{
 1154|      6|    oid stdTrapOidRoot[] = { 1, 3, 6, 1, 6, 3, 1, 1, 5 };
 1155|      6|    oid snmpTrapOid[]    = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
 1156|      6|    oid trapOid[MAX_OID_LEN+2] = {0};
 1157|      6|    int trapOidLen;
 1158|      6|    netsnmp_variable_list *vars;
 1159|      6|    netsnmp_trapd_handler *traph;
 1160|      6|    netsnmp_transport *transport = (netsnmp_transport *) magic;
 1161|      6|    int ret, idx;
 1162|       |
 1163|      6|    switch (op) {
 1164|      6|    case NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE:
  ------------------
  |  |  319|      6|#define NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE	1
  ------------------
  |  Branch (1164:5): [True: 6, False: 0]
  ------------------
 1165|       |        /*
 1166|       |         * Drops packets with reception problems
 1167|       |         */
 1168|      6|        if (session->s_snmp_errno) {
  ------------------
  |  Branch (1168:13): [True: 6, False: 0]
  ------------------
 1169|       |            /* drop problem packets */
 1170|      6|            return 1;
 1171|      6|        }
 1172|       |
 1173|       |        /*
 1174|       |	 * Determine the OID that identifies the trap being handled
 1175|       |	 */
 1176|      0|        DEBUGMSGTL(("snmptrapd", "input: %x\n", pdu->command));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1177|      0|        switch (pdu->command) {
 1178|      0|        case SNMP_MSG_TRAP:
  ------------------
  |  |  135|      0|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (1178:9): [True: 0, False: 0]
  ------------------
 1179|       |            /*
 1180|       |	     * Convert v1 traps into a v2-style trap OID
 1181|       |	     *    (following RFC 2576)
 1182|       |	     */
 1183|      0|            if (pdu->trap_type == SNMP_TRAP_ENTERPRISESPECIFIC) {
  ------------------
  |  |  257|      0|#define SNMP_TRAP_ENTERPRISESPECIFIC	(6)
  ------------------
  |  Branch (1183:17): [True: 0, False: 0]
  ------------------
 1184|      0|                trapOidLen = pdu->enterprise_length;
 1185|       |                /*
 1186|       |                 * Drop packets that cannot be represented by the v2-style
 1187|       |                 * trap OID passed to notification handlers.
 1188|       |                 */
 1189|      0|                if (trapOidLen < 1 || trapOidLen > MAX_OID_LEN - 2)
  ------------------
  |  |  120|      0|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
  |  Branch (1189:21): [True: 0, False: 0]
  |  Branch (1189:39): [True: 0, False: 0]
  ------------------
 1190|      0|                    return 1;
 1191|      0|                memcpy(trapOid, pdu->enterprise, sizeof(oid) * trapOidLen);
 1192|      0|                if (trapOid[trapOidLen - 1] != 0) {
  ------------------
  |  Branch (1192:21): [True: 0, False: 0]
  ------------------
 1193|      0|                    trapOid[trapOidLen++] = 0;
 1194|      0|                }
 1195|      0|                trapOid[trapOidLen++] = pdu->specific_type;
 1196|      0|            } else {
 1197|      0|                memcpy(trapOid, stdTrapOidRoot, sizeof(stdTrapOidRoot));
 1198|      0|                trapOidLen = OID_LENGTH(stdTrapOidRoot);  /* 9 */
  ------------------
  |  |   57|      0|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
 1199|       |                /* Drop packets with an invalid trap type. */
 1200|      0|                if (pdu->trap_type < SNMP_TRAP_COLDSTART ||
  ------------------
  |  |  251|      0|#define SNMP_TRAP_COLDSTART		(0)
  ------------------
  |  Branch (1200:21): [True: 0, False: 0]
  ------------------
 1201|      0|                    pdu->trap_type > SNMP_TRAP_EGPNEIGHBORLOSS)
  ------------------
  |  |  256|      0|#define SNMP_TRAP_EGPNEIGHBORLOSS	(5)
  ------------------
  |  Branch (1201:21): [True: 0, False: 0]
  ------------------
 1202|      0|                    return 1;
 1203|      0|                trapOid[trapOidLen++] = pdu->trap_type+1;
 1204|      0|            }
 1205|      0|            break;
 1206|       |
 1207|      0|        case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|      0|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (1207:9): [True: 0, False: 0]
  ------------------
 1208|      0|        case SNMP_MSG_INFORM:
  ------------------
  |  |  141|      0|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (1208:9): [True: 0, False: 0]
  ------------------
 1209|       |            /*
 1210|       |	     * v2c/v3 notifications *should* have snmpTrapOID as the
 1211|       |	     *    second varbind, so we can go straight there.
 1212|       |	     *    But check, just to make sure
 1213|       |	     */
 1214|      0|            vars = pdu->variables;
 1215|      0|            if (vars)
  ------------------
  |  Branch (1215:17): [True: 0, False: 0]
  ------------------
 1216|      0|                vars = vars->next_variable;
 1217|      0|            if (!vars || vars->type != ASN_OBJECT_ID ||
  ------------------
  |  |   70|      0|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (1217:17): [True: 0, False: 0]
  |  Branch (1217:26): [True: 0, False: 0]
  ------------------
 1218|      0|                snmp_oid_compare(vars->name, vars->name_length,
  ------------------
  |  Branch (1218:17): [True: 0, False: 0]
  ------------------
 1219|      0|                                 snmpTrapOid, OID_LENGTH(snmpTrapOid))) {
  ------------------
  |  |   57|      0|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
 1220|       |	        /*
 1221|       |		 * Didn't find it!
 1222|       |		 * Let's look through the full list....
 1223|       |		 */
 1224|      0|		for ( vars = pdu->variables; vars; vars=vars->next_variable) {
  ------------------
  |  Branch (1224:32): [True: 0, False: 0]
  ------------------
 1225|      0|                    if (vars->type != ASN_OBJECT_ID)
  ------------------
  |  |   70|      0|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (1225:25): [True: 0, False: 0]
  ------------------
 1226|      0|                        continue;
 1227|      0|                    if (!snmp_oid_compare(vars->name, vars->name_length,
  ------------------
  |  Branch (1227:25): [True: 0, False: 0]
  ------------------
 1228|      0|                                          snmpTrapOid, OID_LENGTH(snmpTrapOid)))
  ------------------
  |  |   57|      0|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
 1229|      0|                        break;
 1230|      0|                }
 1231|      0|                if (!vars) {
  ------------------
  |  Branch (1231:21): [True: 0, False: 0]
  ------------------
 1232|       |	            /*
 1233|       |		     * Still can't find it!  Give up.
 1234|       |		     */
 1235|      0|		    snmp_log(LOG_ERR, "Cannot find TrapOID in TRAP2 PDU\n");
 1236|      0|		    return 1;		/* ??? */
 1237|      0|		}
 1238|      0|	    }
 1239|      0|            if (!vars->val.objid) {
  ------------------
  |  Branch (1239:17): [True: 0, False: 0]
  ------------------
 1240|      0|                snmp_log(LOG_ERR, "Empty TrapOID in TRAP2 PDU\n");
 1241|      0|                return 1;
 1242|      0|            }
 1243|      0|            trapOidLen = SNMP_MIN(sizeof(trapOid), vars->val_len) / sizeof(oid);
  ------------------
  |  |  111|      0|#define SNMP_MIN(a,b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (111:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1244|      0|            memcpy(trapOid, vars->val.objid, trapOidLen * sizeof(oid));
 1245|      0|            break;
 1246|       |
 1247|      0|        default:
  ------------------
  |  Branch (1247:9): [True: 0, False: 0]
  ------------------
 1248|       |            /* SHOULDN'T HAPPEN! */
 1249|      0|            return 1;	/* ??? */
 1250|      0|	}
 1251|      0|        DEBUGMSGTL(( "snmptrapd", "Trap OID: "));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1252|      0|        DEBUGMSGOID(("snmptrapd", trapOid, trapOidLen));
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1253|      0|        DEBUGMSG(( "snmptrapd", "\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]
  |  |  ------------------
  ------------------
 1254|       |
 1255|       |
 1256|       |        /*
 1257|       |	 *  OK - We've found the Trap OID used to identify this trap.
 1258|       |         *  Call each of the various lists of handlers:
 1259|       |         *     a) authentication-related handlers,
 1260|       |         *     b) other handlers to be applied to all traps
 1261|       |         *		(*before* trap-specific handlers)
 1262|       |         *     c) the handler(s) specific to this trap
 1263|       |t        *     d) any other global handlers
 1264|       |         *
 1265|       |	 *  In each case, a particular trap handler can abort further
 1266|       |         *     processing - either just for that particular list,
 1267|       |         *     or for the trap completely.
 1268|       |         *
 1269|       |	 *  This is particularly designed for authentication-related
 1270|       |	 *     handlers, but can also be used elsewhere.
 1271|       |         *
 1272|       |         *  OK - Enough waffling, let's get to work.....
 1273|       |	 */
 1274|       |
 1275|      0|        for( idx = 0; handlers[idx].descr; ++idx ) {
  ------------------
  |  Branch (1275:23): [True: 0, False: 0]
  ------------------
 1276|      0|            DEBUGMSGTL(("snmptrapd", "Running %s handlers\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]
  |  |  ------------------
  ------------------
 1277|      0|                        handlers[idx].descr));
 1278|      0|            if (NULL == handlers[idx].handler) /* specific */
  ------------------
  |  Branch (1278:17): [True: 0, False: 0]
  ------------------
 1279|      0|                traph = netsnmp_get_traphandler(trapOid, trapOidLen);
 1280|      0|            else
 1281|      0|                traph = *handlers[idx].handler;
 1282|       |
 1283|      0|            for( ; traph; traph = traph->nexth) {
  ------------------
  |  Branch (1283:20): [True: 0, False: 0]
  ------------------
 1284|      0|                if (!netsnmp_trapd_check_auth(traph->authtypes))
  ------------------
  |  Branch (1284:21): [True: 0, False: 0]
  ------------------
 1285|      0|                    continue; /* we continue on and skip this one */
 1286|       |
 1287|      0|                ret = (*(traph->handler))(pdu, transport, traph);
 1288|      0|                if(NETSNMPTRAPD_HANDLER_FINISH == ret)
  ------------------
  |  |   57|      0|#define NETSNMPTRAPD_HANDLER_FINISH  4	/* No further processing */
  ------------------
  |  Branch (1288:20): [True: 0, False: 0]
  ------------------
 1289|      0|                    return 1;
 1290|      0|                if (ret == NETSNMPTRAPD_HANDLER_BREAK)
  ------------------
  |  |   56|      0|#define NETSNMPTRAPD_HANDLER_BREAK   3	/* Move to the next list */
  ------------------
  |  Branch (1290:21): [True: 0, False: 0]
  ------------------
 1291|      0|                    break; /* move on to next type */
 1292|      0|            } /* traph */
 1293|      0|        } /* handlers */
 1294|       |
 1295|       |
 1296|      0|	if (pdu->command == SNMP_MSG_INFORM) {
  ------------------
  |  |  141|      0|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (1296:6): [True: 0, False: 0]
  ------------------
 1297|      0|	    netsnmp_pdu *reply = snmp_clone_pdu(pdu);
 1298|      0|	    if (!reply) {
  ------------------
  |  Branch (1298:10): [True: 0, False: 0]
  ------------------
 1299|      0|		snmp_log(LOG_ERR, "couldn't clone PDU for INFORM response\n");
 1300|      0|	    } else {
 1301|      0|		reply->command = SNMP_MSG_RESPONSE;
  ------------------
  |  |  127|      0|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
 1302|      0|		reply->errstat = 0;
 1303|      0|		reply->errindex = 0;
 1304|      0|		if (!snmp_send(session, reply)) {
  ------------------
  |  Branch (1304:7): [True: 0, False: 0]
  ------------------
 1305|      0|		    snmp_sess_perror("snmptrapd: Couldn't respond to inform pdu",
 1306|      0|                                    session);
 1307|      0|		    snmp_free_pdu(reply);
 1308|      0|		}
 1309|      0|	    }
 1310|      0|	}
 1311|       |
 1312|      0|        break;
 1313|       |
 1314|      0|    case NETSNMP_CALLBACK_OP_TIMED_OUT:
  ------------------
  |  |  320|      0|#define NETSNMP_CALLBACK_OP_TIMED_OUT		2
  ------------------
  |  Branch (1314:5): [True: 0, False: 6]
  ------------------
 1315|      0|        snmp_log(LOG_ERR, "Timeout: This shouldn't happen!\n");
 1316|      0|        break;
 1317|       |
 1318|      0|    case NETSNMP_CALLBACK_OP_SEND_FAILED:
  ------------------
  |  |  321|      0|#define NETSNMP_CALLBACK_OP_SEND_FAILED		3
  ------------------
  |  Branch (1318:5): [True: 0, False: 6]
  ------------------
 1319|      0|        snmp_log(LOG_ERR, "Send Failed: This shouldn't happen either!\n");
 1320|      0|        break;
 1321|       |
 1322|      0|    case NETSNMP_CALLBACK_OP_CONNECT:
  ------------------
  |  |  322|      0|#define NETSNMP_CALLBACK_OP_CONNECT		4
  ------------------
  |  Branch (1322:5): [True: 0, False: 6]
  ------------------
 1323|      0|    case NETSNMP_CALLBACK_OP_DISCONNECT:
  ------------------
  |  |  323|      0|#define NETSNMP_CALLBACK_OP_DISCONNECT		5
  ------------------
  |  Branch (1323:5): [True: 0, False: 6]
  ------------------
 1324|       |        /* Ignore silently */
 1325|      0|        break;
 1326|       |
 1327|      0|    default:
  ------------------
  |  Branch (1327:5): [True: 0, False: 6]
  ------------------
 1328|      0|        snmp_log(LOG_ERR, "Unknown operation (%d): This shouldn't happen!\n", op);
 1329|      0|        break;
 1330|      6|    }
 1331|      0|    return 0;
 1332|      6|}

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

init_callbacks:
  198|     67|{
  199|       |    /*
  200|       |     * (poses a problem if you put init_callbacks() inside of
  201|       |     * init_snmp() and then want the app to register a callback before
  202|       |     * init_snmp() is called in the first place.  -- Wes 
  203|       |     */
  204|     67|    if (0 == _callback_need_init)
  ------------------
  |  Branch (204:9): [True: 66, False: 1]
  ------------------
  205|     66|        return;
  206|       |    
  207|      1|    _callback_need_init = 0;
  208|       |    
  209|      1|    memset(thecallbacks, 0, sizeof(thecallbacks)); 
  210|      1|#ifdef LOCK_PER_CALLBACK_SUBID
  211|      1|    memset(_locks, 0, sizeof(_locks));
  212|       |#else
  213|       |    _lock = 0;
  214|       |#endif
  215|       |    
  216|      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]
  |  |  ------------------
  ------------------
  217|      1|}
snmp_register_callback:
  258|    792|{
  259|    792|    return netsnmp_register_callback( major, minor, new_callback, arg,
  260|    792|                                      NETSNMP_CALLBACK_DEFAULT_PRIORITY);
  ------------------
  |  |   40|    792|#define NETSNMP_CALLBACK_DEFAULT_PRIORITY       0
  ------------------
  261|    792|}
netsnmp_register_callback:
  280|    792|{
  281|    792|    struct snmp_gen_callback *newscp = NULL, *scp = NULL;
  282|       |
  283|    792|    if (major < 0 || major >= MAX_CALLBACK_IDS ||
  ------------------
  |  |   12|  1.58k|#define MAX_CALLBACK_IDS    2
  ------------------
  |  Branch (283:9): [True: 0, False: 792]
  |  Branch (283:22): [True: 0, False: 792]
  ------------------
  284|    792|        minor < 0 || minor >= MAX_CALLBACK_SUBIDS) {
  ------------------
  |  |   13|    792|#define MAX_CALLBACK_SUBIDS 18
  ------------------
  |  Branch (284:9): [True: 0, False: 792]
  |  Branch (284:22): [True: 0, False: 792]
  ------------------
  285|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  286|      0|    }
  287|       |
  288|    792|    if (_callback_need_init)
  ------------------
  |  Branch (288:9): [True: 1, False: 791]
  ------------------
  289|      1|        init_callbacks();
  290|       |
  291|    792|    _callback_lock(major,minor, "netsnmp_register_callback", 1);
  292|       |    
  293|    792|    if ((newscp = SNMP_MALLOC_STRUCT(snmp_gen_callback)) == NULL) {
  ------------------
  |  |   69|    792|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  |  Branch (293:9): [True: 0, False: 792]
  ------------------
  294|      0|        _callback_unlock(major,minor);
  295|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  296|    792|    } else {
  297|    792|        struct snmp_gen_callback **prevNext = &(thecallbacks[major][minor]);
  298|       |
  299|    792|        newscp->priority = priority;
  300|    792|        newscp->sc_client_arg = arg;
  301|    792|        newscp->sc_callback = new_callback;
  302|    792|        newscp->next = NULL;
  303|       |
  304|  1.58k|        for (scp = thecallbacks[major][minor]; scp != NULL;
  ------------------
  |  Branch (304:48): [True: 792, False: 792]
  ------------------
  305|    792|             scp = scp->next) {
  306|    792|            if (newscp->priority < scp->priority) {
  ------------------
  |  Branch (306:17): [True: 0, False: 792]
  ------------------
  307|      0|                newscp->next = scp;
  308|      0|                break;
  309|      0|            }
  310|    792|            prevNext = &(scp->next);
  311|    792|        }
  312|       |
  313|    792|        *prevNext = newscp;
  314|       |
  315|    792|        DEBUGMSGTL(("callback", "registered (%d,%d) at %p with priority %d\n",
  ------------------
  |  |   66|    792|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    792|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 792]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 792]
  |  |  ------------------
  ------------------
  316|    792|                    major, minor, newscp, priority));
  317|    792|        _callback_unlock(major,minor);
  318|    792|        return SNMPERR_SUCCESS;
  ------------------
  |  |  184|    792|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  319|    792|    }
  320|    792|}
snmp_call_callbacks:
  341|    462|{
  342|    462|    struct snmp_gen_callback *scp;
  343|    462|    unsigned int    count = 0;
  344|       |    
  345|    462|    if (major < 0 || major >= MAX_CALLBACK_IDS ||
  ------------------
  |  |   12|    924|#define MAX_CALLBACK_IDS    2
  ------------------
  |  Branch (345:9): [True: 0, False: 462]
  |  Branch (345:22): [True: 0, False: 462]
  ------------------
  346|    462|        minor < 0 || minor >= MAX_CALLBACK_SUBIDS) {
  ------------------
  |  |   13|    462|#define MAX_CALLBACK_SUBIDS 18
  ------------------
  |  Branch (346:9): [True: 0, False: 462]
  |  Branch (346:22): [True: 0, False: 462]
  ------------------
  347|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  348|      0|    }
  349|       |    
  350|    462|    if (_callback_need_init)
  ------------------
  |  Branch (350:9): [True: 0, False: 462]
  ------------------
  351|      0|        init_callbacks();
  352|       |
  353|    462|#ifdef LOCK_PER_CALLBACK_SUBID
  354|    462|    _callback_lock(major,minor,"snmp_call_callbacks", 1);
  355|       |#else
  356|       |    /*
  357|       |     * Notes:
  358|       |     * - this gets hit the first time a trap is sent after a new trap
  359|       |     *   destination has been added (session init cb during send trap cb)
  360|       |     */
  361|       |    _callback_lock(major,minor, NULL, 0);
  362|       |#endif
  363|       |
  364|    462|    DEBUGMSGTL(("callback", "START calling callbacks for maj=%d min=%d\n",
  ------------------
  |  |   66|    462|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    462|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 462]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 462]
  |  |  ------------------
  ------------------
  365|    462|                major, minor));
  366|       |
  367|       |    /*
  368|       |     * for each registered callback of type major and minor 
  369|       |     */
  370|  1.25k|    for (scp = thecallbacks[major][minor]; scp != NULL; scp = scp->next) {
  ------------------
  |  Branch (370:44): [True: 792, False: 462]
  ------------------
  371|       |
  372|       |        /*
  373|       |         * skip unregistered callbacks
  374|       |         */
  375|    792|        if(NULL == scp->sc_callback)
  ------------------
  |  Branch (375:12): [True: 0, False: 792]
  ------------------
  376|      0|            continue;
  377|       |
  378|    792|        DEBUGMSGTL(("callback", "calling a callback for maj=%d min=%d\n",
  ------------------
  |  |   66|    792|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    792|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 792]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 792]
  |  |  ------------------
  ------------------
  379|    792|                    major, minor));
  380|       |
  381|       |        /*
  382|       |         * call them 
  383|       |         */
  384|    792|        (*(scp->sc_callback)) (major, minor, caller_arg,
  385|    792|                               scp->sc_client_arg);
  386|    792|        count++;
  387|    792|    }
  388|       |
  389|    462|    DEBUGMSGTL(("callback",
  ------------------
  |  |   66|    462|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    462|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 462]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 462]
  |  |  ------------------
  ------------------
  390|    462|                "END calling callbacks for maj=%d min=%d (%d called)\n",
  391|    462|                major, minor, count));
  392|       |
  393|    462|    _callback_unlock(major,minor);
  394|    462|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|    462|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  395|    462|}
netsnmp_callback_clear_client_arg:
  521|    132|{
  522|    132|    struct snmp_gen_callback *scp = NULL;
  523|    132|    int rc = 0;
  524|       |
  525|    132|    if (i < 0 || i >= MAX_CALLBACK_IDS ||
  ------------------
  |  |   12|    264|#define MAX_CALLBACK_IDS    2
  ------------------
  |  Branch (525:9): [True: 0, False: 132]
  |  Branch (525:18): [True: 0, False: 132]
  ------------------
  526|    132|        j < 0 || j >= MAX_CALLBACK_SUBIDS)
  ------------------
  |  |   13|    132|#define MAX_CALLBACK_SUBIDS 18
  ------------------
  |  Branch (526:9): [True: 0, False: 132]
  |  Branch (526:18): [True: 0, False: 132]
  ------------------
  527|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  528|       |
  529|       |    /*
  530|       |     * don't init i and j before loop, since the caller specified
  531|       |     * the starting point explicitly. But *after* the i loop has
  532|       |     * finished executing once, init j to 0 for the next pass
  533|       |     * through the subids.
  534|       |     */
  535|    396|    for (; i < MAX_CALLBACK_IDS; i++,j=0) {
  ------------------
  |  |   12|    396|#define MAX_CALLBACK_IDS    2
  ------------------
  |  Branch (535:12): [True: 264, False: 132]
  ------------------
  536|  4.95k|        for (; j < MAX_CALLBACK_SUBIDS; j++) {
  ------------------
  |  |   13|  4.95k|#define MAX_CALLBACK_SUBIDS 18
  ------------------
  |  Branch (536:16): [True: 4.68k, False: 264]
  ------------------
  537|  4.68k|            scp = thecallbacks[i][j]; 
  538|  6.00k|            while (scp != NULL) {
  ------------------
  |  Branch (538:20): [True: 1.32k, False: 4.68k]
  ------------------
  539|  1.32k|                if ((NULL != scp->sc_callback) &&
  ------------------
  |  Branch (539:21): [True: 1.32k, False: 0]
  ------------------
  540|  1.32k|                    (scp->sc_client_arg != NULL) &&
  ------------------
  |  Branch (540:21): [True: 66, False: 1.25k]
  ------------------
  541|     66|                    (scp->sc_client_arg == ptr)) {
  ------------------
  |  Branch (541:21): [True: 0, False: 66]
  ------------------
  542|      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]
  |  |  ------------------
  ------------------
  543|      0|                    scp->sc_client_arg = NULL;
  544|      0|                    ++rc;
  545|      0|                }
  546|  1.32k|                scp = scp->next;
  547|  1.32k|            }
  548|  4.68k|        }
  549|    264|    }
  550|       |
  551|    132|    if (0 != rc) {
  ------------------
  |  Branch (551:9): [True: 0, False: 132]
  ------------------
  552|      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]
  |  |  ------------------
  ------------------
  553|      0|    }
  554|       |
  555|    132|    return rc;
  556|    132|}
clear_callback:
  560|     66|{
  561|     66|    unsigned int i = 0, j = 0;
  562|     66|    struct snmp_gen_callback *scp = NULL;
  563|       |
  564|     66|    if (_callback_need_init)
  ------------------
  |  Branch (564:9): [True: 0, False: 66]
  ------------------
  565|      0|        init_callbacks();
  566|       |
  567|     66|    DEBUGMSGTL(("callback", "clear callback\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  568|    198|    for (i = 0; i < MAX_CALLBACK_IDS; i++) {
  ------------------
  |  |   12|    198|#define MAX_CALLBACK_IDS    2
  ------------------
  |  Branch (568:17): [True: 132, False: 66]
  ------------------
  569|  2.50k|        for (j = 0; j < MAX_CALLBACK_SUBIDS; j++) {
  ------------------
  |  |   13|  2.50k|#define MAX_CALLBACK_SUBIDS 18
  ------------------
  |  Branch (569:21): [True: 2.37k, False: 132]
  ------------------
  570|  2.37k|            _callback_lock(i,j, "clear_callback", 1);
  571|  2.37k|            scp = thecallbacks[i][j];
  572|  3.16k|            while (scp != NULL) {
  ------------------
  |  Branch (572:20): [True: 792, False: 2.37k]
  ------------------
  573|    792|                thecallbacks[i][j] = scp->next;
  574|       |                /*
  575|       |                 * if there is a client arg, check for duplicates
  576|       |                 * and then free it.
  577|       |                 */
  578|    792|                if ((NULL != scp->sc_callback) &&
  ------------------
  |  Branch (578:21): [True: 792, False: 0]
  ------------------
  579|    792|                    (scp->sc_client_arg != NULL)) {
  ------------------
  |  Branch (579:21): [True: 66, False: 726]
  ------------------
  580|     66|                    void *tmp_arg;
  581|       |                    /*
  582|       |                     * save the client arg, then set it to null so that it
  583|       |                     * won't look like a duplicate, then check for duplicates
  584|       |                     * starting at the current i,j (earlier dups should have
  585|       |                     * already been found) and free the pointer.
  586|       |                     */
  587|     66|                    tmp_arg = scp->sc_client_arg;
  588|     66|                    scp->sc_client_arg = NULL;
  589|     66|                    DEBUGMSGTL(("9:callback", "  freeing %p at [%d,%d]\n", tmp_arg, i, j));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  590|     66|                    (void)netsnmp_callback_clear_client_arg(tmp_arg, i, j);
  591|     66|                    free(tmp_arg);
  592|     66|                }
  593|       |                SNMP_FREE(scp);
  ------------------
  |  |   62|    792|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 792, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 792]
  |  |  ------------------
  ------------------
  594|    792|                scp = thecallbacks[i][j];
  595|    792|            }
  596|  2.37k|            _callback_unlock(i,j);
  597|  2.37k|        }
  598|    132|    }
  599|     66|}
callback.c:_callback_lock:
  119|  3.63k|{
  120|  3.63k|    int lock_holded=0;
  121|  3.63k|    NETSNMP_SELECT_TIMEVAL lock_time;
  ------------------
  |  | 1783|  3.63k|#define NETSNMP_SELECT_TIMEVAL struct timeval
  ------------------
  122|       |
  123|       |#ifdef NETSNMP_PARANOID_LEVEL_HIGH
  124|       |    if (major < 0 || major >= MAX_CALLBACK_IDS ||
  125|       |        minor < 0 || minor >= MAX_CALLBACK_SUBIDS) {
  126|       |        netsnmp_assert("bad callback id");
  127|       |        return 1;
  128|       |    }
  129|       |#endif
  130|       |    
  131|  3.63k|#ifdef CALLBACK_NAME_LOGGING
  132|  3.63k|    DEBUGMSGTL(("9:callback:lock", "locked (%s,%s)\n",
  ------------------
  |  |   66|  3.63k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.63k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.63k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#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.63k]
  |  |  ------------------
  ------------------
  133|  3.63k|                types[major], (SNMP_CALLBACK_LIBRARY == major) ?
  134|  3.63k|                SNMP_STRORNULL(lib[minor]) : "null"));
  135|  3.63k|#endif
  136|  3.63k|    while (CALLBACK_LOCK_COUNT(major,minor) >= 1 && ++lock_holded < 100) {
  ------------------
  |  |  109|  3.63k|#define CALLBACK_LOCK_COUNT(maj,min) _locks[maj][min]
  ------------------
  |  Branch (136:12): [True: 0, False: 3.63k]
  |  Branch (136:53): [True: 0, False: 0]
  ------------------
  137|      0|	lock_time.tv_sec = 0;
  138|      0|	lock_time.tv_usec = 1000;
  139|      0|	select(0, NULL, NULL, NULL, &lock_time);
  140|      0|    }
  141|       |
  142|  3.63k|    if(lock_holded >= 100) {
  ------------------
  |  Branch (142:8): [True: 0, False: 3.63k]
  ------------------
  143|      0|        if (NULL != warn)
  ------------------
  |  Branch (143:13): [True: 0, False: 0]
  ------------------
  144|      0|            snmp_log(LOG_WARNING,
  145|      0|                     "lock in _callback_lock sleeps more than 100 milliseconds in %s\n", warn);
  146|      0|        if (do_assert)
  ------------------
  |  Branch (146:13): [True: 0, False: 0]
  ------------------
  147|      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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  148|       |        
  149|      0|        return 1;
  150|      0|    }
  151|       |
  152|  3.63k|    CALLBACK_LOCK(major,minor);
  ------------------
  |  |  107|  3.63k|#define CALLBACK_LOCK(maj,min) ++_locks[maj][min]
  ------------------
  153|  3.63k|    return 0;
  154|  3.63k|}
callback.c:_callback_unlock:
  158|  3.63k|{
  159|       |#ifdef NETSNMP_PARANOID_LEVEL_HIGH
  160|       |    if (major < 0 || major >= MAX_CALLBACK_IDS ||
  161|       |        minor < 0 || minor >= MAX_CALLBACK_SUBIDS) {
  162|       |        netsnmp_assert("bad callback id");
  163|       |        return;
  164|       |    }
  165|       |#endif
  166|       |    
  167|  3.63k|    CALLBACK_UNLOCK(major,minor);
  ------------------
  |  |  108|  3.63k|#define CALLBACK_UNLOCK(maj,min) --_locks[maj][min]
  ------------------
  168|       |
  169|  3.63k|    if (CALLBACK_LOCK_COUNT(major,minor) == 0) {
  ------------------
  |  |  109|  3.63k|#define CALLBACK_LOCK_COUNT(maj,min) _locks[maj][min]
  ------------------
  |  Branch (169:9): [True: 3.63k, False: 0]
  ------------------
  170|  3.63k|        struct snmp_gen_callback *scp, **prevNext;
  171|  3.63k|        scp = thecallbacks[major][minor];
  172|  3.63k|        prevNext = &(thecallbacks[major][minor]);
  173|  6.00k|        while (scp != NULL) {
  ------------------
  |  Branch (173:16): [True: 2.37k, False: 3.63k]
  ------------------
  174|  2.37k|            if (scp->sc_callback == NULL) {
  ------------------
  |  Branch (174:17): [True: 0, False: 2.37k]
  ------------------
  175|      0|                *prevNext = scp->next;
  176|      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]
  |  |  ------------------
  ------------------
  177|      0|                scp = *prevNext;
  178|  2.37k|            } else {
  179|  2.37k|                prevNext = &(scp->next);
  180|  2.37k|                scp = scp->next;
  181|  2.37k|            }
  182|  2.37k|        }
  183|  3.63k|    }
  184|       |
  185|  3.63k|#ifdef CALLBACK_NAME_LOGGING
  186|  3.63k|    DEBUGMSGTL(("9:callback:lock", "unlocked (%s,%s)\n",
  ------------------
  |  |   66|  3.63k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.63k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.63k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#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.63k]
  |  |  ------------------
  ------------------
  187|  3.63k|                types[major], (SNMP_CALLBACK_LIBRARY == major) ?
  188|  3.63k|                SNMP_STRORNULL(lib[minor]) : "null"));
  189|  3.63k|#endif
  190|  3.63k|}

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

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

netsnmp_binary_array_release:
  216|    396|{
  217|    396|    binary_array_table *t = (binary_array_table*)c->container_data;
  218|    396|    SNMP_FREE(t->data);
  ------------------
  |  |   62|    396|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 330]
  |  |  |  Branch (62:66): [Folded, False: 396]
  |  |  ------------------
  ------------------
  219|    396|    SNMP_FREE(t);
  ------------------
  |  |   62|    396|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 396, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 396]
  |  |  ------------------
  ------------------
  220|    396|    SNMP_FREE(c->container_name);
  ------------------
  |  |   62|    396|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 396]
  |  |  |  Branch (62:66): [Folded, False: 396]
  |  |  ------------------
  ------------------
  221|       |    SNMP_FREE(c);
  ------------------
  |  |   62|    396|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 396, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 396]
  |  |  ------------------
  ------------------
  222|    396|}
netsnmp_binary_array_options_set:
  232|    264|{
  233|    264|#define BA_FLAGS (CONTAINER_KEY_ALLOW_DUPLICATES|CONTAINER_KEY_UNSORTED)
  234|       |
  235|    264|    if (set) {
  ------------------
  |  Branch (235:9): [True: 264, False: 0]
  ------------------
  236|    264|        if ((flags & BA_FLAGS) == flags) {
  ------------------
  |  |  233|    264|#define BA_FLAGS (CONTAINER_KEY_ALLOW_DUPLICATES|CONTAINER_KEY_UNSORTED)
  |  |  ------------------
  |  |  |  |  370|    264|#define CONTAINER_KEY_ALLOW_DUPLICATES             0x00000001
  |  |  ------------------
  |  |               #define BA_FLAGS (CONTAINER_KEY_ALLOW_DUPLICATES|CONTAINER_KEY_UNSORTED)
  |  |  ------------------
  |  |  |  |  371|    264|#define CONTAINER_KEY_UNSORTED                     0x00000002
  |  |  ------------------
  ------------------
  |  Branch (236:13): [True: 264, False: 0]
  ------------------
  237|       |            /** if turning off unsorted, do sort */
  238|    264|            int sort = ((c->flags & CONTAINER_KEY_UNSORTED) &&
  ------------------
  |  |  371|    264|#define CONTAINER_KEY_UNSORTED                     0x00000002
  ------------------
  |  Branch (238:25): [True: 0, False: 264]
  ------------------
  239|      0|                        ! (flags & CONTAINER_KEY_UNSORTED));
  ------------------
  |  |  371|      0|#define CONTAINER_KEY_UNSORTED                     0x00000002
  ------------------
  |  Branch (239:25): [True: 0, False: 0]
  ------------------
  240|    264|            c->flags = flags;
  241|    264|            if (sort) {
  ------------------
  |  Branch (241:17): [True: 0, False: 264]
  ------------------
  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|    264|            return flags;
  247|    264|        } else {
  248|      0|            return -1; /* unsupported flag */
  249|      0|        }
  250|    264|    } else {
  251|      0|        return ((c->flags & flags) == flags);
  252|      0|    }
  253|    264|}
netsnmp_container_get_binary_array:
  817|    396|{
  818|       |    /*
  819|       |     * allocate memory
  820|       |     */
  821|    396|    netsnmp_container *c = SNMP_MALLOC_TYPEDEF(netsnmp_container);
  ------------------
  |  |   73|    396|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  822|    396|    if (NULL==c) {
  ------------------
  |  Branch (822:9): [True: 0, False: 396]
  ------------------
  823|      0|        snmp_log(LOG_ERR, "couldn't allocate memory\n");
  824|      0|        return NULL;
  825|      0|    }
  826|       |
  827|    396|    c->container_data = netsnmp_binary_array_initialize();
  828|    396|    if (NULL == c->container_data) {
  ------------------
  |  Branch (828:9): [True: 0, False: 396]
  ------------------
  829|      0|        free(c);
  830|      0|        snmp_log(LOG_ERR, "couldn't allocate memory for container_data\n");
  831|      0|        return NULL;
  832|      0|    }
  833|       |
  834|       |    /*
  835|       |     * NOTE: CHANGES HERE MUST BE DUPLICATED IN duplicate AS WELL!!
  836|       |     */
  837|    396|    netsnmp_init_container(c, NULL, _ba_free, _ba_size, NULL, _ba_insert,
  838|    396|                           _ba_remove, _ba_find);
  839|    396|    c->find_next = _ba_find_next;
  840|    396|    c->get_subset = _ba_get_subset;
  841|    396|    c->get_iterator = _ba_iterator_get;
  842|    396|    c->for_each = _ba_for_each;
  843|    396|    c->clear = _ba_clear;
  844|    396|    c->options = _ba_options;
  845|    396|    c->duplicate = _ba_duplicate;
  846|    396|    c->get_at = netsnmp_binary_array_get_at;
  847|    396|    c->remove_at = netsnmp_binary_array_remove_at;
  848|    396|    c->insert_before = _ba_insert_before;
  849|       |
  850|    396|    return c;
  851|    396|}
netsnmp_container_get_binary_array_factory:
  855|     66|{
  856|     66|    static netsnmp_factory f = { "binary_array",
  857|     66|                                 netsnmp_container_get_binary_array };
  858|       |    
  859|     66|    return &f;
  860|     66|}
netsnmp_container_binary_array_init:
  864|     66|{
  865|     66|    netsnmp_container_register("binary_array",
  866|     66|                               netsnmp_container_get_binary_array_factory());
  867|     66|}
container_binary_array.c:_ba_is_sorted:
  336|    792|{
  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|    792|    return 1;
  351|    792|}
container_binary_array.c:binary_search:
  125|  2.64k|{
  126|  2.64k|    binary_array_table *t = (binary_array_table*)c->container_data;
  127|  2.64k|    size_t             len = t->count;
  128|  2.64k|    size_t             half;
  129|  2.64k|    size_t             first = 0;
  130|  2.64k|    size_t             middle = 0; /* init not needed; keeps compiler happy */
  131|  2.64k|    int                result = 0; /* init not needed; keeps compiler happy */
  132|       |
  133|  2.64k|    if (!len) {
  ------------------
  |  Branch (133:9): [True: 0, False: 2.64k]
  ------------------
  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.64k|    if (c->flags & CONTAINER_KEY_UNSORTED) {
  ------------------
  |  |  371|  2.64k|#define CONTAINER_KEY_UNSORTED                     0x00000002
  ------------------
  |  Branch (139:9): [True: 0, False: 2.64k]
  ------------------
  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.64k|    if (t->dirty)
  ------------------
  |  Branch (148:9): [True: 0, False: 2.64k]
  ------------------
  149|      0|        Sort_Array(c);
  150|       |
  151|  10.3k|    while (len > 0) {
  ------------------
  |  Branch (151:12): [True: 8.51k, False: 1.84k]
  ------------------
  152|  8.51k|        half = len >> 1;
  153|  8.51k|        middle = first + half;
  154|  8.51k|        if ((result = c->compare(t->data[middle], val)) < 0) {
  ------------------
  |  Branch (154:13): [True: 2.83k, False: 5.67k]
  ------------------
  155|  2.83k|            first = middle + 1;
  156|  2.83k|            len = len - half - 1;
  157|  5.67k|        } else if (result == 0) {
  ------------------
  |  Branch (157:20): [True: 792, False: 4.88k]
  ------------------
  158|    792|            first = middle;
  159|    792|            break;
  160|  4.88k|        } else {
  161|  4.88k|            len = half;
  162|  4.88k|        }
  163|  8.51k|    }
  164|       |
  165|  2.64k|    if (first >= t->count) {
  ------------------
  |  Branch (165:9): [True: 264, False: 2.37k]
  ------------------
  166|    264|        if (exact && NULL != next)
  ------------------
  |  Branch (166:13): [True: 264, False: 0]
  |  Branch (166:22): [True: 132, False: 132]
  ------------------
  167|    132|            *next = t->count;
  168|    264|        return -1;
  169|    264|    }
  170|       |
  171|  2.37k|    if (first != middle) {
  ------------------
  |  Branch (171:9): [True: 1.32k, False: 1.05k]
  ------------------
  172|       |        /* last compare wasn't against first, so get actual result */
  173|  1.32k|        result = c->compare(t->data[first], val);
  174|  1.32k|    }
  175|       |
  176|  2.37k|    if(result == 0) {
  ------------------
  |  Branch (176:8): [True: 792, False: 1.58k]
  ------------------
  177|    792|        if (exact && NULL != next)
  ------------------
  |  Branch (177:13): [True: 792, False: 0]
  |  Branch (177:22): [True: 0, False: 792]
  ------------------
  178|      0|            *next = first+1;
  179|    792|        else if (!exact && ++first == t->count) {
  ------------------
  |  Branch (179:18): [True: 0, False: 792]
  |  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.58k|    } else if(exact) {
  ------------------
  |  Branch (184:15): [True: 1.58k, False: 0]
  ------------------
  185|  1.58k|        if (NULL != next) {
  ------------------
  |  Branch (185:13): [True: 594, False: 990]
  ------------------
  186|    594|            if (result > 0)
  ------------------
  |  Branch (186:17): [True: 594, False: 0]
  ------------------
  187|    594|                *next = first;
  188|      0|            else
  189|      0|                *next = t->count;
  190|    594|        }
  191|  1.58k|        first = -1;
  192|  1.58k|    }
  193|       |
  194|  2.37k|    return first;
  195|  2.64k|}
container_binary_array.c:netsnmp_binary_array_initialize:
  199|    396|{
  200|    396|    binary_array_table *t;
  201|       |
  202|    396|    t = SNMP_MALLOC_TYPEDEF(binary_array_table);
  ------------------
  |  |   73|    396|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  203|    396|    if (t == NULL)
  ------------------
  |  Branch (203:9): [True: 0, False: 396]
  ------------------
  204|      0|        return NULL;
  205|       |
  206|    396|    t->max_size = 0;
  207|    396|    t->count = 0;
  208|    396|    t->dirty = 0;
  209|    396|    t->data = NULL;
  210|       |
  211|    396|    return t;
  212|    396|}
container_binary_array.c:_ba_free:
  713|    396|{
  714|    396|    netsnmp_binary_array_release(container);
  715|    396|    return 0;
  716|    396|}
container_binary_array.c:_ba_size:
  720|      1|{
  721|      1|    return netsnmp_binary_array_count(container);
  722|      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:
  694|    792|{
  695|    792|    return netsnmp_binary_array_insert(container, data);
  696|    792|}
container_binary_array.c:netsnmp_binary_array_insert:
  533|    792|{
  534|    792|    binary_array_table *t = (binary_array_table*)c->container_data;
  535|    792|    const int duplicates_allowed = c->flags & CONTAINER_KEY_ALLOW_DUPLICATES;
  ------------------
  |  |  370|    792|#define CONTAINER_KEY_ALLOW_DUPLICATES             0x00000001
  ------------------
  536|    792|    const int sorted = !(c->flags & CONTAINER_KEY_UNSORTED);
  ------------------
  |  |  371|    792|#define CONTAINER_KEY_UNSORTED                     0x00000002
  ------------------
  537|    792|    int             i = -2;
  538|    792|    size_t          next, pos;
  539|    792|    void           *entry = NETSNMP_REMOVE_CONST(void *, const_entry);
  ------------------
  |  |   91|    792|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  540|       |
  541|    792|    if (NULL == entry)
  ------------------
  |  Branch (541:9): [True: 0, False: 792]
  ------------------
  542|      0|        return -1;
  543|       |
  544|       |    /*
  545|       |     * check key if we have at least 1 item and duplicates aren't allowed
  546|       |     */
  547|    792|    if (!duplicates_allowed && t->count) {
  ------------------
  |  Branch (547:9): [True: 792, False: 0]
  |  Branch (547:32): [True: 726, False: 66]
  ------------------
  548|    726|        i = binary_search(entry, c, 1, &next);
  549|    726|        if (i >= 0) {
  ------------------
  |  Branch (549:13): [True: 0, False: 726]
  ------------------
  550|      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]
  |  |  ------------------
  ------------------
  551|      0|            return -1;
  552|      0|        }
  553|    726|    }
  554|       | 
  555|       |    /*
  556|       |     * if unsorted, just add at the end
  557|       |     */
  558|    792|    if (!sorted) {
  ------------------
  |  Branch (558:9): [True: 0, False: 792]
  ------------------
  559|      0|        pos = t->count;
  560|    792|    } else {
  561|       |        /** if we haven't searched for key yet, do it now */
  562|    792|        if (-2 == i) {
  ------------------
  |  Branch (562:13): [True: 66, False: 726]
  ------------------
  563|     66|            if (0 == t->count) {
  ------------------
  |  Branch (563:17): [True: 66, False: 0]
  ------------------
  564|     66|                next = 0;
  565|     66|                i = -1;
  566|     66|            } else {
  567|      0|                i = binary_search(entry, c, 1, &next);
  568|      0|            }
  569|     66|        }
  570|       |
  571|    792|        pos = next;
  572|       |        /* if key found, advance past any duplicates */
  573|    792|        if (duplicates_allowed && i >= 0)
  ------------------
  |  Branch (573:13): [True: 0, False: 792]
  |  Branch (573:35): [True: 0, False: 0]
  ------------------
  574|      0|            while (pos < t->count && c->compare(t->data[pos], entry) == 0)
  ------------------
  |  Branch (574:20): [True: 0, False: 0]
  |  Branch (574:38): [True: 0, False: 0]
  ------------------
  575|      0|                ++pos;
  576|    792|    }
  577|       |
  578|    792|    return netsnmp_binary_array_insert_before(c, pos, entry, !sorted);
  579|    792|}
container_binary_array.c:netsnmp_binary_array_insert_before:
  487|    792|{
  488|    792|    binary_array_table *t = (binary_array_table*)c->container_data;
  489|       |
  490|    792|    if (NULL == entry)
  ------------------
  |  Branch (490:9): [True: 0, False: 792]
  ------------------
  491|      0|        return -1;
  492|       |
  493|    792|    if (index > t->count) {
  ------------------
  |  Branch (493:9): [True: 0, False: 792]
  ------------------
  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|    792|    if (_ba_resize_check(t) < 0)
  ------------------
  |  Branch (501:9): [True: 0, False: 792]
  ------------------
  502|      0|        return -1;
  503|       |
  504|    792|    netsnmp_assert(t->count < t->max_size);
  ------------------
  |  |   47|    792|#      define netsnmp_assert(x)  do { \
  |  |   48|    792|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 792, False: 0]
  |  |  ------------------
  |  |   49|    792|                 ; \
  |  |   50|    792|              else \
  |  |   51|    792|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    792|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 792]
  |  |  ------------------
  ------------------
  505|       |
  506|       |    /*
  507|       |     * shift array
  508|       |     */
  509|    792|    memmove(&t->data[index+1], &t->data[index],
  510|    792|            sizeof(void*) * (t->count - index));
  511|       |
  512|       |    /*
  513|       |     * Insert the new entry into the data array
  514|       |     */
  515|    792|    t->data[index] = NETSNMP_REMOVE_CONST(void *, entry);
  ------------------
  |  |   91|    792|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  516|    792|    ++t->count;
  517|       |
  518|    792|    netsnmp_assert(index < t->count);
  ------------------
  |  |   47|    792|#      define netsnmp_assert(x)  do { \
  |  |   48|    792|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 792, False: 0]
  |  |  ------------------
  |  |   49|    792|                 ; \
  |  |   50|    792|              else \
  |  |   51|    792|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    792|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 792]
  |  |  ------------------
  ------------------
  519|    792|    netsnmp_assert(t->count <= t->max_size);
  ------------------
  |  |   47|    792|#      define netsnmp_assert(x)  do { \
  |  |   48|    792|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 792, False: 0]
  |  |  ------------------
  |  |   49|    792|                 ; \
  |  |   50|    792|              else \
  |  |   51|    792|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    792|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 792]
  |  |  ------------------
  ------------------
  520|       |
  521|    792|    if (dirty)
  ------------------
  |  Branch (521:9): [True: 0, False: 792]
  ------------------
  522|      0|        t->dirty = 1;
  523|       |
  524|    792|    netsnmp_assert(t->dirty || _ba_is_sorted(c));
  ------------------
  |  |   47|    792|#      define netsnmp_assert(x)  do { \
  |  |   48|  2.37k|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 792]
  |  |  |  Branch (48:20): [True: 792, False: 0]
  |  |  ------------------
  |  |   49|    792|                 ; \
  |  |   50|    792|              else \
  |  |   51|    792|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    792|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 792]
  |  |  ------------------
  ------------------
  525|       |
  526|    792|    ++c->sync;
  527|       |
  528|    792|    return 0;
  529|    792|}
container_binary_array.c:_ba_resize_check:
  458|    792|{
  459|    792|    size_t new_max;
  460|    792|    void ** new_data;
  461|    792|    if (t->max_size > t->count)
  ------------------
  |  Branch (461:9): [True: 660, False: 132]
  ------------------
  462|    660|        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|    132|    new_max = t->max_size > 0 ? 2 * t->max_size : 10;
  ------------------
  |  Branch (468:15): [True: 66, False: 66]
  ------------------
  469|    132|    new_data = (void**) realloc(t->data, new_max * sizeof(void*));
  470|    132|    if (new_data == NULL) {
  ------------------
  |  Branch (470:9): [True: 0, False: 132]
  ------------------
  471|      0|        snmp_log(LOG_ERR, "malloc failed in _ba_resize_check\n");
  472|      0|        return -1; /* error */
  473|      0|    }
  474|       |
  475|    132|    memset(new_data + t->max_size, 0x0,
  476|    132|           (new_max - t->max_size) * sizeof(void*));
  477|       |
  478|    132|    t->data = new_data;
  479|    132|    t->max_size = new_max;
  480|       |
  481|    132|    return 1; /* resized */
  482|    132|}
container_binary_array.c:_ba_find:
  682|  1.98k|{
  683|  1.98k|    return netsnmp_binary_array_get(container, data, 1);
  684|  1.98k|}
container_binary_array.c:netsnmp_binary_array_get:
  267|  1.98k|{
  268|  1.98k|    binary_array_table *t = (binary_array_table*)c->container_data;
  269|  1.98k|    int             index = 0;
  270|       |
  271|       |    /*
  272|       |     * if there is no data, return NULL;
  273|       |     */
  274|  1.98k|    if (!t->count)
  ------------------
  |  Branch (274:9): [True: 66, False: 1.91k]
  ------------------
  275|     66|        return NULL;
  276|       |
  277|       |    /*
  278|       |     * if the table is dirty, sort it.
  279|       |     */
  280|  1.91k|    if (t->dirty)
  ------------------
  |  Branch (280:9): [True: 0, False: 1.91k]
  ------------------
  281|      0|        Sort_Array(c);
  282|       |
  283|       |    /*
  284|       |     * if there is a key, search. Otherwise default is 0;
  285|       |     */
  286|  1.91k|    if (key) {
  ------------------
  |  Branch (286:9): [True: 1.91k, False: 0]
  ------------------
  287|  1.91k|        if ((index = binary_search(key, c, exact, NULL)) == -1)
  ------------------
  |  Branch (287:13): [True: 1.12k, False: 792]
  ------------------
  288|  1.12k|            return NULL;
  289|    792|        if (!exact &&
  ------------------
  |  Branch (289:13): [True: 0, False: 792]
  ------------------
  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|    792|    }
  308|       |
  309|    792|    return t->data[index];
  310|  1.91k|}
container_binary_array.c:_ba_for_each:
  727|     66|{
  728|     66|    netsnmp_binary_array_for_each(container, f, context, 1);
  729|     66|}
container_binary_array.c:netsnmp_binary_array_for_each:
  426|     66|{
  427|     66|    binary_array_table *t = (binary_array_table*)c->container_data;
  428|     66|    size_t             i;
  429|       |
  430|     66|    if (sort && t->dirty)
  ------------------
  |  Branch (430:9): [True: 66, False: 0]
  |  Branch (430:17): [True: 0, False: 66]
  ------------------
  431|      0|        Sort_Array(c);
  432|       |
  433|    858|    for (i = 0; i < t->count; ++i)
  ------------------
  |  Branch (433:17): [True: 792, False: 66]
  ------------------
  434|    792|        (*fe) (t->data[i], context);
  435|     66|}
container_binary_array.c:_ba_clear:
  734|    330|{
  735|    330|    netsnmp_binary_array_clear(container, f, context);
  736|    330|}
container_binary_array.c:netsnmp_binary_array_clear:
  441|    330|{
  442|    330|    binary_array_table *t = (binary_array_table*)c->container_data;
  443|       |
  444|    330|    if( NULL != fe ) {
  ------------------
  |  Branch (444:9): [True: 132, False: 198]
  ------------------
  445|    132|        size_t             i;
  446|       |
  447|    132|        for (i = 0; i < t->count; ++i)
  ------------------
  |  Branch (447:21): [True: 0, False: 132]
  ------------------
  448|      0|            (*fe) (t->data[i], context);
  449|    132|    }
  450|       |
  451|    330|    t->count = 0;
  452|    330|    t->dirty = 0;
  453|    330|    ++c->sync;
  454|    330|}
container_binary_array.c:_ba_options:
  762|    264|{
  763|    264|    return netsnmp_binary_array_options_set(c, set, flags);
  764|    264|}
container_binary_array.c:_ba_iterator_get:
 1026|      1|{
 1027|      1|    binary_array_iterator* it;
 1028|       |
 1029|      1|    if(NULL == c)
  ------------------
  |  Branch (1029:8): [True: 0, False: 1]
  ------------------
 1030|      0|        return NULL;
 1031|       |
 1032|      1|    it = SNMP_MALLOC_TYPEDEF(binary_array_iterator);
  ------------------
  |  |   73|      1|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 1033|      1|    if(NULL == it)
  ------------------
  |  Branch (1033:8): [True: 0, False: 1]
  ------------------
 1034|      0|        return NULL;
 1035|       |
 1036|      1|    it->base.container = c;
 1037|       |    
 1038|      1|    it->base.first = _ba_iterator_first;
 1039|      1|    it->base.next = _ba_iterator_next;
 1040|      1|    it->base.curr = _ba_iterator_curr;
 1041|      1|    it->base.last = _ba_iterator_last;
 1042|      1|    it->base.remove = _ba_iterator_remove;
 1043|      1|    it->base.reset = _ba_iterator_reset;
 1044|      1|    it->base.release = _ba_iterator_release;
 1045|       |
 1046|      1|    (void)_ba_iterator_reset(&it->base);
 1047|       |
 1048|      1|    return &it->base;
 1049|      1|}
container_binary_array.c:_ba_iterator_first:
  932|      1|{
  933|      1|    binary_array_iterator *it = (void *)nit;
  934|       |
  935|      1|    return _ba_iterator_position(it, 0);
  936|      1|}
container_binary_array.c:_ba_iterator_position:
  895|      1|{
  896|      1|    binary_array_table *t = _ba_it2cont(it);
  897|      1|    if (NULL == t)
  ------------------
  |  Branch (897:9): [True: 0, False: 1]
  ------------------
  898|      0|        return t; /* msg already logged */
  899|       |
  900|      1|    if(it->base.container->sync != it->base.sync) {
  ------------------
  |  Branch (900:8): [True: 0, False: 1]
  ------------------
  901|      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]
  |  |  ------------------
  ------------------
  902|      0|        return NULL;
  903|      0|    }
  904|       |    
  905|      1|    if(0 == t->count) {
  ------------------
  |  Branch (905:8): [True: 1, False: 0]
  ------------------
  906|      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]
  |  |  ------------------
  ------------------
  907|      1|        return NULL;
  908|      1|    }
  909|      0|    else if(pos >= t->count) {
  ------------------
  |  Branch (909:13): [True: 0, False: 0]
  ------------------
  910|      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]
  |  |  ------------------
  ------------------
  911|      0|        return NULL;
  912|      0|    }
  913|       |
  914|      0|    return t->data[ pos ];
  915|      1|}
container_binary_array.c:_ba_it2cont:
  876|      2|{
  877|      2|    if(NULL == it) {
  ------------------
  |  Branch (877:8): [True: 0, False: 2]
  ------------------
  878|      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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  879|      0|        return NULL;
  880|      0|    }
  881|      2|    if(NULL == it->base.container) {
  ------------------
  |  Branch (881:8): [True: 0, False: 2]
  ------------------
  882|      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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  883|      0|        return NULL;
  884|      0|    }
  885|      2|    if(NULL == it->base.container->container_data) {
  ------------------
  |  Branch (885:8): [True: 0, False: 2]
  ------------------
  886|      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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  887|      0|        return NULL;
  888|      0|    }
  889|       |
  890|      2|    return (binary_array_table*)(it->base.container->container_data);
  891|      2|}
container_binary_array.c:_ba_iterator_reset:
  994|      1|{
  995|      1|    binary_array_iterator *it = (void *)nit;
  996|      1|    binary_array_table* t = _ba_it2cont(it);
  997|      1|    if(NULL == t) {
  ------------------
  |  Branch (997:8): [True: 0, False: 1]
  ------------------
  998|      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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  999|      0|        return -1;
 1000|      0|    }
 1001|       |
 1002|      1|    if (t->dirty)
  ------------------
  |  Branch (1002:9): [True: 0, False: 1]
  ------------------
 1003|      0|        Sort_Array(it->base.container);
 1004|       |
 1005|       |    /*
 1006|       |     * save sync count, to make sure container doesn't change while
 1007|       |     * iterator is in use.
 1008|       |     */
 1009|      1|    it->base.sync = it->base.container->sync;
 1010|       |
 1011|      1|    it->pos = 0;
 1012|       |
 1013|      1|    return 0;
 1014|      1|}
container_binary_array.c:_ba_iterator_release:
 1018|      1|{
 1019|      1|    free(it);
 1020|       |
 1021|      1|    return 0;
 1022|      1|}

netsnmp_container_get_usll:
  393|     66|{
  394|       |    /*
  395|       |     * allocate memory
  396|       |     */
  397|     66|    sl_container *sl = (sl_container *)netsnmp_container_get_ssll();
  398|     66|    if (NULL==sl)
  ------------------
  |  Branch (398:9): [True: 0, False: 66]
  ------------------
  399|      0|        return NULL; /* msg already logged */
  400|       |
  401|     66|    sl->unsorted = 1;
  402|       |
  403|     66|    return (netsnmp_container*)sl;
  404|     66|}
netsnmp_container_get_singly_linked_list:
  408|     66|{
  409|     66|    sl_container *sl = (sl_container *)netsnmp_container_get_usll();
  410|     66|    if (NULL == sl)
  ------------------
  |  Branch (410:9): [True: 0, False: 66]
  ------------------
  411|      0|        return NULL; /* error already logged */
  412|       |
  413|     66|    sl->fifo = fifo;
  414|       |
  415|     66|    return (netsnmp_container *)sl;
  416|     66|}
netsnmp_container_get_fifo:
  420|     66|{
  421|     66|    return netsnmp_container_get_singly_linked_list(1);
  422|     66|}
netsnmp_container_ssll_init:
  426|     66|{
  427|     66|    static netsnmp_factory ssll = {
  428|     66|        "sorted_singly_linked_list",
  429|     66|        netsnmp_container_get_ssll
  430|     66|    };
  431|     66|    static netsnmp_factory usll = {
  432|     66|        "unsorted_singly_linked_list-lifo",
  433|     66|        netsnmp_container_get_usll
  434|     66|    };
  435|     66|    static netsnmp_factory fifo = {
  436|     66|        "unsorted_singly_linked_list-fifo",
  437|     66|        netsnmp_container_get_fifo
  438|     66|    };
  439|       |
  440|     66|    netsnmp_container_register("sorted_singly_linked_list", &ssll);
  441|     66|    netsnmp_container_register("unsorted_singly_linked_list", &usll);
  442|     66|    netsnmp_container_register("lifo", &usll);
  443|     66|    netsnmp_container_register("fifo", &fifo);
  444|     66|}
container_list_ssll.c:netsnmp_container_get_ssll:
  368|     66|{
  369|       |    /*
  370|       |     * allocate memory
  371|       |     */
  372|     66|    sl_container *sl = SNMP_MALLOC_TYPEDEF(sl_container);
  ------------------
  |  |   73|     66|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  373|     66|    if (NULL==sl) {
  ------------------
  |  Branch (373:9): [True: 0, False: 66]
  ------------------
  374|      0|        snmp_log(LOG_ERR, "couldn't allocate memory\n");
  375|      0|        return NULL;
  376|      0|    }
  377|       |
  378|     66|    netsnmp_init_container((netsnmp_container *)sl, NULL, _ssll_free,
  379|     66|                           _ssll_size, NULL, _ssll_insert, _ssll_remove,
  380|     66|                           _ssll_find);
  381|     66|    sl->c.find_next = _ssll_find_next;
  382|     66|    sl->c.get_subset = NULL;
  383|     66|    sl->c.get_iterator =_ssll_iterator_get;
  384|     66|    sl->c.for_each = _ssll_for_each;
  385|     66|    sl->c.clear = _ssll_clear;
  386|     66|    sl->c.duplicate = _ssll_duplicate;
  387|       |
  388|     66|    return &sl->c;
  389|     66|}
container_list_ssll.c:_ssll_free:
  110|     66|{
  111|     66|    if(c) {
  ------------------
  |  Branch (111:8): [True: 66, False: 0]
  ------------------
  112|     66|        sl_container *sl = (sl_container *)c;
  113|     66|        sl_node *curr, *next;
  114|       |
  115|     66|        for (curr = sl->head; curr; curr = next) {
  ------------------
  |  Branch (115:31): [True: 0, False: 66]
  ------------------
  116|      0|            next = curr->next;
  117|      0|            free(curr);
  118|      0|        }
  119|     66|        free(c);
  120|     66|    }
  121|     66|    return 0;
  122|     66|}
container_list_ssll.c:_ssll_clear:
  294|     66|{
  295|     66|    sl_container *sl = (sl_container*)c;
  296|     66|    sl_node  *curr, *next;
  297|       |    
  298|     66|    if(NULL == c)
  ------------------
  |  Branch (298:8): [True: 0, False: 66]
  ------------------
  299|      0|        return;
  300|       |    
  301|     66|    for(curr = sl->head; curr; curr = next) {
  ------------------
  |  Branch (301:26): [True: 0, False: 66]
  ------------------
  302|       |
  303|      0|        next = curr->next;
  304|       |
  305|      0|        if( NULL != f ) {
  ------------------
  |  Branch (305:13): [True: 0, False: 0]
  ------------------
  306|      0|            curr->next = NULL;
  307|      0|            (*f) ((void *)curr->data, context);
  308|      0|        }
  309|       |
  310|       |        /*
  311|       |         * free our node structure, but not the data
  312|       |         */
  313|      0|        free(curr);
  314|      0|    }
  315|       |    sl->head = NULL;
  316|     66|    sl->count = 0;
  317|     66|    ++c->sync;
  318|     66|}

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

netsnmp_free_all_list_data:
   49|    198|{
   50|    198|    netsnmp_data_list *tmpptr;
   51|    198|    for (; head;) {
  ------------------
  |  Branch (51:12): [True: 0, False: 198]
  ------------------
   52|      0|        netsnmp_free_list_data(head);
   53|      0|        tmpptr = head;
   54|      0|        head = head->next;
   55|       |        SNMP_FREE(tmpptr);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
   56|      0|    }
   57|    198|}
shutdown_data_list:
  399|     66|{
  400|     66|    netsnmp_free_all_list_data(saveHead);
  401|     66|}

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

netsnmp_large_fd_setfd:
  122|     65|{
  123|     65|    netsnmp_assert(fd >= 0);
  ------------------
  |  |   47|     65|#      define netsnmp_assert(x)  do { \
  |  |   48|     65|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 65, False: 0]
  |  |  ------------------
  |  |   49|     65|                 ; \
  |  |   50|     65|              else \
  |  |   51|     65|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     65|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 65]
  |  |  ------------------
  ------------------
  124|       |
  125|     65|    while (fd >= (int)fdset->lfs_setsize) {
  ------------------
  |  Branch (125:12): [True: 0, False: 65]
  ------------------
  126|      0|        if (!netsnmp_large_fd_set_resize(fdset, 2 * (fdset->lfs_setsize + 1)))
  ------------------
  |  Branch (126:13): [True: 0, False: 0]
  ------------------
  127|      0|            return;
  128|      0|    }
  129|       |
  130|     65|    LFD_SET(fd, fdset->lfs_setptr);
  131|     65|}
netsnmp_large_fd_is_set:
  144|     65|{
  145|     65|    netsnmp_assert(fd >= 0);
  ------------------
  |  |   47|     65|#      define netsnmp_assert(x)  do { \
  |  |   48|     65|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 65, False: 0]
  |  |  ------------------
  |  |   49|     65|                 ; \
  |  |   50|     65|              else \
  |  |   51|     65|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     65|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 65]
  |  |  ------------------
  ------------------
  146|       |
  147|     65|    return ((unsigned)fd < fdset->lfs_setsize &&
  ------------------
  |  Branch (147:13): [True: 65, False: 0]
  ------------------
  148|     65|            LFD_ISSET(fd, fdset->lfs_setptr));
  ------------------
  |  Branch (148:13): [True: 65, False: 0]
  ------------------
  149|     65|}
netsnmp_large_fd_set_init:
  155|    130|{
  156|    130|    fdset->lfs_setsize = 0;
  157|    130|    fdset->lfs_setptr  = NULL;
  158|       |#if !defined(cygwin) && defined(HAVE_WINSOCK_H)
  159|       |    fdset->lfs_set.fd_count = 0;
  160|       |#endif
  161|    130|    netsnmp_large_fd_set_resize(fdset, setsize);
  162|    130|}
netsnmp_large_fd_set_resize:
  205|    390|{
  206|    390|    int             fd_set_bytes;
  207|       |
  208|    390|    if (fdset->lfs_setsize == setsize)
  ------------------
  |  Branch (208:9): [True: 130, False: 260]
  ------------------
  209|    130|        goto success;
  210|       |
  211|    260|    if (setsize > FD_SETSIZE) {
  ------------------
  |  Branch (211:9): [True: 0, False: 260]
  ------------------
  212|      0|        fd_set         *new_setptr;
  213|       |
  214|      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])
  |  |  ------------------
  ------------------
  215|      0|        if (fdset->lfs_setsize > FD_SETSIZE) {
  ------------------
  |  Branch (215:13): [True: 0, False: 0]
  ------------------
  216|      0|            new_setptr = realloc(fdset->lfs_setptr, fd_set_bytes);
  217|      0|            if (!new_setptr)
  ------------------
  |  Branch (217:17): [True: 0, False: 0]
  ------------------
  218|      0|                goto out_of_mem;
  219|      0|            fdset->lfs_setptr = new_setptr;
  220|      0|        } else {
  221|      0|            new_setptr = malloc(fd_set_bytes);
  222|      0|            if (!new_setptr)
  ------------------
  |  Branch (222:17): [True: 0, False: 0]
  ------------------
  223|      0|                goto out_of_mem;
  224|      0|            fdset->lfs_setptr = new_setptr;
  225|      0|            *fdset->lfs_setptr = fdset->lfs_set;
  226|      0|        }
  227|    260|    } else {
  228|    260|        if (fdset->lfs_setsize > FD_SETSIZE) {
  ------------------
  |  Branch (228:13): [True: 0, False: 260]
  ------------------
  229|      0|            fdset->lfs_set = *fdset->lfs_setptr;
  230|      0|            free(fdset->lfs_setptr);
  231|      0|        }
  232|    260|        fdset->lfs_setptr = &fdset->lfs_set;
  233|    260|    }
  234|       |
  235|    260|#if defined(cygwin) || !defined(HAVE_WINSOCK_H)
  236|       |    /*
  237|       |     * Unix: when enlarging, clear the file descriptors defined in the
  238|       |     * resized *fdset but that were not defined in the original *fdset.
  239|       |     */
  240|    260|    if ( fdset->lfs_setsize == 0 && setsize == FD_SETSIZE ) {
  ------------------
  |  Branch (240:10): [True: 130, False: 130]
  |  Branch (240:37): [True: 130, False: 0]
  ------------------
  241|       |        /* In this case we can use the OS's FD_ZERO */
  242|    130|        FD_ZERO(fdset->lfs_setptr);
  ------------------
  |  Branch (242:9): [True: 2.08k, False: 130]
  |  Branch (242:9): [Folded, False: 130]
  ------------------
  243|    130|    } else {
  244|    130|        int             i;
  245|       |
  246|    130|        for (i = fdset->lfs_setsize; i < setsize; i++)
  ------------------
  |  Branch (246:38): [True: 0, False: 130]
  ------------------
  247|      0|            LFD_CLR(i, fdset->lfs_setptr);
  248|    130|    }
  249|    260|#endif
  250|       |
  251|    260|    fdset->lfs_setsize = setsize;
  252|       |#if !defined(cygwin) && defined(HAVE_WINSOCK_H)
  253|       |    if (setsize < fdset->lfs_setptr->fd_count)
  254|       |        fdset->lfs_setptr->fd_count = setsize;
  255|       |#endif
  256|    390|success:
  257|    390|    return 1;
  258|       |
  259|      0|out_of_mem:
  260|      0|    return 0;
  261|    260|}
netsnmp_large_fd_set_cleanup:
  265|    130|{
  266|    130|    netsnmp_large_fd_set_resize(fdset, 0);
  267|    130|    fdset->lfs_setsize = 0;
  268|       |    fdset->lfs_setptr  = NULL;
  269|    130|}
netsnmp_copy_fd_set_to_large_fd_set:
  274|    130|{
  275|       |    netsnmp_large_fd_set_resize(dst, FD_SETSIZE);
  276|    130|    *dst->lfs_setptr = *src;
  277|    130|}
netsnmp_copy_large_fd_set_to_fd_set:
  282|     65|{
  283|       |    /* Report failure if *src is larger than FD_SETSIZE. */
  284|     65|    if (src->lfs_setsize > FD_SETSIZE) {
  ------------------
  |  Branch (284:9): [True: 0, False: 65]
  ------------------
  285|      0|        FD_ZERO(dst);
  ------------------
  |  Branch (285:9): [True: 0, False: 0]
  |  Branch (285:9): [Folded, False: 0]
  ------------------
  286|      0|        return -1;
  287|      0|    }
  288|       |
  289|     65|    *dst = *src->lfs_setptr;
  290|       |
  291|     65|#if !(!defined(cygwin) && defined(HAVE_WINSOCK_H))
  292|     65|    {
  293|     65|        int             i;
  294|       |
  295|       |        /* Unix: clear any file descriptors defined in *dst but not in *src. */
  296|     65|        for (i = src->lfs_setsize; i < FD_SETSIZE; ++i)
  ------------------
  |  Branch (296:36): [True: 0, False: 65]
  ------------------
  297|     65|            FD_CLR(i, dst);
  298|     65|    }
  299|     65|#endif
  300|       |
  301|     65|    return 0;
  302|     65|}
large_fd_set.c:LFD_SET:
   97|     65|{
   98|     65|    enum { nfdbits = 8 * sizeof(p->fds_bits[0]) };
   99|     65|    NETSNMP_FD_MASK_TYPE *fds_array = p->fds_bits;
  ------------------
  |  | 1727|     65|#define NETSNMP_FD_MASK_TYPE __fd_mask
  ------------------
  100|       |
  101|     65|    fds_array[n / nfdbits] |= (1ULL << (n % nfdbits));
  102|     65|}
large_fd_set.c:LFD_ISSET:
  113|     65|{
  114|     65|    enum { nfdbits = 8 * sizeof(p->fds_bits[0]) };
  115|     65|    const NETSNMP_FD_MASK_TYPE *fds_array = p->fds_bits;
  116|       |
  117|     65|    return (fds_array[n / nfdbits] & (1ULL << (n % nfdbits))) != 0;
  118|     65|}

get_enginetime:
   98|      6|{
   99|      6|    int             rval = SNMPERR_SUCCESS;
  ------------------
  |  |  184|      6|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  100|      6|    int             timediff = 0;
  101|      6|    Enginetime      e = NULL;
  102|       |
  103|       |
  104|       |
  105|       |    /*
  106|       |     * Sanity check.
  107|       |     */
  108|      6|    if (!engine_time || !engineboot) {
  ------------------
  |  Branch (108:9): [True: 0, False: 6]
  |  Branch (108:25): [True: 0, False: 6]
  ------------------
  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|      6|    *engine_time = *engineboot = 0;
  118|       |
  119|      6|    if (!engineID || (engineID_len <= 0)) {
  ------------------
  |  Branch (119:9): [True: 0, False: 6]
  |  Branch (119:22): [True: 0, False: 6]
  ------------------
  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|      6|    if (!(e = search_enginetime_list(engineID, engineID_len))) {
  ------------------
  |  Branch (123:9): [True: 1, False: 5]
  ------------------
  124|      1|        QUITFUN(SNMPERR_GENERR, get_enginetime_quit);
  ------------------
  |  |  143|      1|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  184|      1|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 1, Folded]
  |  |  ------------------
  |  |  144|      1|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  185|      1|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      1|		goto l ;		\
  |  |  146|      1|	}
  ------------------
  125|      0|    }
  126|      5|#ifdef LCD_TIME_SYNC_OPT
  127|      5|    if (!authenticated || e->authenticatedFlag) {
  ------------------
  |  Branch (127:9): [True: 3, False: 2]
  |  Branch (127:27): [True: 0, False: 2]
  ------------------
  128|      3|#endif
  129|      3|        *engine_time = e->engineTime;
  130|      3|        *engineboot = e->engineBoot;
  131|       |
  132|      3|       timediff = (int) (snmpv3_local_snmpEngineTime() - e->lastReceivedEngineTime);
  133|       |
  134|      3|#ifdef LCD_TIME_SYNC_OPT
  135|      3|    }
  136|      5|#endif
  137|       |
  138|      5|    if (timediff > (int) (ENGINETIME_MAX - *engine_time)) {
  ------------------
  |  |  182|      5|#define ENGINETIME_MAX	2147483647      /* ((2^31)-1) */
  ------------------
  |  Branch (138:9): [True: 0, False: 5]
  ------------------
  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|      5|    } else {
  150|      5|        *engine_time += timediff;
  151|      5|    }
  152|       |
  153|      5|    DEBUGMSGTL(("lcd_get_enginetime", "engineID "));
  ------------------
  |  |   66|      5|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      5|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%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]
  |  |  ------------------
  ------------------
  154|      5|    DEBUGMSGHEX(("lcd_get_enginetime", engineID, engineID_len));
  ------------------
  |  |   71|      5|#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      5|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  ------------------
  |  |  |  Branch (71:71): [Folded, False: 5]
  |  |  ------------------
  ------------------
  155|      5|    DEBUGMSG(("lcd_get_enginetime", ": boots=%d, time=%d\n", *engineboot,
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  156|      5|              *engine_time));
  157|       |
  158|      6|  get_enginetime_quit:
  159|      6|    return rval;
  160|       |
  161|      5|}                               /* end get_enginetime() */
free_etimelist:
  298|     66|{
  299|     66|     int index = 0;
  300|     66|     Enginetime e = NULL;
  301|     66|     Enginetime nextE = NULL;
  302|       |
  303|  1.58k|     for( ; index < ETIMELIST_SIZE; ++index)
  ------------------
  |  |   21|  1.58k|#define ETIMELIST_SIZE	23
  ------------------
  |  Branch (303:13): [True: 1.51k, False: 66]
  ------------------
  304|  1.51k|     {
  305|  1.51k|           e = etimelist[index];
  306|       |
  307|  1.58k|           while(e != NULL)
  ------------------
  |  Branch (307:18): [True: 71, False: 1.51k]
  ------------------
  308|     71|           {
  309|     71|                 nextE = e->next;
  310|     71|                 SNMP_FREE(e->engineID);
  ------------------
  |  |   62|     71|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 71, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 71]
  |  |  ------------------
  ------------------
  311|     71|                 SNMP_FREE(e);
  ------------------
  |  |   62|     71|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 71, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 71]
  |  |  ------------------
  ------------------
  312|     71|                 e = nextE;
  313|     71|           }
  314|       |
  315|       |           etimelist[index] = NULL;
  316|  1.51k|     }
  317|     66|     return;
  318|     66|}
set_enginetime:
  347|     92|{
  348|     92|    int             rval = SNMPERR_SUCCESS, iindex;
  ------------------
  |  |  184|     92|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  349|     92|    Enginetime      e = NULL;
  350|       |
  351|       |
  352|       |
  353|       |    /*
  354|       |     * Sanity check.
  355|       |     */
  356|     92|    if (!engineID || (engineID_len <= 0)) {
  ------------------
  |  Branch (356:9): [True: 0, False: 92]
  |  Branch (356:22): [True: 0, False: 92]
  ------------------
  357|      0|        return rval;
  358|      0|    }
  359|       |
  360|       |
  361|       |    /*
  362|       |     * Store the given <engine_time, engineboot> tuple in the record
  363|       |     * for engineID.  Create a new record if necessary.
  364|       |     */
  365|     92|    if (!(e = search_enginetime_list(engineID, engineID_len))) {
  ------------------
  |  Branch (365:9): [True: 71, False: 21]
  ------------------
  366|     71|        if ((iindex = hash_engineID(engineID, engineID_len)) < 0) {
  ------------------
  |  Branch (366:13): [True: 0, False: 71]
  ------------------
  367|      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|	}
  ------------------
  368|      0|        }
  369|       |
  370|     71|        e = calloc(1, sizeof(*e));
  371|     71|        if (!e) {
  ------------------
  |  Branch (371:13): [True: 0, False: 71]
  ------------------
  372|      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|	}
  ------------------
  373|      0|        }
  374|       |
  375|     71|        e->engineID = calloc(1, engineID_len);
  376|     71|        if (!e->engineID) {
  ------------------
  |  Branch (376:13): [True: 0, False: 71]
  ------------------
  377|      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|	}
  ------------------
  378|      0|        }
  379|     71|        memcpy(e->engineID, engineID, engineID_len);
  380|       |
  381|     71|        e->engineID_len = engineID_len;
  382|     71|        e->next = etimelist[iindex];
  383|     71|        etimelist[iindex] = e;
  384|     71|    }
  385|     92|#ifdef LCD_TIME_SYNC_OPT
  386|     92|    if (authenticated || !e->authenticatedFlag) {
  ------------------
  |  Branch (386:9): [True: 66, False: 26]
  |  Branch (386:26): [True: 26, False: 0]
  ------------------
  387|     92|        e->authenticatedFlag = authenticated;
  388|       |#else
  389|       |    if (authenticated) {
  390|       |#endif
  391|     92|        e->engineTime = engine_time;
  392|     92|        e->engineBoot = engineboot;
  393|     92|        e->lastReceivedEngineTime = snmpv3_local_snmpEngineTime();
  394|     92|    }
  395|       |
  396|     92|    e = NULL;                   /* Indicates a successful update. */
  397|       |
  398|     92|    DEBUGMSGTL(("lcd_set_enginetime", "engineID "));
  ------------------
  |  |   66|     92|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     92|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 92]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 92]
  |  |  ------------------
  ------------------
  399|     92|    DEBUGMSGHEX(("lcd_set_enginetime", engineID, engineID_len));
  ------------------
  |  |   71|     92|#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     92|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 92]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  ------------------
  |  |  |  Branch (71:71): [Folded, False: 92]
  |  |  ------------------
  ------------------
  400|     92|    DEBUGMSG(("lcd_set_enginetime", ": boots=%d, time=%d\n", engineboot,
  ------------------
  |  |   61|     92|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     92|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 92]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 92]
  |  |  ------------------
  ------------------
  401|     92|              engine_time));
  402|       |
  403|     92|  set_enginetime_quit:
  404|     92|    SNMP_FREE(e);
  ------------------
  |  |   62|     92|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 92]
  |  |  |  Branch (62:66): [Folded, False: 92]
  |  |  ------------------
  ------------------
  405|       |
  406|     92|    return rval;
  407|       |
  408|     92|}                               /* end set_enginetime() */
search_enginetime_list:
  431|     98|{
  432|     98|    int             rval = SNMPERR_SUCCESS;
  ------------------
  |  |  184|     98|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  433|     98|    Enginetime      e = NULL;
  434|       |
  435|       |
  436|       |    /*
  437|       |     * Sanity check.
  438|       |     */
  439|     98|    if (!engineID || (engineID_len <= 0)) {
  ------------------
  |  Branch (439:9): [True: 0, False: 98]
  |  Branch (439:22): [True: 0, False: 98]
  ------------------
  440|      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|	}
  ------------------
  441|      0|    }
  442|       |
  443|       |
  444|       |    /*
  445|       |     * Find the entry for engineID if there be one.
  446|       |     */
  447|     98|    rval = hash_engineID(engineID, engineID_len);
  448|     98|    if (rval < 0) {
  ------------------
  |  Branch (448:9): [True: 0, False: 98]
  ------------------
  449|      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|	}
  ------------------
  450|      0|    }
  451|     98|    e = etimelist[rval];
  452|       |
  453|     98|    for ( /*EMPTY*/; e; e = e->next) {
  ------------------
  |  Branch (453:22): [True: 26, False: 72]
  ------------------
  454|     26|        if ((engineID_len == e->engineID_len)
  ------------------
  |  Branch (454:13): [True: 26, False: 0]
  ------------------
  455|     26|            && !memcmp(e->engineID, engineID, engineID_len)) {
  ------------------
  |  Branch (455:16): [True: 26, False: 0]
  ------------------
  456|     26|            break;
  457|     26|        }
  458|     26|    }
  459|       |
  460|       |
  461|     98|  search_enginetime_list_quit:
  462|     98|    return e;
  463|       |
  464|     98|}                               /* end search_enginetime_list() */
hash_engineID:
  489|    169|{
  490|    169|    int             rval = SNMPERR_GENERR;
  ------------------
  |  |  185|    169|#define SNMPERR_GENERR			(-1)
  ------------------
  491|    169|    size_t          buf_len = SNMP_MAXBUF;
  ------------------
  |  |   43|    169|#define SNMP_MAXBUF		(1024 * 4)
  ------------------
  492|    169|    u_int           additive = 0;
  493|    169|    u_char         *bufp, buf[SNMP_MAXBUF];
  494|    169|    void           *context = NULL;
  495|       |
  496|       |
  497|       |
  498|       |    /*
  499|       |     * Sanity check.
  500|       |     */
  501|    169|    if (!engineID || (engineID_len <= 0)) {
  ------------------
  |  Branch (501:9): [True: 0, False: 169]
  |  Branch (501:22): [True: 0, False: 169]
  ------------------
  502|      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|	}
  ------------------
  503|      0|    }
  504|       |
  505|       |
  506|       |    /*
  507|       |     * Hash engineID into a list index.
  508|       |     */
  509|    169|#ifndef NETSNMP_DISABLE_MD5
  510|    169|    rval = sc_hash(usmHMACMD5AuthProtocol,
  511|    169|                   OID_LENGTH(usmHMACMD5AuthProtocol),
  ------------------
  |  |   57|    169|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
  512|    169|                   engineID, engineID_len, buf, &buf_len);
  513|    169|    if (rval == SNMPERR_SC_NOT_CONFIGURED) {
  ------------------
  |  |  223|    169|#define SNMPERR_SC_NOT_CONFIGURED	(-39)
  ------------------
  |  Branch (513:9): [True: 0, False: 169]
  ------------------
  514|       |        /* fall back to sha1 */
  515|      0|        rval = sc_hash(usmHMACSHA1AuthProtocol,
  516|      0|                   OID_LENGTH(usmHMACSHA1AuthProtocol),
  ------------------
  |  |   57|      0|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
  517|      0|                   engineID, engineID_len, buf, &buf_len);
  518|      0|    }
  519|       |#else
  520|       |    rval = sc_hash(usmHMACSHA1AuthProtocol,
  521|       |                   OID_LENGTH(usmHMACSHA1AuthProtocol),
  522|       |                   engineID, engineID_len, buf, &buf_len);
  523|       |#endif
  524|    169|    QUITFUN(rval, hash_engineID_quit);
  ------------------
  |  |  143|    169|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  184|    169|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, False: 169]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  525|       |
  526|    845|    for (bufp = buf; (bufp - buf) < (int) buf_len; bufp += 4) {
  ------------------
  |  Branch (526:22): [True: 676, False: 169]
  ------------------
  527|    676|        additive += (u_int) * bufp;
  528|    676|    }
  529|       |
  530|    169|  hash_engineID_quit:
  531|    169|    SNMP_FREE(context);
  ------------------
  |  |   62|    169|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 169]
  |  |  |  Branch (62:66): [Folded, False: 169]
  |  |  ------------------
  ------------------
  532|    169|    memset(buf, 0, SNMP_MAXBUF);
  ------------------
  |  |   43|    169|#define SNMP_MAXBUF		(1024 * 4)
  ------------------
  533|       |
  534|    169|    return (rval < 0) ? rval : (int)(additive % ETIMELIST_SIZE);
  ------------------
  |  |   21|    169|#define ETIMELIST_SIZE	23
  ------------------
  |  Branch (534:12): [True: 0, False: 169]
  ------------------
  535|       |
  536|    169|}                               /* end hash_engineID() */

register_mib_handlers:
 2496|     66|{
 2497|     66|#ifndef NETSNMP_DISABLE_MIB_LOADING
 2498|     66|    register_prenetsnmp_mib_handler("snmp", "mibdirs",
 2499|     66|                                    handle_mibdirs_conf, NULL,
 2500|     66|                                    "[mib-dirs|+mib-dirs|-mib-dirs]");
 2501|     66|    register_prenetsnmp_mib_handler("snmp", "mibs",
 2502|     66|                                    handle_mibs_conf, NULL,
 2503|     66|                                    "[mib-tokens|+mib-tokens|-mib-tokens]");
 2504|     66|    register_config_handler("snmp", "mibfile",
 2505|     66|                            handle_mibfile_conf, NULL, "mibfile-to-read");
 2506|       |    /*
 2507|       |     * register the snmp.conf configuration handlers for default
 2508|       |     * parsing behaviour 
 2509|       |     */
 2510|       |
 2511|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "showMibErrors",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2512|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_ERRORS);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_ERRORS);
  ------------------
  |  |   59|     66|#define NETSNMP_DS_LIB_MIB_ERRORS          0
  ------------------
 2513|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "commentToEOL",     /* Describes actual behaviour */
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2514|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_COMMENT_TERM);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_COMMENT_TERM);
  ------------------
  |  |   61|     66|#define NETSNMP_DS_LIB_MIB_COMMENT_TERM    2
  ------------------
 2515|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "strictCommentTerm",    /* Backward compatibility */
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2516|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_COMMENT_TERM);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_COMMENT_TERM);
  ------------------
  |  |   61|     66|#define NETSNMP_DS_LIB_MIB_COMMENT_TERM    2
  ------------------
 2517|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "mibAllowUnderline",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2518|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_PARSE_LABEL);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_PARSE_LABEL);
  ------------------
  |  |   62|     66|#define NETSNMP_DS_LIB_MIB_PARSE_LABEL     3
  ------------------
 2519|     66|    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "mibWarningLevel",
  ------------------
  |  |   64|     66|#define ASN_INTEGER	    0x02U
  ------------------
 2520|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_WARNINGS);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_WARNINGS);
  ------------------
  |  |  114|     66|#define NETSNMP_DS_LIB_MIB_WARNINGS         0
  ------------------
 2521|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "mibReplaceWithLatest",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2522|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_REPLACE);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_REPLACE);
  ------------------
  |  |   67|     66|#define NETSNMP_DS_LIB_MIB_REPLACE         7    /* replace objects from latest module */
  ------------------
 2523|     66|#endif
 2524|       |
 2525|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "printNumericEnums",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2526|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM);
  ------------------
  |  |   68|     66|#define NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM  8    /* print only numeric enum values */
  ------------------
 2527|     66|    register_prenetsnmp_mib_handler("snmp", "printNumericOids",
 2528|     66|                       handle_print_numeric, NULL, "(1|yes|true|0|no|false)");
 2529|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "escapeQuotes",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2530|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_ESCAPE_QUOTES);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_ESCAPE_QUOTES);
  ------------------
  |  |   79|     66|#define NETSNMP_DS_LIB_ESCAPE_QUOTES       19   /* shell escape quote marks in oids */
  ------------------
 2531|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "dontBreakdownOids",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2532|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS);
  ------------------
  |  |   70|     66|#define NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS 10   /* dont print oid indexes specially */
  ------------------
 2533|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "quickPrinting",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2534|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT);
  ------------------
  |  |   73|     66|#define NETSNMP_DS_LIB_QUICK_PRINT         13   /* print very brief output for parsing */
  ------------------
 2535|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "numericTimeticks",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2536|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NUMERIC_TIMETICKS);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NUMERIC_TIMETICKS);
  ------------------
  |  |   78|     66|#define NETSNMP_DS_LIB_NUMERIC_TIMETICKS   18   /* print timeticks as a number */
  ------------------
 2537|     66|    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "oidOutputFormat",
  ------------------
  |  |   64|     66|#define ASN_INTEGER	    0x02U
  ------------------
 2538|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
  ------------------
  |  |  118|     66|#define NETSNMP_DS_LIB_OID_OUTPUT_FORMAT    4
  ------------------
 2539|     66|    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "suffixPrinting",
  ------------------
  |  |   64|     66|#define ASN_INTEGER	    0x02U
  ------------------
 2540|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
  ------------------
  |  |  118|     66|#define NETSNMP_DS_LIB_OID_OUTPUT_FORMAT    4
  ------------------
 2541|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "extendedIndex",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2542|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_EXTENDED_INDEX);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_EXTENDED_INDEX);
  ------------------
  |  |   82|     66|#define NETSNMP_DS_LIB_EXTENDED_INDEX	   22   /* print extended index format [x1][x2] */
  ------------------
 2543|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "printHexText",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2544|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_HEX_TEXT);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_HEX_TEXT);
  ------------------
  |  |   83|     66|#define NETSNMP_DS_LIB_PRINT_HEX_TEXT      23   /* print ASCII text along with hex strings */
  ------------------
 2545|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "printValueOnly",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2546|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_BARE_VALUE);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_BARE_VALUE);
  ------------------
  |  |   81|     66|#define NETSNMP_DS_LIB_PRINT_BARE_VALUE	   21   /* just print value (not OID = value) */
  ------------------
 2547|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "dontPrintUnits",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
 2548|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_PRINT_UNITS);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_PRINT_UNITS);
  ------------------
  |  |   89|     66|#define NETSNMP_DS_LIB_DONT_PRINT_UNITS    29 /* don't print UNITS suffix */
  ------------------
 2549|     66|    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "hexOutputLength",
  ------------------
  |  |   64|     66|#define ASN_INTEGER	    0x02U
  ------------------
 2550|     66|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH);
  ------------------
  |  |  121|     66|#define NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH    6
  ------------------
 2551|     66|}
netsnmp_set_mib_directory:
 2566|    131|{
 2567|    131|    const char *newdir;
 2568|    131|    char *olddir, *tmpdir = NULL;
 2569|       |
 2570|    131|    DEBUGTRACE;
  ------------------
  |  |   63|    131|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    131|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 131]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 131]
  |  |  ------------------
  ------------------
 2571|    131|    if (NULL == dir) {
  ------------------
  |  Branch (2571:9): [True: 0, False: 131]
  ------------------
 2572|      0|        return;
 2573|      0|    }
 2574|       |    
 2575|    131|    olddir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    131|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 2576|    131|				   NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|    131|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2577|    131|    if (olddir) {
  ------------------
  |  Branch (2577:9): [True: 66, False: 65]
  ------------------
 2578|     66|        if ((*dir == '+') || (*dir == '-')) {
  ------------------
  |  Branch (2578:13): [True: 0, False: 66]
  |  Branch (2578:30): [True: 0, False: 66]
  ------------------
 2579|       |            /** New dir starts with '+', thus we add it. */
 2580|      0|            if (*dir++ == '+') {
  ------------------
  |  Branch (2580:17): [True: 0, False: 0]
  ------------------
 2581|      0|                if (asprintf(&tmpdir, "%s%c%s", olddir, ENV_SEPARATOR_CHAR, dir) < 0)
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
  |  Branch (2581:21): [True: 0, False: 0]
  ------------------
 2582|      0|                    tmpdir = NULL;
 2583|      0|            } else {
 2584|      0|                if (asprintf(&tmpdir, "%s%c%s", dir, ENV_SEPARATOR_CHAR, olddir) < 0)
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
  |  Branch (2584:21): [True: 0, False: 0]
  ------------------
 2585|      0|                    tmpdir = NULL;
 2586|      0|            }
 2587|      0|            if (!tmpdir) {
  ------------------
  |  Branch (2587:17): [True: 0, False: 0]
  ------------------
 2588|      0|                DEBUGMSGTL(("read_config:initmib", "set mibdir malloc failed"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2589|      0|                return;
 2590|      0|            }
 2591|      0|            newdir = tmpdir;
 2592|     66|        } else {
 2593|     66|            newdir = dir;
 2594|     66|        }
 2595|     66|    } else {
 2596|       |        /** If dir starts with '+' skip '+' it. */
 2597|     65|        newdir = ((*dir == '+') ? ++dir : dir);
  ------------------
  |  Branch (2597:19): [True: 0, False: 65]
  ------------------
 2598|     65|    }
 2599|    131|    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS,
  ------------------
  |  |   48|    131|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS,
  ------------------
  |  |  162|    131|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2600|    131|                          newdir);
 2601|       |
 2602|       |    /** set_string calls strdup, so if we allocated memory, free it */
 2603|    131|    if (tmpdir == newdir) {
  ------------------
  |  Branch (2603:9): [True: 0, False: 131]
  ------------------
 2604|       |        SNMP_FREE(tmpdir);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2605|      0|    }
 2606|    131|}
netsnmp_get_mib_directory:
 2623|    198|{
 2624|    198|    char *dir;
 2625|       |
 2626|    198|    DEBUGTRACE;
  ------------------
  |  |   63|    198|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    198|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 198]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 198]
  |  |  ------------------
  ------------------
 2627|    198|    dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |   48|    198|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|    198|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2628|    198|    if (dir == NULL) {
  ------------------
  |  Branch (2628:9): [True: 65, False: 133]
  ------------------
 2629|     65|        DEBUGMSGTL(("get_mib_directory", "no mib directories set\n"));
  ------------------
  |  |   66|     65|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 65]
  |  |  ------------------
  ------------------
 2630|       |
 2631|       |        /** Check if the environment variable is set */
 2632|     65|        dir = netsnmp_getenv("MIBDIRS");
 2633|     65|        if (dir == NULL) {
  ------------------
  |  Branch (2633:13): [True: 65, False: 0]
  ------------------
 2634|     65|            DEBUGMSGTL(("get_mib_directory", "no mib directories set by environment\n"));
  ------------------
  |  |   66|     65|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 65]
  |  |  ------------------
  ------------------
 2635|       |            /** Not set use hard coded path */
 2636|     65|            if (confmibdir == NULL) {
  ------------------
  |  Branch (2636:17): [True: 65, False: 0]
  ------------------
 2637|     65|                DEBUGMSGTL(("get_mib_directory", "no mib directories set by config\n"));
  ------------------
  |  |   66|     65|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 65]
  |  |  ------------------
  ------------------
 2638|     65|                netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1675|     65|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2639|     65|            }
 2640|      0|            else if ((*confmibdir == '+') || (*confmibdir == '-')) {
  ------------------
  |  Branch (2640:22): [True: 0, False: 0]
  |  Branch (2640:46): [True: 0, False: 0]
  ------------------
 2641|      0|                DEBUGMSGTL(("get_mib_directory", "mib directories set by config (but added)\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2642|      0|                netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1675|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2643|      0|                netsnmp_set_mib_directory(confmibdir);
 2644|      0|            }
 2645|      0|            else {
 2646|      0|                DEBUGMSGTL(("get_mib_directory", "mib directories set by config\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2647|      0|                netsnmp_set_mib_directory(confmibdir);
 2648|      0|            }
 2649|     65|        } else if ((*dir == '+') || (*dir == '-')) {
  ------------------
  |  Branch (2649:20): [True: 0, False: 0]
  |  Branch (2649:37): [True: 0, False: 0]
  ------------------
 2650|      0|            DEBUGMSGTL(("get_mib_directory", "mib directories set by environment (but added)\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2651|      0|            netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1675|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2652|      0|            netsnmp_set_mib_directory(dir);
 2653|      0|        } else {
 2654|      0|            DEBUGMSGTL(("get_mib_directory", "mib directories set by environment\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2655|      0|            netsnmp_set_mib_directory(dir);
 2656|      0|        }
 2657|     65|        dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |   48|     65|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                      dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|     65|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2658|     65|    }
 2659|    198|    DEBUGMSGTL(("get_mib_directory", "mib directories set '%s'\n", dir));
  ------------------
  |  |   66|    198|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    198|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 198]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 198]
  |  |  ------------------
  ------------------
 2660|    198|    return(dir);
 2661|    198|}
netsnmp_fixup_mib_directory:
 2670|     66|{
 2671|     66|    const char *homepath = netsnmp_gethomedir();
 2672|     66|    char *mibpath = netsnmp_get_mib_directory();
 2673|     66|    char *oldmibpath = NULL;
 2674|     66|    char *ptr_home;
 2675|     66|    char *new_mibpath;
 2676|     66|    size_t new_mibpath_len;
 2677|       |
 2678|     66|    DEBUGTRACE;
  ------------------
  |  |   63|     66|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2679|     66|    if (homepath && mibpath) {
  ------------------
  |  Branch (2679:9): [True: 66, False: 0]
  |  Branch (2679:21): [True: 66, False: 0]
  ------------------
 2680|     66|        DEBUGMSGTL(("fixup_mib_directory", "mib directories '%s'\n", mibpath));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2681|    131|        while ((ptr_home = strstr(mibpath, "$HOME"))) {
  ------------------
  |  Branch (2681:16): [True: 65, False: 66]
  ------------------
 2682|     65|            new_mibpath_len = strlen(mibpath) - strlen("$HOME") +
 2683|     65|					 strlen(homepath)+1;
 2684|     65|            new_mibpath = (char *)malloc(new_mibpath_len);
 2685|     65|            if (new_mibpath) {
  ------------------
  |  Branch (2685:17): [True: 65, False: 0]
  ------------------
 2686|     65|                *ptr_home = 0; /* null out the spot where we stop copying */
 2687|     65|                snprintf(new_mibpath, new_mibpath_len, "%s%s%s", mibpath, homepath,
 2688|     65|			ptr_home + strlen("$HOME"));
 2689|       |                /** swap in the new value and repeat */
 2690|     65|                mibpath = new_mibpath;
 2691|     65|		if (oldmibpath != NULL) {
  ------------------
  |  Branch (2691:7): [True: 0, False: 65]
  ------------------
 2692|      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]
  |  |  ------------------
  ------------------
 2693|      0|		}
 2694|     65|		oldmibpath = new_mibpath;
 2695|     65|            } else {
 2696|      0|                break;
 2697|      0|            }
 2698|     65|        }
 2699|       |
 2700|     66|        netsnmp_set_mib_directory(mibpath);
 2701|       |	
 2702|       |	/*  The above copies the mibpath for us, so...  */
 2703|       |
 2704|     66|	if (oldmibpath != NULL) {
  ------------------
  |  Branch (2704:6): [True: 65, False: 1]
  ------------------
 2705|     65|	    SNMP_FREE(oldmibpath);
  ------------------
  |  |   62|     65|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 65, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 65]
  |  |  ------------------
  ------------------
 2706|     65|	}
 2707|       |
 2708|     66|    }
 2709|       |
 2710|     66|}
netsnmp_init_mib:
 2719|     66|{
 2720|     66|    const char     *prefix;
 2721|     66|    char           *env_var, *entry;
 2722|     66|    PrefixListPtr   pp = &mib_prefixes[0];
 2723|     66|    char           *st = NULL;
 2724|       |
 2725|     66|    if (Mib)
  ------------------
  |  Branch (2725:9): [True: 0, False: 66]
  ------------------
 2726|      0|        return;
 2727|     66|    netsnmp_init_mib_internals();
 2728|       |
 2729|       |    /*
 2730|       |     * Initialise the MIB directory/ies 
 2731|       |     */
 2732|     66|    netsnmp_fixup_mib_directory();
 2733|     66|    env_var = strdup(netsnmp_get_mib_directory());
 2734|     66|    if (!env_var)
  ------------------
  |  Branch (2734:9): [True: 0, False: 66]
  ------------------
 2735|      0|        return;
 2736|       |
 2737|     66|    DEBUGMSGTL(("init_mib",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2738|     66|                "Seen MIBDIRS: Looking in '%s' for mib dirs ...\n",
 2739|     66|                env_var));
 2740|       |
 2741|     66|    entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|     66|#define ENV_SEPARATOR ":"
  ------------------
 2742|    197|    while (entry) {
  ------------------
  |  Branch (2742:12): [True: 131, False: 66]
  ------------------
 2743|    131|        add_mibdir(entry);
 2744|    131|        entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|    131|#define ENV_SEPARATOR ":"
  ------------------
 2745|    131|    }
 2746|     66|    SNMP_FREE(env_var);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2747|       |
 2748|     66|    env_var = netsnmp_getenv("MIBFILES");
 2749|     66|    if (env_var != NULL) {
  ------------------
  |  Branch (2749:9): [True: 0, False: 66]
  ------------------
 2750|      0|        if (*env_var == '+')
  ------------------
  |  Branch (2750:13): [True: 0, False: 0]
  ------------------
 2751|      0|            entry = strtok_r(env_var+1, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2752|      0|        else
 2753|      0|            entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2754|      0|        while (entry) {
  ------------------
  |  Branch (2754:16): [True: 0, False: 0]
  ------------------
 2755|      0|            add_mibfile(entry, NULL);
 2756|      0|            entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2757|      0|        }
 2758|      0|    }
 2759|       |
 2760|     66|    netsnmp_init_mib_internals();
 2761|       |
 2762|       |    /*
 2763|       |     * Read in any modules or mibs requested 
 2764|       |     */
 2765|       |
 2766|     66|    env_var = netsnmp_getenv("MIBS");
 2767|     66|    if (env_var == NULL) {
  ------------------
  |  Branch (2767:9): [True: 66, False: 0]
  ------------------
 2768|     66|        if (confmibs != NULL)
  ------------------
  |  Branch (2768:13): [True: 0, False: 66]
  ------------------
 2769|      0|            env_var = strdup(confmibs);
 2770|     66|        else
 2771|     66|            env_var = strdup(NETSNMP_DEFAULT_MIBS);
  ------------------
  |  | 2023|     66|#define NETSNMP_DEFAULT_MIBS ":NET-SNMP-EXTEND-MIB:SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:HOST-RESOURCES-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB:NET-SNMP-PERIODIC-NOTIFY-MIB:DISMAN-NSLOOKUP-MIB:DISMAN-PING-MIB:DISMAN-TRACEROUTE-MIB:EtherLike-MIB:NET-SNMP-EXAMPLES-MIB:HOST-RESOURCES-TYPES:IP-FORWARD-MIB:MTA-MIB:NETWORK-SERVICES-MIB:UCD-IPFWACC-MIB:RMON-MIB:SCTP-MIB:SNMP-USM-DH-OBJECTS-MIB:SNMP-TLS-TM-MIB:SNMP-TSM-MIB:TUNNEL-MIB:IPV6-FLOW-LABEL-MIB:UCD-DISKIO-MIB: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"
  ------------------
 2772|     66|    } else {
 2773|      0|        env_var = strdup(env_var);
 2774|      0|    }
 2775|     66|    if (env_var && ((*env_var == '+') || (*env_var == '-'))) {
  ------------------
  |  Branch (2775:9): [True: 66, False: 0]
  |  Branch (2775:21): [True: 0, False: 66]
  |  Branch (2775:42): [True: 0, False: 66]
  ------------------
 2776|      0|        int res;
 2777|       |
 2778|      0|        if (*env_var == '+')
  ------------------
  |  Branch (2778:13): [True: 0, False: 0]
  ------------------
 2779|      0|            res = asprintf(&entry, "%s%c%s", NETSNMP_DEFAULT_MIBS,
  ------------------
  |  | 2023|      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"
  ------------------
 2780|      0|                           ENV_SEPARATOR_CHAR, env_var + 1);
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 2781|      0|        else
 2782|      0|            res = asprintf(&entry, "%s%c%s", env_var + 1, ENV_SEPARATOR_CHAR,
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 2783|      0|                           NETSNMP_DEFAULT_MIBS);
  ------------------
  |  | 2023|      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"
  ------------------
 2784|      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]
  |  |  ------------------
  ------------------
 2785|      0|        if (res < 0) {
  ------------------
  |  Branch (2785:13): [True: 0, False: 0]
  ------------------
 2786|      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]
  |  |  ------------------
  ------------------
 2787|      0|            return;
 2788|      0|        }
 2789|      0|        env_var = entry;
 2790|      0|    }
 2791|       |
 2792|     66|    if (env_var != NULL) {
  ------------------
  |  Branch (2792:9): [True: 66, False: 0]
  ------------------
 2793|     66|        DEBUGMSGTL(("init_mib",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2794|     66|                    "Seen MIBS: Looking in '%s' for mib files ...\n",
 2795|     66|                    env_var));
 2796|     66|        entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|     66|#define ENV_SEPARATOR ":"
  ------------------
 2797|  3.23k|        while (entry) {
  ------------------
  |  Branch (2797:16): [True: 3.16k, False: 66]
  ------------------
 2798|  3.16k|            if (strcasecmp(entry, DEBUG_ALWAYS_TOKEN) == 0) {
  ------------------
  |  |  227|  3.16k|#define DEBUG_ALWAYS_TOKEN "all"
  ------------------
  |  Branch (2798:17): [True: 0, False: 3.16k]
  ------------------
 2799|      0|                read_all_mibs();
 2800|  3.16k|            } else if (strstr(entry, "/") != NULL) {
  ------------------
  |  Branch (2800:24): [True: 0, False: 3.16k]
  ------------------
 2801|      0|                read_mib(entry);
 2802|  3.16k|            } else {
 2803|  3.16k|                netsnmp_read_module(entry);
 2804|  3.16k|            }
 2805|  3.16k|            entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|  3.16k|#define ENV_SEPARATOR ":"
  ------------------
 2806|  3.16k|        }
 2807|     66|        adopt_orphans();
 2808|     66|        SNMP_FREE(env_var);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2809|     66|    }
 2810|       |
 2811|     66|    env_var = netsnmp_getenv("MIBFILES");
 2812|     66|    if (env_var != NULL) {
  ------------------
  |  Branch (2812:9): [True: 0, False: 66]
  ------------------
 2813|      0|        if ((*env_var == '+') || (*env_var == '-')) {
  ------------------
  |  Branch (2813:13): [True: 0, False: 0]
  |  Branch (2813:34): [True: 0, False: 0]
  ------------------
 2814|       |#ifdef NETSNMP_DEFAULT_MIBFILES
 2815|       |            int res;
 2816|       |
 2817|       |            if (*env_var++ == '+')
 2818|       |                res = asprintf(&entry, "%s%c%s", NETSNMP_DEFAULT_MIBFILES,
 2819|       |                               ENV_SEPARATOR_CHAR, env_var);
 2820|       |            else
 2821|       |                res = asprintf(&entry, "%s%c%s", env_var,
 2822|       |                               ENV_SEPARATOR_CHAR, NETSNMP_DEFAULT_MIBFILES);
 2823|       |            if (res >= 0)
 2824|       |                env_var = entry;
 2825|       |            else
 2826|       |                DEBUGMSGTL(("init_mib", "env mibfiles malloc failed"));
 2827|       |#else
 2828|      0|            env_var = strdup(env_var + 1);
 2829|      0|#endif
 2830|      0|        } else {
 2831|      0|            env_var = strdup(env_var);
 2832|      0|        }
 2833|     66|    } else {
 2834|       |#ifdef NETSNMP_DEFAULT_MIBFILES
 2835|       |        env_var = strdup(NETSNMP_DEFAULT_MIBFILES);
 2836|       |#endif
 2837|     66|    }
 2838|       |
 2839|     66|    if (env_var != NULL) {
  ------------------
  |  Branch (2839:9): [True: 0, False: 66]
  ------------------
 2840|      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]
  |  |  ------------------
  ------------------
 2841|      0|                    "Seen MIBFILES: Looking in '%s' for mib files ...\n",
 2842|      0|                    env_var));
 2843|      0|        entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2844|      0|        while (entry) {
  ------------------
  |  Branch (2844:16): [True: 0, False: 0]
  ------------------
 2845|      0|            read_mib(entry);
 2846|      0|            entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2847|      0|        }
 2848|      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]
  |  |  ------------------
  ------------------
 2849|      0|    }
 2850|       |
 2851|     66|    prefix = netsnmp_getenv("PREFIX");
 2852|       |
 2853|     66|    if (!prefix)
  ------------------
  |  Branch (2853:9): [True: 66, False: 0]
  ------------------
 2854|     66|        prefix = Standard_Prefix;
 2855|       |
 2856|     66|    Prefix = (char *) malloc(strlen(prefix) + 2);
 2857|     66|    if (!Prefix)
  ------------------
  |  Branch (2857:9): [True: 0, False: 66]
  ------------------
 2858|      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]
  |  |  ------------------
  ------------------
 2859|     66|    else
 2860|     66|        strcpy(Prefix, prefix);
 2861|       |
 2862|     66|    DEBUGMSGTL(("init_mib",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2863|     66|                "Seen PREFIX: Looking in '%s' for prefix ...\n", Prefix));
 2864|       |
 2865|       |    /*
 2866|       |     * remove trailing dot 
 2867|       |     */
 2868|     66|    if (Prefix) {
  ------------------
  |  Branch (2868:9): [True: 66, False: 0]
  ------------------
 2869|     66|        env_var = &Prefix[strlen(Prefix) - 1];
 2870|     66|        if (*env_var == '.')
  ------------------
  |  Branch (2870:13): [True: 0, False: 66]
  ------------------
 2871|      0|            *env_var = '\0';
 2872|     66|    }
 2873|       |
 2874|     66|    pp->str = Prefix;           /* fixup first mib_prefix entry */
 2875|       |    /*
 2876|       |     * now that the list of prefixes is built, save each string length. 
 2877|       |     */
 2878|    462|    while (pp->str) {
  ------------------
  |  Branch (2878:12): [True: 396, False: 66]
  ------------------
 2879|    396|        pp->len = strlen(pp->str);
 2880|    396|        pp++;
 2881|    396|    }
 2882|       |
 2883|     66|    Mib = tree_head;            /* Backwards compatibility */
 2884|     66|    tree_top = calloc(1, sizeof(struct tree));
 2885|       |    /*
 2886|       |     * XX error check ? 
 2887|       |     */
 2888|     66|    if (tree_top) {
  ------------------
  |  Branch (2888:9): [True: 66, False: 0]
  ------------------
 2889|     66|        tree_top->label = strdup("(top)");
 2890|     66|        tree_top->child_list = tree_head;
 2891|     66|    }
 2892|     66|}
shutdown_mib:
 2908|     66|{
 2909|     66|    unload_all_mibs();
 2910|     66|    if (tree_top) {
  ------------------
  |  Branch (2910:9): [True: 66, False: 0]
  ------------------
 2911|     66|        if (tree_top->label)
  ------------------
  |  Branch (2911:13): [True: 66, False: 0]
  ------------------
 2912|     66|            SNMP_FREE(tree_top->label);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2913|     66|        SNMP_FREE(tree_top);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2914|     66|    }
 2915|     66|    tree_head = NULL;
 2916|     66|    Mib = NULL;
 2917|     66|    if (Prefix != NULL && Prefix != &Standard_Prefix[0])
  ------------------
  |  Branch (2917:9): [True: 66, False: 0]
  |  Branch (2917:27): [True: 66, False: 0]
  ------------------
 2918|     66|        SNMP_FREE(Prefix);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2919|     66|    if (Prefix)
  ------------------
  |  Branch (2919:9): [True: 0, False: 66]
  ------------------
 2920|      0|        Prefix = NULL;
 2921|     66|    SNMP_FREE(confmibs);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2922|       |    SNMP_FREE(confmibdir);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2923|     66|}
set_function:
 2955|    198|{
 2956|    198|    subtree->printer = NULL;
 2957|    198|    switch (subtree->type) {
 2958|      0|    case TYPE_OBJID:
  ------------------
  |  |  155|      0|#define TYPE_OBJID          1
  ------------------
  |  Branch (2958:5): [True: 0, False: 198]
  ------------------
 2959|      0|        subtree->printomat = sprint_realloc_object_identifier;
 2960|      0|        break;
 2961|      0|    case TYPE_OCTETSTR:
  ------------------
  |  |  156|      0|#define TYPE_OCTETSTR       2
  ------------------
  |  Branch (2961:5): [True: 0, False: 198]
  ------------------
 2962|      0|        subtree->printomat = sprint_realloc_octet_string;
 2963|      0|        break;
 2964|      0|    case TYPE_INTEGER:
  ------------------
  |  |  157|      0|#define TYPE_INTEGER        3
  ------------------
  |  Branch (2964:5): [True: 0, False: 198]
  ------------------
 2965|      0|        subtree->printomat = sprint_realloc_integer;
 2966|      0|        break;
 2967|      0|    case TYPE_INTEGER32:
  ------------------
  |  |  170|      0|#define TYPE_INTEGER32      16
  ------------------
  |  Branch (2967:5): [True: 0, False: 198]
  ------------------
 2968|      0|        subtree->printomat = sprint_realloc_integer;
 2969|      0|        break;
 2970|      0|    case TYPE_NETADDR:
  ------------------
  |  |  158|      0|#define TYPE_NETADDR        4
  ------------------
  |  Branch (2970:5): [True: 0, False: 198]
  ------------------
 2971|      0|        subtree->printomat = sprint_realloc_networkaddress;
 2972|      0|        break;
 2973|      0|    case TYPE_IPADDR:
  ------------------
  |  |  159|      0|#define TYPE_IPADDR         5
  ------------------
  |  Branch (2973:5): [True: 0, False: 198]
  ------------------
 2974|      0|        subtree->printomat = sprint_realloc_ipaddress;
 2975|      0|        break;
 2976|      0|    case TYPE_COUNTER:
  ------------------
  |  |  160|      0|#define TYPE_COUNTER        6
  ------------------
  |  Branch (2976:5): [True: 0, False: 198]
  ------------------
 2977|      0|        subtree->printomat = sprint_realloc_counter;
 2978|      0|        break;
 2979|      0|    case TYPE_GAUGE:
  ------------------
  |  |  161|      0|#define TYPE_GAUGE          7
  ------------------
  |  Branch (2979:5): [True: 0, False: 198]
  ------------------
 2980|      0|        subtree->printomat = sprint_realloc_gauge;
 2981|      0|        break;
 2982|      0|    case TYPE_TIMETICKS:
  ------------------
  |  |  162|      0|#define TYPE_TIMETICKS      8
  ------------------
  |  Branch (2982:5): [True: 0, False: 198]
  ------------------
 2983|      0|        subtree->printomat = sprint_realloc_timeticks;
 2984|      0|        break;
 2985|      0|    case TYPE_OPAQUE:
  ------------------
  |  |  163|      0|#define TYPE_OPAQUE         9
  ------------------
  |  Branch (2985:5): [True: 0, False: 198]
  ------------------
 2986|      0|        subtree->printomat = sprint_realloc_opaque;
 2987|      0|        break;
 2988|      0|    case TYPE_NULL:
  ------------------
  |  |  164|      0|#define TYPE_NULL           10
  ------------------
  |  Branch (2988:5): [True: 0, False: 198]
  ------------------
 2989|      0|        subtree->printomat = sprint_realloc_null;
 2990|      0|        break;
 2991|      0|    case TYPE_BITSTRING:
  ------------------
  |  |  166|      0|#define TYPE_BITSTRING      12
  ------------------
  |  Branch (2991:5): [True: 0, False: 198]
  ------------------
 2992|      0|        subtree->printomat = sprint_realloc_bitstring;
 2993|      0|        break;
 2994|      0|    case TYPE_NSAPADDRESS:
  ------------------
  |  |  167|      0|#define TYPE_NSAPADDRESS    13
  ------------------
  |  Branch (2994:5): [True: 0, False: 198]
  ------------------
 2995|      0|        subtree->printomat = sprint_realloc_nsapaddress;
 2996|      0|        break;
 2997|      0|    case TYPE_COUNTER64:
  ------------------
  |  |  165|      0|#define TYPE_COUNTER64      11
  ------------------
  |  Branch (2997:5): [True: 0, False: 198]
  ------------------
 2998|      0|        subtree->printomat = sprint_realloc_counter64;
 2999|      0|        break;
 3000|      0|    case TYPE_UINTEGER:
  ------------------
  |  |  168|      0|#define TYPE_UINTEGER       14
  ------------------
  |  Branch (3000:5): [True: 0, False: 198]
  ------------------
 3001|      0|        subtree->printomat = sprint_realloc_uinteger;
 3002|      0|        break;
 3003|      0|    case TYPE_UNSIGNED32:
  ------------------
  |  |  169|      0|#define TYPE_UNSIGNED32     15
  ------------------
  |  Branch (3003:5): [True: 0, False: 198]
  ------------------
 3004|      0|        subtree->printomat = sprint_realloc_gauge;
 3005|      0|        break;
 3006|    198|    case TYPE_OTHER:
  ------------------
  |  |  154|    198|#define TYPE_OTHER          0
  ------------------
  |  Branch (3006:5): [True: 198, False: 0]
  ------------------
 3007|    198|    default:
  ------------------
  |  Branch (3007:5): [True: 0, False: 198]
  ------------------
 3008|    198|        subtree->printomat = sprint_realloc_by_type;
 3009|    198|        break;
 3010|    198|    }
 3011|    198|}

netsnmp_init_mib_internals:
  701|  3.36k|{
  702|  3.36k|    register struct tok *tp;
  703|  3.36k|    register int    b, i;
  704|  3.36k|    int             max_modc;
  705|       |
  706|  3.36k|    if (tree_head)
  ------------------
  |  Branch (706:9): [True: 3.30k, False: 66]
  ------------------
  707|  3.30k|        return;
  708|       |
  709|       |    /*
  710|       |     * Set up hash list of pre-defined tokens
  711|       |     */
  712|     66|    memset(buckets, 0, sizeof(buckets));
  713|  6.13k|    for (tp = tokens; tp->name; tp++) {
  ------------------
  |  Branch (713:23): [True: 6.07k, False: 66]
  ------------------
  714|  6.07k|        tp->hash = name_hash(tp->name);
  715|  6.07k|        b = BUCKET(tp->hash);
  ------------------
  |  |  527|  6.07k|#define BUCKET(x)       (x & (HASHSIZE-1))
  |  |  ------------------
  |  |  |  |  526|  6.07k|#define HASHSIZE        32
  |  |  ------------------
  ------------------
  716|  6.07k|        if (buckets[b])
  ------------------
  |  Branch (716:13): [True: 3.96k, False: 2.11k]
  ------------------
  717|  3.96k|            tp->next = buckets[b];      /* BUG ??? */
  718|  6.07k|        buckets[b] = tp;
  719|  6.07k|    }
  720|       |
  721|       |    /*
  722|       |     * Initialise other internal structures
  723|       |     */
  724|       |
  725|     66|    max_modc = sizeof(module_map) / sizeof(module_map[0]) - 1;
  726|  1.45k|    for (i = 0; i < max_modc; ++i)
  ------------------
  |  Branch (726:17): [True: 1.38k, False: 66]
  ------------------
  727|  1.38k|        module_map[i].next = &(module_map[i + 1]);
  728|     66|    module_map[max_modc].next = NULL;
  729|     66|    module_map_head = module_map;
  730|       |
  731|     66|    memset(nbuckets, 0, sizeof(nbuckets));
  732|     66|    memset(tbuckets, 0, sizeof(tbuckets));
  733|     66|    free(tclist);
  734|     66|    tc_alloc = TC_INCR;
  ------------------
  |  |  134|     66|#define TC_INCR 100
  ------------------
  735|     66|    tclist = calloc(tc_alloc, sizeof(struct tc));
  736|     66|    build_translation_table();
  737|     66|    init_tree_roots();          /* Set up initial roots */
  738|       |    /*
  739|       |     * Relies on 'add_mibdir' having set up the modules 
  740|       |     */
  741|     66|}
which_module:
 4248|    198|{
 4249|    198|    struct module  *mp;
 4250|       |
 4251|    198|    for (mp = module_head; mp; mp = mp->next)
  ------------------
  |  Branch (4251:28): [True: 0, False: 198]
  ------------------
 4252|      0|        if (!label_compare(mp->name, name))
  ------------------
  |  | 1238|      0|#define	label_compare	strcmp
  ------------------
  |  Branch (4252:13): [True: 0, False: 0]
  ------------------
 4253|      0|            return (mp->modid);
 4254|       |
 4255|    198|    DEBUGMSGTL(("parse-mibs", "Module %s not found\n", name));
  ------------------
  |  |   66|    198|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    198|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 198]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 198]
  |  |  ------------------
  ------------------
 4256|    198|    return (-1);
 4257|    198|}
adopt_orphans:
 4446|     66|{
 4447|     66|    struct node    *np = NULL, *onp;
 4448|     66|    struct tree    *tp;
 4449|     66|    int             i, adopted = 1;
 4450|       |
 4451|     66|    if (!orphan_nodes)
  ------------------
  |  Branch (4451:9): [True: 66, False: 0]
  ------------------
 4452|     66|        return;
 4453|      0|    init_node_hash(orphan_nodes);
 4454|      0|    orphan_nodes = NULL;
 4455|       |
 4456|      0|    while (adopted) {
  ------------------
  |  Branch (4456:12): [True: 0, False: 0]
  ------------------
 4457|      0|        adopted = 0;
 4458|      0|        for (i = 0; i < NHASHSIZE; i++)
  ------------------
  |  |  529|      0|#define NHASHSIZE    128
  ------------------
  |  Branch (4458:21): [True: 0, False: 0]
  ------------------
 4459|      0|            if (nbuckets[i]) {
  ------------------
  |  Branch (4459:17): [True: 0, False: 0]
  ------------------
 4460|      0|                for (np = nbuckets[i]; np != NULL; np = np->next) {
  ------------------
  |  Branch (4460:40): [True: 0, False: 0]
  ------------------
 4461|      0|                    tp = find_tree_node(np->parent, -1);
 4462|      0|		    if (tp) {
  ------------------
  |  Branch (4462:11): [True: 0, False: 0]
  ------------------
 4463|      0|			do_subtree(tp, &np);
 4464|      0|			adopted = 1;
 4465|       |                        /*
 4466|       |                         * if do_subtree adopted the entire bucket, stop
 4467|       |                         */
 4468|      0|                        if(NULL == nbuckets[i])
  ------------------
  |  Branch (4468:28): [True: 0, False: 0]
  ------------------
 4469|      0|                            break;
 4470|       |
 4471|       |                        /*
 4472|       |                         * do_subtree may modify nbuckets, and if np
 4473|       |                         * was adopted, np->next probably isn't an orphan
 4474|       |                         * anymore. if np is still in the bucket (do_subtree
 4475|       |                         * didn't adopt it) keep on plugging. otherwise
 4476|       |                         * start over, at the top of the bucket.
 4477|       |                         */
 4478|      0|                        for(onp = nbuckets[i]; onp; onp = onp->next)
  ------------------
  |  Branch (4478:48): [True: 0, False: 0]
  ------------------
 4479|      0|                            if(onp == np)
  ------------------
  |  Branch (4479:32): [True: 0, False: 0]
  ------------------
 4480|      0|                                break;
 4481|      0|                        if(NULL == onp) { /* not in the list */
  ------------------
  |  Branch (4481:28): [True: 0, False: 0]
  ------------------
 4482|      0|                            np = nbuckets[i]; /* start over */
 4483|      0|                        }
 4484|      0|		    }
 4485|      0|		}
 4486|      0|            }
 4487|      0|    }
 4488|       |
 4489|       |    /*
 4490|       |     * Report on outstanding orphans
 4491|       |     *    and link them back into the orphan list
 4492|       |     */
 4493|      0|    for (i = 0; i < NHASHSIZE; i++)
  ------------------
  |  |  529|      0|#define NHASHSIZE    128
  ------------------
  |  Branch (4493:17): [True: 0, False: 0]
  ------------------
 4494|      0|        if (nbuckets[i]) {
  ------------------
  |  Branch (4494:13): [True: 0, False: 0]
  ------------------
 4495|      0|            if (orphan_nodes)
  ------------------
  |  Branch (4495:17): [True: 0, False: 0]
  ------------------
 4496|      0|                onp = np->next = nbuckets[i];
 4497|      0|            else
 4498|      0|                onp = orphan_nodes = nbuckets[i];
 4499|      0|            nbuckets[i] = NULL;
 4500|      0|            while (onp) {
  ------------------
  |  Branch (4500:20): [True: 0, False: 0]
  ------------------
 4501|      0|                char            modbuf[256];
 4502|      0|                snmp_log(LOG_WARNING,
 4503|      0|                         "Cannot resolve OID in %s: %s ::= { %s %ld } at line %d in %s\n",
 4504|      0|                         module_name(onp->modid, modbuf),
 4505|      0|                         (onp->label ? onp->label : "<no label>"),
  ------------------
  |  Branch (4505:27): [True: 0, False: 0]
  ------------------
 4506|      0|                         (onp->parent ? onp->parent : "<no parent>"),
  ------------------
  |  Branch (4506:27): [True: 0, False: 0]
  ------------------
 4507|      0|                         onp->subid, onp->lineno, onp->filename);
 4508|      0|                np = onp;
 4509|      0|                onp = onp->next;
 4510|      0|            }
 4511|      0|        }
 4512|      0|}
netsnmp_read_module:
 4524|  3.16k|{
 4525|  3.16k|    int status = 0;
 4526|  3.16k|    status = read_module_internal(name);
 4527|       |
 4528|  3.16k|    if (status == MODULE_NOT_FOUND) {
  ------------------
  |  |  513|  3.16k|#define MODULE_NOT_FOUND	0
  ------------------
  |  Branch (4528:9): [True: 3.16k, False: 0]
  ------------------
 4529|  3.16k|        if (!read_module_replacements(name))
  ------------------
  |  Branch (4529:13): [True: 3.16k, False: 0]
  ------------------
 4530|  3.16k|            print_module_not_found(name);
 4531|  3.16k|    } else if (status == MODULE_SYNTAX_ERROR) {
  ------------------
  |  |  520|      0|#define MODULE_SYNTAX_ERROR     4
  ------------------
  |  Branch (4531:16): [True: 0, False: 0]
  ------------------
 4532|      0|        gMibError = 0;
 4533|      0|        gLoop = 1;
 4534|       |
 4535|      0|        strncat(gMibNames, " ", sizeof(gMibNames) - strlen(gMibNames) - 1);
 4536|      0|        strncat(gMibNames, name, sizeof(gMibNames) - strlen(gMibNames) - 1);
 4537|      0|    }
 4538|       |
 4539|  3.16k|    return tree_head;
 4540|  3.16k|}
unload_module_by_ID:
 4549|     66|{
 4550|     66|    struct tree    *tp, *next;
 4551|     66|    int             i;
 4552|       |
 4553|    264|    for (tp = tree_top; tp; tp = next) {
  ------------------
  |  Branch (4553:25): [True: 198, False: 66]
  ------------------
 4554|       |        /*
 4555|       |         * Essentially, this is equivalent to the code fragment:
 4556|       |         *      if (tp->modID == modID)
 4557|       |         *        tp->number_modules--;
 4558|       |         * but handles one tree node being part of several modules,
 4559|       |         * and possible multiple copies of the same module ID.
 4560|       |         */
 4561|    198|        int             nmod = tp->number_modules;
 4562|    198|        if (nmod > 0) {         /* in some module */
  ------------------
  |  Branch (4562:13): [True: 198, False: 0]
  ------------------
 4563|       |            /*
 4564|       |             * Remove all copies of this module ID
 4565|       |             */
 4566|    198|            int             cnt = 0, *pi1, *pi2 = tp->module_list;
 4567|    396|            for (i = 0, pi1 = pi2; i < nmod; i++, pi2++) {
  ------------------
  |  Branch (4567:36): [True: 198, False: 198]
  ------------------
 4568|    198|                if (*pi2 == modID)
  ------------------
  |  Branch (4568:21): [True: 198, False: 0]
  ------------------
 4569|    198|                    continue;
 4570|      0|                cnt++;
 4571|      0|                *pi1++ = *pi2;
 4572|      0|            }
 4573|    198|            if (nmod != cnt) {  /* in this module */
  ------------------
  |  Branch (4573:17): [True: 198, False: 0]
  ------------------
 4574|       |                /*
 4575|       |                 * if ( (nmod - cnt) > 1)
 4576|       |                 * printf("Dup modid %d,  %d times, '%s'\n", tp->modid, (nmod-cnt), tp->label); fflush(stdout); ?* XXDEBUG 
 4577|       |                 */
 4578|    198|                tp->number_modules = cnt;
 4579|    198|                switch (cnt) {
 4580|    198|                case 0:
  ------------------
  |  Branch (4580:17): [True: 198, False: 0]
  ------------------
 4581|    198|                    tp->module_list[0] = -1;    /* Mark unused, */
 4582|    198|		    NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2449|    198|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4583|       |
 4584|    198|                case 1:        /* save the remaining module */
  ------------------
  |  Branch (4584:17): [True: 0, False: 198]
  ------------------
 4585|    198|                    if (&(tp->modid) != tp->module_list) {
  ------------------
  |  Branch (4585:25): [True: 0, False: 198]
  ------------------
 4586|      0|                        tp->modid = tp->module_list[0];
 4587|      0|                        free(tp->module_list);
 4588|      0|                        tp->module_list = &(tp->modid);
 4589|      0|                    }
 4590|    198|                    break;
 4591|       |
 4592|      0|                default:
  ------------------
  |  Branch (4592:17): [True: 0, False: 198]
  ------------------
 4593|      0|                    break;
 4594|    198|                }
 4595|    198|            }                   /* if tree node is in this module */
 4596|    198|        }
 4597|       |        /*
 4598|       |         * if tree node is in some module 
 4599|       |         */
 4600|    198|        next = tp->next_peer;
 4601|       |
 4602|       |
 4603|       |        /*
 4604|       |         *  OK - that's dealt with *this* node.
 4605|       |         *    Now let's look at the children.
 4606|       |         *    (Isn't recursion wonderful!)
 4607|       |         */
 4608|    198|        if (tp->child_list)
  ------------------
  |  Branch (4608:13): [True: 0, False: 198]
  ------------------
 4609|      0|            unload_module_by_ID(modID, tp->child_list);
 4610|       |
 4611|       |
 4612|    198|        if (tp->number_modules == 0) {
  ------------------
  |  Branch (4612:13): [True: 198, False: 0]
  ------------------
 4613|       |            /*
 4614|       |             * This node isn't needed any more (except perhaps
 4615|       |             * for the sake of the children) 
 4616|       |             */
 4617|    198|            if (tp->child_list == NULL) {
  ------------------
  |  Branch (4617:17): [True: 198, False: 0]
  ------------------
 4618|    198|                unlink_tree(tp);
 4619|    198|                free_tree(tp);
 4620|    198|            } else {
 4621|      0|                free_partial_tree(tp, TRUE);
  ------------------
  |  |  128|      0|#define TRUE  1
  ------------------
 4622|      0|            }
 4623|    198|        }
 4624|    198|    }
 4625|     66|}
unload_all_mibs:
 4662|     66|{
 4663|     66|    struct module  *mp;
 4664|     66|    struct module_compatability *mcp;
 4665|     66|    struct tc      *ptc;
 4666|     66|    unsigned int    i;
 4667|       |
 4668|     66|    for (mcp = module_map_head; mcp; mcp = module_map_head) {
  ------------------
  |  Branch (4668:33): [True: 66, False: 0]
  ------------------
 4669|     66|        if (mcp == module_map)
  ------------------
  |  Branch (4669:13): [True: 66, False: 0]
  ------------------
 4670|     66|            break;
 4671|      0|        module_map_head = mcp->next;
 4672|      0|        if (mcp->tag) free(NETSNMP_REMOVE_CONST(char *, mcp->tag));
  ------------------
  |  |   91|      0|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  |  Branch (4672:13): [True: 0, False: 0]
  ------------------
 4673|      0|        free(NETSNMP_REMOVE_CONST(char *, mcp->old_module));
  ------------------
  |  |   91|      0|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
 4674|      0|        free(NETSNMP_REMOVE_CONST(char *, mcp->new_module));
  ------------------
  |  |   91|      0|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
 4675|      0|        free(mcp);
 4676|      0|    }
 4677|       |
 4678|     66|    for (mp = module_head; mp; mp = module_head) {
  ------------------
  |  Branch (4678:28): [True: 0, False: 66]
  ------------------
 4679|      0|        struct module_import *mi = mp->imports;
 4680|      0|        if (mi) {
  ------------------
  |  Branch (4680:13): [True: 0, False: 0]
  ------------------
 4681|      0|            for (i = 0; i < (unsigned int)mp->no_imports; ++i) {
  ------------------
  |  Branch (4681:25): [True: 0, False: 0]
  ------------------
 4682|      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]
  |  |  ------------------
  ------------------
 4683|      0|            }
 4684|      0|            mp->no_imports = 0;
 4685|      0|            if (mi == root_imports)
  ------------------
  |  Branch (4685:17): [True: 0, False: 0]
  ------------------
 4686|      0|                memset(mi, 0, sizeof(*mi));
 4687|      0|            else
 4688|      0|                free(mi);
 4689|      0|        }
 4690|       |
 4691|      0|        unload_module_by_ID(mp->modid, tree_head);
 4692|      0|        module_head = mp->next;
 4693|      0|        free(mp->name);
 4694|      0|        free(mp->file);
 4695|      0|        free(mp);
 4696|      0|    }
 4697|     66|    unload_module_by_ID(-1, tree_head);
 4698|       |    /*
 4699|       |     * tree nodes are cleared 
 4700|       |     */
 4701|       |
 4702|  6.66k|    for (i = 0, ptc = tclist; i < tc_alloc; i++, ptc++) {
  ------------------
  |  Branch (4702:31): [True: 6.60k, False: 66]
  ------------------
 4703|  6.60k|        if (ptc->type == 0)
  ------------------
  |  Branch (4703:13): [True: 6.60k, False: 0]
  ------------------
 4704|  6.60k|            continue;
 4705|      0|        free_enums(&ptc->enums);
 4706|      0|        free_ranges(&ptc->ranges);
 4707|      0|        free(ptc->descriptor);
 4708|      0|        if (ptc->hint)
  ------------------
  |  Branch (4708:13): [True: 0, False: 0]
  ------------------
 4709|      0|            free(ptc->hint);
 4710|      0|        if (ptc->description)
  ------------------
  |  Branch (4710:13): [True: 0, False: 0]
  ------------------
 4711|      0|            free(ptc->description);
 4712|      0|    }
 4713|     66|    SNMP_FREE(tclist);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 4714|     66|    tc_alloc = 0;
 4715|       |
 4716|     66|    memset(buckets, 0, sizeof(buckets));
 4717|     66|    memset(nbuckets, 0, sizeof(nbuckets));
 4718|     66|    memset(tbuckets, 0, sizeof(tbuckets));
 4719|       |
 4720|    264|    for (i = 0; i < sizeof(root_imports) / sizeof(root_imports[0]); i++) {
  ------------------
  |  Branch (4720:17): [True: 198, False: 66]
  ------------------
 4721|    198|        SNMP_FREE(root_imports[i].label);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 198, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
 4722|    198|    }
 4723|       |
 4724|     66|    max_module = 0;
 4725|     66|    current_module = 0;
 4726|     66|    module_map_head = NULL;
 4727|     66|    SNMP_FREE(last_err_module);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 4728|       |
 4729|     66|    {
 4730|     66|        struct node *np = orphan_nodes;
 4731|       |
 4732|     66|        while (np) {
  ------------------
  |  Branch (4732:16): [True: 0, False: 66]
  ------------------
 4733|      0|            struct node *nnp = np->next;
 4734|      0|            free_node(np);
 4735|      0|            np = nnp;
 4736|      0|        }
 4737|       |        orphan_nodes = NULL;
 4738|     66|    }
 4739|     66|    erroneousMibs = 0;
 4740|     66|    first_err_module = 1;
 4741|     66|}
add_mibdir:
 5704|    131|{
 5705|    131|    const char     *oldFile = File;
 5706|    131|    int             oldLine = mibLine;
 5707|    131|    char          **filenames;
 5708|    131|    int             count = 0;
 5709|    131|    int             filename_count, i;
 5710|       |
 5711|    131|    DEBUGMSGTL(("parse-mibs", "Scanning directory %s\n", dirname));
  ------------------
  |  |   66|    131|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    131|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 131]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 131]
  |  |  ------------------
  ------------------
 5712|       |
 5713|    131|    filename_count = scan_directory(&filenames, dirname);
 5714|       |
 5715|    131|    if (filename_count >= 0) {
  ------------------
  |  Branch (5715:9): [True: 0, False: 131]
  ------------------
 5716|      0|        for (i = 0; i < filename_count; i++) {
  ------------------
  |  Branch (5716:21): [True: 0, False: 0]
  ------------------
 5717|      0|            if (add_mibfile(filenames[i], strrchr(filenames[i], '/')) == 0)
  ------------------
  |  Branch (5717:17): [True: 0, False: 0]
  ------------------
 5718|      0|                count++;
 5719|      0|	    free(filenames[i]);
 5720|      0|        }
 5721|      0|        File = oldFile;
 5722|      0|        mibLine = oldLine;
 5723|      0|        free(filenames);
 5724|      0|        return (count);
 5725|      0|    }
 5726|    131|    else
 5727|    131|        DEBUGMSGTL(("parse-mibs","cannot open MIB directory %s\n", dirname));
  ------------------
  |  |   66|    131|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    131|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 131]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 131]
  |  |  ------------------
  ------------------
 5728|       |
 5729|    131|    return (-1);
 5730|    131|}
parse.c:name_hash:
  688|  6.46k|{
  689|  6.46k|    int             hash = 0;
  690|  6.46k|    const char     *cp;
  691|       |
  692|  6.46k|    if (!name)
  ------------------
  |  Branch (692:9): [True: 0, False: 6.46k]
  ------------------
  693|      0|        return 0;
  694|  67.8k|    for (cp = name; *cp; cp++)
  ------------------
  |  Branch (694:21): [True: 61.3k, False: 6.46k]
  ------------------
  695|  61.3k|        hash += tolower((unsigned char)(*cp));
  ------------------
  |  Branch (695:17): [True: 0, False: 0]
  |  Branch (695:17): [True: 0, False: 0]
  |  Branch (695:17): [Folded, False: 61.3k]
  ------------------
  696|  6.46k|    return (hash);
  697|  6.46k|}
parse.c:build_translation_table:
 1073|     66|{
 1074|     66|    int             count;
 1075|       |
 1076|  16.9k|    for (count = 0; count < 256; count++) {
  ------------------
  |  Branch (1076:21): [True: 16.8k, False: 66]
  ------------------
 1077|  16.8k|        switch (count) {
 1078|     66|        case OBJID:
  ------------------
  |  |  167|     66|#define OBJID       (4 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1078:9): [True: 66, False: 16.8k]
  ------------------
 1079|     66|            translation_table[count] = TYPE_OBJID;
  ------------------
  |  |  155|     66|#define TYPE_OBJID          1
  ------------------
 1080|     66|            break;
 1081|     66|        case OCTETSTR:
  ------------------
  |  |  168|     66|#define OCTETSTR    (5 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1081:9): [True: 66, False: 16.8k]
  ------------------
 1082|     66|            translation_table[count] = TYPE_OCTETSTR;
  ------------------
  |  |  156|     66|#define TYPE_OCTETSTR       2
  ------------------
 1083|     66|            break;
 1084|     66|        case INTEGER:
  ------------------
  |  |  169|     66|#define INTEGER     (6 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1084:9): [True: 66, False: 16.8k]
  ------------------
 1085|     66|            translation_table[count] = TYPE_INTEGER;
  ------------------
  |  |  157|     66|#define TYPE_INTEGER        3
  ------------------
 1086|     66|            break;
 1087|     66|        case NETADDR:
  ------------------
  |  |  170|     66|#define NETADDR     (7 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1087:9): [True: 66, False: 16.8k]
  ------------------
 1088|     66|            translation_table[count] = TYPE_NETADDR;
  ------------------
  |  |  158|     66|#define TYPE_NETADDR        4
  ------------------
 1089|     66|            break;
 1090|     66|        case IPADDR:
  ------------------
  |  |  171|     66|#define IPADDR      (8 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1090:9): [True: 66, False: 16.8k]
  ------------------
 1091|     66|            translation_table[count] = TYPE_IPADDR;
  ------------------
  |  |  159|     66|#define TYPE_IPADDR         5
  ------------------
 1092|     66|            break;
 1093|     66|        case COUNTER:
  ------------------
  |  |  172|     66|#define COUNTER     (9 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1093:9): [True: 66, False: 16.8k]
  ------------------
 1094|     66|            translation_table[count] = TYPE_COUNTER;
  ------------------
  |  |  160|     66|#define TYPE_COUNTER        6
  ------------------
 1095|     66|            break;
 1096|     66|        case GAUGE:
  ------------------
  |  |  173|     66|#define GAUGE       (10 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1096:9): [True: 66, False: 16.8k]
  ------------------
 1097|     66|            translation_table[count] = TYPE_GAUGE;
  ------------------
  |  |  161|     66|#define TYPE_GAUGE          7
  ------------------
 1098|     66|            break;
 1099|     66|        case TIMETICKS:
  ------------------
  |  |  174|     66|#define TIMETICKS   (11 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1099:9): [True: 66, False: 16.8k]
  ------------------
 1100|     66|            translation_table[count] = TYPE_TIMETICKS;
  ------------------
  |  |  162|     66|#define TYPE_TIMETICKS      8
  ------------------
 1101|     66|            break;
 1102|     66|        case KW_OPAQUE:
  ------------------
  |  |  175|     66|#define KW_OPAQUE   (12 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1102:9): [True: 66, False: 16.8k]
  ------------------
 1103|     66|            translation_table[count] = TYPE_OPAQUE;
  ------------------
  |  |  163|     66|#define TYPE_OPAQUE         9
  ------------------
 1104|     66|            break;
 1105|     66|        case NUL:
  ------------------
  |  |  176|     66|#define NUL         (13 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1105:9): [True: 66, False: 16.8k]
  ------------------
 1106|     66|            translation_table[count] = TYPE_NULL;
  ------------------
  |  |  164|     66|#define TYPE_NULL           10
  ------------------
 1107|     66|            break;
 1108|     66|        case COUNTER64:
  ------------------
  |  |  211|     66|#define COUNTER64   (43 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1108:9): [True: 66, False: 16.8k]
  ------------------
 1109|     66|            translation_table[count] = TYPE_COUNTER64;
  ------------------
  |  |  165|     66|#define TYPE_COUNTER64      11
  ------------------
 1110|     66|            break;
 1111|     66|        case BITSTRING:
  ------------------
  |  |  209|     66|#define BITSTRING   (41 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1111:9): [True: 66, False: 16.8k]
  ------------------
 1112|     66|            translation_table[count] = TYPE_BITSTRING;
  ------------------
  |  |  166|     66|#define TYPE_BITSTRING      12
  ------------------
 1113|     66|            break;
 1114|     66|        case NSAPADDRESS:
  ------------------
  |  |  210|     66|#define NSAPADDRESS (42 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1114:9): [True: 66, False: 16.8k]
  ------------------
 1115|     66|            translation_table[count] = TYPE_NSAPADDRESS;
  ------------------
  |  |  167|     66|#define TYPE_NSAPADDRESS    13
  ------------------
 1116|     66|            break;
 1117|     66|        case INTEGER32:
  ------------------
  |  |  274|     66|#define INTEGER32	(105 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1117:9): [True: 66, False: 16.8k]
  ------------------
 1118|     66|            translation_table[count] = TYPE_INTEGER32;
  ------------------
  |  |  170|     66|#define TYPE_INTEGER32      16
  ------------------
 1119|     66|            break;
 1120|     66|        case UINTEGER32:
  ------------------
  |  |  224|     66|#define UINTEGER32 (56 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1120:9): [True: 66, False: 16.8k]
  ------------------
 1121|     66|            translation_table[count] = TYPE_UINTEGER;
  ------------------
  |  |  168|     66|#define TYPE_UINTEGER       14
  ------------------
 1122|     66|            break;
 1123|     66|        case UNSIGNED32:
  ------------------
  |  |  273|     66|#define UNSIGNED32	(104 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     66|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1123:9): [True: 66, False: 16.8k]
  ------------------
 1124|     66|            translation_table[count] = TYPE_UNSIGNED32;
  ------------------
  |  |  169|     66|#define TYPE_UNSIGNED32     15
  ------------------
 1125|     66|            break;
 1126|     66|        case TRAPTYPE:
  ------------------
  |  |  229|     66|#define TRAPTYPE    61
  ------------------
  |  Branch (1126:9): [True: 66, False: 16.8k]
  ------------------
 1127|     66|            translation_table[count] = TYPE_TRAPTYPE;
  ------------------
  |  |  174|     66|#define TYPE_TRAPTYPE	    20
  ------------------
 1128|     66|            break;
 1129|     66|        case NOTIFTYPE:
  ------------------
  |  |  213|     66|#define NOTIFTYPE   45
  ------------------
  |  Branch (1129:9): [True: 66, False: 16.8k]
  ------------------
 1130|     66|            translation_table[count] = TYPE_NOTIFTYPE;
  ------------------
  |  |  175|     66|#define TYPE_NOTIFTYPE      21
  ------------------
 1131|     66|            break;
 1132|     66|        case NOTIFGROUP:
  ------------------
  |  |  258|     66|#define NOTIFGROUP  88
  ------------------
  |  Branch (1132:9): [True: 66, False: 16.8k]
  ------------------
 1133|     66|            translation_table[count] = TYPE_NOTIFGROUP;
  ------------------
  |  |  177|     66|#define TYPE_NOTIFGROUP	    23
  ------------------
 1134|     66|            break;
 1135|     66|        case OBJGROUP:
  ------------------
  |  |  212|     66|#define OBJGROUP    44
  ------------------
  |  Branch (1135:9): [True: 66, False: 16.8k]
  ------------------
 1136|     66|            translation_table[count] = TYPE_OBJGROUP;
  ------------------
  |  |  176|     66|#define TYPE_OBJGROUP	    22
  ------------------
 1137|     66|            break;
 1138|     66|        case MODULEIDENTITY:
  ------------------
  |  |  220|     66|#define MODULEIDENTITY 52
  ------------------
  |  Branch (1138:9): [True: 66, False: 16.8k]
  ------------------
 1139|     66|            translation_table[count] = TYPE_MODID;
  ------------------
  |  |  178|     66|#define TYPE_MODID	    24
  ------------------
 1140|     66|            break;
 1141|     66|        case OBJIDENTITY:
  ------------------
  |  |  275|     66|#define OBJIDENTITY	106
  ------------------
  |  Branch (1141:9): [True: 66, False: 16.8k]
  ------------------
 1142|     66|            translation_table[count] = TYPE_OBJIDENTITY;
  ------------------
  |  |  181|     66|#define TYPE_OBJIDENTITY    27
  ------------------
 1143|     66|            break;
 1144|     66|        case AGENTCAP:
  ------------------
  |  |  243|     66|#define AGENTCAP    73
  ------------------
  |  Branch (1144:9): [True: 66, False: 16.8k]
  ------------------
 1145|     66|            translation_table[count] = TYPE_AGENTCAP;
  ------------------
  |  |  179|     66|#define TYPE_AGENTCAP       25
  ------------------
 1146|     66|            break;
 1147|     66|        case COMPLIANCE:
  ------------------
  |  |  215|     66|#define COMPLIANCE  47
  ------------------
  |  Branch (1147:9): [True: 66, False: 16.8k]
  ------------------
 1148|     66|            translation_table[count] = TYPE_MODCOMP;
  ------------------
  |  |  180|     66|#define TYPE_MODCOMP        26
  ------------------
 1149|     66|            break;
 1150|  15.3k|        default:
  ------------------
  |  Branch (1150:9): [True: 15.3k, False: 1.58k]
  ------------------
 1151|  15.3k|            translation_table[count] = TYPE_OTHER;
  ------------------
  |  |  154|  15.3k|#define TYPE_OTHER          0
  ------------------
 1152|  15.3k|            break;
 1153|  16.8k|        }
 1154|  16.8k|    }
 1155|     66|}
parse.c:init_tree_roots:
 1159|     66|{
 1160|     66|    struct tree    *tp, *lasttp;
 1161|     66|    int             base_modid;
 1162|     66|    int             hash;
 1163|       |
 1164|     66|    base_modid = which_module("SNMPv2-SMI");
 1165|     66|    if (base_modid == -1)
  ------------------
  |  Branch (1165:9): [True: 66, False: 0]
  ------------------
 1166|     66|        base_modid = which_module("RFC1155-SMI");
 1167|     66|    if (base_modid == -1)
  ------------------
  |  Branch (1167:9): [True: 66, False: 0]
  ------------------
 1168|     66|        base_modid = which_module("RFC1213-MIB");
 1169|       |
 1170|       |    /*
 1171|       |     * build root node 
 1172|       |     */
 1173|     66|    tp = calloc(1, sizeof(struct tree));
 1174|     66|    if (tp == NULL)
  ------------------
  |  Branch (1174:9): [True: 0, False: 66]
  ------------------
 1175|      0|        return;
 1176|     66|    tp->label = strdup("joint-iso-ccitt");
 1177|     66|    tp->modid = base_modid;
 1178|     66|    tp->number_modules = 1;
 1179|     66|    tp->module_list = &(tp->modid);
 1180|     66|    tp->subid = 2;
 1181|     66|    tp->tc_index = -1;
 1182|     66|    set_function(tp);           /* from mib.c */
 1183|     66|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|     66|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|     66|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1184|     66|    tp->next = tbuckets[hash];
 1185|     66|    tbuckets[hash] = tp;
 1186|     66|    lasttp = tp;
 1187|     66|    root_imports[0].label = strdup(tp->label);
 1188|     66|    root_imports[0].modid = base_modid;
 1189|       |
 1190|       |    /*
 1191|       |     * build root node 
 1192|       |     */
 1193|     66|    tp = calloc(1, sizeof(struct tree));
 1194|     66|    if (tp == NULL)
  ------------------
  |  Branch (1194:9): [True: 0, False: 66]
  ------------------
 1195|      0|        return;
 1196|     66|    tp->next_peer = lasttp;
 1197|     66|    tp->label = strdup("ccitt");
 1198|     66|    tp->modid = base_modid;
 1199|     66|    tp->number_modules = 1;
 1200|     66|    tp->module_list = &(tp->modid);
 1201|     66|    tp->subid = 0;
 1202|     66|    tp->tc_index = -1;
 1203|     66|    set_function(tp);           /* from mib.c */
 1204|     66|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|     66|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|     66|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1205|     66|    tp->next = tbuckets[hash];
 1206|     66|    tbuckets[hash] = tp;
 1207|     66|    lasttp = tp;
 1208|     66|    root_imports[1].label = strdup(tp->label);
 1209|     66|    root_imports[1].modid = base_modid;
 1210|       |
 1211|       |    /*
 1212|       |     * build root node 
 1213|       |     */
 1214|     66|    tp = calloc(1, sizeof(struct tree));
 1215|     66|    if (tp == NULL)
  ------------------
  |  Branch (1215:9): [True: 0, False: 66]
  ------------------
 1216|      0|        return;
 1217|     66|    tp->next_peer = lasttp;
 1218|     66|    tp->label = strdup("iso");
 1219|     66|    tp->modid = base_modid;
 1220|     66|    tp->number_modules = 1;
 1221|     66|    tp->module_list = &(tp->modid);
 1222|     66|    tp->subid = 1;
 1223|     66|    tp->tc_index = -1;
 1224|     66|    set_function(tp);           /* from mib.c */
 1225|     66|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|     66|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|     66|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1226|     66|    tp->next = tbuckets[hash];
 1227|     66|    tbuckets[hash] = tp;
 1228|     66|    lasttp = tp;
 1229|     66|    root_imports[2].label = strdup(tp->label);
 1230|     66|    root_imports[2].modid = base_modid;
 1231|       |
 1232|     66|    tree_head = tp;
 1233|     66|}
parse.c:unlink_tbucket:
  831|    198|{
  832|    198|    int             hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|    198|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|    198|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
  833|    198|    struct tree    *otp = NULL, *ntp = tbuckets[hash];
  834|       |
  835|    198|    while (ntp && ntp != tp) {
  ------------------
  |  Branch (835:12): [True: 198, False: 0]
  |  Branch (835:19): [True: 0, False: 198]
  ------------------
  836|      0|        otp = ntp;
  837|      0|        ntp = ntp->next;
  838|      0|    }
  839|    198|    if (!ntp)
  ------------------
  |  Branch (839:9): [True: 0, False: 198]
  ------------------
  840|      0|        snmp_log(LOG_EMERG, "Can't find %s in tbuckets\n", tp->label);
  841|    198|    else if (otp)
  ------------------
  |  Branch (841:14): [True: 0, False: 198]
  ------------------
  842|      0|        otp->next = ntp->next;
  843|    198|    else
  844|    198|        tbuckets[hash] = tp->next;
  845|    198|}
parse.c:read_module_internal:
 4432|  3.16k|{
 4433|  3.16k|    struct module  *mp;
 4434|       |
 4435|  3.16k|    netsnmp_init_mib_internals();
 4436|       |
 4437|  3.16k|    for (mp = module_head; mp; mp = mp->next)
  ------------------
  |  Branch (4437:28): [True: 0, False: 3.16k]
  ------------------
 4438|      0|        if (!label_compare(mp->name, name))
  ------------------
  |  | 1238|      0|#define	label_compare	strcmp
  ------------------
  |  Branch (4438:13): [True: 0, False: 0]
  ------------------
 4439|      0|            return read_from_file(mp, name);
 4440|       |
 4441|  3.16k|    return MODULE_NOT_FOUND;
  ------------------
  |  |  513|  3.16k|#define MODULE_NOT_FOUND	0
  ------------------
 4442|  3.16k|}
parse.c:print_error:
  781|  3.16k|{
  782|  3.16k|    erroneousMibs++;
  783|  3.16k|    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|  3.16k|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (783:9): [True: 0, False: 3.16k]
  ------------------
  784|  3.16k|                                NETSNMP_DS_LIB_MIB_ERRORS))
  ------------------
  |  |   59|  3.16k|#define NETSNMP_DS_LIB_MIB_ERRORS          0
  ------------------
  785|      0|	return;
  786|  3.16k|    DEBUGMSGTL(("parse-mibs", "\n"));
  ------------------
  |  |   66|  3.16k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.16k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.16k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 3.16k]
  |  |  ------------------
  ------------------
  787|  3.16k|    if (type == ENDOFFILE)
  ------------------
  |  |  163|  3.16k|#define ENDOFFILE   0
  ------------------
  |  Branch (787:9): [True: 0, False: 3.16k]
  ------------------
  788|      0|        snmp_log(LOG_ERR, "%s (EOF): At line %d in %s\n", str, mibLine,
  789|      0|                 File);
  790|  3.16k|    else if (token && *token)
  ------------------
  |  Branch (790:14): [True: 3.16k, False: 0]
  |  Branch (790:23): [True: 3.16k, False: 0]
  ------------------
  791|  3.16k|        snmp_log(LOG_ERR, "%s (%s): At line %d in %s\n", str, token,
  792|  3.16k|                 mibLine, File);
  793|      0|    else
  794|      0|        snmp_log(LOG_ERR, "%s: At line %d in %s\n", str, mibLine, File);
  795|  3.16k|}
parse.c:free_indexes:
 5946|    198|{
 5947|    198|    if (spp && *spp) {
  ------------------
  |  Branch (5947:9): [True: 198, False: 0]
  |  Branch (5947:16): [True: 0, False: 198]
  ------------------
 5948|      0|        struct index_list *pp, *npp;
 5949|       |
 5950|      0|        pp = *spp;
 5951|      0|        *spp = NULL;
 5952|       |
 5953|      0|        while (pp) {
  ------------------
  |  Branch (5953:16): [True: 0, False: 0]
  ------------------
 5954|      0|            npp = pp->next;
 5955|      0|            if (pp->ilabel)
  ------------------
  |  Branch (5955:17): [True: 0, False: 0]
  ------------------
 5956|      0|                free(pp->ilabel);
 5957|      0|            free(pp);
 5958|      0|            pp = npp;
 5959|      0|        }
 5960|      0|    }
 5961|    198|}
parse.c:free_varbinds:
 5965|    198|{
 5966|    198|    if (spp && *spp) {
  ------------------
  |  Branch (5966:9): [True: 198, False: 0]
  |  Branch (5966:16): [True: 0, False: 198]
  ------------------
 5967|      0|        struct varbind_list *pp, *npp;
 5968|       |
 5969|      0|        pp = *spp;
 5970|      0|        *spp = NULL;
 5971|       |
 5972|      0|        while (pp) {
  ------------------
  |  Branch (5972:16): [True: 0, False: 0]
  ------------------
 5973|      0|            npp = pp->next;
 5974|      0|            if (pp->vblabel)
  ------------------
  |  Branch (5974:17): [True: 0, False: 0]
  ------------------
 5975|      0|                free(pp->vblabel);
 5976|      0|            free(pp);
 5977|      0|            pp = npp;
 5978|      0|        }
 5979|      0|    }
 5980|    198|}
parse.c:read_module_replacements:
 4312|  3.16k|{
 4313|  3.16k|    struct module_compatability *mcp;
 4314|       |
 4315|  72.8k|    for (mcp = module_map_head; mcp; mcp = mcp->next) {
  ------------------
  |  Branch (4315:33): [True: 69.6k, False: 3.16k]
  ------------------
 4316|  69.6k|        if (!label_compare(mcp->old_module, name)) {
  ------------------
  |  | 1238|  69.6k|#define	label_compare	strcmp
  ------------------
  |  Branch (4316:13): [True: 0, False: 69.6k]
  ------------------
 4317|      0|            if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (4317:17): [True: 0, False: 0]
  ------------------
 4318|      0|				   NETSNMP_DS_LIB_MIB_WARNINGS)) {
  ------------------
  |  |  114|      0|#define NETSNMP_DS_LIB_MIB_WARNINGS         0
  ------------------
 4319|      0|                snmp_log(LOG_WARNING,
 4320|      0|                         "Loading replacement module %s for %s (%s)\n",
 4321|      0|                         mcp->new_module, name, File);
 4322|      0|	    }
 4323|      0|            (void) netsnmp_read_module(mcp->new_module);
 4324|      0|            return 1;
 4325|      0|        }
 4326|  69.6k|    }
 4327|  3.16k|    return 0;
 4328|  3.16k|}
parse.c:print_module_not_found:
  799|  3.16k|{
  800|  3.16k|    if (first_err_module) {
  ------------------
  |  Branch (800:9): [True: 66, False: 3.10k]
  ------------------
  801|     66|        snmp_log(LOG_ERR, "MIB search path: %s\n",
  802|     66|                           netsnmp_get_mib_directory());
  803|     66|        first_err_module = 0;
  804|     66|    }
  805|  3.16k|    if (!last_err_module || strcmp(cp, last_err_module))
  ------------------
  |  Branch (805:9): [True: 66, False: 3.10k]
  |  Branch (805:29): [True: 3.10k, False: 0]
  ------------------
  806|  3.16k|        print_error("Cannot find module", cp, CONTINUE);
  ------------------
  |  |  162|  3.16k|#define CONTINUE    -1
  ------------------
  807|  3.16k|    if (last_err_module)
  ------------------
  |  Branch (807:9): [True: 3.10k, False: 66]
  ------------------
  808|  3.10k|        free(last_err_module);
  809|  3.16k|    last_err_module = strdup(cp);
  810|  3.16k|}
parse.c:unlink_tree:
  849|    198|{
  850|    198|    struct tree    *otp = NULL, *ntp = tp->parent;
  851|       |
  852|    198|    if (!ntp) {                 /* this tree has no parent */
  ------------------
  |  Branch (852:9): [True: 198, False: 0]
  ------------------
  853|    198|        DEBUGMSGTL(("unlink_tree", "Tree node %s has no parent\n",
  ------------------
  |  |   66|    198|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    198|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 198]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 198]
  |  |  ------------------
  ------------------
  854|    198|                    tp->label));
  855|    198|    } else {
  856|      0|        child_index_modified(ntp, NULL);
  857|      0|        ntp = ntp->child_list;
  858|       |
  859|      0|        while (ntp && ntp != tp) {
  ------------------
  |  Branch (859:16): [True: 0, False: 0]
  |  Branch (859:23): [True: 0, False: 0]
  ------------------
  860|      0|            otp = ntp;
  861|      0|            ntp = ntp->next_peer;
  862|      0|        }
  863|      0|        if (!ntp)
  ------------------
  |  Branch (863:13): [True: 0, False: 0]
  ------------------
  864|      0|            snmp_log(LOG_EMERG, "Can't find %s in %s's children\n",
  865|      0|                     tp->label, tp->parent->label);
  866|      0|        else if (otp)
  ------------------
  |  Branch (866:18): [True: 0, False: 0]
  ------------------
  867|      0|            otp->next_peer = ntp->next_peer;
  868|      0|        else
  869|      0|            tp->parent->child_list = tp->next_peer;
  870|      0|    }
  871|       |
  872|    198|    if (tree_head == tp)
  ------------------
  |  Branch (872:9): [True: 198, False: 0]
  ------------------
  873|    198|        tree_head = tp->next_peer;
  874|    198|}
parse.c:free_tree:
  905|    198|{
  906|    198|    if (!Tree)
  ------------------
  |  Branch (906:9): [True: 0, False: 198]
  ------------------
  907|      0|        return;
  908|       |
  909|    198|    unlink_tbucket(Tree);
  910|    198|    free_partial_tree(Tree, FALSE);
  ------------------
  |  |  125|    198|#define FALSE 0
  ------------------
  911|    198|    if (Tree->module_list != &Tree->modid)
  ------------------
  |  Branch (911:9): [True: 0, False: 198]
  ------------------
  912|      0|        free(Tree->module_list);
  913|    198|    free(Tree);
  914|    198|}
parse.c:free_partial_tree:
  878|    198|{
  879|    198|    if (!tp)
  ------------------
  |  Branch (879:9): [True: 0, False: 198]
  ------------------
  880|      0|        return;
  881|       |
  882|       |    /*
  883|       |     * remove the data from this tree node 
  884|       |     */
  885|    198|    free_enums(&tp->enums);
  886|    198|    free_ranges(&tp->ranges);
  887|    198|    free_indexes(&tp->indexes);
  888|    198|    free_varbinds(&tp->varbinds);
  889|    198|    if (!keep_label)
  ------------------
  |  Branch (889:9): [True: 198, False: 0]
  ------------------
  890|    198|        SNMP_FREE(tp->label);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 198, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
  891|    198|    SNMP_FREE(tp->hint);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 198]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
  892|    198|    SNMP_FREE(tp->units);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 198]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
  893|    198|    SNMP_FREE(tp->description);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 198]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
  894|    198|    SNMP_FREE(tp->reference);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 198]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
  895|    198|    SNMP_FREE(tp->augments);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 198]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
  896|       |    SNMP_FREE(tp->defaultValue);
  ------------------
  |  |   62|    198|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 198]
  |  |  |  Branch (62:66): [Folded, False: 198]
  |  |  ------------------
  ------------------
  897|    198|}
parse.c:scan_directory:
 5634|    131|{
 5635|    131|    DIR            *dir, *dir2;
 5636|    131|    struct dirent  *file;
 5637|    131|    char          **filenames = NULL;
 5638|    131|    int             fname_len, i, filename_count = 0, array_size = 0;
 5639|    131|    char           *tmpstr;
 5640|       |
 5641|    131|    *result = NULL;
 5642|       |
 5643|    131|    dir = opendir(dirname);
 5644|    131|    if (!dir)
  ------------------
  |  Branch (5644:9): [True: 131, False: 0]
  ------------------
 5645|    131|        return -1;
 5646|       |
 5647|      0|    while ((file = readdir(dir))) {
  ------------------
  |  Branch (5647:12): [True: 0, False: 0]
  ------------------
 5648|       |        /*
 5649|       |         * Only parse file names that don't begin with a '.'
 5650|       |         * Also skip files ending in '~', or starting/ending
 5651|       |         * with '#' which are typically editor backup files.
 5652|       |         */
 5653|      0|        fname_len = strlen(file->d_name);
 5654|      0|        if (fname_len > 0 && file->d_name[0] != '.'
  ------------------
  |  Branch (5654:13): [True: 0, False: 0]
  |  Branch (5654:30): [True: 0, False: 0]
  ------------------
 5655|      0|            && file->d_name[0] != '#'
  ------------------
  |  Branch (5655:16): [True: 0, False: 0]
  ------------------
 5656|      0|            && file->d_name[fname_len-1] != '#'
  ------------------
  |  Branch (5656:16): [True: 0, False: 0]
  ------------------
 5657|      0|            && file->d_name[fname_len-1] != '~') {
  ------------------
  |  Branch (5657:16): [True: 0, False: 0]
  ------------------
 5658|      0|            if (asprintf(&tmpstr, "%s/%s", dirname, file->d_name) < 0)
  ------------------
  |  Branch (5658:17): [True: 0, False: 0]
  ------------------
 5659|      0|                continue;
 5660|      0|            dir2 = opendir(tmpstr);
 5661|      0|            if (dir2) {
  ------------------
  |  Branch (5661:17): [True: 0, False: 0]
  ------------------
 5662|       |                /* file is a directory, don't read it */
 5663|      0|                closedir(dir2);
 5664|      0|            } else {
 5665|      0|                if (filename_count >= array_size) {
  ------------------
  |  Branch (5665:21): [True: 0, False: 0]
  ------------------
 5666|      0|                    char **new_filenames;
 5667|       |
 5668|      0|                    array_size = (array_size + 16) * 2;
 5669|      0|                    new_filenames = realloc(filenames,
 5670|      0|                                        array_size * sizeof(filenames[0]));
 5671|      0|                    if (!new_filenames) {
  ------------------
  |  Branch (5671:25): [True: 0, False: 0]
  ------------------
 5672|      0|                        free(tmpstr);
 5673|      0|                        for (i = 0; i < filename_count; i++)
  ------------------
  |  Branch (5673:37): [True: 0, False: 0]
  ------------------
 5674|      0|                            free(filenames[i]);
 5675|      0|                        free(filenames);
 5676|      0|                        closedir(dir);
 5677|      0|                        return -1;
 5678|      0|                    }
 5679|      0|                    filenames = new_filenames;
 5680|      0|                }
 5681|      0|                filenames[filename_count++] = tmpstr;
 5682|      0|                tmpstr = NULL;
 5683|      0|            }
 5684|      0|            free(tmpstr);
 5685|      0|        }
 5686|      0|    }
 5687|      0|    closedir(dir);
 5688|       |
 5689|      0|    if (filenames)
  ------------------
  |  Branch (5689:9): [True: 0, False: 0]
  ------------------
 5690|      0|        qsort(filenames, filename_count, sizeof(filenames[0]), elemcmp);
 5691|      0|    *result = filenames;
 5692|       |
 5693|      0|    return filename_count;
 5694|      0|}
parse.c:free_ranges:
 5984|    198|{
 5985|    198|    if (spp && *spp) {
  ------------------
  |  Branch (5985:9): [True: 198, False: 0]
  |  Branch (5985:16): [True: 0, False: 198]
  ------------------
 5986|      0|        struct range_list *pp, *npp;
 5987|       |
 5988|      0|        pp = *spp;
 5989|      0|        *spp = NULL;
 5990|       |
 5991|      0|        while (pp) {
  ------------------
  |  Branch (5991:16): [True: 0, False: 0]
  ------------------
 5992|      0|            npp = pp->next;
 5993|      0|            free(pp);
 5994|      0|            pp = npp;
 5995|      0|        }
 5996|      0|    }
 5997|    198|}
parse.c:free_enums:
 6001|    198|{
 6002|    198|    if (spp && *spp) {
  ------------------
  |  Branch (6002:9): [True: 198, False: 0]
  |  Branch (6002:16): [True: 0, False: 198]
  ------------------
 6003|      0|        struct enum_list *pp, *npp;
 6004|       |
 6005|      0|        pp = *spp;
 6006|      0|        *spp = NULL;
 6007|       |
 6008|      0|        while (pp) {
  ------------------
  |  Branch (6008:16): [True: 0, False: 0]
  ------------------
 6009|      0|            npp = pp->next;
 6010|      0|            if (pp->label)
  ------------------
  |  Branch (6010:17): [True: 0, False: 0]
  ------------------
 6011|      0|                free(pp->label);
 6012|      0|            free(pp);
 6013|      0|            pp = npp;
 6014|      0|        }
 6015|      0|    }
 6016|    198|}

register_prenetsnmp_mib_handler:
  256|  2.31k|{
  257|  2.31k|    return internal_register_config_handler(type, token, parser, NULL, releaser,
  258|  2.31k|					    help, PREMIB_CONFIG);
  ------------------
  |  |   15|  2.31k|#define PREMIB_CONFIG 1
  ------------------
  259|  2.31k|}
register_config_handler:
  311|  4.15k|{
  312|  4.15k|    return internal_register_config_handler(type, token, parser, NULL, releaser,
  313|  4.15k|					    help, NORMAL_CONFIG);
  ------------------
  |  |   14|  4.15k|#define NORMAL_CONFIG 0
  ------------------
  314|  4.15k|}
register_const_config_handler:
  321|     66|{
  322|     66|    return internal_register_config_handler(type, token, NULL, parser, releaser,
  323|     66|					    help, NORMAL_CONFIG);
  ------------------
  |  |   14|     66|#define NORMAL_CONFIG 0
  ------------------
  324|     66|}
register_app_config_handler:
  330|    132|{
  331|       |    return register_config_handler(NULL, token, parser, releaser, help);
  332|    132|}
unregister_config_handler:
  356|  11.0k|{
  357|  11.0k|    struct config_files **ctmp = &config_files;
  358|  11.0k|    struct config_line  **ltmp;
  359|  11.0k|    const char           *type = type_param;
  360|       |
  361|  11.0k|    if (type == NULL || *type == '\0') {
  ------------------
  |  Branch (361:9): [True: 0, False: 11.0k]
  |  Branch (361:25): [True: 0, False: 11.0k]
  ------------------
  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|  11.0k|    if (strchr(type, ':')) {
  ------------------
  |  Branch (369:9): [True: 0, False: 11.0k]
  ------------------
  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|  11.0k|    while (*ctmp != NULL && strcmp((*ctmp)->fileHeader, type)) {
  ------------------
  |  Branch (389:12): [True: 6.66k, False: 4.35k]
  |  Branch (389:29): [True: 0, False: 6.66k]
  ------------------
  390|      0|        ctmp = &((*ctmp)->next);
  391|      0|    }
  392|       |
  393|  11.0k|    if (*ctmp == NULL) {
  ------------------
  |  Branch (393:9): [True: 4.35k, False: 6.66k]
  ------------------
  394|       |        /*
  395|       |         * Not found, return. 
  396|       |         */
  397|  4.35k|        return;
  398|  4.35k|    }
  399|       |
  400|  6.66k|    ltmp = &((*ctmp)->start);
  401|  6.66k|    if (*ltmp == NULL) {
  ------------------
  |  Branch (401:9): [True: 0, False: 6.66k]
  ------------------
  402|       |        /*
  403|       |         * Not found, return. 
  404|       |         */
  405|      0|        return;
  406|      0|    }
  407|  6.66k|    if (strcmp((*ltmp)->config_token, token) == 0) {
  ------------------
  |  Branch (407:9): [True: 6.66k, False: 0]
  ------------------
  408|       |        /*
  409|       |         * found it at the top of the list 
  410|       |         */
  411|  6.66k|        struct config_line *ltmp2 = (*ltmp)->next;
  412|  6.66k|        if ((*ltmp)->free_func)
  ------------------
  |  Branch (412:13): [True: 462, False: 6.20k]
  ------------------
  413|    462|            (*ltmp)->free_func();
  414|  6.66k|        SNMP_FREE((*ltmp)->config_token);
  ------------------
  |  |   62|  6.66k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 6.66k, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 6.66k]
  |  |  ------------------
  ------------------
  415|  6.66k|        SNMP_FREE((*ltmp)->help);
  ------------------
  |  |   62|  6.66k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 5.87k, False: 792]
  |  |  |  Branch (62:66): [Folded, False: 6.66k]
  |  |  ------------------
  ------------------
  416|  6.66k|        SNMP_FREE(*ltmp);
  ------------------
  |  |   62|  6.66k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 6.66k, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 6.66k]
  |  |  ------------------
  ------------------
  417|  6.66k|        (*ctmp)->start = ltmp2;
  418|  6.66k|        return;
  419|  6.66k|    }
  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|     66|{
  446|     66|    struct config_files *ctmp, *save;
  447|     66|    struct config_line *ltmp;
  448|       |
  449|       |    /*
  450|       |     * Keep using config_files until there are no more! 
  451|       |     */
  452|    198|    for (ctmp = config_files; ctmp;) {
  ------------------
  |  Branch (452:31): [True: 132, False: 66]
  ------------------
  453|  6.79k|        for (ltmp = ctmp->start; ltmp; ltmp = ctmp->start) {
  ------------------
  |  Branch (453:34): [True: 6.66k, False: 132]
  ------------------
  454|  6.66k|            unregister_config_handler(ctmp->fileHeader,
  455|  6.66k|                                      ltmp->config_token);
  456|  6.66k|        }
  457|    132|        SNMP_FREE(ctmp->fileHeader);
  ------------------
  |  |   62|    132|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 132, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 132]
  |  |  ------------------
  ------------------
  458|    132|        save = ctmp->next;
  459|       |        SNMP_FREE(ctmp);
  ------------------
  |  |   62|    132|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 132, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 132]
  |  |  ------------------
  ------------------
  460|    132|        ctmp = save;
  461|    132|        config_files = save;
  462|    132|    }
  463|     66|}
netsnmp_config_remember_free_list:
  695|     66|{
  696|     66|    struct read_config_memory *tmpmem;
  697|     66|    while (*mem) {
  ------------------
  |  Branch (697:12): [True: 0, False: 66]
  ------------------
  698|      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]
  |  |  ------------------
  ------------------
  699|      0|        tmpmem = (*mem)->next;
  700|       |        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]
  |  |  ------------------
  ------------------
  701|      0|        *mem = tmpmem;
  702|      0|    }
  703|     66|}
netsnmp_config_process_memory_list:
  708|    132|{
  709|       |
  710|    132|    struct read_config_memory *mem;
  711|       |
  712|    132|    if (!memp)
  ------------------
  |  Branch (712:9): [True: 0, False: 132]
  ------------------
  713|      0|        return;
  714|       |
  715|    132|    mem = *memp;
  716|       |
  717|    132|    while (mem) {
  ------------------
  |  Branch (717:12): [True: 0, False: 132]
  ------------------
  718|      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]
  |  |  ------------------
  ------------------
  719|      0|        snmp_config_when(mem->line, when);
  720|      0|        mem = mem->next;
  721|      0|    }
  722|       |
  723|    132|    if (clear)
  ------------------
  |  Branch (723:9): [True: 66, False: 66]
  ------------------
  724|     66|        netsnmp_config_remember_free_list(memp);
  725|    132|}
netsnmp_config_process_memories_when:
  746|    132|{
  747|    132|    netsnmp_config_process_memory_list(&memorylist, when, clear);
  748|    132|}
free_config:
 1036|     66|{
 1037|     66|    struct config_files *ctmp = config_files;
 1038|     66|    struct config_line *ltmp;
 1039|       |
 1040|    198|    for (; ctmp != NULL; ctmp = ctmp->next)
  ------------------
  |  Branch (1040:12): [True: 132, False: 66]
  ------------------
 1041|  6.79k|        for (ltmp = ctmp->start; ltmp != NULL; ltmp = ltmp->next)
  ------------------
  |  Branch (1041:34): [True: 6.66k, False: 132]
  ------------------
 1042|  6.66k|            if (ltmp->free_func)
  ------------------
  |  Branch (1042:17): [True: 462, False: 6.20k]
  ------------------
 1043|    462|                (*(ltmp->free_func)) ();
 1044|     66|}
read_configs:
 1089|     66|{
 1090|     66|    char *optional_config = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1091|     66|					       NETSNMP_DS_LIB_OPTIONALCONFIG);
  ------------------
  |  |  156|     66|#define NETSNMP_DS_LIB_OPTIONALCONFIG    5
  ------------------
 1092|       |
 1093|     66|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1094|     66|                        SNMP_CALLBACK_PRE_READ_CONFIG, NULL);
  ------------------
  |  |   30|     66|#define SNMP_CALLBACK_PRE_READ_CONFIG	        7
  ------------------
 1095|       |
 1096|     66|    DEBUGMSGTL(("read_config", "reading normal configuration tokens\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 1097|       |
 1098|     66|    if ((NULL != optional_config) && (*optional_config == '-')) {
  ------------------
  |  Branch (1098:9): [True: 0, False: 66]
  |  Branch (1098:38): [True: 0, False: 0]
  ------------------
 1099|      0|        (void)read_configs_optional(++optional_config, NORMAL_CONFIG);
  ------------------
  |  |   14|      0|#define NORMAL_CONFIG 0
  ------------------
 1100|      0|        optional_config = NULL; /* clear, so we don't read them twice */
 1101|      0|    }
 1102|       |
 1103|     66|    (void)read_config_files(NORMAL_CONFIG);
  ------------------
  |  |   14|     66|#define NORMAL_CONFIG 0
  ------------------
 1104|       |
 1105|       |    /*
 1106|       |     * do this even when the normal above wasn't done 
 1107|       |     */
 1108|     66|    if (NULL != optional_config)
  ------------------
  |  Branch (1108:9): [True: 0, False: 66]
  ------------------
 1109|      0|        (void)read_configs_optional(optional_config, NORMAL_CONFIG);
  ------------------
  |  |   14|      0|#define NORMAL_CONFIG 0
  ------------------
 1110|       |
 1111|     66|    netsnmp_config_process_memories_when(NORMAL_CONFIG, 1);
  ------------------
  |  |   14|     66|#define NORMAL_CONFIG 0
  ------------------
 1112|       |
 1113|     66|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1114|     66|			   NETSNMP_DS_LIB_HAVE_READ_CONFIG, 1);
  ------------------
  |  |   87|     66|#define NETSNMP_DS_LIB_HAVE_READ_CONFIG    27   /* have the config tokens been processed */
  ------------------
 1115|     66|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1116|     66|                        SNMP_CALLBACK_POST_READ_CONFIG, NULL);
  ------------------
  |  |   24|     66|#define SNMP_CALLBACK_POST_READ_CONFIG	        0
  ------------------
 1117|     66|}
read_premib_configs:
 1121|     66|{
 1122|     66|    char *optional_config = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1123|     66|					       NETSNMP_DS_LIB_OPTIONALCONFIG);
  ------------------
  |  |  156|     66|#define NETSNMP_DS_LIB_OPTIONALCONFIG    5
  ------------------
 1124|       |
 1125|     66|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1126|     66|                        SNMP_CALLBACK_PRE_PREMIB_READ_CONFIG, NULL);
  ------------------
  |  |   31|     66|#define SNMP_CALLBACK_PRE_PREMIB_READ_CONFIG	8
  ------------------
 1127|       |
 1128|     66|    DEBUGMSGTL(("read_config", "reading premib configuration tokens\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 1129|       |
 1130|     66|    if ((NULL != optional_config) && (*optional_config == '-')) {
  ------------------
  |  Branch (1130:9): [True: 0, False: 66]
  |  Branch (1130:38): [True: 0, False: 0]
  ------------------
 1131|      0|        (void)read_configs_optional(++optional_config, PREMIB_CONFIG);
  ------------------
  |  |   15|      0|#define PREMIB_CONFIG 1
  ------------------
 1132|      0|        optional_config = NULL; /* clear, so we don't read them twice */
 1133|      0|    }
 1134|       |
 1135|     66|    (void)read_config_files(PREMIB_CONFIG);
  ------------------
  |  |   15|     66|#define PREMIB_CONFIG 1
  ------------------
 1136|       |
 1137|     66|    if (NULL != optional_config)
  ------------------
  |  Branch (1137:9): [True: 0, False: 66]
  ------------------
 1138|      0|        (void)read_configs_optional(optional_config, PREMIB_CONFIG);
  ------------------
  |  |   15|      0|#define PREMIB_CONFIG 1
  ------------------
 1139|       |
 1140|     66|    netsnmp_config_process_memories_when(PREMIB_CONFIG, 0);
  ------------------
  |  |   15|     66|#define PREMIB_CONFIG 1
  ------------------
 1141|       |
 1142|     66|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1143|     66|			   NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG, 1);
  ------------------
  |  |   86|     66|#define NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG 26       /* have the pre-mib parsing config tokens been processed */
  ------------------
 1144|     66|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1145|     66|                        SNMP_CALLBACK_POST_PREMIB_READ_CONFIG, NULL);
  ------------------
  |  |   27|     66|#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG	3
  ------------------
 1146|     66|}
set_configuration_directory:
 1158|      1|{
 1159|      1|    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1160|      1|			  NETSNMP_DS_LIB_CONFIGURATION_DIR, dir);
  ------------------
  |  |  160|      1|#define NETSNMP_DS_LIB_CONFIGURATION_DIR 9
  ------------------
 1161|      1|}
get_configuration_directory:
 1177|      1|{
 1178|      1|    char            defaultPath[SPRINT_MAX_LEN];
 1179|      1|    const char     *homepath;
 1180|       |
 1181|      1|    if (NULL == netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1181:9): [True: 1, False: 0]
  ------------------
 1182|      1|				      NETSNMP_DS_LIB_CONFIGURATION_DIR)) {
  ------------------
  |  |  160|      1|#define NETSNMP_DS_LIB_CONFIGURATION_DIR 9
  ------------------
 1183|      1|        homepath = netsnmp_gethomedir();
 1184|      1|        snprintf(defaultPath, sizeof(defaultPath), "%s%c%s%c%s%s%s%s",
 1185|      1|                SNMPCONFPATH, ENV_SEPARATOR_CHAR,
  ------------------
  |  | 2068|      1|#define SNMPCONFPATH "/usr/local/net-snmp-master/etc/snmp"
  ------------------
                              SNMPCONFPATH, ENV_SEPARATOR_CHAR,
  ------------------
  |  |   70|      1|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 1186|      1|                SNMPSHAREPATH, ENV_SEPARATOR_CHAR, SNMPLIBPATH,
  ------------------
  |  | 2067|      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,
  ------------------
  |  | 2066|      1|#define SNMPLIBPATH "/usr/local/net-snmp-master/lib/snmp"
  ------------------
 1187|      1|                ((homepath == NULL) ? "" : ENV_SEPARATOR),
  ------------------
  |  |   67|      1|#define ENV_SEPARATOR ":"
  ------------------
  |  Branch (1187:18): [True: 0, False: 1]
  ------------------
 1188|      1|                ((homepath == NULL) ? "" : homepath),
  ------------------
  |  Branch (1188:18): [True: 0, False: 1]
  ------------------
 1189|      1|                ((homepath == NULL) ? "" : "/.snmp"));
  ------------------
  |  Branch (1189:18): [True: 0, False: 1]
  ------------------
 1190|      1|        defaultPath[ sizeof(defaultPath)-1 ] = 0;
 1191|      1|        set_configuration_directory(defaultPath);
 1192|      1|    }
 1193|      1|    return (netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1194|      1|				  NETSNMP_DS_LIB_CONFIGURATION_DIR));
  ------------------
  |  |  160|      1|#define NETSNMP_DS_LIB_CONFIGURATION_DIR 9
  ------------------
 1195|      1|}
get_persistent_directory:
 1225|      1|{
 1226|      1|    if (NULL == netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1226:9): [True: 0, False: 1]
  ------------------
 1227|      1|				      NETSNMP_DS_LIB_PERSISTENT_DIR)) {
  ------------------
  |  |  159|      1|#define NETSNMP_DS_LIB_PERSISTENT_DIR    8
  ------------------
 1228|      0|        const char *persdir = netsnmp_getenv("SNMP_PERSISTENT_DIR");
 1229|      0|        if (NULL == persdir)
  ------------------
  |  Branch (1229:13): [True: 0, False: 0]
  ------------------
 1230|      0|            persdir = NETSNMP_PERSISTENT_DIRECTORY;
  ------------------
  |  | 2038|      0|#define NETSNMP_PERSISTENT_DIRECTORY "/var/net-snmp"
  ------------------
 1231|      0|        set_persistent_directory(persdir);
 1232|      0|    }
 1233|      1|    return (netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1234|      1|				  NETSNMP_DS_LIB_PERSISTENT_DIR));
  ------------------
  |  |  159|      1|#define NETSNMP_DS_LIB_PERSISTENT_DIR    8
  ------------------
 1235|      1|}
read_config_files_of_type:
 1419|    264|{
 1420|    264|    const char     *confpath, *persfile, *envconfpath;
 1421|    264|    char           *perspath;
 1422|    264|    int             ret = SNMPERR_GENERR;
  ------------------
  |  |  185|    264|#define SNMPERR_GENERR			(-1)
  ------------------
 1423|       |
 1424|    264|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    264|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1424:9): [True: 264, False: 0]
  ------------------
 1425|    264|                               NETSNMP_DS_LIB_DONT_PERSIST_STATE)
  ------------------
  |  |   92|    264|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
 1426|      0|        || netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1426:12): [True: 0, False: 0]
  ------------------
 1427|      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 */
  |  |  ------------------
  ------------------
 1428|    264|        || (NULL == ctmp)) return ret;
  ------------------
  |  Branch (1428:12): [True: 0, False: 0]
  ------------------
 1429|       |
 1430|       |    /*
 1431|       |     * these shouldn't change
 1432|       |     */
 1433|      0|    confpath = get_configuration_directory();
 1434|      0|    persfile = netsnmp_getenv("SNMP_PERSISTENT_FILE");
 1435|      0|    envconfpath = netsnmp_getenv("SNMPCONFPATH");
 1436|       |
 1437|       |
 1438|       |        /*
 1439|       |         * read the config files. strdup() the result of
 1440|       |         * get_persistent_directory() to avoid that parsing the "persistentDir"
 1441|       |         * keyword transforms the perspath pointer into a dangling pointer.
 1442|       |         */
 1443|      0|        perspath = strdup(get_persistent_directory());
 1444|      0|        if (perspath == NULL) {
  ------------------
  |  Branch (1444:13): [True: 0, False: 0]
  ------------------
 1445|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1446|      0|        }
 1447|      0|        if (envconfpath == NULL) {
  ------------------
  |  Branch (1447:13): [True: 0, False: 0]
  ------------------
 1448|       |            /*
 1449|       |             * read just the config files (no persistent stuff), since
 1450|       |             * persistent path can change via conf file. Then get the
 1451|       |             * current persistent directory, and read files there.
 1452|       |             */
 1453|      0|            if ( read_config_files_in_path(confpath, ctmp, when, perspath,
  ------------------
  |  Branch (1453:18): [True: 0, False: 0]
  ------------------
 1454|      0|                                      persfile) == SNMPERR_SUCCESS )
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1455|      0|                ret = SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1456|      0|            free(perspath);
 1457|      0|            perspath = strdup(get_persistent_directory());
 1458|      0|            if (perspath == NULL) {
  ------------------
  |  Branch (1458:17): [True: 0, False: 0]
  ------------------
 1459|      0|                return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1460|      0|            }
 1461|      0|            if ( read_config_files_in_path(perspath, ctmp, when, perspath,
  ------------------
  |  Branch (1461:18): [True: 0, False: 0]
  ------------------
 1462|      0|                                      persfile) == SNMPERR_SUCCESS )
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1463|      0|                ret = SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1464|      0|        }
 1465|      0|        else {
 1466|       |            /*
 1467|       |             * only read path specified by user
 1468|       |             */
 1469|      0|            if ( read_config_files_in_path(envconfpath, ctmp, when, perspath,
  ------------------
  |  Branch (1469:18): [True: 0, False: 0]
  ------------------
 1470|      0|                                      persfile) == SNMPERR_SUCCESS )
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1471|      0|                ret = SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1472|      0|        }
 1473|      0|        free(perspath);
 1474|      0|        return ret;
 1475|      0|}
read_config_files:
 1483|    132|read_config_files(int when) {
 1484|       |
 1485|    132|    struct config_files *ctmp = config_files;
 1486|    132|    int                  ret  = SNMPERR_GENERR;
  ------------------
  |  |  185|    132|#define SNMPERR_GENERR			(-1)
  ------------------
 1487|       |
 1488|    132|    config_errors = 0;
 1489|       |
 1490|    132|    if (when == PREMIB_CONFIG)
  ------------------
  |  |   15|    132|#define PREMIB_CONFIG 1
  ------------------
  |  Branch (1490:9): [True: 66, False: 66]
  ------------------
 1491|     66|        free_config();
 1492|       |
 1493|       |    /*
 1494|       |     * read all config file types 
 1495|       |     */
 1496|    396|    for (; ctmp != NULL; ctmp = ctmp->next) {
  ------------------
  |  Branch (1496:12): [True: 264, False: 132]
  ------------------
 1497|    264|        if ( read_config_files_of_type(when, ctmp) == SNMPERR_SUCCESS )
  ------------------
  |  |  184|    264|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (1497:14): [True: 0, False: 264]
  ------------------
 1498|      0|            ret = SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1499|    264|    }
 1500|       |
 1501|    132|    if (config_errors) {
  ------------------
  |  Branch (1501:9): [True: 0, False: 132]
  ------------------
 1502|       |        snmp_log(LOG_ERR, "net-snmp: %d error(s) in config file(s)\n",
 1503|      0|                 config_errors);
 1504|      0|    }
 1505|    132|    return ret;
 1506|    132|}
read_config_store:
 1555|    132|{
 1556|    132|#ifdef NETSNMP_PERSISTENT_DIRECTORY
 1557|    132|    char            file[512], *filep;
 1558|    132|    FILE           *fout;
 1559|    132|#ifdef NETSNMP_PERSISTENT_MASK
 1560|    132|    mode_t          oldmask;
 1561|    132|#endif
 1562|       |
 1563|    132|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    132|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1563:9): [True: 132, False: 0]
  ------------------
 1564|    132|                               NETSNMP_DS_LIB_DONT_PERSIST_STATE)
  ------------------
  |  |   92|    132|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
 1565|      0|     || netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1565:9): [True: 0, False: 0]
  ------------------
 1566|    132|                               NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD)) return;
  ------------------
  |  |   95|      0|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD  35 /* don't load persistent file */
  ------------------
 1567|       |
 1568|       |    /*
 1569|       |     * store configuration directives in the following order of preference:
 1570|       |     * 1. ENV variable SNMP_PERSISTENT_FILE
 1571|       |     * 2. configured <NETSNMP_PERSISTENT_DIRECTORY>/<type>.conf
 1572|       |     */
 1573|      0|    if ((filep = netsnmp_getenv("SNMP_PERSISTENT_FILE")) == NULL) {
  ------------------
  |  Branch (1573:9): [True: 0, False: 0]
  ------------------
 1574|      0|        snprintf(file, sizeof(file),
 1575|      0|                 "%s/%s.conf", get_persistent_directory(), type);
 1576|      0|        filep = file;
 1577|      0|    }
 1578|      0|#ifdef NETSNMP_PERSISTENT_MASK
 1579|      0|    oldmask = umask(NETSNMP_PERSISTENT_MASK);
  ------------------
  |  | 1773|      0|#define NETSNMP_PERSISTENT_MASK 077
  ------------------
 1580|      0|#endif
 1581|      0|    if (mkdirhier(filep, NETSNMP_AGENT_DIRECTORY_MODE, 1)) {
  ------------------
  |  | 2043|      0|#define NETSNMP_AGENT_DIRECTORY_MODE 0700
  ------------------
  |  Branch (1581:9): [True: 0, False: 0]
  ------------------
 1582|      0|        snmp_log(LOG_ERR,
 1583|      0|                 "Failed to create the persistent directory for %s\n",
 1584|      0|                 filep);
 1585|      0|    }
 1586|      0|    if ((fout = fopen(filep, "a")) != NULL) {
  ------------------
  |  Branch (1586:9): [True: 0, False: 0]
  ------------------
 1587|      0|        fprintf(fout, "%s", line);
 1588|      0|        if (line[strlen(line)] != '\n')
  ------------------
  |  Branch (1588:13): [True: 0, False: 0]
  ------------------
 1589|      0|            fprintf(fout, "\n");
 1590|      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]
  |  |  ------------------
  ------------------
 1591|      0|        fflush(fout);
 1592|      0|#if defined(HAVE_FSYNC)
 1593|      0|        fsync(fileno(fout));
 1594|       |#elif defined(HAVE__GET_OSFHANDLE)
 1595|       |        {
 1596|       |            int fd;
 1597|       |            HANDLE h;
 1598|       |
 1599|       |            fd = fileno(fout);
 1600|       |            netsnmp_assert(fd != -1);
 1601|       |            /*
 1602|       |             * Use size_t instead of uintptr_t because not all supported
 1603|       |             * Windows compilers support uintptr_t.
 1604|       |             */
 1605|       |            h = (HANDLE)(size_t)_get_osfhandle(fd);
 1606|       |            netsnmp_assert(h != INVALID_HANDLE_VALUE);
 1607|       |            FlushFileBuffers(h);
 1608|       |        }
 1609|       |#endif
 1610|      0|        fclose(fout);
 1611|      0|    } else {
 1612|      0|        if (strcmp(NETSNMP_APPLICATION_CONFIG_TYPE, type) != 0) {
  ------------------
  |  |   22|      0|#define NETSNMP_APPLICATION_CONFIG_TYPE "snmpapp"
  ------------------
  |  Branch (1612:13): [True: 0, False: 0]
  ------------------
 1613|       |            /*
 1614|       |             * Ignore this error in client utilities, they can run with random
 1615|       |             * UID/GID and typically cannot write to /var. Error message just
 1616|       |             * confuses people.
 1617|       |             */
 1618|      0|            snmp_log(LOG_ERR, "read_config_store open failure on %s\n", filep);
 1619|      0|        }
 1620|      0|    }
 1621|      0|#ifdef NETSNMP_PERSISTENT_MASK
 1622|      0|    umask(oldmask);
 1623|      0|#endif
 1624|       |
 1625|      0|#endif
 1626|      0|}                               /* end read_config_store() */
snmp_save_persistent:
 1659|     66|{
 1660|     66|    char            file[512], fileold[SPRINT_MAX_LEN];
 1661|     66|    struct stat     statbuf;
 1662|     66|    int             j;
 1663|       |
 1664|     66|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1664:9): [True: 66, False: 0]
  ------------------
 1665|     66|                               NETSNMP_DS_LIB_DONT_PERSIST_STATE)
  ------------------
  |  |   92|     66|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
 1666|      0|     || netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1666:9): [True: 0, False: 0]
  ------------------
 1667|     66|                               NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE)) return;
  ------------------
  |  |   96|      0|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE  36 /* don't save persistent file */
  ------------------
 1668|       |
 1669|      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]
  |  |  ------------------
  ------------------
 1670|      0|    snprintf(file, sizeof(file),
 1671|      0|             "%s/%s.conf", get_persistent_directory(), type);
 1672|      0|    if (stat(file, &statbuf) == 0) {
  ------------------
  |  Branch (1672:9): [True: 0, False: 0]
  ------------------
 1673|      0|        for (j = 0; j <= NETSNMP_MAX_PERSISTENT_BACKUPS; j++) {
  ------------------
  |  | 2050|      0|#define NETSNMP_MAX_PERSISTENT_BACKUPS 10
  ------------------
  |  Branch (1673:21): [True: 0, False: 0]
  ------------------
 1674|      0|            snprintf(fileold, sizeof(fileold),
 1675|      0|                     "%s/%s.%d.conf", get_persistent_directory(), type, j);
 1676|      0|            if (stat(fileold, &statbuf) != 0) {
  ------------------
  |  Branch (1676:17): [True: 0, False: 0]
  ------------------
 1677|      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]
  |  |  ------------------
  ------------------
 1678|      0|                            " saving old config file: %s -> %s.\n", file,
 1679|      0|                            fileold));
 1680|      0|                if (rename(file, fileold)) {
  ------------------
  |  Branch (1680:21): [True: 0, False: 0]
  ------------------
 1681|      0|                    snmp_log(LOG_ERR, "Cannot rename %s to %s\n", file, fileold);
 1682|       |                     /* moving it failed, try nuking it, as leaving
 1683|       |                      * it around is very bad. */
 1684|      0|                    if (unlink(file) == -1)
  ------------------
  |  Branch (1684:25): [True: 0, False: 0]
  ------------------
 1685|      0|                        snmp_log(LOG_ERR, "Cannot unlink %s\n", file);
 1686|      0|                }
 1687|      0|                break;
 1688|      0|            }
 1689|      0|        }
 1690|      0|    }
 1691|       |    /*
 1692|       |     * save a warning header to the top of the new file 
 1693|       |     */
 1694|      0|    snprintf(fileold, sizeof(fileold),
 1695|      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",
 1696|      0|            "#\n# net-snmp (or ucd-snmp) persistent data file.\n#\n############################################################################\n# STOP STOP STOP STOP STOP STOP STOP STOP STOP \n",
 1697|      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",
 1698|      0|            type, type, type,
 1699|      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");
 1700|      0|    read_config_store(type, fileold);
 1701|      0|}
snmp_clean_persistent:
 1723|     66|{
 1724|     66|    char            file[512];
 1725|     66|    struct stat     statbuf;
 1726|     66|    int             j;
 1727|       |
 1728|     66|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1728:9): [True: 66, False: 0]
  ------------------
 1729|     66|                               NETSNMP_DS_LIB_DONT_PERSIST_STATE)
  ------------------
  |  |   92|     66|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
 1730|      0|     || netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1730:9): [True: 0, False: 0]
  ------------------
 1731|     66|                               NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE)) return;
  ------------------
  |  |   96|      0|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE  36 /* don't save persistent file */
  ------------------
 1732|       |
 1733|      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]
  |  |  ------------------
  ------------------
 1734|      0|    snprintf(file, sizeof(file),
 1735|      0|             "%s/%s.conf", get_persistent_directory(), type);
 1736|      0|    if (stat(file, &statbuf) == 0) {
  ------------------
  |  Branch (1736:9): [True: 0, False: 0]
  ------------------
 1737|      0|        for (j = 0; j <= NETSNMP_MAX_PERSISTENT_BACKUPS; j++) {
  ------------------
  |  | 2050|      0|#define NETSNMP_MAX_PERSISTENT_BACKUPS 10
  ------------------
  |  Branch (1737:21): [True: 0, False: 0]
  ------------------
 1738|      0|            snprintf(file, sizeof(file),
 1739|      0|                     "%s/%s.%d.conf", get_persistent_directory(), type, j);
 1740|      0|            if (stat(file, &statbuf) == 0) {
  ------------------
  |  Branch (1740:17): [True: 0, False: 0]
  ------------------
 1741|      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]
  |  |  ------------------
  ------------------
 1742|      0|                            " removing old config file: %s\n", file));
 1743|      0|                if (unlink(file) == -1)
  ------------------
  |  Branch (1743:21): [True: 0, False: 0]
  ------------------
 1744|      0|                    snmp_log(LOG_ERR, "Cannot unlink %s\n", file);
 1745|      0|            }
 1746|      0|        }
 1747|      0|    }
 1748|      0|}
skip_white_const:
 1813|    264|{
 1814|    264|    if (ptr == NULL)
  ------------------
  |  Branch (1814:9): [True: 0, False: 264]
  ------------------
 1815|      0|        return (NULL);
 1816|    396|    while (*ptr != 0 && isspace((unsigned char)*ptr))
  ------------------
  |  Branch (1816:12): [True: 264, False: 132]
  |  Branch (1816:25): [True: 132, False: 132]
  ------------------
 1817|    132|        ptr++;
 1818|    264|    if (*ptr == 0 || *ptr == '#')
  ------------------
  |  Branch (1818:9): [True: 132, False: 132]
  |  Branch (1818:22): [True: 0, False: 132]
  ------------------
 1819|    132|        return (NULL);
 1820|    132|    return (ptr);
 1821|    264|}
copy_nword_const:
 1878|    264|{
 1879|    264|    char            quote;
 1880|    264|    if (!from || !to)
  ------------------
  |  Branch (1880:9): [True: 0, False: 264]
  |  Branch (1880:18): [True: 0, False: 264]
  ------------------
 1881|      0|        return NULL;
 1882|    264|    if ((*from == '\"') || (*from == '\'')) {
  ------------------
  |  Branch (1882:9): [True: 0, False: 264]
  |  Branch (1882:28): [True: 0, False: 264]
  ------------------
 1883|      0|        quote = *(from++);
 1884|      0|        while ((*from != quote) && (*from != 0)) {
  ------------------
  |  Branch (1884:16): [True: 0, False: 0]
  |  Branch (1884:36): [True: 0, False: 0]
  ------------------
 1885|      0|            if ((*from == '\\') && (*(from + 1) != 0)) {
  ------------------
  |  Branch (1885:17): [True: 0, False: 0]
  |  Branch (1885:36): [True: 0, False: 0]
  ------------------
 1886|      0|                if (len > 0) {  /* don't copy beyond len bytes */
  ------------------
  |  Branch (1886:21): [True: 0, False: 0]
  ------------------
 1887|      0|                    *to++ = *(from + 1);
 1888|      0|                    if (--len == 0)
  ------------------
  |  Branch (1888:25): [True: 0, False: 0]
  ------------------
 1889|      0|                        *(to - 1) = '\0';       /* null protect the last spot */
 1890|      0|                }
 1891|      0|                from = from + 2;
 1892|      0|            } else {
 1893|      0|                if (len > 0) {  /* don't copy beyond len bytes */
  ------------------
  |  Branch (1893:21): [True: 0, False: 0]
  ------------------
 1894|      0|                    *to++ = *from++;
 1895|      0|                    if (--len == 0)
  ------------------
  |  Branch (1895:25): [True: 0, False: 0]
  ------------------
 1896|      0|                        *(to - 1) = '\0';       /* null protect the last spot */
 1897|      0|                } else
 1898|      0|                    from++;
 1899|      0|            }
 1900|      0|        }
 1901|      0|        if (*from == 0) {
  ------------------
  |  Branch (1901:13): [True: 0, False: 0]
  ------------------
 1902|      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]
  |  |  ------------------
  ------------------
 1903|      0|                        "no end quote found in config string\n"));
 1904|      0|        } else
 1905|      0|            from++;
 1906|    264|    } else {
 1907|  1.18k|        while (*from != 0 && !isspace((unsigned char)(*from))) {
  ------------------
  |  Branch (1907:16): [True: 1.05k, False: 132]
  |  Branch (1907:30): [True: 924, False: 132]
  ------------------
 1908|    924|            if ((*from == '\\') && (*(from + 1) != 0)) {
  ------------------
  |  Branch (1908:17): [True: 0, False: 924]
  |  Branch (1908:36): [True: 0, False: 0]
  ------------------
 1909|      0|                if (len > 0) {  /* don't copy beyond len bytes */
  ------------------
  |  Branch (1909:21): [True: 0, False: 0]
  ------------------
 1910|      0|                    *to++ = *(from + 1);
 1911|      0|                    if (--len == 0)
  ------------------
  |  Branch (1911:25): [True: 0, False: 0]
  ------------------
 1912|      0|                        *(to - 1) = '\0';       /* null protect the last spot */
 1913|      0|                }
 1914|      0|                from = from + 2;
 1915|    924|            } else {
 1916|    924|                if (len > 0) {  /* don't copy beyond len bytes */
  ------------------
  |  Branch (1916:21): [True: 924, False: 0]
  ------------------
 1917|    924|                    *to++ = *from++;
 1918|    924|                    if (--len == 0)
  ------------------
  |  Branch (1918:25): [True: 0, False: 924]
  ------------------
 1919|      0|                        *(to - 1) = '\0';       /* null protect the last spot */
 1920|    924|                } else
 1921|      0|                    from++;
 1922|    924|            }
 1923|    924|        }
 1924|    264|    }
 1925|    264|    if (len > 0)
  ------------------
  |  Branch (1925:9): [True: 264, False: 0]
  ------------------
 1926|    264|        *to = 0;
 1927|    264|    from = skip_white_const(from);
 1928|    264|    return (from);
 1929|    264|}                               /* copy_nword */
read_config_save_octet_string:
 1970|     66|{
 1971|     66|    size_t          i;
 1972|     66|    const u_char   *cp;
 1973|       |
 1974|       |    /*
 1975|       |     * is everything easily printable
 1976|       |     */
 1977|     66|    for (i = 0, cp = str; i < len && cp &&
  ------------------
  |  Branch (1977:27): [True: 66, False: 0]
  |  Branch (1977:38): [True: 66, False: 0]
  ------------------
 1978|     66|         (isalpha(*cp) || isdigit(*cp) || *cp == ' '); cp++, i++);
  ------------------
  |  Branch (1978:11): [True: 0, False: 66]
  |  Branch (1978:27): [True: 0, False: 66]
  |  Branch (1978:43): [True: 0, False: 66]
  ------------------
 1979|       |
 1980|     66|    if (len != 0 && i == len) {
  ------------------
  |  Branch (1980:9): [True: 66, False: 0]
  |  Branch (1980:21): [True: 0, False: 66]
  ------------------
 1981|      0|        *saveto++ = '"';
 1982|      0|        memcpy(saveto, str, len);
 1983|      0|        saveto += len;
 1984|      0|        *saveto++ = '"';
 1985|      0|        *saveto = '\0';
 1986|     66|    } else {
 1987|     66|        if (str != NULL) {
  ------------------
  |  Branch (1987:13): [True: 66, False: 0]
  ------------------
 1988|     66|            sprintf(saveto, "0x");
 1989|     66|            saveto += 2;
 1990|  1.18k|            for (i = 0; i < len; i++) {
  ------------------
  |  Branch (1990:25): [True: 1.12k, False: 66]
  ------------------
 1991|  1.12k|                sprintf(saveto, "%02x", str[i]);
 1992|  1.12k|                saveto = saveto + 2;
 1993|  1.12k|            }
 1994|     66|        } else {
 1995|      0|            sprintf(saveto, "\"\"");
 1996|      0|            saveto += 2;
 1997|      0|        }
 1998|     66|    }
 1999|     66|    return saveto;
 2000|     66|}
read_config.c:internal_register_config_handler:
  153|  6.79k|{
  154|  6.79k|    struct config_files **ctmp = &config_files;
  155|  6.79k|    struct config_line  **ltmp;
  156|  6.79k|    const char           *type = type_param;
  157|       |
  158|  6.79k|    if (type == NULL || *type == '\0') {
  ------------------
  |  Branch (158:9): [True: 132, False: 6.66k]
  |  Branch (158:25): [True: 132, False: 6.53k]
  ------------------
  159|    264|        type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|    264|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  160|    264|				     NETSNMP_DS_LIB_APPTYPE);
  ------------------
  |  |  157|    264|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
  161|    264|    }
  162|       |
  163|       |    /*
  164|       |     * Handle multiple types (recursively)
  165|       |     */
  166|  6.79k|    if (strchr(type, ':')) {
  ------------------
  |  Branch (166:9): [True: 132, False: 6.66k]
  ------------------
  167|    132|        struct config_line *ltmp2 = NULL;
  168|    132|        char                buf[STRINGMAX];
  169|    132|        char               *cptr = buf;
  170|       |
  171|    132|        strlcpy(buf, type, STRINGMAX);
  ------------------
  |  |   12|    132|#define STRINGMAX 1024
  ------------------
  172|    396|        while (cptr) {
  ------------------
  |  Branch (172:16): [True: 264, False: 132]
  ------------------
  173|    264|            char* c = cptr;
  174|    264|            cptr = strchr(cptr, ':');
  175|    264|            if(cptr) {
  ------------------
  |  Branch (175:16): [True: 132, False: 132]
  ------------------
  176|    132|                *cptr = '\0';
  177|    132|                ++cptr;
  178|    132|            }
  179|    264|            ltmp2 = internal_register_config_handler(c, token, parser1, parser2,
  180|    264|                                                     releaser, help, when);
  181|    264|        }
  182|    132|        return ltmp2;
  183|    132|    }
  184|       |    
  185|       |    /*
  186|       |     * Find type in current list  -OR-  create a new file type.
  187|       |     */
  188|  7.78k|    while (*ctmp != NULL && strcmp((*ctmp)->fileHeader, type)) {
  ------------------
  |  Branch (188:12): [True: 7.65k, False: 132]
  |  Branch (188:29): [True: 1.12k, False: 6.53k]
  ------------------
  189|  1.12k|        ctmp = &((*ctmp)->next);
  190|  1.12k|    }
  191|       |
  192|  6.66k|    if (*ctmp == NULL) {
  ------------------
  |  Branch (192:9): [True: 132, False: 6.53k]
  ------------------
  193|    132|        *ctmp = (struct config_files *)
  194|    132|            calloc(1, sizeof(struct config_files));
  195|    132|        if (!*ctmp) {
  ------------------
  |  Branch (195:13): [True: 0, False: 132]
  ------------------
  196|      0|            return NULL;
  197|      0|        }
  198|       |
  199|    132|        (*ctmp)->fileHeader = strdup(type);
  200|    132|        if (!(*ctmp)->fileHeader) {
  ------------------
  |  Branch (200:13): [True: 0, False: 132]
  ------------------
  201|      0|            free(*ctmp);
  202|      0|            *ctmp = NULL;
  203|      0|            return NULL;
  204|      0|        }
  205|    132|        DEBUGMSGTL(("9:read_config:type", "new type %s\n", type));
  ------------------
  |  |   66|    132|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    132|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 132]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 132]
  |  |  ------------------
  ------------------
  206|    132|    }
  207|       |
  208|  6.66k|    DEBUGMSGTL(("9:read_config:register_handler", "registering %s %s\n",
  ------------------
  |  |   66|  6.66k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  6.66k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 6.66k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 6.66k]
  |  |  ------------------
  ------------------
  209|  6.66k|                type, token));
  210|       |    /*
  211|       |     * Find parser type in current list  -OR-  create a new
  212|       |     * line parser entry.
  213|       |     */
  214|  6.66k|    ltmp = &((*ctmp)->start);
  215|       |
  216|   245k|    while (*ltmp != NULL && strcmp((*ltmp)->config_token, token)) {
  ------------------
  |  Branch (216:12): [True: 239k, False: 6.66k]
  |  Branch (216:29): [True: 239k, False: 0]
  ------------------
  217|   239k|        ltmp = &((*ltmp)->next);
  218|   239k|    }
  219|       |
  220|  6.66k|    if (*ltmp == NULL) {
  ------------------
  |  Branch (220:9): [True: 6.66k, False: 0]
  ------------------
  221|  6.66k|        *ltmp = (struct config_line *)
  222|  6.66k|            calloc(1, sizeof(struct config_line));
  223|  6.66k|        if (!*ltmp) {
  ------------------
  |  Branch (223:13): [True: 0, False: 6.66k]
  ------------------
  224|      0|            return NULL;
  225|      0|        }
  226|       |
  227|  6.66k|        (*ltmp)->config_time = when;
  228|  6.66k|        (*ltmp)->config_token = strdup(token);
  229|  6.66k|        if (!(*ltmp)->config_token) {
  ------------------
  |  Branch (229:13): [True: 0, False: 6.66k]
  ------------------
  230|      0|            free(*ltmp);
  231|      0|            *ltmp = NULL;
  232|      0|            return NULL;
  233|      0|        }
  234|       |
  235|  6.66k|        if (help != NULL)
  ------------------
  |  Branch (235:13): [True: 5.87k, False: 792]
  ------------------
  236|  5.87k|            (*ltmp)->help = strdup(help);
  237|  6.66k|    }
  238|       |
  239|       |    /*
  240|       |     * Add/Replace the parse/free functions for the given line type
  241|       |     * in the given file type.
  242|       |     */
  243|  6.66k|    (*ltmp)->parse_line1 = parser1;
  244|  6.66k|    (*ltmp)->parse_line2 = parser2;
  245|  6.66k|    (*ltmp)->free_func = releaser;
  246|       |
  247|  6.66k|    return (*ltmp);
  248|       |
  249|  6.66k|}                               /* end register_config_handler() */

sc_find_auth_alg_byoid:
  270|    169|{
  271|    169|    int i = 0;
  272|       |
  273|    169|    DEBUGTRACE;
  ------------------
  |  |   63|    169|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    169|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 169]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 169]
  |  |  ------------------
  ------------------
  274|       |
  275|    169|    if ((NULL == authoid) || (0 == len))
  ------------------
  |  Branch (275:9): [True: 0, False: 169]
  |  Branch (275:30): [True: 0, False: 169]
  ------------------
  276|      0|        return NULL;
  277|       |
  278|    507|    for( ; _auth_alg_info[i].type != -1; ++i) {
  ------------------
  |  Branch (278:12): [True: 507, False: 0]
  ------------------
  279|    507|        if (len != _auth_alg_info[i].oid_len)
  ------------------
  |  Branch (279:13): [True: 0, False: 507]
  ------------------
  280|      0|            continue;
  281|    507|        if (snmp_oid_compare(_auth_alg_info[i].alg_oid,
  ------------------
  |  Branch (281:13): [True: 169, False: 338]
  ------------------
  282|    507|                             _auth_alg_info[i].oid_len,
  283|    507|                             authoid, len) == 0 )
  284|    169|            return(&_auth_alg_info[i]);
  285|    507|    }
  286|       |
  287|       |/*    DEBUGMSGTL(("scapi", "No auth alg found for"));
  288|       |      DEBUGMSGOID(("scapi", authoid, len ));*/
  289|       |
  290|      0|    return NULL;
  291|    169|}
sc_find_auth_alg_bytype:
  317|    169|{
  318|    169|    int i = 0;
  319|       |
  320|    169|    DEBUGTRACE;
  ------------------
  |  |   63|    169|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    169|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 169]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 169]
  |  |  ------------------
  ------------------
  321|       |
  322|    507|    for( ; _auth_alg_info[i].type != -1; ++i) {
  ------------------
  |  Branch (322:12): [True: 507, False: 0]
  ------------------
  323|    507|        if (type != _auth_alg_info[i].type)
  ------------------
  |  Branch (323:13): [True: 338, False: 169]
  ------------------
  324|    338|            continue;
  325|    169|        return(&_auth_alg_info[i]);
  326|    507|    }
  327|       |
  328|      0|    return NULL;
  329|    169|}
sc_get_authtype:
  342|    169|{
  343|    169|    const netsnmp_auth_alg_info *aai;
  344|       |
  345|    169|    DEBUGTRACE;
  ------------------
  |  |   63|    169|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    169|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 169]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 169]
  |  |  ------------------
  ------------------
  346|       |
  347|    169|    aai = sc_find_auth_alg_byoid(hashtype, hashtype_len);
  348|    169|    if (NULL == aai)
  ------------------
  |  Branch (348:9): [True: 0, False: 169]
  ------------------
  349|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  350|       |
  351|    169|    return aai->type;
  352|    169|}
sc_get_proper_auth_length_bytype:
  399|    169|{
  400|    169|    const netsnmp_auth_alg_info *aai;
  401|       |
  402|    169|    DEBUGTRACE;
  ------------------
  |  |   63|    169|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    169|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 169]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 169]
  |  |  ------------------
  ------------------
  403|       |
  404|    169|    aai = sc_find_auth_alg_bytype(hashtype);
  405|    169|    if (NULL == aai)
  ------------------
  |  Branch (405:9): [True: 0, False: 169]
  ------------------
  406|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  407|       |
  408|    169|    return aai->proper_length;
  409|    169|}
sc_init:
  571|     66|{
  572|     66|    int             rval = SNMPERR_SUCCESS;
  ------------------
  |  |  184|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  573|       |
  574|     66|#if defined(NETSNMP_USE_OPENSSL)
  575|     66|#if defined(HAVE_OPENSSL_PROVIDER_H)
  576|     66|    if (!sc_initialized) {
  ------------------
  |  Branch (576:9): [True: 66, False: 0]
  ------------------
  577|     66|        sc_initialized = 1;
  578|     66|        legacy_provider = OSSL_PROVIDER_load(NULL, "legacy");
  579|     66|        if (legacy_provider == NULL)
  ------------------
  |  Branch (579:13): [True: 0, False: 66]
  ------------------
  580|      0|            snmp_log(LOG_WARNING, "Failed to load OpenSSL legacy provider\n");
  581|     66|        default_provider = OSSL_PROVIDER_load(NULL, "default");
  582|     66|        if (default_provider == NULL)
  ------------------
  |  Branch (582:13): [True: 0, False: 66]
  ------------------
  583|      0|            snmp_log(LOG_WARNING, "Failed to load OpenSSL default provider\n");
  584|     66|        snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
  585|     66|                               SNMP_CALLBACK_SHUTDOWN,
  ------------------
  |  |   26|     66|#define SNMP_CALLBACK_SHUTDOWN		        2
  ------------------
  586|     66|                               sc_shutdown, NULL);
  587|     66|    }
  588|     66|#endif
  589|       |#else /* !NETSNMP_USE_OPENSSL */
  590|       |#if defined(NETSNMP_USE_INTERNAL_MD5) || defined(NETSNMP_USE_INTERNAL_CRYPTO)
  591|       |    struct timeval  tv;
  592|       |
  593|       |    DEBUGTRACE;
  594|       |
  595|       |    gettimeofday(&tv, (struct timezone *) 0);
  596|       |
  597|       |    netsnmp_srandom((unsigned)(tv.tv_sec ^ tv.tv_usec));
  598|       |#elif defined(NETSNMP_USE_PKCS11)
  599|       |    DEBUGTRACE;
  600|       |    rval = pkcs_init();
  601|       |#else
  602|       |    rval = SNMPERR_SC_NOT_CONFIGURED;
  603|       |#endif                           /* NETSNMP_USE_INTERNAL_MD5 */
  604|       |    /*
  605|       |     * XXX ogud: The only reason to do anything here with openssl is to 
  606|       |     * * XXX ogud: seed random number generator 
  607|       |     */
  608|       |#endif                          /* NETSNMP_USE_OPENSSL */
  609|       |
  610|     66|    return rval;
  611|     66|}                               /* end sc_init() */
sc_random:
  626|    198|{
  627|    198|    int             rval = SNMPERR_SUCCESS;
  ------------------
  |  |  184|    198|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  628|       |#if !defined(NETSNMP_USE_OPENSSL) && !defined(NETSNMP_USE_PKCS11)
  629|       |    int             i;
  630|       |    int             rndval;
  631|       |    u_char         *ucp = buf;
  632|       |#endif
  633|       |
  634|    198|    DEBUGTRACE;
  ------------------
  |  |   63|    198|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    198|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 198]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 198]
  |  |  ------------------
  ------------------
  635|       |
  636|    198|#ifdef NETSNMP_USE_OPENSSL
  637|    198|    if (RAND_bytes(buf, *buflen) != 1)
  ------------------
  |  Branch (637:9): [True: 0, False: 198]
  ------------------
  638|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  639|    198|    MAKE_MEM_DEFINED(buf, *buflen);
  ------------------
  |  |    8|    198|#define MAKE_MEM_DEFINED(ptr, len) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (8:50): [Folded, False: 198]
  |  |  ------------------
  ------------------
  640|       |#elif defined(NETSNMP_USE_PKCS11)  /* NETSNMP_USE_PKCS11 */
  641|       |    rval = pkcs_random(buf, *buflen);
  642|       |#else                           /* NETSNMP_USE_INTERNAL_MD5 */
  643|       |    /*
  644|       |     * fill the buffer with random integers.  Note that random()
  645|       |     * is defined in config.h and may not be truly the random()
  646|       |     * system call if something better existed 
  647|       |     */
  648|       |    rval = *buflen - *buflen % sizeof(rndval);
  649|       |    for (i = 0; i < rval; i += sizeof(rndval)) {
  650|       |        rndval = netsnmp_random();
  651|       |        memcpy(ucp, &rndval, sizeof(rndval));
  652|       |        ucp += sizeof(rndval);
  653|       |    }
  654|       |
  655|       |    rndval = netsnmp_random();
  656|       |    memcpy(ucp, &rndval, *buflen % sizeof(rndval));
  657|       |
  658|       |    rval = SNMPERR_SUCCESS;
  659|       |#endif                          /* NETSNMP_USE_OPENSSL */
  660|    198|    return rval;
  661|       |
  662|    198|}                               /* end sc_random() */
sc_get_openssl_hashfn:
  672|    169|{
  673|    169|    const EVP_MD   *hashfn = NULL;
  674|       |
  675|    169|    DEBUGTRACE;
  ------------------
  |  |   63|    169|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    169|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 169]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 169]
  |  |  ------------------
  ------------------
  676|       |
  677|    169|    switch (auth_type) {
  ------------------
  |  Branch (677:13): [True: 169, False: 0]
  ------------------
  678|      0|#ifndef NETSNMP_DISABLE_MD5
  679|    169|        case NETSNMP_USMAUTH_HMACMD5:
  ------------------
  |  |   21|    169|#define NETSNMP_USMAUTH_HMACMD5           2
  ------------------
  |  Branch (679:9): [True: 169, False: 0]
  ------------------
  680|    169|            hashfn = (const EVP_MD *) EVP_md5();
  681|    169|            break;
  682|      0|#endif
  683|      0|        case NETSNMP_USMAUTH_HMACSHA1:
  ------------------
  |  |   22|      0|#define NETSNMP_USMAUTH_HMACSHA1          3
  ------------------
  |  Branch (683:9): [True: 0, False: 169]
  ------------------
  684|      0|            hashfn = (const EVP_MD *) EVP_sha1();
  685|      0|            break;
  686|       |
  687|      0|#ifdef HAVE_EVP_SHA224
  688|      0|        case NETSNMP_USMAUTH_HMAC128SHA224:
  ------------------
  |  |   24|      0|#define NETSNMP_USMAUTH_HMAC128SHA224     4 /* RFC 7860; OPTIONAL */
  ------------------
  |  Branch (688:9): [True: 0, False: 169]
  ------------------
  689|      0|            hashfn = (const EVP_MD *) EVP_sha224();
  690|      0|            break;
  691|       |
  692|      0|        case NETSNMP_USMAUTH_HMAC192SHA256:
  ------------------
  |  |   25|      0|#define NETSNMP_USMAUTH_HMAC192SHA256     5 /* RFC 7860; MUST */
  ------------------
  |  Branch (692:9): [True: 0, False: 169]
  ------------------
  693|      0|            hashfn = (const EVP_MD *) EVP_sha256();
  694|      0|            break;
  695|      0|#endif /* HAVE_EVP_SHA224 */
  696|       |
  697|      0|#ifdef HAVE_EVP_SHA384
  698|      0|        case NETSNMP_USMAUTH_HMAC256SHA384:
  ------------------
  |  |   26|      0|#define NETSNMP_USMAUTH_HMAC256SHA384     6 /* RFC 7860; OPTIONAL */
  ------------------
  |  Branch (698:9): [True: 0, False: 169]
  ------------------
  699|      0|            hashfn = (const EVP_MD *) EVP_sha384();
  700|      0|            break;
  701|       |
  702|      0|        case NETSNMP_USMAUTH_HMAC384SHA512:
  ------------------
  |  |   27|      0|#define NETSNMP_USMAUTH_HMAC384SHA512     7 /* RFC 7860; SHOULD */
  ------------------
  |  Branch (702:9): [True: 0, False: 169]
  ------------------
  703|      0|            hashfn = (const EVP_MD *) EVP_sha512();
  704|      0|            break;
  705|    169|#endif /* HAVE_EVP_SHA384 */
  706|    169|    }
  707|       |
  708|    169|    return hashfn;
  709|    169|}
sc_hash:
  932|    169|{
  933|    169|    int auth_type;
  934|       |
  935|    169|    DEBUGTRACE;
  ------------------
  |  |   63|    169|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    169|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 169]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 169]
  |  |  ------------------
  ------------------
  936|       |
  937|    169|    if (hashtype == NULL)
  ------------------
  |  Branch (937:9): [True: 0, False: 169]
  ------------------
  938|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  939|       |
  940|    169|    auth_type = sc_get_authtype(hashtype, hashtypelen);
  941|    169|    if (auth_type < 0 )
  ------------------
  |  Branch (941:9): [True: 0, False: 169]
  ------------------
  942|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  943|       |
  944|    169|    return sc_hash_type(auth_type, buf, buf_len, MAC, MAC_len);
  945|    169|}
sc_hash_type:
  971|    169|{
  972|    169|#if defined(NETSNMP_USE_OPENSSL) || defined(NETSNMP_USE_PKCS11) || defined(NETSNMP_USE_INTERNAL_CRYPTO)
  973|    169|    int            rval = SNMPERR_SUCCESS;
  ------------------
  |  |  184|    169|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  974|    169|#endif
  975|    169|#if defined(NETSNMP_USE_OPENSSL) || defined(NETSNMP_USE_PKCS11)
  976|    169|    unsigned int   tmp_len;
  977|    169|#endif
  978|    169|    int            ret;
  979|       |
  980|    169|#ifdef NETSNMP_USE_OPENSSL
  981|    169|    const EVP_MD   *hashfn;
  982|    169|    EVP_MD_CTX     *cptr;
  983|    169|#endif
  984|       |#ifdef NETSNMP_USE_INTERNAL_CRYPTO
  985|       |    MD5_CTX        cmd5;
  986|       |    SHA_CTX        csha1;
  987|       |#endif
  988|    169|    DEBUGTRACE;
  ------------------
  |  |   63|    169|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    169|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 169]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 169]
  |  |  ------------------
  ------------------
  989|       |
  990|    169|    if (buf == NULL || buf_len <= 0 || MAC == NULL || MAC_len == NULL )
  ------------------
  |  Branch (990:9): [True: 0, False: 169]
  |  Branch (990:24): [True: 0, False: 169]
  |  Branch (990:40): [True: 0, False: 169]
  |  Branch (990:55): [True: 0, False: 169]
  ------------------
  991|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  992|       |
  993|    169|    ret = sc_get_proper_auth_length_bytype(auth_type);
  994|    169|    if (( ret < 0 ) || (*MAC_len < (size_t)ret ))
  ------------------
  |  Branch (994:9): [True: 0, False: 169]
  |  Branch (994:24): [True: 0, False: 169]
  ------------------
  995|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  996|       |
  997|    169|#ifdef NETSNMP_USE_OPENSSL
  998|       |    /*
  999|       |     * Determine transform type.
 1000|       |     */
 1001|    169|    hashfn = sc_get_openssl_hashfn(auth_type);
 1002|    169|    if (NULL == hashfn)
  ------------------
  |  Branch (1002:9): [True: 0, False: 169]
  ------------------
 1003|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1004|       |
 1005|       |/** initialize the pointer */
 1006|    169|#if defined(HAVE_EVP_MD_CTX_NEW)
 1007|    169|    cptr = EVP_MD_CTX_new();
 1008|       |#elif defined(HAVE_EVP_MD_CTX_CREATE)
 1009|       |    cptr = EVP_MD_CTX_create();
 1010|       |#else
 1011|       |    cptr = malloc(sizeof(*cptr));
 1012|       |#if defined(OLD_DES)
 1013|       |    if (cptr)
 1014|       |        memset(cptr, 0, sizeof(*cptr));
 1015|       |#else
 1016|       |    if (cptr)
 1017|       |        EVP_MD_CTX_init(cptr);
 1018|       |#endif
 1019|       |#endif
 1020|    169|    if (!cptr)
  ------------------
  |  Branch (1020:9): [True: 0, False: 169]
  ------------------
 1021|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1022|    169|    if (!EVP_DigestInit(cptr, hashfn)) {
  ------------------
  |  Branch (1022:9): [True: 0, False: 169]
  ------------------
 1023|       |        /* requested hash function is not available */
 1024|      0|        rval = SNMPERR_SC_NOT_CONFIGURED;
  ------------------
  |  |  223|      0|#define SNMPERR_SC_NOT_CONFIGURED	(-39)
  ------------------
 1025|      0|        goto sc_hash_type_quit;
 1026|      0|    }
 1027|       |
 1028|       |/** pass the data and do the final pass */
 1029|    169|    if (!EVP_DigestUpdate(cptr, buf, buf_len) ||
  ------------------
  |  Branch (1029:9): [True: 0, False: 169]
  ------------------
 1030|    169|        !EVP_DigestFinal(cptr, MAC, &tmp_len)) {
  ------------------
  |  Branch (1030:9): [True: 0, False: 169]
  ------------------
 1031|      0|        rval = SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1032|      0|        goto sc_hash_type_quit;
 1033|      0|    }
 1034|    169|    *MAC_len = tmp_len;
 1035|       |
 1036|    169|sc_hash_type_quit:
 1037|    169|#if defined(HAVE_EVP_MD_CTX_FREE)
 1038|    169|    EVP_MD_CTX_free(cptr);
 1039|       |#elif defined(HAVE_EVP_MD_CTX_DESTROY)
 1040|       |    EVP_MD_CTX_destroy(cptr);
 1041|       |#else
 1042|       |#if !defined(OLD_DES)
 1043|       |    EVP_MD_CTX_cleanup(cptr);
 1044|       |#endif
 1045|       |    free(cptr);
 1046|       |#endif
 1047|    169|    return (rval);
 1048|       |
 1049|       |#elif defined(NETSNMP_USE_INTERNAL_CRYPTO)
 1050|       |#ifndef NETSNMP_DISABLE_MD5
 1051|       |    if (NETSNMP_USMAUTH_HMACMD5 == auth_type) {
 1052|       |        if (*MAC_len < MD5_DIGEST_LENGTH)
 1053|       |            return (SNMPERR_GENERR);      /* the buffer isn't big enough */
 1054|       |        MD5_Init(&cmd5);
 1055|       |        ret = !MD5_Update(&cmd5, buf, buf_len);
 1056|       |        if (ret != 0)
 1057|       |            return SNMPERR_GENERR;
 1058|       |        MD5_Final(MAC, &cmd5);
 1059|       |        *MAC_len = MD5_DIGEST_LENGTH;
 1060|       |    } else 
 1061|       |#endif
 1062|       |    if (NETSNMP_USMAUTH_HMACSHA1 == auth_type) {
 1063|       |        if (*MAC_len < SHA_DIGEST_LENGTH)
 1064|       |            return (SNMPERR_GENERR);      /* the buffer isn't big enough */
 1065|       |        SHA1_Init(&csha1);
 1066|       |        ret = !SHA1_Update(&csha1, buf, buf_len);
 1067|       |        if (ret != 0)
 1068|       |            return SNMPERR_GENERR;
 1069|       |        SHA1_Final(MAC, &csha1);
 1070|       |        *MAC_len = SHA_DIGEST_LENGTH;
 1071|       |            
 1072|       |    } else {
 1073|       |        return (SNMPERR_GENERR);
 1074|       |    }
 1075|       |    return (rval);
 1076|       |#elif defined(NETSNMP_USE_PKCS11)        /* NETSNMP_USE_PKCS11 */
 1077|       |
 1078|       |#ifndef NETSNMP_DISABLE_MD5
 1079|       |    if (NETSNMP_USMAUTH_HMACMD5 == auth_type) {
 1080|       |        rval = pkcs_digest(CKM_MD5, buf, buf_len, MAC, &tmp_len);
 1081|       |        *MAC_len = tmp_len;
 1082|       |    } else
 1083|       |#endif
 1084|       |    if (NETSNMP_USMAUTH_HMACSHA1 == auth_type) {
 1085|       |       rval = pkcs_digest(CKM_SHA_1, buf, buf_len, MAC, &tmp_len);
 1086|       |        *MAC_len = tmp_len;
 1087|       |    } else {
 1088|       |        return (SNMPERR_GENERR);
 1089|       |    }
 1090|       |
 1091|       |     return (rval);
 1092|       |
 1093|       |#else                           /* NETSNMP_USE_INTERNAL_MD5 */
 1094|       |
 1095|       |    if (MDchecksum(buf, buf_len, MAC, *MAC_len)) {
 1096|       |        return SNMPERR_GENERR;
 1097|       |    }
 1098|       |    if (*MAC_len > 16)
 1099|       |        *MAC_len = 16;
 1100|       |    return SNMPERR_SUCCESS;
 1101|       |
 1102|       |#endif                          /* NETSNMP_USE_OPENSSL */
 1103|    169|}
sc_check_keyed_hash:
 1136|      6|{
 1137|      6|    int             rval = SNMPERR_SUCCESS, auth_type, auth_size;
  ------------------
  |  |  184|      6|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1138|      6|    size_t          buf_len = SNMP_MAXBUF_SMALL;
  ------------------
  |  |   45|      6|#define SNMP_MAXBUF_SMALL	512
  ------------------
 1139|       |
 1140|      6|    u_char          buf[SNMP_MAXBUF_SMALL];
 1141|       |
 1142|      6|    DEBUGTRACE;
  ------------------
  |  |   63|      6|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      6|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 6]
  |  |  ------------------
  ------------------
 1143|       |
 1144|       |#ifdef NETSNMP_ENABLE_TESTING_CODE
 1145|       |    {
 1146|       |        int             i;
 1147|       |        DEBUGMSG(("scapi", "sc_check_keyed_hash():    key=0x"));
 1148|       |        for (i = 0; i < keylen; i++)
 1149|       |            DEBUGMSG(("scapi", "%02x", key[i] & 0xff));
 1150|       |        DEBUGMSG(("scapi", " (%d)\n", keylen));
 1151|       |    }
 1152|       |#endif                          /* NETSNMP_ENABLE_TESTING_CODE */
 1153|       |
 1154|       |    /*
 1155|       |     * Sanity check.
 1156|       |     */
 1157|      6|    if (!authtypeOID || !key || !message || !MAC
  ------------------
  |  Branch (1157:9): [True: 0, False: 6]
  |  Branch (1157:25): [True: 6, False: 0]
  |  Branch (1157:33): [True: 0, False: 0]
  |  Branch (1157:45): [True: 0, False: 0]
  ------------------
 1158|      6|        || (keylen <= 0) || (msglen <= 0) || (maclen <= 0)) {
  ------------------
  |  Branch (1158:12): [True: 0, False: 0]
  |  Branch (1158:29): [True: 0, False: 0]
  |  Branch (1158:46): [True: 0, False: 0]
  ------------------
 1159|      6|        QUITFUN(SNMPERR_GENERR, sc_check_keyed_hash_quit);
  ------------------
  |  |  121|      6|#define QUITFUN(e, l) do {                              \
  |  |  122|      6|	if (e != SNMPERR_SUCCESS) {			\
  |  |  ------------------
  |  |  |  |  184|     12|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (122:6): [True: 6, Folded]
  |  |  ------------------
  |  |  123|      6|		rval = SNMPERR_SC_GENERAL_FAILURE;	\
  |  |  ------------------
  |  |  |  |  222|      6|#define SNMPERR_SC_GENERAL_FAILURE	(-38)
  |  |  ------------------
  |  |  124|      6|		goto l ;				\
  |  |  125|      6|        }                                               \
  |  |  126|      6|    } while (0)
  |  |  ------------------
  |  |  |  Branch (126:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1160|      6|    }
 1161|       |
 1162|      0|    auth_type = sc_get_authtype(authtypeOID, authtypeOIDlen);
 1163|      0|    if (auth_type < 0 )
  ------------------
  |  Branch (1163:9): [True: 0, False: 0]
  ------------------
 1164|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1165|       |
 1166|      0|    auth_size = sc_get_auth_maclen(auth_type);
 1167|      0|    if (0 == auth_size || maclen != auth_size) {
  ------------------
  |  Branch (1167:9): [True: 0, False: 0]
  |  Branch (1167:27): [True: 0, False: 0]
  ------------------
 1168|      0|        QUITFUN(SNMPERR_GENERR, sc_check_keyed_hash_quit);
  ------------------
  |  |  121|      0|#define QUITFUN(e, l) do {                              \
  |  |  122|      0|	if (e != SNMPERR_SUCCESS) {			\
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (122:6): [True: 0, Folded]
  |  |  ------------------
  |  |  123|      0|		rval = SNMPERR_SC_GENERAL_FAILURE;	\
  |  |  ------------------
  |  |  |  |  222|      0|#define SNMPERR_SC_GENERAL_FAILURE	(-38)
  |  |  ------------------
  |  |  124|      0|		goto l ;				\
  |  |  125|      0|        }                                               \
  |  |  126|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (126:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1169|      0|    }
 1170|       |
 1171|       |    /*
 1172|       |     * Generate a full hash of the message, then compare
 1173|       |     * the result with the given MAC which may be shorter than
 1174|       |     * the full hash length.
 1175|       |     */
 1176|      0|    rval = sc_generate_keyed_hash(authtypeOID, authtypeOIDlen, key, keylen,
 1177|      0|                                  message, msglen, buf, &buf_len);
 1178|      0|    QUITFUN(rval, sc_check_keyed_hash_quit);
  ------------------
  |  |  121|      0|#define QUITFUN(e, l) do {                              \
  |  |  122|      0|	if (e != SNMPERR_SUCCESS) {			\
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (122:6): [True: 0, False: 0]
  |  |  ------------------
  |  |  123|      0|		rval = SNMPERR_SC_GENERAL_FAILURE;	\
  |  |  ------------------
  |  |  |  |  222|      0|#define SNMPERR_SC_GENERAL_FAILURE	(-38)
  |  |  ------------------
  |  |  124|      0|		goto l ;				\
  |  |  125|      0|        }                                               \
  |  |  126|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (126:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1179|       |
 1180|      0|    if (maclen > msglen) {
  ------------------
  |  Branch (1180:9): [True: 0, False: 0]
  ------------------
 1181|      0|        QUITFUN(SNMPERR_GENERR, sc_check_keyed_hash_quit);
  ------------------
  |  |  121|      0|#define QUITFUN(e, l) do {                              \
  |  |  122|      0|	if (e != SNMPERR_SUCCESS) {			\
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (122:6): [True: 0, Folded]
  |  |  ------------------
  |  |  123|      0|		rval = SNMPERR_SC_GENERAL_FAILURE;	\
  |  |  ------------------
  |  |  |  |  222|      0|#define SNMPERR_SC_GENERAL_FAILURE	(-38)
  |  |  ------------------
  |  |  124|      0|		goto l ;				\
  |  |  125|      0|        }                                               \
  |  |  126|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (126:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1182|       |
 1183|      0|    } else if (memcmp(buf, MAC, maclen) != 0) {
  ------------------
  |  Branch (1183:16): [True: 0, False: 0]
  ------------------
 1184|      0|        QUITFUN(SNMPERR_GENERR, sc_check_keyed_hash_quit);
  ------------------
  |  |  121|      0|#define QUITFUN(e, l) do {                              \
  |  |  122|      0|	if (e != SNMPERR_SUCCESS) {			\
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (122:6): [True: 0, Folded]
  |  |  ------------------
  |  |  123|      0|		rval = SNMPERR_SC_GENERAL_FAILURE;	\
  |  |  ------------------
  |  |  |  |  222|      0|#define SNMPERR_SC_GENERAL_FAILURE	(-38)
  |  |  ------------------
  |  |  124|      0|		goto l ;				\
  |  |  125|      0|        }                                               \
  |  |  126|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (126:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1185|      0|    }
 1186|       |
 1187|       |
 1188|      6|  sc_check_keyed_hash_quit:
 1189|      6|    memset(buf, 0, SNMP_MAXBUF_SMALL);
  ------------------
  |  |   45|      6|#define SNMP_MAXBUF_SMALL	512
  ------------------
 1190|       |
 1191|      6|    return rval;
 1192|       |
 1193|      0|}                               /* end sc_check_keyed_hash() */
scapi.c:sc_shutdown:
  549|     66|{
  550|     66|    if (legacy_provider) {
  ------------------
  |  Branch (550:9): [True: 66, False: 0]
  ------------------
  551|     66|        OSSL_PROVIDER_unload(legacy_provider);
  552|     66|        legacy_provider = NULL;
  553|     66|    }
  554|     66|    if (default_provider) {
  ------------------
  |  Branch (554:9): [True: 66, False: 0]
  ------------------
  555|     66|        OSSL_PROVIDER_unload(default_provider);
  556|     66|        default_provider = NULL;
  557|     66|    }
  558|     66|    sc_initialized = 0;
  559|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  560|     66|}

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

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

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

netsnmp_max_send_msg_size:
  373|    135|{
  374|    135|    u_int max = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    135|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  375|    135|                                   NETSNMP_DS_LIB_MSG_SEND_MAX);
  ------------------
  |  |  132|    135|#define NETSNMP_DS_LIB_MSG_SEND_MAX        16 /* global max response size */
  ------------------
  376|    135|    if (0 == max)
  ------------------
  |  Branch (376:9): [True: 135, False: 0]
  ------------------
  377|    135|        max = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|    135|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  378|      0|    else if (max < SNMP_MIN_MAX_LEN)
  ------------------
  |  |   48|      0|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (378:14): [True: 0, False: 0]
  ------------------
  379|      0|        max = SNMP_MIN_MAX_LEN; /* minimum max size per SNMP specs */
  ------------------
  |  |   48|      0|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  380|      0|    else if (max > SNMP_MAX_PACKET_LEN)
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (380:14): [True: 0, False: 0]
  ------------------
  381|      0|        max = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  382|       |
  383|    135|    return max;
  384|    135|}
snmp_get_next_sessid:
  477|     66|{
  478|     66|    long            retVal;
  479|     66|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSIONID);
  ------------------
  |  |   79|     66|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 66]
  |  |  ------------------
  ------------------
  480|     66|    retVal = 1 + Sessid;        /*MTCRITICAL_RESOURCE */
  481|     66|    if (!retVal)
  ------------------
  |  Branch (481:9): [True: 0, False: 66]
  ------------------
  482|      0|        retVal = 2;
  483|     66|    Sessid = retVal;
  484|     66|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   91|     66|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  |  Branch (484:9): [True: 0, False: 66]
  ------------------
  485|      0|        retVal &= 0x7fff;	/* mask to 15 bits */
  486|     66|    else
  487|     66|        retVal &= 0x7fffffff;	/* mask to 31 bits */
  488|       |
  489|     66|    if (!retVal) {
  ------------------
  |  Branch (489:9): [True: 0, False: 66]
  ------------------
  490|      0|        Sessid = retVal = 2;
  491|      0|    }
  492|     66|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSIONID);
  ------------------
  |  |   80|     66|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 66]
  |  |  ------------------
  ------------------
  493|     66|    return retVal;
  494|     66|}
snmp_get_next_transid:
  498|    426|{
  499|    426|    long            retVal;
  500|    426|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   79|    426|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 426]
  |  |  ------------------
  ------------------
  501|    426|    retVal = 1 + Transid;       /*MTCRITICAL_RESOURCE */
  502|    426|    if (!retVal)
  ------------------
  |  Branch (502:9): [True: 0, False: 426]
  ------------------
  503|      0|        retVal = 2;
  504|    426|    Transid = retVal;
  505|    426|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   48|    426|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   91|    426|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  |  Branch (505:9): [True: 0, False: 426]
  ------------------
  506|      0|        retVal &= 0x7fff;	/* mask to 15 bits */
  507|    426|    else
  508|    426|        retVal &= 0x7fffffff;	/* mask to 31 bits */
  509|       |
  510|    426|    if (!retVal) {
  ------------------
  |  Branch (510:9): [True: 0, False: 426]
  ------------------
  511|      0|        Transid = retVal = 2;
  512|      0|    }
  513|    426|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   80|    426|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 426]
  |  |  ------------------
  ------------------
  514|    426|    return retVal;
  515|    426|}
snmp_set_detail:
  529|    820|{
  530|    820|    if (detail_string != NULL) {
  ------------------
  |  Branch (530:9): [True: 820, False: 0]
  ------------------
  531|    820|        strlcpy(snmp_detail, detail_string, sizeof(snmp_detail));
  532|    820|        snmp_detail_f = 1;
  533|    820|    }
  534|    820|}
netsnmp_random:
  652|    198|{
  653|    198|#if defined(HAVE_RANDOM)
  654|       |    /*
  655|       |     * The function random() is a more sophisticated random number generator
  656|       |     * which uses nonlinear feedback and an internal table that is 124 bytes
  657|       |     * (992 bits) long. The function returns random values that are 32 bits in
  658|       |     * length. All of the bits generated by random() are usable. The random()
  659|       |     * function is adequate for simulations and games, but should not be used
  660|       |     * for security related applications such as picking cryptographic keys or
  661|       |     * simulating one-time pads.
  662|       |     */
  663|    198|    return random();
  664|       |#elif defined(HAVE_LRAND48)
  665|       |    /*
  666|       |     * As with random(), lrand48() provides excellent random numbers for
  667|       |     * simulations and games, but should not be used for security-related
  668|       |     * applications such as picking cryptographic keys or simulating one-time
  669|       |     * pads; linear congruential algorithms are too easy to break.
  670|       |     */
  671|       |    return lrand48();
  672|       |#elif defined(HAVE_RAND)
  673|       |    /*
  674|       |     * The original UNIX random number generator, rand(), is not a very good
  675|       |     * random number generator. It uses a 32-bit seed and maintains a 32-bit
  676|       |     * internal state.
  677|       |     */
  678|       |    return rand();
  679|       |#else
  680|       |#error "Neither random(), nor lrand48() nor rand() are available"
  681|       |#endif
  682|    198|}
netsnmp_srandom:
  685|     66|{
  686|     66|#if defined(HAVE_SRANDOM)
  687|     66|    srandom(seed);
  688|       |#elif defined(HAVE_SRAND48)
  689|       |    srand48(seed);
  690|       |#elif defined(HAVE_SRAND)
  691|       |    srand(seed);
  692|       |#else
  693|       |#error "Neither srandom(), nor srand48() nor srand() are available"
  694|       |#endif
  695|     66|}
snmp_sess_init:
  788|     66|{
  789|     66|    _init_snmp();
  790|       |
  791|       |    /*
  792|       |     * initialize session to default values 
  793|       |     */
  794|       |
  795|     66|    memset(session, 0, sizeof(netsnmp_session));
  796|     66|    session->timeout = SNMP_DEFAULT_TIMEOUT;
  ------------------
  |  |   80|     66|#define SNMP_DEFAULT_TIMEOUT	    -1
  ------------------
  797|     66|    session->retries = SNMP_DEFAULT_RETRIES;
  ------------------
  |  |   79|     66|#define SNMP_DEFAULT_RETRIES	    -1
  ------------------
  798|     66|    session->version = SNMP_DEFAULT_VERSION;
  ------------------
  |  |   90|     66|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  799|     66|    session->securityModel = SNMP_DEFAULT_SECMODEL;
  ------------------
  |  |   91|     66|#define SNMP_DEFAULT_SECMODEL	    -1
  ------------------
  800|     66|    session->rcvMsgMaxSize = netsnmp_max_send_msg_size();
  801|     66|    session->sndMsgMaxSize = netsnmp_max_send_msg_size();
  802|     66|    session->flags |= SNMP_FLAGS_DONT_PROBE;
  ------------------
  |  |  155|     66|#define SNMP_FLAGS_DONT_PROBE      0x100      /* don't probe for an engineID */
  ------------------
  803|     66|}
init_snmp:
  892|     66|{
  893|     66|    if (init_snmp_init_done) {
  ------------------
  |  Branch (893:9): [True: 0, False: 66]
  ------------------
  894|      0|        return;
  895|      0|    }
  896|       |
  897|     66|    init_snmp_init_done = 1;
  898|       |
  899|       |    /*
  900|       |     * make the type available everywhere else 
  901|       |     */
  902|     66|    if (type && !netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (902:9): [True: 66, False: 0]
  |  Branch (902:17): [True: 66, False: 0]
  ------------------
  903|     66|				       NETSNMP_DS_LIB_APPTYPE)) {
  ------------------
  |  |  157|     66|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
  904|     66|        netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  905|     66|			      NETSNMP_DS_LIB_APPTYPE, type);
  ------------------
  |  |  157|     66|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
  906|     66|    }
  907|       |
  908|     66|    _init_snmp();
  909|       |
  910|       |    /*
  911|       |     * set our current locale properly to initialize isprint() type functions 
  912|       |     *
  913|       |     * Do not use setlocale on qnx, it is buggy 
  914|       |     * https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.lib_ref/topic/s/setlocale.html
  915|       |     */
  916|     66|#if defined(HAVE_SETLOCALE) && !defined(__QNX__)
  917|     66|    setlocale(LC_CTYPE, "");
  918|     66|#endif
  919|       |
  920|     66|    snmp_debug_init();    /* should be done first, to turn on debugging ASAP */
  921|     66|    netsnmp_container_init_list();
  922|     66|    init_callbacks();
  923|     66|    init_snmp_logging();
  924|     66|    snmp_init_statistics();
  925|     66|    register_mib_handlers();
  926|     66|    register_default_handlers();
  927|     66|    init_snmp_transport();
  928|     66|    init_snmpv3(type);
  929|     66|    init_snmp_alarm();
  930|     66|    init_snmp_enum(type);
  931|     66|    init_vacm();
  932|     66|#if defined(NETSNMP_USE_OPENSSL) && defined(HAVE_LIBSSL) && NETSNMP_TRANSPORT_TLSBASE_DOMAIN
  933|     66|    netsnmp_certs_init();
  934|     66|#endif
  935|       |#ifdef DNSSEC_LOCAL_VALIDATION
  936|       |    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "dnssecWarnOnly",
  937|       |                               NETSNMP_DS_LIBRARY_ID,
  938|       |                               NETSNMP_DS_LIB_DNSSEC_WARN_ONLY);
  939|       |#endif
  940|       |
  941|     66|    read_premib_configs();
  942|     66|#ifndef NETSNMP_DISABLE_MIB_LOADING
  943|     66|    netsnmp_init_mib();
  944|     66|#endif /* NETSNMP_DISABLE_MIB_LOADING */
  945|       |
  946|     66|    read_configs();
  947|       |
  948|     66|}                               /* end init_snmp() */
snmp_store:
  974|     66|{
  975|     66|    DEBUGMSGTL(("snmp_store", "storing stuff...\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  976|     66|    snmp_save_persistent(type);
  977|     66|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA, NULL);
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
                  snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA, NULL);
  ------------------
  |  |   25|     66|#define SNMP_CALLBACK_STORE_DATA	        1
  ------------------
  978|     66|    snmp_clean_persistent(type);
  979|     66|}
snmp_shutdown:
  992|     66|{
  993|     66|    snmp_store(type);
  994|     66|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN, NULL);
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
                  snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN, NULL);
  ------------------
  |  |   26|     66|#define SNMP_CALLBACK_SHUTDOWN		        2
  ------------------
  995|     66|    shutdown_snmp_logging();
  996|     66|    snmp_alarm_unregister_all();
  997|     66|    netsnmp_query_shutdown();
  998|     66|    snmp_close_sessions();
  999|     66|#ifndef NETSNMP_DISABLE_MIB_LOADING
 1000|     66|    shutdown_mib();
 1001|     66|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 1002|     66|#if defined(NETSNMP_USE_OPENSSL) && defined(HAVE_LIBSSL) && NETSNMP_TRANSPORT_TLSBASE_DOMAIN
 1003|     66|    netsnmp_certs_shutdown();
 1004|     66|#endif
 1005|     66|#if !defined(NETSNMP_FEATURE_REMOVE_FILTER_SOURCE)
 1006|     66|    netsnmp_transport_filter_cleanup();
 1007|     66|#endif
 1008|     66|    unregister_all_config_handlers();
 1009|     66|    netsnmp_container_free_list();
 1010|     66|    clear_sec_mod();
 1011|     66|    clear_snmp_enum();
 1012|     66|    netsnmp_clear_tdomain_list();
 1013|     66|    clear_callback();
 1014|     66|    netsnmp_ds_shutdown();
 1015|     66|    netsnmp_clear_default_target();
 1016|     66|    netsnmp_clear_default_domain();
 1017|     66|    shutdown_secmod();
 1018|     66|    shutdown_snmp_transport();
 1019|     66|    shutdown_data_list();
 1020|     66|    snmp_debug_shutdown();    /* should be done last */
 1021|       |
 1022|     66|    init_snmp_init_done  = 0;
 1023|     66|    _init_snmp_init_done = 0;
 1024|     66|}
snmp_session_insert:
 1030|     66|{
 1031|     66|    if (NULL == slp)
  ------------------
  |  Branch (1031:9): [True: 0, False: 66]
  ------------------
 1032|      0|        return;
 1033|       |
 1034|     66|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     66|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 66]
  |  |  ------------------
  ------------------
 1035|     66|    slp->next = Sessions;
 1036|     66|    Sessions = slp;
 1037|     66|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     66|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 66]
  |  |  ------------------
  ------------------
 1038|     66|}
netsnmp_sess_config_transport:
 1635|     66|{
 1636|       |    /* Optional supplemental transport configuration information and
 1637|       |       final call to actually open the transport */
 1638|     66|    if (transport_configuration) {
  ------------------
  |  Branch (1638:9): [True: 0, False: 66]
  ------------------
 1639|      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]
  |  |  ------------------
  ------------------
 1640|      0|        if (transport->f_config) {
  ------------------
  |  Branch (1640:13): [True: 0, False: 0]
  ------------------
 1641|      0|            netsnmp_iterator *iter;
 1642|      0|            netsnmp_transport_config *config_data;
 1643|      0|            int ret = 0;
 1644|       |
 1645|      0|            iter = CONTAINER_ITERATOR(transport_configuration);
  ------------------
  |  |  404|      0|#define CONTAINER_ITERATOR(x)       (x)->get_iterator(x)
  ------------------
 1646|      0|            if (NULL == iter) {
  ------------------
  |  Branch (1646:17): [True: 0, False: 0]
  ------------------
 1647|      0|                return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1648|      0|            }
 1649|       |
 1650|      0|            for(config_data = (netsnmp_transport_config*)ITERATOR_FIRST(iter); config_data;
  ------------------
  |  |  546|      0|#define ITERATOR_FIRST(x)  x->first(x)
  ------------------
  |  Branch (1650:80): [True: 0, False: 0]
  ------------------
 1651|      0|                config_data = (netsnmp_transport_config*)ITERATOR_NEXT(iter)) {
  ------------------
  |  |  547|      0|#define ITERATOR_NEXT(x)   x->next(x)
  ------------------
 1652|      0|                ret = transport->f_config(transport, config_data->key,
 1653|      0|                                          config_data->value);
 1654|      0|                if (ret)
  ------------------
  |  Branch (1654:21): [True: 0, False: 0]
  ------------------
 1655|      0|                    break;
 1656|      0|            }
 1657|      0|            ITERATOR_RELEASE(iter);
  ------------------
  |  |  550|      0|#define ITERATOR_RELEASE(x) do { x->release(x); x = NULL; } while(0)
  |  |  ------------------
  |  |  |  Branch (550:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1658|      0|            if (ret)
  ------------------
  |  Branch (1658:17): [True: 0, False: 0]
  ------------------
 1659|      0|                return SNMPERR_TRANSPORT_CONFIG_ERROR;
  ------------------
  |  |  252|      0|#define SNMPERR_TRANSPORT_CONFIG_ERROR  (-68)
  ------------------
 1660|      0|        } else {
 1661|      0|            return SNMPERR_TRANSPORT_NO_CONFIG;
  ------------------
  |  |  251|      0|#define SNMPERR_TRANSPORT_NO_CONFIG     (-67)
  ------------------
 1662|      0|        }
 1663|      0|    }
 1664|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1665|     66|}
netsnmp_sess_config_and_open_transport:
 1697|     66|{
 1698|     66|    int rc;
 1699|       |    
 1700|     66|    DEBUGMSGTL(("snmp_sess", "opening transport: %x\n", transport->flags & NETSNMP_TRANSPORT_FLAG_OPENED));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 1701|       |
 1702|       |    /* don't double open */
 1703|     66|    if (transport->flags & NETSNMP_TRANSPORT_FLAG_OPENED)
  ------------------
  |  |   57|     66|#define		NETSNMP_TRANSPORT_FLAG_OPENED	 0x20  /* f_open called */
  ------------------
  |  Branch (1703:9): [True: 0, False: 66]
  ------------------
 1704|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1705|       |
 1706|     66|    if ((rc = netsnmp_sess_config_transport(in_session->transport_configuration,
  ------------------
  |  Branch (1706:9): [True: 0, False: 66]
  ------------------
 1707|     66|                                            transport)) != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1708|      0|        in_session->s_snmp_errno = rc;
 1709|      0|        in_session->s_errno = 0;
 1710|      0|        return rc;
 1711|      0|    }
 1712|       |        
 1713|     66|    if (transport->f_open)
  ------------------
  |  Branch (1713:9): [True: 0, False: 66]
  ------------------
 1714|      0|        transport = transport->f_open(transport);
 1715|       |
 1716|     66|    if (transport == NULL) {
  ------------------
  |  Branch (1716:9): [True: 0, False: 66]
  ------------------
 1717|      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]
  |  |  ------------------
  ------------------
 1718|      0|        in_session->s_snmp_errno = SNMPERR_BAD_ADDRESS;
  ------------------
  |  |  187|      0|#define SNMPERR_BAD_ADDRESS		(-3)
  ------------------
 1719|      0|        in_session->s_errno = errno;
 1720|      0|        snmp_set_detail(in_session->peername);
 1721|      0|        return SNMPERR_BAD_ADDRESS;
  ------------------
  |  |  187|      0|#define SNMPERR_BAD_ADDRESS		(-3)
  ------------------
 1722|      0|    }
 1723|       |
 1724|       |    /** if transport has a max size, make sure session is the same (or less) */
 1725|     66|    if (in_session->rcvMsgMaxSize > transport->msgMaxSize) {
  ------------------
  |  Branch (1725:9): [True: 66, False: 0]
  ------------------
 1726|     66|        DEBUGMSGTL(("snmp_sess",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 1727|     66|                    "limiting session rcv size (%" NETSNMP_PRIz "d) to transport max (%" NETSNMP_PRIz "d)\n",
 1728|     66|                    in_session->rcvMsgMaxSize, transport->msgMaxSize));
 1729|     66|        in_session->rcvMsgMaxSize = transport->msgMaxSize;
 1730|     66|    }
 1731|       |
 1732|     66|    if (in_session->sndMsgMaxSize > transport->msgMaxSize) {
  ------------------
  |  Branch (1732:9): [True: 66, False: 0]
  ------------------
 1733|     66|        DEBUGMSGTL(("snmp_sess",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 1734|     66|                    "limiting session snd size (%" NETSNMP_PRIz "d) to transport max (%" NETSNMP_PRIz "d)\n",
 1735|     66|                    in_session->sndMsgMaxSize, transport->msgMaxSize));
 1736|     66|        in_session->sndMsgMaxSize = transport->msgMaxSize;
 1737|     66|    }
 1738|       |
 1739|     66|    transport->flags |= NETSNMP_TRANSPORT_FLAG_OPENED;
  ------------------
  |  |   57|     66|#define		NETSNMP_TRANSPORT_FLAG_OPENED	 0x20  /* f_open called */
  ------------------
 1740|     66|    DEBUGMSGTL(("snmp_sess", "done opening transport: %x\n", transport->flags & NETSNMP_TRANSPORT_FLAG_OPENED));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 1741|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1742|     66|}
snmp_add:
 1858|     66|{
 1859|     66|    struct session_list *slp;
 1860|       |
 1861|     66|    slp = snmp_sess_add_ex(in_session, transport, fpre_parse, NULL,
 1862|     66|                           fpost_parse, NULL, NULL, NULL, NULL);
 1863|     66|    if (slp == NULL) {
  ------------------
  |  Branch (1863:9): [True: 0, False: 66]
  ------------------
 1864|      0|        return NULL;
 1865|      0|    }
 1866|       |
 1867|     66|    snmp_session_insert(slp);
 1868|       |
 1869|     66|    return (slp->session);
 1870|     66|}
snmp_sess_add_ex:
 1919|     66|{
 1920|     66|    struct session_list *slp;
 1921|     66|    int rc;
 1922|       |    
 1923|     66|    _init_snmp();
 1924|       |
 1925|     66|    if (transport == NULL)
  ------------------
  |  Branch (1925:9): [True: 0, False: 66]
  ------------------
 1926|      0|        return NULL;
 1927|       |
 1928|     66|    if (NULL != in_session && (in_session->rcvMsgMaxSize < SNMP_MIN_MAX_LEN ||
  ------------------
  |  |   48|    132|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (1928:9): [True: 66, False: 0]
  |  Branch (1928:32): [True: 0, False: 66]
  ------------------
 1929|     66|                               in_session->sndMsgMaxSize < SNMP_MIN_MAX_LEN)) {
  ------------------
  |  |   48|     66|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (1929:32): [True: 0, False: 66]
  ------------------
 1930|      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]
  |  |  ------------------
  ------------------
 1931|      0|                    "invalid session (msg sizes). need snmp_sess_init"));
 1932|      0|        in_session = NULL; /* force transport cleanup below */
 1933|      0|    }
 1934|       |
 1935|     66|    if (in_session == NULL) {
  ------------------
  |  Branch (1935:9): [True: 0, False: 66]
  ------------------
 1936|      0|        transport->f_close(transport);
 1937|      0|        netsnmp_transport_free(transport);
 1938|      0|        return NULL;
 1939|      0|    }
 1940|       |
 1941|       |    /* if the transport hasn't been fully opened yet, open it now */
 1942|     66|    if ((rc = netsnmp_sess_config_and_open_transport(in_session, transport))
  ------------------
  |  Branch (1942:9): [True: 0, False: 66]
  ------------------
 1943|     66|        != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1944|      0|        return NULL;
 1945|      0|    }
 1946|       |
 1947|     66|    DEBUGMSGTL(("snmp_sess_add", "fd %" NETSNMP_FMT_SKT "\n",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 1948|     66|                transport->sock));
 1949|       |
 1950|     66|    if ((slp = snmp_sess_copy(in_session)) == NULL) {
  ------------------
  |  Branch (1950:9): [True: 0, False: 66]
  ------------------
 1951|      0|        transport->f_close(transport);
 1952|      0|        netsnmp_transport_free(transport);
 1953|      0|        return (NULL);
 1954|      0|    }
 1955|       |
 1956|     66|    slp->transport = transport;
 1957|     66|    slp->internal->hook_pre = fpre_parse;
 1958|     66|    slp->internal->hook_parse = fparse;
 1959|     66|    slp->internal->hook_post = fpost_parse;
 1960|     66|    slp->internal->hook_build = fbuild;
 1961|     66|    slp->internal->hook_realloc_build = frbuild;
 1962|     66|    slp->internal->check_packet = fcheck;
 1963|     66|    slp->internal->hook_create_pdu = fcreate_pdu;
 1964|       |
 1965|       |    /** don't let session max exceed transport max */
 1966|     66|    if (slp->session->rcvMsgMaxSize > transport->msgMaxSize) {
  ------------------
  |  Branch (1966:9): [True: 0, False: 66]
  ------------------
 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 rcv size (%" NETSNMP_PRIz "d) to transport max (%" NETSNMP_PRIz "d)\n",
 1969|      0|                    slp->session->rcvMsgMaxSize, transport->msgMaxSize));
 1970|      0|        slp->session->rcvMsgMaxSize = transport->msgMaxSize;
 1971|      0|    }
 1972|     66|    if (slp->session->sndMsgMaxSize > transport->msgMaxSize) {
  ------------------
  |  Branch (1972:9): [True: 0, False: 66]
  ------------------
 1973|      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]
  |  |  ------------------
  ------------------
 1974|      0|                    "limiting session snd size (%" NETSNMP_PRIz "d) to transport max (%" NETSNMP_PRIz "d)\n",
 1975|      0|                    slp->session->sndMsgMaxSize, transport->msgMaxSize));
 1976|      0|        slp->session->sndMsgMaxSize = transport->msgMaxSize;
 1977|      0|    }
 1978|       |
 1979|     66|    if (transport->f_setup_session &&
  ------------------
  |  Branch (1979:9): [True: 66, False: 0]
  ------------------
 1980|     66|        transport->f_setup_session(transport, slp->session) != SNMPERR_SUCCESS)
  ------------------
  |  |  184|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (1980:9): [True: 0, False: 66]
  ------------------
 1981|      0|        goto close_session;
 1982|       |
 1983|       |    /* Anything below this point should only be done if the transport
 1984|       |       had no say in the matter */
 1985|     66|    if (slp->session->securityLevel == 0)
  ------------------
  |  Branch (1985:9): [True: 66, False: 0]
  ------------------
 1986|     66|        slp->session->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|     66|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 1987|       |
 1988|     66|    if (slp->session->version == SNMP_VERSION_3) {
  ------------------
  |  |  113|     66|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (1988:9): [True: 0, False: 66]
  ------------------
 1989|      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]
  |  |  ------------------
  ------------------
 1990|      0|                    "adding v3 session -- maybe engineID probe now\n"));
 1991|      0|        if (!snmpv3_engineID_probe(slp, slp->session)) {
  ------------------
  |  Branch (1991:13): [True: 0, False: 0]
  ------------------
 1992|      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]
  |  |  ------------------
  ------------------
 1993|      0|            goto close_session;
 1994|      0|        }
 1995|      0|    }
 1996|       |
 1997|     66|    slp->session->flags &= ~SNMP_FLAGS_DONT_PROBE;
  ------------------
  |  |  155|     66|#define SNMP_FLAGS_DONT_PROBE      0x100      /* don't probe for an engineID */
  ------------------
 1998|       |
 1999|     66|    return slp;
 2000|       |
 2001|      0|close_session:
 2002|      0|    snmp_sess_close(slp);
 2003|       |    return NULL;
 2004|     66|}                               /*  end snmp_sess_add_ex()  */
netsnmp_cleanup_session:
 2064|     66|{
 2065|     66|    free(s->localname);
 2066|     66|    free(s->peername);
 2067|     66|    free(s->community);
 2068|     66|    free(s->contextEngineID);
 2069|     66|    free(s->contextName);
 2070|     66|    free(s->securityEngineID);
 2071|     66|    free(s->securityName);
 2072|     66|    free(s->securityAuthProto);
 2073|     66|    free(s->securityAuthLocalKey);
 2074|     66|    free(s->securityPrivProto);
 2075|     66|    free(s->securityPrivLocalKey);
 2076|     66|    free(s->paramName);
 2077|     66|#ifndef NETSNMP_NO_TRAP_STATS
 2078|     66|    free(s->trap_stats);
 2079|     66|#endif /* NETSNMP_NO_TRAP_STATS */
 2080|     66|    usm_free_user(s->sessUser);
 2081|     66|    netsnmp_free_transport_config(s->transport_configuration);
 2082|     66|    memset(s, 0, sizeof(*s));
 2083|     66|}
snmp_sess_close:
 2137|     66|{
 2138|     66|    netsnmp_transport *transport;
 2139|     66|    struct snmp_internal_session *isp;
 2140|     66|    netsnmp_session *sesp = NULL;
 2141|     66|    struct snmp_secmod_def *sptr;
 2142|       |
 2143|     66|    if (slp == NULL) {
  ------------------
  |  Branch (2143:9): [True: 0, False: 66]
  ------------------
 2144|      0|        return 0;
 2145|      0|    }
 2146|       |
 2147|     66|    if (slp->session != NULL &&
  ------------------
  |  Branch (2147:9): [True: 66, False: 0]
  ------------------
 2148|     66|        (sptr = find_sec_mod(slp->session->securityModel)) != NULL &&
  ------------------
  |  Branch (2148:9): [True: 66, False: 0]
  ------------------
 2149|     66|        sptr->session_close != NULL) {
  ------------------
  |  Branch (2149:9): [True: 0, False: 66]
  ------------------
 2150|      0|        (*sptr->session_close) (slp->session);
 2151|      0|    }
 2152|       |
 2153|     66|    isp = slp->internal;
 2154|     66|    slp->internal = NULL;
 2155|       |
 2156|     66|    if (isp) {
  ------------------
  |  Branch (2156:9): [True: 66, False: 0]
  ------------------
 2157|     66|        netsnmp_request_list *rp, *orp;
 2158|       |
 2159|     66|        SNMP_FREE(isp->packet);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2160|       |
 2161|       |        /*
 2162|       |         * Free each element in the input request list.  
 2163|       |         */
 2164|     66|        rp = isp->requests;
 2165|     66|        while (rp) {
  ------------------
  |  Branch (2165:16): [True: 0, False: 66]
  ------------------
 2166|      0|            orp = rp;
 2167|      0|            rp = rp->next_request;
 2168|      0|            if (orp->callback) {
  ------------------
  |  Branch (2168:17): [True: 0, False: 0]
  ------------------
 2169|      0|                orp->callback(NETSNMP_CALLBACK_OP_TIMED_OUT,
  ------------------
  |  |  320|      0|#define NETSNMP_CALLBACK_OP_TIMED_OUT		2
  ------------------
 2170|      0|                              slp->session, orp->pdu->reqid,
 2171|      0|                              orp->pdu, orp->cb_data);
 2172|      0|            }
 2173|      0|            remove_request(isp, NULL, orp);
 2174|      0|            free(orp);
 2175|      0|        }
 2176|       |
 2177|     66|        free(isp);
 2178|     66|    }
 2179|       |
 2180|     66|    transport = slp->transport;
 2181|     66|    slp->transport = NULL;
 2182|       |
 2183|     66|    if (transport) {
  ------------------
  |  Branch (2183:9): [True: 66, False: 0]
  ------------------
 2184|     66|        transport->f_close(transport);
 2185|     66|        netsnmp_transport_free(transport);
 2186|     66|    }
 2187|       |
 2188|     66|    sesp = slp->session;
 2189|     66|    slp->session = NULL;
 2190|       |
 2191|       |    /*
 2192|       |     * The following is necessary to avoid memory leakage when closing AgentX 
 2193|       |     * sessions that may have multiple subsessions.  These hang off the main
 2194|       |     * session at ->subsession, and chain through ->next.  
 2195|       |     */
 2196|       |
 2197|     66|    if (sesp != NULL && sesp->subsession != NULL) {
  ------------------
  |  Branch (2197:9): [True: 66, False: 0]
  |  Branch (2197:25): [True: 0, False: 66]
  ------------------
 2198|      0|        netsnmp_session *subsession = sesp->subsession, *tmpsub;
 2199|       |
 2200|      0|        while (subsession != NULL) {
  ------------------
  |  Branch (2200:16): [True: 0, False: 0]
  ------------------
 2201|      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]
  |  |  ------------------
  ------------------
 2202|      0|                        "closing session %p, subsession %p\n", sesp,
 2203|      0|                        subsession));
 2204|      0|            tmpsub = subsession->next;
 2205|      0|            snmp_free_session(subsession);
 2206|      0|            subsession = tmpsub;
 2207|      0|        }
 2208|      0|    }
 2209|       |
 2210|     66|    snmp_free_session(sesp);
 2211|     66|    free(slp);
 2212|     66|    return 1;
 2213|     66|}
snmp_close:
 2217|     66|{
 2218|     66|    struct session_list *slp = NULL, *oslp = NULL;
 2219|       |
 2220|     66|    {                           /*MTCRITICAL_RESOURCE */
 2221|     66|        snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     66|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2222|     66|        if (Sessions && Sessions->session == session) { /* If first entry */
  ------------------
  |  Branch (2222:13): [True: 0, False: 66]
  |  Branch (2222:25): [True: 0, False: 0]
  ------------------
 2223|      0|            slp = Sessions;
 2224|      0|            Sessions = slp->next;
 2225|     66|        } else {
 2226|     66|            for (slp = Sessions; slp; slp = slp->next) {
  ------------------
  |  Branch (2226:34): [True: 0, False: 66]
  ------------------
 2227|      0|                if (slp->session == session) {
  ------------------
  |  Branch (2227:21): [True: 0, False: 0]
  ------------------
 2228|      0|                    if (oslp)   /* if we found entry that points here */
  ------------------
  |  Branch (2228:25): [True: 0, False: 0]
  ------------------
 2229|      0|                        oslp->next = slp->next; /* link around this entry */
 2230|      0|                    break;
 2231|      0|                }
 2232|      0|                oslp = slp;
 2233|      0|            }
 2234|     66|        }
 2235|     66|        snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     66|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2236|     66|    }                           /*END MTCRITICAL_RESOURCE */
 2237|     66|    if (slp == NULL) {
  ------------------
  |  Branch (2237:9): [True: 66, False: 0]
  ------------------
 2238|     66|        return 0;
 2239|     66|    }
 2240|      0|    return snmp_sess_close(slp);
 2241|     66|}
snmp_close_sessions:
 2245|     66|{
 2246|     66|    struct session_list *slp;
 2247|       |
 2248|     66|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     66|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2249|    132|    while (Sessions) {
  ------------------
  |  Branch (2249:12): [True: 66, False: 66]
  ------------------
 2250|     66|        slp = Sessions;
 2251|     66|        Sessions = Sessions->next;
 2252|     66|        snmp_sess_close(slp);
 2253|     66|    }
 2254|     66|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     66|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 66]
  |  |  ------------------
  ------------------
 2255|     66|    return 1;
 2256|     66|}
snmpv3_header_realloc_rbuild:
 2629|      3|{
 2630|      3|    size_t          start_offset = *offset;
 2631|      3|    u_char          msg_flags;
 2632|      3|    long            max_size, sec_model;
 2633|      3|    int             rc = 0;
 2634|       |
 2635|       |    /*
 2636|       |     * msgSecurityModel.  
 2637|       |     */
 2638|      3|    sec_model = pdu->securityModel;
 2639|      3|    DEBUGDUMPHEADER("send", "msgSecurityModel");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 3]
  |  |  ------------------
  ------------------
 2640|      3|    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 2641|      3|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   79|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   84|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2642|      3|                                          ASN_INTEGER), &sec_model,
  ------------------
  |  |   64|      3|#define ASN_INTEGER	    0x02U
  ------------------
 2643|      3|                                sizeof(sec_model));
 2644|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2645|      3|    if (rc == 0) {
  ------------------
  |  Branch (2645:9): [True: 0, False: 3]
  ------------------
 2646|      0|        return 0;
 2647|      0|    }
 2648|       |
 2649|       |    /*
 2650|       |     * msgFlags.  
 2651|       |     */
 2652|      3|    snmpv3_calc_msg_flags(pdu->securityLevel, pdu->command, &msg_flags);
 2653|      3|    DEBUGDUMPHEADER("send", "msgFlags");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 3]
  |  |  ------------------
  ------------------
 2654|      3|    rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 2655|      3|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   79|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   84|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2656|      3|                                             | ASN_OCTET_STR), &msg_flags,
  ------------------
  |  |   67|      3|#define ASN_OCTET_STR	    0x04U
  ------------------
 2657|      3|                                   sizeof(msg_flags));
 2658|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2659|      3|    if (rc == 0) {
  ------------------
  |  Branch (2659:9): [True: 0, False: 3]
  ------------------
 2660|      0|        return 0;
 2661|      0|    }
 2662|       |
 2663|       |    /*
 2664|       |     * msgMaxSize.  
 2665|       |     */
 2666|      3|    max_size = netsnmp_max_send_msg_size();
 2667|      3|    if (session->rcvMsgMaxSize < max_size)
  ------------------
  |  Branch (2667:9): [True: 3, False: 0]
  ------------------
 2668|      3|        max_size = session->rcvMsgMaxSize;
 2669|      3|    DEBUGDUMPHEADER("send:msgMaxSize2", "msgMaxSize");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 3]
  |  |  ------------------
  ------------------
 2670|      3|    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 2671|      3|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   79|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   84|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2672|      3|                                          ASN_INTEGER), &max_size,
  ------------------
  |  |   64|      3|#define ASN_INTEGER	    0x02U
  ------------------
 2673|      3|                                sizeof(max_size));
 2674|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2675|      3|    if (rc == 0) {
  ------------------
  |  Branch (2675:9): [True: 0, False: 3]
  ------------------
 2676|      0|        return 0;
 2677|      0|    }
 2678|       |
 2679|       |    /*
 2680|       |     * msgID.  
 2681|       |     */
 2682|      3|    DEBUGDUMPHEADER("send", "msgID");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 3]
  |  |  ------------------
  ------------------
 2683|      3|    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 2684|      3|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   79|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   84|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2685|      3|                                          ASN_INTEGER), &pdu->msgid,
  ------------------
  |  |   64|      3|#define ASN_INTEGER	    0x02U
  ------------------
 2686|      3|                                sizeof(pdu->msgid));
 2687|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2688|      3|    if (rc == 0) {
  ------------------
  |  Branch (2688:9): [True: 0, False: 3]
  ------------------
 2689|      0|        return 0;
 2690|      0|    }
 2691|       |
 2692|       |    /*
 2693|       |     * Global data sequence.  
 2694|       |     */
 2695|      3|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 2696|      3|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   73|      3|#define ASN_SEQUENCE	    0x10U
  ------------------
 2697|      3|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2698|      3|                                     *offset - start_offset);
 2699|      3|    if (rc == 0) {
  ------------------
  |  Branch (2699:9): [True: 0, False: 3]
  ------------------
 2700|      0|        return 0;
 2701|      0|    }
 2702|       |
 2703|       |    /*
 2704|       |     * Store the version field - msgVersion.  
 2705|       |     */
 2706|      3|    DEBUGDUMPHEADER("send", "SNMP Version Number");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 3]
  |  |  ------------------
  ------------------
 2707|      3|    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 2708|      3|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   79|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   84|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2709|      3|                                          ASN_INTEGER),
  ------------------
  |  |   64|      3|#define ASN_INTEGER	    0x02U
  ------------------
 2710|      3|                                (long *) &pdu->version,
 2711|      3|                                sizeof(pdu->version));
 2712|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2713|      3|    return rc;
 2714|      3|}                               /* end snmpv3_header_realloc_rbuild() */
snmpv3_scopedPDU_header_realloc_rbuild:
 2759|      3|{
 2760|      3|    size_t          start_offset = *offset;
 2761|      3|    int             rc = 0;
 2762|       |
 2763|       |    /*
 2764|       |     * contextName.  
 2765|       |     */
 2766|      3|    DEBUGDUMPHEADER("send", "contextName");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 3]
  |  |  ------------------
  ------------------
 2767|      3|    rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 2768|      3|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   79|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   84|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2769|      3|                                             | ASN_OCTET_STR),
  ------------------
  |  |   67|      3|#define ASN_OCTET_STR	    0x04U
  ------------------
 2770|      3|                                   (u_char *) pdu->contextName,
 2771|      3|                                   pdu->contextNameLen);
 2772|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2773|      3|    if (rc == 0) {
  ------------------
  |  Branch (2773:9): [True: 0, False: 3]
  ------------------
 2774|      0|        return 0;
 2775|      0|    }
 2776|       |
 2777|       |    /*
 2778|       |     * contextEngineID.  
 2779|       |     */
 2780|      3|    DEBUGDUMPHEADER("send", "contextEngineID");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 3]
  |  |  ------------------
  ------------------
 2781|      3|    rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 2782|      3|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   79|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   84|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2783|      3|                                             | ASN_OCTET_STR),
  ------------------
  |  |   67|      3|#define ASN_OCTET_STR	    0x04U
  ------------------
 2784|      3|                                   pdu->contextEngineID,
 2785|      3|                                   pdu->contextEngineIDLen);
 2786|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2787|      3|    if (rc == 0) {
  ------------------
  |  Branch (2787:9): [True: 0, False: 3]
  ------------------
 2788|      0|        return 0;
 2789|      0|    }
 2790|       |
 2791|      3|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 2792|      3|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   73|      3|#define ASN_SEQUENCE	    0x10U
  ------------------
 2793|      3|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2794|      3|                                     *offset - start_offset + body_len);
 2795|       |
 2796|      3|    return rc;
 2797|      3|}                               /* end snmpv3_scopedPDU_header_realloc_rbuild() */
snmpv3_packet_realloc_rbuild:
 2809|      3|{
 2810|      3|    u_char         *scoped_pdu, *hdrbuf = NULL, *hdr = NULL;
 2811|      3|    size_t          hdrbuf_len = SNMP_MAX_MSG_V3_HDRS, hdr_offset =
  ------------------
  |  |  110|      3|#define SNMP_MAX_MSG_V3_HDRS       (4+3+4+7+7+3+7+16)   /* fudge factor=16 */
  ------------------
 2812|      3|        0, spdu_offset = 0;
 2813|      3|    size_t          body_end_offset = *offset, body_len = 0;
 2814|      3|    struct snmp_secmod_def *sptr = NULL;
 2815|      3|    int             rc = 0;
 2816|       |
 2817|       |    /*
 2818|       |     * Build a scopedPDU structure into the packet buffer.  
 2819|       |     */
 2820|      3|    DEBUGPRINTPDUTYPE("send", pdu->command);
  ------------------
  |  |  431|      3|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   81|      3|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (81:56): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2821|      3|    if (pdu_data) {
  ------------------
  |  Branch (2821:9): [True: 0, False: 3]
  ------------------
 2822|      0|        while ((*pkt_len - *offset) < pdu_data_len) {
  ------------------
  |  Branch (2822:16): [True: 0, False: 0]
  ------------------
 2823|      0|            if (!asn_realloc(pkt, pkt_len)) {
  ------------------
  |  Branch (2823:17): [True: 0, False: 0]
  ------------------
 2824|      0|                return -1;
 2825|      0|            }
 2826|      0|        }
 2827|       |
 2828|      0|        *offset += pdu_data_len;
 2829|      0|        memcpy(*pkt + *pkt_len - *offset, pdu_data, pdu_data_len);
 2830|      3|    } else {
 2831|      3|        rc = snmp_pdu_realloc_rbuild(pkt, pkt_len, offset, pdu);
 2832|      3|        if (rc == 0) {
  ------------------
  |  Branch (2832:13): [True: 0, False: 3]
  ------------------
 2833|      0|            return -1;
 2834|      0|        }
 2835|      3|    }
 2836|      3|    body_len = *offset - body_end_offset;
 2837|       |
 2838|      3|    DEBUGDUMPSECTION("send", "ScopedPdu");
  ------------------
  |  |   81|      3|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2839|      3|    rc = snmpv3_scopedPDU_header_realloc_rbuild(pkt, pkt_len, offset,
 2840|      3|                                                pdu, body_len);
 2841|      3|    if (rc == 0) {
  ------------------
  |  Branch (2841:9): [True: 0, False: 3]
  ------------------
 2842|      0|        return -1;
 2843|      0|    }
 2844|      3|    spdu_offset = *offset;
 2845|      3|    DEBUGINDENTADD(-4);         /*  Return from Scoped PDU.  */
  ------------------
  |  |   73|      3|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2846|       |
 2847|      3|    if ((hdrbuf = (u_char *) malloc(hdrbuf_len)) == NULL) {
  ------------------
  |  Branch (2847:9): [True: 0, False: 3]
  ------------------
 2848|      0|        return -1;
 2849|      0|    }
 2850|       |
 2851|      3|    rc = snmpv3_header_realloc_rbuild(&hdrbuf, &hdrbuf_len, &hdr_offset,
 2852|      3|                                      session, pdu);
 2853|      3|    if (rc == 0) {
  ------------------
  |  Branch (2853:9): [True: 0, False: 3]
  ------------------
 2854|      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]
  |  |  ------------------
  ------------------
 2855|      0|        return -1;
 2856|      0|    }
 2857|      3|    hdr = hdrbuf + hdrbuf_len - hdr_offset;
 2858|      3|    scoped_pdu = *pkt + *pkt_len - spdu_offset;
 2859|       |
 2860|       |    /*
 2861|       |     * Call the security module to possibly encrypt and authenticate the
 2862|       |     * message---the entire message to transmitted on the wire is returned.  
 2863|       |     */
 2864|       |
 2865|      3|    sptr = find_sec_mod(pdu->securityModel);
 2866|      3|    DEBUGDUMPSECTION("send", "SM msgSecurityParameters");
  ------------------
  |  |   81|      3|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2867|      3|    if (sptr && sptr->encode_reverse) {
  ------------------
  |  Branch (2867:9): [True: 3, False: 0]
  |  Branch (2867:17): [True: 3, False: 0]
  ------------------
 2868|      3|        struct snmp_secmod_outgoing_params parms;
 2869|       |
 2870|      3|        parms.msgProcModel = pdu->msgParseModel;
 2871|      3|        parms.globalData = hdr;
 2872|      3|        parms.globalDataLen = hdr_offset;
 2873|      3|        parms.maxMsgSize = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  109|      3|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 2874|      3|        parms.secModel = pdu->securityModel;
 2875|      3|        parms.secEngineID = pdu->securityEngineID;
 2876|      3|        parms.secEngineIDLen = pdu->securityEngineIDLen;
 2877|      3|        parms.secName = pdu->securityName;
 2878|      3|        parms.secNameLen = pdu->securityNameLen;
 2879|      3|        parms.secLevel = pdu->securityLevel;
 2880|      3|        parms.scopedPdu = scoped_pdu;
 2881|      3|        parms.scopedPduLen = spdu_offset;
 2882|      3|        parms.secStateRef = pdu->securityStateRef;
 2883|      3|        parms.wholeMsg = pkt;
 2884|      3|        parms.wholeMsgLen = pkt_len;
 2885|      3|        parms.wholeMsgOffset = offset;
 2886|      3|        parms.session = session;
 2887|      3|        parms.pdu = pdu;
 2888|       |
 2889|      3|        rc = (*sptr->encode_reverse) (&parms);
 2890|      3|    } else {
 2891|      0|        if (!sptr) {
  ------------------
  |  Branch (2891:13): [True: 0, False: 0]
  ------------------
 2892|      0|            snmp_log(LOG_ERR,
 2893|      0|                     "no such security service available: %d\n",
 2894|      0|                     pdu->securityModel);
 2895|      0|        } else if (!sptr->encode_reverse) {
  ------------------
  |  Branch (2895:20): [True: 0, False: 0]
  ------------------
 2896|      0|            snmp_log(LOG_ERR,
 2897|      0|                     "security service %d doesn't support reverse encoding.\n",
 2898|      0|                     pdu->securityModel);
 2899|      0|        }
 2900|      0|        rc = -1;
 2901|      0|    }
 2902|       |
 2903|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2904|       |    SNMP_FREE(hdrbuf);
  ------------------
  |  |   62|      3|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 3, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2905|      3|    return rc;
 2906|      3|}                               /* end snmpv3_packet_realloc_rbuild() */
snmp_build:
 3409|      3|{
 3410|      3|    int             rc;
 3411|       |
 3412|      3|    rc = _snmp_build(pkt, pkt_len, offset, pss, pdu);
 3413|      3|    if (rc) {
  ------------------
  |  Branch (3413:9): [True: 0, False: 3]
  ------------------
 3414|      0|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (3414:13): [True: 0, False: 0]
  ------------------
 3415|      0|            snmp_log(LOG_ERR, "snmp_build: unknown failure\n");
 3416|      0|            pss->s_snmp_errno = SNMPERR_BAD_ASN1_BUILD;
  ------------------
  |  |  195|      0|#define SNMPERR_BAD_ASN1_BUILD		(-11)
  ------------------
 3417|      0|        }
 3418|      0|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   43|      0|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 3419|      0|        rc = -1;
 3420|      0|    }
 3421|      3|    return rc;
 3422|      3|}
snmp_pdu_realloc_rbuild:
 3641|      3|{
 3642|      3|#ifndef VPCACHE_SIZE
 3643|      3|#define VPCACHE_SIZE 50
 3644|      3|#endif
 3645|      3|    netsnmp_variable_list *vpcache[VPCACHE_SIZE];
 3646|      3|    netsnmp_variable_list *vp, *tmpvp;
 3647|      3|    size_t          start_offset = *offset;
 3648|      3|    int             i, wrapped = 0, notdone, final, rc = 0;
 3649|       |
 3650|      3|    DEBUGMSGTL(("snmp_pdu_realloc_rbuild", "starting\n"));
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3651|      6|    for (vp = pdu->variables, i = VPCACHE_SIZE - 1; vp;
  ------------------
  |  | 3643|      3|#define VPCACHE_SIZE 50
  ------------------
  |  Branch (3651:53): [True: 3, False: 3]
  ------------------
 3652|      3|         vp = vp->next_variable, i--) {
 3653|       |        /*
 3654|       |         * if estimated getbulk response size exceeded packet max size,
 3655|       |         * processing was stopped before bulk cache was filled and type
 3656|       |         * was set to ASN_PRIV_STOP, indicating that the rest of the varbinds
 3657|       |         * in the cache are empty and we can stop encoding them.
 3658|       |         */
 3659|      3|        if (ASN_PRIV_STOP == vp->type)
  ------------------
  |  |  196|      3|#define ASN_PRIV_STOP       (ASN_PRIVATE | 8)   /* 200 */
  |  |  ------------------
  |  |  |  |   82|      3|#define ASN_PRIVATE	    0xC0U
  |  |  ------------------
  ------------------
  |  Branch (3659:13): [True: 0, False: 3]
  ------------------
 3660|      0|            break;
 3661|      3|        if (i < 0) {
  ------------------
  |  Branch (3661:13): [True: 0, False: 3]
  ------------------
 3662|      0|            wrapped = notdone = 1;
 3663|      0|            i = VPCACHE_SIZE - 1;
  ------------------
  |  | 3643|      0|#define VPCACHE_SIZE 50
  ------------------
 3664|      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]
  |  |  ------------------
  ------------------
 3665|      0|        }
 3666|      3|        vpcache[i] = vp;
 3667|      3|    }
 3668|      3|    final = i + 1;
 3669|       |
 3670|      3|    do {
 3671|      6|        for (i = final; i < VPCACHE_SIZE; i++) {
  ------------------
  |  | 3643|      6|#define VPCACHE_SIZE 50
  ------------------
  |  Branch (3671:25): [True: 3, False: 3]
  ------------------
 3672|      3|            vp = vpcache[i];
 3673|      3|            DEBUGDUMPSECTION("send", "VarBind");
  ------------------
  |  |   81|      3|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3674|      3|            rc = snmp_realloc_rbuild_var_op(pkt, pkt_len, offset, 1,
 3675|      3|                                            vp->name, &vp->name_length,
 3676|      3|                                            vp->type,
 3677|      3|                                            (u_char *) vp->val.string,
 3678|      3|                                            vp->val_len);
 3679|      3|            DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3680|      3|            if (rc == 0) {
  ------------------
  |  Branch (3680:17): [True: 0, False: 3]
  ------------------
 3681|      0|                return 0;
 3682|      0|            }
 3683|      3|        }
 3684|       |
 3685|      3|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3686|      3|        if (wrapped) {
  ------------------
  |  Branch (3686:13): [True: 0, False: 3]
  ------------------
 3687|      0|            notdone = 1;
 3688|      0|            for (i = 0; i < final; i++) {
  ------------------
  |  Branch (3688:25): [True: 0, False: 0]
  ------------------
 3689|      0|                vp = vpcache[i];
 3690|      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]
  |  |  ------------------
  ------------------
 3691|      0|                rc = snmp_realloc_rbuild_var_op(pkt, pkt_len, offset, 1,
 3692|      0|                                                vp->name, &vp->name_length,
 3693|      0|                                                vp->type,
 3694|      0|                                                (u_char *) vp->val.string,
 3695|      0|                                                vp->val_len);
 3696|      0|                DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3697|      0|                if (rc == 0) {
  ------------------
  |  Branch (3697:21): [True: 0, False: 0]
  ------------------
 3698|      0|                    return 0;
 3699|      0|                }
 3700|      0|            }
 3701|       |
 3702|      0|            if (final == 0) {
  ------------------
  |  Branch (3702:17): [True: 0, False: 0]
  ------------------
 3703|      0|                tmpvp = vpcache[VPCACHE_SIZE - 1];
  ------------------
  |  | 3643|      0|#define VPCACHE_SIZE 50
  ------------------
 3704|      0|            } else {
 3705|      0|                tmpvp = vpcache[final - 1];
 3706|      0|            }
 3707|      0|            wrapped = 0;
 3708|       |
 3709|      0|            for (vp = pdu->variables, i = VPCACHE_SIZE - 1;
  ------------------
  |  | 3643|      0|#define VPCACHE_SIZE 50
  ------------------
 3710|      0|                 vp && vp != tmpvp; vp = vp->next_variable, i--) {
  ------------------
  |  Branch (3710:18): [True: 0, False: 0]
  |  Branch (3710:24): [True: 0, False: 0]
  ------------------
 3711|      0|                if (i < 0) {
  ------------------
  |  Branch (3711:21): [True: 0, False: 0]
  ------------------
 3712|      0|                    wrapped = 1;
 3713|      0|                    i = VPCACHE_SIZE - 1;
  ------------------
  |  | 3643|      0|#define VPCACHE_SIZE 50
  ------------------
 3714|      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]
  |  |  ------------------
  ------------------
 3715|      0|                }
 3716|      0|                vpcache[i] = vp;
 3717|      0|            }
 3718|      0|            final = i + 1;
 3719|      3|        } else {
 3720|      3|            notdone = 0;
 3721|      3|        }
 3722|      3|    } while (notdone);
  ------------------
  |  Branch (3722:14): [True: 0, False: 3]
  ------------------
 3723|       |
 3724|       |    /*
 3725|       |     * Save current location and build SEQUENCE tag and length placeholder for
 3726|       |     * variable-bindings sequence (actual length will be inserted later).  
 3727|       |     */
 3728|       |
 3729|      3|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 3730|      3|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   73|      3|#define ASN_SEQUENCE	    0x10U
  ------------------
 3731|      3|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3732|      3|                                     *offset - start_offset);
 3733|      3|    if (rc == 0) {
  ------------------
  |  Branch (3733:9): [True: 0, False: 3]
  ------------------
 3734|      0|        return 0;
 3735|      0|    }
 3736|       |
 3737|       |    /*
 3738|       |     * Store fields in the PDU preceding the variable-bindings sequence.
 3739|       |     */
 3740|      3|    if (pdu->command != SNMP_MSG_TRAP) {
  ------------------
  |  |  135|      3|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   81|      3|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3740:9): [True: 3, False: 0]
  ------------------
 3741|       |        /*
 3742|       |         * Error index (getbulk max-repetitions).  
 3743|       |         */
 3744|      3|        DEBUGDUMPHEADER("send", "error index");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 3]
  |  |  ------------------
  ------------------
 3745|      3|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3746|      3|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   79|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   84|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3747|      3|                                              | ASN_INTEGER),
  ------------------
  |  |   64|      3|#define ASN_INTEGER	    0x02U
  ------------------
 3748|      3|                                    &pdu->errindex, sizeof(pdu->errindex));
 3749|      3|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3750|      3|        if (rc == 0) {
  ------------------
  |  Branch (3750:13): [True: 0, False: 3]
  ------------------
 3751|      0|            return 0;
 3752|      0|        }
 3753|       |
 3754|       |        /*
 3755|       |         * Error status (getbulk non-repeaters).  
 3756|       |         */
 3757|      3|        DEBUGDUMPHEADER("send", "error status");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 3]
  |  |  ------------------
  ------------------
 3758|      3|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3759|      3|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   79|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   84|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3760|      3|                                              | ASN_INTEGER),
  ------------------
  |  |   64|      3|#define ASN_INTEGER	    0x02U
  ------------------
 3761|      3|                                    &pdu->errstat, sizeof(pdu->errstat));
 3762|      3|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3763|      3|        if (rc == 0) {
  ------------------
  |  Branch (3763:13): [True: 0, False: 3]
  ------------------
 3764|      0|            return 0;
 3765|      0|        }
 3766|       |
 3767|       |        /*
 3768|       |         * Request ID.  
 3769|       |         */
 3770|      3|        DEBUGDUMPHEADER("send", "request_id");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 3]
  |  |  ------------------
  ------------------
 3771|      3|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3772|      3|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   79|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   84|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3773|      3|                                              | ASN_INTEGER), &pdu->reqid,
  ------------------
  |  |   64|      3|#define ASN_INTEGER	    0x02U
  ------------------
 3774|      3|                                    sizeof(pdu->reqid));
 3775|      3|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3776|      3|        if (rc == 0) {
  ------------------
  |  Branch (3776:13): [True: 0, False: 3]
  ------------------
 3777|      0|            return 0;
 3778|      0|        }
 3779|      3|    } else {
 3780|       |        /*
 3781|       |         * An SNMPv1 trap PDU.  
 3782|       |         */
 3783|       |
 3784|       |        /*
 3785|       |         * Timestamp.  
 3786|       |         */
 3787|      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]
  |  |  ------------------
  ------------------
 3788|      0|        rc = asn_realloc_rbuild_unsigned_int(pkt, pkt_len, offset, 1,
 3789|      0|                                             (u_char) (ASN_TIMETICKS |
  ------------------
  |  |   92|      0|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
 3790|      0|                                                       ASN_PRIMITIVE),
  ------------------
  |  |   84|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3791|      0|                                             &pdu->time,
 3792|      0|                                             sizeof(pdu->time));
 3793|      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]
  |  |  ------------------
  ------------------
 3794|      0|        if (rc == 0) {
  ------------------
  |  Branch (3794:13): [True: 0, False: 0]
  ------------------
 3795|      0|            return 0;
 3796|      0|        }
 3797|       |
 3798|       |        /*
 3799|       |         * Specific trap.  
 3800|       |         */
 3801|      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]
  |  |  ------------------
  ------------------
 3802|      0|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3803|      0|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   79|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   84|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3804|      0|                                              | ASN_INTEGER),
  ------------------
  |  |   64|      0|#define ASN_INTEGER	    0x02U
  ------------------
 3805|      0|                                    (const long *) &pdu->specific_type,
 3806|      0|                                    sizeof(pdu->specific_type));
 3807|      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]
  |  |  ------------------
  ------------------
 3808|      0|        if (rc == 0) {
  ------------------
  |  Branch (3808:13): [True: 0, False: 0]
  ------------------
 3809|      0|            return 0;
 3810|      0|        }
 3811|       |
 3812|       |        /*
 3813|       |         * Generic trap.  
 3814|       |         */
 3815|      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]
  |  |  ------------------
  ------------------
 3816|      0|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3817|      0|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   79|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   84|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3818|      0|                                              | ASN_INTEGER),
  ------------------
  |  |   64|      0|#define ASN_INTEGER	    0x02U
  ------------------
 3819|      0|                                    (const long *) &pdu->trap_type,
 3820|      0|                                    sizeof(pdu->trap_type));
 3821|      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]
  |  |  ------------------
  ------------------
 3822|      0|        if (rc == 0) {
  ------------------
  |  Branch (3822:13): [True: 0, False: 0]
  ------------------
 3823|      0|            return 0;
 3824|      0|        }
 3825|       |
 3826|       |        /*
 3827|       |         * Agent-addr.  
 3828|       |         */
 3829|      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]
  |  |  ------------------
  ------------------
 3830|      0|        rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 3831|      0|                                       (u_char) (ASN_IPADDRESS |
  ------------------
  |  |   88|      0|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
 3832|      0|                                                 ASN_PRIMITIVE),
  ------------------
  |  |   84|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3833|      0|                                       (const u_char *) pdu->agent_addr, 4);
 3834|      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]
  |  |  ------------------
  ------------------
 3835|      0|        if (rc == 0) {
  ------------------
  |  Branch (3835:13): [True: 0, False: 0]
  ------------------
 3836|      0|            return 0;
 3837|      0|        }
 3838|       |
 3839|       |        /*
 3840|       |         * Enterprise.  
 3841|       |         */
 3842|      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]
  |  |  ------------------
  ------------------
 3843|      0|        rc = asn_realloc_rbuild_objid(pkt, pkt_len, offset, 1,
 3844|      0|                                      (u_char) (ASN_UNIVERSAL |
  ------------------
  |  |   79|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
 3845|      0|                                                ASN_PRIMITIVE |
  ------------------
  |  |   84|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3846|      0|                                                ASN_OBJECT_ID),
  ------------------
  |  |   70|      0|#define ASN_OBJECT_ID	    0x06U
  ------------------
 3847|      0|                                      (oid *) pdu->enterprise,
 3848|      0|                                      pdu->enterprise_length);
 3849|      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]
  |  |  ------------------
  ------------------
 3850|      0|        if (rc == 0) {
  ------------------
  |  Branch (3850:13): [True: 0, False: 0]
  ------------------
 3851|      0|            return 0;
 3852|      0|        }
 3853|      0|    }
 3854|       |
 3855|       |    /*
 3856|       |     * Build the PDU sequence.  
 3857|       |     */
 3858|      3|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 3859|      3|                                     (u_char) pdu->command,
 3860|      3|                                     *offset - start_offset);
 3861|      3|    return rc;
 3862|      3|}
snmpv3_parse:
 3895|     87|{
 3896|     87|    u_char          type, msg_flags;
 3897|     87|    long            ver, msg_sec_model;
 3898|     87|    size_t          max_size_response;
 3899|     87|    u_char          tmp_buf[SNMP_MAX_MSG_SIZE];
 3900|     87|    size_t          tmp_buf_len;
 3901|     87|    u_char          pdu_buf[SNMP_MAX_MSG_SIZE];
 3902|     87|    u_char         *mallocbuf = NULL;
 3903|     87|    size_t          pdu_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  109|     87|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 3904|     87|    u_char         *sec_params;
 3905|     87|    u_char         *msg_data;
 3906|     87|    u_char         *cp;
 3907|     87|    size_t          asn_len, msg_len;
 3908|     87|    int             ret, ret_val;
 3909|     87|    struct snmp_secmod_def *sptr;
 3910|       |
 3911|       |
 3912|     87|    msg_data = data;
 3913|     87|    msg_len = *length;
 3914|       |
 3915|       |
 3916|       |    /*
 3917|       |     * message is an ASN.1 SEQUENCE  
 3918|       |     */
 3919|     87|    DEBUGDUMPSECTION("recv", "SNMPv3 Message");
  ------------------
  |  |   81|     87|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     87|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 87]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 87]
  |  |  ------------------
  ------------------
 3920|     87|    data = asn_parse_sequence(data, length, &type,
 3921|     87|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   73|     87|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   85|     87|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3922|     87|    if (data == NULL) {
  ------------------
  |  Branch (3922:9): [True: 0, False: 87]
  ------------------
 3923|       |        /*
 3924|       |         * error msg detail is set 
 3925|       |         */
 3926|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3927|      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]
  |  |  ------------------
  ------------------
 3928|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3929|      0|    }
 3930|       |
 3931|       |    /*
 3932|       |     * parse msgVersion  
 3933|       |     */
 3934|     87|    DEBUGDUMPHEADER("recv", "SNMP Version Number");
  ------------------
  |  |   79|     87|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     87|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 87]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 87]
  |  |  ------------------
  ------------------
 3935|     87|    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
 3936|     87|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     87|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     87|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 87]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 87]
  |  |  ------------------
  ------------------
 3937|     87|    if (data == NULL) {
  ------------------
  |  Branch (3937:9): [True: 0, False: 87]
  ------------------
 3938|      0|        ERROR_MSG("bad parse of version");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3939|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3940|      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]
  |  |  ------------------
  ------------------
 3941|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3942|      0|    }
 3943|     87|    pdu->version = ver;
 3944|       |
 3945|       |    /*
 3946|       |     * parse msgGlobalData sequence  
 3947|       |     */
 3948|     87|    cp = data;
 3949|     87|    asn_len = *length;
 3950|     87|    DEBUGDUMPSECTION("recv", "msgGlobalData");
  ------------------
  |  |   81|     87|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     87|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 87]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 87]
  |  |  ------------------
  ------------------
 3951|     87|    data = asn_parse_sequence(data, &asn_len, &type,
 3952|     87|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   73|     87|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   85|     87|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3953|     87|                              "msgGlobalData");
 3954|     87|    if (data == NULL) {
  ------------------
  |  Branch (3954:9): [True: 2, False: 85]
  ------------------
 3955|       |        /*
 3956|       |         * error msg detail is set 
 3957|       |         */
 3958|      2|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      2|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3959|      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]
  |  |  ------------------
  ------------------
 3960|      2|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      2|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3961|      2|    }
 3962|     85|    *length -= data - cp;       /* subtract off the length of the header */
 3963|       |
 3964|       |    /*
 3965|       |     * msgID 
 3966|       |     */
 3967|     85|    DEBUGDUMPHEADER("recv", "msgID");
  ------------------
  |  |   79|     85|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     85|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 85]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 85]
  |  |  ------------------
  ------------------
 3968|     85|    data =
 3969|     85|        asn_parse_int(data, length, &type, &pdu->msgid,
 3970|     85|                      sizeof(pdu->msgid));
 3971|     85|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     85|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     85|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 85]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 85]
  |  |  ------------------
  ------------------
 3972|     85|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   64|     31|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3972:9): [True: 54, False: 31]
  |  Branch (3972:25): [True: 0, False: 31]
  ------------------
 3973|     54|        ERROR_MSG("error parsing msgID");
  ------------------
  |  |  188|     54|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3974|     54|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     54|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     54|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 54]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 54]
  |  |  ------------------
  ------------------
 3975|     54|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     54|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3976|     54|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|     54|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3977|     54|    }
 3978|       |
 3979|       |    /*
 3980|       |     * Check the msgID we received is a legal value.  If not, then increment
 3981|       |     * snmpInASNParseErrs and return the appropriate error (see RFC 2572,
 3982|       |     * para. 7.2, section 2 -- note that a bad msgID means that the received
 3983|       |     * message is NOT a serialization of an SNMPv3Message, since the msgID
 3984|       |     * field is out of bounds).  
 3985|       |     */
 3986|       |
 3987|     31|    if (pdu->msgid < 0 || pdu->msgid > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|     30|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3987:9): [True: 1, False: 30]
  |  Branch (3987:27): [True: 2, False: 28]
  ------------------
 3988|      3|        snmp_log(LOG_ERR, "Received bad msgID (%ld %s %s).\n", pdu->msgid,
 3989|      3|                 (pdu->msgid < 0) ? "<" : ">",
  ------------------
  |  Branch (3989:18): [True: 1, False: 2]
  ------------------
 3990|      3|                 (pdu->msgid < 0) ? "0" : "2^31 - 1");
  ------------------
  |  Branch (3990:18): [True: 1, False: 2]
  ------------------
 3991|      3|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      3|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3992|      3|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      3|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3993|      3|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      3|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3994|      3|    }
 3995|       |
 3996|       |    /*
 3997|       |     * msgMaxSize 
 3998|       |     */
 3999|     28|    DEBUGDUMPHEADER("recv:msgMaxSize", "msgMaxSize");
  ------------------
  |  |   79|     28|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     28|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 28]
  |  |  ------------------
  ------------------
 4000|     28|    data = asn_parse_int(data, length, &type, &pdu->msgMaxSize,
 4001|     28|                         sizeof(pdu->msgMaxSize));
 4002|     28|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     28|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     28|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 28]
  |  |  ------------------
  ------------------
 4003|     28|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   64|     28|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4003:9): [True: 0, False: 28]
  |  Branch (4003:25): [True: 0, False: 28]
  ------------------
 4004|      0|        ERROR_MSG("error parsing msgMaxSize");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4005|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4006|      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]
  |  |  ------------------
  ------------------
 4007|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4008|      0|    }
 4009|       |
 4010|       |    /*
 4011|       |     * Check the msgMaxSize we received is a legal value.  If not, then
 4012|       |     * increment snmpInASNParseErrs and return the appropriate error (see RFC
 4013|       |     * 2572, para. 7.2, section 2 -- note that a bad msgMaxSize means that the
 4014|       |     * received message is NOT a serialization of an SNMPv3Message, since the
 4015|       |     * msgMaxSize field is out of bounds).
 4016|       |     */
 4017|       |
 4018|     28|    if (pdu->msgMaxSize < SNMP_MIN_MAX_LEN) {
  ------------------
  |  |   48|     28|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (4018:9): [True: 1, False: 27]
  ------------------
 4019|      1|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu < 484).\n",
 4020|      1|                 pdu->msgMaxSize);
 4021|      1|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      1|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4022|      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]
  |  |  ------------------
  ------------------
 4023|      1|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      1|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4024|     27|    } else if (pdu->msgMaxSize > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|     27|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (4024:16): [True: 0, False: 27]
  ------------------
 4025|      0|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu > 2^31 - 1).\n",
 4026|      0|                 pdu->msgMaxSize);
 4027|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4028|      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]
  |  |  ------------------
  ------------------
 4029|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4030|     27|    } else {
 4031|     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]
  |  |  ------------------
  ------------------
 4032|     27|                    pdu->msgMaxSize));
 4033|       |        /** don't increase max msg size if we've already got one */
 4034|     27|        if (sess->sndMsgMaxSize < pdu->msgMaxSize) {
  ------------------
  |  Branch (4034:13): [True: 27, False: 0]
  ------------------
 4035|     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]
  |  |  ------------------
  ------------------
 4036|     27|                        "msgMaxSize %" NETSNMP_PRIz "d greater than session max %ld; reducing\n",
 4037|     27|                        sess->sndMsgMaxSize, pdu->msgMaxSize));
 4038|     27|            pdu->msgMaxSize = sess->sndMsgMaxSize;
 4039|     27|        }
 4040|     27|    }
 4041|       |
 4042|       |    /*
 4043|       |     * msgFlags 
 4044|       |     */
 4045|     27|    tmp_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  109|     27|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 4046|     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]
  |  |  ------------------
  ------------------
 4047|     27|    data = asn_parse_string(data, length, &type, tmp_buf, &tmp_buf_len);
 4048|     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]
  |  |  ------------------
  ------------------
 4049|     27|    if (data == NULL || type != ASN_OCTET_STR || tmp_buf_len != 1) {
  ------------------
  |  |   67|     52|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (4049:9): [True: 2, False: 25]
  |  Branch (4049:25): [True: 0, False: 25]
  |  Branch (4049:50): [True: 0, False: 25]
  ------------------
 4050|      2|        ERROR_MSG("error parsing msgFlags");
  ------------------
  |  |  188|      2|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4051|      2|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      2|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4052|      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]
  |  |  ------------------
  ------------------
 4053|      2|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      2|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4054|      2|    }
 4055|     25|    msg_flags = *tmp_buf;
 4056|     25|    if (msg_flags & SNMP_MSG_FLAG_RPRT_BIT)
  ------------------
  |  |  305|     25|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (4056:9): [True: 6, False: 19]
  ------------------
 4057|      6|        pdu->flags |= SNMP_MSG_FLAG_RPRT_BIT;
  ------------------
  |  |  305|      6|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 4058|     19|    else
 4059|     19|        pdu->flags &= (~SNMP_MSG_FLAG_RPRT_BIT);
  ------------------
  |  |  305|     19|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 4060|       |
 4061|       |    /*
 4062|       |     * msgSecurityModel 
 4063|       |     */
 4064|     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]
  |  |  ------------------
  ------------------
 4065|     25|    data = asn_parse_int(data, length, &type, &msg_sec_model,
 4066|     25|                         sizeof(msg_sec_model));
 4067|     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]
  |  |  ------------------
  ------------------
 4068|     25|    if (data == NULL || type != ASN_INTEGER ||
  ------------------
  |  |   64|     50|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4068:9): [True: 0, False: 25]
  |  Branch (4068:25): [True: 0, False: 25]
  ------------------
 4069|     25|        msg_sec_model < 1 || msg_sec_model > 0x7fffffff) {
  ------------------
  |  Branch (4069:9): [True: 0, False: 25]
  |  Branch (4069:30): [True: 0, False: 25]
  ------------------
 4070|      0|        ERROR_MSG("error parsing msgSecurityModel");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4071|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4072|      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]
  |  |  ------------------
  ------------------
 4073|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4074|      0|    }
 4075|     25|    sptr = find_sec_mod(msg_sec_model);
 4076|     25|    if (!sptr) {
  ------------------
  |  Branch (4076:9): [True: 0, False: 25]
  ------------------
 4077|      0|        snmp_log(LOG_WARNING, "unknown security model: %ld\n",
 4078|      0|                 msg_sec_model);
 4079|      0|        snmp_increment_statistic(STAT_SNMPUNKNOWNSECURITYMODELS);
  ------------------
  |  |  611|      0|#define   STAT_SNMPUNKNOWNSECURITYMODELS     0
  ------------------
 4080|      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]
  |  |  ------------------
  ------------------
 4081|      0|        return SNMPERR_UNKNOWN_SEC_MODEL;
  ------------------
  |  |  214|      0|#define SNMPERR_UNKNOWN_SEC_MODEL 	(-30)
  ------------------
 4082|      0|    }
 4083|     25|    pdu->securityModel = msg_sec_model;
 4084|       |
 4085|     25|    if (msg_flags & SNMP_MSG_FLAG_PRIV_BIT &&
  ------------------
  |  |  304|     50|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (4085:9): [True: 0, False: 25]
  ------------------
 4086|      0|        !(msg_flags & SNMP_MSG_FLAG_AUTH_BIT)) {
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (4086:9): [True: 0, False: 0]
  ------------------
 4087|      0|        ERROR_MSG("invalid message, illegal msgFlags");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4088|      0|        snmp_increment_statistic(STAT_SNMPINVALIDMSGS);
  ------------------
  |  |  612|      0|#define   STAT_SNMPINVALIDMSGS               1
  ------------------
 4089|      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]
  |  |  ------------------
  ------------------
 4090|      0|        return SNMPERR_INVALID_MSG;
  ------------------
  |  |  215|      0|#define SNMPERR_INVALID_MSG             (-31)
  ------------------
 4091|      0|    }
 4092|     25|    pdu->securityLevel = ((msg_flags & SNMP_MSG_FLAG_AUTH_BIT)
  ------------------
  |  |  303|     25|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (4092:27): [True: 11, False: 14]
  ------------------
 4093|     25|                          ? ((msg_flags & SNMP_MSG_FLAG_PRIV_BIT)
  ------------------
  |  |  304|     11|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (4093:30): [True: 0, False: 11]
  ------------------
 4094|     11|                             ? SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
 4095|     11|                             : SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|     11|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
 4096|     25|                          : SNMP_SEC_LEVEL_NOAUTH);
  ------------------
  |  |  299|     14|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4097|       |    /*
 4098|       |     * end of msgGlobalData 
 4099|       |     */
 4100|       |
 4101|       |    /*
 4102|       |     * securtityParameters OCTET STRING begins after msgGlobalData 
 4103|       |     */
 4104|     25|    sec_params = data;
 4105|     25|    SNMP_FREE(pdu->contextEngineID);
  ------------------
  |  |   62|     25|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 25]
  |  |  |  Branch (62:66): [Folded, False: 25]
  |  |  ------------------
  ------------------
 4106|     25|    pdu->contextEngineID = calloc(1, SNMP_MAX_ENG_SIZE);
  ------------------
  |  |  111|     25|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4107|     25|    pdu->contextEngineIDLen = SNMP_MAX_ENG_SIZE;
  ------------------
  |  |  111|     25|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4108|       |
 4109|       |    /*
 4110|       |     * Note: there is no length limit on the msgAuthoritativeEngineID field,
 4111|       |     * although we would EXPECT it to be limited to 32 (the SnmpEngineID TC
 4112|       |     * limit).  We'll use double that here to be on the safe side.  
 4113|       |     */
 4114|       |
 4115|     25|    SNMP_FREE(pdu->securityEngineID);
  ------------------
  |  |   62|     25|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 25]
  |  |  |  Branch (62:66): [Folded, False: 25]
  |  |  ------------------
  ------------------
 4116|     25|    pdu->securityEngineID = calloc(1, SNMP_MAX_ENG_SIZE * 2);
  ------------------
  |  |  111|     25|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4117|     25|    pdu->securityEngineIDLen = SNMP_MAX_ENG_SIZE * 2;
  ------------------
  |  |  111|     25|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4118|     25|    SNMP_FREE(pdu->securityName);
  ------------------
  |  |   62|     25|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 25]
  |  |  |  Branch (62:66): [Folded, False: 25]
  |  |  ------------------
  ------------------
 4119|     25|    pdu->securityName = calloc(1, SNMP_MAX_SEC_NAME_SIZE);
  ------------------
  |  |  112|     25|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 4120|     25|    pdu->securityNameLen = SNMP_MAX_SEC_NAME_SIZE;
  ------------------
  |  |  112|     25|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 4121|       |
 4122|     25|    if ((pdu->securityName == NULL) ||
  ------------------
  |  Branch (4122:9): [True: 0, False: 25]
  ------------------
 4123|     25|        (pdu->securityEngineID == NULL) ||
  ------------------
  |  Branch (4123:9): [True: 0, False: 25]
  ------------------
 4124|     25|        (pdu->contextEngineID == NULL)) {
  ------------------
  |  Branch (4124:9): [True: 0, False: 25]
  ------------------
 4125|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4126|      0|    }
 4127|       |
 4128|     25|    if (pdu_buf_len < msg_len
  ------------------
  |  Branch (4128:9): [True: 0, False: 25]
  ------------------
 4129|      0|        && pdu->securityLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (4129:12): [True: 0, False: 0]
  ------------------
 4130|       |        /*
 4131|       |         * space needed is larger than we have in the default buffer 
 4132|       |         */
 4133|      0|        mallocbuf = calloc(1, msg_len);
 4134|      0|        if (mallocbuf == NULL)
  ------------------
  |  Branch (4134:13): [True: 0, False: 0]
  ------------------
 4135|      0|            return SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4136|      0|        pdu_buf_len = msg_len;
 4137|      0|        cp = mallocbuf;
 4138|     25|    } else {
 4139|     25|        memset(pdu_buf, 0, pdu_buf_len);
 4140|     25|        cp = pdu_buf;
 4141|     25|    }
 4142|       |
 4143|     25|    DEBUGDUMPSECTION("recv", "SM msgSecurityParameters");
  ------------------
  |  |   81|     25|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     25|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 25]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 25]
  |  |  ------------------
  ------------------
 4144|     25|    if (sptr->decode) {
  ------------------
  |  Branch (4144:9): [True: 25, False: 0]
  ------------------
 4145|     25|        struct snmp_secmod_incoming_params parms;
 4146|     25|        parms.msgProcModel = pdu->msgParseModel;
 4147|     25|        parms.maxMsgSize = pdu->msgMaxSize;
 4148|     25|        parms.secParams = sec_params;
 4149|     25|        parms.secModel = msg_sec_model;
 4150|     25|        parms.secLevel = pdu->securityLevel;
 4151|     25|        parms.wholeMsg = msg_data;
 4152|     25|        parms.wholeMsgLen = msg_len;
 4153|     25|        parms.secEngineID = pdu->securityEngineID;
 4154|     25|        parms.secEngineIDLen = &pdu->securityEngineIDLen;
 4155|     25|        parms.secName = pdu->securityName;
 4156|     25|        parms.secNameLen = &pdu->securityNameLen;
 4157|     25|        parms.scopedPdu = &cp;
 4158|     25|        parms.scopedPduLen = &pdu_buf_len;
 4159|     25|        parms.maxSizeResponse = &max_size_response;
 4160|     25|        parms.secStateRef = &pdu->securityStateRef;
 4161|     25|        parms.sess = sess;
 4162|     25|        parms.pdu = pdu;
 4163|     25|        parms.msg_flags = msg_flags;
 4164|     25|        ret_val = (*sptr->decode) (&parms);
 4165|     25|    } else {
 4166|      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]
  |  |  ------------------
  ------------------
 4167|      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]
  |  |  ------------------
  ------------------
 4168|      0|        snmp_log(LOG_WARNING, "security service %ld can't decode packets\n",
 4169|      0|                 msg_sec_model);
 4170|      0|        return (-1);
 4171|      0|    }
 4172|       |
 4173|     25|    if (ret_val != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|     25|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (4173:9): [True: 14, False: 11]
  ------------------
 4174|     14|        DEBUGDUMPSECTION("recv", "ScopedPDU");
  ------------------
  |  |   81|     14|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     14|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 14]
  |  |  ------------------
  ------------------
 4175|       |        /*
 4176|       |         * Parse as much as possible -- though I don't see the point? [jbpn].  
 4177|       |         */
 4178|     14|        if (cp) {
  ------------------
  |  Branch (4178:13): [True: 14, False: 0]
  ------------------
 4179|     14|            cp = snmpv3_scopedPDU_parse(pdu, cp, &pdu_buf_len);
 4180|     14|        }
 4181|     14|        if (cp) {
  ------------------
  |  Branch (4181:13): [True: 1, False: 13]
  ------------------
 4182|      1|            DEBUGPRINTPDUTYPE("recv", *cp);
  ------------------
  |  |  431|      1|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   81|      1|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (81:56): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4183|      1|            snmp_pdu_parse(pdu, cp, &pdu_buf_len);
 4184|      1|            DEBUGINDENTADD(-8);
  ------------------
  |  |   73|      1|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 1]
  |  |  ------------------
  ------------------
 4185|     13|        } else {
 4186|     13|            DEBUGINDENTADD(-4);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 4187|     13|        }
 4188|       |
 4189|     14|        SNMP_FREE(mallocbuf);
  ------------------
  |  |   62|     14|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 14]
  |  |  |  Branch (62:66): [Folded, False: 14]
  |  |  ------------------
  ------------------
 4190|     14|        return ret_val;
 4191|     14|    }
 4192|       |
 4193|       |    /*
 4194|       |     * parse plaintext ScopedPDU sequence 
 4195|       |     */
 4196|     11|    *length = pdu_buf_len;
 4197|     11|    DEBUGDUMPSECTION("recv", "ScopedPDU");
  ------------------
  |  |   81|     11|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     11|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 11]
  |  |  ------------------
  ------------------
 4198|     11|    data = snmpv3_scopedPDU_parse(pdu, cp, length);
 4199|     11|    if (data == NULL) {
  ------------------
  |  Branch (4199:9): [True: 2, False: 9]
  ------------------
 4200|      2|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4201|      2|                 msg_sec_model);
 4202|      2|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  188|      2|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4203|      2|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      2|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4204|      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]
  |  |  ------------------
  ------------------
 4205|      2|        SNMP_FREE(mallocbuf);
  ------------------
  |  |   62|      2|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 2]
  |  |  |  Branch (62:66): [Folded, False: 2]
  |  |  ------------------
  ------------------
 4206|      2|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      2|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4207|      2|    }
 4208|       |
 4209|       |    /*
 4210|       |     * parse the PDU.  
 4211|       |     */
 4212|      9|    if (after_header != NULL) {
  ------------------
  |  Branch (4212:9): [True: 0, False: 9]
  ------------------
 4213|      0|        *after_header = data;
 4214|      0|        tmp_buf_len = *length;
 4215|      0|    }
 4216|       |
 4217|      9|    DEBUGPRINTPDUTYPE("recv", *data);
  ------------------
  |  |  431|      9|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   81|      9|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      9|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 9]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	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: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4218|      9|    ret = snmp_pdu_parse(pdu, data, length);
 4219|      9|    DEBUGINDENTADD(-8);
  ------------------
  |  |   73|      9|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      9|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 9]
  |  |  ------------------
  ------------------
 4220|       |
 4221|      9|    if (after_header != NULL) {
  ------------------
  |  Branch (4221:9): [True: 0, False: 9]
  ------------------
 4222|      0|        *length = tmp_buf_len;
 4223|      0|    }
 4224|       |
 4225|      9|    if (ret != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|      9|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (4225:9): [True: 9, False: 0]
  ------------------
 4226|      9|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4227|      9|                 msg_sec_model);
 4228|      9|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  188|      9|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4229|      9|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      9|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4230|      9|        SNMP_FREE(mallocbuf);
  ------------------
  |  |   62|      9|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 9]
  |  |  |  Branch (62:66): [Folded, False: 9]
  |  |  ------------------
  ------------------
 4231|      9|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      9|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4232|      9|    }
 4233|       |
 4234|      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]
  |  |  ------------------
  ------------------
 4235|      0|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4236|      9|}                               /* end snmpv3_parse() */
snmpv3_make_report:
 4267|      3|{
 4268|       |
 4269|      3|    long            ltmp;
 4270|      3|    static const oid unknownSecurityLevel[] =
 4271|      3|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 1, 0 };
 4272|      3|    static const oid notInTimeWindow[] =
 4273|      3|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 2, 0 };
 4274|      3|    static const oid unknownUserName[] =
 4275|      3|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 3, 0 };
 4276|      3|    static const oid unknownEngineID[] =
 4277|      3|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 4, 0 };
 4278|      3|    static const oid wrongDigest[] = { 1, 3, 6, 1, 6, 3, 15, 1, 1, 5, 0 };
 4279|      3|    static const oid decryptionError[] =
 4280|      3|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 6, 0 };
 4281|      3|    const oid      *err_var;
 4282|      3|    int             err_var_len;
 4283|      3|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4284|      3|    int             stat_ind;
 4285|      3|#endif
 4286|       |
 4287|      3|    switch (error) {
 4288|      1|    case SNMPERR_USM_UNKNOWNENGINEID:
  ------------------
  |  |  232|      1|#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
  ------------------
  |  Branch (4288:5): [True: 1, False: 2]
  ------------------
 4289|      1|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4290|      1|        stat_ind = STAT_USMSTATSUNKNOWNENGINEIDS;
  ------------------
  |  |  623|      1|#define   STAT_USMSTATSUNKNOWNENGINEIDS      6
  ------------------
 4291|      1|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4292|      1|        err_var = unknownEngineID;
 4293|      1|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4263|      1|#define ERROR_STAT_LENGTH 11
  ------------------
 4294|      1|        break;
 4295|      0|    case SNMPERR_USM_UNKNOWNSECURITYNAME:
  ------------------
  |  |  227|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (4295:5): [True: 0, False: 3]
  ------------------
 4296|      0|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4297|      0|        stat_ind = STAT_USMSTATSUNKNOWNUSERNAMES;
  ------------------
  |  |  622|      0|#define   STAT_USMSTATSUNKNOWNUSERNAMES      5
  ------------------
 4298|      0|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4299|      0|        err_var = unknownUserName;
 4300|      0|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4263|      0|#define ERROR_STAT_LENGTH 11
  ------------------
 4301|      0|        break;
 4302|      0|    case SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL:
  ------------------
  |  |  228|      0|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
  |  Branch (4302:5): [True: 0, False: 3]
  ------------------
 4303|      0|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4304|      0|        stat_ind = STAT_USMSTATSUNSUPPORTEDSECLEVELS;
  ------------------
  |  |  620|      0|#define   STAT_USMSTATSUNSUPPORTEDSECLEVELS  3
  ------------------
 4305|      0|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4306|      0|        err_var = unknownSecurityLevel;
 4307|      0|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4263|      0|#define ERROR_STAT_LENGTH 11
  ------------------
 4308|      0|        break;
 4309|      2|    case SNMPERR_USM_AUTHENTICATIONFAILURE:
  ------------------
  |  |  230|      2|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
  |  Branch (4309:5): [True: 2, False: 1]
  ------------------
 4310|      2|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4311|      2|        stat_ind = STAT_USMSTATSWRONGDIGESTS;
  ------------------
  |  |  624|      2|#define   STAT_USMSTATSWRONGDIGESTS          7
  ------------------
 4312|      2|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4313|      2|        err_var = wrongDigest;
 4314|      2|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4263|      2|#define ERROR_STAT_LENGTH 11
  ------------------
 4315|      2|        break;
 4316|      0|    case SNMPERR_USM_NOTINTIMEWINDOW:
  ------------------
  |  |  233|      0|#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
  ------------------
  |  Branch (4316:5): [True: 0, False: 3]
  ------------------
 4317|      0|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4318|      0|        stat_ind = STAT_USMSTATSNOTINTIMEWINDOWS;
  ------------------
  |  |  621|      0|#define   STAT_USMSTATSNOTINTIMEWINDOWS      4
  ------------------
 4319|      0|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4320|      0|        err_var = notInTimeWindow;
 4321|      0|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4263|      0|#define ERROR_STAT_LENGTH 11
  ------------------
 4322|      0|        break;
 4323|      0|    case SNMPERR_USM_DECRYPTIONERROR:
  ------------------
  |  |  234|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
  |  Branch (4323:5): [True: 0, False: 3]
  ------------------
 4324|      0|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4325|      0|        stat_ind = STAT_USMSTATSDECRYPTIONERRORS;
  ------------------
  |  |  625|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 4326|      0|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4327|      0|        err_var = decryptionError;
 4328|      0|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4263|      0|#define ERROR_STAT_LENGTH 11
  ------------------
 4329|      0|        break;
 4330|      0|    default:
  ------------------
  |  Branch (4330:5): [True: 0, False: 3]
  ------------------
 4331|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 4332|      3|    }
 4333|       |
 4334|      3|    snmp_free_varbind(pdu->variables);  /* free the current varbind */
 4335|       |
 4336|      3|    pdu->variables = NULL;
 4337|      3|    SNMP_FREE(pdu->securityEngineID);
  ------------------
  |  |   62|      3|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 3, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 3]
  |  |  ------------------
  ------------------
 4338|      3|    pdu->securityEngineID =
 4339|      3|        snmpv3_generate_engineID(&pdu->securityEngineIDLen);
 4340|      3|    SNMP_FREE(pdu->contextEngineID);
  ------------------
  |  |   62|      3|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 3, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 3]
  |  |  ------------------
  ------------------
 4341|      3|    pdu->contextEngineID =
 4342|      3|        snmpv3_generate_engineID(&pdu->contextEngineIDLen);
 4343|      3|    pdu->command = SNMP_MSG_REPORT;
  ------------------
  |  |  147|      3|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   81|      3|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
 4344|      3|    pdu->errstat = 0;
 4345|      3|    pdu->errindex = 0;
 4346|      3|    SNMP_FREE(pdu->contextName);
  ------------------
  |  |   62|      3|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 1, False: 2]
  |  |  |  Branch (62:66): [Folded, False: 3]
  |  |  ------------------
  ------------------
 4347|      3|    pdu->contextNameLen = 0;
 4348|      3|    pdu->contextName = strdup("");
 4349|      3|    if (!pdu->contextName)
  ------------------
  |  Branch (4349:9): [True: 0, False: 3]
  ------------------
 4350|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4351|      3|    pdu->contextNameLen = strlen(pdu->contextName);
 4352|       |
 4353|       |    /*
 4354|       |     * reports shouldn't cache previous data. 
 4355|       |     */
 4356|       |    /*
 4357|       |     * FIX - yes they should but USM needs to follow new EoP to determine
 4358|       |     * which cached values to use 
 4359|       |     */
 4360|      3|    free_securityStateRef(pdu);
 4361|       |
 4362|      3|    if (error == SNMPERR_USM_NOTINTIMEWINDOW) {
  ------------------
  |  |  233|      3|#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
  ------------------
  |  Branch (4362:9): [True: 0, False: 3]
  ------------------
 4363|      0|        pdu->securityLevel = SNMP_SEC_LEVEL_AUTHNOPRIV;
  ------------------
  |  |  300|      0|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
 4364|      3|    } else {
 4365|      3|        pdu->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|      3|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4366|      3|    }
 4367|       |
 4368|       |    /*
 4369|       |     * find the appropriate error counter  
 4370|       |     */
 4371|      3|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4372|      3|    ltmp = snmp_get_statistic(stat_ind);
 4373|       |#else /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4374|       |    ltmp = 1;
 4375|       |#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4376|       |
 4377|       |    /*
 4378|       |     * return the appropriate error counter  
 4379|       |     */
 4380|      3|    snmp_pdu_add_variable(pdu, err_var, err_var_len,
 4381|      3|                          ASN_COUNTER, & ltmp, sizeof(ltmp));
  ------------------
  |  |   89|      3|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   80|      3|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
 4382|       |
 4383|      3|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|      3|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4384|      3|}                               /* end snmpv3_make_report() */
snmp_parse:
 4775|    426|{
 4776|    426|    int             rc;
 4777|       |
 4778|    426|    rc = _snmp_parse(slp, pss, pdu, data, length);
 4779|    426|    if (rc) {
  ------------------
  |  Branch (4779:9): [True: 426, False: 0]
  ------------------
 4780|    426|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (4780:13): [True: 107, False: 319]
  ------------------
 4781|    107|            pss->s_snmp_errno = SNMPERR_BAD_PARSE;
  ------------------
  |  |  197|    107|#define SNMPERR_BAD_PARSE		(-13)
  ------------------
 4782|    107|        }
 4783|    426|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   43|    426|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 4784|    426|    }
 4785|       |
 4786|    426|    return rc;
 4787|    426|}
snmp_pdu_parse:
 4791|     27|{
 4792|     27|    u_char          type;
 4793|     27|    u_char          msg_type;
 4794|     27|    u_char         *var_val;
 4795|     27|    size_t          len;
 4796|     27|    size_t          four;
 4797|     27|    netsnmp_variable_list *vp = NULL, *vplast = NULL;
 4798|     27|    oid             objid[MAX_OID_LEN];
 4799|     27|    u_char         *p;
 4800|       |
 4801|       |    /*
 4802|       |     * Get the PDU type 
 4803|       |     */
 4804|     27|    data = asn_parse_header(data, length, &msg_type);
 4805|     27|    if (data == NULL)
  ------------------
  |  Branch (4805:9): [True: 5, False: 22]
  ------------------
 4806|      5|        return -1;
 4807|     22|    DEBUGMSGTL(("dumpv_recv","    Command %s\n", snmp_pdu_type(msg_type)));
  ------------------
  |  |   66|     22|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     22|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 22]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 22]
  |  |  ------------------
  ------------------
 4808|     22|    pdu->command = msg_type;
 4809|     22|    pdu->flags &= (~UCD_MSG_FLAG_RESPONSE_PDU);
  ------------------
  |  |  311|     22|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4810|       |
 4811|       |    /*
 4812|       |     * get the fields in the PDU preceding the variable-bindings sequence
 4813|       |     */
 4814|     22|    switch (pdu->command) {
 4815|     11|    case SNMP_MSG_TRAP:
  ------------------
  |  |  135|     11|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   81|     11|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   85|     11|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4815:5): [True: 11, False: 11]
  ------------------
 4816|       |        /*
 4817|       |         * enterprise 
 4818|       |         */
 4819|     11|        pdu->enterprise_length = MAX_OID_LEN;
  ------------------
  |  |  120|     11|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4820|     11|        data = asn_parse_objid(data, length, &type, objid,
 4821|     11|                               &pdu->enterprise_length);
 4822|     11|        if (data == NULL)
  ------------------
  |  Branch (4822:13): [True: 5, False: 6]
  ------------------
 4823|      5|            return -1;
 4824|      6|        SNMP_FREE(pdu->enterprise);
  ------------------
  |  |   62|      6|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 6]
  |  |  |  Branch (62:66): [Folded, False: 6]
  |  |  ------------------
  ------------------
 4825|      6|        pdu->enterprise = netsnmp_memdup(objid,
 4826|      6|                                         pdu->enterprise_length * sizeof(oid));
 4827|      6|        if (pdu->enterprise == NULL) {
  ------------------
  |  Branch (4827:13): [True: 0, False: 6]
  ------------------
 4828|      0|            return -1;
 4829|      0|        }
 4830|       |
 4831|       |        /*
 4832|       |         * agent-addr 
 4833|       |         */
 4834|      6|        four = 4;
 4835|      6|        data = asn_parse_string(data, length, &type,
 4836|      6|                                (u_char *) pdu->agent_addr, &four);
 4837|      6|        if (data == NULL)
  ------------------
  |  Branch (4837:13): [True: 5, False: 1]
  ------------------
 4838|      5|            return -1;
 4839|       |
 4840|       |        /*
 4841|       |         * generic trap 
 4842|       |         */
 4843|      1|        data = asn_parse_int(data, length, &type, (long *) &pdu->trap_type,
 4844|      1|                             sizeof(pdu->trap_type));
 4845|      1|        if (data == NULL)
  ------------------
  |  Branch (4845:13): [True: 0, False: 1]
  ------------------
 4846|      0|            return -1;
 4847|       |        /*
 4848|       |         * specific trap 
 4849|       |         */
 4850|      1|        data =
 4851|      1|            asn_parse_int(data, length, &type,
 4852|      1|                          (long *) &pdu->specific_type,
 4853|      1|                          sizeof(pdu->specific_type));
 4854|      1|        if (data == NULL)
  ------------------
  |  Branch (4854:13): [True: 0, False: 1]
  ------------------
 4855|      0|            return -1;
 4856|       |
 4857|       |        /*
 4858|       |         * timestamp  
 4859|       |         */
 4860|      1|        data = asn_parse_unsigned_int(data, length, &type, &pdu->time,
 4861|      1|                                      sizeof(pdu->time));
 4862|      1|        if (data == NULL)
  ------------------
  |  Branch (4862:13): [True: 1, False: 0]
  ------------------
 4863|      1|            return -1;
 4864|       |
 4865|      0|        break;
 4866|       |
 4867|      0|    case SNMP_MSG_RESPONSE:
  ------------------
  |  |  127|      0|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4867:5): [True: 0, False: 22]
  ------------------
 4868|      6|    case SNMP_MSG_REPORT:
  ------------------
  |  |  147|      6|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   81|      6|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   85|      6|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4868:5): [True: 6, False: 16]
  ------------------
 4869|      6|        pdu->flags |= UCD_MSG_FLAG_RESPONSE_PDU;
  ------------------
  |  |  311|      6|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4870|      6|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2449|      6|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4871|       |
 4872|      6|    case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|      6|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   81|      6|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   85|      6|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4872:5): [True: 0, False: 22]
  ------------------
 4873|      9|    case SNMP_MSG_INFORM:
  ------------------
  |  |  141|      9|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   81|      9|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   85|      9|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4873:5): [True: 3, False: 19]
  ------------------
 4874|      9|#ifndef NETSNMP_NOTIFY_ONLY
 4875|      9|    case SNMP_MSG_GET:
  ------------------
  |  |  125|      9|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   81|      9|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   85|      9|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4875:5): [True: 0, False: 22]
  ------------------
 4876|      9|    case SNMP_MSG_GETNEXT:
  ------------------
  |  |  126|      9|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   81|      9|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   85|      9|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4876:5): [True: 0, False: 22]
  ------------------
 4877|      9|    case SNMP_MSG_GETBULK:
  ------------------
  |  |  140|      9|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   81|      9|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   85|      9|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4877:5): [True: 0, False: 22]
  ------------------
 4878|      9|#endif /* ! NETSNMP_NOTIFY_ONLY */
 4879|      9|#ifndef NETSNMP_NO_WRITE_SUPPORT
 4880|      9|    case SNMP_MSG_SET:
  ------------------
  |  |  129|      9|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   81|      9|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   85|      9|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4880:5): [True: 0, False: 22]
  ------------------
 4881|      9|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 4882|       |        /*
 4883|       |         * PDU is not an SNMPv1 TRAP 
 4884|       |         */
 4885|       |
 4886|       |        /*
 4887|       |         * request id 
 4888|       |         */
 4889|      9|        DEBUGDUMPHEADER("recv", "request_id");
  ------------------
  |  |   79|      9|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      9|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 9]
  |  |  ------------------
  ------------------
 4890|      9|        data = asn_parse_int(data, length, &type, &pdu->reqid,
 4891|      9|                             sizeof(pdu->reqid));
 4892|      9|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      9|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      9|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 9]
  |  |  ------------------
  ------------------
 4893|      9|        if (data == NULL) {
  ------------------
  |  Branch (4893:13): [True: 9, False: 0]
  ------------------
 4894|      9|            return -1;
 4895|      9|        }
 4896|       |
 4897|       |        /*
 4898|       |         * error status (getbulk non-repeaters) 
 4899|       |         */
 4900|      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]
  |  |  ------------------
  ------------------
 4901|      0|        data = asn_parse_int(data, length, &type, &pdu->errstat,
 4902|      0|                             sizeof(pdu->errstat));
 4903|      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]
  |  |  ------------------
  ------------------
 4904|      0|        if (data == NULL) {
  ------------------
  |  Branch (4904:13): [True: 0, False: 0]
  ------------------
 4905|      0|            return -1;
 4906|      0|        }
 4907|       |
 4908|       |        /*
 4909|       |         * error index (getbulk max-repetitions) 
 4910|       |         */
 4911|      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]
  |  |  ------------------
  ------------------
 4912|      0|        data = asn_parse_int(data, length, &type, &pdu->errindex,
 4913|      0|                             sizeof(pdu->errindex));
 4914|      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]
  |  |  ------------------
  ------------------
 4915|      0|        if (data == NULL) {
  ------------------
  |  Branch (4915:13): [True: 0, False: 0]
  ------------------
 4916|      0|            return -1;
 4917|      0|        }
 4918|      0|	break;
 4919|       |
 4920|      2|    default:
  ------------------
  |  Branch (4920:5): [True: 2, False: 20]
  ------------------
 4921|      2|        snmp_log(LOG_ERR, "Bad PDU type received: 0x%.2x\n", pdu->command);
 4922|      2|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      2|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4923|      2|        return -1;
 4924|     22|    }
 4925|       |
 4926|       |    /*
 4927|       |     * get header for variable-bindings sequence 
 4928|       |     */
 4929|      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]
  |  |  ------------------
  ------------------
 4930|      0|    data = asn_parse_sequence(data, length, &type,
 4931|      0|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   73|      0|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 4932|      0|                              "varbinds");
 4933|      0|    if (data == NULL)
  ------------------
  |  Branch (4933:9): [True: 0, False: 0]
  ------------------
 4934|      0|        goto fail;
 4935|       |
 4936|      0|    snmp_free_varbind(pdu->variables);
 4937|      0|    pdu->variables = NULL;
 4938|       |
 4939|       |    /*
 4940|       |     * get each varBind sequence 
 4941|       |     */
 4942|      0|    while ((int) *length > 0) {
  ------------------
  |  Branch (4942:12): [True: 0, False: 0]
  ------------------
 4943|      0|        vp = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
  ------------------
  |  |   73|      0|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 4944|      0|        if (NULL == vp)
  ------------------
  |  Branch (4944:13): [True: 0, False: 0]
  ------------------
 4945|      0|            goto fail;
 4946|       |
 4947|      0|        vp->name_length = MAX_OID_LEN;
  ------------------
  |  |  120|      0|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4948|      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]
  |  |  ------------------
  ------------------
 4949|      0|        data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type,
 4950|      0|                                 &vp->val_len, &var_val, length);
 4951|      0|        if (data == NULL)
  ------------------
  |  Branch (4951:13): [True: 0, False: 0]
  ------------------
 4952|      0|            goto fail;
 4953|      0|        if (snmp_set_var_objid(vp, objid, vp->name_length))
  ------------------
  |  Branch (4953:13): [True: 0, False: 0]
  ------------------
 4954|      0|            goto fail;
 4955|       |
 4956|      0|        len = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
 4957|      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]
  |  |  ------------------
  ------------------
 4958|      0|        switch ((short) vp->type) {
 4959|      0|        case ASN_INTEGER:
  ------------------
  |  |   64|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4959:9): [True: 0, False: 0]
  ------------------
 4960|      0|            vp->val.integer = (long *) vp->buf;
 4961|      0|            vp->val_len = sizeof(long);
 4962|      0|            p = asn_parse_int(var_val, &len, &vp->type,
 4963|      0|                          (long *) vp->val.integer,
 4964|      0|                          sizeof(*vp->val.integer));
 4965|      0|            if (!p)
  ------------------
  |  Branch (4965:17): [True: 0, False: 0]
  ------------------
 4966|      0|                goto fail;
 4967|      0|            break;
 4968|      0|        case ASN_COUNTER:
  ------------------
  |  |   89|      0|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4968:9): [True: 0, False: 0]
  ------------------
 4969|      0|        case ASN_GAUGE:
  ------------------
  |  |   90|      0|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4969:9): [True: 0, False: 0]
  ------------------
 4970|      0|        case ASN_TIMETICKS:
  ------------------
  |  |   92|      0|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4970:9): [True: 0, False: 0]
  ------------------
 4971|      0|        case ASN_UINTEGER:
  ------------------
  |  |  100|      0|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4971:9): [True: 0, False: 0]
  ------------------
 4972|      0|            vp->val.integer = (long *) vp->buf;
 4973|      0|            vp->val_len = sizeof(u_long);
 4974|      0|            p = asn_parse_unsigned_int(var_val, &len, &vp->type,
 4975|      0|                                   (u_long *) vp->val.integer,
 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|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4981|      0|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  145|      0|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  125|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  135|      0|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4981:9): [True: 0, False: 0]
  ------------------
 4982|      0|        case ASN_OPAQUE_U64:
  ------------------
  |  |  181|      0|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  125|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  139|      0|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4982:9): [True: 0, False: 0]
  ------------------
 4983|      0|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4984|      0|        case ASN_COUNTER64:
  ------------------
  |  |   99|      0|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4984:9): [True: 0, False: 0]
  ------------------
 4985|      0|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4986|      0|            vp->val_len = sizeof(struct counter64);
 4987|      0|            p = asn_parse_unsigned_int64(var_val, &len, &vp->type,
 4988|      0|                                     (struct counter64 *) vp->val.
 4989|      0|                                     counter64, vp->val_len);
 4990|      0|            if (!p)
  ------------------
  |  Branch (4990:17): [True: 0, False: 0]
  ------------------
 4991|      0|                goto fail;
 4992|      0|            break;
 4993|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4994|      0|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  154|      0|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  125|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4994:9): [True: 0, False: 0]
  ------------------
 4995|      0|            vp->val.floatVal = (float *) vp->buf;
 4996|      0|            vp->val_len = sizeof(float);
 4997|      0|            p = asn_parse_float(var_val, &len, &vp->type,
 4998|      0|                            vp->val.floatVal, vp->val_len);
 4999|      0|            if (!p)
  ------------------
  |  Branch (4999:17): [True: 0, False: 0]
  ------------------
 5000|      0|                goto fail;
 5001|      0|            break;
 5002|      0|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  163|      0|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  125|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  137|      0|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (5002:9): [True: 0, False: 0]
  ------------------
 5003|      0|            vp->val.doubleVal = (double *) vp->buf;
 5004|      0|            vp->val_len = sizeof(double);
 5005|      0|            p = asn_parse_double(var_val, &len, &vp->type,
 5006|      0|                             vp->val.doubleVal, vp->val_len);
 5007|      0|            if (!p)
  ------------------
  |  Branch (5007:17): [True: 0, False: 0]
  ------------------
 5008|      0|                goto fail;
 5009|      0|            break;
 5010|      0|        case ASN_OPAQUE_I64:
  ------------------
  |  |  172|      0|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  125|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  138|      0|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (5010:9): [True: 0, False: 0]
  ------------------
 5011|      0|            vp->val.counter64 = (struct counter64 *) vp->buf;
 5012|      0|            vp->val_len = sizeof(struct counter64);
 5013|      0|            p = asn_parse_signed_int64(var_val, &len, &vp->type,
 5014|      0|                                   (struct counter64 *) vp->val.counter64,
 5015|      0|                                   sizeof(*vp->val.counter64));
 5016|       |
 5017|      0|            if (!p)
  ------------------
  |  Branch (5017:17): [True: 0, False: 0]
  ------------------
 5018|      0|                goto fail;
 5019|      0|            break;
 5020|      0|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 5021|      0|        case ASN_IPADDRESS:
  ------------------
  |  |   88|      0|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (5021:9): [True: 0, False: 0]
  ------------------
 5022|      0|            if (vp->val_len != 4)
  ------------------
  |  Branch (5022:17): [True: 0, False: 0]
  ------------------
 5023|      0|                goto fail;
 5024|      0|            NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2449|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 5025|      0|        case ASN_OCTET_STR:
  ------------------
  |  |   67|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (5025:9): [True: 0, False: 0]
  ------------------
 5026|      0|        case ASN_OPAQUE:
  ------------------
  |  |   93|      0|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (5026:9): [True: 0, False: 0]
  ------------------
 5027|      0|        case ASN_NSAP:
  ------------------
  |  |   98|      0|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (5027:9): [True: 0, False: 0]
  ------------------
 5028|      0|            if (vp->val_len < sizeof(vp->buf)) {
  ------------------
  |  Branch (5028:17): [True: 0, False: 0]
  ------------------
 5029|      0|                vp->val.string = (u_char *) vp->buf;
 5030|      0|            } else {
 5031|      0|                vp->val.string = (u_char *) malloc(vp->val_len);
 5032|      0|            }
 5033|      0|            if (vp->val.string == NULL) {
  ------------------
  |  Branch (5033:17): [True: 0, False: 0]
  ------------------
 5034|      0|                goto fail;
 5035|      0|            }
 5036|      0|            p = asn_parse_string(var_val, &len, &vp->type, vp->val.string,
 5037|      0|                             &vp->val_len);
 5038|      0|            if (!p)
  ------------------
  |  Branch (5038:17): [True: 0, False: 0]
  ------------------
 5039|      0|                goto fail;
 5040|      0|            break;
 5041|      0|        case ASN_OBJECT_ID:
  ------------------
  |  |   70|      0|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (5041:9): [True: 0, False: 0]
  ------------------
 5042|      0|            vp->val_len = MAX_OID_LEN;
  ------------------
  |  |  120|      0|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 5043|      0|            p = asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len);
 5044|      0|            if (!p)
  ------------------
  |  Branch (5044:17): [True: 0, False: 0]
  ------------------
 5045|      0|                goto fail;
 5046|      0|            vp->val_len *= sizeof(oid);
 5047|      0|            vp->val.objid = netsnmp_memdup(objid, vp->val_len);
 5048|      0|            if (vp->val.objid == NULL)
  ------------------
  |  Branch (5048:17): [True: 0, False: 0]
  ------------------
 5049|      0|                goto fail;
 5050|      0|            break;
 5051|      0|        case SNMP_NOSUCHOBJECT:
  ------------------
  |  |  201|      0|#define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   84|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (5051:9): [True: 0, False: 0]
  ------------------
 5052|      0|        case SNMP_NOSUCHINSTANCE:
  ------------------
  |  |  202|      0|#define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   84|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (5052:9): [True: 0, False: 0]
  ------------------
 5053|      0|        case SNMP_ENDOFMIBVIEW:
  ------------------
  |  |  203|      0|#define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   84|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (5053:9): [True: 0, False: 0]
  ------------------
 5054|      0|        case ASN_NULL:
  ------------------
  |  |   68|      0|#define ASN_NULL	    0x05U
  ------------------
  |  Branch (5054:9): [True: 0, False: 0]
  ------------------
 5055|      0|            break;
 5056|      0|        case ASN_BIT_STR:
  ------------------
  |  |   66|      0|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (5056:9): [True: 0, False: 0]
  ------------------
 5057|      0|            vp->val.bitstring = (u_char *) malloc(vp->val_len);
 5058|      0|            if (vp->val.bitstring == NULL) {
  ------------------
  |  Branch (5058:17): [True: 0, False: 0]
  ------------------
 5059|      0|                goto fail;
 5060|      0|            }
 5061|      0|            p = asn_parse_bitstring(var_val, &len, &vp->type,
 5062|      0|                                vp->val.bitstring, &vp->val_len);
 5063|      0|            if (!p)
  ------------------
  |  Branch (5063:17): [True: 0, False: 0]
  ------------------
 5064|      0|                goto fail;
 5065|      0|            break;
 5066|      0|        default:
  ------------------
  |  Branch (5066:9): [True: 0, False: 0]
  ------------------
 5067|      0|            snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type);
 5068|      0|            goto fail;
 5069|      0|            break;
 5070|      0|        }
 5071|      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]
  |  |  ------------------
  ------------------
 5072|       |
 5073|      0|        if (NULL == vplast) {
  ------------------
  |  Branch (5073:13): [True: 0, False: 0]
  ------------------
 5074|      0|            pdu->variables = vp;
 5075|      0|        } else {
 5076|      0|            vplast->next_variable = vp;
 5077|      0|        }
 5078|      0|        vplast = vp;
 5079|      0|        vp = NULL;
 5080|      0|    }
 5081|      0|    return 0;
 5082|       |
 5083|      0|  fail:
 5084|      0|    {
 5085|      0|        const char *errstr = snmp_api_errstring(SNMPERR_SUCCESS);
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5086|      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]
  |  |  ------------------
  ------------------
 5087|      0|    }
 5088|       |    /** if we were parsing a var, remove it from the pdu and free it */
 5089|      0|    if (vp)
  ------------------
  |  Branch (5089:9): [True: 0, False: 0]
  ------------------
 5090|      0|        snmp_free_var(vp);
 5091|       |
 5092|      0|    return -1;
 5093|      0|}
snmpv3_scopedPDU_parse:
 5104|     25|{
 5105|     25|    u_char          tmp_buf[SNMP_MAX_MSG_SIZE];
 5106|     25|    size_t          tmp_buf_len;
 5107|     25|    u_char          type;
 5108|     25|    size_t          asn_len;
 5109|     25|    u_char         *data;
 5110|       |
 5111|     25|    pdu->command = 0;           /* initialize so we know if it got parsed */
 5112|     25|    asn_len = *length;
 5113|     25|    data = asn_parse_sequence(cp, &asn_len, &type,
 5114|     25|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   73|     25|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   85|     25|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 5115|     25|                              "plaintext scopedPDU");
 5116|     25|    if (data == NULL) {
  ------------------
  |  Branch (5116:9): [True: 10, False: 15]
  ------------------
 5117|     10|        return NULL;
 5118|     10|    }
 5119|     15|    *length -= data - cp;
 5120|       |
 5121|       |    /*
 5122|       |     * contextEngineID from scopedPdu  
 5123|       |     */
 5124|     15|    DEBUGDUMPHEADER("recv", "contextEngineID");
  ------------------
  |  |   79|     15|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     15|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 15]
  |  |  ------------------
  ------------------
 5125|     15|    data = asn_parse_string(data, length, &type, pdu->contextEngineID,
 5126|     15|                            &pdu->contextEngineIDLen);
 5127|     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]
  |  |  ------------------
  ------------------
 5128|     15|    if (data == NULL) {
  ------------------
  |  Branch (5128:9): [True: 5, False: 10]
  ------------------
 5129|      5|        ERROR_MSG("error parsing contextEngineID from scopedPdu");
  ------------------
  |  |  188|      5|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 5130|      5|        return NULL;
 5131|      5|    }
 5132|       |
 5133|       |    /*
 5134|       |     * parse contextName from scopedPdu
 5135|       |     */
 5136|     10|    tmp_buf_len = SNMP_MAX_CONTEXT_SIZE;
  ------------------
  |  |  113|     10|#define SNMP_MAX_CONTEXT_SIZE      256
  ------------------
 5137|     10|    DEBUGDUMPHEADER("recv", "contextName");
  ------------------
  |  |   79|     10|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     10|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 10]
  |  |  ------------------
  ------------------
 5138|     10|    data = asn_parse_string(data, length, &type, tmp_buf, &tmp_buf_len);
 5139|     10|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     10|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     10|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 10]
  |  |  ------------------
  ------------------
 5140|     10|    if (data == NULL) {
  ------------------
  |  Branch (5140:9): [True: 0, False: 10]
  ------------------
 5141|      0|        ERROR_MSG("error parsing contextName from scopedPdu");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 5142|      0|        return NULL;
 5143|      0|    }
 5144|       |
 5145|     10|    SNMP_FREE(pdu->contextName);
  ------------------
  |  |   62|     10|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 10]
  |  |  |  Branch (62:66): [Folded, False: 10]
  |  |  ------------------
  ------------------
 5146|     10|    pdu->contextName = netsnmp_memdup_nt(tmp_buf, tmp_buf_len,
 5147|     10|                                         &pdu->contextNameLen);
 5148|     10|    if (pdu->contextName == NULL) {
  ------------------
  |  Branch (5148:9): [True: 0, False: 10]
  ------------------
 5149|      0|        ERROR_MSG("error copying contextName from scopedPdu");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 5150|      0|        return NULL;
 5151|      0|    }
 5152|       |
 5153|       |    /*
 5154|       |     * Get the PDU type 
 5155|       |     */
 5156|     10|    asn_len = *length;
 5157|     10|    cp = asn_parse_header(data, &asn_len, &type);
 5158|     10|    if (cp == NULL)
  ------------------
  |  Branch (5158:9): [True: 0, False: 10]
  ------------------
 5159|      0|        return NULL;
 5160|       |
 5161|     10|    pdu->command = type;
 5162|       |
 5163|     10|    return data;
 5164|     10|}
_build_initial_pdu_packet:
 5210|      3|{
 5211|      3|    netsnmp_session *session;
 5212|      3|    struct snmp_internal_session *isp;
 5213|      3|    netsnmp_transport *transport = NULL;
 5214|      3|    u_char         *pktbuf = NULL, *packet = NULL;
 5215|      3|    size_t          pktbuf_len = 0, length = 0, orig_length = 0;
 5216|      3|    int             result, orig_count = 0, curr_count = 0;
 5217|       |
 5218|      3|    if (slp == NULL) {
  ------------------
  |  Branch (5218:9): [True: 0, False: 3]
  ------------------
 5219|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5220|      0|    }
 5221|      3|    session = slp->session;
 5222|       |
 5223|      3|    isp = slp->internal;
 5224|      3|    transport = slp->transport;
 5225|      3|    if (!session || !isp || !transport) {
  ------------------
  |  Branch (5225:9): [True: 0, False: 3]
  |  Branch (5225:21): [True: 0, False: 3]
  |  Branch (5225:29): [True: 0, False: 3]
  ------------------
 5226|      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]
  |  |  ------------------
  ------------------
 5227|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5228|      0|    }
 5229|       |
 5230|      3|    if (pdu == NULL) {
  ------------------
  |  Branch (5230:9): [True: 0, False: 3]
  ------------------
 5231|      0|        session->s_snmp_errno = SNMPERR_NULL_PDU;
  ------------------
  |  |  243|      0|#define SNMPERR_NULL_PDU		(-59)
  ------------------
 5232|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5233|      0|    }
 5234|       |
 5235|      3|    SNMP_FREE(isp->obuf); /* should already be NULL */
  ------------------
  |  |   62|      3|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 3]
  |  |  |  Branch (62:66): [Folded, False: 3]
  |  |  ------------------
  ------------------
 5236|       |
 5237|      3|    session->s_snmp_errno = 0;
 5238|      3|    session->s_errno = 0;
 5239|       |
 5240|       |    /*
 5241|       |     * Check/setup the version.  
 5242|       |     */
 5243|      3|    if (pdu->version == SNMP_DEFAULT_VERSION) {
  ------------------
  |  |   90|      3|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (5243:9): [True: 0, False: 3]
  ------------------
 5244|      0|        if (session->version == SNMP_DEFAULT_VERSION) {
  ------------------
  |  |   90|      0|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (5244:13): [True: 0, False: 0]
  ------------------
 5245|      0|            session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 5246|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5247|      0|        }
 5248|      0|        pdu->version = session->version;
 5249|      3|    } else if (session->version == SNMP_DEFAULT_VERSION) {
  ------------------
  |  |   90|      3|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (5249:16): [True: 3, False: 0]
  ------------------
 5250|       |        /*
 5251|       |         * It's OK  
 5252|       |         */
 5253|      3|    } else if (pdu->version != session->version) {
  ------------------
  |  Branch (5253:16): [True: 0, False: 0]
  ------------------
 5254|       |        /*
 5255|       |         * ENHANCE: we should support multi-lingual sessions  
 5256|       |         */
 5257|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 5258|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5259|      0|    }
 5260|      3|    if (NETSNMP_RUNTIME_PROTOCOL_SKIP(pdu->version)) {
  ------------------
  |  |  246|      3|    (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||        \
  |  |  ------------------
  |  |  |  |  205|      6|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|      6|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  206|      6|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (206:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  207|      0|                            NETSNMP_DS_LIB_DISABLE_V1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|      0|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  247|      3|     NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver) ||        \
  |  |  ------------------
  |  |  |  |  215|      6|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|      6|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  216|      6|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (216:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  217|      0|                            NETSNMP_DS_LIB_DISABLE_V2c))
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|#define NETSNMP_DS_LIB_DISABLE_V2c         44 /* disable SNMPv2c */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  248|      3|     NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver))
  |  |  ------------------
  |  |  |  |  229|      3|    ((pc_ver == SNMP_VERSION_3) &&                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|      3|#define SNMP_VERSION_3     3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (229:6): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  230|      3|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      3|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (230:6): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  231|      3|                            NETSNMP_DS_LIB_DISABLE_V3))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|      3|#define NETSNMP_DS_LIB_DISABLE_V3          45 /* disable SNMPv3 */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5261|      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]
  |  |  ------------------
  ------------------
 5262|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 5263|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5264|      0|    }
 5265|       |
 5266|       |    /*
 5267|       |     * do we expect a response?
 5268|       |     */
 5269|      3|    switch (pdu->command) {
 5270|       |
 5271|      0|        case SNMP_MSG_RESPONSE:
  ------------------
  |  |  127|      0|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (5271:9): [True: 0, False: 3]
  ------------------
 5272|      0|        case SNMP_MSG_TRAP:
  ------------------
  |  |  135|      0|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (5272:9): [True: 0, False: 3]
  ------------------
 5273|      0|        case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|      0|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (5273:9): [True: 0, False: 3]
  ------------------
 5274|      3|        case SNMP_MSG_REPORT:
  ------------------
  |  |  147|      3|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   81|      3|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (5274:9): [True: 3, False: 0]
  ------------------
 5275|      3|        case AGENTX_MSG_CLEANUPSET:
  ------------------
  |  |   45|      3|#define AGENTX_MSG_CLEANUPSET ((u_char)11)
  ------------------
  |  Branch (5275:9): [True: 0, False: 3]
  ------------------
 5276|      3|        case AGENTX_MSG_RESPONSE:
  ------------------
  |  |   52|      3|#define AGENTX_MSG_RESPONSE    ((u_char)18)
  ------------------
  |  Branch (5276:9): [True: 0, False: 3]
  ------------------
 5277|      3|            pdu->flags &= ~UCD_MSG_FLAG_EXPECT_RESPONSE;
  ------------------
  |  |  312|      3|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
 5278|      3|            break;
 5279|       |            
 5280|      0|        default:
  ------------------
  |  Branch (5280:9): [True: 0, False: 3]
  ------------------
 5281|      0|            pdu->flags |= UCD_MSG_FLAG_EXPECT_RESPONSE;
  ------------------
  |  |  312|      0|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
 5282|      0|            break;
 5283|      3|    }
 5284|       |
 5285|       |    /*
 5286|       |     * Check if we need to perform a v3 engineID probe. Call post probe hook to
 5287|       |     * create user from information in a session even if SNMP_FLAGS_DONT_PROBE
 5288|       |     * is set, as this may indicate that probe was already sent by other means
 5289|       |     * for example asynchronously.
 5290|       |     */
 5291|      3|    if ((pdu->version == SNMP_VERSION_3) &&
  ------------------
  |  |  113|      3|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (5291:9): [True: 3, False: 0]
  ------------------
 5292|      3|        (pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE)) {
  ------------------
  |  |  312|      3|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
  |  Branch (5292:9): [True: 0, False: 3]
  ------------------
 5293|      0|        int rc;
 5294|      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]
  |  |  ------------------
  ------------------
 5295|      0|        rc = snmpv3_engineID_probe(slp, session);
 5296|      0|        if (rc == 0)
  ------------------
  |  Branch (5296:13): [True: 0, False: 0]
  ------------------
 5297|      0|            return 0; /* s_snmp_errno already set */
 5298|      0|    }
 5299|       |
 5300|       |    /*
 5301|       |     * determine max packet size
 5302|       |     */
 5303|      3|    if (pdu->msgMaxSize == 0) {
  ------------------
  |  Branch (5303:9): [True: 0, False: 3]
  ------------------
 5304|      0|        pdu->msgMaxSize = netsnmp_max_send_msg_size();
 5305|      0|        if (pdu->msgMaxSize > transport->msgMaxSize)
  ------------------
  |  Branch (5305:13): [True: 0, False: 0]
  ------------------
 5306|      0|            pdu->msgMaxSize = transport->msgMaxSize;
 5307|      0|        if (pdu->msgMaxSize > session->sndMsgMaxSize)
  ------------------
  |  Branch (5307:13): [True: 0, False: 0]
  ------------------
 5308|      0|            pdu->msgMaxSize = session->sndMsgMaxSize;
 5309|      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]
  |  |  ------------------
  ------------------
 5310|      0|                    pdu->msgMaxSize));
 5311|      0|    }
 5312|      3|    netsnmp_assert(pdu->msgMaxSize > 0);
  ------------------
  |  |   47|      3|#      define netsnmp_assert(x)  do { \
  |  |   48|      3|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 3, False: 0]
  |  |  ------------------
  |  |   49|      3|                 ; \
  |  |   50|      3|              else \
  |  |   51|      3|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      3|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 3]
  |  |  ------------------
  ------------------
 5313|       |
 5314|       |    /*
 5315|       |     * allocate initial packet buffer. Buffer will be grown as needed
 5316|       |     * while building the packet.
 5317|       |     */
 5318|      3|    pktbuf_len = SNMP_MIN_MAX_LEN;
  ------------------
  |  |   48|      3|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
 5319|      3|    if ((pktbuf = (u_char *)malloc(pktbuf_len)) == NULL) {
  ------------------
  |  Branch (5319:9): [True: 0, False: 3]
  ------------------
 5320|      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]
  |  |  ------------------
  ------------------
 5321|      0|                    "couldn't malloc initial packet buffer\n"));
 5322|      0|        session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 5323|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 5324|      0|    }
 5325|       |
 5326|       |#ifdef TEMPORARILY_DISABLED
 5327|       |    /*
 5328|       |     *  NULL variable are allowed in certain PDU types.
 5329|       |     *  In particular, SNMPv3 engineID probes are of this form.
 5330|       |     *  There is an internal PDU flag to indicate that this
 5331|       |     *    is acceptable, but until the construction of engineID
 5332|       |     *    probes can be amended to set this flag, we'll simply
 5333|       |     *    skip this test altogether.
 5334|       |     */
 5335|       |    if (pdu->variables == NULL) {
 5336|       |        switch (pdu->command) {
 5337|       |#ifndef NETSNMP_NO_WRITE_SUPPORT
 5338|       |        case SNMP_MSG_SET:
 5339|       |#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 5340|       |        case SNMP_MSG_GET:
 5341|       |        case SNMP_MSG_GETNEXT:
 5342|       |        case SNMP_MSG_GETBULK:
 5343|       |        case SNMP_MSG_RESPONSE:
 5344|       |        case SNMP_MSG_TRAP2:
 5345|       |        case SNMP_MSG_REPORT:
 5346|       |        case SNMP_MSG_INFORM:
 5347|       |            session->s_snmp_errno = snmp_errno = SNMPERR_NO_VARS;
 5348|       |            return SNMPERR_NO_VARS;
 5349|       |        case SNMP_MSG_TRAP:
 5350|       |            break;
 5351|       |        }
 5352|       |    }
 5353|       |#endif
 5354|       |
 5355|       |
 5356|       |    /*
 5357|       |     * Build the message to send. If a bulk response is too big, switch to
 5358|       |     * forward encoding and set a flag to drop varbinds to make it fit.
 5359|       |     */
 5360|      3|    do {
 5361|      3|        packet = NULL;
 5362|      3|        length = 0;
 5363|      3|        result = netsnmp_build_packet(isp, session, pdu, &pktbuf, &pktbuf_len,
 5364|      3|                                      &packet, &length);
 5365|      3|        if (0 != result)
  ------------------
  |  Branch (5365:13): [True: 0, False: 3]
  ------------------
 5366|      0|            break;
 5367|       |
 5368|      3|        if (orig_count) { /* 2nd pass, see how many varbinds remain */
  ------------------
  |  Branch (5368:13): [True: 0, False: 3]
  ------------------
 5369|      0|            curr_count = count_varbinds(pdu->variables);
 5370|      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]
  |  |  ------------------
  ------------------
 5371|      0|                        curr_count));
 5372|      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]
  |  |  ------------------
  ------------------
 5373|      0|                        orig_length, length, pdu->msgMaxSize));
 5374|      0|        }
 5375|       |
 5376|       |        /** if length is less than max size, we're done (success). */
 5377|      3|        if (length <= pdu->msgMaxSize)
  ------------------
  |  Branch (5377:13): [True: 3, False: 0]
  ------------------
 5378|      3|            break;
 5379|       |
 5380|      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]
  |  |  ------------------
  ------------------
 5381|      0|                    length, pdu->msgMaxSize));
 5382|       |
 5383|       |        /** packet too big. if this is not a bulk request, we're done (err). */
 5384|      0|        if (!bulk) {
  ------------------
  |  Branch (5384:13): [True: 0, False: 0]
  ------------------
 5385|      0|           session->s_snmp_errno = SNMPERR_TOO_LONG;
  ------------------
  |  |  189|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 5386|      0|           break;
 5387|      0|        }
 5388|       |
 5389|       |        /** rebuild bulk response with truncation and fixed size */
 5390|      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
  ------------------
 5391|      0|        pktbuf_len = pdu->msgMaxSize;
 5392|       |
 5393|       |        /** save original number of varbinds & length */
 5394|      0|        if (0 == orig_count) {
  ------------------
  |  Branch (5394:13): [True: 0, False: 0]
  ------------------
 5395|      0|            curr_count = orig_count = count_varbinds(pdu->variables);
 5396|      0|            orig_length = length;
 5397|      0|        }
 5398|       |
 5399|      0|    } while(1);
  ------------------
  |  Branch (5399:13): [True: 0, Folded]
  ------------------
 5400|       |
 5401|      3|    DEBUGMSGTL(("sess_async_send",
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 3]
  |  |  ------------------
  ------------------
 5402|      3|                "final pktbuf_len after building packet %" NETSNMP_PRIz "u\n",
 5403|      3|                pktbuf_len));
 5404|      3|    if (curr_count != orig_count)
  ------------------
  |  Branch (5404:9): [True: 0, False: 3]
  ------------------
 5405|      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]
  |  |  ------------------
  ------------------
 5406|      3|                    "sending %d of %d varbinds (-%d) from bulk response\n",
 5407|      3|                    curr_count, orig_count, orig_count - curr_count));
 5408|       |
 5409|      3|    if (length > pdu->msgMaxSize) {
  ------------------
  |  Branch (5409:9): [True: 0, False: 3]
  ------------------
 5410|      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]
  |  |  ------------------
  ------------------
 5411|      0|                    "length of packet (%" NETSNMP_PRIz "u) exceeded pdu maximum (%lu)\n",
 5412|      0|                    length, pdu->msgMaxSize));
 5413|      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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5414|      0|    }
 5415|       |
 5416|      3|    if ((SNMPERR_TOO_LONG == session->s_snmp_errno) || (result < 0)) {
  ------------------
  |  |  189|      3|#define SNMPERR_TOO_LONG		(-5)
  ------------------
  |  Branch (5416:9): [True: 0, False: 3]
  |  Branch (5416:56): [True: 0, False: 3]
  ------------------
 5417|      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]
  |  |  ------------------
  ------------------
 5418|      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]
  |  |  ------------------
  ------------------
 5419|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5420|      0|    }
 5421|       |
 5422|      3|    isp->obuf = pktbuf;
 5423|      3|    isp->obuf_size = pktbuf_len;
 5424|      3|    isp->opacket = packet;
 5425|      3|    isp->opacket_len = length;
 5426|       |
 5427|      3|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|      3|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5428|      3|}
snmp_sess_send:
 5460|      3|{
 5461|      3|    return snmp_sess_async_send(slp, pdu, NULL, NULL);
 5462|      3|}
snmp_sess_async_send:
 5677|      3|{
 5678|       |
 5679|      3|    return snmp_sess_async_send_cp(slp, pdu, callback, cb_data, 0);
 5680|      3|}
snmp_sess_async_send_cp:
 5686|      3|{
 5687|      3|    int             rc;
 5688|       |
 5689|      3|    if (slp == NULL) {
  ------------------
  |  Branch (5689:9): [True: 0, False: 3]
  ------------------
 5690|      0|        snmp_errno = SNMPERR_BAD_SESSION;       /*MTCRITICAL_RESOURCE */
  ------------------
  |  |  188|      0|#define SNMPERR_BAD_SESSION		(-4)
  ------------------
 5691|      0|        return (0);
 5692|      0|    }
 5693|       |    /*
 5694|       |     * send pdu
 5695|       |     */
 5696|       |
 5697|      3|    rc = _sess_async_send(slp, pdu, callback, cb_data, cp_inc);
 5698|      3|    if (rc == 0)
  ------------------
  |  Branch (5698:9): [True: 0, False: 3]
  ------------------
 5699|      0|        SET_SNMP_ERROR(slp->session->s_snmp_errno);
  ------------------
  |  |   43|      0|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 5700|      3|    return rc;
 5701|      3|}
snmp_free_var_internals:
 5709|      3|{
 5710|      3|    if (!var)
  ------------------
  |  Branch (5710:9): [True: 0, False: 3]
  ------------------
 5711|      0|        return;
 5712|       |
 5713|      3|    if (var->name != var->name_loc)
  ------------------
  |  Branch (5713:9): [True: 0, False: 3]
  ------------------
 5714|      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]
  |  |  ------------------
  ------------------
 5715|      3|    if (var->val.string != var->buf)
  ------------------
  |  Branch (5715:9): [True: 0, False: 3]
  ------------------
 5716|      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]
  |  |  ------------------
  ------------------
 5717|      3|    if (var->data) {
  ------------------
  |  Branch (5717:9): [True: 0, False: 3]
  ------------------
 5718|      0|        if (var->dataFreeHook) {
  ------------------
  |  Branch (5718:13): [True: 0, False: 0]
  ------------------
 5719|      0|            var->dataFreeHook(var->data);
 5720|      0|            var->data = NULL;
 5721|      0|        } else {
 5722|       |            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]
  |  |  ------------------
  ------------------
 5723|      0|        }
 5724|      0|    }
 5725|      3|}
snmp_free_var:
 5729|      3|{
 5730|      3|    snmp_free_var_internals(var);
 5731|      3|    free(var);
 5732|      3|}
snmp_free_varbind:
 5736|    432|{
 5737|    432|    netsnmp_variable_list *ptr;
 5738|    435|    while (var) {
  ------------------
  |  Branch (5738:12): [True: 3, False: 432]
  ------------------
 5739|      3|        ptr = var->next_variable;
 5740|      3|        snmp_free_var(var);
 5741|      3|        var = ptr;
 5742|      3|    }
 5743|    432|}
snmp_free_pdu:
 5750|    429|{
 5751|    429|    struct snmp_secmod_def *sptr;
 5752|       |
 5753|    429|    if (!pdu)
  ------------------
  |  Branch (5753:9): [True: 0, False: 429]
  ------------------
 5754|      0|        return;
 5755|       |
 5756|    429|    free_securityStateRef(pdu);
 5757|       |
 5758|    429|    sptr = find_sec_mod(pdu->securityModel);
 5759|    429|    if (sptr && sptr->pdu_free)
  ------------------
  |  Branch (5759:9): [True: 28, False: 401]
  |  Branch (5759:17): [True: 0, False: 28]
  ------------------
 5760|      0|        (*sptr->pdu_free)(pdu);
 5761|       |
 5762|    429|    snmp_free_varbind(pdu->variables);
 5763|    429|    free(pdu->enterprise);
 5764|    429|    free(pdu->community);
 5765|    429|    free(pdu->contextEngineID);
 5766|    429|    free(pdu->securityEngineID);
 5767|    429|    free(pdu->contextName);
 5768|    429|    free(pdu->securityName);
 5769|    429|    free(pdu->transport_data);
 5770|    429|    free(pdu);
 5771|    429|}
snmp_create_sess_pdu:
 5776|    426|{
 5777|    426|    netsnmp_pdu *pdu = calloc(1, sizeof(netsnmp_pdu));
 5778|    426|    if (pdu == NULL) {
  ------------------
  |  Branch (5778:9): [True: 0, False: 426]
  ------------------
 5779|      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]
  |  |  ------------------
  ------------------
 5780|      0|        return NULL;
 5781|      0|    }
 5782|       |
 5783|       |    /*
 5784|       |     * Save the transport-level data specific to this reception (e.g. UDP
 5785|       |     * source address).  
 5786|       |     */
 5787|       |
 5788|    426|    pdu->transport_data = opaque;
 5789|    426|    pdu->transport_data_length = olength;
 5790|    426|    pdu->tDomain = transport->domain;
 5791|    426|    pdu->tDomainLen = transport->domain_length;
 5792|    426|    return pdu;
 5793|    426|}
snmp_read:
 6333|     65|{
 6334|     65|    netsnmp_large_fd_set lfdset;
 6335|       |
 6336|       |    netsnmp_large_fd_set_init(&lfdset, FD_SETSIZE);
 6337|     65|    netsnmp_copy_fd_set_to_large_fd_set(&lfdset, fdset);
 6338|     65|    snmp_read2(&lfdset);
 6339|     65|    netsnmp_large_fd_set_cleanup(&lfdset);
 6340|     65|}
snmp_read2:
 6344|     65|{
 6345|     65|    struct session_list *slp, *next;
 6346|       |
 6347|     65|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     65|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 65]
  |  |  ------------------
  ------------------
 6348|    130|    for (slp = Sessions; slp; slp = next) {
  ------------------
  |  Branch (6348:26): [True: 65, False: 65]
  ------------------
 6349|     65|        next = slp->next;
 6350|     65|        if (_sess_packet_deadline_expired(slp->internal)) {
  ------------------
  |  Branch (6350:13): [True: 0, False: 65]
  ------------------
 6351|      0|            _sess_close_stream(slp);
 6352|      0|            continue;
 6353|      0|        }
 6354|     65|        snmp_sess_read2(slp, fdset);
 6355|     65|    }
 6356|     65|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     65|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 65]
  |  |  ------------------
  ------------------
 6357|     65|}
_sess_read:
 6857|     65|{
 6858|     65|    netsnmp_transport *transport;
 6859|       |
 6860|     65|    if (!slp || !fdset)
  ------------------
  |  Branch (6860:9): [True: 0, False: 65]
  |  Branch (6860:17): [True: 0, False: 65]
  ------------------
 6861|      0|        return 0;
 6862|       |
 6863|     65|    transport = slp->transport;
 6864|       |
 6865|     65|    if (!transport || !NETSNMP_LARGE_FD_ISSET(transport->sock, fdset)) {
  ------------------
  |  |   50|     65|                    netsnmp_large_fd_is_set(fd, fdset)
  ------------------
  |  Branch (6865:9): [True: 0, False: 65]
  |  Branch (6865:23): [True: 0, False: 65]
  ------------------
 6866|      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]
  |  |  ------------------
  ------------------
 6867|      0|        return 0;
 6868|      0|    }
 6869|       |
 6870|     65|    return __sess_read(slp);
 6871|     65|}
snmp_sess_read2:
 6893|     65|{
 6894|     65|    netsnmp_session *pss;
 6895|     65|    int             rc;
 6896|       |
 6897|     65|    rc = _sess_read(slp, fdset);
 6898|     65|    pss = slp->session;
 6899|     65|    if (rc && pss->s_snmp_errno) {
  ------------------
  |  Branch (6899:9): [True: 26, False: 39]
  |  Branch (6899:15): [True: 26, False: 0]
  ------------------
 6900|     26|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   43|     26|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 6901|     26|    }
 6902|     65|    return rc;
 6903|     65|}
snmp_select_info:
 6968|     65|{
 6969|       |    return snmp_sess_select_info(NULL, numfds, fdset, timeout, block);
 6970|     65|}
snmp_sess_select_info:
 6988|     65|{
 6989|     65|    return snmp_sess_select_info_flags(slp, numfds, fdset, timeout, block,
 6990|     65|                                       NETSNMP_SELECT_NOFLAGS);
  ------------------
  |  |  198|     65|#define NETSNMP_SELECT_NOFLAGS  0x00
  ------------------
 6991|     65|}
snmp_sess_select_info_flags:
 6999|     65|{
 7000|     65|  int rc;
 7001|     65|  netsnmp_large_fd_set lfdset;
 7002|       |
 7003|     65|  netsnmp_large_fd_set_init(&lfdset, FD_SETSIZE);
 7004|     65|  netsnmp_copy_fd_set_to_large_fd_set(&lfdset, fdset);
 7005|     65|  rc = snmp_sess_select_info2_flags(slp, numfds, &lfdset, timeout,
 7006|     65|                                    block, flags);
 7007|     65|  if (netsnmp_copy_large_fd_set_to_fd_set(fdset, &lfdset) < 0) {
  ------------------
  |  Branch (7007:7): [True: 0, False: 65]
  ------------------
 7008|       |      snmp_log(LOG_ERR,
 7009|      0|	     "Use snmp_sess_select_info2() for processing"
 7010|      0|	     " large file descriptors\n");
 7011|      0|  }
 7012|     65|  netsnmp_large_fd_set_cleanup(&lfdset);
 7013|     65|  return rc;
 7014|     65|}
snmp_sess_select_info2_flags:
 7058|     65|{
 7059|     65|    struct session_list *slp, *next = NULL;
 7060|     65|    netsnmp_request_list *rp;
 7061|     65|    struct timeval  now, earliest, alarm_tm;
 7062|     65|    int             active = 0, requests = 0;
 7063|     65|    int             next_alarm = 0;
 7064|     65|    int             has_pending_data = 0;
 7065|     65|    int             packet_deadlines = 0;
 7066|       |
 7067|     65|    timerclear(&earliest);
 7068|       |
 7069|       |    /*
 7070|       |     * For each session examined, add its socket to the fdset,
 7071|       |     * and if it is the earliest timeout to expire, mark it as lowest.
 7072|       |     * If a single session is specified, do just for that session.
 7073|       |     */
 7074|       |
 7075|     65|    DEBUGMSGTL(("sess_select", "for %s session%s: ",
  ------------------
  |  |   66|     65|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 65]
  |  |  ------------------
  ------------------
 7076|     65|                sessp ? "single" : "all", sessp ? "" : "s"));
 7077|       |
 7078|    130|    for (slp = sessp ? sessp : Sessions; slp; slp = next) {
  ------------------
  |  Branch (7078:16): [True: 0, False: 65]
  |  Branch (7078:42): [True: 65, False: 65]
  ------------------
 7079|     65|        next = slp->next;
 7080|       |
 7081|     65|        if (slp->transport == NULL) {
  ------------------
  |  Branch (7081:13): [True: 0, False: 65]
  ------------------
 7082|       |            /*
 7083|       |             * Close in progress -- skip this one.  
 7084|       |             */
 7085|      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]
  |  |  ------------------
  ------------------
 7086|      0|            continue;
 7087|      0|        }
 7088|       |
 7089|     65|        if (!NETSNMP_IS_VALID_SOCKET(slp->transport->sock)) {
  ------------------
  |  |   44|     65|#define NETSNMP_IS_VALID_SOCKET(_sock) ((_sock) != -1)
  ------------------
  |  Branch (7089:13): [True: 0, False: 65]
  ------------------
 7090|       |            /*
 7091|       |             * This session was marked for deletion.  
 7092|       |             */
 7093|      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]
  |  |  ------------------
  ------------------
 7094|      0|            if (sessp == NULL) {
  ------------------
  |  Branch (7094:17): [True: 0, False: 0]
  ------------------
 7095|      0|                snmp_close(slp->session);
 7096|      0|            } else {
 7097|      0|                snmp_sess_close(slp);
 7098|      0|            }
 7099|      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]
  |  |  ------------------
  ------------------
 7100|      0|                        sessp ? "single" : "all", sessp ? "" : "s"));
 7101|      0|            continue;
 7102|      0|        }
 7103|       |
 7104|     65|        DEBUGMSG(("sess_select", "%" NETSNMP_FMT_SKT " ",
  ------------------
  |  |   61|     65|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 65]
  |  |  ------------------
  ------------------
 7105|     65|                  slp->transport->sock));
 7106|     65|        if ((slp->transport->sock + 1) > *numfds) {
  ------------------
  |  Branch (7106:13): [True: 65, False: 0]
  ------------------
 7107|     65|            *numfds = (slp->transport->sock + 1);
 7108|     65|        }
 7109|       |
 7110|     65|        NETSNMP_LARGE_FD_SET(slp->transport->sock, fdset);
  ------------------
  |  |   35|     65|                    netsnmp_large_fd_setfd(fd, fdset)
  ------------------
 7111|     65|        if (slp->transport->f_pending &&
  ------------------
  |  Branch (7111:13): [True: 0, False: 65]
  ------------------
 7112|      0|            slp->transport->f_pending(slp->transport)) {
  ------------------
  |  Branch (7112:13): [True: 0, False: 0]
  ------------------
 7113|      0|            has_pending_data = 1;
 7114|      0|        }
 7115|     65|        if (slp->internal != NULL && slp->internal->requests) {
  ------------------
  |  Branch (7115:13): [True: 65, False: 0]
  |  Branch (7115:38): [True: 0, False: 65]
  ------------------
 7116|       |            /*
 7117|       |             * Found another session with outstanding requests.  
 7118|       |             */
 7119|      0|            requests++;
 7120|      0|            for (rp = slp->internal->requests; rp; rp = rp->next_request) {
  ------------------
  |  Branch (7120:48): [True: 0, False: 0]
  ------------------
 7121|      0|                if (!timerisset(&earliest)
  ------------------
  |  Branch (7121:21): [True: 0, False: 0]
  ------------------
 7122|      0|                    || (timerisset(&rp->expireM)
  ------------------
  |  Branch (7122:25): [True: 0, False: 0]
  ------------------
 7123|      0|                        && timercmp(&rp->expireM, &earliest, <))) {
  ------------------
  |  Branch (7123:28): [True: 0, False: 0]
  |  Branch (7123:28): [True: 0, False: 0]
  ------------------
 7124|      0|                    earliest = rp->expireM;
 7125|      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]
  |  |  ------------------
  ------------------
 7126|      0|                               (int)earliest.tv_sec, (int)earliest.tv_usec));
 7127|      0|                }
 7128|      0|            }
 7129|      0|        }
 7130|     65|        if (slp->internal != NULL &&
  ------------------
  |  Branch (7130:13): [True: 65, False: 0]
  ------------------
 7131|     65|            timerisset(&slp->internal->packet_deadline)) {
  ------------------
  |  Branch (7131:13): [True: 65, False: 0]
  ------------------
 7132|      0|            packet_deadlines++;
 7133|      0|            if (!timerisset(&earliest) ||
  ------------------
  |  Branch (7133:17): [True: 0, False: 0]
  ------------------
 7134|      0|                timercmp(&slp->internal->packet_deadline, &earliest, <))
  ------------------
  |  Branch (7134:17): [True: 0, False: 0]
  |  Branch (7134:17): [True: 0, False: 0]
  ------------------
 7135|      0|                earliest = slp->internal->packet_deadline;
 7136|      0|        }
 7137|       |
 7138|     65|        active++;
 7139|     65|        if (sessp) {
  ------------------
  |  Branch (7139:13): [True: 0, False: 65]
  ------------------
 7140|       |            /*
 7141|       |             * Single session processing.  
 7142|       |             */
 7143|      0|            break;
 7144|      0|        }
 7145|     65|    }
 7146|     65|    DEBUGMSG(("sess_select", "\n"));
  ------------------
  |  |   61|     65|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 65]
  |  |  ------------------
  ------------------
 7147|       |
 7148|     65|    if (has_pending_data) {
  ------------------
  |  Branch (7148:9): [True: 0, False: 65]
  ------------------
 7149|      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]
  |  |  ------------------
  ------------------
 7150|      0|                   "pending transport data present, setting timeout to 0\n"));
 7151|      0|        timerclear(timeout);
 7152|      0|        *block = 0;
 7153|      0|        return active;
 7154|      0|    }
 7155|       |
 7156|     65|    netsnmp_get_monotonic_clock(&now);
 7157|       |
 7158|     65|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     65|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (7158:9): [True: 0, False: 65]
  ------------------
 7159|     65|                               NETSNMP_DS_LIB_ALARM_DONT_USE_SIG) &&
  ------------------
  |  |   71|     65|#define NETSNMP_DS_LIB_ALARM_DONT_USE_SIG  11   /* don't use the alarm() signal */
  ------------------
 7160|      0|        !(flags & NETSNMP_SELECT_NOALARMS)) {
  ------------------
  |  |  199|      0|#define NETSNMP_SELECT_NOALARMS 0x01
  ------------------
  |  Branch (7160:9): [True: 0, False: 0]
  ------------------
 7161|      0|        next_alarm = netsnmp_get_next_alarm_time(&alarm_tm, &now);
 7162|      0|        if (next_alarm)
  ------------------
  |  Branch (7162:13): [True: 0, False: 0]
  ------------------
 7163|      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]
  |  |  ------------------
  ------------------
 7164|      0|                       (long)alarm_tm.tv_sec, (long)alarm_tm.tv_usec));
 7165|      0|    }
 7166|     65|    if (next_alarm == 0 && requests == 0 && packet_deadlines == 0) {
  ------------------
  |  Branch (7166:9): [True: 65, False: 0]
  |  Branch (7166:28): [True: 65, False: 0]
  |  Branch (7166:45): [True: 65, False: 0]
  ------------------
 7167|       |        /*
 7168|       |         * If none are active, skip arithmetic.  
 7169|       |         */
 7170|     65|        DEBUGMSGT(("sess_select","blocking:no session requests or alarms.\n"));
  ------------------
  |  |   62|     65|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 65]
  |  |  ------------------
  ------------------
 7171|     65|        *block = 1; /* can block - timeout value is undefined if no requests */
 7172|     65|        return active;
 7173|     65|    }
 7174|       |
 7175|      0|    if (next_alarm &&
  ------------------
  |  Branch (7175:9): [True: 0, False: 0]
  ------------------
 7176|      0|        (!timerisset(&earliest) || timercmp(&alarm_tm, &earliest, <)))
  ------------------
  |  Branch (7176:10): [True: 0, False: 0]
  |  Branch (7176:36): [True: 0, False: 0]
  |  Branch (7176:36): [True: 0, False: 0]
  ------------------
 7177|      0|        earliest = alarm_tm;
 7178|       |
 7179|      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]
  |  |  ------------------
  ------------------
 7180|      0|    if (earliest.tv_sec < 0) {
  ------------------
  |  Branch (7180:9): [True: 0, False: 0]
  ------------------
 7181|      0|        time_t overdue_ms = -(earliest.tv_sec * 1000 + earliest.tv_usec / 1000);
 7182|      0|        if (overdue_ms >= 10)
  ------------------
  |  Branch (7182:13): [True: 0, False: 0]
  ------------------
 7183|      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]
  |  |  ------------------
  ------------------
 7184|      0|                       (long) overdue_ms));
 7185|      0|        timerclear(&earliest);
 7186|      0|    } else {
 7187|      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]
  |  |  ------------------
  ------------------
 7188|      0|                   (int)earliest.tv_sec, (int)earliest.tv_usec));
 7189|      0|    }
 7190|       |
 7191|       |    /*
 7192|       |     * if it was blocking before or our delta time is less, reset timeout 
 7193|       |     */
 7194|      0|    if ((*block || (timercmp(&earliest, timeout, <)))) {
  ------------------
  |  Branch (7194:10): [True: 0, False: 0]
  |  Branch (7194:20): [True: 0, False: 0]
  |  Branch (7194:21): [True: 0, False: 0]
  ------------------
 7195|      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]
  |  |  ------------------
  ------------------
 7196|      0|                   "setting timer to %d.%06d sec, clear block (was %d)\n",
 7197|      0|                   (int)earliest.tv_sec, (int)earliest.tv_usec, *block));
 7198|      0|        *timeout = earliest;
 7199|      0|        *block = 0;
 7200|      0|    }
 7201|      0|    return active;
 7202|     65|}
snmp_oid_compare:
 7390|    507|{
 7391|    507|    register int    len;
 7392|    507|    register const oid *name1 = in_name1;
 7393|    507|    register const oid *name2 = in_name2;
 7394|       |
 7395|       |    /*
 7396|       |     * len = minimum of len1 and len2 
 7397|       |     */
 7398|    507|    if (len1 < len2)
  ------------------
  |  Branch (7398:9): [True: 0, False: 507]
  ------------------
 7399|      0|        len = len1;
 7400|    507|    else
 7401|    507|        len = len2;
 7402|       |    /*
 7403|       |     * find first non-matching OID 
 7404|       |     */
 7405|  5.23k|    while (len-- > 0) {
  ------------------
  |  Branch (7405:12): [True: 5.07k, False: 169]
  ------------------
 7406|       |        /*
 7407|       |         * these must be done in separate comparisons, since
 7408|       |         * subtracting them and using that result has problems with
 7409|       |         * subids > 2^31. 
 7410|       |         */
 7411|  5.07k|        if (*(name1) != *(name2)) {
  ------------------
  |  Branch (7411:13): [True: 338, False: 4.73k]
  ------------------
 7412|    338|            if (*(name1) < *(name2))
  ------------------
  |  Branch (7412:17): [True: 169, False: 169]
  ------------------
 7413|    169|                return -1;
 7414|    169|            return 1;
 7415|    338|        }
 7416|  4.73k|        name1++;
 7417|  4.73k|        name2++;
 7418|  4.73k|    }
 7419|       |    /*
 7420|       |     * both OIDs equal up to length of shorter OID 
 7421|       |     */
 7422|    169|    if (len1 < len2)
  ------------------
  |  Branch (7422:9): [True: 0, False: 169]
  ------------------
 7423|      0|        return -1;
 7424|    169|    if (len2 < len1)
  ------------------
  |  Branch (7424:9): [True: 0, False: 169]
  ------------------
 7425|      0|        return 1;
 7426|    169|    return 0;
 7427|    169|}
netsnmp_oid_equals:
 7527|  3.64k|{
 7528|  3.64k|    register const oid *name1 = in_name1;
 7529|  3.64k|    register const oid *name2 = in_name2;
 7530|  3.64k|    register int    len = len1;
 7531|       |
 7532|       |    /*
 7533|       |     * len = minimum of len1 and len2 
 7534|       |     */
 7535|  3.64k|    if (len1 != len2)
  ------------------
  |  Branch (7535:9): [True: 2.51k, False: 1.13k]
  ------------------
 7536|  2.51k|        return 1;
 7537|       |    /*
 7538|       |     * Handle 'null' OIDs
 7539|       |     */
 7540|  1.13k|    if (len1 == 0)
  ------------------
  |  Branch (7540:9): [True: 0, False: 1.13k]
  ------------------
 7541|      0|        return 0;   /* Two null OIDs are (trivially) the same */
 7542|  1.13k|    if (!name1 || !name2)
  ------------------
  |  Branch (7542:9): [True: 0, False: 1.13k]
  |  Branch (7542:19): [True: 0, False: 1.13k]
  ------------------
 7543|      0|        return 1;   /* Otherwise something's wrong, so report a non-match */
 7544|       |    /*
 7545|       |     * find first non-matching OID 
 7546|       |     */
 7547|  9.47k|    while (len-- > 0) {
  ------------------
  |  Branch (7547:12): [True: 9.47k, False: 0]
  ------------------
 7548|       |        /*
 7549|       |         * these must be done in separate comparisons, since
 7550|       |         * subtracting them and using that result has problems with
 7551|       |         * subids > 2^31. 
 7552|       |         */
 7553|  9.47k|        if (*(name1++) != *(name2++))
  ------------------
  |  Branch (7553:13): [True: 1.13k, False: 8.34k]
  ------------------
 7554|  1.13k|            return 1;
 7555|  9.47k|    }
 7556|      0|    return 0;
 7557|  1.13k|}
snmp_pdu_add_variable:
 7669|      3|{
 7670|      3|    return snmp_varlist_add_variable(&pdu->variables, name, name_length,
 7671|      3|                                     type, value, len);
 7672|      3|}
snmp_varlist_add_variable:
 7683|      3|{
 7684|      3|    netsnmp_variable_list *vars, *vtmp;
 7685|      3|    int rc;
 7686|       |
 7687|      3|    if (varlist == NULL)
  ------------------
  |  Branch (7687:9): [True: 0, False: 3]
  ------------------
 7688|      0|        return NULL;
 7689|       |
 7690|      3|    vars = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
  ------------------
  |  |   73|      3|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 7691|      3|    if (vars == NULL)
  ------------------
  |  Branch (7691:9): [True: 0, False: 3]
  ------------------
 7692|      0|        return NULL;
 7693|       |
 7694|      3|    vars->type = type;
 7695|       |
 7696|      3|    rc = snmp_set_var_value( vars, value, len );
 7697|      3|    if (( 0 != rc ) ||
  ------------------
  |  Branch (7697:9): [True: 0, False: 3]
  ------------------
 7698|      3|        (name != NULL && snmp_set_var_objid(vars, name, name_length))) {
  ------------------
  |  Branch (7698:10): [True: 3, False: 0]
  |  Branch (7698:26): [True: 0, False: 3]
  ------------------
 7699|      0|        snmp_free_var(vars);
 7700|      0|        return NULL;
 7701|      0|    }
 7702|       |
 7703|       |    /*
 7704|       |     * put only qualified variable onto varlist 
 7705|       |     */
 7706|      3|    if (*varlist == NULL) {
  ------------------
  |  Branch (7706:9): [True: 3, False: 0]
  ------------------
 7707|      3|        *varlist = vars;
 7708|      3|    } else {
 7709|      0|        for (vtmp = *varlist; vtmp->next_variable;
  ------------------
  |  Branch (7709:31): [True: 0, False: 0]
  ------------------
 7710|      0|             vtmp = vtmp->next_variable);
 7711|       |
 7712|      0|        vtmp->next_variable = vars;
 7713|      0|    }
 7714|       |
 7715|      3|    return vars;
 7716|      3|}
snmp_duplicate_objid:
 8394|    396|{
 8395|    396|    oid            *returnOid;
 8396|    396|    if (objToCopy != NULL && objToCopyLen != 0) {
  ------------------
  |  Branch (8396:9): [True: 396, False: 0]
  |  Branch (8396:30): [True: 396, False: 0]
  ------------------
 8397|    396|        returnOid = (oid *) malloc(objToCopyLen * sizeof(oid));
 8398|    396|        if (returnOid) {
  ------------------
  |  Branch (8398:13): [True: 396, False: 0]
  ------------------
 8399|    396|            memcpy(returnOid, objToCopy, objToCopyLen * sizeof(oid));
 8400|    396|        }
 8401|    396|    } else
 8402|      0|        returnOid = NULL;
 8403|    396|    return returnOid;
 8404|    396|}
snmp_increment_statistic:
 8414|    427|{
 8415|    427|    if (which >= 0 && which < NETSNMP_STAT_MAX_STATS) {
  ------------------
  |  |  710|    427|#define  NETSNMP_STAT_MAX_STATS              (STAT_TLSTM_STATS_END+1)
  |  |  ------------------
  |  |  |  |  706|    427|#define  STAT_TLSTM_STATS_END          STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES
  |  |  |  |  ------------------
  |  |  |  |  |  |  703|    427|#define  STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES              56
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (8415:9): [True: 427, False: 0]
  |  Branch (8415:23): [True: 427, False: 0]
  ------------------
 8416|    427|        statistics[which]++;
 8417|    427|        return statistics[which];
 8418|    427|    }
 8419|      0|    return 0;
 8420|    427|}
snmp_get_statistic:
 8434|      3|{
 8435|      3|    if (which >= 0 && which < NETSNMP_STAT_MAX_STATS)
  ------------------
  |  |  710|      3|#define  NETSNMP_STAT_MAX_STATS              (STAT_TLSTM_STATS_END+1)
  |  |  ------------------
  |  |  |  |  706|      3|#define  STAT_TLSTM_STATS_END          STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES
  |  |  |  |  ------------------
  |  |  |  |  |  |  703|      3|#define  STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES              56
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (8435:9): [True: 3, False: 0]
  |  Branch (8435:23): [True: 3, False: 0]
  ------------------
 8436|      3|        return statistics[which];
 8437|      0|    return 0;
 8438|      3|}
snmp_init_statistics:
 8442|     66|{
 8443|     66|    memset(statistics, 0, sizeof(statistics));
 8444|     66|}
snmp_api.c:_init_snmp:
  710|    198|{
  711|       |
  712|    198|    struct timeval  tv;
  713|    198|    long            tmpReqid, tmpMsgid;
  714|       |
  715|    198|    if (_init_snmp_init_done)
  ------------------
  |  Branch (715:9): [True: 132, False: 66]
  ------------------
  716|    132|        return;
  717|     66|    _init_snmp_init_done = 1;
  718|     66|    Reqid = 1;
  719|       |
  720|     66|    snmp_res_init();            /* initialize the mt locking structures */
  ------------------
  |  |   78|     66|#define snmp_res_init() do {} while (0)
  |  |  ------------------
  |  |  |  Branch (78:38): [Folded, False: 66]
  |  |  ------------------
  ------------------
  721|     66|#ifndef NETSNMP_DISABLE_MIB_LOADING
  722|     66|    netsnmp_init_mib_internals();
  723|     66|#endif /* NETSNMP_DISABLE_MIB_LOADING */
  724|     66|    netsnmp_tdomain_init();
  725|       |
  726|     66|    gettimeofday(&tv, (struct timezone *) 0);
  727|       |    /*
  728|       |     * Now = tv;
  729|       |     */
  730|       |
  731|       |    /*
  732|       |     * get pseudo-random values for request ID and message ID 
  733|       |     */
  734|     66|    netsnmp_srandom((unsigned)(tv.tv_sec ^ tv.tv_usec));
  735|     66|    tmpReqid = netsnmp_random();
  736|     66|    tmpMsgid = netsnmp_random();
  737|       |
  738|       |    /*
  739|       |     * don't allow zero value to repeat init 
  740|       |     */
  741|     66|    if (tmpReqid == 0)
  ------------------
  |  Branch (741:9): [True: 0, False: 66]
  ------------------
  742|      0|        tmpReqid = 1;
  743|     66|    if (tmpMsgid == 0)
  ------------------
  |  Branch (743:9): [True: 0, False: 66]
  ------------------
  744|      0|        tmpMsgid = 1;
  745|     66|    Reqid = tmpReqid;
  746|     66|    Msgid = tmpMsgid;
  747|       |
  748|     66|    netsnmp_register_default_domain("snmp", "udp udp6");
  749|     66|    netsnmp_register_default_domain("snmptrap", "udp udp6");
  750|       |
  751|     66|    netsnmp_register_default_target("snmp", "udp", ":161");
  752|     66|    netsnmp_register_default_target("snmp", "tcp", ":161");
  753|     66|    netsnmp_register_default_target("snmp", "udp6", ":161");
  754|     66|    netsnmp_register_default_target("snmp", "tcp6", ":161");
  755|     66|    netsnmp_register_default_target("snmp", "dtlsudp", ":10161");
  756|     66|    netsnmp_register_default_target("snmp", "tlstcp", ":10161");
  757|     66|    netsnmp_register_default_target("snmp", "ipx", "/36879");
  758|       |
  759|     66|    netsnmp_register_default_target("snmptrap", "udp", ":162");
  760|     66|    netsnmp_register_default_target("snmptrap", "tcp", ":162");
  761|     66|    netsnmp_register_default_target("snmptrap", "udp6", ":162");
  762|     66|    netsnmp_register_default_target("snmptrap", "tcp6", ":162");
  763|     66|    netsnmp_register_default_target("snmptrap", "dtlsudp", ":10162");
  764|     66|    netsnmp_register_default_target("snmptrap", "tlstcp", ":10162");
  765|     66|    netsnmp_register_default_target("snmptrap", "ipx", "/36880");
  766|       |
  767|     66|    netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  768|     66|                       NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH, 16);
  ------------------
  |  |  121|     66|#define NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH    6
  ------------------
  769|     66|    netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES,
  ------------------
  |  |  131|     66|#define NETSNMP_DS_LIB_RETRIES             15
  ------------------
  770|     66|                       DEFAULT_RETRIES);
  ------------------
  |  |  191|     66|#define DEFAULT_RETRIES	    5
  ------------------
  771|     66|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  772|     66|			   NETSNMP_DS_LIB_MIB_ERRORS, 1);
  ------------------
  |  |   59|     66|#define NETSNMP_DS_LIB_MIB_ERRORS          0
  ------------------
  773|       |
  774|     66|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
  775|     66|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  776|     66|			   NETSNMP_DS_LIB_REVERSE_ENCODE,
  ------------------
  |  |   80|     66|#define NETSNMP_DS_LIB_REVERSE_ENCODE      20   /* encode packets from back to front */
  ------------------
  777|     66|			   NETSNMP_DEFAULT_ASNENCODING_DIRECTION);
  ------------------
  |  | 2033|     66|#define NETSNMP_DEFAULT_ASNENCODING_DIRECTION 1 /* 1 = reverse, 0 = forwards */
  ------------------
  778|     66|#endif
  779|     66|}
snmp_api.c:register_default_handlers:
  808|     66|{
  809|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "dumpPacket",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  810|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DUMP_PACKET);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DUMP_PACKET);
  ------------------
  |  |   63|     66|#define NETSNMP_DS_LIB_DUMP_PACKET         4
  ------------------
  811|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "reverseEncodeBER",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  812|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_REVERSE_ENCODE);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_REVERSE_ENCODE);
  ------------------
  |  |   80|     66|#define NETSNMP_DS_LIB_REVERSE_ENCODE      20   /* encode packets from back to front */
  ------------------
  813|     66|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "defaultPort",
  ------------------
  |  |   64|     66|#define ASN_INTEGER	    0x02U
  ------------------
  814|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DEFAULT_PORT);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DEFAULT_PORT);
  ------------------
  |  |  117|     66|#define NETSNMP_DS_LIB_DEFAULT_PORT         3
  ------------------
  815|     66|#ifndef NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION
  816|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "disableSNMPv3",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  817|     66|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V3);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V3);
  ------------------
  |  |  105|     66|#define NETSNMP_DS_LIB_DISABLE_V3          45 /* disable SNMPv3 */
  ------------------
  818|     66|#endif /* NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION */
  819|     66|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
  820|     66|#ifndef NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION
  821|     66|#if !defined(NETSNMP_DISABLE_SNMPV1)
  822|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "disableSNMPv1",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  823|     66|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V1);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V1);
  ------------------
  |  |  103|     66|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  ------------------
  824|     66|#endif
  825|     66|#if !defined(NETSNMP_DISABLE_SNMPV2C)
  826|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "disableSNMPv2c",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  827|     66|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V2c);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V2c);
  ------------------
  |  |  104|     66|#define NETSNMP_DS_LIB_DISABLE_V2c         44 /* disable SNMPv2c */
  ------------------
  828|     66|#endif
  829|     66|#endif /* NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION */
  830|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defCommunity",
  ------------------
  |  |   67|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  831|     66|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_COMMUNITY);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_COMMUNITY);
  ------------------
  |  |  158|     66|#define NETSNMP_DS_LIB_COMMUNITY         7
  ------------------
  832|     66|#endif /* !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C) */
  833|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "noTokenWarnings",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  834|     66|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_TOKEN_WARNINGS);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_TOKEN_WARNINGS);
  ------------------
  |  |   77|     66|#define NETSNMP_DS_LIB_NO_TOKEN_WARNINGS   17   /* no warn about unknown config tokens */
  ------------------
  835|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noRangeCheck",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  836|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_CHECK_RANGE);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_CHECK_RANGE);
  ------------------
  |  |   76|     66|#define NETSNMP_DS_LIB_DONT_CHECK_RANGE    16   /* don't check values for ranges on send */
  ------------------
  837|     66|    netsnmp_ds_register_premib(ASN_OCTET_STR, "snmp", "persistentDir",
  ------------------
  |  |   67|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  838|     66|	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PERSISTENT_DIR);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PERSISTENT_DIR);
  ------------------
  |  |  159|     66|#define NETSNMP_DS_LIB_PERSISTENT_DIR    8
  ------------------
  839|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "tempFilePattern",
  ------------------
  |  |   67|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  840|     66|	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_TEMP_FILE_PATTERN);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_TEMP_FILE_PATTERN);
  ------------------
  |  |  166|     66|#define NETSNMP_DS_LIB_TEMP_FILE_PATTERN 15
  ------------------
  841|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noDisplayHint",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  842|     66|	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
  ------------------
  |  |   90|     66|#define NETSNMP_DS_LIB_NO_DISPLAY_HINT     30 /* don't apply DISPLAY-HINTs */
  ------------------
  843|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "16bitIDs",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  844|     66|	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS);
  ------------------
  |  |   91|     66|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  845|     66|    netsnmp_ds_register_premib(ASN_OCTET_STR, "snmp", "clientaddr",
  ------------------
  |  |   67|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  846|     66|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENT_ADDR);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENT_ADDR);
  ------------------
  |  |  165|     66|#define NETSNMP_DS_LIB_CLIENT_ADDR       14
  ------------------
  847|     66|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "clientaddrUsesPort",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  848|     66|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT);
  ------------------
  |  |  102|     66|#define NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT 42 /* NETSNMP_DS_LIB_CLIENT_ADDR includes address and also port */
  ------------------
  849|     66|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "serverSendBuf",
  ------------------
  |  |   64|     66|#define ASN_INTEGER	    0x02U
  ------------------
  850|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SERVERSENDBUF);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SERVERSENDBUF);
  ------------------
  |  |  122|     66|#define NETSNMP_DS_LIB_SERVERSENDBUF        7 /* send buffer (server) */
  ------------------
  851|     66|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "serverRecvBuf",
  ------------------
  |  |   64|     66|#define ASN_INTEGER	    0x02U
  ------------------
  852|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SERVERRECVBUF);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SERVERRECVBUF);
  ------------------
  |  |  123|     66|#define NETSNMP_DS_LIB_SERVERRECVBUF        8 /* receive buffer (server) */
  ------------------
  853|     66|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "clientSendBuf",
  ------------------
  |  |   64|     66|#define ASN_INTEGER	    0x02U
  ------------------
  854|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENTSENDBUF);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENTSENDBUF);
  ------------------
  |  |  124|     66|#define NETSNMP_DS_LIB_CLIENTSENDBUF        9 /* send buffer (client) */
  ------------------
  855|     66|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "clientRecvBuf",
  ------------------
  |  |   64|     66|#define ASN_INTEGER	    0x02U
  ------------------
  856|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENTRECVBUF);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENTRECVBUF);
  ------------------
  |  |  125|     66|#define NETSNMP_DS_LIB_CLIENTRECVBUF       10 /* receive buffer (client) */
  ------------------
  857|     66|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "sendMessageMaxSize",
  ------------------
  |  |   64|     66|#define ASN_INTEGER	    0x02U
  ------------------
  858|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  859|     66|                               NETSNMP_DS_LIB_MSG_SEND_MAX);
  ------------------
  |  |  132|     66|#define NETSNMP_DS_LIB_MSG_SEND_MAX        16 /* global max response size */
  ------------------
  860|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noPersistentLoad",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  861|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD);
  ------------------
  |  |   95|     66|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD  35 /* don't load persistent file */
  ------------------
  862|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noPersistentSave",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  863|     66|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE);
  ------------------
  |  |   96|     66|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE  36 /* don't save persistent file */
  ------------------
  864|     66|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp",
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  865|     66|                               "noContextEngineIDDiscovery",
  866|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  867|     66|                               NETSNMP_DS_LIB_NO_DISCOVERY);
  ------------------
  |  |   98|     66|#define NETSNMP_DS_LIB_NO_DISCOVERY        38 /* don't support RFC5343 contextEngineID discovery */
  ------------------
  868|     66|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "timeout",
  ------------------
  |  |   64|     66|#define ASN_INTEGER	    0x02U
  ------------------
  869|     66|		               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_TIMEOUT);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_TIMEOUT);
  ------------------
  |  |  130|     66|#define NETSNMP_DS_LIB_TIMEOUT             14
  ------------------
  870|     66|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "retries",
  ------------------
  |  |   64|     66|#define ASN_INTEGER	    0x02U
  ------------------
  871|     66|		               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES);
  ------------------
  |  |  131|     66|#define NETSNMP_DS_LIB_RETRIES             15
  ------------------
  872|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "outputPrecision",
  ------------------
  |  |   67|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
  873|     66|                               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OUTPUT_PRECISION);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                             NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OUTPUT_PRECISION);
  ------------------
  |  |  186|     66|#define NETSNMP_DS_LIB_OUTPUT_PRECISION  35
  ------------------
  874|       |
  875|       |
  876|     66|    netsnmp_register_service_handlers();
  877|     66|}
snmp_api.c:snmp_sess_copy:
 1403|     66|{
 1404|     66|    struct session_list *psl;
 1405|     66|    psl = _sess_copy(pss);
 1406|     66|    if (!psl) {
  ------------------
  |  Branch (1406:9): [True: 0, False: 66]
  ------------------
 1407|      0|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (1407:13): [True: 0, False: 0]
  ------------------
 1408|      0|            pss->s_snmp_errno = SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1409|      0|        }
 1410|      0|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   43|      0|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 1411|      0|    }
 1412|     66|    return psl;
 1413|     66|}
snmp_api.c:_sess_copy:
 1107|     66|{
 1108|     66|    struct session_list *slp;
 1109|     66|    struct snmp_internal_session *isp;
 1110|     66|    netsnmp_session *session;
 1111|     66|    struct snmp_secmod_def *sptr;
 1112|     66|    char           *cp;
 1113|     66|    u_char         *ucp;
 1114|       |
 1115|     66|    in_session->s_snmp_errno = 0;
 1116|     66|    in_session->s_errno = 0;
 1117|       |
 1118|       |    /*
 1119|       |     * Copy session structure and link into list 
 1120|       |     */
 1121|     66|    slp = calloc(1, sizeof(struct session_list));
 1122|     66|    if (slp == NULL) {
  ------------------
  |  Branch (1122:9): [True: 0, False: 66]
  ------------------
 1123|      0|        in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1124|      0|        return (NULL);
 1125|      0|    }
 1126|       |
 1127|     66|    slp->transport = NULL;
 1128|       |
 1129|     66|    isp = calloc(1, sizeof(struct snmp_internal_session));
 1130|       |
 1131|     66|    if (isp == NULL) {
  ------------------
  |  Branch (1131:9): [True: 0, False: 66]
  ------------------
 1132|      0|        snmp_sess_close(slp);
 1133|      0|        in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1134|      0|        return (NULL);
 1135|      0|    }
 1136|       |
 1137|     66|    slp->internal = isp;
 1138|     66|    slp->session = netsnmp_memdup(in_session, sizeof(netsnmp_session));
 1139|     66|    if (slp->session == NULL) {
  ------------------
  |  Branch (1139:9): [True: 0, False: 66]
  ------------------
 1140|      0|        snmp_sess_close(slp);
 1141|      0|        in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1142|      0|        return (NULL);
 1143|      0|    }
 1144|     66|    session = slp->session;
 1145|       |
 1146|       |    /*
 1147|       |     * zero out pointers so if we have to free the session we wont free mem
 1148|       |     * owned by in_session 
 1149|       |     */
 1150|     66|    session->localname = NULL;
 1151|     66|    session->peername = NULL;
 1152|     66|    session->community = NULL;
 1153|     66|    session->contextEngineID = NULL;
 1154|     66|    session->contextName = NULL;
 1155|     66|    session->securityEngineID = NULL;
 1156|     66|    session->securityName = NULL;
 1157|     66|    session->securityAuthProto = NULL;
 1158|     66|    session->securityAuthLocalKey = NULL;
 1159|     66|    session->securityPrivProto = NULL;
 1160|     66|    session->securityPrivLocalKey = NULL;
 1161|     66|    session->sessUser = NULL;
 1162|     66|    session->paramName = NULL;
 1163|     66|#ifndef NETSNMP_NO_TRAP_STATS
 1164|     66|    session->trap_stats = NULL;
 1165|     66|#endif
 1166|       |    /*
 1167|       |     * session now points to the new structure that still contains pointers to
 1168|       |     * data allocated elsewhere.  Some of this data is copied to space malloc'd
 1169|       |     * here, and the pointer replaced with the new one.
 1170|       |     */
 1171|       |
 1172|     66|    if (in_session->peername != NULL) {
  ------------------
  |  Branch (1172:9): [True: 0, False: 66]
  ------------------
 1173|      0|        session->peername =
 1174|      0|            netsnmp_strdup_and_null((u_char*)in_session->peername,
 1175|      0|                                    strlen(in_session->peername));
 1176|      0|        if (session->peername == NULL) {
  ------------------
  |  Branch (1176:13): [True: 0, False: 0]
  ------------------
 1177|      0|            snmp_sess_close(slp);
 1178|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1179|      0|            return (NULL);
 1180|      0|        }
 1181|      0|    }
 1182|       |
 1183|       |    /*
 1184|       |     * Fill in defaults if necessary 
 1185|       |     */
 1186|     66|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 1187|     66|    if (in_session->community_len != SNMP_DEFAULT_COMMUNITY_LEN) {
  ------------------
  |  |   78|     66|#define SNMP_DEFAULT_COMMUNITY_LEN  0   /* to get a default community name */
  ------------------
  |  Branch (1187:9): [True: 0, False: 66]
  ------------------
 1188|      0|        ucp = netsnmp_memdup(in_session->community, in_session->community_len);
 1189|     66|    } else {
 1190|     66|        if ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1190:13): [True: 0, False: 66]
  ------------------
 1191|     66|					NETSNMP_DS_LIB_COMMUNITY)) != NULL) {
  ------------------
  |  |  158|     66|#define NETSNMP_DS_LIB_COMMUNITY         7
  ------------------
 1192|      0|            session->community_len = strlen(cp);
 1193|      0|            ucp = (u_char *) strdup(cp);
 1194|     66|        } else {
 1195|       |#ifdef NETSNMP_NO_ZEROLENGTH_COMMUNITY
 1196|       |            session->community_len = strlen(DEFAULT_COMMUNITY);
 1197|       |            ucp = netsnmp_memdup(DEFAULT_COMMUNITY, session->community_len);
 1198|       |#else
 1199|     66|            ucp = (u_char *) strdup("");
 1200|     66|#endif
 1201|     66|        }
 1202|     66|    }
 1203|       |
 1204|     66|    if (ucp == NULL) {
  ------------------
  |  Branch (1204:9): [True: 0, False: 66]
  ------------------
 1205|      0|        snmp_sess_close(slp);
 1206|      0|        in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1207|      0|        return (NULL);
 1208|      0|    }
 1209|     66|    session->community = ucp;   /* replace pointer with pointer to new data */
 1210|     66|#endif
 1211|       |
 1212|     66|    if (session->securityLevel <= 0) {
  ------------------
  |  Branch (1212:9): [True: 66, False: 0]
  ------------------
 1213|     66|        session->securityLevel =
 1214|     66|            netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECLEVEL);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                          netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECLEVEL);
  ------------------
  |  |  115|     66|#define NETSNMP_DS_LIB_SECLEVEL             1
  ------------------
 1215|     66|    }
 1216|       |
 1217|     66|    if (in_session->securityEngineIDLen > 0) {
  ------------------
  |  Branch (1217:9): [True: 0, False: 66]
  ------------------
 1218|      0|        ucp = netsnmp_memdup(in_session->securityEngineID,
 1219|      0|                             in_session->securityEngineIDLen);
 1220|      0|        if (ucp == NULL) {
  ------------------
  |  Branch (1220:13): [True: 0, False: 0]
  ------------------
 1221|      0|            snmp_sess_close(slp);
 1222|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1223|      0|            return (NULL);
 1224|      0|        }
 1225|      0|        session->securityEngineID = ucp;
 1226|      0|        session->securityEngineIDLen = in_session->securityEngineIDLen;
 1227|      0|    }
 1228|       |
 1229|     66|    if (in_session->contextEngineIDLen > 0) {
  ------------------
  |  Branch (1229:9): [True: 0, False: 66]
  ------------------
 1230|      0|        ucp = netsnmp_memdup(in_session->contextEngineID,
 1231|      0|                             in_session->contextEngineIDLen);
 1232|      0|        if (ucp == NULL) {
  ------------------
  |  Branch (1232:13): [True: 0, False: 0]
  ------------------
 1233|      0|            snmp_sess_close(slp);
 1234|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1235|      0|            return (NULL);
 1236|      0|        }
 1237|      0|        session->contextEngineID = ucp;
 1238|      0|        session->contextEngineIDLen = in_session->contextEngineIDLen;
 1239|     66|    } else if (in_session->securityEngineIDLen > 0) {
  ------------------
  |  Branch (1239:16): [True: 0, False: 66]
  ------------------
 1240|       |        /*
 1241|       |         * default contextEngineID to securityEngineIDLen if defined 
 1242|       |         */
 1243|      0|        ucp = netsnmp_memdup(in_session->securityEngineID,
 1244|      0|                             in_session->securityEngineIDLen);
 1245|      0|        if (ucp == NULL) {
  ------------------
  |  Branch (1245:13): [True: 0, False: 0]
  ------------------
 1246|      0|            snmp_sess_close(slp);
 1247|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1248|      0|            return (NULL);
 1249|      0|        }
 1250|      0|        session->contextEngineID = ucp;
 1251|      0|        session->contextEngineIDLen = in_session->securityEngineIDLen;
 1252|      0|    }
 1253|       |
 1254|     66|    if (in_session->contextName) {
  ------------------
  |  Branch (1254:9): [True: 0, False: 66]
  ------------------
 1255|      0|        session->contextName = strdup(in_session->contextName);
 1256|      0|        if (session->contextName == NULL) {
  ------------------
  |  Branch (1256:13): [True: 0, False: 0]
  ------------------
 1257|      0|            snmp_sess_close(slp);
 1258|      0|            return (NULL);
 1259|      0|        }
 1260|      0|        session->contextNameLen = in_session->contextNameLen;
 1261|     66|    } else {
 1262|     66|        if ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1262:13): [True: 0, False: 66]
  ------------------
 1263|     66|                                        NETSNMP_DS_LIB_CONTEXT)) != NULL)
  ------------------
  |  |  152|     66|#define NETSNMP_DS_LIB_CONTEXT           1
  ------------------
 1264|      0|            cp = strdup(cp);
 1265|     66|        else
 1266|     66|            cp = strdup(SNMP_DEFAULT_CONTEXT);
  ------------------
  |  |   92|     66|#define SNMP_DEFAULT_CONTEXT        ""
  ------------------
 1267|     66|        if (cp == NULL) {
  ------------------
  |  Branch (1267:13): [True: 0, False: 66]
  ------------------
 1268|      0|            snmp_sess_close(slp);
 1269|      0|            return (NULL);
 1270|      0|        }
 1271|     66|        session->contextName = cp;
 1272|     66|        session->contextNameLen = strlen(cp);
 1273|     66|    }
 1274|       |
 1275|     66|    if (in_session->securityName) {
  ------------------
  |  Branch (1275:9): [True: 0, False: 66]
  ------------------
 1276|      0|        session->securityName = strdup(in_session->securityName);
 1277|      0|        if (session->securityName == NULL) {
  ------------------
  |  Branch (1277:13): [True: 0, False: 0]
  ------------------
 1278|      0|            snmp_sess_close(slp);
 1279|      0|            return (NULL);
 1280|      0|        }
 1281|     66|    } else if ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1281:16): [True: 0, False: 66]
  ------------------
 1282|     66|					   NETSNMP_DS_LIB_SECNAME)) != NULL) {
  ------------------
  |  |  151|     66|#define NETSNMP_DS_LIB_SECNAME           0
  ------------------
 1283|      0|        cp = strdup(cp);
 1284|      0|        if (cp == NULL) {
  ------------------
  |  Branch (1284:13): [True: 0, False: 0]
  ------------------
 1285|      0|            snmp_sess_close(slp);
 1286|      0|            return (NULL);
 1287|      0|        }
 1288|      0|        session->securityName = cp;
 1289|      0|        session->securityNameLen = strlen(cp);
 1290|      0|    }
 1291|       |
 1292|     66|    if (in_session->securityAuthLocalKey) {
  ------------------
  |  Branch (1292:9): [True: 0, False: 66]
  ------------------
 1293|      0|            session->securityAuthLocalKey =
 1294|      0|                netsnmp_memdup(in_session->securityAuthLocalKey,
 1295|      0|                               in_session->securityAuthLocalKeyLen);
 1296|      0|            session->securityAuthLocalKeyLen =
 1297|      0|                in_session->securityAuthLocalKeyLen;
 1298|      0|    }
 1299|       |
 1300|     66|    if (in_session->securityPrivLocalKey) {
  ------------------
  |  Branch (1300:9): [True: 0, False: 66]
  ------------------
 1301|      0|            session->securityPrivLocalKey =
 1302|      0|                netsnmp_memdup(in_session->securityPrivLocalKey,
 1303|      0|                               in_session->securityPrivLocalKeyLen);
 1304|      0|            session->securityPrivLocalKeyLen =
 1305|      0|                in_session->securityPrivLocalKeyLen;
 1306|      0|    }
 1307|       |
 1308|     66|    if (session->transport_configuration) {
  ------------------
  |  Branch (1308:9): [True: 0, False: 66]
  ------------------
 1309|      0|        session->transport_configuration =
 1310|      0|            CONTAINER_DUP(session->transport_configuration, NULL, 0);
 1311|      0|        if (!session->transport_configuration) {
  ------------------
  |  Branch (1311:13): [True: 0, False: 0]
  ------------------
 1312|      0|            snmp_sess_close(slp);
 1313|      0|            return NULL;
 1314|      0|        }
 1315|      0|    }
 1316|       |
 1317|     66|    if (session->retries == SNMP_DEFAULT_RETRIES) {
  ------------------
  |  |   79|     66|#define SNMP_DEFAULT_RETRIES	    -1
  ------------------
  |  Branch (1317:9): [True: 66, False: 0]
  ------------------
 1318|     66|        int retry = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1319|     66|                                       NETSNMP_DS_LIB_RETRIES);
  ------------------
  |  |  131|     66|#define NETSNMP_DS_LIB_RETRIES             15
  ------------------
 1320|     66|        if (retry < 0)
  ------------------
  |  Branch (1320:13): [True: 0, False: 66]
  ------------------
 1321|      0|            session->retries = DEFAULT_RETRIES;
  ------------------
  |  |  191|      0|#define DEFAULT_RETRIES	    5
  ------------------
 1322|     66|        else
 1323|     66|            session->retries = retry;
 1324|     66|    }
 1325|     66|    if (session->timeout == SNMP_DEFAULT_TIMEOUT) {
  ------------------
  |  |   80|     66|#define SNMP_DEFAULT_TIMEOUT	    -1
  ------------------
  |  Branch (1325:9): [True: 66, False: 0]
  ------------------
 1326|     66|        int timeout = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1327|     66|                                         NETSNMP_DS_LIB_TIMEOUT);
  ------------------
  |  |  130|     66|#define NETSNMP_DS_LIB_TIMEOUT             14
  ------------------
 1328|     66|        if (timeout <= 0)
  ------------------
  |  Branch (1328:13): [True: 66, False: 0]
  ------------------
 1329|     66|            session->timeout = DEFAULT_TIMEOUT;
  ------------------
  |  |  192|     66|#define DEFAULT_TIMEOUT	    (1000L * 1000L)
  ------------------
 1330|      0|        else
 1331|      0|            session->timeout = timeout * 1000L * 1000L;
 1332|     66|    }
 1333|     66|    session->sessid = snmp_get_next_sessid();
 1334|       |
 1335|     66|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SESSION_INIT,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
                  snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SESSION_INIT,
  ------------------
  |  |   29|     66|#define SNMP_CALLBACK_SESSION_INIT		5
  ------------------
 1336|     66|                        session);
 1337|       |
 1338|     66|    if ((sptr = find_sec_mod(session->securityModel)) != NULL) {
  ------------------
  |  Branch (1338:9): [True: 66, False: 0]
  ------------------
 1339|       |        /*
 1340|       |         * security module specific copying 
 1341|       |         */
 1342|     66|        if (sptr->session_setup) {
  ------------------
  |  Branch (1342:13): [True: 66, False: 0]
  ------------------
 1343|     66|            int ret = (*sptr->session_setup) (in_session, session);
 1344|     66|            if (ret != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (1344:17): [True: 0, False: 66]
  ------------------
 1345|      0|                snmp_sess_close(slp);
 1346|      0|                return NULL;
 1347|      0|            }
 1348|     66|        }
 1349|       |
 1350|       |        /*
 1351|       |         * security module specific opening
 1352|       |         */
 1353|     66|        if (sptr->session_open) {
  ------------------
  |  Branch (1353:13): [True: 0, False: 66]
  ------------------
 1354|      0|            int ret = (*sptr->session_open) (session);
 1355|      0|            if (ret != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (1355:17): [True: 0, False: 0]
  ------------------
 1356|      0|                snmp_sess_close(slp);
 1357|      0|                return NULL;
 1358|      0|            }
 1359|      0|        }
 1360|     66|    }
 1361|       |
 1362|     66|#ifndef NETSNMP_NO_WRITE_SUPPORT
 1363|     66|    if (in_session->sessUser) {
  ------------------
  |  Branch (1363:9): [True: 0, False: 66]
  ------------------
 1364|      0|        struct usmUser *user;
 1365|       |
 1366|      0|        user = calloc(1, sizeof(struct usmUser));
 1367|      0|        if (user == NULL) {
  ------------------
  |  Branch (1367:13): [True: 0, False: 0]
  ------------------
 1368|      0|            snmp_sess_close(slp);
 1369|      0|            return NULL;
 1370|      0|        }
 1371|      0|        session->sessUser = usm_cloneFrom_user(in_session->sessUser, user);
 1372|      0|        if (session->sessUser == NULL) {
  ------------------
  |  Branch (1372:13): [True: 0, False: 0]
  ------------------
 1373|      0|            usm_free_user(user);
 1374|      0|            snmp_sess_close(slp);
 1375|      0|            return NULL;
 1376|      0|        }
 1377|      0|    }
 1378|     66|#endif /* NETSNMP_NO_WRITE_SUPPORT */
 1379|       |
 1380|     66|    if (in_session->paramName) {
  ------------------
  |  Branch (1380:9): [True: 0, False: 66]
  ------------------
 1381|      0|        session->paramName = strdup(in_session->paramName);
 1382|      0|        if (session->paramName == NULL) {
  ------------------
  |  Branch (1382:13): [True: 0, False: 0]
  ------------------
 1383|      0|            snmp_sess_close(slp);
 1384|      0|            return NULL;
 1385|      0|        }
 1386|      0|    }
 1387|     66|#ifndef NETSNMP_NO_TRAP_STATS
 1388|     66|    if (in_session->trap_stats) {
  ------------------
  |  Branch (1388:9): [True: 0, False: 66]
  ------------------
 1389|      0|        session->trap_stats = netsnmp_memdup(in_session->trap_stats,
 1390|      0|                                             sizeof(*in_session->trap_stats));
 1391|      0|        if (session->trap_stats == NULL) {
  ------------------
  |  Branch (1391:13): [True: 0, False: 0]
  ------------------
 1392|      0|            snmp_sess_close(slp);
 1393|      0|            return NULL;
 1394|      0|        }
 1395|      0|    }
 1396|     66|#endif
 1397|       |
 1398|     66|    return (slp);
 1399|     66|}
snmp_api.c:netsnmp_free_transport_config:
 2054|     66|{
 2055|     66|    if (!tc)
  ------------------
  |  Branch (2055:9): [True: 66, False: 0]
  ------------------
 2056|     66|        return;
 2057|       |
 2058|      0|    CONTAINER_CLEAR(tc, netsnmp_free_one_tr_cfg, NULL);
 2059|      0|    CONTAINER_FREE(tc);
 2060|      0|}
snmp_api.c:snmp_free_session:
 2093|     66|{
 2094|     66|    if (!s)
  ------------------
  |  Branch (2094:9): [True: 0, False: 66]
  ------------------
 2095|      0|        return;
 2096|       |
 2097|     66|    netsnmp_cleanup_session(s);
 2098|       |
 2099|       |    /*
 2100|       |     * clear session from any callbacks
 2101|       |     */
 2102|     66|    netsnmp_callback_clear_client_arg(s, 0, 0);
 2103|       |
 2104|     66|    free(s);
 2105|     66|}
snmp_api.c:snmpv3_calc_msg_flags:
 2260|      3|{
 2261|      3|    *flags = 0;
 2262|      3|    if (sec_level == SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|      3|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (2262:9): [True: 0, False: 3]
  ------------------
 2263|      0|        *flags = SNMP_MSG_FLAG_AUTH_BIT;
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
 2264|      3|    else if (sec_level == SNMP_SEC_LEVEL_AUTHPRIV)
  ------------------
  |  |  301|      3|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2264:14): [True: 0, False: 3]
  ------------------
 2265|      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
  ------------------
 2266|       |
 2267|      3|    if (SNMP_CMD_CONFIRMED(msg_command))
  ------------------
  |  |  193|      3|#define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
  |  |  ------------------
  |  |  |  |  141|      6|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|      3|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
  |  |  ------------------
  |  |  |  |  140|      6|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|      3|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (193:32): [True: 0, False: 3]
  |  |  |  Branch (193:56): [True: 0, False: 3]
  |  |  ------------------
  |  |  194|      3|                               c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
  |  |  ------------------
  |  |  |  |  126|      6|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|      3|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                              c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
  |  |  ------------------
  |  |  |  |  125|      6|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|      3|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (194:32): [True: 0, False: 3]
  |  |  |  Branch (194:57): [True: 0, False: 3]
  |  |  ------------------
  |  |  195|      3|                               c == SNMP_MSG_SET )
  |  |  ------------------
  |  |  |  |  129|      6|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|      3|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (195:32): [True: 0, False: 3]
  |  |  ------------------
  ------------------
 2268|      0|        *flags |= SNMP_MSG_FLAG_RPRT_BIT;
  ------------------
  |  |  305|      0|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 2269|       |
 2270|      3|    return;
 2271|      3|}
snmp_api.c:_snmp_build:
 3036|      3|{
 3037|      3|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 3038|      3|    u_char         *h0e = NULL;
 3039|      3|    size_t          start_offset = *offset;
 3040|      3|    long            version;
 3041|      3|    int             rc = 0;
 3042|      3|    size_t          length;
 3043|      3|#endif /* support for community based SNMP */
 3044|       |
 3045|      3|    u_char         *cp;
 3046|       |
 3047|      3|    if (NETSNMP_RUNTIME_PROTOCOL_SKIP(pdu->version)) {
  ------------------
  |  |  246|      3|    (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||        \
  |  |  ------------------
  |  |  |  |  205|      6|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|      6|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  206|      6|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (206:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  207|      0|                            NETSNMP_DS_LIB_DISABLE_V1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|      0|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  247|      3|     NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver) ||        \
  |  |  ------------------
  |  |  |  |  215|      6|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|      6|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  216|      6|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (216:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  217|      0|                            NETSNMP_DS_LIB_DISABLE_V2c))
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|#define NETSNMP_DS_LIB_DISABLE_V2c         44 /* disable SNMPv2c */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  248|      3|     NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver))
  |  |  ------------------
  |  |  |  |  229|      3|    ((pc_ver == SNMP_VERSION_3) &&                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|      3|#define SNMP_VERSION_3     3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (229:6): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  230|      3|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      3|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (230:6): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  231|      3|                            NETSNMP_DS_LIB_DISABLE_V3))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|      3|#define NETSNMP_DS_LIB_DISABLE_V3          45 /* disable SNMPv3 */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3048|      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]
  |  |  ------------------
  ------------------
 3049|      0|                    (u_int)pdu->version));
 3050|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3051|      0|        return -1;
 3052|      0|    }
 3053|       |
 3054|      3|    session->s_snmp_errno = 0;
 3055|      3|    session->s_errno = 0;
 3056|       |
 3057|      3|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 3058|      3|    if ((pdu->flags & UCD_MSG_FLAG_BULK_TOOBIG) ||
  ------------------
  |  |  321|      3|#define UCD_MSG_FLAG_BULK_TOOBIG          0x010000
  ------------------
  |  Branch (3058:9): [True: 0, False: 3]
  ------------------
 3059|      3|        (0 == netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      3|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3059:9): [True: 0, False: 3]
  ------------------
 3060|      3|                                     NETSNMP_DS_LIB_REVERSE_ENCODE))) {
  ------------------
  |  |   80|      3|#define NETSNMP_DS_LIB_REVERSE_ENCODE      20   /* encode packets from back to front */
  ------------------
 3061|      0|        pdu->flags |= UCD_MSG_FLAG_FORWARD_ENCODE;
  ------------------
  |  |  319|      0|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
 3062|      0|    }
 3063|      3|#endif /* NETSNMP_USE_REVERSE_ASNENCODING */
 3064|       |
 3065|      3|    if (pdu->version == SNMP_VERSION_3) {
  ------------------
  |  |  113|      3|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (3065:9): [True: 3, False: 0]
  ------------------
 3066|      3|        return snmpv3_build(pkt, pkt_len, offset, session, pdu);
 3067|      3|    }
 3068|       |
 3069|      0|    switch (pdu->command) {
 3070|      0|    case SNMP_MSG_RESPONSE:
  ------------------
  |  |  127|      0|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3070:5): [True: 0, False: 0]
  ------------------
 3071|      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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3072|      0|#ifndef NETSNMP_NOTIFY_ONLY
 3073|      0|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2449|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 3074|      0|    case SNMP_MSG_GET:
  ------------------
  |  |  125|      0|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3074:5): [True: 0, False: 0]
  ------------------
 3075|      0|    case SNMP_MSG_GETNEXT:
  ------------------
  |  |  126|      0|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3075:5): [True: 0, False: 0]
  ------------------
 3076|      0|#endif /* ! NETSNMP_NOTIFY_ONLY */
 3077|      0|#ifndef NETSNMP_NO_WRITE_SUPPORT
 3078|      0|    case SNMP_MSG_SET:
  ------------------
  |  |  129|      0|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3078:5): [True: 0, False: 0]
  ------------------
 3079|      0|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 3080|       |        /*
 3081|       |         * all versions support these PDU types 
 3082|       |         */
 3083|       |        /*
 3084|       |         * initialize defaulted PDU fields 
 3085|       |         */
 3086|       |
 3087|      0|        if (pdu->errstat == SNMP_DEFAULT_ERRSTAT)
  ------------------
  |  |   84|      0|#define SNMP_DEFAULT_ERRSTAT	    -1
  ------------------
  |  Branch (3087:13): [True: 0, False: 0]
  ------------------
 3088|      0|            pdu->errstat = 0;
 3089|      0|        if (pdu->errindex == SNMP_DEFAULT_ERRINDEX)
  ------------------
  |  |   85|      0|#define SNMP_DEFAULT_ERRINDEX	    -1
  ------------------
  |  Branch (3089:13): [True: 0, False: 0]
  ------------------
 3090|      0|            pdu->errindex = 0;
 3091|      0|        break;
 3092|       |
 3093|      0|    case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|      0|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3093:5): [True: 0, False: 0]
  ------------------
 3094|      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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3095|      0|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2449|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 3096|      0|    case SNMP_MSG_INFORM:
  ------------------
  |  |  141|      0|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3096:5): [True: 0, False: 0]
  ------------------
 3097|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3098|       |        /*
 3099|       |         * not supported in SNMPv1 and SNMPsec 
 3100|       |         */
 3101|      0|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3101:13): [True: 0, False: 0]
  ------------------
 3102|      0|            session->s_snmp_errno = SNMPERR_V2_IN_V1;
  ------------------
  |  |  191|      0|#define SNMPERR_V2_IN_V1		(-7)
  ------------------
 3103|      0|            return -1;
 3104|      0|        }
 3105|      0|#endif
 3106|      0|        if (pdu->errstat == SNMP_DEFAULT_ERRSTAT)
  ------------------
  |  |   84|      0|#define SNMP_DEFAULT_ERRSTAT	    -1
  ------------------
  |  Branch (3106:13): [True: 0, False: 0]
  ------------------
 3107|      0|            pdu->errstat = 0;
 3108|      0|        if (pdu->errindex == SNMP_DEFAULT_ERRINDEX)
  ------------------
  |  |   85|      0|#define SNMP_DEFAULT_ERRINDEX	    -1
  ------------------
  |  Branch (3108:13): [True: 0, False: 0]
  ------------------
 3109|      0|            pdu->errindex = 0;
 3110|      0|        break;
 3111|       |
 3112|      0|#ifndef NETSNMP_NOTIFY_ONLY
 3113|      0|    case SNMP_MSG_GETBULK:
  ------------------
  |  |  140|      0|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3113:5): [True: 0, False: 0]
  ------------------
 3114|       |        /*
 3115|       |         * not supported in SNMPv1 and SNMPsec 
 3116|       |         */
 3117|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3118|      0|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3118:13): [True: 0, False: 0]
  ------------------
 3119|      0|            session->s_snmp_errno = SNMPERR_V2_IN_V1;
  ------------------
  |  |  191|      0|#define SNMPERR_V2_IN_V1		(-7)
  ------------------
 3120|      0|            return -1;
 3121|      0|        }
 3122|      0|#endif
 3123|      0|        if (pdu->max_repetitions < 0) {
  ------------------
  |  |  161|      0|#define max_repetitions errindex
  ------------------
  |  Branch (3123:13): [True: 0, False: 0]
  ------------------
 3124|      0|            session->s_snmp_errno = SNMPERR_BAD_REPETITIONS;
  ------------------
  |  |  194|      0|#define SNMPERR_BAD_REPETITIONS		(-10)
  ------------------
 3125|      0|            return -1;
 3126|      0|        }
 3127|      0|        if (pdu->non_repeaters < 0) {
  ------------------
  |  |  160|      0|#define non_repeaters	errstat
  ------------------
  |  Branch (3127:13): [True: 0, False: 0]
  ------------------
 3128|      0|            session->s_snmp_errno = SNMPERR_BAD_REPEATERS;
  ------------------
  |  |  193|      0|#define SNMPERR_BAD_REPEATERS		(-9)
  ------------------
 3129|      0|            return -1;
 3130|      0|        }
 3131|      0|        break;
 3132|      0|#endif /* ! NETSNMP_NOTIFY_ONLY */
 3133|       |
 3134|      0|    case SNMP_MSG_TRAP:
  ------------------
  |  |  135|      0|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3134:5): [True: 0, False: 0]
  ------------------
 3135|       |        /*
 3136|       |         * *only* supported in SNMPv1 and SNMPsec 
 3137|       |         */
 3138|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3139|      0|        if (pdu->version != SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3139:13): [True: 0, False: 0]
  ------------------
 3140|      0|            session->s_snmp_errno = SNMPERR_V1_IN_V2;
  ------------------
  |  |  192|      0|#define SNMPERR_V1_IN_V2		(-8)
  ------------------
 3141|      0|            return -1;
 3142|      0|        }
 3143|      0|#endif
 3144|       |        /*
 3145|       |         * initialize defaulted Trap PDU fields 
 3146|       |         */
 3147|      0|        pdu->reqid = 1;         /* give a bogus non-error reqid for traps */
 3148|      0|        if (pdu->enterprise_length == SNMP_DEFAULT_ENTERPRISE_LENGTH) {
  ------------------
  |  |   88|      0|#define SNMP_DEFAULT_ENTERPRISE_LENGTH	0
  ------------------
  |  Branch (3148:13): [True: 0, False: 0]
  ------------------
 3149|      0|            pdu->enterprise = netsnmp_memdup(DEFAULT_ENTERPRISE,
  ------------------
  |  |  194|      0|#define DEFAULT_ENTERPRISE  default_enterprise
  ------------------
 3150|      0|                                             sizeof(DEFAULT_ENTERPRISE));
  ------------------
  |  |  194|      0|#define DEFAULT_ENTERPRISE  default_enterprise
  ------------------
 3151|      0|            if (pdu->enterprise == NULL) {
  ------------------
  |  Branch (3151:17): [True: 0, False: 0]
  ------------------
 3152|      0|                session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3153|      0|                return -1;
 3154|      0|            }
 3155|      0|            pdu->enterprise_length =
 3156|      0|                OID_LENGTH(DEFAULT_ENTERPRISE);
  ------------------
  |  |   57|      0|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
 3157|      0|        }
 3158|      0|        if (pdu->time == SNMP_DEFAULT_TIME)
  ------------------
  |  |   89|      0|#define SNMP_DEFAULT_TIME	    0
  ------------------
  |  Branch (3158:13): [True: 0, False: 0]
  ------------------
 3159|      0|            pdu->time = DEFAULT_TIME;
  ------------------
  |  |  195|      0|#define DEFAULT_TIME	    0
  ------------------
 3160|       |        /*
 3161|       |         * don't expect a response 
 3162|       |         */
 3163|      0|        pdu->flags &= (~UCD_MSG_FLAG_EXPECT_RESPONSE);
  ------------------
  |  |  312|      0|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
 3164|      0|        break;
 3165|       |
 3166|      0|    case SNMP_MSG_REPORT:      /* SNMPv3 only */
  ------------------
  |  |  147|      0|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3166:5): [True: 0, False: 0]
  ------------------
 3167|      0|    default:
  ------------------
  |  Branch (3167:5): [True: 0, False: 0]
  ------------------
 3168|      0|        session->s_snmp_errno = SNMPERR_UNKNOWN_PDU;
  ------------------
  |  |  207|      0|#define SNMPERR_UNKNOWN_PDU		(-23)
  ------------------
 3169|      0|        return -1;
 3170|      0|    }
 3171|       |
 3172|       |    /*
 3173|       |     * save length 
 3174|       |     */
 3175|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 3176|      0|    length = *pkt_len;
 3177|      0|#endif
 3178|       |
 3179|       |    /*
 3180|       |     * setup administrative fields based on version 
 3181|       |     */
 3182|       |    /*
 3183|       |     * build the message wrapper and all the administrative fields
 3184|       |     * upto the PDU sequence
 3185|       |     * (note that actual length of message will be inserted later) 
 3186|       |     */
 3187|      0|    switch (pdu->version) {
 3188|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3189|      0|    case SNMP_VERSION_1:
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3189:5): [True: 0, False: 0]
  ------------------
 3190|      0|#endif
 3191|      0|#ifndef NETSNMP_DISABLE_SNMPV2C
 3192|      0|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|      0|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (3192:5): [True: 0, False: 0]
  ------------------
 3193|      0|#endif
 3194|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 3195|       |#ifdef NETSNMP_NO_ZEROLENGTH_COMMUNITY
 3196|       |        if (pdu->community_len == 0) {
 3197|       |            if (session->community_len == 0) {
 3198|       |                session->s_snmp_errno = SNMPERR_BAD_COMMUNITY;
 3199|       |                return -1;
 3200|       |            }
 3201|       |            pdu->community = netsnmp_memdup(session->community,
 3202|       |                                            session->community_len);
 3203|       |            if (pdu->community == NULL) {
 3204|       |                session->s_snmp_errno = SNMPERR_MALLOC;
 3205|       |                return -1;
 3206|       |            }
 3207|       |            pdu->community_len = session->community_len;
 3208|       |        }
 3209|       |#else                           /* !NETSNMP_NO_ZEROLENGTH_COMMUNITY */
 3210|      0|        if (pdu->community_len == 0 && pdu->command != SNMP_MSG_RESPONSE) {
  ------------------
  |  |  127|      0|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3210:13): [True: 0, False: 0]
  |  Branch (3210:40): [True: 0, False: 0]
  ------------------
 3211|       |            /*
 3212|       |             * copy session community exactly to pdu community 
 3213|       |             */
 3214|      0|            if (0 == session->community_len) {
  ------------------
  |  Branch (3214:17): [True: 0, False: 0]
  ------------------
 3215|      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]
  |  |  ------------------
  ------------------
 3216|      0|            } else if (pdu->community_len == session->community_len) {
  ------------------
  |  Branch (3216:24): [True: 0, False: 0]
  ------------------
 3217|      0|                memmove(pdu->community,
 3218|      0|                        session->community, session->community_len);
 3219|      0|            } else {
 3220|      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]
  |  |  ------------------
  ------------------
 3221|      0|                pdu->community = netsnmp_memdup(session->community,
 3222|      0|                                                session->community_len);
 3223|      0|                if (pdu->community == NULL) {
  ------------------
  |  Branch (3223:21): [True: 0, False: 0]
  ------------------
 3224|      0|                    session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3225|      0|                    return -1;
 3226|      0|                }
 3227|      0|            }
 3228|      0|            pdu->community_len = session->community_len;
 3229|      0|        }
 3230|      0|#endif                          /* !NETSNMP_NO_ZEROLENGTH_COMMUNITY */
 3231|       |
 3232|      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]
  |  |  ------------------
  ------------------
 3233|      0|                    (1 + pdu->version)));
 3234|      0|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 3235|      0|        if (!(pdu->flags & UCD_MSG_FLAG_FORWARD_ENCODE)) {
  ------------------
  |  |  319|      0|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
  |  Branch (3235:13): [True: 0, False: 0]
  ------------------
 3236|      0|            DEBUGPRINTPDUTYPE("send", pdu->command);
  ------------------
  |  |  431|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3237|      0|            rc = snmp_pdu_realloc_rbuild(pkt, pkt_len, offset, pdu);
 3238|      0|            if (rc == 0) {
  ------------------
  |  Branch (3238:17): [True: 0, False: 0]
  ------------------
 3239|      0|                return -1;
 3240|      0|            }
 3241|       |
 3242|      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]
  |  |  ------------------
  ------------------
 3243|      0|            rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 3244|      0|                                           (u_char) (ASN_UNIVERSAL |
  ------------------
  |  |   79|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
 3245|      0|                                                     ASN_PRIMITIVE |
  ------------------
  |  |   84|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3246|      0|                                                     ASN_OCTET_STR),
  ------------------
  |  |   67|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 3247|      0|                                           pdu->community,
 3248|      0|                                           pdu->community_len);
 3249|      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]
  |  |  ------------------
  ------------------
 3250|      0|            if (rc == 0) {
  ------------------
  |  Branch (3250:17): [True: 0, False: 0]
  ------------------
 3251|      0|                return -1;
 3252|      0|            }
 3253|       |
 3254|       |
 3255|       |            /*
 3256|       |             * Store the version field.  
 3257|       |             */
 3258|      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]
  |  |  ------------------
  ------------------
 3259|       |
 3260|      0|            version = pdu->version;
 3261|      0|            rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3262|      0|                                        (u_char) (ASN_UNIVERSAL |
  ------------------
  |  |   79|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
 3263|      0|                                                  ASN_PRIMITIVE |
  ------------------
  |  |   84|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3264|      0|                                                  ASN_INTEGER),
  ------------------
  |  |   64|      0|#define ASN_INTEGER	    0x02U
  ------------------
 3265|      0|                                        (long *) &version,
 3266|      0|                                        sizeof(version));
 3267|      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]
  |  |  ------------------
  ------------------
 3268|      0|            if (rc == 0) {
  ------------------
  |  Branch (3268:17): [True: 0, False: 0]
  ------------------
 3269|      0|                return -1;
 3270|      0|            }
 3271|       |
 3272|       |            /*
 3273|       |             * Build the final sequence.  
 3274|       |             */
 3275|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3276|      0|            if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3276:17): [True: 0, False: 0]
  ------------------
 3277|      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]
  |  |  ------------------
  ------------------
 3278|      0|            } else {
 3279|      0|#endif
 3280|      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]
  |  |  ------------------
  ------------------
 3281|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3282|      0|            }
 3283|      0|#endif
 3284|      0|            rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 3285|      0|                                             (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   73|      0|#define ASN_SEQUENCE	    0x10U
  ------------------
 3286|      0|                                                       ASN_CONSTRUCTOR),
  ------------------
  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3287|      0|                                             *offset - start_offset);
 3288|      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]
  |  |  ------------------
  ------------------
 3289|       |
 3290|      0|            if (rc == 0) {
  ------------------
  |  Branch (3290:17): [True: 0, False: 0]
  ------------------
 3291|      0|                return -1;
 3292|      0|            }
 3293|      0|            return 0;
 3294|      0|        } else {
 3295|       |
 3296|      0|#endif                          /* NETSNMP_USE_REVERSE_ASNENCODING */
 3297|       |            /*
 3298|       |             * Save current location and build SEQUENCE tag and length
 3299|       |             * placeholder for SNMP message sequence
 3300|       |             * (actual length will be inserted later) 
 3301|       |             */
 3302|      0|            cp = asn_build_sequence(*pkt, pkt_len,
 3303|      0|                                    (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   73|      0|#define ASN_SEQUENCE	    0x10U
  ------------------
 3304|      0|                                              ASN_CONSTRUCTOR), 0);
  ------------------
  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3305|      0|            if (cp == NULL) {
  ------------------
  |  Branch (3305:17): [True: 0, False: 0]
  ------------------
 3306|      0|                return -1;
 3307|      0|            }
 3308|      0|            h0e = cp;
 3309|       |
 3310|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3311|      0|            if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3311:17): [True: 0, False: 0]
  ------------------
 3312|      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]
  |  |  ------------------
  ------------------
 3313|      0|            } else {
 3314|      0|#endif
 3315|      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]
  |  |  ------------------
  ------------------
 3316|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3317|      0|            }
 3318|      0|#endif
 3319|       |
 3320|       |            /*
 3321|       |             * store the version field 
 3322|       |             */
 3323|      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]
  |  |  ------------------
  ------------------
 3324|       |
 3325|      0|            version = pdu->version;
 3326|      0|            cp = asn_build_int(cp, pkt_len,
 3327|      0|                               (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   79|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                             (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   84|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3328|      0|                                         ASN_INTEGER), (long *) &version,
  ------------------
  |  |   64|      0|#define ASN_INTEGER	    0x02U
  ------------------
 3329|      0|                               sizeof(version));
 3330|      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]
  |  |  ------------------
  ------------------
 3331|      0|            if (cp == NULL)
  ------------------
  |  Branch (3331:17): [True: 0, False: 0]
  ------------------
 3332|      0|                return -1;
 3333|       |
 3334|       |            /*
 3335|       |             * store the community string 
 3336|       |             */
 3337|      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]
  |  |  ------------------
  ------------------
 3338|      0|            cp = asn_build_string(cp, pkt_len,
 3339|      0|                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   79|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   84|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3340|      0|                                            ASN_OCTET_STR), pdu->community,
  ------------------
  |  |   67|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 3341|      0|                                  pdu->community_len);
 3342|      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]
  |  |  ------------------
  ------------------
 3343|      0|            if (cp == NULL)
  ------------------
  |  Branch (3343:17): [True: 0, False: 0]
  ------------------
 3344|      0|                return -1;
 3345|      0|            break;
 3346|       |
 3347|      0|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 3348|      0|        }
 3349|      0|#endif                          /* NETSNMP_USE_REVERSE_ASNENCODING */
 3350|      0|        break;
 3351|      0|#endif /* support for community based SNMP */
 3352|      0|    case SNMP_VERSION_2p:
  ------------------
  |  |  119|      0|#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
  ------------------
  |  Branch (3352:5): [True: 0, False: 0]
  ------------------
 3353|      0|    case SNMP_VERSION_sec:
  ------------------
  |  |  118|      0|#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
  ------------------
  |  Branch (3353:5): [True: 0, False: 0]
  ------------------
 3354|      0|    case SNMP_VERSION_2u:
  ------------------
  |  |  112|      0|#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
  ------------------
  |  Branch (3354:5): [True: 0, False: 0]
  ------------------
 3355|      0|    case SNMP_VERSION_2star:
  ------------------
  |  |  120|      0|#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
  ------------------
  |  Branch (3355:5): [True: 0, False: 0]
  ------------------
 3356|      0|    default:
  ------------------
  |  Branch (3356:5): [True: 0, False: 0]
  ------------------
 3357|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3358|      0|        return -1;
 3359|      0|    }
 3360|       |
 3361|      0|    DEBUGPRINTPDUTYPE("send", pdu->command);
  ------------------
  |  |  431|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3362|      0|    cp = snmp_pdu_build(pdu, cp, pkt_len);
 3363|      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]
  |  |  ------------------
  ------------------
 3364|      0|    if (cp == NULL)
  ------------------
  |  Branch (3364:9): [True: 0, False: 0]
  ------------------
 3365|      0|        return -1;
 3366|       |
 3367|       |    /*
 3368|       |     * insert the actual length of the message sequence 
 3369|       |     */
 3370|      0|    switch (pdu->version) {
 3371|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3372|      0|    case SNMP_VERSION_1:
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3372:5): [True: 0, False: 0]
  ------------------
 3373|      0|#endif
 3374|      0|#ifndef NETSNMP_DISABLE_SNMPV2C
 3375|      0|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|      0|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (3375:5): [True: 0, False: 0]
  ------------------
 3376|      0|#endif
 3377|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 3378|      0|        asn_build_sequence(*pkt, &length,
 3379|      0|                           (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   73|      0|#define ASN_SEQUENCE	    0x10U
  ------------------
                                         (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3380|      0|                           cp - h0e);
 3381|      0|        break;
 3382|      0|#endif /* support for community based SNMP */
 3383|       |
 3384|      0|    case SNMP_VERSION_2p:
  ------------------
  |  |  119|      0|#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
  ------------------
  |  Branch (3384:5): [True: 0, False: 0]
  ------------------
 3385|      0|    case SNMP_VERSION_sec:
  ------------------
  |  |  118|      0|#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
  ------------------
  |  Branch (3385:5): [True: 0, False: 0]
  ------------------
 3386|      0|    case SNMP_VERSION_2u:
  ------------------
  |  |  112|      0|#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
  ------------------
  |  Branch (3386:5): [True: 0, False: 0]
  ------------------
 3387|      0|    case SNMP_VERSION_2star:
  ------------------
  |  |  120|      0|#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
  ------------------
  |  Branch (3387:5): [True: 0, False: 0]
  ------------------
 3388|      0|    default:
  ------------------
  |  Branch (3388:5): [True: 0, False: 0]
  ------------------
 3389|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3390|      0|        return -1;
 3391|      0|    }
 3392|      0|    *pkt_len = cp - *pkt;
 3393|      0|    return 0;
 3394|      0|}
snmp_api.c:snmpv3_build:
 2336|      3|{
 2337|      3|    int             ret;
 2338|       |
 2339|      3|    session->s_snmp_errno = 0;
 2340|      3|    session->s_errno = 0;
 2341|       |
 2342|       |    /*
 2343|       |     * do validation for PDU types 
 2344|       |     */
 2345|      3|    switch (pdu->command) {
 2346|      0|    case SNMP_MSG_RESPONSE:
  ------------------
  |  |  127|      0|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2346:5): [True: 0, False: 3]
  ------------------
 2347|      0|    case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|      0|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2347:5): [True: 0, False: 3]
  ------------------
 2348|      3|    case SNMP_MSG_REPORT:
  ------------------
  |  |  147|      3|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   81|      3|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2348:5): [True: 3, False: 0]
  ------------------
 2349|      3|        netsnmp_assert(0 == (pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE));
  ------------------
  |  |   47|      3|#      define netsnmp_assert(x)  do { \
  |  |   48|      3|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 3, False: 0]
  |  |  ------------------
  |  |   49|      3|                 ; \
  |  |   50|      3|              else \
  |  |   51|      3|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      3|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2350|      3|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2449|      3|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 2351|      3|    case SNMP_MSG_INFORM:
  ------------------
  |  |  141|      3|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   81|      3|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2351:5): [True: 0, False: 3]
  ------------------
 2352|      3|#ifndef NETSNMP_NOTIFY_ONLY
 2353|      3|    case SNMP_MSG_GET:
  ------------------
  |  |  125|      3|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   81|      3|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2353:5): [True: 0, False: 3]
  ------------------
 2354|      3|    case SNMP_MSG_GETNEXT:
  ------------------
  |  |  126|      3|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   81|      3|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2354:5): [True: 0, False: 3]
  ------------------
 2355|      3|#endif /* ! NETSNMP_NOTIFY_ONLY */
 2356|      3|#ifndef NETSNMP_NO_WRITE_SUPPORT
 2357|      3|    case SNMP_MSG_SET:
  ------------------
  |  |  129|      3|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   81|      3|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2357:5): [True: 0, False: 3]
  ------------------
 2358|      3|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 2359|      3|        if (pdu->errstat == SNMP_DEFAULT_ERRSTAT)
  ------------------
  |  |   84|      3|#define SNMP_DEFAULT_ERRSTAT	    -1
  ------------------
  |  Branch (2359:13): [True: 0, False: 3]
  ------------------
 2360|      0|            pdu->errstat = 0;
 2361|      3|        if (pdu->errindex == SNMP_DEFAULT_ERRINDEX)
  ------------------
  |  |   85|      3|#define SNMP_DEFAULT_ERRINDEX	    -1
  ------------------
  |  Branch (2361:13): [True: 0, False: 3]
  ------------------
 2362|      0|            pdu->errindex = 0;
 2363|      3|        break;
 2364|       |
 2365|      0|#ifndef NETSNMP_NOTIFY_ONLY
 2366|      0|    case SNMP_MSG_GETBULK:
  ------------------
  |  |  140|      0|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2366:5): [True: 0, False: 3]
  ------------------
 2367|      0|        if (pdu->max_repetitions < 0) {
  ------------------
  |  |  161|      0|#define max_repetitions errindex
  ------------------
  |  Branch (2367:13): [True: 0, False: 0]
  ------------------
 2368|      0|            session->s_snmp_errno = SNMPERR_BAD_REPETITIONS;
  ------------------
  |  |  194|      0|#define SNMPERR_BAD_REPETITIONS		(-10)
  ------------------
 2369|      0|            return -1;
 2370|      0|        }
 2371|      0|        if (pdu->non_repeaters < 0) {
  ------------------
  |  |  160|      0|#define non_repeaters	errstat
  ------------------
  |  Branch (2371:13): [True: 0, False: 0]
  ------------------
 2372|      0|            session->s_snmp_errno = SNMPERR_BAD_REPEATERS;
  ------------------
  |  |  193|      0|#define SNMPERR_BAD_REPEATERS		(-9)
  ------------------
 2373|      0|            return -1;
 2374|      0|        }
 2375|      0|        break;
 2376|      0|#endif /* ! NETSNMP_NOTIFY_ONLY */
 2377|       |
 2378|      0|    case SNMP_MSG_TRAP:
  ------------------
  |  |  135|      0|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2378:5): [True: 0, False: 3]
  ------------------
 2379|      0|        session->s_snmp_errno = SNMPERR_V1_IN_V2;
  ------------------
  |  |  192|      0|#define SNMPERR_V1_IN_V2		(-8)
  ------------------
 2380|      0|        return -1;
 2381|       |
 2382|      0|    default:
  ------------------
  |  Branch (2382:5): [True: 0, False: 3]
  ------------------
 2383|      0|        session->s_snmp_errno = SNMPERR_UNKNOWN_PDU;
  ------------------
  |  |  207|      0|#define SNMPERR_UNKNOWN_PDU		(-23)
  ------------------
 2384|      0|        return -1;
 2385|      3|    }
 2386|       |
 2387|       |    /* Do we need to set the session security engineid? */
 2388|      3|    if (pdu->securityEngineIDLen == 0) {
  ------------------
  |  Branch (2388:9): [True: 0, False: 3]
  ------------------
 2389|      0|        if (session->securityEngineIDLen) {
  ------------------
  |  Branch (2389:13): [True: 0, False: 0]
  ------------------
 2390|      0|            snmpv3_clone_engineID(&pdu->securityEngineID,
 2391|      0|                                  &pdu->securityEngineIDLen,
 2392|      0|                                  session->securityEngineID,
 2393|      0|                                  session->securityEngineIDLen);
 2394|      0|        }
 2395|      0|    }
 2396|       |    
 2397|       |    /* Do we need to set the session context engineid? */
 2398|      3|    if (pdu->contextEngineIDLen == 0) {
  ------------------
  |  Branch (2398:9): [True: 0, False: 3]
  ------------------
 2399|      0|        if (session->contextEngineIDLen) {
  ------------------
  |  Branch (2399:13): [True: 0, False: 0]
  ------------------
 2400|      0|            snmpv3_clone_engineID(&pdu->contextEngineID,
 2401|      0|                                  &pdu->contextEngineIDLen,
 2402|      0|                                  session->contextEngineID,
 2403|      0|                                  session->contextEngineIDLen);
 2404|      0|        } else if (pdu->securityEngineIDLen) {
  ------------------
  |  Branch (2404:20): [True: 0, False: 0]
  ------------------
 2405|      0|            snmpv3_clone_engineID(&pdu->contextEngineID,
 2406|      0|                                  &pdu->contextEngineIDLen,
 2407|      0|                                  pdu->securityEngineID,
 2408|      0|                                  pdu->securityEngineIDLen);
 2409|      0|        }
 2410|      0|    }
 2411|       |
 2412|      3|    if (pdu->contextName == NULL) {
  ------------------
  |  Branch (2412:9): [True: 0, False: 3]
  ------------------
 2413|      0|        if (!session->contextName) {
  ------------------
  |  Branch (2413:13): [True: 0, False: 0]
  ------------------
 2414|      0|            session->s_snmp_errno = SNMPERR_BAD_CONTEXT;
  ------------------
  |  |  201|      0|#define SNMPERR_BAD_CONTEXT		(-17)
  ------------------
 2415|      0|            return -1;
 2416|      0|        }
 2417|      0|        pdu->contextName = strdup(session->contextName);
 2418|      0|        if (pdu->contextName == NULL) {
  ------------------
  |  Branch (2418:13): [True: 0, False: 0]
  ------------------
 2419|      0|            session->s_snmp_errno = SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 2420|      0|            return -1;
 2421|      0|        }
 2422|      0|        pdu->contextNameLen = session->contextNameLen;
 2423|      0|    }
 2424|      3|    if (pdu->securityModel == SNMP_DEFAULT_SECMODEL) {
  ------------------
  |  |   91|      3|#define SNMP_DEFAULT_SECMODEL	    -1
  ------------------
  |  Branch (2424:9): [True: 0, False: 3]
  ------------------
 2425|      0|        pdu->securityModel = session->securityModel;
 2426|      0|        if (pdu->securityModel == SNMP_DEFAULT_SECMODEL) {
  ------------------
  |  |   91|      0|#define SNMP_DEFAULT_SECMODEL	    -1
  ------------------
  |  Branch (2426:13): [True: 0, False: 0]
  ------------------
 2427|      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
  ------------------
 2428|       |            
 2429|      0|            if (pdu->securityModel <= 0) {
  ------------------
  |  Branch (2429:17): [True: 0, False: 0]
  ------------------
 2430|      0|                pdu->securityModel = SNMP_SEC_MODEL_USM;
  ------------------
  |  |  295|      0|#define SNMP_SEC_MODEL_USM		3
  ------------------
 2431|      0|            }
 2432|      0|        }
 2433|      0|    }
 2434|      3|    if (pdu->securityNameLen == 0 && pdu->securityName == NULL) {
  ------------------
  |  Branch (2434:9): [True: 3, False: 0]
  |  Branch (2434:38): [True: 0, False: 3]
  ------------------
 2435|      0|        if (session->securityModel != SNMP_SEC_MODEL_TSM &&
  ------------------
  |  |  296|      0|#define SNMP_SEC_MODEL_TSM              4
  ------------------
  |  Branch (2435:13): [True: 0, False: 0]
  ------------------
 2436|      0|            session->securityNameLen == 0) {
  ------------------
  |  Branch (2436:13): [True: 0, False: 0]
  ------------------
 2437|      0|            session->s_snmp_errno = SNMPERR_BAD_SEC_NAME;
  ------------------
  |  |  211|      0|#define SNMPERR_BAD_SEC_NAME 		(-27)
  ------------------
 2438|      0|            return -1;
 2439|      0|        }
 2440|      0|        if (session->securityName) {
  ------------------
  |  Branch (2440:13): [True: 0, False: 0]
  ------------------
 2441|      0|            pdu->securityName = strdup(session->securityName);
 2442|      0|            if (pdu->securityName == NULL) {
  ------------------
  |  Branch (2442:17): [True: 0, False: 0]
  ------------------
 2443|      0|                session->s_snmp_errno = SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 2444|      0|                return -1;
 2445|      0|            }
 2446|      0|            pdu->securityNameLen = session->securityNameLen;
 2447|      0|        } else {
 2448|      0|            pdu->securityName = strdup("");
 2449|      0|            session->securityName = strdup("");
 2450|      0|            if (pdu->securityName == NULL || session->securityName == NULL) {
  ------------------
  |  Branch (2450:17): [True: 0, False: 0]
  |  Branch (2450:46): [True: 0, False: 0]
  ------------------
 2451|      0|                SNMP_FREE(pdu->securityName);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2452|      0|                SNMP_FREE(session->securityName);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2453|      0|                session->s_snmp_errno = SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 2454|      0|                return -1;
 2455|      0|            }
 2456|      0|        }
 2457|      0|    }
 2458|      3|    if (pdu->securityLevel == 0) {
  ------------------
  |  Branch (2458:9): [True: 0, False: 3]
  ------------------
 2459|      0|        if (session->securityLevel == 0) {
  ------------------
  |  Branch (2459:13): [True: 0, False: 0]
  ------------------
 2460|      0|            session->s_snmp_errno = SNMPERR_BAD_SEC_LEVEL;
  ------------------
  |  |  212|      0|#define SNMPERR_BAD_SEC_LEVEL 		(-28)
  ------------------
 2461|      0|            return -1;
 2462|      0|        }
 2463|      0|        pdu->securityLevel = session->securityLevel;
 2464|      0|    }
 2465|      3|    DEBUGMSGTL(("snmp_build",
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164: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: 3]
  |  |  ------------------
  ------------------
 2466|      3|                "Building SNMPv3 message (secName:\"%s\", secLevel:%s)...\n",
 2467|      3|                ((session->securityName) ? (char *) session->securityName :
 2468|      3|                 ((pdu->securityName) ? (char *) pdu->securityName :
 2469|      3|                  "ERROR: undefined")),
 2470|      3|                (pdu->securityLevel >= 0 && pdu->securityLevel < 4) ?
 2471|      3|                secLevelName[pdu->securityLevel] : "ERROR: invalid"));
 2472|       |
 2473|      3|    DEBUGDUMPSECTION("send", "SNMPv3 Message");
  ------------------
  |  |   81|      3|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2474|      3|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 2475|      3|    if (!(pdu->flags & UCD_MSG_FLAG_FORWARD_ENCODE)) {
  ------------------
  |  |  319|      3|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
  |  Branch (2475:9): [True: 3, False: 0]
  ------------------
 2476|      3|        ret = snmpv3_packet_realloc_rbuild(pkt, pkt_len, offset,
 2477|      3|                                           session, pdu, NULL, 0);
 2478|      3|    } else {
 2479|      0|#endif
 2480|      0|        ret = snmpv3_packet_build(session, pdu, *pkt, pkt_len, NULL, 0);
 2481|      0|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 2482|      0|    }
 2483|      3|#endif
 2484|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2485|      3|    if (-1 != ret) {
  ------------------
  |  Branch (2485:9): [True: 3, False: 0]
  ------------------
 2486|      3|        session->s_snmp_errno = ret;
 2487|      3|    }
 2488|       |
 2489|      3|    return ret;
 2490|       |
 2491|      3|}                               /* end snmpv3_build() */
snmp_api.c:free_securityStateRef:
 4240|    519|{
 4241|    519|    struct snmp_secmod_def *sptr;
 4242|       |
 4243|    519|    if (!pdu->securityStateRef)
  ------------------
  |  Branch (4243:9): [True: 519, False: 0]
  ------------------
 4244|    519|        return;
 4245|       |
 4246|      0|    sptr = find_sec_mod(pdu->securityModel);
 4247|      0|    if (sptr) {
  ------------------
  |  Branch (4247:9): [True: 0, False: 0]
  ------------------
 4248|      0|        if (sptr->pdu_free_state_ref) {
  ------------------
  |  Branch (4248:13): [True: 0, False: 0]
  ------------------
 4249|      0|            (*sptr->pdu_free_state_ref) (pdu->securityStateRef);
 4250|      0|        } else {
 4251|      0|            snmp_log(LOG_ERR,
 4252|      0|                     "Security Model %d can't free state references\n",
 4253|      0|                     pdu->securityModel);
 4254|      0|	}
 4255|      0|    } else {
 4256|      0|	snmp_log(LOG_ERR,
 4257|      0|		 "Can't find security model to free ptr: %d\n",
 4258|      0|		 pdu->securityModel);
 4259|      0|    }
 4260|       |    pdu->securityStateRef = NULL;
 4261|      0|}
snmp_api.c:_snmp_parse:
 4469|    426|{
 4470|    426|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4471|    426|    u_char          community[COMMUNITY_MAX_LEN];
 4472|    426|    size_t          community_length = COMMUNITY_MAX_LEN;
  ------------------
  |  |   41|    426|#define COMMUNITY_MAX_LEN	256
  ------------------
 4473|    426|#endif
 4474|    426|    int             result = -1;
 4475|       |
 4476|    426|    static const oid snmpEngineIDoid[]   = { 1,3,6,1,6,3,10,2,1,1,0};
 4477|    426|    static size_t   snmpEngineIDoid_len = 11;
 4478|       |
 4479|    426|    static char     ourEngineID[SNMP_SEC_PARAM_BUF_SIZE];
 4480|    426|    static size_t   ourEngineID_len = sizeof(ourEngineID);
 4481|       |
 4482|    426|    netsnmp_pdu    *pdu2 = NULL;
 4483|       |
 4484|    426|    session->s_snmp_errno = 0;
 4485|    426|    session->s_errno = 0;
 4486|       |
 4487|       |    /*
 4488|       |     * Ensure all incoming PDUs have a unique means of identification 
 4489|       |     * (This is not restricted to AgentX handling,
 4490|       |     * though that is where the need becomes visible)   
 4491|       |     */
 4492|    426|    pdu->transid = snmp_get_next_transid();
 4493|       |
 4494|    426|    if (session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |   90|    426|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4494:9): [True: 0, False: 426]
  ------------------
 4495|      0|        pdu->version = session->version;
 4496|    426|    } else {
 4497|    426|        pdu->version = snmp_parse_version(data, length);
 4498|    426|    }
 4499|       |
 4500|    426|    switch (pdu->version) {
 4501|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4502|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4503|     20|    case SNMP_VERSION_1:
  ------------------
  |  |  107|     20|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4503:5): [True: 20, False: 406]
  ------------------
 4504|     20|#endif
 4505|     20|#ifndef NETSNMP_DISABLE_SNMPV2C
 4506|     20|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|     20|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (4506:5): [True: 0, False: 426]
  ------------------
 4507|     20|#endif
 4508|     20|        NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pdu->version,unsupported_version);
  ------------------
  |  |  220|     20|#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pc_ver, pc_target) do {    \
  |  |  221|     20|        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||                \
  |  |  ------------------
  |  |  |  |  205|     40|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|     40|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 20, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  206|     40|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|     20|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (206:6): [True: 0, False: 20]
  |  |  |  |  ------------------
  |  |  |  |  207|     20|                            NETSNMP_DS_LIB_DISABLE_V1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|     20|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  222|     20|            NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver)) {                \
  |  |  ------------------
  |  |  |  |  215|     20|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|     40|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 0, False: 20]
  |  |  |  |  ------------------
  |  |  |  |  216|     20|     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|     20|    } while(0)
  |  |  ------------------
  |  |  |  Branch (226:13): [Folded, False: 20]
  |  |  ------------------
  ------------------
 4509|     20|        DEBUGMSGTL(("snmp_api", "Parsing SNMPv%ld message...\n",
  ------------------
  |  |   66|     20|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     20|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 20]
  |  |  ------------------
  ------------------
 4510|     20|                    (1 + pdu->version)));
 4511|       |
 4512|       |        /*
 4513|       |         * authenticates message and returns length if valid 
 4514|       |         */
 4515|     20|#ifndef NETSNMP_DISABLE_SNMPV1
 4516|     20|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|     20|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4516:13): [True: 20, False: 0]
  ------------------
 4517|     20|            DEBUGDUMPSECTION("recv", "SNMPv1 message\n");
  ------------------
  |  |   81|     20|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     20|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 20]
  |  |  ------------------
  ------------------
 4518|     20|        } else {
 4519|      0|#endif
 4520|      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]
  |  |  ------------------
  ------------------
 4521|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4522|      0|        }
 4523|     20|#endif
 4524|     20|        data = snmp_comstr_parse(data, &length,
 4525|     20|                                 community, &community_length,
 4526|     20|                                 &pdu->version);
 4527|     20|        if (data == NULL)
  ------------------
  |  Branch (4527:13): [True: 3, False: 17]
  ------------------
 4528|      3|            return -1;
 4529|       |
 4530|     17|        if (pdu->version != session->version &&
  ------------------
  |  Branch (4530:13): [True: 17, False: 0]
  ------------------
 4531|     17|            session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |   90|     17|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4531:13): [True: 0, False: 17]
  ------------------
 4532|      0|            session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4533|      0|            return -1;
 4534|      0|        }
 4535|       |
 4536|       |        /*
 4537|       |         * maybe get the community string. 
 4538|       |         */
 4539|     17|        pdu->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|     17|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4540|     17|        pdu->securityModel = 
 4541|     17|#ifndef NETSNMP_DISABLE_SNMPV1
 4542|     17|            (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  107|     17|#define SNMP_VERSION_1	   0
  ------------------
                          (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  293|     17|#define SNMP_SEC_MODEL_SNMPv1		1
  ------------------
  |  Branch (4542:13): [True: 17, False: 0]
  ------------------
 4543|     17|#endif
 4544|     17|                                               SNMP_SEC_MODEL_SNMPv2c;
  ------------------
  |  |  294|     17|#define SNMP_SEC_MODEL_SNMPv2c		2
  ------------------
 4545|     17|        SNMP_FREE(pdu->community);
  ------------------
  |  |   62|     17|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 17]
  |  |  |  Branch (62:66): [Folded, False: 17]
  |  |  ------------------
  ------------------
 4546|     17|        pdu->community_len = 0;
 4547|     17|        pdu->community = (u_char *) 0;
 4548|     17|        if (community_length) {
  ------------------
  |  Branch (4548:13): [True: 0, False: 17]
  ------------------
 4549|      0|            pdu->community_len = community_length;
 4550|      0|            pdu->community = netsnmp_memdup(community, community_length);
 4551|      0|            if (pdu->community == NULL) {
  ------------------
  |  Branch (4551:17): [True: 0, False: 0]
  ------------------
 4552|      0|                session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4553|      0|                return -1;
 4554|      0|            }
 4555|      0|        }
 4556|     17|        if (session->authenticator) {
  ------------------
  |  Branch (4556:13): [True: 0, False: 17]
  ------------------
 4557|      0|            data = session->authenticator(data, &length,
 4558|      0|                                          community, community_length);
 4559|      0|            if (data == NULL) {
  ------------------
  |  Branch (4559:17): [True: 0, False: 0]
  ------------------
 4560|      0|                session->s_snmp_errno = SNMPERR_AUTHENTICATION_FAILURE;
  ------------------
  |  |  219|      0|#define SNMPERR_AUTHENTICATION_FAILURE 	(-35)
  ------------------
 4561|      0|                return -1;
 4562|      0|            }
 4563|      0|        }
 4564|       |
 4565|     17|        DEBUGDUMPSECTION("recv", "PDU");
  ------------------
  |  |   81|     17|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     17|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 17]
  |  |  ------------------
  ------------------
 4566|     17|        result = snmp_pdu_parse(pdu, data, &length);
 4567|     17|        if (result < 0) {
  ------------------
  |  Branch (4567:13): [True: 17, False: 0]
  ------------------
 4568|       |            /*
 4569|       |             * This indicates a parse error.  
 4570|       |             */
 4571|     17|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     17|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4572|     17|        }
 4573|     17|        DEBUGINDENTADD(-6);
  ------------------
  |  |   73|     17|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     17|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 17]
  |  |  ------------------
  ------------------
 4574|     17|        break;
 4575|      0|#endif /* support for community based SNMP */
 4576|       |
 4577|     87|    case SNMP_VERSION_3:
  ------------------
  |  |  113|     87|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (4577:5): [True: 87, False: 339]
  ------------------
 4578|     87|        NETSNMP_RUNTIME_PROTOCOL_CHECK_V3(SNMP_VERSION_3,unsupported_version);
  ------------------
  |  |  233|     87|#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V3(pc_ver, pc_target) do {      \
  |  |  234|     87|        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver)) {                \
  |  |  ------------------
  |  |  |  |  229|     87|    ((pc_ver == SNMP_VERSION_3) &&                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|     87|#define SNMP_VERSION_3     3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (229:6): [True: 87, Folded]
  |  |  |  |  ------------------
  |  |  |  |  230|     87|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|     87|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (230:6): [True: 0, False: 87]
  |  |  |  |  ------------------
  |  |  |  |  231|     87|                            NETSNMP_DS_LIB_DISABLE_V3))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|     87|#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|     87|    } while(0)
  |  |  ------------------
  |  |  |  Branch (238:13): [Folded, False: 87]
  |  |  ------------------
  ------------------
 4579|     87|        result = snmpv3_parse(pdu, data, &length, NULL, session);
 4580|     87|        DEBUGMSGTL(("snmp_parse",
  ------------------
  |  |   66|     87|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     87|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 87]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#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: 87]
  |  |  ------------------
  ------------------
 4581|     87|                    "Parsed SNMPv3 message (secName:%s, secLevel:%s): %s\n",
 4582|     87|                    pdu->securityName,
 4583|     87|                    (pdu->securityLevel >= 0 && pdu->securityLevel < 4) ?
 4584|     87|                    secLevelName[pdu->securityLevel] : "ERROR: invalid",
 4585|     87|                    snmp_api_errstring(result)));
 4586|       |
 4587|     87|        if (result == SNMPERR_USM_UNKNOWNSECURITYNAME) {
  ------------------
  |  |  227|     87|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (4587:13): [True: 0, False: 87]
  ------------------
 4588|      0|            snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
  ------------------
  |  |   19|      0|#define SNMP_CALLBACK_APPLICATION 1
  ------------------
 4589|      0|                                SNMPD_CALLBACK_AUTH_FAILURE, pdu);
  ------------------
  |  |   21|      0|#define SNMPD_CALLBACK_AUTH_FAILURE             17
  ------------------
 4590|      0|        }
 4591|       |        
 4592|     87|        if (result) {
  ------------------
  |  Branch (4592:13): [True: 87, False: 0]
  ------------------
 4593|     87|            struct snmp_secmod_def *secmod =
 4594|     87|                find_sec_mod(pdu->securityModel);
 4595|     87|            if (!slp) {
  ------------------
  |  Branch (4595:17): [True: 0, False: 87]
  ------------------
 4596|      0|                session->s_snmp_errno = result;
 4597|     87|            } else {
 4598|       |                /*
 4599|       |                 * Call the security model to special handle any errors
 4600|       |                 */
 4601|       |
 4602|     87|                if (secmod && secmod->handle_report) {
  ------------------
  |  Branch (4602:21): [True: 25, False: 62]
  |  Branch (4602:31): [True: 25, False: 0]
  ------------------
 4603|     25|                    (*secmod->handle_report)(slp, slp->transport, session,
 4604|     25|                                             result, pdu);
 4605|     25|                }
 4606|     87|            }
 4607|     87|            free_securityStateRef(pdu);
 4608|     87|        }
 4609|       |
 4610|       |        /* Implement RFC5343 here for two reasons:
 4611|       |           1) From a security perspective it handles this otherwise
 4612|       |              always approved request earlier.  It bypasses the need
 4613|       |              for authorization to the snmpEngineID scalar, which is
 4614|       |              what is what RFC3415 appendix A species as ok.  Note
 4615|       |              that we haven't bypassed authentication since if there
 4616|       |              was an authentication error it would have been handled
 4617|       |              above in the if(result) part at the latest.
 4618|       |           2) From an application point of view if we let this request
 4619|       |              get all the way to the application, it'd require that
 4620|       |              all application types supporting discovery also fire up
 4621|       |              a minimal agent in order to handle just this request
 4622|       |              which seems like overkill.  Though there is no other
 4623|       |              application types that currently need discovery (NRs
 4624|       |              accept notifications from contextEngineIDs that derive
 4625|       |              from the NO not the NR).  Also a lame excuse for doing
 4626|       |              it here.
 4627|       |           3) Less important technically, but the net-snmp agent
 4628|       |              doesn't currently handle registrations of different
 4629|       |              engineIDs either and it would have been a lot more work
 4630|       |              to implement there since we'd need to support that
 4631|       |              first. :-/ Supporting multiple context engineIDs should
 4632|       |              be done anyway, so it's not a valid excuse here.
 4633|       |           4) There is a lot less to do if we trump the agent at this
 4634|       |              point; IE, the agent does a lot more unnecessary
 4635|       |              processing when the only thing that should ever be in
 4636|       |              this context by definition is the single scalar.
 4637|       |        */
 4638|       |
 4639|       |        /* special RFC5343 engineID discovery engineID check */
 4640|     87|        if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     87|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (4640:13): [True: 87, False: 0]
  ------------------
 4641|     87|                                    NETSNMP_DS_LIB_NO_DISCOVERY) &&
  ------------------
  |  |   98|     87|#define NETSNMP_DS_LIB_NO_DISCOVERY        38 /* don't support RFC5343 contextEngineID discovery */
  ------------------
 4642|     87|            SNMP_MSG_RESPONSE       != pdu->command &&
  ------------------
  |  |  127|     87|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   81|     87|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   85|     87|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4642:13): [True: 87, False: 0]
  ------------------
 4643|     87|            NULL                    != pdu->contextEngineID &&
  ------------------
  |  Branch (4643:13): [True: 25, False: 62]
  ------------------
 4644|     25|            pdu->contextEngineIDLen == 5 &&
  ------------------
  |  Branch (4644:13): [True: 10, False: 15]
  ------------------
 4645|     10|            pdu->contextEngineID[0] == 0x80 &&
  ------------------
  |  Branch (4645:13): [True: 0, False: 10]
  ------------------
 4646|      0|            pdu->contextEngineID[1] == 0x00 &&
  ------------------
  |  Branch (4646:13): [True: 0, False: 0]
  ------------------
 4647|      0|            pdu->contextEngineID[2] == 0x00 &&
  ------------------
  |  Branch (4647:13): [True: 0, False: 0]
  ------------------
 4648|      0|            pdu->contextEngineID[3] == 0x00 &&
  ------------------
  |  Branch (4648:13): [True: 0, False: 0]
  ------------------
 4649|      0|            pdu->contextEngineID[4] == 0x06) {
  ------------------
  |  Branch (4649:13): [True: 0, False: 0]
  ------------------
 4650|       |
 4651|       |            /* define a result so it doesn't get past us at this point
 4652|       |               and gets dropped by future parts of the stack */
 4653|      0|            result = SNMPERR_JUST_A_CONTEXT_PROBE;
  ------------------
  |  |  250|      0|#define SNMPERR_JUST_A_CONTEXT_PROBE    (-66)
  ------------------
 4654|       |
 4655|      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]
  |  |  ------------------
  ------------------
 4656|       |            /* ensure exactly one variable */
 4657|      0|            if (NULL != pdu->variables &&
  ------------------
  |  Branch (4657:17): [True: 0, False: 0]
  ------------------
 4658|      0|                NULL == pdu->variables->next_variable &&
  ------------------
  |  Branch (4658:17): [True: 0, False: 0]
  ------------------
 4659|       |
 4660|       |                /* if it's a GET, match it exactly */
 4661|      0|                ((SNMP_MSG_GET == pdu->command &&
  ------------------
  |  |  125|      0|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4661:19): [True: 0, False: 0]
  ------------------
 4662|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4662:19): [True: 0, False: 0]
  ------------------
 4663|      0|                                   snmpEngineIDoid_len,
 4664|      0|                                   pdu->variables->name,
 4665|      0|                                   pdu->variables->name_length) == 0)
 4666|       |                 /* if it's a GETNEXT ensure it's less than the engineID oid */
 4667|      0|                 ||
 4668|      0|                 (SNMP_MSG_GETNEXT == pdu->command &&
  ------------------
  |  |  126|      0|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4668:19): [True: 0, False: 0]
  ------------------
 4669|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4669:19): [True: 0, False: 0]
  ------------------
 4670|      0|                                   snmpEngineIDoid_len,
 4671|      0|                                   pdu->variables->name,
 4672|      0|                                   pdu->variables->name_length) > 0)
 4673|      0|                    )) {
 4674|       |
 4675|      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]
  |  |  ------------------
  ------------------
 4676|      0|                            "  One correct variable found\n"));
 4677|       |
 4678|       |                /* Note: we're explicitly not handling a GETBULK.  Deal. */
 4679|       |
 4680|       |                /* set up the response */
 4681|      0|                pdu2 = snmp_clone_pdu(pdu);
 4682|      0|                if (NULL == pdu2) {
  ------------------
  |  Branch (4682:21): [True: 0, False: 0]
  ------------------
 4683|      0|                    snmp_log(LOG_ERR, "failed to clone PDU for rfc5343 probe\n");
 4684|      0|                    if (pdu->securityStateRef)
  ------------------
  |  Branch (4684:25): [True: 0, False: 0]
  ------------------
 4685|      0|                        free_securityStateRef(pdu);
 4686|      0|                    return result;
 4687|      0|                }
 4688|       |
 4689|       |                /* free the current varbind */
 4690|      0|                snmp_free_varbind(pdu2->variables);
 4691|       |
 4692|       |                /* set the variables */
 4693|      0|                pdu2->variables = NULL;
 4694|      0|                pdu2->command = SNMP_MSG_RESPONSE;
  ------------------
  |  |  127|      0|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   85|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
 4695|      0|                pdu2->errstat = 0;
 4696|      0|                pdu2->errindex = 0;
 4697|       |
 4698|      0|                ourEngineID_len =
 4699|      0|                    snmpv3_get_engineID((u_char*)ourEngineID, ourEngineID_len);
 4700|      0|                if (0 != ourEngineID_len) {
  ------------------
  |  Branch (4700:21): [True: 0, False: 0]
  ------------------
 4701|       |
 4702|      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]
  |  |  ------------------
  ------------------
 4703|      0|                                "  responding with our engineID\n"));
 4704|       |
 4705|      0|                    snmp_pdu_add_variable(pdu2,
 4706|      0|                                          snmpEngineIDoid, snmpEngineIDoid_len,
 4707|      0|                                          ASN_OCTET_STR,
  ------------------
  |  |   67|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 4708|      0|                                          ourEngineID, ourEngineID_len);
 4709|       |                    
 4710|       |                    /* send the response */
 4711|      0|                    if (0 == snmp_sess_send(slp, pdu2)) {
  ------------------
  |  Branch (4711:25): [True: 0, False: 0]
  ------------------
 4712|       |
 4713|      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]
  |  |  ------------------
  ------------------
 4714|      0|                                    "  sent it off!\n"));
 4715|       |
 4716|      0|                        snmp_free_pdu(pdu2);
 4717|       |                        
 4718|      0|                        snmp_log(LOG_ERR, "sending a response to the context engineID probe failed\n");
 4719|      0|                    }
 4720|      0|                } else {
 4721|      0|                    snmp_log(LOG_ERR, "failed to get our own engineID!\n");
 4722|      0|                    snmp_free_pdu(pdu2);
 4723|      0|                }
 4724|      0|            } else {
 4725|      0|                snmp_log(LOG_WARNING,
 4726|      0|                         "received an odd context engineID probe\n");
 4727|      0|            }
 4728|      0|            if (pdu->securityStateRef)
  ------------------
  |  Branch (4728:17): [True: 0, False: 0]
  ------------------
 4729|      0|                free_securityStateRef(pdu);
 4730|      0|        }
 4731|       |
 4732|     87|        break;
 4733|    314|    case SNMPERR_BAD_VERSION:
  ------------------
  |  |  198|    314|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
  |  Branch (4733:5): [True: 314, False: 112]
  ------------------
 4734|    314|        ERROR_MSG("error parsing snmp message version");
  ------------------
  |  |  188|    314|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4735|    314|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|    314|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4736|    314|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|    314|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4737|    314|        break;
 4738|       |
 4739|      0|        unsupported_version:  /* goto label */
 4740|      0|    case SNMP_VERSION_sec:
  ------------------
  |  |  118|      0|#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4740:5): [True: 0, False: 426]
  ------------------
 4741|      0|    case SNMP_VERSION_2u:
  ------------------
  |  |  112|      0|#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
  ------------------
  |  Branch (4741:5): [True: 0, False: 426]
  ------------------
 4742|      0|    case SNMP_VERSION_2star:
  ------------------
  |  |  120|      0|#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4742:5): [True: 0, False: 426]
  ------------------
 4743|      0|    case SNMP_VERSION_2p:
  ------------------
  |  |  119|      0|#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
  ------------------
  |  Branch (4743:5): [True: 0, False: 426]
  ------------------
 4744|      5|    default:
  ------------------
  |  Branch (4744:5): [True: 5, False: 421]
  ------------------
 4745|      5|        ERROR_MSG("unsupported snmp message version");
  ------------------
  |  |  188|      5|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4746|      5|        snmp_increment_statistic(STAT_SNMPINBADVERSIONS);
  ------------------
  |  |  634|      5|#define  STAT_SNMPINBADVERSIONS              11
  ------------------
 4747|       |
 4748|       |        /*
 4749|       |         * need better way to determine OS independent
 4750|       |         * INT32_MAX value, for now hardcode
 4751|       |         */
 4752|      5|        if (pdu->version < 0 || pdu->version > 2147483647) {
  ------------------
  |  Branch (4752:13): [True: 2, False: 3]
  |  Branch (4752:33): [True: 0, False: 3]
  ------------------
 4753|      2|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      2|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4754|      2|        }
 4755|      5|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      5|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4756|      5|        break;
 4757|    426|    }
 4758|       |
 4759|    423|    return result;
 4760|    426|}
snmp_api.c:snmp_parse_version:
 3871|    426|{
 3872|    426|    u_char          type;
 3873|    426|    long            version = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|    426|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3874|       |
 3875|    426|    data = asn_parse_sequence(data, &length, &type,
 3876|    426|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "version");
  ------------------
  |  |   73|    426|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "version");
  ------------------
  |  |   85|    426|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3877|    426|    if (data) {
  ------------------
  |  Branch (3877:9): [True: 426, False: 0]
  ------------------
 3878|    426|        DEBUGDUMPHEADER("recv", "SNMP Version");
  ------------------
  |  |   79|    426|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    426|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 426]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 426]
  |  |  ------------------
  ------------------
 3879|    426|        data =
 3880|    426|            asn_parse_int(data, &length, &type, &version, sizeof(version));
 3881|    426|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    426|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    426|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 426]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 426]
  |  |  ------------------
  ------------------
 3882|    426|        if (!data || type != ASN_INTEGER) {
  ------------------
  |  |   64|    112|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3882:13): [True: 314, False: 112]
  |  Branch (3882:22): [True: 0, False: 112]
  ------------------
 3883|    314|            return SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|    314|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3884|    314|        }
 3885|    426|    }
 3886|    112|    return version;
 3887|    426|}
snmp_api.c:netsnmp_build_packet:
 5175|      3|{
 5176|      3|    size_t offset = 0;
 5177|      3|    int    result;
 5178|       |
 5179|      3|    if (isp && isp->hook_realloc_build) {
  ------------------
  |  Branch (5179:9): [True: 3, False: 0]
  |  Branch (5179:16): [True: 0, False: 3]
  ------------------
 5180|      0|        result = isp->hook_realloc_build(sp, pdu, pktbuf_p, pktbuf_len_p,
 5181|      0|                                         &offset);
 5182|       |
 5183|      0|        *pkt_p = *pktbuf_p;
 5184|      0|        *len_p = offset;
 5185|      3|    } else if (isp && isp->hook_build) {
  ------------------
  |  Branch (5185:16): [True: 3, False: 0]
  |  Branch (5185:23): [True: 0, False: 3]
  ------------------
 5186|      0|        *pkt_p = *pktbuf_p;
 5187|      0|        *len_p = *pktbuf_len_p;
 5188|      0|        result = isp->hook_build(sp, pdu, *pktbuf_p, len_p);
 5189|      3|    } else {
 5190|      3|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 5191|      3|        if (!(pdu->flags & UCD_MSG_FLAG_FORWARD_ENCODE)) {
  ------------------
  |  |  319|      3|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
  |  Branch (5191:13): [True: 3, False: 0]
  ------------------
 5192|      3|            result = snmp_build(pktbuf_p, pktbuf_len_p, &offset, sp, pdu);
 5193|      3|            *pkt_p = *pktbuf_p + *pktbuf_len_p - offset;
 5194|      3|            *len_p = offset;
 5195|      3|        } else {
 5196|      0|#endif
 5197|      0|            *pkt_p = *pktbuf_p;
 5198|      0|            *len_p = *pktbuf_len_p;
 5199|      0|            result = snmp_build(pktbuf_p, len_p, &offset, sp, pdu);
 5200|      0|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 5201|      0|        }
 5202|      3|#endif
 5203|      3|    }
 5204|       |
 5205|      3|    return result;
 5206|      3|}
snmp_api.c:_sess_async_send:
 5498|      3|{
 5499|      3|    netsnmp_session *session;
 5500|      3|    struct snmp_internal_session *isp;
 5501|      3|    netsnmp_transport *transport = NULL;
 5502|      3|    int             result;
 5503|      3|    long            reqid;
 5504|       |
 5505|      3|    if (slp == NULL || NULL == slp->session || NULL ==slp->internal ||
  ------------------
  |  Branch (5505:9): [True: 0, False: 3]
  |  Branch (5505:24): [True: 0, False: 3]
  |  Branch (5505:48): [True: 0, False: 3]
  ------------------
 5506|      3|                NULL == slp->transport) {
  ------------------
  |  Branch (5506:17): [True: 0, False: 3]
  ------------------
 5507|      0|        return 0;
 5508|      0|    }
 5509|       |
 5510|      3|    session = slp->session;
 5511|      3|    isp = slp->internal;
 5512|      3|    transport = slp->transport;
 5513|       |
 5514|      3|    if (NULL == isp->opacket) {
  ------------------
  |  Branch (5514:9): [True: 3, False: 0]
  ------------------
 5515|      3|        result = _build_initial_pdu_packet(slp, pdu, 0);
 5516|      3|        if ((SNMPERR_SUCCESS != result) || (NULL == isp->opacket)) {
  ------------------
  |  |  184|      3|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (5516:13): [True: 0, False: 3]
  |  Branch (5516:44): [True: 0, False: 3]
  ------------------
 5517|      0|            if (callback) {
  ------------------
  |  Branch (5517:17): [True: 0, False: 0]
  ------------------
 5518|      0|                switch (session->s_snmp_errno) {
 5519|       |                    /*
 5520|       |                     * some of these probably don't make sense here, but
 5521|       |                     * it's a rough first cut.
 5522|       |                     */
 5523|      0|                    case SNMPERR_BAD_ENG_ID:
  ------------------
  |  |  210|      0|#define SNMPERR_BAD_ENG_ID 		(-26)
  ------------------
  |  Branch (5523:21): [True: 0, False: 0]
  ------------------
 5524|      0|                    case SNMPERR_BAD_SEC_LEVEL:
  ------------------
  |  |  212|      0|#define SNMPERR_BAD_SEC_LEVEL 		(-28)
  ------------------
  |  Branch (5524:21): [True: 0, False: 0]
  ------------------
 5525|      0|                    case SNMPERR_UNKNOWN_SEC_MODEL:
  ------------------
  |  |  214|      0|#define SNMPERR_UNKNOWN_SEC_MODEL 	(-30)
  ------------------
  |  Branch (5525:21): [True: 0, False: 0]
  ------------------
 5526|      0|                    case SNMPERR_UNKNOWN_ENG_ID:
  ------------------
  |  |  216|      0|#define SNMPERR_UNKNOWN_ENG_ID          (-32)
  ------------------
  |  Branch (5526:21): [True: 0, False: 0]
  ------------------
 5527|      0|                    case SNMPERR_UNKNOWN_USER_NAME:
  ------------------
  |  |  217|      0|#define SNMPERR_UNKNOWN_USER_NAME 	(-33)
  ------------------
  |  Branch (5527:21): [True: 0, False: 0]
  ------------------
 5528|      0|                    case SNMPERR_UNSUPPORTED_SEC_LEVEL:
  ------------------
  |  |  218|      0|#define SNMPERR_UNSUPPORTED_SEC_LEVEL 	(-34)
  ------------------
  |  Branch (5528:21): [True: 0, False: 0]
  ------------------
 5529|      0|                    case SNMPERR_AUTHENTICATION_FAILURE:
  ------------------
  |  |  219|      0|#define SNMPERR_AUTHENTICATION_FAILURE 	(-35)
  ------------------
  |  Branch (5529:21): [True: 0, False: 0]
  ------------------
 5530|      0|                    case SNMPERR_NOT_IN_TIME_WINDOW:
  ------------------
  |  |  220|      0|#define SNMPERR_NOT_IN_TIME_WINDOW 	(-36)
  ------------------
  |  Branch (5530:21): [True: 0, False: 0]
  ------------------
 5531|      0|                    case SNMPERR_USM_GENERICERROR:
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
  |  Branch (5531:21): [True: 0, False: 0]
  ------------------
 5532|      0|                    case SNMPERR_USM_UNKNOWNSECURITYNAME:
  ------------------
  |  |  227|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (5532:21): [True: 0, False: 0]
  ------------------
 5533|      0|                    case SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL:
  ------------------
  |  |  228|      0|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
  |  Branch (5533:21): [True: 0, False: 0]
  ------------------
 5534|      0|                    case SNMPERR_USM_ENCRYPTIONERROR:
  ------------------
  |  |  229|      0|#define SNMPERR_USM_ENCRYPTIONERROR		(-45)
  ------------------
  |  Branch (5534:21): [True: 0, False: 0]
  ------------------
 5535|      0|                    case SNMPERR_USM_AUTHENTICATIONFAILURE:
  ------------------
  |  |  230|      0|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
  |  Branch (5535:21): [True: 0, False: 0]
  ------------------
 5536|      0|                    case SNMPERR_USM_PARSEERROR:
  ------------------
  |  |  231|      0|#define SNMPERR_USM_PARSEERROR			(-47)
  ------------------
  |  Branch (5536:21): [True: 0, False: 0]
  ------------------
 5537|      0|                    case SNMPERR_USM_UNKNOWNENGINEID:
  ------------------
  |  |  232|      0|#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
  ------------------
  |  Branch (5537:21): [True: 0, False: 0]
  ------------------
 5538|      0|                    case SNMPERR_USM_NOTINTIMEWINDOW:
  ------------------
  |  |  233|      0|#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
  ------------------
  |  Branch (5538:21): [True: 0, False: 0]
  ------------------
 5539|      0|                        callback(NETSNMP_CALLBACK_OP_SEC_ERROR, session,
  ------------------
  |  |  325|      0|#define NETSNMP_CALLBACK_OP_SEC_ERROR		7
  ------------------
 5540|      0|                                 pdu->reqid, pdu, cb_data);
 5541|      0|                        break;
 5542|      0|                    case SNMPERR_TIMEOUT: /* engineID probe timed out */
  ------------------
  |  |  208|      0|#define SNMPERR_TIMEOUT 		(-24)
  ------------------
  |  Branch (5542:21): [True: 0, False: 0]
  ------------------
 5543|      0|                        callback(NETSNMP_CALLBACK_OP_TIMED_OUT, session,
  ------------------
  |  |  320|      0|#define NETSNMP_CALLBACK_OP_TIMED_OUT		2
  ------------------
 5544|      0|                                 pdu->reqid, pdu, cb_data);
 5545|      0|                        break;
 5546|      0|                    default:
  ------------------
  |  Branch (5546:21): [True: 0, False: 0]
  ------------------
 5547|      0|                        callback(NETSNMP_CALLBACK_OP_SEND_FAILED, session,
  ------------------
  |  |  321|      0|#define NETSNMP_CALLBACK_OP_SEND_FAILED		3
  ------------------
 5548|      0|                                 pdu->reqid, pdu, cb_data);
 5549|      0|                        break;
 5550|      0|                }
 5551|      0|            }
 5552|       |            /** no packet to send?? */
 5553|      0|            return 0;
 5554|      0|        }
 5555|      3|    }
 5556|       |
 5557|       |    /*
 5558|       |     * Send the message.  
 5559|       |     */
 5560|       |
 5561|      3|    DEBUGMSGTL(("sess_process_packet", "sending message id#%ld reqid#%ld len %"
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 3]
  |  |  ------------------
  ------------------
 5562|      3|                NETSNMP_PRIz "u\n", pdu->msgid, pdu->reqid, isp->opacket_len));
 5563|      3|    result = netsnmp_transport_send(transport, isp->opacket, isp->opacket_len,
 5564|      3|                                    &(pdu->transport_data),
 5565|      3|                                    &(pdu->transport_data_length));
 5566|       |
 5567|      3|    SNMP_FREE(isp->obuf);
  ------------------
  |  |   62|      3|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 3, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 3]
  |  |  ------------------
  ------------------
 5568|      3|    isp->opacket = NULL; /* opacket was in obuf, so no free needed */
 5569|      3|    isp->opacket_len = 0;
 5570|       |
 5571|      3|    if (result < 0) {
  ------------------
  |  Branch (5571:9): [True: 0, False: 3]
  ------------------
 5572|      0|        session->s_snmp_errno = SNMPERR_BAD_SENDTO;
  ------------------
  |  |  196|      0|#define SNMPERR_BAD_SENDTO		(-12)
  ------------------
 5573|      0|        session->s_errno = errno;
 5574|      0|        if (callback)
  ------------------
  |  Branch (5574:13): [True: 0, False: 0]
  ------------------
 5575|      0|            callback(NETSNMP_CALLBACK_OP_SEND_FAILED, session,
  ------------------
  |  |  321|      0|#define NETSNMP_CALLBACK_OP_SEND_FAILED		3
  ------------------
 5576|      0|                     pdu->reqid, pdu, cb_data);
 5577|      0|        return 0;
 5578|      0|    }
 5579|       |
 5580|      3|    reqid = pdu->reqid;
 5581|       |
 5582|       |    /*
 5583|       |     * Bug 2387: 0 is a valid request id, so since reqid is used as a return
 5584|       |     * code with 0 meaning an error, set reqid to 1 if there is no error. This
 5585|       |     * does not affect the request id in the packet and fixes a memory leak
 5586|       |     * for incoming PDUs with a request id of 0. This could cause some
 5587|       |     * confusion if the caller is expecting the request id to match the
 5588|       |     * return code, as the documentation states it will. Most example code
 5589|       |     * just checks for non-zero, so hopefully this wont be an issue.
 5590|       |     */
 5591|      3|    if (0 == reqid && (SNMPERR_SUCCESS == session->s_snmp_errno))
  ------------------
  |  |  184|      3|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (5591:9): [True: 3, False: 0]
  |  Branch (5591:23): [True: 3, False: 0]
  ------------------
 5592|      3|        ++reqid;
 5593|       |
 5594|       |    /*
 5595|       |     * Add to pending requests list if we expect a response.  
 5596|       |     */
 5597|      3|    if (pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE) {
  ------------------
  |  |  312|      3|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
  |  Branch (5597:9): [True: 0, False: 3]
  ------------------
 5598|      0|        netsnmp_request_list *rp;
 5599|      0|        struct timeval  tv;
 5600|       |
 5601|      0|        rp = calloc(1, sizeof(netsnmp_request_list));
 5602|      0|        if (rp == NULL) {
  ------------------
  |  Branch (5602:13): [True: 0, False: 0]
  ------------------
 5603|      0|            session->s_snmp_errno = SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5604|      0|            return 0;
 5605|      0|        }
 5606|       |
 5607|      0|        netsnmp_get_monotonic_clock(&tv);
 5608|      0|        rp->pdu = pdu;
 5609|      0|        rp->request_id = pdu->reqid;
 5610|      0|        rp->message_id = pdu->msgid;
 5611|      0|        rp->callback = callback;
 5612|      0|        if (cp_inc && cb_data) {
  ------------------
  |  Branch (5612:13): [True: 0, False: 0]
  |  Branch (5612:23): [True: 0, False: 0]
  ------------------
 5613|      0|            netsnmp_refcnt_void *aux_cb_data = (netsnmp_refcnt_void*) cb_data;
 5614|      0|            aux_cb_data->refcnt++;
 5615|      0|            rp->cb_data_refcounted = 1;
 5616|      0|	}
 5617|      0|        rp->cb_data = cb_data;
 5618|      0|        rp->retries = 0;
 5619|      0|        if (pdu->flags & UCD_MSG_FLAG_PDU_TIMEOUT) {
  ------------------
  |  |  315|      0|#define UCD_MSG_FLAG_PDU_TIMEOUT            0x1000
  ------------------
  |  Branch (5619:13): [True: 0, False: 0]
  ------------------
 5620|      0|            rp->timeout = pdu->time * 1000000L;
 5621|      0|        } else {
 5622|      0|            rp->timeout = session->timeout;
 5623|      0|        }
 5624|      0|        rp->timeM = tv;
 5625|      0|        tv.tv_usec += rp->timeout;
 5626|      0|        tv.tv_sec += tv.tv_usec / 1000000L;
 5627|      0|        tv.tv_usec %= 1000000L;
 5628|      0|        rp->expireM = tv;
 5629|       |
 5630|       |        /*
 5631|       |         * XX lock should be per session ! 
 5632|       |         */
 5633|      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]
  |  |  ------------------
  ------------------
 5634|      0|        if (isp->requestsEnd) {
  ------------------
  |  Branch (5634:13): [True: 0, False: 0]
  ------------------
 5635|      0|            rp->next_request = isp->requestsEnd->next_request;
 5636|      0|            isp->requestsEnd->next_request = rp;
 5637|      0|            isp->requestsEnd = rp;
 5638|      0|        } else {
 5639|      0|            rp->next_request = isp->requests;
 5640|      0|            isp->requests = rp;
 5641|      0|            isp->requestsEnd = rp;
 5642|      0|        }
 5643|      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]
  |  |  ------------------
  ------------------
 5644|      3|    } else {
 5645|       |        /*
 5646|       |         * No response expected...  
 5647|       |         */
 5648|      3|        if (reqid) {
  ------------------
  |  Branch (5648:13): [True: 3, False: 0]
  ------------------
 5649|       |            /*
 5650|       |             * Free v1 or v2 TRAP PDU iff no error  
 5651|       |             */
 5652|      3|            snmp_free_pdu(pdu);
 5653|      3|        }
 5654|      3|    }
 5655|       |
 5656|      3|    return reqid;
 5657|      3|}
snmp_api.c:_sess_packet_deadline_expired:
 6250|     65|{
 6251|     65|    struct timeval now;
 6252|       |
 6253|     65|    if (isp == NULL || !timerisset(&isp->packet_deadline))
  ------------------
  |  Branch (6253:9): [True: 0, False: 65]
  |  Branch (6253:24): [True: 0, False: 65]
  ------------------
 6254|     65|        return 0;
 6255|      0|    netsnmp_get_monotonic_clock(&now);
 6256|       |    return !timercmp(&now, &isp->packet_deadline, <);
  ------------------
  |  Branch (6256:13): [True: 0, False: 0]
  ------------------
 6257|     65|}
snmp_api.c:__sess_read:
 6527|     65|{
 6528|     65|    netsnmp_session *sp = slp ? slp->session : NULL;
  ------------------
  |  Branch (6528:27): [True: 65, False: 0]
  ------------------
 6529|     65|    struct snmp_internal_session *isp = slp ? slp->internal : NULL;
  ------------------
  |  Branch (6529:41): [True: 65, False: 0]
  ------------------
 6530|     65|    netsnmp_transport *transport = slp ? slp->transport : NULL;
  ------------------
  |  Branch (6530:36): [True: 65, False: 0]
  ------------------
 6531|     65|    size_t          pdulen = 0;
 6532|     65|    size_t          rxbuf_len;
 6533|     65|    size_t          stream_limit;
 6534|     65|    u_char         *rxbuf = NULL;
 6535|     65|    int             length = 0, olength = 0, rc = 0;
 6536|     65|    void           *opaque = NULL;
 6537|       |
 6538|     65|    if (NULL == slp || NULL == sp || NULL == isp || NULL == transport) {
  ------------------
  |  Branch (6538:9): [True: 0, False: 65]
  |  Branch (6538:24): [True: 0, False: 65]
  |  Branch (6538:38): [True: 0, False: 65]
  |  Branch (6538:53): [True: 0, False: 65]
  ------------------
 6539|      0|        snmp_log(LOG_ERR, "bad parameters to __sess_read\n");
 6540|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 6541|      0|    }
 6542|       |
 6543|       |    /* to avoid subagent crash */
 6544|     65|    if (!NETSNMP_IS_VALID_SOCKET(transport->sock)) {
  ------------------
  |  |   44|     65|#define NETSNMP_IS_VALID_SOCKET(_sock) ((_sock) != -1)
  ------------------
  |  Branch (6544:9): [True: 0, False: 65]
  ------------------
 6545|      0|        snmp_log(LOG_INFO, "transport->sock is invalid\n");
 6546|      0|        return 0; 
 6547|      0|    }
 6548|       |
 6549|     65|    sp->s_snmp_errno = 0;
 6550|     65|    sp->s_errno = 0;
 6551|       |
 6552|     65|    stream_limit = sp->rcvMsgMaxSize ?
  ------------------
  |  Branch (6552:20): [True: 65, False: 0]
  ------------------
 6553|     65|        SNMP_MIN(SNMP_MAX_PACKET_LEN, sp->rcvMsgMaxSize) :
  ------------------
  |  |  111|     65|#define SNMP_MIN(a,b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (111:24): [True: 65, False: 0]
  |  |  ------------------
  ------------------
 6554|     65|        SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|     65|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
 6555|     65|    rxbuf_len = SNMP_MIN(SNMP_MAX_RCV_MSG_SIZE, stream_limit);
  ------------------
  |  |  111|     65|#define SNMP_MIN(a,b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (111:24): [True: 65, False: 0]
  |  |  ------------------
  ------------------
 6556|       |
 6557|     65|    if (transport->flags & NETSNMP_TRANSPORT_FLAG_LISTEN)
  ------------------
  |  |   52|     65|#define		NETSNMP_TRANSPORT_FLAG_LISTEN	 0x02
  ------------------
  |  Branch (6557:9): [True: 0, False: 65]
  ------------------
 6558|      0|        return _sess_read_accept(slp);
 6559|       |
 6560|     65|    if (!(transport->flags & NETSNMP_TRANSPORT_FLAG_STREAM)) {
  ------------------
  |  |   51|     65|#define		NETSNMP_TRANSPORT_FLAG_STREAM	 0x01
  ------------------
  |  Branch (6560:9): [True: 65, False: 0]
  ------------------
 6561|     65|        snmp_rcv_packet rcvp;
 6562|     65|        u_char *pptr;
 6563|     65|        size_t len_remaining, pdulen;
 6564|     65|        void *ocopy = NULL;
 6565|       |
 6566|     65|        memset(&rcvp, 0x0, sizeof(rcvp));
 6567|       |
 6568|       |        /** read the packet */
 6569|     65|        rc = _sess_read_dgram_packet(slp, &rcvp);
 6570|     65|        if (-1 == rc) /* protocol error */
  ------------------
  |  Branch (6570:13): [True: 0, False: 65]
  ------------------
 6571|      0|            return -1;
 6572|     65|        else if (-2 == rc) /* no packet to process */
  ------------------
  |  Branch (6572:18): [True: 0, False: 65]
  ------------------
 6573|      0|            return 0;
 6574|       |
 6575|     65|        pptr = rcvp.packet;
 6576|     65|        len_remaining = rcvp.packet_len;
 6577|     65|        rc = 0;
 6578|       |
 6579|    491|        while (len_remaining > 0) {
  ------------------
  |  Branch (6579:16): [True: 483, False: 8]
  ------------------
 6580|    483|            if (isp->check_packet) {
  ------------------
  |  Branch (6580:17): [True: 0, False: 483]
  ------------------
 6581|      0|                pdulen = isp->check_packet(pptr, len_remaining);
 6582|    483|            } else {
 6583|    483|                pdulen = asn_check_packet(pptr, len_remaining);
 6584|    483|            }
 6585|    483|            if (pdulen == 0 || pdulen > len_remaining || pdulen > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|    426|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (6585:17): [True: 24, False: 459]
  |  Branch (6585:32): [True: 33, False: 426]
  |  Branch (6585:58): [True: 0, False: 426]
  ------------------
 6586|       |                /* Not a valid packet or incomplete in datagram mode */
 6587|     57|                if (pptr == rcvp.packet) {
  ------------------
  |  Branch (6587:21): [True: 39, False: 18]
  ------------------
 6588|     39|                    SNMP_FREE(rcvp.opaque);
  ------------------
  |  |   62|     39|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 39, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 39]
  |  |  ------------------
  ------------------
 6589|     39|                }
 6590|     57|                break;
 6591|     57|            }
 6592|    426|            if (pdulen < len_remaining) {
  ------------------
  |  Branch (6592:17): [True: 418, False: 8]
  ------------------
 6593|    418|                if (rcvp.olength > 0 && rcvp.opaque != NULL) {
  ------------------
  |  Branch (6593:21): [True: 418, False: 0]
  |  Branch (6593:41): [True: 418, False: 0]
  ------------------
 6594|    418|                    ocopy = malloc(rcvp.olength);
 6595|    418|                    if (ocopy != NULL) {
  ------------------
  |  Branch (6595:25): [True: 418, False: 0]
  ------------------
 6596|    418|                        memcpy(ocopy, rcvp.opaque, rcvp.olength);
 6597|    418|                    }
 6598|    418|                }
 6599|    418|            } else {
 6600|      8|                ocopy = rcvp.opaque;
 6601|      8|                rcvp.opaque = NULL;
 6602|      8|            }
 6603|    426|            rc = _sess_process_packet(slp, sp, isp, transport,
 6604|    426|                                      ocopy, ocopy ? rcvp.olength : 0,
  ------------------
  |  Branch (6604:46): [True: 426, False: 0]
  ------------------
 6605|    426|                                      pptr, pdulen);
 6606|    426|            ocopy = NULL;
 6607|    426|            pptr += pdulen;
 6608|    426|            len_remaining -= pdulen;
 6609|    426|        }
 6610|     65|        SNMP_FREE(rcvp.packet);
  ------------------
  |  |   62|     65|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 65, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 65]
  |  |  ------------------
  ------------------
 6611|     65|        SNMP_FREE(rcvp.opaque);
  ------------------
  |  |   62|     65|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 18, False: 47]
  |  |  |  Branch (62:66): [Folded, False: 65]
  |  |  ------------------
  ------------------
 6612|     65|        return rc;
 6613|     65|    }
 6614|       |
 6615|       |    /** stream transport */
 6616|       |
 6617|      0|        if (isp->packet_len >= stream_limit) {
  ------------------
  |  Branch (6617:13): [True: 0, False: 0]
  ------------------
 6618|      0|            _sess_close_stream(slp);
 6619|      0|            return -1;
 6620|      0|        }
 6621|      0|        rxbuf_len = SNMP_MIN(rxbuf_len, stream_limit - isp->packet_len);
  ------------------
  |  |  111|      0|#define SNMP_MIN(a,b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (111:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 6622|       |
 6623|      0|        if (isp->packet == NULL) {
  ------------------
  |  Branch (6623:13): [True: 0, False: 0]
  ------------------
 6624|       |            /*
 6625|       |             * We have no saved packet.  Allocate one.  
 6626|       |             */
 6627|      0|            if ((isp->packet = (u_char *) malloc(rxbuf_len)) == NULL) {
  ------------------
  |  Branch (6627:17): [True: 0, False: 0]
  ------------------
 6628|      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]
  |  |  ------------------
  ------------------
 6629|      0|                            "u bytes for rxbuf\n", rxbuf_len));
 6630|      0|                return 0;
 6631|      0|            } else {
 6632|      0|                rxbuf = isp->packet;
 6633|      0|                isp->packet_size = rxbuf_len;
 6634|      0|                isp->packet_len = 0;
 6635|      0|            }
 6636|      0|        } else {
 6637|       |            /*
 6638|       |             * We have saved a partial packet from last time.  Extend that, if
 6639|       |             * necessary, and receive new data after the old data.  
 6640|       |             */
 6641|      0|            u_char         *newbuf;
 6642|       |
 6643|      0|            if (isp->packet_size < isp->packet_len + rxbuf_len) {
  ------------------
  |  Branch (6643:17): [True: 0, False: 0]
  ------------------
 6644|      0|                newbuf =
 6645|      0|                    (u_char *) realloc(isp->packet,
 6646|      0|                                       isp->packet_len + rxbuf_len);
 6647|      0|                if (newbuf == NULL) {
  ------------------
  |  Branch (6647:21): [True: 0, False: 0]
  ------------------
 6648|      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]
  |  |  ------------------
  ------------------
 6649|      0|                                "can't malloc %" NETSNMP_PRIz
 6650|      0|                                "u more for rxbuf (%" NETSNMP_PRIz "u tot)\n",
 6651|      0|                                rxbuf_len, isp->packet_len + rxbuf_len));
 6652|      0|                    return 0;
 6653|      0|                } else {
 6654|      0|                    isp->packet = newbuf;
 6655|      0|                    isp->packet_size = isp->packet_len + rxbuf_len;
 6656|      0|                    rxbuf = isp->packet + isp->packet_len;
 6657|      0|                }
 6658|      0|            } else {
 6659|      0|                rxbuf = isp->packet + isp->packet_len;
 6660|      0|                rxbuf_len = isp->packet_size - isp->packet_len;
 6661|      0|            }
 6662|      0|        }
 6663|       |
 6664|      0|    length = netsnmp_transport_recv(transport, rxbuf, rxbuf_len, &opaque,
 6665|      0|                                    &olength);
 6666|       |
 6667|      0|    if (0 == length && transport->flags & NETSNMP_TRANSPORT_FLAG_EMPTY_PKT) {
  ------------------
  |  |   56|      0|#define		NETSNMP_TRANSPORT_FLAG_EMPTY_PKT 0x10
  ------------------
  |  Branch (6667:9): [True: 0, False: 0]
  |  Branch (6667:24): [True: 0, False: 0]
  ------------------
 6668|       |        /* this allows for a transport that needs to return from
 6669|       |         * packet processing that doesn't necessarily have any
 6670|       |         * consumable data in it. */
 6671|       |
 6672|       |        /* reset the flag since it's a per-message flag */
 6673|      0|        transport->flags &= (~NETSNMP_TRANSPORT_FLAG_EMPTY_PKT);
  ------------------
  |  |   56|      0|#define		NETSNMP_TRANSPORT_FLAG_EMPTY_PKT 0x10
  ------------------
 6674|       |
 6675|      0|        return 0;
 6676|      0|    }
 6677|       |
 6678|       |    /*
 6679|       |     * Remote end closed connection.  
 6680|       |     */
 6681|      0|    if (length <= 0) {
  ------------------
  |  Branch (6681:9): [True: 0, False: 0]
  ------------------
 6682|       |        /*
 6683|       |         * Alert the application if possible.  
 6684|       |         */
 6685|      0|        _sess_close_stream(slp);
 6686|      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]
  |  |  ------------------
  ------------------
 6687|      0|        return -1;
 6688|      0|    }
 6689|       |
 6690|      0|    {
 6691|      0|        u_char *pptr = isp->packet;
 6692|      0|	void *ocopy = NULL;
 6693|       |
 6694|      0|        isp->packet_len += length;
 6695|       |
 6696|      0|        while (isp->packet_len > 0) {
  ------------------
  |  Branch (6696:16): [True: 0, False: 0]
  ------------------
 6697|       |
 6698|       |            /*
 6699|       |             * Get the total data length we're expecting (and need to wait
 6700|       |             * for).
 6701|       |             */
 6702|      0|            if (isp->check_packet) {
  ------------------
  |  Branch (6702:17): [True: 0, False: 0]
  ------------------
 6703|      0|                pdulen = isp->check_packet(pptr, isp->packet_len);
 6704|      0|            } else {
 6705|      0|                pdulen = asn_check_packet(pptr, isp->packet_len);
 6706|      0|            }
 6707|       |
 6708|      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]
  |  |  ------------------
  ------------------
 6709|      0|                        "  loop packet_len %" NETSNMP_PRIz "u, PDU length %"
 6710|      0|                        NETSNMP_PRIz "u\n", isp->packet_len, pdulen));
 6711|       |
 6712|      0|            if ((int)pdulen < 0 || pdulen > SNMP_MAX_PACKET_LEN ||
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (6712:17): [True: 0, False: 0]
  |  Branch (6712:36): [True: 0, False: 0]
  ------------------
 6713|      0|                (sp->rcvMsgMaxSize && pdulen > sp->rcvMsgMaxSize)) {
  ------------------
  |  Branch (6713:18): [True: 0, False: 0]
  |  Branch (6713:39): [True: 0, False: 0]
  ------------------
 6714|       |                /*
 6715|       |                 * Illegal length, drop the connection.  
 6716|       |                 */
 6717|      0|                snmp_log(LOG_ERR, 
 6718|      0|			 "Received broken packet. Closing session.\n");
 6719|      0|                _sess_close_stream(slp);
 6720|      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]
  |  |  ------------------
  ------------------
 6721|      0|                return -1;
 6722|      0|            }
 6723|       |
 6724|      0|            if (pdulen > isp->packet_len || pdulen == 0) {
  ------------------
  |  Branch (6724:17): [True: 0, False: 0]
  |  Branch (6724:45): [True: 0, False: 0]
  ------------------
 6725|       |                /*
 6726|       |                 * We don't have a complete packet yet.  If we've already
 6727|       |                 * processed a packet, break out so we'll shift this packet
 6728|       |                 * to the start of the buffer. If we're already at the
 6729|       |                 * start, simply return and wait for more data to arrive.
 6730|       |                 */
 6731|      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]
  |  |  ------------------
  ------------------
 6732|      0|                            "pkt not complete (need %" NETSNMP_PRIz "u got %"
 6733|      0|                            NETSNMP_PRIz "u so far)\n", pdulen,
 6734|      0|                            isp->packet_len));
 6735|       |
 6736|      0|                if (pptr != isp->packet)
  ------------------
  |  Branch (6736:21): [True: 0, False: 0]
  ------------------
 6737|      0|                    break; /* opaque freed for us outside of loop. */
 6738|       |
 6739|      0|                if (!timerisset(&isp->packet_deadline))
  ------------------
  |  Branch (6739:21): [True: 0, False: 0]
  ------------------
 6740|      0|                    _sess_set_packet_deadline(isp);
 6741|      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]
  |  |  ------------------
  ------------------
 6742|      0|                return 0;
 6743|      0|            }
 6744|       |
 6745|       |            /*  We have *at least* one complete packet in the buffer now.  If
 6746|       |		we have possibly more than one packet, we must copy the opaque
 6747|       |		pointer because we may need to reuse it for a later packet.  */
 6748|       |
 6749|      0|	    if (pdulen < isp->packet_len) {
  ------------------
  |  Branch (6749:10): [True: 0, False: 0]
  ------------------
 6750|      0|		if (olength > 0 && opaque != NULL) {
  ------------------
  |  Branch (6750:7): [True: 0, False: 0]
  |  Branch (6750:22): [True: 0, False: 0]
  ------------------
 6751|      0|		    ocopy = malloc(olength);
 6752|      0|		    if (ocopy != NULL) {
  ------------------
  |  Branch (6752:11): [True: 0, False: 0]
  ------------------
 6753|      0|			memcpy(ocopy, opaque, olength);
 6754|      0|		    }
 6755|      0|		}
 6756|      0|	    } else if (pdulen == isp->packet_len) {
  ------------------
  |  Branch (6756:17): [True: 0, False: 0]
  ------------------
 6757|       |		/*  Common case -- exactly one packet.  No need to copy the
 6758|       |		    opaque pointer.  */
 6759|      0|		ocopy = opaque;
 6760|      0|		opaque = NULL;
 6761|      0|	    }
 6762|       |
 6763|      0|            if ((rc = _sess_process_packet(slp, sp, isp, transport,
  ------------------
  |  Branch (6763:17): [True: 0, False: 0]
  ------------------
 6764|      0|                                           ocopy, ocopy?olength:0, pptr,
  ------------------
  |  Branch (6764:51): [True: 0, False: 0]
  ------------------
 6765|      0|                                           pdulen))) {
 6766|       |                /*
 6767|       |                 * Something went wrong while processing this packet -- set the
 6768|       |                 * errno.  
 6769|       |                 */
 6770|      0|                if (sp->s_snmp_errno != 0) {
  ------------------
  |  Branch (6770:21): [True: 0, False: 0]
  ------------------
 6771|      0|                    SET_SNMP_ERROR(sp->s_snmp_errno);
  ------------------
  |  |   43|      0|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 6772|      0|                }
 6773|      0|            }
 6774|      0|            timerclear(&isp->packet_deadline);
 6775|       |
 6776|       |	    /*  ocopy has been free()d by _sess_process_packet by this point,
 6777|       |		so set it to NULL.  */
 6778|       |
 6779|      0|	    ocopy = NULL;
 6780|       |
 6781|       |	    /*  Step past the packet we've just dealt with.  */
 6782|       |
 6783|      0|            pptr += pdulen;
 6784|      0|            isp->packet_len -= pdulen;
 6785|      0|        }
 6786|       |
 6787|       |	/*  If we had more than one packet, then we were working with copies
 6788|       |	    of the opaque pointer, so we still need to free() the opaque
 6789|       |	    pointer itself.  */
 6790|       |
 6791|      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]
  |  |  ------------------
  ------------------
 6792|       |
 6793|      0|        if (isp->packet_len >= stream_limit) {
  ------------------
  |  Branch (6793:13): [True: 0, False: 0]
  ------------------
 6794|       |            /*
 6795|       |             * Obviously this should never happen!  
 6796|       |             */
 6797|      0|            snmp_log(LOG_ERR,
 6798|      0|                     "too large packet_len = %" NETSNMP_PRIz
 6799|      0|                     "u, dropping connection %" NETSNMP_FMT_SKT "\n",
 6800|      0|                     isp->packet_len, transport->sock);
 6801|      0|            _sess_close_stream(slp);
 6802|      0|            return -1;
 6803|      0|        } else if (isp->packet_len == 0) {
  ------------------
  |  Branch (6803:20): [True: 0, False: 0]
  ------------------
 6804|       |            /*
 6805|       |             * This is good: it means the packet buffer contained an integral
 6806|       |             * number of PDUs, so we don't have to save any data for next
 6807|       |             * time.  We can free() the buffer now to keep the memory
 6808|       |             * footprint down.
 6809|       |             */
 6810|      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]
  |  |  ------------------
  ------------------
 6811|      0|            isp->packet_size = 0;
 6812|      0|            isp->packet_len = 0;
 6813|      0|            timerclear(&isp->packet_deadline);
 6814|      0|            return rc;
 6815|      0|        }
 6816|       |
 6817|       |        /*
 6818|       |         * If we get here, then there is a partial packet of length
 6819|       |         * isp->packet_len bytes starting at pptr left over.  Move that to the
 6820|       |         * start of the buffer, and then realloc() the buffer down to size to
 6821|       |         * reduce the memory footprint.  
 6822|       |         */
 6823|       |
 6824|      0|        memmove(isp->packet, pptr, isp->packet_len);
 6825|      0|        if (!timerisset(&isp->packet_deadline))
  ------------------
  |  Branch (6825:13): [True: 0, False: 0]
  ------------------
 6826|      0|            _sess_set_packet_deadline(isp);
 6827|      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]
  |  |  ------------------
  ------------------
 6828|      0|                    "end: memmove(%p, %p, %" NETSNMP_PRIz "u); realloc(%p, %"
 6829|      0|                    NETSNMP_PRIz "u)\n",
 6830|      0|                    isp->packet, pptr, isp->packet_len,
 6831|      0|		    isp->packet, isp->packet_len));
 6832|       |
 6833|      0|        if ((rxbuf = (u_char *)realloc(isp->packet, isp->packet_len)) == NULL) {
  ------------------
  |  Branch (6833:13): [True: 0, False: 0]
  ------------------
 6834|       |            /*
 6835|       |             * I don't see why this should ever fail, but it's not a big deal.
 6836|       |             */
 6837|      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]
  |  |  ------------------
  ------------------
 6838|      0|        } else {
 6839|      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]
  |  |  ------------------
  ------------------
 6840|      0|                        isp->packet, rxbuf));
 6841|      0|            isp->packet = rxbuf;
 6842|      0|            isp->packet_size = isp->packet_len;
 6843|      0|        }
 6844|      0|    }
 6845|       |
 6846|      0|    return rc;
 6847|      0|}
snmp_api.c:_sess_read_dgram_packet:
 6469|     65|{
 6470|     65|    netsnmp_session *sp = slp ? slp->session : NULL;
  ------------------
  |  Branch (6470:27): [True: 65, False: 0]
  ------------------
 6471|     65|    struct snmp_internal_session *isp = slp ? slp->internal : NULL;
  ------------------
  |  Branch (6471:41): [True: 65, False: 0]
  ------------------
 6472|     65|    netsnmp_transport *transport = slp ? slp->transport : NULL;
  ------------------
  |  Branch (6472:36): [True: 65, False: 0]
  ------------------
 6473|       |
 6474|     65|    if (!sp || !isp || !transport || !rcvp ) {
  ------------------
  |  Branch (6474:9): [True: 0, False: 65]
  |  Branch (6474:16): [True: 0, False: 65]
  |  Branch (6474:24): [True: 0, False: 65]
  |  Branch (6474:38): [True: 0, False: 65]
  ------------------
 6475|      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]
  |  |  ------------------
  ------------------
 6476|      0|        return -2;
 6477|      0|    }
 6478|       |
 6479|     65|    if (transport->flags & NETSNMP_TRANSPORT_FLAG_STREAM)
  ------------------
  |  |   51|     65|#define		NETSNMP_TRANSPORT_FLAG_STREAM	 0x01
  ------------------
  |  Branch (6479:9): [True: 0, False: 65]
  ------------------
 6480|      0|        return -2;
 6481|       |
 6482|     65|    if (NULL != rcvp->packet) {
  ------------------
  |  Branch (6482:9): [True: 0, False: 65]
  ------------------
 6483|      0|        snmp_log(LOG_WARNING, "overwriting existing saved packet; sess %p\n",
 6484|      0|                 sp);
 6485|      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]
  |  |  ------------------
  ------------------
 6486|      0|    }
 6487|       |
 6488|     65|    if ((rcvp->packet = (u_char *) malloc(SNMP_MAX_RCV_MSG_SIZE)) == NULL) {
  ------------------
  |  |  108|     65|#define SNMP_MAX_RCV_MSG_SIZE      65536
  ------------------
  |  Branch (6488:9): [True: 0, False: 65]
  ------------------
 6489|      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]
  |  |  ------------------
  ------------------
 6490|      0|                    SNMP_MAX_RCV_MSG_SIZE));
 6491|      0|        return -2;
 6492|      0|    }
 6493|       |
 6494|     65|    rcvp->packet_len = netsnmp_transport_recv(transport, rcvp->packet,
 6495|     65|                                              SNMP_MAX_RCV_MSG_SIZE,
  ------------------
  |  |  108|     65|#define SNMP_MAX_RCV_MSG_SIZE      65536
  ------------------
 6496|     65|                                              &rcvp->opaque, &rcvp->olength);
 6497|     65|    if (rcvp->packet_len == -1) {
  ------------------
  |  Branch (6497:9): [True: 0, False: 65]
  ------------------
 6498|      0|        sp->s_snmp_errno = SNMPERR_BAD_RECVFROM;
  ------------------
  |  |  209|      0|#define SNMPERR_BAD_RECVFROM 		(-25)
  ------------------
 6499|      0|        sp->s_errno = errno;
 6500|      0|        snmp_set_detail(strerror(errno));
 6501|      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]
  |  |  ------------------
  ------------------
 6502|      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]
  |  |  ------------------
  ------------------
 6503|      0|        return -1;
 6504|      0|    }
 6505|       |
 6506|     65|    if (0 == rcvp->packet_len &&
  ------------------
  |  Branch (6506:9): [True: 0, False: 65]
  ------------------
 6507|      0|        transport->flags & NETSNMP_TRANSPORT_FLAG_EMPTY_PKT) {
  ------------------
  |  |   56|      0|#define		NETSNMP_TRANSPORT_FLAG_EMPTY_PKT 0x10
  ------------------
  |  Branch (6507:9): [True: 0, False: 0]
  ------------------
 6508|       |        /* this allows for a transport that needs to return from
 6509|       |         * packet processing that doesn't necessarily have any
 6510|       |         * consumable data in it. */
 6511|       |
 6512|       |        /* reset the flag since it's a per-message flag */
 6513|      0|        transport->flags &= (~NETSNMP_TRANSPORT_FLAG_EMPTY_PKT);
  ------------------
  |  |   56|      0|#define		NETSNMP_TRANSPORT_FLAG_EMPTY_PKT 0x10
  ------------------
 6514|       |
 6515|       |        /** free packet */
 6516|      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]
  |  |  ------------------
  ------------------
 6517|      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]
  |  |  ------------------
  ------------------
 6518|       |
 6519|      0|        return -2;
 6520|      0|    }
 6521|       |
 6522|     65|    return 0;
 6523|     65|}
snmp_api.c:_sess_process_packet:
 6201|    426|{
 6202|    426|    netsnmp_pdu         *pdu;
 6203|    426|    int                  rc;
 6204|       |
 6205|    426|    pdu = _sess_process_packet_parse_pdu(slp, sp, isp, transport, opaque,
 6206|    426|                                         olength, packetptr, length);
 6207|    426|    if (NULL == pdu)
  ------------------
  |  Branch (6207:9): [True: 426, False: 0]
  ------------------
 6208|    426|        return -1;
 6209|       |
 6210|       |    /*
 6211|       |     * find session to process pdu. usually that will be the current session,
 6212|       |     * but with the introduction of shared transports, another session may
 6213|       |     * have the same socket.
 6214|       |     */
 6215|      0|    do {
 6216|      0|        rc = _sess_process_packet_handle_pdu(slp, sp, isp, transport, pdu);
 6217|      0|        if (-2 != rc || !(transport->flags & NETSNMP_TRANSPORT_FLAG_SHARED))
  ------------------
  |  |   58|      0|#define		NETSNMP_TRANSPORT_FLAG_SHARED	 0x40
  ------------------
  |  Branch (6217:13): [True: 0, False: 0]
  |  Branch (6217:25): [True: 0, False: 0]
  ------------------
 6218|      0|            break;
 6219|       |
 6220|       |        /** -2 means pdu not in request list. check other sessions */
 6221|      0|        do  {
 6222|      0|            slp = slp->next;
 6223|      0|        } while (slp && slp->transport->sock != transport->sock);
  ------------------
  |  Branch (6223:18): [True: 0, False: 0]
  |  Branch (6223:25): [True: 0, False: 0]
  ------------------
 6224|      0|        if (!slp)
  ------------------
  |  Branch (6224:13): [True: 0, False: 0]
  ------------------
 6225|      0|            break; /* no more sessions with same socket */
 6226|       |
 6227|      0|        sp = slp->session;
 6228|      0|        isp = slp->internal;
 6229|      0|        transport = slp->transport;
 6230|      0|    } while(slp);
  ------------------
  |  Branch (6230:13): [True: 0, False: 0]
  ------------------
 6231|       |
 6232|      0|    if (-2 == rc) { /* did not find session for pdu */
  ------------------
  |  Branch (6232:9): [True: 0, False: 0]
  ------------------
 6233|      0|        snmp_increment_statistic(STAT_SNMPUNKNOWNPDUHANDLERS);
  ------------------
  |  |  613|      0|#define   STAT_SNMPUNKNOWNPDUHANDLERS        2
  ------------------
 6234|      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]
  |  |  ------------------
  ------------------
 6235|      0|        snmp_free_pdu(pdu);
 6236|      0|    }
 6237|       |
 6238|      0|  return rc;
 6239|    426|}
snmp_api.c:_sess_process_packet_parse_pdu:
 5805|    426|{
 5806|    426|  netsnmp_pdu    *pdu;
 5807|    426|  int             ret = 0;
 5808|    426|  int             dump = 0, filter = 0;
 5809|       |
 5810|    426|  debug_indent_reset();
 5811|       |
 5812|    426|  DEBUGMSGTL(("sess_process_packet",
  ------------------
  |  |   66|    426|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    426|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 426]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 426]
  |  |  ------------------
  ------------------
 5813|    426|	      "session %p fd %" NETSNMP_FMT_SKT " pkt %p length %d\n", slp,
 5814|    426|	      transport->sock, packetptr, length));
 5815|       |
 5816|    426|  dump = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    426|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 5817|    426|                                NETSNMP_DS_LIB_DUMP_PACKET);
  ------------------
  |  |   63|    426|#define NETSNMP_DS_LIB_DUMP_PACKET         4
  ------------------
 5818|    426|#ifndef NETSNMP_FEATURE_REMOVE_FILTER_SOURCE
 5819|    426|  filter = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    426|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 5820|    426|                                  NETSNMP_DS_LIB_FILTER_TYPE);
  ------------------
  |  |  133|    426|#define NETSNMP_DS_LIB_FILTER_TYPE         17 /* 0=NONE, 1=whitelist, -1=blacklist */
  ------------------
 5821|    426|#endif
 5822|    426|  if (dump || filter) {
  ------------------
  |  Branch (5822:7): [True: 0, False: 426]
  |  Branch (5822:15): [True: 0, False: 426]
  ------------------
 5823|      0|      int filtered = 0;
 5824|      0|      char *addrtxt = netsnmp_transport_peer_string(transport, opaque, olength);
 5825|       |
 5826|      0|      if (!addrtxt) {
  ------------------
  |  Branch (5826:11): [True: 0, False: 0]
  ------------------
 5827|      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]
  |  |  ------------------
  ------------------
 5828|      0|                      "Failed to resolve peer address\n"));
 5829|      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]
  |  |  ------------------
  ------------------
 5830|      0|          return NULL;
 5831|      0|      }
 5832|       |
 5833|      0|      snmp_log(LOG_DEBUG, "\nReceived %d byte packet from %s\n",
 5834|      0|               length, addrtxt);
 5835|       |
 5836|      0|      if (dump)
  ------------------
  |  Branch (5836:11): [True: 0, False: 0]
  ------------------
 5837|      0|          xdump(packetptr, length, "");
 5838|       |
 5839|      0|#ifndef NETSNMP_FEATURE_REMOVE_FILTER_SOURCE
 5840|      0|      if (filter) {
  ------------------
  |  Branch (5840:11): [True: 0, False: 0]
  ------------------
 5841|      0|          char *sourceaddr = NULL, *c = strchr(addrtxt, '[');
 5842|      0|          const char *dropstr = NULL;
 5843|      0|          if (c) {
  ------------------
  |  Branch (5843:15): [True: 0, False: 0]
  ------------------
 5844|      0|              sourceaddr = ++c;
 5845|      0|              c = strchr(sourceaddr, ']');
 5846|      0|              if (c)
  ------------------
  |  Branch (5846:19): [True: 0, False: 0]
  ------------------
 5847|      0|                  *c = 0;
 5848|      0|              filtered = netsnmp_transport_filter_check(sourceaddr);
 5849|      0|          }
 5850|      0|          else if (!strncmp(addrtxt, "callback", 8)) {
  ------------------
  |  Branch (5850:20): [True: 0, False: 0]
  ------------------
 5851|       |              /* do not filter internal request */
 5852|      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]
  |  |  ------------------
  ------------------
 5853|      0|                          "bypass packet from %s \n",
 5854|      0|                          addrtxt));
 5855|      0|              filtered = 1;
 5856|      0|          }
 5857|      0|          if ((filter == -1) && filtered)
  ------------------
  |  Branch (5857:15): [True: 0, False: 0]
  |  Branch (5857:33): [True: 0, False: 0]
  ------------------
 5858|      0|              dropstr = "matched blacklist";
 5859|      0|          else if ((filter == 1) && !filtered)
  ------------------
  |  Branch (5859:20): [True: 0, False: 0]
  |  Branch (5859:37): [True: 0, False: 0]
  ------------------
 5860|      0|              dropstr = "didn't match whitelist";
 5861|      0|          if (dropstr) {
  ------------------
  |  Branch (5861:15): [True: 0, False: 0]
  ------------------
 5862|      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]
  |  |  ------------------
  ------------------
 5863|      0|                          "packet from %s %s\n",
 5864|      0|                          sourceaddr ? sourceaddr : "UNKNOWN", dropstr));
 5865|      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]
  |  |  ------------------
  ------------------
 5866|      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]
  |  |  ------------------
  ------------------
 5867|      0|              return NULL;
 5868|      0|          }
 5869|      0|      }
 5870|      0|#endif
 5871|       |
 5872|      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]
  |  |  ------------------
  ------------------
 5873|      0|  }
 5874|       |
 5875|       |  /*
 5876|       |   * Do transport-level filtering (e.g. IP-address based allow/deny).  
 5877|       |   */
 5878|       |
 5879|    426|  if (isp->hook_pre) {
  ------------------
  |  Branch (5879:7): [True: 0, False: 426]
  ------------------
 5880|      0|    if (isp->hook_pre(sp, transport, opaque, olength) == 0) {
  ------------------
  |  Branch (5880:9): [True: 0, False: 0]
  ------------------
 5881|      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]
  |  |  ------------------
  ------------------
 5882|      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]
  |  |  ------------------
  ------------------
 5883|      0|      return NULL;
 5884|      0|    }
 5885|      0|  }
 5886|       |
 5887|    426|  if (isp->hook_create_pdu) {
  ------------------
  |  Branch (5887:7): [True: 0, False: 426]
  ------------------
 5888|      0|    pdu = isp->hook_create_pdu(transport, opaque, olength);
 5889|    426|  } else {
 5890|    426|    pdu = snmp_create_sess_pdu(transport, opaque, olength);
 5891|    426|  }
 5892|       |
 5893|    426|  if (pdu == NULL) {
  ------------------
  |  Branch (5893:7): [True: 0, False: 426]
  ------------------
 5894|      0|    snmp_log(LOG_ERR, "pdu failed to be created\n");
 5895|      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]
  |  |  ------------------
  ------------------
 5896|      0|    return NULL;
 5897|      0|  }
 5898|       |
 5899|       |  /* if the transport was a magic tunnel, mark the PDU as having come
 5900|       |     through one. */
 5901|    426|  if (transport->flags & NETSNMP_TRANSPORT_FLAG_TUNNELED) {
  ------------------
  |  |   53|    426|#define		NETSNMP_TRANSPORT_FLAG_TUNNELED	 0x04
  ------------------
  |  Branch (5901:7): [True: 0, False: 426]
  ------------------
 5902|      0|      pdu->flags |= UCD_MSG_FLAG_TUNNELED;
  ------------------
  |  |  317|      0|#define UCD_MSG_FLAG_TUNNELED               0x4000
  ------------------
 5903|      0|  }
 5904|       |
 5905|    426|  if (isp->hook_parse) {
  ------------------
  |  Branch (5905:7): [True: 0, False: 426]
  ------------------
 5906|      0|    ret = isp->hook_parse(sp, pdu, packetptr, length);
 5907|    426|  } else {
 5908|    426|    ret = snmp_parse(slp, sp, pdu, packetptr, length);
 5909|    426|  }
 5910|       |
 5911|    426|  DEBUGMSGTL(("sess_process_packet", "received message id#%ld reqid#%ld len "
  ------------------
  |  |   66|    426|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    426|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 426]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 426]
  |  |  ------------------
  ------------------
 5912|    426|              "%u\n", pdu->msgid, pdu->reqid, length));
 5913|       |
 5914|    426|  if (ret != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|    426|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
  |  Branch (5914:7): [True: 426, False: 0]
  ------------------
 5915|    426|    DEBUGMSGTL(("sess_process_packet", "parse fail\n"));
  ------------------
  |  |   66|    426|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    426|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 426]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 426]
  |  |  ------------------
  ------------------
 5916|    426|  }
 5917|       |
 5918|    426|  if (isp->hook_post) {
  ------------------
  |  Branch (5918:7): [True: 0, False: 426]
  ------------------
 5919|      0|    if (isp->hook_post(sp, pdu, ret) == 0) {
  ------------------
  |  Branch (5919:9): [True: 0, False: 0]
  ------------------
 5920|      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]
  |  |  ------------------
  ------------------
 5921|      0|      ret = SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 5922|      0|    }
 5923|      0|  }
 5924|       |
 5925|    426|  if (ret != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|    426|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
  |  Branch (5925:7): [True: 426, False: 0]
  ------------------
 5926|    426|    snmp_free_pdu(pdu);
 5927|    426|    return NULL;
 5928|    426|  }
 5929|       |
 5930|      0|  return pdu;
 5931|    426|}

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

snmp_clone_mem:
  316|     21|{
  317|     21|    *dstPtr = NULL;
  318|     21|    if (srcPtr) {
  ------------------
  |  Branch (318:9): [True: 13, False: 8]
  ------------------
  319|     13|        if (len == UINT_MAX)
  ------------------
  |  Branch (319:13): [True: 0, False: 13]
  ------------------
  320|      0|            return 1;
  321|     13|        *dstPtr = malloc(len + 1);
  322|     13|        if (!*dstPtr) {
  ------------------
  |  Branch (322:13): [True: 0, False: 13]
  ------------------
  323|      0|            return 1;
  324|      0|        }
  325|     13|        memmove(*dstPtr, srcPtr, len);
  326|       |        /*
  327|       |         * this is for those routines that expect 0-terminated strings!!!
  328|       |         * someone should rather have called strdup
  329|       |         */
  330|     13|        ((char *) *dstPtr)[len] = 0;
  331|     13|    }
  332|     21|    return 0;
  333|     21|}
snmp_clone_pdu:
  602|      3|{
  603|      3|    return _clone_pdu(pdu, 0);  /* copies all variables */
  604|      3|}
snmp_set_var_objid:
  700|      3|{
  701|      3|    size_t          len = sizeof(oid) * name_length;
  702|       |
  703|      3|    if (vp->name != vp->name_loc && vp->name != NULL) {
  ------------------
  |  Branch (703:9): [True: 3, False: 0]
  |  Branch (703:37): [True: 0, False: 3]
  ------------------
  704|       |        /*
  705|       |         * Probably previously-allocated "big storage".  Better free it
  706|       |         * else memory leaks possible.  
  707|       |         */
  708|      0|        free(vp->name);
  709|      0|    }
  710|       |
  711|       |    /*
  712|       |     * use built-in storage for smaller values 
  713|       |     */
  714|      3|    if (len <= sizeof(vp->name_loc)) {
  ------------------
  |  Branch (714:9): [True: 3, False: 0]
  ------------------
  715|      3|        vp->name = vp->name_loc;
  716|      3|    } else {
  717|      0|        vp->name = (oid *) malloc(len);
  718|      0|        if (!vp->name)
  ------------------
  |  Branch (718:13): [True: 0, False: 0]
  ------------------
  719|      0|            return 1;
  720|      0|    }
  721|      3|    if (objid)
  ------------------
  |  Branch (721:9): [True: 3, False: 0]
  ------------------
  722|      3|        memmove(vp->name, objid, len);
  723|      3|    vp->name_length = name_length;
  724|      3|    return 0;
  725|      3|}
snmp_set_var_value:
  816|      3|{
  817|      3|    int             largeval = 1;
  818|       |
  819|       |    /*
  820|       |     * xxx-rks: why the unconditional free? why not use existing
  821|       |     * memory, if len < vars->val_len ?
  822|       |     */
  823|      3|    if (vars->val.string && vars->val.string != vars->buf) {
  ------------------
  |  Branch (823:9): [True: 0, False: 3]
  |  Branch (823:29): [True: 0, False: 0]
  ------------------
  824|      0|        free(vars->val.string);
  825|      0|    }
  826|      3|    vars->val.string = NULL;
  827|      3|    vars->val_len = 0;
  828|       |
  829|      3|    if (value == NULL && len > 0) {
  ------------------
  |  Branch (829:9): [True: 0, False: 3]
  |  Branch (829:26): [True: 0, False: 0]
  ------------------
  830|      0|        snmp_log(LOG_ERR, "bad size for NULL value\n");
  831|      0|        return 1;
  832|      0|    }
  833|       |
  834|       |    /*
  835|       |     * use built-in storage for smaller values 
  836|       |     */
  837|      3|    if (len <= sizeof(vars->buf)) {
  ------------------
  |  Branch (837:9): [True: 3, False: 0]
  ------------------
  838|      3|        vars->val.string = (u_char *) vars->buf;
  839|      3|        largeval = 0;
  840|      3|    }
  841|       |
  842|      3|    if ((0 == len) || (NULL == value)) {
  ------------------
  |  Branch (842:9): [True: 0, False: 3]
  |  Branch (842:23): [True: 0, False: 3]
  ------------------
  843|      0|        vars->val.string[0] = 0;
  844|      0|        return 0;
  845|      0|    }
  846|       |
  847|      3|    vars->val_len = len;
  848|      3|    switch (vars->type) {
  849|      0|    case ASN_INTEGER:
  ------------------
  |  |   64|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (849:5): [True: 0, False: 3]
  ------------------
  850|      0|    case ASN_UNSIGNED:
  ------------------
  |  |   91|      0|#define ASN_UNSIGNED    (ASN_APPLICATION | 2)   /* RFC 1902 - same as GAUGE */
  |  |  ------------------
  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (850:5): [True: 0, False: 3]
  ------------------
  851|      0|    case ASN_TIMETICKS:
  ------------------
  |  |   92|      0|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (851:5): [True: 0, False: 3]
  ------------------
  852|      3|    case ASN_COUNTER:
  ------------------
  |  |   89|      3|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   80|      3|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (852:5): [True: 3, False: 0]
  ------------------
  853|      3|    case ASN_UINTEGER:
  ------------------
  |  |  100|      3|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   80|      3|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (853:5): [True: 0, False: 3]
  ------------------
  854|      3|        if (vars->val_len == sizeof(int)) {
  ------------------
  |  Branch (854:13): [True: 0, False: 3]
  ------------------
  855|      0|            if (ASN_INTEGER == vars->type) {
  ------------------
  |  |   64|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (855:17): [True: 0, False: 0]
  ------------------
  856|      0|                const int      *val_int 
  857|      0|                    = (const int *) value;
  858|      0|                *(vars->val.integer) = (long) *val_int;
  859|      0|            } else {
  860|      0|                const u_int    *val_uint
  861|      0|                    = (const u_int *) value;
  862|      0|                *(vars->val.integer) = (unsigned long) *val_uint;
  863|      0|            }
  864|      0|        }
  865|      3|        else if (vars->val_len == sizeof(long)){
  ------------------
  |  Branch (865:18): [True: 3, False: 0]
  ------------------
  866|      3|            const u_long   *val_ulong
  867|      3|                = (const u_long *) value;
  868|      3|            *(vars->val.integer) = *val_ulong;
  869|      3|            if (*(vars->val.integer) > 0xffffffff) {
  ------------------
  |  Branch (869:17): [True: 0, False: 3]
  ------------------
  870|      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]
  |  |  ------------------
  ------------------
  871|      0|                                 "truncating integer value > 32 bits\n"));
  872|      0|                *(vars->val.integer) &= 0xffffffff;
  873|      0|            }
  874|      3|        }
  875|      0|        else if (vars->val_len == sizeof(long long)){
  ------------------
  |  Branch (875:18): [True: 0, False: 0]
  ------------------
  876|      0|            const unsigned long long   *val_ullong
  877|      0|                = (const unsigned long long *) value;
  878|      0|            *(vars->val.integer) = (long) *val_ullong;
  879|      0|            if (*(vars->val.integer) > 0xffffffff) {
  ------------------
  |  Branch (879:17): [True: 0, False: 0]
  ------------------
  880|      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]
  |  |  ------------------
  ------------------
  881|      0|                                 "truncating integer value > 32 bits\n"));
  882|      0|                *(vars->val.integer) &= 0xffffffff;
  883|      0|            }
  884|      0|        }
  885|      0|        else if (vars->val_len == sizeof(intmax_t)){
  ------------------
  |  Branch (885:18): [True: 0, False: 0]
  ------------------
  886|      0|            const uintmax_t *val_uintmax_t
  887|      0|                = (const uintmax_t *) value;
  888|      0|            *(vars->val.integer) = (long) *val_uintmax_t;
  889|      0|            if (*(vars->val.integer) > 0xffffffff) {
  ------------------
  |  Branch (889:17): [True: 0, False: 0]
  ------------------
  890|      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]
  |  |  ------------------
  ------------------
  891|      0|                                 "truncating integer value > 32 bits\n"));
  892|      0|                *(vars->val.integer) &= 0xffffffff;
  893|      0|            }
  894|      0|        }
  895|      0|        else if (vars->val_len == sizeof(short)) {
  ------------------
  |  Branch (895:18): [True: 0, False: 0]
  ------------------
  896|      0|            if (ASN_INTEGER == vars->type) {
  ------------------
  |  |   64|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (896:17): [True: 0, False: 0]
  ------------------
  897|      0|                const short      *val_short 
  898|      0|                    = (const short *) value;
  899|      0|                *(vars->val.integer) = (long) *val_short;
  900|      0|            } else {
  901|      0|                const u_short    *val_ushort
  902|      0|                    = (const u_short *) value;
  903|      0|                *(vars->val.integer) = (unsigned long) *val_ushort;
  904|      0|            }
  905|      0|        }
  906|      0|        else if (vars->val_len == sizeof(char)) {
  ------------------
  |  Branch (906:18): [True: 0, False: 0]
  ------------------
  907|      0|            if (ASN_INTEGER == vars->type) {
  ------------------
  |  |   64|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (907:17): [True: 0, False: 0]
  ------------------
  908|      0|                const signed char   *val_char
  909|      0|                    = (const signed char *) value;
  910|      0|                *(vars->val.integer) = (long) *val_char;
  911|      0|            } else {
  912|      0|                    const u_char    *val_uchar
  913|      0|                    = (const u_char *) value;
  914|      0|                *(vars->val.integer) = (unsigned long) *val_uchar;
  915|      0|            }
  916|      0|        }
  917|      0|        else {
  918|      0|            snmp_log(LOG_ERR,"bad size for integer-like type (%d)\n",
  919|      0|                     (int)vars->val_len);
  920|      0|            return (1);
  921|      0|        }
  922|      3|        vars->val_len = sizeof(long);
  923|      3|        break;
  924|       |
  925|      0|    case ASN_OBJECT_ID:
  ------------------
  |  |   70|      0|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (925:5): [True: 0, False: 3]
  ------------------
  926|      0|    case ASN_PRIV_IMPLIED_OBJECT_ID:
  ------------------
  |  |  194|      0|#define ASN_PRIV_IMPLIED_OBJECT_ID  (ASN_PRIVATE | ASN_OBJECT_ID)       /* 6 */
  |  |  ------------------
  |  |  |  |   82|      0|#define ASN_PRIVATE	    0xC0U
  |  |  ------------------
  |  |               #define ASN_PRIV_IMPLIED_OBJECT_ID  (ASN_PRIVATE | ASN_OBJECT_ID)       /* 6 */
  |  |  ------------------
  |  |  |  |   70|      0|#define ASN_OBJECT_ID	    0x06U
  |  |  ------------------
  ------------------
  |  Branch (926:5): [True: 0, False: 3]
  ------------------
  927|      0|    case ASN_PRIV_INCL_RANGE:
  ------------------
  |  |  190|      0|#define ASN_PRIV_INCL_RANGE (ASN_PRIVATE | 2)
  |  |  ------------------
  |  |  |  |   82|      0|#define ASN_PRIVATE	    0xC0U
  |  |  ------------------
  ------------------
  |  Branch (927:5): [True: 0, False: 3]
  ------------------
  928|      0|    case ASN_PRIV_EXCL_RANGE:
  ------------------
  |  |  191|      0|#define ASN_PRIV_EXCL_RANGE (ASN_PRIVATE | 3)
  |  |  ------------------
  |  |  |  |   82|      0|#define ASN_PRIVATE	    0xC0U
  |  |  ------------------
  ------------------
  |  Branch (928:5): [True: 0, False: 3]
  ------------------
  929|      0|        if (largeval) {
  ------------------
  |  Branch (929:13): [True: 0, False: 0]
  ------------------
  930|      0|            vars->val.objid = (oid *) malloc(vars->val_len);
  931|      0|        }
  932|      0|        if (vars->val.objid == NULL) {
  ------------------
  |  Branch (932:13): [True: 0, False: 0]
  ------------------
  933|      0|            snmp_log(LOG_ERR,"no storage for OID\n");
  934|      0|            return 1;
  935|      0|        }
  936|      0|        memmove(vars->val.objid, value, vars->val_len);
  937|      0|        break;
  938|       |
  939|      0|    case ASN_IPADDRESS: /* snmp_build_var_op treats IPADDR like a string */
  ------------------
  |  |   88|      0|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (939:5): [True: 0, False: 3]
  ------------------
  940|      0|        if (4 != vars->val_len) {
  ------------------
  |  Branch (940:13): [True: 0, False: 0]
  ------------------
  941|      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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  942|      0|        }
  943|      0|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2449|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  944|      0|    case ASN_PRIV_IMPLIED_OCTET_STR:
  ------------------
  |  |  193|      0|#define ASN_PRIV_IMPLIED_OCTET_STR  (ASN_PRIVATE | ASN_OCTET_STR)       /* 4 */
  |  |  ------------------
  |  |  |  |   82|      0|#define ASN_PRIVATE	    0xC0U
  |  |  ------------------
  |  |               #define ASN_PRIV_IMPLIED_OCTET_STR  (ASN_PRIVATE | ASN_OCTET_STR)       /* 4 */
  |  |  ------------------
  |  |  |  |   67|      0|#define ASN_OCTET_STR	    0x04U
  |  |  ------------------
  ------------------
  |  Branch (944:5): [True: 0, False: 3]
  ------------------
  945|      0|    case ASN_OCTET_STR:
  ------------------
  |  |   67|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (945:5): [True: 0, False: 3]
  ------------------
  946|      0|    case ASN_BIT_STR:
  ------------------
  |  |   66|      0|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (946:5): [True: 0, False: 3]
  ------------------
  947|      0|    case ASN_OPAQUE:
  ------------------
  |  |   93|      0|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (947:5): [True: 0, False: 3]
  ------------------
  948|      0|    case ASN_NSAP:
  ------------------
  |  |   98|      0|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (948:5): [True: 0, False: 3]
  ------------------
  949|      0|        if (vars->val_len >= sizeof(vars->buf)) {
  ------------------
  |  Branch (949:13): [True: 0, False: 0]
  ------------------
  950|      0|            vars->val.string = (u_char *) malloc(vars->val_len + 1);
  951|      0|        }
  952|      0|        if (vars->val.string == NULL) {
  ------------------
  |  Branch (952:13): [True: 0, False: 0]
  ------------------
  953|      0|            snmp_log(LOG_ERR,"no storage for string\n");
  954|      0|            return 1;
  955|      0|        }
  956|      0|        memmove(vars->val.string, value, vars->val_len);
  957|       |        /*
  958|       |         * Make sure the string is zero-terminated; some bits of code make
  959|       |         * this assumption.  Easier to do this here than fix all these wrong
  960|       |         * assumptions.  
  961|       |         */
  962|      0|        vars->val.string[vars->val_len] = '\0';
  963|      0|        break;
  964|       |
  965|      0|    case SNMP_NOSUCHOBJECT:
  ------------------
  |  |  201|      0|#define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   84|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (965:5): [True: 0, False: 3]
  ------------------
  966|      0|    case SNMP_NOSUCHINSTANCE:
  ------------------
  |  |  202|      0|#define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   84|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (966:5): [True: 0, False: 3]
  ------------------
  967|      0|    case SNMP_ENDOFMIBVIEW:
  ------------------
  |  |  203|      0|#define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   84|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (967:5): [True: 0, False: 3]
  ------------------
  968|      0|    case ASN_NULL:
  ------------------
  |  |   68|      0|#define ASN_NULL	    0x05U
  ------------------
  |  Branch (968:5): [True: 0, False: 3]
  ------------------
  969|      0|        vars->val_len = 0;
  970|      0|        vars->val.string = NULL;
  971|      0|        break;
  972|       |
  973|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
  974|      0|    case ASN_OPAQUE_U64:
  ------------------
  |  |  181|      0|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  125|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  139|      0|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (974:5): [True: 0, False: 3]
  ------------------
  975|      0|    case ASN_OPAQUE_I64:
  ------------------
  |  |  172|      0|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  125|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  138|      0|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (975:5): [True: 0, False: 3]
  ------------------
  976|      0|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
  977|      0|    case ASN_COUNTER64:
  ------------------
  |  |   99|      0|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (977:5): [True: 0, False: 3]
  ------------------
  978|      0|        if (largeval || vars->val_len != sizeof(struct counter64)) {
  ------------------
  |  Branch (978:13): [True: 0, False: 0]
  |  Branch (978:25): [True: 0, False: 0]
  ------------------
  979|      0|            snmp_log(LOG_ERR,"bad size for counter 64 (%d)\n",
  980|      0|                     (int)vars->val_len);
  981|      0|            return (1);
  982|      0|        }
  983|      0|        vars->val_len = sizeof(struct counter64);
  984|      0|        memmove(vars->val.counter64, value, vars->val_len);
  985|      0|        break;
  986|       |
  987|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
  988|      0|    case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  154|      0|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  125|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (988:5): [True: 0, False: 3]
  ------------------
  989|      0|        if (largeval) {
  ------------------
  |  Branch (989:13): [True: 0, False: 0]
  ------------------
  990|      0|            snmp_log(LOG_ERR,"bad size for opaque float (%d)\n",
  991|      0|                     (int)vars->val_len);
  992|      0|            return (1);
  993|      0|        }
  994|      0|        vars->val_len = sizeof(float);
  995|      0|        memmove(vars->val.floatVal, value, vars->val_len);
  996|      0|        break;
  997|       |
  998|      0|    case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  163|      0|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  125|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  137|      0|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (998:5): [True: 0, False: 3]
  ------------------
  999|      0|        if (largeval) {
  ------------------
  |  Branch (999:13): [True: 0, False: 0]
  ------------------
 1000|      0|            snmp_log(LOG_ERR,"bad size for opaque double (%d)\n",
 1001|      0|                     (int)vars->val_len);
 1002|      0|            return (1);
 1003|      0|        }
 1004|      0|        vars->val_len = sizeof(double);
 1005|      0|        memmove(vars->val.doubleVal, value, vars->val_len);
 1006|      0|        break;
 1007|       |
 1008|      0|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 1009|       |
 1010|      0|    default:
  ------------------
  |  Branch (1010:5): [True: 0, False: 3]
  ------------------
 1011|      0|        snmp_log(LOG_ERR,"Internal error in type switching\n");
 1012|      0|        snmp_set_detail("Internal error in type switching\n");
 1013|      0|        return (1);
 1014|      3|    }
 1015|       |
 1016|      3|    return 0;
 1017|      3|}
netsnmp_query_shutdown:
 1268|     66|netsnmp_query_shutdown(void) {
 1269|     66|    if (_def_query_session) {
  ------------------
  |  Branch (1269:9): [True: 0, False: 66]
  ------------------
 1270|      0|        snmp_close(_def_query_session);
 1271|       |        _def_query_session = NULL;
 1272|      0|    }
 1273|     66|}
snmp_client.c:_copy_varlist:
  437|      3|{                               /* !=0 number variables to copy */
  438|      3|    netsnmp_variable_list *newhead, *newvar, *oldvar;
  439|      3|    int             ii = 0;
  440|       |
  441|      3|    newhead = NULL;
  442|      3|    oldvar = NULL;
  443|       |
  444|      3|    while (var && (copy_count-- > 0)) {
  ------------------
  |  Branch (444:12): [True: 0, False: 3]
  |  Branch (444:19): [True: 0, False: 0]
  ------------------
  445|       |        /*
  446|       |         * Drop the specified variable (if applicable) 
  447|       |         * xxx hmm, is it intentional that dropping the errindex
  448|       |         *     counts towards copy_count?
  449|       |         */
  450|      0|        if (++ii == errindex) {
  ------------------
  |  Branch (450:13): [True: 0, False: 0]
  ------------------
  451|      0|            var = var->next_variable;
  452|      0|            continue;
  453|      0|        }
  454|       |
  455|       |        /*
  456|       |         * clone the next variable. Cleanup if alloc fails 
  457|       |         */
  458|      0|        newvar = (netsnmp_variable_list *)
  459|      0|            malloc(sizeof(netsnmp_variable_list));
  460|      0|        if (snmp_clone_var(var, newvar)) {
  ------------------
  |  Branch (460:13): [True: 0, False: 0]
  ------------------
  461|      0|            if (newvar)
  ------------------
  |  Branch (461:17): [True: 0, False: 0]
  ------------------
  462|      0|                free(newvar);
  463|      0|            snmp_free_varbind(newhead);
  464|      0|            return NULL;
  465|      0|        }
  466|       |
  467|       |        /*
  468|       |         * add cloned variable to new list  
  469|       |         */
  470|      0|        if (NULL == newhead)
  ------------------
  |  Branch (470:13): [True: 0, False: 0]
  ------------------
  471|      0|            newhead = newvar;
  472|      0|        if (oldvar)
  ------------------
  |  Branch (472:13): [True: 0, False: 0]
  ------------------
  473|      0|            oldvar->next_variable = newvar;
  474|      0|        oldvar = newvar;
  475|       |
  476|      0|        var = var->next_variable;
  477|      0|    }
  478|      3|    return newhead;
  479|      3|}
snmp_client.c:_clone_pdu:
  570|      3|{
  571|      3|    netsnmp_pdu    *newpdu;
  572|       |
  573|      3|    newpdu = _clone_pdu_header(pdu);
  574|      3|    if (!newpdu)
  ------------------
  |  Branch (574:9): [True: 0, False: 3]
  ------------------
  575|      0|        return newpdu;
  576|      3|    newpdu = _copy_pdu_vars(pdu, newpdu, drop_err, 0, 10000);   /* skip none, copy all */
  577|       |
  578|      3|    return newpdu;
  579|      3|}
snmp_client.c:_clone_pdu_header:
  372|      3|{
  373|      3|    netsnmp_pdu    *newpdu;
  374|      3|    struct snmp_secmod_def *sptr;
  375|      3|    int ret;
  376|       |
  377|      3|    if (!pdu)
  ------------------
  |  Branch (377:9): [True: 0, False: 3]
  ------------------
  378|      0|        return NULL;
  379|       |
  380|      3|    newpdu = netsnmp_memdup(pdu, sizeof(netsnmp_pdu));
  381|      3|    if (!newpdu)
  ------------------
  |  Branch (381:9): [True: 0, False: 3]
  ------------------
  382|      0|        return NULL;
  383|       |
  384|       |    /*
  385|       |     * reset copied pointers if copy fails 
  386|       |     */
  387|      3|    newpdu->variables = NULL;
  388|      3|    newpdu->enterprise = NULL;
  389|      3|    newpdu->community = NULL;
  390|      3|    newpdu->securityEngineID = NULL;
  391|      3|    newpdu->securityName = NULL;
  392|      3|    newpdu->contextEngineID = NULL;
  393|      3|    newpdu->contextName = NULL;
  394|      3|    newpdu->transport_data = NULL;
  395|      3|    newpdu->securityStateRef = NULL;
  396|       |
  397|       |    /*
  398|       |     * copy buffers individually. If any copy fails, all are freed. 
  399|       |     */
  400|      3|    if (snmp_clone_mem((void **) &newpdu->enterprise, pdu->enterprise,
  ------------------
  |  Branch (400:9): [True: 0, False: 3]
  ------------------
  401|      3|                       sizeof(oid) * pdu->enterprise_length) ||
  402|      3|        snmp_clone_mem((void **) &newpdu->community, pdu->community,
  ------------------
  |  Branch (402:9): [True: 0, False: 3]
  ------------------
  403|      3|                       pdu->community_len) ||
  404|      3|        snmp_clone_mem((void **) &newpdu->contextEngineID,
  ------------------
  |  Branch (404:9): [True: 0, False: 3]
  ------------------
  405|      3|                       pdu->contextEngineID, pdu->contextEngineIDLen)
  406|      3|        || snmp_clone_mem((void **) &newpdu->securityEngineID,
  ------------------
  |  Branch (406:12): [True: 0, False: 3]
  ------------------
  407|      3|                          pdu->securityEngineID, pdu->securityEngineIDLen)
  408|      3|        || snmp_clone_mem((void **) &newpdu->contextName, pdu->contextName,
  ------------------
  |  Branch (408:12): [True: 0, False: 3]
  ------------------
  409|      3|                          pdu->contextNameLen)
  410|      3|        || snmp_clone_mem((void **) &newpdu->securityName,
  ------------------
  |  Branch (410:12): [True: 0, False: 3]
  ------------------
  411|      3|                          pdu->securityName, pdu->securityNameLen)
  412|      3|        || snmp_clone_mem((void **) &newpdu->transport_data,
  ------------------
  |  Branch (412:12): [True: 0, False: 3]
  ------------------
  413|      3|                          pdu->transport_data,
  414|      3|                          pdu->transport_data_length)) {
  415|      0|        snmp_free_pdu(newpdu);
  416|      0|        return NULL;
  417|      0|    }
  418|       |
  419|      3|    sptr = find_sec_mod(newpdu->securityModel);
  420|      3|    if (sptr && sptr->pdu_clone) {
  ------------------
  |  Branch (420:9): [True: 3, False: 0]
  |  Branch (420:17): [True: 3, False: 0]
  ------------------
  421|       |        /* call security model if it needs to know about this */
  422|      3|        ret = sptr->pdu_clone(pdu, newpdu);
  423|      3|        if (ret) {
  ------------------
  |  Branch (423:13): [True: 0, False: 3]
  ------------------
  424|      0|            snmp_free_pdu(newpdu);
  425|      0|            return NULL;
  426|      0|        }
  427|      3|    }
  428|       |
  429|      3|    return newpdu;
  430|      3|}
snmp_client.c:_copy_pdu_vars:
  507|      3|{                               /* !=0 number of variables to copy */
  508|      3|    netsnmp_variable_list *var;
  509|       |#ifdef TEMPORARILY_DISABLED
  510|       |    int             copied;
  511|       |#endif
  512|      3|    int             drop_idx;
  513|       |
  514|      3|    if (!newpdu)
  ------------------
  |  Branch (514:9): [True: 0, False: 3]
  ------------------
  515|      0|        return NULL;            /* where is PDU to copy to ? */
  516|       |
  517|      3|    if (drop_err)
  ------------------
  |  Branch (517:9): [True: 0, False: 3]
  ------------------
  518|      0|        drop_idx = pdu->errindex - skip_count;
  519|      3|    else
  520|      3|        drop_idx = 0;
  521|       |
  522|      3|    var = pdu->variables;
  523|      3|    while (var && (skip_count-- > 0))   /* skip over pdu variables */
  ------------------
  |  Branch (523:12): [True: 0, False: 3]
  |  Branch (523:19): [True: 0, False: 0]
  ------------------
  524|      0|        var = var->next_variable;
  525|       |
  526|       |#ifdef TEMPORARILY_DISABLED
  527|       |    copied = 0;
  528|       |    if (pdu->flags & UCD_MSG_FLAG_FORCE_PDU_COPY)
  529|       |        copied = 1;             /* We're interested in 'empty' responses too */
  530|       |#endif
  531|       |
  532|      3|    newpdu->variables = _copy_varlist(var, drop_idx, copy_count);
  533|       |#ifdef TEMPORARILY_DISABLED
  534|       |    if (newpdu->variables)
  535|       |        copied = 1;
  536|       |#endif
  537|       |
  538|       |#ifdef ALSO_TEMPORARILY_DISABLED
  539|       |    /*
  540|       |     * Error if bad errindex or if target PDU has no variables copied 
  541|       |     */
  542|       |    if ((drop_err && (ii < pdu->errindex))
  543|       |#ifdef TEMPORARILY_DISABLED
  544|       |        /*
  545|       |         * SNMPv3 engineID probes are allowed to be empty.
  546|       |         * See the comment in snmp_api.c for further details 
  547|       |         */
  548|       |        || copied == 0
  549|       |#endif
  550|       |        ) {
  551|       |        snmp_free_pdu(newpdu);
  552|       |        return 0;
  553|       |    }
  554|       |#endif
  555|      3|    return newpdu;
  556|      3|}

debug_indent_reset:
  112|    426|{
  113|    426|    if (debugindent != 0)
  ------------------
  |  Branch (113:9): [True: 0, False: 426]
  ------------------
  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|    426|    debugindent = 0;
  116|    426|}
debug_is_token_registered:
  303|     68|{
  304|     68|    int             i, rc;
  305|       |
  306|       |    /*
  307|       |     * debugging flag is on or off
  308|       |     */
  309|     68|    if (!dodebug)
  ------------------
  |  Branch (309:9): [True: 68, False: 0]
  ------------------
  310|     68|        return SNMPERR_GENERR;
  ------------------
  |  |  185|     68|#define SNMPERR_GENERR			(-1)
  ------------------
  311|       |
  312|      0|    if (debug_num_tokens == 0 || debug_print_everything) {
  ------------------
  |  Branch (312:9): [True: 0, False: 0]
  |  Branch (312:34): [True: 0, False: 0]
  ------------------
  313|       |        /*
  314|       |         * no tokens specified, print everything
  315|       |         */
  316|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  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|  39.1k|{
  552|  39.1k|    return dodebug;
  553|  39.1k|}
snmp_debug_shutdown:
  569|     66|{
  570|     66|    int i;
  571|       |
  572|     66|    for (i = 0; i < debug_num_tokens; i++)
  ------------------
  |  Branch (572:17): [True: 0, False: 66]
  ------------------
  573|       |       SNMP_FREE(dbg_tokens[i].token_name);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  574|     66|}
snmp_debug_init:
  722|     66|{
  723|       |#ifdef HAVE_WOLFSSL_WOLFCRYPT_LOGGING_H
  724|       |    wolfSSL_Debugging_ON();
  725|       |    wolfSSL_SetLoggingCb(snmp_log_wolfssl_msg);
  726|       |#endif
  727|       |
  728|     66|    register_prenetsnmp_mib_handler("snmp", "doDebugging",
  729|     66|                                    debug_config_turn_on_debugging, NULL,
  730|     66|                                    "(1|0)");
  731|     66|    register_prenetsnmp_mib_handler("snmp", "debugTokens",
  732|     66|                                    debug_config_register_tokens, NULL,
  733|     66|                                    "token[,token...]");
  734|     66|#ifndef NETSNMP_DISABLE_DYNAMIC_LOG_LEVEL
  735|     66|    register_prenetsnmp_mib_handler("snmp", "debugLogLevel",
  736|       |                                    debug_config_debug_log_level, NULL,
  737|     66|                                    "(emerg|alert|crit|err|warning|notice|info|debug)");
  738|     66|#endif /* NETSNMP_DISABLE_DYNAMIC_LOG_LEVEL */
  739|     66|}

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

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

netsnmp_init_openssl:
  118|     67|void netsnmp_init_openssl(void) {
  119|       |
  120|       |    /* avoid duplicate calls */
  121|     67|    if (have_started_already)
  ------------------
  |  Branch (121:9): [True: 66, False: 1]
  ------------------
  122|     66|        return;
  123|      1|    have_started_already = 1;
  124|       |
  125|      1|    DEBUGMSGTL(("snmp_openssl", "initializing\n"));
  ------------------
  |  |   66|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 1]
  |  |  ------------------
  ------------------
  126|       |
  127|       |    /* Initializing OpenSSL */
  128|      1|#ifdef HAVE_SSL_LIBRARY_INIT
  129|      1|    SSL_library_init();
  130|      1|#endif
  131|      1|#ifdef HAVE_SSL_LOAD_ERROR_STRINGS
  132|      1|    SSL_load_error_strings();
  133|      1|#endif
  134|       |#ifdef HAVE_ERR_LOAD_BIO_STRINGS
  135|       |    ERR_load_BIO_strings();
  136|       |#endif
  137|      1|#ifdef HAVE_OPENSSL_ADD_ALL_ALGORITHMS
  138|       |    OpenSSL_add_all_algorithms();
  139|      1|#endif
  140|      1|}

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

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

init_snmp_transport:
  124|     66|{
  125|     66|    netsnmp_ds_register_config(ASN_BOOLEAN,
  ------------------
  |  |   61|     66|#define ASN_BOOLEAN	    0x01U
  ------------------
  126|     66|                               "snmp", "dontLoadHostConfig",
  127|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  128|     66|                               NETSNMP_DS_LIB_DONT_LOAD_HOST_FILES);
  ------------------
  |  |  100|     66|#define NETSNMP_DS_LIB_DONT_LOAD_HOST_FILES 40 /* don't read host.conf files */
  ------------------
  129|     66|#ifndef NETSNMP_FEATURE_REMOVE_FILTER_SOURCE
  130|     66|    register_app_config_handler("sourceFilterType",
  131|     66|                                netsnmp_transport_parse_filterType,
  132|       |                                NULL, "none|whitelist|blacklist");
  133|     66|    register_app_config_handler("sourceFilterAddress",
  134|     66|                                netsnmp_transport_parse_filter,
  135|     66|                                netsnmp_transport_filter_cleanup,
  136|     66|                                "host");
  137|     66|#endif /* NETSNMP_FEATURE_REMOVE_FILTER_SOURCE */
  138|     66|}
shutdown_snmp_transport:
  142|     66|{
  143|     66|#ifndef NETSNMP_FEATURE_REMOVE_FILTER_SOURCE
  144|     66|    netsnmp_transport_filter_cleanup();
  145|     66|#endif
  146|     66|}
netsnmp_transport_alloc:
  231|     66|{
  232|     66|    netsnmp_transport *transport;
  233|       |
  234|     66|    transport = SNMP_MALLOC_TYPEDEF(netsnmp_transport);
  ------------------
  |  |   73|     66|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  235|     66|    if (!transport)
  ------------------
  |  Branch (235:9): [True: 0, False: 66]
  ------------------
  236|      0|        return NULL;
  237|     66|    transport->sock = NETSNMP_INVALID_SOCKET;
  ------------------
  |  |   43|     66|#define NETSNMP_INVALID_SOCKET -1
  ------------------
  238|     66|    return transport;
  239|     66|}
netsnmp_transport_free:
  243|    132|{
  244|    132|    if (NULL == t)
  ------------------
  |  Branch (244:9): [True: 66, False: 66]
  ------------------
  245|     66|        return;
  246|       |
  247|     66|#ifndef FEATURE_REMOVE_TRANSPORT_CACHE
  248|       |    /** don't free a transport that is currently shared */
  249|     66|    if (netsnmp_transport_cache_remove(t) == 1)
  ------------------
  |  Branch (249:9): [True: 0, False: 66]
  ------------------
  250|      0|        return;
  251|     66|#endif
  252|       |
  253|     66|    SNMP_FREE(t->local);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  254|     66|    SNMP_FREE(t->remote);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  255|     66|    SNMP_FREE(t->data);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  256|     66|    netsnmp_transport_free(t->base_transport);
  257|       |
  258|       |    SNMP_FREE(t);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  259|     66|}
netsnmp_transport_filter_cleanup:
  381|    264|{
  382|    264|    if (NULL == filtered)
  ------------------
  |  Branch (382:9): [True: 264, False: 0]
  ------------------
  383|    264|        return;
  384|      0|    CONTAINER_CLEAR(filtered, filtered->free_item, NULL);
  385|      0|    CONTAINER_FREE(filtered);
  386|       |    filtered = NULL;
  387|      0|}
netsnmp_transport_send:
  416|      3|{
  417|      3|    int dumpPacket, debugLength;
  418|       |
  419|      3|    if ((NULL == t) || (NULL == t->f_send)) {
  ------------------
  |  Branch (419:9): [True: 0, False: 3]
  |  Branch (419:24): [True: 0, False: 3]
  ------------------
  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|      3|    dumpPacket = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      3|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  425|      3|                                        NETSNMP_DS_LIB_DUMP_PACKET);
  ------------------
  |  |   63|      3|#define NETSNMP_DS_LIB_DUMP_PACKET         4
  ------------------
  426|      3|    debugLength = (SNMPERR_SUCCESS ==
  ------------------
  |  |  184|      3|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  427|      3|                   debug_is_token_registered("transport:send"));
  428|       |
  429|      3|    if (dumpPacket | debugLength) {
  ------------------
  |  Branch (429:9): [True: 0, False: 3]
  ------------------
  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|      3|    if (dumpPacket)
  ------------------
  |  Branch (441:9): [True: 0, False: 3]
  ------------------
  442|      0|        xdump(packet, length, "");
  443|       |
  444|      3|    return t->f_send(t, packet, length, opaque, olength);
  445|      3|}
netsnmp_transport_recv:
  450|     65|{
  451|     65|    int debugLength;
  452|       |
  453|     65|    if ((NULL == t) || (NULL == t->f_recv)) {
  ------------------
  |  Branch (453:9): [True: 0, False: 65]
  |  Branch (453:24): [True: 0, False: 65]
  ------------------
  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|     65|    length = t->f_recv(t, packet, length, opaque, olength);
  459|       |
  460|     65|    if (length <=0)
  ------------------
  |  Branch (460:9): [True: 0, False: 65]
  ------------------
  461|      0|        return length; /* don't log timeouts/socket closed */
  462|       |
  463|     65|    debugLength = (SNMPERR_SUCCESS ==
  ------------------
  |  |  184|     65|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  464|     65|                   debug_is_token_registered("transport:recv"));
  465|       |
  466|     65|    if (debugLength) {
  ------------------
  |  Branch (466:9): [True: 0, False: 65]
  ------------------
  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|     65|    return length;
  475|     65|}
netsnmp_tdomain_init:
  503|     66|{
  504|     66|    DEBUGMSGTL(("tdomain", "netsnmp_tdomain_init() called\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  505|       |
  506|       |/* include the configure generated list of constructor calls */
  507|     66|#include "transports/snmp_transport_inits.h"
  ------------------
  |  |    1|       |/* This file is automatically generated by configure.  Do not modify by hand. */
  |  |    2|     66|netsnmp_tlsbase_ctor();
  |  |    3|     66|netsnmp_tlstcp_ctor();
  |  |    4|     66|netsnmp_dtlsudp_ctor();
  |  |    5|     66|netsnmp_udpshared_ctor();
  |  |    6|     66|netsnmp_std_ctor();
  |  |    7|     66|netsnmp_ipx_ctor();
  |  |    8|     66|netsnmp_aal5pvc_ctor();
  |  |    9|     66|netsnmp_udpipv6_ctor();
  |  |   10|     66|netsnmp_tcpipv6_ctor();
  |  |   11|     66|netsnmp_udp_ctor();
  |  |   12|     66|netsnmp_tcp_ctor();
  |  |   13|     66|netsnmp_alias_ctor();
  |  |   14|     66|netsnmp_unix_ctor();
  ------------------
  508|       |
  509|     66|    netsnmp_tdomain_dump();
  510|       |
  511|       |
  512|     66|}
netsnmp_clear_tdomain_list:
  516|     66|{
  517|     66|    netsnmp_tdomain *list = domain_list, *next = NULL;
  518|     66|    DEBUGMSGTL(("tdomain", "clear_tdomain_list() called\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  519|       |
  520|    793|    while (list != NULL) {
  ------------------
  |  Branch (520:12): [True: 727, False: 66]
  ------------------
  521|    727|	next = list->next;
  522|    727|	SNMP_FREE(list->prefix);
  ------------------
  |  |   62|    727|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 727, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 727]
  |  |  ------------------
  ------------------
  523|       |        /* attention!! list itself is not in the heap, so we must not free it! */
  524|    727|	list = next;
  525|    727|    }
  526|       |    domain_list = NULL;
  527|     66|}
netsnmp_tdomain_register:
  554|    727|{
  555|    727|    netsnmp_tdomain **prevNext = &domain_list, *d;
  556|       |
  557|    727|    if (n != NULL) {
  ------------------
  |  Branch (557:9): [True: 727, False: 0]
  ------------------
  558|  4.36k|        for (d = domain_list; d != NULL; d = d->next) {
  ------------------
  |  Branch (558:31): [True: 3.64k, False: 727]
  ------------------
  559|  3.64k|            if (netsnmp_oid_equals(n->name, n->name_length,
  ------------------
  |  Branch (559:17): [True: 0, False: 3.64k]
  ------------------
  560|  3.64k|                                d->name, d->name_length) == 0) {
  561|       |                /*
  562|       |                 * Already registered.  
  563|       |                 */
  564|      0|                return 0;
  565|      0|            }
  566|  3.64k|            prevNext = &(d->next);
  567|  3.64k|        }
  568|    727|        n->next = NULL;
  569|    727|        *prevNext = n;
  570|    727|        return 1;
  571|    727|    } else {
  572|      0|        return 0;
  573|      0|    }
  574|    727|}
netsnmp_tdomain_transport_tspec:
  643|     66|{
  644|     66|    const char *application, *str, *default_domain, *default_target, *source;
  645|     66|    int local;
  646|     66|    netsnmp_tdomain    *match = NULL;
  647|     66|    const char         *addr = NULL;
  648|     66|    const char * const *spec = NULL;
  649|     66|    int                 any_found = 0;
  650|     66|    char buf[SNMP_MAXPATH];
  651|     66|    const char **lspec = NULL;
  652|     66|    char *tokenized_domain = NULL;
  653|       |
  654|     66|    application = tspec->application;
  655|     66|    str = tspec->target;
  656|     66|    local = tspec->flags & NETSNMP_TSPEC_LOCAL;
  ------------------
  |  |  117|     66|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  657|     66|    default_domain = tspec->default_domain;
  658|     66|    default_target = tspec->default_target;
  659|     66|    source = tspec->source;
  660|       |    /** transport_config = tspec->transport_config; not used yet */
  661|       |
  662|     66|    DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  663|     66|                "tdomain_transport_spec(\"%s\", \"%s\", %d, \"%s\", \"%s\", \"%s\")\n",
  664|     66|                application, str ? str : "[NIL]", local,
  665|     66|                default_domain ? default_domain : "[NIL]",
  666|     66|                default_target ? default_target : "[NIL]",
  667|     66|                source ? source : "[NIL]"));
  668|       |
  669|       |    /* see if we can load a host-name specific set of conf files */
  670|     66|    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (670:9): [True: 66, False: 0]
  ------------------
  671|     66|                                NETSNMP_DS_LIB_DONT_LOAD_HOST_FILES) &&
  ------------------
  |  |  100|     66|#define NETSNMP_DS_LIB_DONT_LOAD_HOST_FILES 40 /* don't read host.conf files */
  ------------------
  672|     66|        netsnmp_is_fqdn(str)) {
  ------------------
  |  Branch (672:9): [True: 0, False: 66]
  ------------------
  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,
  ------------------
  |  |   67|      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|     66|    if (str != NULL) {
  ------------------
  |  Branch (722:9): [True: 66, False: 0]
  ------------------
  723|     66|        const char *cp;
  724|     66|        if ((cp = strchr(str, ':')) != NULL) {
  ------------------
  |  Branch (724:13): [True: 66, False: 0]
  ------------------
  725|     66|            char* mystring = (char*)malloc(cp + 1 - str);
  726|     66|            if (mystring == NULL)
  ------------------
  |  Branch (726:17): [True: 0, False: 66]
  ------------------
  727|      0|                return NULL;
  728|     66|            memcpy(mystring, str, cp - str);
  729|     66|            mystring[cp - str] = '\0';
  730|     66|            addr = cp + 1;
  731|       |
  732|     66|            match = find_tdomain(mystring);
  733|     66|            free(mystring);
  734|     66|        }
  735|     66|    }
  736|       |
  737|       |    /*
  738|       |     * Second try, if there is no domain in str (target), then try the
  739|       |     * default domain
  740|       |     */
  741|       |
  742|     66|    if (match == NULL) {
  ------------------
  |  Branch (742:9): [True: 66, False: 0]
  ------------------
  743|     66|        addr = str;
  744|     66|        if (addr && *addr == '/') {
  ------------------
  |  Branch (744:13): [True: 66, False: 0]
  |  Branch (744:21): [True: 0, False: 66]
  ------------------
  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|     66|        } else if (default_domain) {
  ------------------
  |  Branch (749:20): [True: 0, False: 66]
  ------------------
  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|     66|        } else {
  776|     66|            spec = netsnmp_lookup_default_domains(application);
  777|     66|            if (spec == NULL) {
  ------------------
  |  Branch (777:17): [True: 66, False: 0]
  ------------------
  778|     66|                DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  779|     66|                            "No default domain found, assume \"udp\"\n"));
  780|     66|                match = find_tdomain("udp");
  781|     66|            } 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|     66|        }
  792|     66|    }
  793|       |
  794|     66|    for(;;) {
  795|     66|        if (match) {
  ------------------
  |  Branch (795:13): [True: 66, False: 0]
  ------------------
  796|     66|            netsnmp_transport *t = NULL;
  797|     66|            const char* addr2;
  798|       |
  799|     66|            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|     66|            if (default_target != NULL)
  ------------------
  |  Branch (804:17): [True: 0, False: 66]
  ------------------
  805|      0|                addr2 = default_target;
  806|     66|            else
  807|     66|                addr2 = netsnmp_lookup_default_target(application,
  808|     66|                                                      match->prefix[0]);
  809|     66|            DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  810|     66|                        "trying domain \"%s\" address \"%s\" "
  811|     66|                        "default address \"%s\"\n",
  812|     66|                        match->prefix[0], addr ? addr : "[NIL]",
  813|     66|                        addr2 ? addr2 : "[NIL]"));
  814|     66|            if (match->f_create_from_tspec) {
  ------------------
  |  Branch (814:17): [True: 66, False: 0]
  ------------------
  815|     66|                netsnmp_tdomain_spec tspec_tmp;
  816|     66|                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|     66|                if ((default_target == NULL) && (addr2 != NULL))
  ------------------
  |  Branch (819:21): [True: 66, False: 0]
  |  Branch (819:49): [True: 0, False: 66]
  ------------------
  820|      0|                    tspec_tmp.default_target = addr2;
  821|     66|                if (addr != tspec_tmp.target)
  ------------------
  |  Branch (821:21): [True: 0, False: 66]
  ------------------
  822|      0|                    tspec_tmp.target = addr;
  823|     66|                t = match->f_create_from_tspec(&tspec_tmp);
  824|     66|            }
  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|     66|            if (t) {
  ------------------
  |  Branch (837:17): [True: 66, False: 0]
  ------------------
  838|     66|                if (lspec) {
  ------------------
  |  Branch (838:21): [True: 0, False: 66]
  ------------------
  839|      0|                    free(tokenized_domain);
  840|      0|                    free(lspec);
  841|      0|                }
  842|     66|                return t;
  843|     66|            }
  844|     66|        }
  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|     66|}
netsnmp_tdomain_transport_full:
  865|     66|{
  866|     66|    netsnmp_tdomain_spec tspec;
  867|     66|    memset(&tspec, 0x0, sizeof(tspec));
  868|     66|    tspec.application = application;
  869|     66|    tspec.target = str;
  870|     66|    if (local)
  ------------------
  |  Branch (870:9): [True: 66, False: 0]
  ------------------
  871|     66|        tspec.flags |= NETSNMP_TSPEC_LOCAL;
  ------------------
  |  |  117|     66|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  872|     66|    tspec.default_domain = default_domain;
  873|     66|    tspec.default_target = default_target;
  874|     66|    tspec.source = NULL;
  875|       |    tspec.transport_config = NULL;
  876|     66|    return netsnmp_tdomain_transport_tspec(&tspec);
  877|     66|}
netsnmp_transport_open_server:
  936|     66|{
  937|     66|    return netsnmp_tdomain_transport_full(application, str, 1, NULL, NULL);
  938|     66|}
_tc_find_transport:
 1240|     66|{
 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|     66|    netsnmp_iterator  *itr;
 1246|     66|    trans_cache *tc;
 1247|       |
 1248|     66|    DEBUGMSGTL(("transport:cache:find_transport", "%p\n", t));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 1249|       |
 1250|     66|    if (NULL == _container)
  ------------------
  |  Branch (1250:9): [True: 66, False: 0]
  ------------------
 1251|     66|        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|     66|{
 1273|     66|    trans_cache *tc;
 1274|       |
 1275|     66|    DEBUGMSGTL(("transport:cache:close", "%p\n", t));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 1276|       |
 1277|     66|    if (NULL == t)
  ------------------
  |  Branch (1277:9): [True: 0, False: 66]
  ------------------
 1278|      0|        return 0;
 1279|       |
 1280|       |    /** transport in cache? */
 1281|     66|    tc = _tc_find_transport(t);
 1282|     66|    if (NULL == tc) {
  ------------------
  |  Branch (1282:9): [True: 66, False: 0]
  ------------------
 1283|     66|        DEBUGMSGTL(("transport:cache:close", "%p not found in cache\n", t));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 1284|     66|        return 0;
 1285|     66|    }
 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|     66|{
  533|     66|    netsnmp_tdomain *d;
  534|     66|    int i = 0;
  535|       |
  536|     66|    DEBUGMSGTL(("tdomain", "domain_list -> "));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  537|    793|    for (d = domain_list; d != NULL; d = d->next) {
  ------------------
  |  Branch (537:27): [True: 727, False: 66]
  ------------------
  538|    727|        DEBUGMSG(("tdomain", "{ "));
  ------------------
  |  |   61|    727|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    727|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 727]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 727]
  |  |  ------------------
  ------------------
  539|    727|        DEBUGMSGOID(("tdomain", d->name, d->name_length));
  ------------------
  |  |   67|    727|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    727|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 727]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 727]
  |  |  ------------------
  ------------------
  540|    727|        DEBUGMSG(("tdomain", ", \""));
  ------------------
  |  |   61|    727|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    727|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 727]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 727]
  |  |  ------------------
  ------------------
  541|  2.11k|        for (i = 0; d->prefix[i] != NULL; i++) {
  ------------------
  |  Branch (541:21): [True: 1.38k, False: 727]
  ------------------
  542|  1.38k|            DEBUGMSG(("tdomain", "%s%s", d->prefix[i],
  ------------------
  |  |   61|  1.38k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.38k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.38k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:56): [True: 0, False: 0]
  |  |  |  Branch (61:67): [Folded, False: 1.38k]
  |  |  ------------------
  ------------------
  543|  1.38k|		      (d->prefix[i + 1]) ? "/" : ""));
  544|  1.38k|        }
  545|    727|        DEBUGMSG(("tdomain", "\" } -> "));
  ------------------
  |  |   61|    727|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    727|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 727]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 727]
  |  |  ------------------
  ------------------
  546|    727|    }
  547|     66|    DEBUGMSG(("tdomain", "[NIL]\n"));
  ------------------
  |  |   61|     66|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 66]
  |  |  ------------------
  ------------------
  548|     66|}
snmp_transport.c:netsnmp_is_fqdn:
  623|     66|{
  624|     66|    if (!thename)
  ------------------
  |  Branch (624:9): [True: 0, False: 66]
  ------------------
  625|      0|        return 0;
  626|    660|    while(*thename) {
  ------------------
  |  Branch (626:11): [True: 660, False: 0]
  ------------------
  627|    660|        if (*thename != '.' && !isupper((unsigned char)*thename) &&
  ------------------
  |  Branch (627:13): [True: 462, False: 198]
  |  Branch (627:32): [True: 462, False: 0]
  ------------------
  628|    462|            !islower((unsigned char)*thename) &&
  ------------------
  |  Branch (628:13): [True: 462, False: 0]
  ------------------
  629|    462|            !isdigit((unsigned char)*thename) && *thename != '-') {
  ------------------
  |  Branch (629:13): [True: 66, False: 396]
  |  Branch (629:50): [True: 66, False: 0]
  ------------------
  630|     66|            return 0;
  631|     66|        }
  632|    594|        thename++;
  633|    594|    }
  634|      0|    return 1;
  635|     66|}
snmp_transport.c:find_tdomain:
  605|    132|{
  606|    132|    netsnmp_tdomain *d;
  607|  1.32k|    for (d = domain_list; d != NULL; d = d->next) {
  ------------------
  |  Branch (607:27): [True: 1.25k, False: 66]
  ------------------
  608|  1.25k|        int i;
  609|  3.76k|        for (i = 0; d->prefix[i] != NULL; i++)
  ------------------
  |  Branch (609:21): [True: 2.57k, False: 1.19k]
  ------------------
  610|  2.57k|            if (strcasecmp(d->prefix[i], spec) == 0) {
  ------------------
  |  Branch (610:17): [True: 66, False: 2.51k]
  ------------------
  611|     66|                DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  612|     66|                            "Found domain \"%s\" from specifier \"%s\"\n",
  613|     66|                            d->prefix[0], spec));
  614|     66|                return d;
  615|     66|            }
  616|  1.25k|    }
  617|     66|    DEBUGMSGTL(("tdomain", "Found no domain from specifier \"%s\"\n", spec));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  618|       |    return NULL;
  619|    132|}

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

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

usm_get_user2:
  517|      3|{
  518|      3|    DEBUGMSGTL(("usm", "getting user %.*s\n", (int)nameLen,
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 3]
  |  |  ------------------
  ------------------
  519|      3|                (const char *)name));
  520|      3|    return usm_get_user_from_list(engineID, engineIDLen, name, nameLen,
  521|      3|                                  userList, 1);
  522|      3|}
usm_free_user:
  749|    198|{
  750|    198|    if (user == NULL)
  ------------------
  |  Branch (750:9): [True: 132, False: 66]
  ------------------
  751|    132|        return NULL;
  752|       |
  753|     66|    SNMP_FREE(user->engineID);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  754|     66|    SNMP_FREE(user->name);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  755|     66|    SNMP_FREE(user->secName);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  756|     66|    SNMP_FREE(user->cloneFrom);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  757|     66|    SNMP_FREE(user->userPublicString);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 66]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  758|     66|    SNMP_FREE(user->authProtocol);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  759|     66|    SNMP_FREE(user->privProtocol);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  760|       |
  761|     66|    if (user->authKey != NULL) {
  ------------------
  |  Branch (761:9): [True: 0, False: 66]
  ------------------
  762|      0|        SNMP_ZERO(user->authKey, user->authKeyLen);
  ------------------
  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  763|      0|        SNMP_FREE(user->authKey);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  764|      0|    }
  765|       |
  766|     66|    if (user->privKey != NULL) {
  ------------------
  |  Branch (766:9): [True: 0, False: 66]
  ------------------
  767|      0|        SNMP_ZERO(user->privKey, user->privKeyLen);
  ------------------
  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  768|      0|        SNMP_FREE(user->privKey);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  769|      0|    }
  770|       |
  771|     66|    if (user->authKeyKu != NULL) {
  ------------------
  |  Branch (771:9): [True: 0, False: 66]
  ------------------
  772|      0|        SNMP_ZERO(user->authKeyKu, user->authKeyKuLen);
  ------------------
  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  773|      0|        SNMP_FREE(user->authKeyKu);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  774|      0|    }
  775|       |
  776|     66|    if (user->privKeyKu != NULL) {
  ------------------
  |  Branch (776:9): [True: 0, False: 66]
  ------------------
  777|      0|        SNMP_ZERO(user->privKeyKu, user->privKeyKuLen);
  ------------------
  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  778|      0|        SNMP_FREE(user->privKeyKu);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  779|      0|    }
  780|       |
  781|     66|#ifdef NETSNMP_USE_OPENSSL
  782|     66|    if (user->usmDHUserAuthKeyChange)
  ------------------
  |  Branch (782:9): [True: 0, False: 66]
  ------------------
  783|      0|    {
  784|      0|        DH_free(user->usmDHUserAuthKeyChange);
  785|      0|        user->usmDHUserAuthKeyChange = NULL;
  786|      0|    }
  787|       |
  788|     66|    if (user->usmDHUserPrivKeyChange)
  ------------------
  |  Branch (788:9): [True: 0, False: 66]
  ------------------
  789|      0|    {
  790|      0|        DH_free(user->usmDHUserPrivKeyChange);
  791|      0|        user->usmDHUserPrivKeyChange = NULL;
  792|      0|    }
  793|     66|#endif
  794|       |
  795|       |    /*
  796|       |     * FIX  Why not put this check *first?*
  797|       |     */
  798|     66|    if (user->prev != NULL && user->prev != (struct usmUser *)-1) {   /* ack, this shouldn't happen */
  ------------------
  |  Branch (798:9): [True: 0, False: 66]
  |  Branch (798:31): [True: 0, False: 0]
  ------------------
  799|      0|        user->prev->next = user->next;
  800|      0|    }
  801|     66|    if (user->next != NULL && user->next != (struct usmUser *)-1) {
  ------------------
  |  Branch (801:9): [True: 0, False: 66]
  |  Branch (801:31): [True: 0, False: 0]
  ------------------
  802|      0|        user->next->prev = user->prev;
  803|      0|        if (user->prev != NULL) /* ack this is really bad, because it means
  ------------------
  |  Branch (803:13): [True: 0, False: 0]
  ------------------
  804|       |                                 * * we'll loose the head of some structure tree */
  805|      0|            DEBUGMSGTL(("usm",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  806|      0|                        "Severe: Asked to free the head of a usmUser tree somewhere."));
  807|      0|    }
  808|       |
  809|       |
  810|     66|    SNMP_ZERO(user, sizeof(*user));
  ------------------
  |  |   77|     66|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 66, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 66]
  |  |  ------------------
  ------------------
  811|     66|    SNMP_FREE(user);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
  812|       |
  813|     66|    return NULL;                /* for convenience to returns from calling functions */
  814|       |
  815|    198|}                               /* end usm_free_user() */
usm_create_user:
 4160|     66|{
 4161|     66|    struct usmUser *newUser;
 4162|       |
 4163|       |    /*
 4164|       |     * create the new user 
 4165|       |     */
 4166|     66|    newUser = calloc(1, sizeof(struct usmUser));
 4167|     66|    if (newUser == NULL)
  ------------------
  |  Branch (4167:9): [True: 0, False: 66]
  ------------------
 4168|      0|        return NULL;
 4169|       |
 4170|       |    /*
 4171|       |     * fill the auth/priv protocols 
 4172|       |     */
 4173|     66|    if ((newUser->authProtocol =
  ------------------
  |  Branch (4173:9): [True: 0, False: 66]
  ------------------
 4174|     66|         snmp_duplicate_objid(usmNoAuthProtocol,
 4175|     66|                              OID_LENGTH(usmNoAuthProtocol))) ==
  ------------------
  |  |   57|     66|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
 4176|     66|        NULL)
 4177|      0|        return usm_free_user(newUser);
 4178|     66|    newUser->authProtocolLen = OID_LENGTH(usmNoAuthProtocol);
  ------------------
  |  |   57|     66|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
 4179|       |
 4180|     66|    if ((newUser->privProtocol =
  ------------------
  |  Branch (4180:9): [True: 0, False: 66]
  ------------------
 4181|     66|         snmp_duplicate_objid(usmNoPrivProtocol,
 4182|     66|                              OID_LENGTH(usmNoPrivProtocol))) ==
  ------------------
  |  |   57|     66|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
 4183|     66|        NULL)
 4184|      0|        return usm_free_user(newUser);
 4185|     66|    newUser->privProtocolLen = OID_LENGTH(usmNoPrivProtocol);
  ------------------
  |  |   57|     66|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
 4186|       |
 4187|       |    /*
 4188|       |     * set the storage type to nonvolatile, and the status to ACTIVE 
 4189|       |     */
 4190|     66|    newUser->userStorageType = ST_NONVOLATILE;
  ------------------
  |  |   52|     66|#define ST_NONVOLATILE	3
  ------------------
 4191|     66|    newUser->userStatus = RS_ACTIVE;
  ------------------
  |  |   35|     66|#define RS_ACTIVE	        1
  ------------------
 4192|     66|    return newUser;
 4193|       |
 4194|     66|}                               /* end usm_clone_user() */
get_default_authtype:
 5150|    132|{
 5151|    132|    if (defaultAuthType == NULL) {
  ------------------
  |  Branch (5151:9): [True: 1, False: 131]
  ------------------
 5152|      1|        defaultAuthType = SNMP_DEFAULT_AUTH_PROTO;
  ------------------
  |  |   94|      1|#define SNMP_DEFAULT_AUTH_PROTO     usmHMACMD5AuthProtocol
  ------------------
 5153|      1|        defaultAuthTypeLen = SNMP_DEFAULT_AUTH_PROTOLEN;
  ------------------
  |  |   98|      1|#define SNMP_DEFAULT_AUTH_PROTOLEN  OID_LENGTH(SNMP_DEFAULT_AUTH_PROTO)
  |  |  ------------------
  |  |  |  |   57|      1|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  |  |  ------------------
  ------------------
 5154|      1|    }
 5155|    132|    if (len)
  ------------------
  |  Branch (5155:9): [True: 66, False: 66]
  ------------------
 5156|     66|        *len = defaultAuthTypeLen;
 5157|    132|    return defaultAuthType;
 5158|    132|}
get_default_privtype:
 5172|    132|{
 5173|    132|    if (defaultPrivType == NULL) {
  ------------------
  |  Branch (5173:9): [True: 1, False: 131]
  ------------------
 5174|      1|        defaultPrivType = SNMP_DEFAULT_PRIV_PROTO;
  ------------------
  |  |  100|      1|#define SNMP_DEFAULT_PRIV_PROTO     usmDESPrivProtocol
  ------------------
 5175|      1|        defaultPrivTypeLen = SNMP_DEFAULT_PRIV_PROTOLEN;
  ------------------
  |  |  104|      1|#define SNMP_DEFAULT_PRIV_PROTOLEN  OID_LENGTH(SNMP_DEFAULT_PRIV_PROTO)
  |  |  ------------------
  |  |  |  |   57|      1|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  |  |  ------------------
  ------------------
 5176|      1|    }
 5177|    132|    if (len)
  ------------------
  |  Branch (5177:9): [True: 66, False: 66]
  ------------------
 5178|     66|        *len = defaultPrivTypeLen;
 5179|    132|    return defaultPrivType;
 5180|    132|}
init_usm:
 5272|     66|{
 5273|     66|    struct snmp_secmod_def *def;
 5274|     66|    char *type;
 5275|       |
 5276|     66|    DEBUGMSGTL(("init_usm", "unit_usm: %" NETSNMP_PRIo "u %" NETSNMP_PRIo "u\n",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 5277|     66|                usmNoPrivProtocol[0], usmNoPrivProtocol[1]));
 5278|       |
 5279|     66|    sc_init();                  /* initialize scapi code */
 5280|       |
 5281|       |    /*
 5282|       |     * register ourselves as a security service
 5283|       |     */
 5284|     66|    def = SNMP_MALLOC_STRUCT(snmp_secmod_def);
  ------------------
  |  |   69|     66|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
 5285|     66|    if (def == NULL)
  ------------------
  |  Branch (5285:9): [True: 0, False: 66]
  ------------------
 5286|      0|        return;
 5287|       |    /*
 5288|       |     * XXX: def->init_sess_secmod move stuff from snmp_api.c
 5289|       |     */
 5290|     66|    def->encode_reverse = usm_secmod_rgenerate_out_msg;
 5291|     66|    def->encode_forward = usm_secmod_generate_out_msg;
 5292|     66|    def->decode = usm_secmod_process_in_msg;
 5293|     66|    def->pdu_clone = usm_clone;
 5294|     66|    def->pdu_free_state_ref = usm_free_usmStateReference;
 5295|     66|    def->session_setup = usm_session_init;
 5296|     66|    def->handle_report = usm_handle_report;
 5297|     66|    def->probe_engineid = usm_discover_engineid;
 5298|     66|    def->post_probe_engineid = usm_create_user_from_session_hook;
 5299|     66|    if (register_sec_mod(USM_SEC_MODEL_NUMBER, "usm", def) != SNMPERR_SUCCESS) {
  ------------------
  |  |   40|     66|#define USM_SEC_MODEL_NUMBER            SNMP_SEC_MODEL_USM
  |  |  ------------------
  |  |  |  |  295|     66|#define SNMP_SEC_MODEL_USM		3
  |  |  ------------------
  ------------------
                  if (register_sec_mod(USM_SEC_MODEL_NUMBER, "usm", def) != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (5299:9): [True: 0, False: 66]
  ------------------
 5300|      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]
  |  |  ------------------
  ------------------
 5301|      0|        snmp_log(LOG_ERR, "could not register usm sec mod\n");
 5302|      0|        return;
 5303|      0|    }
 5304|       |
 5305|     66|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 5306|     66|                           SNMP_CALLBACK_POST_PREMIB_READ_CONFIG,
  ------------------
  |  |   27|     66|#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG	3
  ------------------
 5307|     66|                           init_usm_post_config, NULL);
 5308|       |
 5309|     66|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 5310|     66|                           SNMP_CALLBACK_SHUTDOWN,
  ------------------
  |  |   26|     66|#define SNMP_CALLBACK_SHUTDOWN		        2
  ------------------
 5311|     66|                           deinit_usm_post_config, NULL);
 5312|       |
 5313|     66|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 5314|     66|                           SNMP_CALLBACK_SHUTDOWN,
  ------------------
  |  |   26|     66|#define SNMP_CALLBACK_SHUTDOWN		        2
  ------------------
 5315|     66|                           free_engineID, NULL);
 5316|       |
 5317|     66|    register_config_handler("snmp", "defAuthType", snmpv3_authtype_conf,
 5318|     66|                            NULL, "MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224");
 5319|     66|    register_config_handler("snmp", "defPrivType", snmpv3_privtype_conf,
 5320|     66|                            NULL,
 5321|     66|                            "DES"
 5322|     66|#ifdef HAVE_AES
 5323|     66|                            "|AES|AES-128"
 5324|     66|#ifdef NETSNMP_DRAFT_BLUMENTHAL_AES_04
 5325|     66|                            "|AES-192|AES-256"
 5326|     66|#endif /* NETSNMP_DRAFT_BLUMENTHAL_AES_04 */
 5327|       |#else
 5328|       |                            " (AES support not available)"
 5329|       |#endif
 5330|     66|                           );
 5331|       |
 5332|       |    /*
 5333|       |     * Free stuff at shutdown time
 5334|       |     */
 5335|     66|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 5336|     66|                           SNMP_CALLBACK_SHUTDOWN,
  ------------------
  |  |   26|     66|#define SNMP_CALLBACK_SHUTDOWN		        2
  ------------------
 5337|     66|                           free_enginetime_on_shutdown, NULL);
 5338|       |
 5339|       |
 5340|     66|    type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE);
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE);
  ------------------
  |  |  157|     66|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
 5341|       |
 5342|     66|    register_config_handler(type, "userSetAuthPass", usm_set_password,
 5343|     66|                            NULL, NULL);
 5344|     66|    register_config_handler(type, "userSetPrivPass", usm_set_password,
 5345|     66|                            NULL, NULL);
 5346|     66|    register_config_handler(type, "userSetAuthKey", usm_set_password, NULL,
 5347|     66|                            NULL);
 5348|     66|    register_config_handler(type, "userSetPrivKey", usm_set_password, NULL,
 5349|     66|                            NULL);
 5350|     66|    register_config_handler(type, "userSetAuthLocalKey", usm_set_password,
 5351|     66|                            NULL, NULL);
 5352|     66|    register_config_handler(type, "userSetPrivLocalKey", usm_set_password,
 5353|     66|                            NULL, NULL);
 5354|     66|}
shutdown_usm:
 5358|     66|{
 5359|     66|    free_etimelist();
 5360|     66|    clear_user_list();
 5361|     66|}
snmpusm.c:usm_get_user_from_list:
  482|     20|{
  483|     20|    struct usmUser *ptr;
  484|       |
  485|     20|    for (ptr = puserList; ptr != NULL; ptr = ptr->next) {
  ------------------
  |  Branch (485:27): [True: 0, False: 20]
  ------------------
  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|     20|    if (use_default && !strcmp(name, "")) {
  ------------------
  |  Branch (507:9): [True: 20, False: 0]
  |  Branch (507:24): [True: 20, False: 0]
  ------------------
  508|     20|        DEBUGMSGTL(("usm", "return noNameUser\n"));
  ------------------
  |  |   66|     20|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     20|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 20]
  |  |  ------------------
  ------------------
  509|     20|        return noNameUser;
  510|     20|    }
  511|      0|    return NULL;
  512|     20|}
snmpusm.c:usm_secmod_rgenerate_out_msg:
 2431|      3|{
 2432|      3|    if (!parms)
  ------------------
  |  Branch (2432:9): [True: 0, False: 3]
  ------------------
 2433|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 2434|       |
 2435|      3|    return usm_rgenerate_out_msg(parms->msgProcModel,
 2436|      3|                                 parms->globalData, parms->globalDataLen,
 2437|      3|                                 parms->maxMsgSize, parms->secModel,
 2438|      3|                                 parms->secEngineID, parms->secEngineIDLen,
 2439|      3|                                 parms->secName, parms->secNameLen,
 2440|      3|                                 parms->secLevel,
 2441|      3|                                 parms->scopedPdu, parms->scopedPduLen,
 2442|      3|                                 parms->secStateRef,
 2443|      3|                                 parms->session->sessUser,
 2444|      3|                                 parms->wholeMsg, parms->wholeMsgLen,
 2445|      3|                                 parms->wholeMsgOffset);
 2446|      3|}
snmpusm.c:usm_rgenerate_out_msg:
 1977|      3|{
 1978|      3|    size_t          msgAuthParmLen = 0;
 1979|      3|    u_int           boots_uint;
 1980|      3|    u_int           time_uint;
 1981|      3|    long            boots_long;
 1982|      3|    long            time_long;
 1983|       |
 1984|       |    /*
 1985|       |     * Indirection because secStateRef values override parameters.
 1986|       |     * 
 1987|       |     * None of these are to be free'd - they are either pointing to
 1988|       |     * what's in the secStateRef or to something either in the
 1989|       |     * actual parameter list or the user list.
 1990|       |     */
 1991|       |
 1992|      3|    const char     *theName = NULL;
 1993|      3|    u_int           theNameLength = 0;
 1994|      3|    const u_char   *theEngineID = NULL;
 1995|      3|    u_int           theEngineIDLength = 0;
 1996|      3|    u_char         *theAuthKey = NULL;
 1997|      3|    u_int           theAuthKeyLength = 0;
 1998|      3|    const oid      *theAuthProtocol = NULL;
 1999|      3|    u_int           theAuthProtocolLength = 0;
 2000|      3|    u_char         *thePrivKey = NULL;
 2001|      3|    u_int           thePrivKeyLength = 0;
 2002|      3|    const oid      *thePrivProtocol = NULL;
 2003|      3|    u_int           thePrivProtocolLength = 0;
 2004|      3|    int             theSecLevel = 0;    /* No defined const for bad
 2005|       |                                         * value (other then err). */
 2006|      3|    size_t          salt_length = 0, save_salt_length = 0;
 2007|      3|    u_char          salt[BYTESIZE(USM_MAX_SALT_LENGTH)];
 2008|      3|    u_char          authParams[USM_MAX_AUTHSIZE];
 2009|      3|    u_char          iv[BYTESIZE(USM_MAX_SALT_LENGTH)];
 2010|      3|    size_t          sp_offset = 0, mac_offset = 0;
 2011|      3|    int             rc = 0;
 2012|       |
 2013|      3|    DEBUGMSGTL(("usm", "USM processing has begun (offset %d)\n", (int)*offset));
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2014|       |
 2015|      3|    if (secStateRef != NULL) {
  ------------------
  |  Branch (2015:9): [True: 0, False: 3]
  ------------------
 2016|       |        /*
 2017|       |         * To hush the compiler for now.  XXX 
 2018|       |         */
 2019|      0|        const struct usmStateReference *ref = secStateRef;
 2020|       |
 2021|      0|        theName = ref->usr_name;
 2022|      0|        theNameLength = ref->usr_name_length;
 2023|      0|        theEngineID = ref->usr_engine_id;
 2024|      0|        theEngineIDLength = ref->usr_engine_id_length;
 2025|       |
 2026|      0|        if (!theEngineIDLength) {
  ------------------
  |  Branch (2026:13): [True: 0, False: 0]
  ------------------
 2027|      0|            theEngineID = secEngineID;
 2028|      0|            theEngineIDLength = secEngineIDLen;
 2029|      0|        }
 2030|       |
 2031|      0|        theAuthProtocol = ref->usr_auth_protocol;
 2032|      0|        theAuthProtocolLength = ref->usr_auth_protocol_length;
 2033|      0|        theAuthKey = ref->usr_auth_key;
 2034|      0|        theAuthKeyLength = ref->usr_auth_key_length;
 2035|      0|        thePrivProtocol = ref->usr_priv_protocol;
 2036|      0|        thePrivProtocolLength = ref->usr_priv_protocol_length;
 2037|      0|        thePrivKey = ref->usr_priv_key;
 2038|      0|        thePrivKeyLength = ref->usr_priv_key_length;
 2039|      0|        theSecLevel = ref->usr_sec_level;
 2040|      0|    }
 2041|       |
 2042|       |    /*
 2043|       |     * * Identify the user record.
 2044|       |     */
 2045|      3|    else {
 2046|      3|        struct usmUser *user;
 2047|       |
 2048|       |        /*
 2049|       |         * we do allow an unknown user name for
 2050|       |         * unauthenticated requests. 
 2051|       |         */
 2052|      3|        if (sessUser)
  ------------------
  |  Branch (2052:13): [True: 0, False: 3]
  ------------------
 2053|      0|            user = sessUser;
 2054|      3|        else
 2055|      3|            user = usm_get_user2(secEngineID, secEngineIDLen, secName, secNameLen);
 2056|       |
 2057|      3|        if (user == NULL && secLevel != SNMP_SEC_LEVEL_NOAUTH) {
  ------------------
  |  |  299|      0|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
  |  Branch (2057:13): [True: 0, False: 3]
  |  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|      3|        theName = secName;
 2063|      3|        theNameLength = secNameLen;
 2064|      3|        theEngineID = secEngineID;
 2065|      3|        theSecLevel = secLevel;
 2066|      3|        theEngineIDLength = secEngineIDLen;
 2067|      3|        if (user) {
  ------------------
  |  Branch (2067:13): [True: 3, False: 0]
  ------------------
 2068|      3|            theAuthProtocol = user->authProtocol;
 2069|      3|            theAuthProtocolLength = user->authProtocolLen;
 2070|      3|            theAuthKey = user->authKey;
 2071|      3|            theAuthKeyLength = user->authKeyLen;
 2072|      3|            thePrivProtocol = user->privProtocol;
 2073|      3|            thePrivProtocolLength = user->privProtocolLen;
 2074|      3|            thePrivKey = user->privKey;
 2075|      3|            thePrivKeyLength = user->privKeyLen;
 2076|      3|        } else {
 2077|       |            /*
 2078|       |             * unknown users can not do authentication (obviously) 
 2079|       |             */
 2080|      0|            theAuthProtocol = usmNoAuthProtocol;
 2081|      0|            theAuthProtocolLength =
 2082|      0|                OID_LENGTH(usmNoAuthProtocol);
  ------------------
  |  |   57|      0|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
 2083|      0|            theAuthKey = NULL;
 2084|      0|            theAuthKeyLength = 0;
 2085|      0|            thePrivProtocol = usmNoPrivProtocol;
 2086|      0|            thePrivProtocolLength =
 2087|      0|                OID_LENGTH(usmNoPrivProtocol);
  ------------------
  |  |   57|      0|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
 2088|      0|            thePrivKey = NULL;
 2089|      0|            thePrivKeyLength = 0;
 2090|      0|        }
 2091|      3|    }                           /* endif -- secStateRef==NULL */
 2092|       |
 2093|       |
 2094|       |    /*
 2095|       |     * From here to the end of the function, avoid reference to
 2096|       |     * secName, secEngineID, secLevel, and associated lengths.
 2097|       |     */
 2098|       |
 2099|       |
 2100|       |    /*
 2101|       |     * Check to see if the user can use the requested sec services.
 2102|       |     */
 2103|      3|    if (usm_check_secLevel_vs_protocols(theSecLevel,
  ------------------
  |  Branch (2103:9): [True: 0, False: 3]
  ------------------
 2104|      3|                                        theAuthProtocol,
 2105|      3|                                        theAuthProtocolLength,
 2106|      3|                                        thePrivProtocol,
 2107|      3|                                        thePrivProtocolLength) == 1) {
 2108|      0|        DEBUGMSGTL(("usm", "Unsupported Security Level or type (%d)\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2109|      0|                    theSecLevel));
 2110|       |
 2111|      0|        return SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL;
  ------------------
  |  |  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|      3|    if (get_enginetime(theEngineID, theEngineIDLength,
  ------------------
  |  Branch (2121:9): [True: 0, False: 3]
  ------------------
 2122|      3|                       &boots_uint, &time_uint, FALSE) == -1) {
  ------------------
  |  |  125|      3|#define FALSE 0
  ------------------
 2123|      0|        DEBUGMSGTL(("usm", "%s\n", "Failed to find engine data."));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2124|      0|    }
 2125|       |
 2126|      3|    boots_long = boots_uint;
 2127|      3|    time_long = time_uint;
 2128|       |
 2129|      3|    if (theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      3|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2129:9): [True: 0, False: 3]
  ------------------
 2130|       |        /*
 2131|       |         * Initially assume that the ciphertext will end up the same size as
 2132|       |         * the plaintext plus some padding.  Really sc_encrypt ought to be able
 2133|       |         * to grow this for us, a la asn_realloc_rbuild_<type> functions, but
 2134|       |         * this will do for now.  
 2135|       |         */
 2136|      0|        u_char         *ciphertext = NULL;
 2137|      0|        size_t          ciphertextlen = scopedPduLen + 64;
 2138|      0|        int             priv_type = sc_get_privtype(thePrivProtocol,
 2139|      0|                                                    thePrivProtocolLength);
 2140|       |
 2141|      0|        if ((ciphertext = (u_char *) malloc(ciphertextlen)) == NULL) {
  ------------------
  |  Branch (2141:13): [True: 0, False: 0]
  ------------------
 2142|      0|            DEBUGMSGTL(("usm",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2143|      0|                        "couldn't malloc %d bytes for encrypted PDU\n",
 2144|      0|                        (int)ciphertextlen));
 2145|      0|            return SNMPERR_MALLOC;
  ------------------
  |  |  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 |
  ------------------
  |  |   79|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
 2204|      0|                                                 ASN_PRIMITIVE |
  ------------------
  |  |   84|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2205|      0|                                                 ASN_OCTET_STR),
  ------------------
  |  |   67|      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|      3|    } else {
 2225|       |        /*
 2226|       |         * theSecLevel != SNMP_SEC_LEVEL_AUTHPRIV  
 2227|       |         */
 2228|      3|    }
 2229|       |
 2230|       |    /*
 2231|       |     * Start encoding the msgSecurityParameters.  
 2232|       |     */
 2233|       |
 2234|      3|    sp_offset = *offset;
 2235|       |
 2236|      3|    DEBUGDUMPHEADER("send", "msgPrivacyParameters");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 3]
  |  |  ------------------
  ------------------
 2237|       |    /*
 2238|       |     * msgPrivacyParameters (warning: assumes DES salt).  
 2239|       |     */
 2240|      3|    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2241|      3|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   79|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   84|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2242|      3|                                             | ASN_OCTET_STR),
  ------------------
  |  |   67|      3|#define ASN_OCTET_STR	    0x04U
  ------------------
 2243|      3|                                   iv,
 2244|      3|                                   save_salt_length);
 2245|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2246|      3|    if (rc == 0) {
  ------------------
  |  Branch (2246:9): [True: 0, False: 3]
  ------------------
 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|      3|    DEBUGDUMPHEADER("send", "msgAuthenticationParameters");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 3]
  |  |  ------------------
  ------------------
 2252|       |    /*
 2253|       |     * msgAuthenticationParameters.
 2254|       |     */
 2255|      3|    if (theSecLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
  ------------------
  |  |  300|      6|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (2255:9): [True: 0, False: 3]
  ------------------
 2256|      3|        || theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      3|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2256:12): [True: 0, False: 3]
  ------------------
 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|      3|    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2264|      3|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   79|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   84|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2265|      3|                                             | ASN_OCTET_STR), authParams,
  ------------------
  |  |   67|      3|#define ASN_OCTET_STR	    0x04U
  ------------------
 2266|      3|                                   msgAuthParmLen);
 2267|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2268|      3|    if (rc == 0) {
  ------------------
  |  Branch (2268:9): [True: 0, False: 3]
  ------------------
 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|      3|    mac_offset = *offset - 2;
 2280|       |
 2281|       |    /*
 2282|       |     * msgUserName.  
 2283|       |     */
 2284|      3|    DEBUGDUMPHEADER("send", "msgUserName");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 3]
  |  |  ------------------
  ------------------
 2285|      3|    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2286|      3|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   79|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   84|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2287|      3|                                             | ASN_OCTET_STR),
  ------------------
  |  |   67|      3|#define ASN_OCTET_STR	    0x04U
  ------------------
 2288|      3|                                   (const u_char *) theName, theNameLength);
 2289|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2290|      3|    if (rc == 0) {
  ------------------
  |  Branch (2290:9): [True: 0, False: 3]
  ------------------
 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|      3|    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineTime");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 3]
  |  |  ------------------
  ------------------
 2299|      3|    rc = asn_realloc_rbuild_int(wholeMsg, wholeMsgLen, offset, 1,
 2300|      3|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   79|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   84|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2301|      3|                                          ASN_INTEGER), &time_long,
  ------------------
  |  |   64|      3|#define ASN_INTEGER	    0x02U
  ------------------
 2302|      3|                                sizeof(long));
 2303|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2304|      3|    if (rc == 0) {
  ------------------
  |  Branch (2304:9): [True: 0, False: 3]
  ------------------
 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|      3|    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineBoots");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 3]
  |  |  ------------------
  ------------------
 2314|      3|    rc = asn_realloc_rbuild_int(wholeMsg, wholeMsgLen, offset, 1,
 2315|      3|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   79|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   84|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2316|      3|                                          ASN_INTEGER), &boots_long,
  ------------------
  |  |   64|      3|#define ASN_INTEGER	    0x02U
  ------------------
 2317|      3|                                sizeof(long));
 2318|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2319|      3|    if (rc == 0) {
  ------------------
  |  Branch (2319:9): [True: 0, False: 3]
  ------------------
 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|      3|    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineID");
  ------------------
  |  |   79|      3|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 3]
  |  |  ------------------
  ------------------
 2326|      3|    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2327|      3|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   79|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   84|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2328|      3|                                             | ASN_OCTET_STR), theEngineID,
  ------------------
  |  |   67|      3|#define ASN_OCTET_STR	    0x04U
  ------------------
 2329|      3|                                   theEngineIDLength);
 2330|      3|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      3|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2331|      3|    if (rc == 0) {
  ------------------
  |  Branch (2331:9): [True: 0, False: 3]
  ------------------
 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|      3|    rc = asn_realloc_rbuild_sequence(wholeMsg, wholeMsgLen, offset, 1,
 2340|      3|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   73|      3|#define ASN_SEQUENCE	    0x10U
  ------------------
 2341|      3|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2342|      3|                                     *offset - sp_offset);
 2343|      3|    if (rc == 0) {
  ------------------
  |  Branch (2343:9): [True: 0, False: 3]
  ------------------
 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|      3|    rc = asn_realloc_rbuild_header(wholeMsg, wholeMsgLen, offset, 1,
 2352|      3|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   79|      3|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   84|      3|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2353|      3|                                             | ASN_OCTET_STR),
  ------------------
  |  |   67|      3|#define ASN_OCTET_STR	    0x04U
  ------------------
 2354|      3|                                   *offset - sp_offset);
 2355|       |
 2356|      3|    if (rc == 0) {
  ------------------
  |  Branch (2356:9): [True: 0, False: 3]
  ------------------
 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|      3|    while ((*wholeMsgLen - *offset) < globalDataLen) {
  ------------------
  |  Branch (2364:12): [True: 0, False: 3]
  ------------------
 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|      3|    *offset += globalDataLen;
 2372|      3|    memcpy(*wholeMsg + *wholeMsgLen - *offset, globalData, globalDataLen);
 2373|       |
 2374|       |    /*
 2375|       |     * Total packet sequence.  
 2376|       |     */
 2377|      3|    rc = asn_realloc_rbuild_sequence(wholeMsg, wholeMsgLen, offset, 1,
 2378|      3|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   73|      3|#define ASN_SEQUENCE	    0x10U
  ------------------
 2379|      3|                                               ASN_CONSTRUCTOR), *offset);
  ------------------
  |  |   85|      3|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2380|      3|    if (rc == 0) {
  ------------------
  |  Branch (2380:9): [True: 0, False: 3]
  ------------------
 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|      3|    if (theSecLevel == SNMP_SEC_LEVEL_AUTHNOPRIV ||
  ------------------
  |  |  300|      6|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (2389:9): [True: 0, False: 3]
  ------------------
 2390|      3|        theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      3|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2390:9): [True: 0, False: 3]
  ------------------
 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|      3|    DEBUGMSGTL(("usm", "USM processing completed.\n"));
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2426|      3|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|      3|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 2427|      3|}                               /* end usm_rgenerate_out_msg() */
snmpusm.c:usm_check_secLevel_vs_protocols:
 1352|      3|{
 1353|       |
 1354|      3|    if (level == SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|      6|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (1354:9): [True: 0, False: 3]
  ------------------
 1355|      0|        &&
 1356|      0|        (netsnmp_oid_equals
  ------------------
  |  Branch (1356:9): [True: 0, False: 0]
  ------------------
 1357|      0|         (privProtocol, privProtocolLen, usmNoPrivProtocol,
 1358|      0|          OID_LENGTH(usmNoPrivProtocol)) == 0)) {
  ------------------
  |  |   57|      0|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
 1359|      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]
  |  |  ------------------
  ------------------
 1360|      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]
  |  |  ------------------
  ------------------
 1361|      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]
  |  |  ------------------
  ------------------
 1362|      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]
  |  |  ------------------
  ------------------
 1363|      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]
  |  |  ------------------
  ------------------
 1364|      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]
  |  |  ------------------
  ------------------
 1365|      0|        return 1;
 1366|      0|    }
 1367|      3|    if ((level == SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|      6|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (1367:10): [True: 0, False: 3]
  ------------------
 1368|      3|         || level == SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|      3|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (1368:13): [True: 0, False: 3]
  ------------------
 1369|      0|        &&
 1370|      0|        (netsnmp_oid_equals
  ------------------
  |  Branch (1370:9): [True: 0, False: 0]
  ------------------
 1371|      0|         (authProtocol, authProtocolLen, usmNoAuthProtocol,
 1372|      0|          OID_LENGTH(usmNoAuthProtocol)) == 0)) {
  ------------------
  |  |   57|      0|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
 1373|      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]
  |  |  ------------------
  ------------------
 1374|      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]
  |  |  ------------------
  ------------------
 1375|      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]
  |  |  ------------------
  ------------------
 1376|      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]
  |  |  ------------------
  ------------------
 1377|      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]
  |  |  ------------------
  ------------------
 1378|      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]
  |  |  ------------------
  ------------------
 1379|      0|        return 1;
 1380|      0|    }
 1381|       |
 1382|      3|    return 0;
 1383|       |
 1384|      3|}                               /* end usm_check_secLevel_vs_protocols() */
snmpusm.c:usm_secmod_process_in_msg:
 3360|     25|{
 3361|     25|    if (!parms)
  ------------------
  |  Branch (3361:9): [True: 0, False: 25]
  ------------------
 3362|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 3363|       |
 3364|     25|    return usm_process_in_msg(parms->msgProcModel,
 3365|     25|                              parms->maxMsgSize,
 3366|     25|                              parms->secParams,
 3367|     25|                              parms->secModel,
 3368|     25|                              parms->secLevel,
 3369|     25|                              parms->wholeMsg,
 3370|     25|                              parms->wholeMsgLen,
 3371|     25|                              parms->secEngineID,
 3372|     25|                              parms->secEngineIDLen,
 3373|     25|                              parms->secName,
 3374|     25|                              parms->secNameLen,
 3375|     25|                              parms->scopedPdu,
 3376|     25|                              parms->scopedPduLen,
 3377|     25|                              parms->maxSizeResponse,
 3378|     25|                              parms->secStateRef,
 3379|     25|                              parms->sess, parms->msg_flags);
 3380|     25|}
snmpusm.c:usm_process_in_msg:
 2958|     25|{                               /* IN     - v3 Message flags.              */
 2959|     25|    size_t          remaining = wholeMsgLen - (secParams - wholeMsg);
 2960|     25|    u_int           boots_uint;
 2961|     25|    u_int           time_uint;
 2962|     25|#ifdef HAVE_AES
 2963|     25|    u_int           net_boots, net_time;
 2964|     25|#endif
 2965|     25|#ifndef NETSNMP_DISABLE_DES
 2966|     25|    int             i;
 2967|     25|#endif
 2968|     25|    u_char          signature[USM_MAX_AUTHSIZE];
 2969|     25|    size_t          signature_length = USM_MAX_AUTHSIZE;
  ------------------
  |  |   38|     25|#define USM_MAX_AUTHSIZE                USM_HMAC384SHA512_AUTH_LEN
  |  |  ------------------
  |  |  |  |   37|     25|#define USM_HMAC384SHA512_AUTH_LEN      48      /* SHOULD */
  |  |  ------------------
  ------------------
 2970|     25|    u_char          salt[BYTESIZE(USM_MAX_SALT_LENGTH)];
 2971|     25|    size_t          salt_length = BYTESIZE(USM_MAX_SALT_LENGTH);
  ------------------
  |  |   55|     25|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 2972|     25|    u_char          iv[BYTESIZE(USM_MAX_SALT_LENGTH)];
 2973|     25|    u_int           iv_length = BYTESIZE(USM_MAX_SALT_LENGTH);
  ------------------
  |  |   55|     25|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 2974|     25|    u_char         *data_ptr;
 2975|     25|    u_char         *value_ptr;
 2976|     25|    u_char          type_value;
 2977|     25|    u_char         *end_of_overhead = NULL;
 2978|     25|    int             error;
 2979|     25|    int             rc = 0;
 2980|     25|    struct usmStateReference **secStateRef =
 2981|     25|        (struct usmStateReference **) secStateRf;
 2982|       |
 2983|     25|    struct usmUser *user;
 2984|       |
 2985|       |
 2986|     25|    DEBUGMSGTL(("usm", "USM processing begun...\n"));
  ------------------
  |  |   66|     25|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     25|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 25]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 25]
  |  |  ------------------
  ------------------
 2987|       |
 2988|     25|    netsnmp_assert(secStateRef);
  ------------------
  |  |   47|     25|#      define netsnmp_assert(x)  do { \
  |  |   48|     25|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 25, False: 0]
  |  |  ------------------
  |  |   49|     25|                 ; \
  |  |   50|     25|              else \
  |  |   51|     25|                 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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     25|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 25]
  |  |  ------------------
  ------------------
 2989|       |
 2990|     25|    usm_free_usmStateReference(*secStateRef);
 2991|     25|    *secStateRef = usm_malloc_usmStateReference();
 2992|     25|    if (*secStateRef == NULL) {
  ------------------
  |  Branch (2992:9): [True: 0, False: 25]
  ------------------
 2993|      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]
  |  |  ------------------
  ------------------
 2994|      0|        return SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 2995|      0|    }
 2996|       |
 2997|       |    /*
 2998|       |     * Make sure the *secParms is an OCTET STRING.
 2999|       |     * Extract the user name, engine ID, and security level.
 3000|       |     */
 3001|     25|    if ((rc = usm_parse_security_parameters(secParams, remaining,
  ------------------
  |  Branch (3001:9): [True: 7, False: 18]
  ------------------
 3002|     25|                                            secEngineID, secEngineIDLen,
 3003|     25|                                            &boots_uint, &time_uint,
 3004|     25|                                            secName, secNameLen,
 3005|     25|                                            signature, &signature_length,
 3006|     25|                                            salt, &salt_length,
 3007|     25|                                            &data_ptr)) < 0) {
 3008|      7|        DEBUGMSGTL(("usm", "Parsing failed (rc %d).\n", rc));
  ------------------
  |  |   66|      7|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      7|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 7]
  |  |  ------------------
  ------------------
 3009|      7|        if (rc == -2) {
  ------------------
  |  Branch (3009:13): [True: 1, False: 6]
  ------------------
 3010|       |            /*
 3011|       |             * This indicates a decryptionError.  
 3012|       |             */
 3013|      1|            snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  625|      1|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3014|      1|            error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  234|      1|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3015|      6|        } else {
 3016|      6|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      6|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3017|      6|            error = SNMPERR_USM_PARSEERROR;
  ------------------
  |  |  231|      6|#define SNMPERR_USM_PARSEERROR			(-47)
  ------------------
 3018|      6|        }
 3019|      7|        goto err;
 3020|      7|    }
 3021|       |
 3022|       |    /*
 3023|       |     * RFC 2574 section 8.3.2
 3024|       |     * 1)  If the privParameters field is not an 8-octet OCTET STRING,
 3025|       |     * then an error indication (decryptionError) is returned to the
 3026|       |     * calling module.
 3027|       |     */
 3028|     18|    if ((secLevel == SNMP_SEC_LEVEL_AUTHPRIV) && (salt_length != 8)) {
  ------------------
  |  |  301|     18|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3028:9): [True: 0, False: 18]
  |  Branch (3028:50): [True: 0, False: 0]
  ------------------
 3029|      0|        snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  625|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3030|      0|        error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  234|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3031|      0|        goto err;
 3032|      0|    }
 3033|       |
 3034|     18|    if (secLevel != SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|     18|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3034:9): [True: 18, False: 0]
  ------------------
 3035|       |        /*
 3036|       |         * pull these out now so reports can use them 
 3037|       |         */
 3038|     18|        *scopedPdu = data_ptr;
 3039|     18|        *scopedPduLen = wholeMsgLen - (data_ptr - wholeMsg);
 3040|     18|        end_of_overhead = data_ptr;
 3041|     18|    }
 3042|       |
 3043|       |    /*
 3044|       |     * Cache the name, engine ID, and security level,
 3045|       |     * * per step 2 (section 3.2)
 3046|       |     */
 3047|     18|    if (usm_set_usmStateReference_name
  ------------------
  |  Branch (3047:9): [True: 0, False: 18]
  ------------------
 3048|     18|        (*secStateRef, secName, *secNameLen) == -1) {
 3049|      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]
  |  |  ------------------
  ------------------
 3050|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3051|      0|        goto err;
 3052|      0|    }
 3053|       |
 3054|     18|    if (usm_set_usmStateReference_engine_id
  ------------------
  |  Branch (3054:9): [True: 0, False: 18]
  ------------------
 3055|     18|        (*secStateRef, secEngineID, *secEngineIDLen) == -1) {
 3056|      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]
  |  |  ------------------
  ------------------
 3057|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3058|      0|        goto err;
 3059|      0|    }
 3060|       |
 3061|     18|    if (usm_set_usmStateReference_sec_level(*secStateRef, secLevel) ==
  ------------------
  |  Branch (3061:9): [True: 0, False: 18]
  ------------------
 3062|     18|        -1) {
 3063|      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]
  |  |  ------------------
  ------------------
 3064|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3065|      0|        goto err;
 3066|      0|    }
 3067|       |
 3068|       |    /*
 3069|       |     * Locate the engine ID record.
 3070|       |     * If it is unknown, then either create one or note this as an error.
 3071|       |     */
 3072|     18|    if ((sess && (sess->isAuthoritative == SNMP_SESS_AUTHORITATIVE ||
  ------------------
  |  |  125|     36|#define SNMP_SESS_AUTHORITATIVE    1    /* don't learn engineIDs */
  ------------------
  |  Branch (3072:10): [True: 18, False: 0]
  |  Branch (3072:19): [True: 0, False: 18]
  ------------------
 3073|     18|                  (sess->isAuthoritative == SNMP_SESS_UNKNOWNAUTH &&
  ------------------
  |  |  126|     36|#define SNMP_SESS_UNKNOWNAUTH      2    /* sometimes (like NRs) */
  ------------------
  |  Branch (3073:20): [True: 18, False: 0]
  ------------------
 3074|     18|                   (msg_flags & SNMP_MSG_FLAG_RPRT_BIT)))) ||
  ------------------
  |  |  305|     18|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3074:20): [True: 3, False: 15]
  ------------------
 3075|     15|        (!sess && (msg_flags & SNMP_MSG_FLAG_RPRT_BIT))) {
  ------------------
  |  |  305|      0|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3075:10): [True: 0, False: 15]
  |  Branch (3075:19): [True: 0, False: 0]
  ------------------
 3076|      3|        if (ISENGINEKNOWN(secEngineID, *secEngineIDLen) == FALSE) {
  ------------------
  |  |   82|      3|	( (get_enginetime(e, e_l,				\
  |  |  ------------------
  |  |  |  Branch (82:4): [True: 2, False: 1]
  |  |  ------------------
  |  |   83|      3|		&dummy_eboot, &dummy_etime, TRUE) == SNMPERR_SUCCESS)	\
  |  |  ------------------
  |  |  |  |  128|      3|#define TRUE  1
  |  |  ------------------
  |  |               		&dummy_eboot, &dummy_etime, TRUE) == SNMPERR_SUCCESS)	\
  |  |  ------------------
  |  |  |  |  184|      3|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |   84|      3|		? TRUE						\
  |  |  ------------------
  |  |  |  |  128|      2|#define TRUE  1
  |  |  ------------------
  |  |   85|      3|		: FALSE )
  |  |  ------------------
  |  |  |  |  125|      1|#define FALSE 0
  |  |  ------------------
  ------------------
                      if (ISENGINEKNOWN(secEngineID, *secEngineIDLen) == FALSE) {
  ------------------
  |  |  125|      3|#define FALSE 0
  ------------------
  |  Branch (3076:13): [True: 1, False: 2]
  ------------------
 3077|      1|            DEBUGMSGTL(("usm", "Unknown Engine ID.\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]
  |  |  ------------------
  ------------------
 3078|      1|            snmp_increment_statistic(STAT_USMSTATSUNKNOWNENGINEIDS);
  ------------------
  |  |  623|      1|#define   STAT_USMSTATSUNKNOWNENGINEIDS      6
  ------------------
 3079|      1|            error = SNMPERR_USM_UNKNOWNENGINEID;
  ------------------
  |  |  232|      1|#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
  ------------------
 3080|      1|            goto err;
 3081|      1|        }
 3082|     15|    } else {
 3083|     15|        if (ENSURE_ENGINE_RECORD(secEngineID, *secEngineIDLen)
  ------------------
  |  |   88|     15|	( (set_enginetime(e, e_l, 0, 0, FALSE) == SNMPERR_SUCCESS)	\
  |  |  ------------------
  |  |  |  |  125|     15|#define FALSE 0
  |  |  ------------------
  |  |               	( (set_enginetime(e, e_l, 0, 0, FALSE) == SNMPERR_SUCCESS)	\
  |  |  ------------------
  |  |  |  |  184|     15|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (88:4): [True: 15, False: 0]
  |  |  ------------------
  |  |   89|     15|		? SNMPERR_SUCCESS				\
  |  |  ------------------
  |  |  |  |  184|     15|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |   90|     15|		: SNMPERR_GENERR )
  |  |  ------------------
  |  |  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  ------------------
  |  Branch (3083:13): [True: 0, False: 15]
  ------------------
 3084|     15|            != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|     15|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3085|      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]
  |  |  ------------------
  ------------------
 3086|      0|            error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3087|      0|            goto err;
 3088|      0|        }
 3089|       |
 3090|     15|    }
 3091|       |
 3092|       |
 3093|       |    /*
 3094|       |     * Locate the User record.
 3095|       |     * If the user/engine ID is unknown, report this as an error.
 3096|       |     */
 3097|     17|    if (sess && sess->sessUser)
  ------------------
  |  Branch (3097:9): [True: 17, False: 0]
  |  Branch (3097:17): [True: 0, False: 17]
  ------------------
 3098|      0|        user = sess->sessUser;
 3099|     17|    else
 3100|     17|        user = usm_get_user_from_list(secEngineID, *secEngineIDLen,
 3101|     17|                                       secName, *secNameLen, userList,
 3102|     17|                                       (((sess && sess->isAuthoritative ==
  ------------------
  |  Branch (3102:43): [True: 17, False: 0]
  |  Branch (3102:51): [True: 0, False: 17]
  ------------------
 3103|     17|                                          SNMP_SESS_AUTHORITATIVE) ||
  ------------------
  |  |  125|     17|#define SNMP_SESS_AUTHORITATIVE    1    /* don't learn engineIDs */
  ------------------
 3104|     17|                                         (!sess)) ? 0 : 1));
  ------------------
  |  Branch (3104:42): [True: 0, False: 17]
  ------------------
 3105|       |
 3106|     17|    if (user == NULL) {
  ------------------
  |  Branch (3106:9): [True: 0, False: 17]
  ------------------
 3107|      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]
  |  |  ------------------
  ------------------
 3108|      0|        snmp_increment_statistic(STAT_USMSTATSUNKNOWNUSERNAMES);
  ------------------
  |  |  622|      0|#define   STAT_USMSTATSUNKNOWNUSERNAMES      5
  ------------------
 3109|      0|        error = SNMPERR_USM_UNKNOWNSECURITYNAME;
  ------------------
  |  |  227|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
 3110|      0|        goto err;
 3111|      0|    }
 3112|       |
 3113|       |    /* ensure the user is active */
 3114|     17|    if (user->userStatus != RS_ACTIVE) {
  ------------------
  |  |   35|     17|#define RS_ACTIVE	        1
  ------------------
  |  Branch (3114:9): [True: 0, False: 17]
  ------------------
 3115|      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]
  |  |  ------------------
  ------------------
 3116|      0|        error = SNMPERR_USM_UNKNOWNSECURITYNAME;
  ------------------
  |  |  227|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
 3117|      0|        goto err;
 3118|      0|    }
 3119|       |
 3120|       |    /*
 3121|       |     * Make sure the security level is appropriate.
 3122|       |     */
 3123|       |
 3124|     17|    rc = usm_check_secLevel(secLevel, user);
 3125|     17|    if (1 == rc) {
  ------------------
  |  Branch (3125:9): [True: 0, False: 17]
  ------------------
 3126|      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]
  |  |  ------------------
  ------------------
 3127|      0|                    secLevel));
 3128|      0|        snmp_increment_statistic(STAT_USMSTATSUNSUPPORTEDSECLEVELS);
  ------------------
  |  |  620|      0|#define   STAT_USMSTATSUNSUPPORTEDSECLEVELS  3
  ------------------
 3129|      0|        error = SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL;
  ------------------
  |  |  228|      0|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
 3130|      0|        goto err;
 3131|     17|    } else if (rc != 0) {
  ------------------
  |  Branch (3131:16): [True: 0, False: 17]
  ------------------
 3132|      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]
  |  |  ------------------
  ------------------
 3133|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3134|      0|        goto err;
 3135|      0|    }
 3136|       |
 3137|       |    /*
 3138|       |     * Check the authentication credentials of the message.
 3139|       |     */
 3140|     17|    if (secLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
  ------------------
  |  |  300|     34|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (3140:9): [True: 6, False: 11]
  ------------------
 3141|     11|        || secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|     11|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3141:12): [True: 0, False: 11]
  ------------------
 3142|      6|        if (sc_check_keyed_hash(user->authProtocol, user->authProtocolLen,
  ------------------
  |  Branch (3142:13): [True: 6, False: 0]
  ------------------
 3143|      6|                                user->authKey, user->authKeyLen,
 3144|      6|                                wholeMsg, wholeMsgLen,
 3145|      6|                                signature, signature_length)
 3146|      6|            != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|      6|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
 3147|      6|            DEBUGMSGTL(("usm", "Verification failed.\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]
  |  |  ------------------
  ------------------
 3148|      6|            snmp_increment_statistic(STAT_USMSTATSWRONGDIGESTS);
  ------------------
  |  |  624|      6|#define   STAT_USMSTATSWRONGDIGESTS          7
  ------------------
 3149|      6|	    snmp_log(LOG_WARNING, "Authentication failed for %s\n",
 3150|      6|				user->name);
 3151|      6|            error = SNMPERR_USM_AUTHENTICATIONFAILURE;
  ------------------
  |  |  230|      6|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
 3152|      6|            goto err;
 3153|      6|        }
 3154|       |
 3155|      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]
  |  |  ------------------
  ------------------
 3156|      0|    }
 3157|       |
 3158|       |
 3159|       |    /*
 3160|       |     * Steps 10-11  user is already set - relocated before timeliness 
 3161|       |     * check in case it fails - still save user data for response.
 3162|       |     *
 3163|       |     * Cache the keys and protocol oids, per step 11 (s3.2).
 3164|       |     */
 3165|     11|    if (usm_set_usmStateReference_auth_protocol(*secStateRef,
  ------------------
  |  Branch (3165:9): [True: 0, False: 11]
  ------------------
 3166|     11|                                                user->authProtocol,
 3167|     11|                                                user->
 3168|     11|                                                authProtocolLen) == -1) {
 3169|      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]
  |  |  ------------------
  ------------------
 3170|      0|                    "Couldn't cache authentication protocol."));
 3171|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3172|      0|        goto err;
 3173|      0|    }
 3174|       |
 3175|     11|    if (usm_set_usmStateReference_auth_key(*secStateRef,
  ------------------
  |  Branch (3175:9): [True: 0, False: 11]
  ------------------
 3176|     11|                                           user->authKey,
 3177|     11|                                           user->authKeyLen) == -1) {
 3178|      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]
  |  |  ------------------
  ------------------
 3179|      0|                    "Couldn't cache authentication key."));
 3180|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3181|      0|        goto err;
 3182|      0|    }
 3183|       |
 3184|     11|    if (usm_set_usmStateReference_priv_protocol(*secStateRef,
  ------------------
  |  Branch (3184:9): [True: 0, False: 11]
  ------------------
 3185|     11|                                                user->privProtocol,
 3186|     11|                                                user->
 3187|     11|                                                privProtocolLen) == -1) {
 3188|      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]
  |  |  ------------------
  ------------------
 3189|      0|                    "Couldn't cache privacy protocol."));
 3190|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3191|      0|        goto err;
 3192|      0|    }
 3193|       |
 3194|     11|    if (usm_set_usmStateReference_priv_key(*secStateRef,
  ------------------
  |  Branch (3194:9): [True: 0, False: 11]
  ------------------
 3195|     11|                                           user->privKey,
 3196|     11|                                           user->privKeyLen) == -1) {
 3197|      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]
  |  |  ------------------
  ------------------
 3198|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  226|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3199|      0|        goto err;
 3200|      0|    }
 3201|       |
 3202|       |
 3203|       |    /*
 3204|       |     * Perform the timeliness/time manager functions.
 3205|       |     */
 3206|     11|    if (secLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
  ------------------
  |  |  300|     22|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (3206:9): [True: 0, False: 11]
  ------------------
 3207|     11|        || secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|     11|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3207:12): [True: 0, False: 11]
  ------------------
 3208|      0|        if (usm_check_and_update_timeliness(secEngineID, *secEngineIDLen,
  ------------------
  |  Branch (3208:13): [True: 0, False: 0]
  ------------------
 3209|      0|                                            boots_uint, time_uint,
 3210|      0|                                            &error) == -1) {
 3211|      0|            goto err;
 3212|      0|        }
 3213|      0|    }
 3214|     11|#ifdef							LCD_TIME_SYNC_OPT
 3215|       |    /*
 3216|       |     * Cache the unauthenticated time to use in case we don't have
 3217|       |     * anything better - this guess will be no worse than (0,0)
 3218|       |     * that we normally use.
 3219|       |     */
 3220|     11|    else {
 3221|     11|        set_enginetime(secEngineID, *secEngineIDLen,
 3222|     11|                       boots_uint, time_uint, FALSE);
  ------------------
  |  |  125|     11|#define FALSE 0
  ------------------
 3223|     11|    }
 3224|     11|#endif                          /* LCD_TIME_SYNC_OPT */
 3225|       |
 3226|       |
 3227|       |    /*
 3228|       |     * If needed, decrypt the scoped PDU.
 3229|       |     */
 3230|     11|    if (secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|     11|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3230:9): [True: 0, False: 11]
  ------------------
 3231|      0|        int priv_type = sc_get_privtype(user->privProtocol,
 3232|      0|                                        user->privProtocolLen);
 3233|      0|        remaining = wholeMsgLen - (data_ptr - wholeMsg);
 3234|       |
 3235|      0|        if ((value_ptr = asn_parse_sequence(data_ptr, &remaining,
  ------------------
  |  Branch (3235:13): [True: 0, False: 0]
  ------------------
 3236|      0|                                            &type_value,
 3237|      0|                                            (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   79|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                          (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   84|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3238|      0|                                             | ASN_OCTET_STR),
  ------------------
  |  |   67|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 3239|      0|                                            "encrypted sPDU")) == NULL) {
 3240|      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]
  |  |  ------------------
  ------------------
 3241|      0|                        "Failed while parsing encrypted sPDU."));
 3242|      0|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3243|      0|            usm_free_usmStateReference(*secStateRef);
 3244|      0|            *secStateRef = NULL;
 3245|      0|            error = SNMPERR_USM_PARSEERROR;
  ------------------
  |  |  231|      0|#define SNMPERR_USM_PARSEERROR			(-47)
  ------------------
 3246|      0|            goto err;
 3247|      0|        }
 3248|       |
 3249|      0|#ifndef NETSNMP_DISABLE_DES
 3250|      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 (3250:13): [True: 0, False: 0]
  ------------------
 3251|       |            /*
 3252|       |             * From RFC2574:
 3253|       |             * 
 3254|       |             * "Before decryption, the encrypted data length is verified.
 3255|       |             * If the length of the OCTET STRING to be decrypted is not
 3256|       |             * an integral multiple of 8 octets, the decryption process
 3257|       |             * is halted and an appropriate exception noted."  
 3258|       |             */
 3259|       |
 3260|      0|            if (remaining % 8 != 0) {
  ------------------
  |  Branch (3260:17): [True: 0, False: 0]
  ------------------
 3261|      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]
  |  |  ------------------
  ------------------
 3262|      0|                            "Ciphertext is %lu bytes, not an integer multiple of 8 (rem %lu)\n",
 3263|      0|                            (unsigned long)remaining, (unsigned long)remaining % 8));
 3264|      0|                snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  625|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3265|      0|                usm_free_usmStateReference(*secStateRef);
 3266|      0|                *secStateRef = NULL;
 3267|      0|                error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  234|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3268|      0|                goto err;
 3269|      0|            }
 3270|       |
 3271|      0|            end_of_overhead = value_ptr;
 3272|      0|            iv_length = BYTESIZE(USM_DES_SALT_LENGTH);
  ------------------
  |  |   55|      0|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 3273|       |
 3274|      0|            if (!user->privKey || user->privKeyLen < 2 * iv_length ||
  ------------------
  |  Branch (3274:17): [True: 0, False: 0]
  |  Branch (3274:35): [True: 0, False: 0]
  ------------------
 3275|      0|                salt_length < iv_length) {
  ------------------
  |  Branch (3275:17): [True: 0, False: 0]
  ------------------
 3276|      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]
  |  |  ------------------
  ------------------
 3277|      0|                snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  625|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3278|      0|                usm_free_usmStateReference(*secStateRef);
 3279|      0|                *secStateRef = NULL;
 3280|      0|                error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  234|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3281|      0|                goto err;
 3282|      0|            }
 3283|       |
 3284|       |            /*
 3285|       |             * XOR the salt with the last (iv_length) bytes
 3286|       |             * of the priv_key to obtain the IV.
 3287|       |             */
 3288|      0|            for (i = 0; i < (int) iv_length; i++)
  ------------------
  |  Branch (3288:25): [True: 0, False: 0]
  ------------------
 3289|      0|                iv[i] = salt[i] ^ user->privKey[iv_length + i];
 3290|      0|        }
 3291|      0|#endif
 3292|      0|#ifdef HAVE_AES
 3293|      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 (3293:13): [True: 0, False: 0]
  ------------------
 3294|      0|            iv_length = BYTESIZE(USM_AES_SALT_LENGTH);
  ------------------
  |  |   55|      0|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 3295|      0|            net_boots = ntohl(boots_uint);
 3296|      0|            net_time = ntohl(time_uint);
 3297|      0|            memcpy(iv, &net_boots, 4);
 3298|      0|            memcpy(iv+4, &net_time, 4);
 3299|      0|            memcpy(iv+8, salt, salt_length);
 3300|      0|        }
 3301|      0|#endif
 3302|       |
 3303|       |#ifdef NETSNMP_ENABLE_TESTING_CODE
 3304|       |        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
 3305|       |            dump_chunk("usm/dump", "Cypher Text", value_ptr, remaining);
 3306|       |            dump_chunk("usm/dump", "salt + Encrypted form:",
 3307|       |                       salt, salt_length);
 3308|       |            dump_chunk("usm/dump", "IV + Encrypted form:", iv, iv_length);
 3309|       |        }
 3310|       |#endif
 3311|      0|        if (sc_decrypt(user->privProtocol, user->privProtocolLen,
  ------------------
  |  Branch (3311:13): [True: 0, False: 0]
  ------------------
 3312|      0|                       user->privKey, user->privKeyLen,
 3313|      0|                       iv, iv_length,
 3314|      0|                       value_ptr, remaining, *scopedPdu, scopedPduLen)
 3315|      0|            != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|      0|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
 3316|      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]
  |  |  ------------------
  ------------------
 3317|      0|            snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  625|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3318|      0|            error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  234|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3319|      0|            goto err;
 3320|      0|        }
 3321|       |#ifdef NETSNMP_ENABLE_TESTING_CODE
 3322|       |        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
 3323|       |            dump_chunk("usm/dump", "Decrypted chunk:",
 3324|       |                       *scopedPdu, *scopedPduLen);
 3325|       |        }
 3326|       |#endif
 3327|      0|    }
 3328|       |    /*
 3329|       |     * sPDU is plaintext.
 3330|       |     */
 3331|     11|    else {
 3332|     11|        *scopedPdu = data_ptr;
 3333|     11|        *scopedPduLen = wholeMsgLen - (data_ptr - wholeMsg);
 3334|     11|        end_of_overhead = data_ptr;
 3335|       |
 3336|     11|    }                           /* endif -- PDU decryption */
 3337|       |
 3338|       |
 3339|       |    /*
 3340|       |     * Calculate the biggest sPDU for the response (i.e., whole - ovrhd).
 3341|       |     *
 3342|       |     * FIX  Correct? 
 3343|       |     */
 3344|     11|    *maxSizeResponse = maxMsgSize - (end_of_overhead - wholeMsg);
 3345|       |
 3346|       |
 3347|     11|    DEBUGMSGTL(("usm", "USM processing completed.\n"));
  ------------------
  |  |   66|     11|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     11|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 11]
  |  |  ------------------
  ------------------
 3348|       |
 3349|     11|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     11|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3350|       |
 3351|     14|err:
 3352|     14|    usm_free_usmStateReference(*secStateRef);
 3353|     14|    *secStateRef = NULL;
 3354|       |    netsnmp_assert(error != SNMPERR_SUCCESS);
  ------------------
  |  |   47|     14|#      define netsnmp_assert(x)  do { \
  |  |   48|     14|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 14, False: 0]
  |  |  ------------------
  |  |   49|     14|                 ; \
  |  |   50|     14|              else \
  |  |   51|     14|                 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
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     14|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 14]
  |  |  ------------------
  ------------------
 3355|     14|    return error;
 3356|     11|}                               /* end usm_process_in_msg() */
snmpusm.c:usm_malloc_usmStateReference:
  288|     25|{
  289|     25|    struct usmStateReference *retval;
  290|       |
  291|     25|    retval = calloc(1, sizeof(struct usmStateReference));
  292|     25|    if (retval)
  ------------------
  |  Branch (292:9): [True: 25, False: 0]
  ------------------
  293|     25|        retval->refcnt = 1;
  294|       |
  295|     25|    return retval;
  296|     25|}                               /* end usm_malloc_usmStateReference() */
snmpusm.c:usm_parse_security_parameters:
 2477|     25|{
 2478|     25|    u_char         *parse_ptr = secParams;
 2479|     25|    u_char         *value_ptr;
 2480|     25|    u_char         *next_ptr;
 2481|     25|    u_char          type_value;
 2482|       |
 2483|     25|    size_t          octet_string_length = remaining;
 2484|     25|    size_t          sequence_length;
 2485|     25|    size_t          remaining_bytes;
 2486|       |
 2487|     25|    long            boots_long;
 2488|     25|    long            time_long;
 2489|       |
 2490|     25|    u_int           origNameLen;
 2491|       |
 2492|       |
 2493|       |    /*
 2494|       |     * Eat the first octet header.
 2495|       |     */
 2496|     25|    if ((value_ptr = asn_parse_sequence(parse_ptr, &octet_string_length,
  ------------------
  |  Branch (2496:9): [True: 0, False: 25]
  ------------------
 2497|     25|                                        &type_value,
 2498|     25|                                        (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   79|     25|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                      (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   84|     25|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2499|     25|                                         ASN_OCTET_STR),
  ------------------
  |  |   67|     25|#define ASN_OCTET_STR	    0x04U
  ------------------
 2500|     25|                                        "usm first octet")) == NULL) {
 2501|       |        /*
 2502|       |         * RETURN parse error 
 2503|      0|         */ return -1;
 2504|      0|    }
 2505|       |
 2506|       |
 2507|       |    /*
 2508|       |     * Eat the sequence header.
 2509|       |     */
 2510|     25|    parse_ptr = value_ptr;
 2511|     25|    sequence_length = octet_string_length;
 2512|       |
 2513|     25|    if ((value_ptr = asn_parse_sequence(parse_ptr, &sequence_length,
  ------------------
  |  Branch (2513:9): [True: 0, False: 25]
  ------------------
 2514|     25|                                        &type_value,
 2515|     25|                                        (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   73|     25|#define ASN_SEQUENCE	    0x10U
  ------------------
                                                      (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   85|     25|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2516|     25|                                        "usm sequence")) == NULL) {
 2517|       |        /*
 2518|       |         * RETURN parse error 
 2519|      0|         */ return -1;
 2520|      0|    }
 2521|       |
 2522|       |
 2523|       |    /*
 2524|       |     * Retrieve the engineID.
 2525|       |     */
 2526|     25|    parse_ptr = value_ptr;
 2527|     25|    remaining_bytes = sequence_length;
 2528|       |
 2529|     25|    DEBUGDUMPHEADER("recv", "msgAuthoritativeEngineID");
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 2530|     25|    if ((next_ptr
  ------------------
  |  Branch (2530:9): [True: 1, False: 24]
  ------------------
 2531|     25|         = asn_parse_string(parse_ptr, &remaining_bytes, &type_value,
 2532|     25|                            secEngineID, secEngineIDLen)) == NULL) {
 2533|      1|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      1|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 1]
  |  |  ------------------
  ------------------
 2534|       |        /*
 2535|       |         * RETURN parse error 
 2536|      1|         */ return -1;
 2537|      1|    }
 2538|     24|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     24|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     24|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 24]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 24]
  |  |  ------------------
  ------------------
 2539|       |
 2540|     24|    if (type_value !=
  ------------------
  |  Branch (2540:9): [True: 0, False: 24]
  ------------------
 2541|     24|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   79|     24|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   84|     24|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   67|     24|#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|     24|    DEBUGDUMPHEADER("recv", "msgAuthoritativeEngineBoots");
  ------------------
  |  |   79|     24|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     24|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 24]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 24]
  |  |  ------------------
  ------------------
 2553|     24|    if ((next_ptr = asn_parse_int(next_ptr, &remaining_bytes, &type_value,
  ------------------
  |  Branch (2553:9): [True: 0, False: 24]
  ------------------
 2554|     24|                                  &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|     24|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     24|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     24|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 24]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 24]
  |  |  ------------------
  ------------------
 2561|       |
 2562|     24|    if (type_value !=
  ------------------
  |  Branch (2562:9): [True: 0, False: 24]
  ------------------
 2563|     24|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   79|     24|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   84|     24|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   64|     24|#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|     24|    *boots_uint = (u_int) boots_long;
 2571|       |
 2572|       |
 2573|       |    /*
 2574|       |     * Retrieve the time value.
 2575|       |     */
 2576|     24|    DEBUGDUMPHEADER("recv", "msgAuthoritativeEngineTime");
  ------------------
  |  |   79|     24|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     24|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 24]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 24]
  |  |  ------------------
  ------------------
 2577|     24|    if ((next_ptr = asn_parse_int(next_ptr, &remaining_bytes, &type_value,
  ------------------
  |  Branch (2577:9): [True: 0, False: 24]
  ------------------
 2578|     24|                                  &time_long, sizeof(long))) == NULL) {
 2579|       |        /*
 2580|       |         * RETURN parse error 
 2581|      0|         */ return -1;
 2582|      0|    }
 2583|     24|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     24|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     24|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 24]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 24]
  |  |  ------------------
  ------------------
 2584|       |
 2585|     24|    if (type_value !=
  ------------------
  |  Branch (2585:9): [True: 0, False: 24]
  ------------------
 2586|     24|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   79|     24|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   84|     24|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   64|     24|#define ASN_INTEGER	    0x02U
  ------------------
 2587|       |        /*
 2588|       |         * RETURN parse error 
 2589|      0|         */ return -1;
 2590|      0|    }
 2591|       |
 2592|     24|    *time_uint = (u_int) time_long;
 2593|       |
 2594|     24|    if (boots_long < 0 || boots_long > ENGINEBOOT_MAX ||
  ------------------
  |  |  183|     47|#define ENGINEBOOT_MAX	2147483647      /* ((2^31)-1) */
  ------------------
  |  Branch (2594:9): [True: 1, False: 23]
  |  Branch (2594:27): [True: 0, False: 23]
  ------------------
 2595|     23|        time_long < 0 || time_long > ENGINETIME_MAX) {
  ------------------
  |  |  182|     23|#define ENGINETIME_MAX	2147483647      /* ((2^31)-1) */
  ------------------
  |  Branch (2595:9): [True: 0, False: 23]
  |  Branch (2595:26): [True: 0, False: 23]
  ------------------
 2596|      1|        return -1;
 2597|      1|    }
 2598|       |
 2599|       |    /*
 2600|       |     * Retrieve the secName.
 2601|       |     */
 2602|     23|    origNameLen = *secNameLen;
 2603|       |
 2604|       |
 2605|     23|    DEBUGDUMPHEADER("recv", "msgUserName");
  ------------------
  |  |   79|     23|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     23|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 23]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 23]
  |  |  ------------------
  ------------------
 2606|     23|    if ((next_ptr
  ------------------
  |  Branch (2606:9): [True: 0, False: 23]
  ------------------
 2607|     23|         = asn_parse_string(next_ptr, &remaining_bytes, &type_value,
 2608|     23|                            (u_char *) secName, secNameLen)) == NULL) {
 2609|      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]
  |  |  ------------------
  ------------------
 2610|       |        /*
 2611|       |         * RETURN parse error 
 2612|      0|         */ return -1;
 2613|      0|    }
 2614|     23|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     23|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     23|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 23]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 23]
  |  |  ------------------
  ------------------
 2615|       |
 2616|       |    /*
 2617|       |     * FIX -- doesn't this also indicate a buffer overrun?
 2618|       |     */
 2619|     23|    if (origNameLen < *secNameLen + 1) {
  ------------------
  |  Branch (2619:9): [True: 0, False: 23]
  ------------------
 2620|       |        /*
 2621|       |         * RETURN parse error, but it's really a parameter error 
 2622|       |         */
 2623|      0|        return -1;
 2624|      0|    }
 2625|       |
 2626|     23|    if (*secNameLen > 32) {
  ------------------
  |  Branch (2626:9): [True: 0, False: 23]
  ------------------
 2627|       |        /*
 2628|       |         * This is a USM-specific limitation over and above the above
 2629|       |         * limitation (which will probably default to the length of an
 2630|       |         * SnmpAdminString, i.e. 255).  See RFC 2574, sec. 2.4.  
 2631|       |         */
 2632|      0|        return -1;
 2633|      0|    }
 2634|       |
 2635|     23|    secName[*secNameLen] = '\0';
 2636|       |
 2637|     23|    if (type_value !=
  ------------------
  |  Branch (2637:9): [True: 0, False: 23]
  ------------------
 2638|     23|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   79|     23|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   84|     23|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   67|     23|#define ASN_OCTET_STR	    0x04U
  ------------------
 2639|       |        /*
 2640|       |         * RETURN parse error 
 2641|      0|         */ return -1;
 2642|      0|    }
 2643|       |
 2644|       |
 2645|       |    /*
 2646|       |     * Retrieve the signature and blank it if there.
 2647|       |     */
 2648|     23|    DEBUGDUMPHEADER("recv", "msgAuthenticationParameters");
  ------------------
  |  |   79|     23|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     23|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 23]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 23]
  |  |  ------------------
  ------------------
 2649|     23|    if ((next_ptr
  ------------------
  |  Branch (2649:9): [True: 4, False: 19]
  ------------------
 2650|     23|         = asn_parse_string(next_ptr, &remaining_bytes, &type_value,
 2651|     23|                            signature, signature_length)) == NULL) {
 2652|      4|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2653|       |        /*
 2654|       |         * RETURN parse error 
 2655|      4|         */ return -1;
 2656|      4|    }
 2657|     19|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     19|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     19|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 19]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 19]
  |  |  ------------------
  ------------------
 2658|       |
 2659|     19|    if (type_value !=
  ------------------
  |  Branch (2659:9): [True: 0, False: 19]
  ------------------
 2660|     19|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   79|     19|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   84|     19|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   67|     19|#define ASN_OCTET_STR	    0x04U
  ------------------
 2661|       |        /*
 2662|       |         * RETURN parse error 
 2663|      0|         */ return -1;
 2664|      0|    }
 2665|       |
 2666|     19|    if (*signature_length != 0) {       /* Blanking for authentication step later */
  ------------------
  |  Branch (2666:9): [True: 19, False: 0]
  ------------------
 2667|     19|        memset(next_ptr - (u_long) * signature_length,
 2668|     19|               0, *signature_length);
 2669|     19|    }
 2670|       |
 2671|       |
 2672|       |    /*
 2673|       |     * Retrieve the salt.
 2674|       |     *
 2675|       |     * Note that the next ptr is where the data section starts.
 2676|       |     */
 2677|     19|    DEBUGDUMPHEADER("recv", "msgPrivacyParameters");
  ------------------
  |  |   79|     19|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     19|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 19]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 19]
  |  |  ------------------
  ------------------
 2678|     19|    if ((*data_ptr
  ------------------
  |  Branch (2678:9): [True: 1, False: 18]
  ------------------
 2679|     19|         = asn_parse_string(next_ptr, &remaining_bytes, &type_value,
 2680|     19|                            salt, salt_length)) == NULL) {
 2681|      1|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      1|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 1]
  |  |  ------------------
  ------------------
 2682|       |        /*
 2683|       |         * RETURN parse error 
 2684|      1|         */ return -2;
 2685|      1|    }
 2686|     18|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     18|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     18|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 18]
  |  |  ------------------
  ------------------
 2687|       |
 2688|     18|    if (type_value !=
  ------------------
  |  Branch (2688:9): [True: 0, False: 18]
  ------------------
 2689|     18|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   79|     18|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   84|     18|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   67|     18|#define ASN_OCTET_STR	    0x04U
  ------------------
 2690|       |        /*
 2691|       |         * RETURN parse error 
 2692|      0|         */ return -2;
 2693|      0|    }
 2694|       |
 2695|     18|    return 0;
 2696|       |
 2697|     18|}                               /* end usm_parse_security_parameters() */
snmpusm.c:usm_set_usmStateReference_name:
  356|     18|{
  357|       |    MAKE_ENTRY(ref, char, name, name_len, usr_name, usr_name_length);
  ------------------
  |  |  248|     18|#define MAKE_ENTRY(ref, type, item, len, field, field_len)      \
  |  |  249|     18|do {                                                            \
  |  |  250|     18|	if (ref == NULL)                                        \
  |  |  ------------------
  |  |  |  Branch (250:6): [True: 0, False: 18]
  |  |  ------------------
  |  |  251|     18|		return -1;                                      \
  |  |  252|     18|	if (ref->field != NULL)	{                               \
  |  |  ------------------
  |  |  |  Branch (252:6): [True: 0, False: 18]
  |  |  ------------------
  |  |  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|     18|	ref->field_len = 0;                                     \
  |  |  257|     18|        if (len == 0 || item == NULL)                           \
  |  |  ------------------
  |  |  |  Branch (257:13): [True: 18, False: 0]
  |  |  |  Branch (257:25): [True: 0, False: 0]
  |  |  ------------------
  |  |  258|     18|		return 0;                                       \
  |  |  259|     18|	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|     18|}
snmpusm.c:usm_set_usmStateReference_engine_id:
  364|     18|{
  365|       |    MAKE_ENTRY(ref, u_char, engine_id, engine_id_len,
  ------------------
  |  |  248|     18|#define MAKE_ENTRY(ref, type, item, len, field, field_len)      \
  |  |  249|     18|do {                                                            \
  |  |  250|     18|	if (ref == NULL)                                        \
  |  |  ------------------
  |  |  |  Branch (250:6): [True: 0, False: 18]
  |  |  ------------------
  |  |  251|     18|		return -1;                                      \
  |  |  252|     18|	if (ref->field != NULL)	{                               \
  |  |  ------------------
  |  |  |  Branch (252:6): [True: 0, False: 18]
  |  |  ------------------
  |  |  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|     18|	ref->field_len = 0;                                     \
  |  |  257|     18|        if (len == 0 || item == NULL)                           \
  |  |  ------------------
  |  |  |  Branch (257:13): [True: 0, False: 18]
  |  |  |  Branch (257:25): [True: 0, False: 18]
  |  |  ------------------
  |  |  258|     18|		return 0;                                       \
  |  |  259|     18|	ref->field = netsnmp_memdup(item, len * sizeof(type));  \
  |  |  260|     18|        if (ref->field == NULL)                                 \
  |  |  ------------------
  |  |  |  Branch (260:13): [True: 0, False: 18]
  |  |  ------------------
  |  |  261|     18|		return -1;                                      \
  |  |  262|     18|                                                                \
  |  |  263|     18|	ref->field_len = len;                                   \
  |  |  264|     18|	return 0;                                               \
  |  |  265|     18|} while (0)
  |  |  ------------------
  |  |  |  Branch (265:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  366|     18|               usr_engine_id, usr_engine_id_length);
  367|     18|}
snmpusm.c:usm_set_usmStateReference_sec_level:
  406|     18|{
  407|     18|    if (ref == NULL)
  ------------------
  |  Branch (407:9): [True: 0, False: 18]
  ------------------
  408|      0|        return -1;
  409|     18|    ref->usr_sec_level = sec_level;
  410|     18|    return 0;
  411|     18|}
snmpusm.c:usm_check_secLevel:
 2876|     17|{
 2877|       |
 2878|     17|    if (user->userStatus != RS_ACTIVE)
  ------------------
  |  |   35|     17|#define RS_ACTIVE	        1
  ------------------
  |  Branch (2878:9): [True: 0, False: 17]
  ------------------
 2879|      0|        return -1;
 2880|       |
 2881|     17|    DEBUGMSGTL(("comparex", "Comparing: %" NETSNMP_PRIo "u %" NETSNMP_PRIo "u ",
  ------------------
  |  |   66|     17|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     17|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 17]
  |  |  ------------------
  ------------------
 2882|     17|                usmNoPrivProtocol[0], usmNoPrivProtocol[1]));
 2883|     17|    DEBUGMSGOID(("comparex", usmNoPrivProtocol,
  ------------------
  |  |   67|     17|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     17|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 17]
  |  |  ------------------
  ------------------
 2884|     17|                 OID_LENGTH(usmNoPrivProtocol)));
 2885|     17|    DEBUGMSG(("comparex", "\n"));
  ------------------
  |  |   61|     17|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     17|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 17]
  |  |  ------------------
  ------------------
 2886|     17|    if (level == SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|     34|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2886:9): [True: 0, False: 17]
  ------------------
 2887|      0|        && (netsnmp_oid_equals(user->privProtocol, user->privProtocolLen,
  ------------------
  |  Branch (2887:12): [True: 0, False: 0]
  ------------------
 2888|      0|                             usmNoPrivProtocol,
 2889|      0|                             OID_LENGTH(usmNoPrivProtocol)) ==
  ------------------
  |  |   57|      0|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
 2890|      0|            0)) {
 2891|      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]
  |  |  ------------------
  ------------------
 2892|      0|        DEBUGMSGTL(("usm", "User (%s) Auth Protocol: ", user->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]
  |  |  ------------------
  ------------------
 2893|      0|        DEBUGMSGOID(("usm", user->authProtocol, user->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]
  |  |  ------------------
  ------------------
 2894|      0|        DEBUGMSG(("usm", ", User 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]
  |  |  ------------------
  ------------------
 2895|      0|        DEBUGMSGOID(("usm", user->privProtocol, user->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]
  |  |  ------------------
  ------------------
 2896|      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]
  |  |  ------------------
  ------------------
 2897|      0|        return 1;
 2898|      0|    }
 2899|     17|    if ((level == SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|     34|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2899:10): [True: 0, False: 17]
  ------------------
 2900|     17|         || level == SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|     17|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (2900:13): [True: 6, False: 11]
  ------------------
 2901|      6|        &&
 2902|      6|        (netsnmp_oid_equals
  ------------------
  |  Branch (2902:9): [True: 0, False: 6]
  ------------------
 2903|      6|         (user->authProtocol, user->authProtocolLen, usmNoAuthProtocol,
 2904|      6|          OID_LENGTH(usmNoAuthProtocol)) == 0)) {
  ------------------
  |  |   57|      6|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
 2905|      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]
  |  |  ------------------
  ------------------
 2906|      0|        DEBUGMSGTL(("usm", "User (%s) Auth Protocol: ", user->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]
  |  |  ------------------
  ------------------
 2907|      0|        DEBUGMSGOID(("usm", user->authProtocol, user->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]
  |  |  ------------------
  ------------------
 2908|      0|        DEBUGMSG(("usm", ", User 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]
  |  |  ------------------
  ------------------
 2909|      0|        DEBUGMSGOID(("usm", user->privProtocol, user->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]
  |  |  ------------------
  ------------------
 2910|      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]
  |  |  ------------------
  ------------------
 2911|      0|        return 1;
 2912|      0|    }
 2913|       |
 2914|     17|    return 0;
 2915|     17|}                               /* end usm_check_secLevel() */
snmpusm.c:usm_set_usmStateReference_auth_protocol:
  373|     11|{
  374|       |    MAKE_ENTRY(ref, oid, auth_protocol, auth_protocol_len,
  ------------------
  |  |  248|     11|#define MAKE_ENTRY(ref, type, item, len, field, field_len)      \
  |  |  249|     11|do {                                                            \
  |  |  250|     11|	if (ref == NULL)                                        \
  |  |  ------------------
  |  |  |  Branch (250:6): [True: 0, False: 11]
  |  |  ------------------
  |  |  251|     11|		return -1;                                      \
  |  |  252|     11|	if (ref->field != NULL)	{                               \
  |  |  ------------------
  |  |  |  Branch (252:6): [True: 0, False: 11]
  |  |  ------------------
  |  |  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|     11|	ref->field_len = 0;                                     \
  |  |  257|     11|        if (len == 0 || item == NULL)                           \
  |  |  ------------------
  |  |  |  Branch (257:13): [True: 0, False: 11]
  |  |  |  Branch (257:25): [True: 0, False: 11]
  |  |  ------------------
  |  |  258|     11|		return 0;                                       \
  |  |  259|     11|	ref->field = netsnmp_memdup(item, len * sizeof(type));  \
  |  |  260|     11|        if (ref->field == NULL)                                 \
  |  |  ------------------
  |  |  |  Branch (260:13): [True: 0, False: 11]
  |  |  ------------------
  |  |  261|     11|		return -1;                                      \
  |  |  262|     11|                                                                \
  |  |  263|     11|	ref->field_len = len;                                   \
  |  |  264|     11|	return 0;                                               \
  |  |  265|     11|} while (0)
  |  |  ------------------
  |  |  |  Branch (265:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  375|     11|               usr_auth_protocol, usr_auth_protocol_length);
  376|     11|}
snmpusm.c:usm_set_usmStateReference_auth_key:
  381|     11|{
  382|       |    MAKE_ENTRY(ref, u_char, auth_key, auth_key_len,
  ------------------
  |  |  248|     11|#define MAKE_ENTRY(ref, type, item, len, field, field_len)      \
  |  |  249|     11|do {                                                            \
  |  |  250|     11|	if (ref == NULL)                                        \
  |  |  ------------------
  |  |  |  Branch (250:6): [True: 0, False: 11]
  |  |  ------------------
  |  |  251|     11|		return -1;                                      \
  |  |  252|     11|	if (ref->field != NULL)	{                               \
  |  |  ------------------
  |  |  |  Branch (252:6): [True: 0, False: 11]
  |  |  ------------------
  |  |  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|     11|	ref->field_len = 0;                                     \
  |  |  257|     11|        if (len == 0 || item == NULL)                           \
  |  |  ------------------
  |  |  |  Branch (257:13): [True: 11, False: 0]
  |  |  |  Branch (257:25): [True: 0, False: 0]
  |  |  ------------------
  |  |  258|     11|		return 0;                                       \
  |  |  259|     11|	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]
  |  |  ------------------
  ------------------
  383|     11|               usr_auth_key, usr_auth_key_length);
  384|     11|}
snmpusm.c:usm_set_usmStateReference_priv_protocol:
  390|     11|{
  391|       |    MAKE_ENTRY(ref, oid, priv_protocol, priv_protocol_len,
  ------------------
  |  |  248|     11|#define MAKE_ENTRY(ref, type, item, len, field, field_len)      \
  |  |  249|     11|do {                                                            \
  |  |  250|     11|	if (ref == NULL)                                        \
  |  |  ------------------
  |  |  |  Branch (250:6): [True: 0, False: 11]
  |  |  ------------------
  |  |  251|     11|		return -1;                                      \
  |  |  252|     11|	if (ref->field != NULL)	{                               \
  |  |  ------------------
  |  |  |  Branch (252:6): [True: 0, False: 11]
  |  |  ------------------
  |  |  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|     11|	ref->field_len = 0;                                     \
  |  |  257|     11|        if (len == 0 || item == NULL)                           \
  |  |  ------------------
  |  |  |  Branch (257:13): [True: 0, False: 11]
  |  |  |  Branch (257:25): [True: 0, False: 11]
  |  |  ------------------
  |  |  258|     11|		return 0;                                       \
  |  |  259|     11|	ref->field = netsnmp_memdup(item, len * sizeof(type));  \
  |  |  260|     11|        if (ref->field == NULL)                                 \
  |  |  ------------------
  |  |  |  Branch (260:13): [True: 0, False: 11]
  |  |  ------------------
  |  |  261|     11|		return -1;                                      \
  |  |  262|     11|                                                                \
  |  |  263|     11|	ref->field_len = len;                                   \
  |  |  264|     11|	return 0;                                               \
  |  |  265|     11|} while (0)
  |  |  ------------------
  |  |  |  Branch (265:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  392|     11|               usr_priv_protocol, usr_priv_protocol_length);
  393|     11|}
snmpusm.c:usm_set_usmStateReference_priv_key:
  398|     11|{
  399|       |    MAKE_ENTRY(ref, u_char, priv_key, priv_key_len,
  ------------------
  |  |  248|     11|#define MAKE_ENTRY(ref, type, item, len, field, field_len)      \
  |  |  249|     11|do {                                                            \
  |  |  250|     11|	if (ref == NULL)                                        \
  |  |  ------------------
  |  |  |  Branch (250:6): [True: 0, False: 11]
  |  |  ------------------
  |  |  251|     11|		return -1;                                      \
  |  |  252|     11|	if (ref->field != NULL)	{                               \
  |  |  ------------------
  |  |  |  Branch (252:6): [True: 0, False: 11]
  |  |  ------------------
  |  |  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|     11|	ref->field_len = 0;                                     \
  |  |  257|     11|        if (len == 0 || item == NULL)                           \
  |  |  ------------------
  |  |  |  Branch (257:13): [True: 11, False: 0]
  |  |  |  Branch (257:25): [True: 0, False: 0]
  |  |  ------------------
  |  |  258|     11|		return 0;                                       \
  |  |  259|     11|	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]
  |  |  ------------------
  ------------------
  400|     11|               usr_priv_key, usr_priv_key_length);
  401|     11|}
snmpusm.c:usm_clone:
  300|      3|{
  301|      3|    struct usmStateReference *ref = pdu->securityStateRef;
  302|      3|    struct usmStateReference **new_ref =
  303|      3|        (struct usmStateReference **)&new_pdu->securityStateRef;
  304|      3|    int ret = 0;
  305|       |
  306|      3|    if (!ref)
  ------------------
  |  Branch (306:9): [True: 3, False: 0]
  ------------------
  307|      3|        return ret;
  308|       |
  309|      0|    if (pdu->command == SNMP_MSG_TRAP2) {
  ------------------
  |  |  142|      0|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   85|      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|      3|}
snmpusm.c:usm_free_usmStateReference:
  321|     64|{
  322|     64|    struct usmStateReference *ref = old;
  323|       |
  324|     64|    if (!ref)
  ------------------
  |  Branch (324:9): [True: 39, False: 25]
  ------------------
  325|     39|        return;
  326|       |
  327|     25|    if (--ref->refcnt > 0)
  ------------------
  |  Branch (327:9): [True: 0, False: 25]
  ------------------
  328|      0|        return;
  329|       |
  330|     25|    SNMP_FREE(ref->usr_name);
  ------------------
  |  |   62|     25|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 25]
  |  |  |  Branch (62:66): [Folded, False: 25]
  |  |  ------------------
  ------------------
  331|     25|    SNMP_FREE(ref->usr_engine_id);
  ------------------
  |  |   62|     25|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 18, False: 7]
  |  |  |  Branch (62:66): [Folded, False: 25]
  |  |  ------------------
  ------------------
  332|     25|    SNMP_FREE(ref->usr_auth_protocol);
  ------------------
  |  |   62|     25|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 11, False: 14]
  |  |  |  Branch (62:66): [Folded, False: 25]
  |  |  ------------------
  ------------------
  333|     25|    SNMP_FREE(ref->usr_priv_protocol);
  ------------------
  |  |   62|     25|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 11, False: 14]
  |  |  |  Branch (62:66): [Folded, False: 25]
  |  |  ------------------
  ------------------
  334|       |
  335|     25|    if (ref->usr_auth_key_length && ref->usr_auth_key) {
  ------------------
  |  Branch (335:9): [True: 0, False: 25]
  |  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|     25|    if (ref->usr_priv_key_length && ref->usr_priv_key) {
  ------------------
  |  Branch (339:9): [True: 0, False: 25]
  |  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|     25|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 25, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 25]
  |  |  ------------------
  ------------------
  345|     25|}                               /* end usm_free_usmStateReference() */
snmpusm.c:usm_session_init:
 3466|     66|{
 3467|     66|    char *cp;
 3468|     66|    size_t i;
 3469|       |    
 3470|     66|    if (in_session->securityAuthProtoLen > 0) {
  ------------------
  |  Branch (3470:9): [True: 0, False: 66]
  ------------------
 3471|      0|        session->securityAuthProto =
 3472|      0|            snmp_duplicate_objid(in_session->securityAuthProto,
 3473|      0|                                 in_session->securityAuthProtoLen);
 3474|      0|        if (session->securityAuthProto == NULL) {
  ------------------
  |  Branch (3474:13): [True: 0, False: 0]
  ------------------
 3475|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3476|      0|            return SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3477|      0|        }
 3478|     66|    } else if (get_default_authtype(&i) != NULL) {
  ------------------
  |  Branch (3478:16): [True: 66, False: 0]
  ------------------
 3479|     66|        session->securityAuthProto =
 3480|     66|            snmp_duplicate_objid(get_default_authtype(NULL), i);
 3481|     66|        session->securityAuthProtoLen = i;
 3482|     66|    }
 3483|       |
 3484|     66|    if (in_session->securityPrivProtoLen > 0) {
  ------------------
  |  Branch (3484:9): [True: 0, False: 66]
  ------------------
 3485|      0|        session->securityPrivProto =
 3486|      0|            snmp_duplicate_objid(in_session->securityPrivProto,
 3487|      0|                                 in_session->securityPrivProtoLen);
 3488|      0|        if (session->securityPrivProto == NULL) {
  ------------------
  |  Branch (3488:13): [True: 0, False: 0]
  ------------------
 3489|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3490|      0|            return SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3491|      0|        }
 3492|     66|    } else if (get_default_privtype(&i) != NULL) {
  ------------------
  |  Branch (3492:16): [True: 66, False: 0]
  ------------------
 3493|     66|        session->securityPrivProto =
 3494|     66|            snmp_duplicate_objid(get_default_privtype(NULL), i);
 3495|     66|        session->securityPrivProtoLen = i;
 3496|     66|    }
 3497|       |
 3498|     66|    if ((in_session->securityAuthKeyLen <= 0) &&
  ------------------
  |  Branch (3498:9): [True: 66, False: 0]
  ------------------
 3499|     66|        ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3499:9): [True: 0, False: 66]
  ------------------
 3500|     66|				     NETSNMP_DS_LIB_AUTHMASTERKEY)))) {
  ------------------
  |  |  167|     66|#define NETSNMP_DS_LIB_AUTHMASTERKEY     16
  ------------------
 3501|      0|        size_t buflen = sizeof(session->securityAuthKey);
 3502|      0|        u_char *tmpp = session->securityAuthKey;
 3503|      0|        session->securityAuthKeyLen = 0;
 3504|       |        /* it will be a hex string */
 3505|      0|        if (!snmp_hex_to_binary(&tmpp, &buflen,
  ------------------
  |  Branch (3505:13): [True: 0, False: 0]
  ------------------
 3506|      0|                                &session->securityAuthKeyLen, 0, cp)) {
 3507|      0|            snmp_set_detail("error parsing authentication master key");
 3508|      0|            return SNMP_ERR_GENERR;
  ------------------
  |  |  217|      0|#define SNMP_ERR_GENERR	                (5)
  ------------------
 3509|      0|        }
 3510|     66|    } else if ((in_session->securityAuthKeyLen <= 0) &&
  ------------------
  |  Branch (3510:16): [True: 66, False: 0]
  ------------------
 3511|     66|               ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3511:17): [True: 0, False: 66]
  ------------------
 3512|     66|                                            NETSNMP_DS_LIB_AUTHPASSPHRASE)) ||
  ------------------
  |  |  154|     66|#define NETSNMP_DS_LIB_AUTHPASSPHRASE    3
  ------------------
 3513|     66|                (cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3513:17): [True: 0, False: 66]
  ------------------
 3514|     66|                                            NETSNMP_DS_LIB_PASSPHRASE)))) {
  ------------------
  |  |  153|     66|#define NETSNMP_DS_LIB_PASSPHRASE        2
  ------------------
 3515|      0|        session->securityAuthKeyLen = USM_AUTH_KU_LEN;
  ------------------
  |  |  271|      0|#define USM_AUTH_KU_LEN     64
  ------------------
 3516|      0|        if (generate_Ku(session->securityAuthProto,
  ------------------
  |  Branch (3516:13): [True: 0, False: 0]
  ------------------
 3517|      0|                        session->securityAuthProtoLen,
 3518|      0|                        (u_char *) cp, strlen(cp),
 3519|      0|                        session->securityAuthKey,
 3520|      0|                        &session->securityAuthKeyLen) != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3521|      0|            snmp_set_detail
 3522|      0|                ("Error generating a key (Ku) from the supplied authentication pass phrase.");
 3523|      0|            return SNMP_ERR_GENERR;
  ------------------
  |  |  217|      0|#define SNMP_ERR_GENERR	                (5)
  ------------------
 3524|      0|        }
 3525|      0|    }
 3526|       |
 3527|       |    
 3528|     66|    if ((in_session->securityPrivKeyLen <= 0) &&
  ------------------
  |  Branch (3528:9): [True: 66, False: 0]
  ------------------
 3529|     66|        ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3529:9): [True: 0, False: 66]
  ------------------
 3530|     66|				     NETSNMP_DS_LIB_PRIVMASTERKEY)))) {
  ------------------
  |  |  168|     66|#define NETSNMP_DS_LIB_PRIVMASTERKEY     17
  ------------------
 3531|      0|        size_t buflen = sizeof(session->securityPrivKey);
 3532|      0|        u_char *tmpp = session->securityPrivKey;
 3533|      0|        session->securityPrivKeyLen = 0;
 3534|       |        /* it will be a hex string */
 3535|      0|        if (!snmp_hex_to_binary(&tmpp, &buflen,
  ------------------
  |  Branch (3535:13): [True: 0, False: 0]
  ------------------
 3536|      0|                                &session->securityPrivKeyLen, 0, cp)) {
 3537|      0|            snmp_set_detail("error parsing encryption master key");
 3538|      0|            return SNMP_ERR_GENERR;
  ------------------
  |  |  217|      0|#define SNMP_ERR_GENERR	                (5)
  ------------------
 3539|      0|        }
 3540|     66|    } else if ((in_session->securityPrivKeyLen <= 0) &&
  ------------------
  |  Branch (3540:16): [True: 66, False: 0]
  ------------------
 3541|     66|               ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3541:17): [True: 0, False: 66]
  ------------------
 3542|     66|                                            NETSNMP_DS_LIB_PRIVPASSPHRASE)) ||
  ------------------
  |  |  155|     66|#define NETSNMP_DS_LIB_PRIVPASSPHRASE    4
  ------------------
 3543|     66|                (cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3543:17): [True: 0, False: 66]
  ------------------
 3544|     66|                                            NETSNMP_DS_LIB_PASSPHRASE)))) {
  ------------------
  |  |  153|     66|#define NETSNMP_DS_LIB_PASSPHRASE        2
  ------------------
 3545|      0|        session->securityPrivKeyLen = USM_PRIV_KU_LEN;
  ------------------
  |  |  272|      0|#define USM_PRIV_KU_LEN     64
  ------------------
 3546|      0|        if (generate_Ku(session->securityAuthProto,
  ------------------
  |  Branch (3546:13): [True: 0, False: 0]
  ------------------
 3547|      0|                        session->securityAuthProtoLen,
 3548|      0|                        (u_char *) cp, strlen(cp),
 3549|      0|                        session->securityPrivKey,
 3550|      0|                        &session->securityPrivKeyLen) != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3551|      0|            snmp_set_detail
 3552|      0|                ("Error generating a key (Ku) from the supplied privacy pass phrase.");
 3553|      0|            return SNMP_ERR_GENERR;
  ------------------
  |  |  217|      0|#define SNMP_ERR_GENERR	                (5)
  ------------------
 3554|      0|        }
 3555|      0|    }
 3556|       |
 3557|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3558|     66|}
snmpusm.c:usm_handle_report:
 3386|     25|{
 3387|       |    /*
 3388|       |     * handle reportable errors 
 3389|       |     */
 3390|       |
 3391|       |    /* this will get in our way */
 3392|     25|    usm_free_usmStateReference(pdu->securityStateRef);
 3393|     25|    pdu->securityStateRef = NULL;
 3394|       |
 3395|     25|    switch (result) {
  ------------------
  |  Branch (3395:13): [True: 8, False: 17]
  ------------------
 3396|      6|    case SNMPERR_USM_AUTHENTICATIONFAILURE:
  ------------------
  |  |  230|      6|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
  |  Branch (3396:5): [True: 6, False: 19]
  ------------------
 3397|      6|    {
 3398|      6|        int res = session->s_snmp_errno;
 3399|      6|        session->s_snmp_errno = result;
 3400|      6|        if (session->callback) {
  ------------------
  |  Branch (3400:13): [True: 6, False: 0]
  ------------------
 3401|      6|            session->callback(NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE,
  ------------------
  |  |  319|      6|#define NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE	1
  ------------------
 3402|      6|                              session, pdu->reqid, pdu,
 3403|      6|                              session->callback_magic);
 3404|      6|        }
 3405|      6|        session->s_snmp_errno = res;
 3406|      6|    }  
 3407|      6|    NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2449|      6|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 3408|      7|    case SNMPERR_USM_UNKNOWNENGINEID:
  ------------------
  |  |  232|      7|#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
  ------------------
  |  Branch (3408:5): [True: 1, False: 24]
  ------------------
 3409|      7|    case SNMPERR_USM_UNKNOWNSECURITYNAME:
  ------------------
  |  |  227|      7|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (3409:5): [True: 0, False: 25]
  ------------------
 3410|      7|    case SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL:
  ------------------
  |  |  228|      7|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
  |  Branch (3410:5): [True: 0, False: 25]
  ------------------
 3411|      7|    case SNMPERR_USM_NOTINTIMEWINDOW:
  ------------------
  |  |  233|      7|#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
  ------------------
  |  Branch (3411:5): [True: 0, False: 25]
  ------------------
 3412|      8|    case SNMPERR_USM_DECRYPTIONERROR:
  ------------------
  |  |  234|      8|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
  |  Branch (3412:5): [True: 1, False: 24]
  ------------------
 3413|       |
 3414|      8|        if (SNMP_CMD_CONFIRMED(pdu->command) ||
  ------------------
  |  |  193|     16|#define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
  |  |  ------------------
  |  |  |  |  141|     16|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|      8|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|      8|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
  |  |  ------------------
  |  |  |  |  140|     15|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|      7|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|      7|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (193:32): [True: 1, False: 7]
  |  |  |  Branch (193:56): [True: 0, False: 7]
  |  |  ------------------
  |  |  194|      8|                               c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
  |  |  ------------------
  |  |  |  |  126|     15|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|      7|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|      7|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                              c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
  |  |  ------------------
  |  |  |  |  125|     15|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|      7|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|      7|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (194:32): [True: 0, False: 7]
  |  |  |  Branch (194:57): [True: 0, False: 7]
  |  |  ------------------
  |  |  195|     16|                               c == SNMP_MSG_SET )
  |  |  ------------------
  |  |  |  |  129|     15|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|      7|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|      7|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (195:32): [True: 0, False: 7]
  |  |  ------------------
  ------------------
 3415|      7|            (pdu->command == 0
  ------------------
  |  Branch (3415:14): [True: 7, False: 0]
  ------------------
 3416|      7|             && (pdu->flags & SNMP_MSG_FLAG_RPRT_BIT))) {
  ------------------
  |  |  305|      7|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3416:17): [True: 2, False: 5]
  ------------------
 3417|      3|            netsnmp_pdu    *pdu2;
 3418|      3|            int             flags = pdu->flags;
 3419|       |
 3420|      3|            pdu->flags |= UCD_MSG_FLAG_FORCE_PDU_COPY;
  ------------------
  |  |  313|      3|#define UCD_MSG_FLAG_FORCE_PDU_COPY          0x400
  ------------------
 3421|      3|            pdu2 = snmp_clone_pdu(pdu);
 3422|      3|            pdu->flags = flags;
 3423|      3|            if (pdu2 == NULL)
  ------------------
  |  Branch (3423:17): [True: 0, False: 3]
  ------------------
 3424|      0|                break;
 3425|      3|            pdu2->flags = flags;
 3426|      3|            snmpv3_make_report(pdu2, result);
 3427|      3|            if (0 == snmp_sess_send(slp, pdu2)) {
  ------------------
  |  Branch (3427:17): [True: 0, False: 3]
  ------------------
 3428|      0|                snmp_free_pdu(pdu2);
 3429|       |                /*
 3430|       |                 * TODO: indicate error 
 3431|       |                 */
 3432|      0|            }
 3433|      3|        }
 3434|      8|        break;
 3435|     25|    }       
 3436|     25|}
snmpusm.c:init_usm_post_config:
 5208|     66|{
 5209|     66|    size_t          salt_integer_len = sizeof(salt_integer);
 5210|     66|    uint64_t        current_time;
 5211|       |
 5212|     66|    if (sc_random((u_char *) & salt_integer, &salt_integer_len) !=
  ------------------
  |  Branch (5212:9): [True: 0, False: 66]
  ------------------
 5213|     66|        SNMPERR_SUCCESS) {
  ------------------
  |  |  184|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5214|      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]
  |  |  ------------------
  ------------------
 5215|      0|        current_time = time(NULL);
 5216|      0|        salt_integer = current_time;
 5217|      0|    }
 5218|       |
 5219|     66|#ifdef HAVE_AES
 5220|     66|    salt_integer_len = sizeof (salt_integer64_1);
 5221|     66|    if (sc_random((u_char *) & salt_integer64_1, &salt_integer_len) !=
  ------------------
  |  Branch (5221:9): [True: 0, False: 66]
  ------------------
 5222|     66|        SNMPERR_SUCCESS) {
  ------------------
  |  |  184|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5223|      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]
  |  |  ------------------
  ------------------
 5224|      0|        current_time = time(NULL);
 5225|      0|        salt_integer64_1 = current_time;
 5226|      0|    }
 5227|     66|    salt_integer_len = sizeof (salt_integer64_1);
 5228|     66|    if (sc_random((u_char *) & salt_integer64_2, &salt_integer_len) !=
  ------------------
  |  Branch (5228:9): [True: 0, False: 66]
  ------------------
 5229|     66|        SNMPERR_SUCCESS) {
  ------------------
  |  |  184|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5230|      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]
  |  |  ------------------
  ------------------
 5231|      0|        current_time = time(NULL);
 5232|      0|        salt_integer64_2 = current_time;
 5233|      0|    }
 5234|     66|#endif
 5235|       |
 5236|       |    // Free noNameUser before it is assigned
 5237|     66|    usm_free_user(noNameUser);
 5238|       |
 5239|     66|#ifndef NETSNMP_DISABLE_MD5
 5240|     66|    noNameUser = usm_create_initial_user("", usmHMACMD5AuthProtocol,
 5241|     66|                                         OID_LENGTH(usmHMACMD5AuthProtocol),
  ------------------
  |  |   57|     66|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
 5242|     66|                                         SNMP_DEFAULT_PRIV_PROTO,
  ------------------
  |  |  100|     66|#define SNMP_DEFAULT_PRIV_PROTO     usmDESPrivProtocol
  ------------------
 5243|     66|                                         SNMP_DEFAULT_PRIV_PROTOLEN);
  ------------------
  |  |  104|     66|#define SNMP_DEFAULT_PRIV_PROTOLEN  OID_LENGTH(SNMP_DEFAULT_PRIV_PROTO)
  |  |  ------------------
  |  |  |  |   57|     66|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  |  |  ------------------
  ------------------
 5244|       |#else
 5245|       |    noNameUser = usm_create_initial_user("", usmHMACSHA1AuthProtocol,
 5246|       |                                         OID_LENGTH(usmHMACSHA1AuthProtocol),
 5247|       |                                         SNMP_DEFAULT_PRIV_PROTO,
 5248|       |                                         SNMP_DEFAULT_PRIV_PROTOLEN);
 5249|       |#endif
 5250|       |
 5251|     66|    if ( noNameUser ) {
  ------------------
  |  Branch (5251:10): [True: 66, False: 0]
  ------------------
 5252|     66|        SNMP_FREE(noNameUser->engineID);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 5253|     66|        noNameUser->engineIDLen = 0;
 5254|     66|    }
 5255|       |
 5256|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5257|     66|}                               /* end init_usm_post_config() */
snmpusm.c:usm_create_initial_user:
 4205|     66|{
 4206|     66|    struct usmUser *newUser = usm_create_user();
 4207|     66|    if (newUser == NULL)
  ------------------
  |  Branch (4207:9): [True: 0, False: 66]
  ------------------
 4208|      0|        return NULL;
 4209|       |
 4210|     66|    if ((newUser->name = strdup(name)) == NULL)
  ------------------
  |  Branch (4210:9): [True: 0, False: 66]
  ------------------
 4211|      0|        return usm_free_user(newUser);
 4212|       |
 4213|     66|    if ((newUser->secName = strdup(name)) == NULL)
  ------------------
  |  Branch (4213:9): [True: 0, False: 66]
  ------------------
 4214|      0|        return usm_free_user(newUser);
 4215|       |
 4216|     66|    if ((newUser->engineID =
  ------------------
  |  Branch (4216:9): [True: 0, False: 66]
  ------------------
 4217|     66|         snmpv3_generate_engineID(&newUser->engineIDLen)) == NULL)
 4218|      0|        return usm_free_user(newUser);
 4219|       |
 4220|     66|    if ((newUser->cloneFrom = (oid *) malloc(sizeof(oid) * 2)) == NULL)
  ------------------
  |  Branch (4220:9): [True: 0, False: 66]
  ------------------
 4221|      0|        return usm_free_user(newUser);
 4222|     66|    newUser->cloneFrom[0] = 0;
 4223|     66|    newUser->cloneFrom[1] = 0;
 4224|     66|    newUser->cloneFromLen = 2;
 4225|       |
 4226|     66|    SNMP_FREE(newUser->privProtocol);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 4227|     66|    if ((newUser->privProtocol = snmp_duplicate_objid(privProtocol,
  ------------------
  |  Branch (4227:9): [True: 0, False: 66]
  ------------------
 4228|     66|                                                      privProtocolLen)) ==
 4229|     66|        NULL) {
 4230|      0|        return usm_free_user(newUser);
 4231|      0|    }
 4232|     66|    newUser->privProtocolLen = privProtocolLen;
 4233|       |
 4234|     66|    SNMP_FREE(newUser->authProtocol);
  ------------------
  |  |   62|     66|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 66, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 66]
  |  |  ------------------
  ------------------
 4235|     66|    if ((newUser->authProtocol = snmp_duplicate_objid(authProtocol,
  ------------------
  |  Branch (4235:9): [True: 0, False: 66]
  ------------------
 4236|     66|                                                      authProtocolLen)) ==
 4237|     66|        NULL) {
 4238|      0|        return usm_free_user(newUser);
 4239|      0|    }
 4240|     66|    newUser->authProtocolLen = authProtocolLen;
 4241|       |
 4242|     66|    newUser->userStatus = RS_ACTIVE;
  ------------------
  |  |   35|     66|#define RS_ACTIVE	        1
  ------------------
 4243|     66|    newUser->userStorageType = ST_READONLY;
  ------------------
  |  |   54|     66|#define ST_READONLY	5
  ------------------
 4244|       |
 4245|     66|    return newUser;
 4246|     66|}
snmpusm.c:deinit_usm_post_config:
 5262|     66|{
 5263|     66|    usm_free_user(noNameUser);
 5264|     66|    noNameUser = NULL;
 5265|       |
 5266|     66|    DEBUGMSGTL(("deinit_usm_post_config", "initial user removed\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 5267|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5268|     66|}                               /* end deinit_usm_post_config() */
snmpusm.c:free_enginetime_on_shutdown:
  274|     66|{
  275|     66|    u_char engineID[SNMP_MAX_ENG_SIZE];
  276|     66|    size_t engineID_len = sizeof(engineID);
  277|       |
  278|     66|    DEBUGMSGTL(("snmpv3", "free enginetime callback called\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  279|       |
  280|     66|    engineID_len = snmpv3_get_engineID(engineID, engineID_len);
  281|     66|    if (engineID_len > 0)
  ------------------
  |  Branch (281:9): [True: 0, False: 66]
  ------------------
  282|      0|	free_enginetime(engineID, engineID_len);
  283|     66|    return 0;
  284|     66|}
snmpusm.c:clear_user_list:
 4053|     66|{
 4054|     66|    struct usmUser *tmp = userList, *next = NULL;
 4055|       |
 4056|     66|    while (tmp != NULL) {
  ------------------
  |  Branch (4056:12): [True: 0, False: 66]
  ------------------
 4057|      0|	next = tmp->next;
 4058|      0|	usm_free_user(tmp);
 4059|      0|	tmp = next;
 4060|      0|    }
 4061|     66|    userList = NULL;
 4062|       |
 4063|     66|}

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

netsnmp_gethostbyname_v4:
  773|     66|{
  774|     66|#ifdef HAVE_GETADDRINFO
  775|     66|    struct addrinfo *addrs = NULL;
  776|     66|    struct addrinfo hint;
  777|     66|    int             err;
  778|       |
  779|     66|    memset(&hint, 0, sizeof hint);
  780|     66|    hint.ai_flags = 0;
  781|     66|    hint.ai_family = PF_INET;
  782|     66|    hint.ai_socktype = SOCK_DGRAM;
  783|     66|    hint.ai_protocol = 0;
  784|       |
  785|     66|    err = netsnmp_getaddrinfo(name, NULL, &hint, &addrs);
  786|     66|    if (err != 0) {
  ------------------
  |  Branch (786:9): [True: 0, False: 66]
  ------------------
  787|      0|        return -1;
  788|      0|    }
  789|       |
  790|     66|    if (addrs != NULL) {
  ------------------
  |  Branch (790:9): [True: 66, False: 0]
  ------------------
  791|     66|        memcpy(addr_out,
  792|     66|               &((struct sockaddr_in *) addrs->ai_addr)->sin_addr,
  793|     66|               sizeof(in_addr_t));
  794|     66|        freeaddrinfo(addrs);
  795|     66|    } else {
  796|      0|        DEBUGMSGTL(("get_thisaddr",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  797|      0|                    "Failed to resolve IPv4 hostname\n"));
  798|      0|        return -1;
  799|      0|    }
  800|     66|    return 0;
  801|       |
  802|       |#elif defined(HAVE_GETHOSTBYNAME)
  803|       |    struct hostent *hp = NULL;
  804|       |
  805|       |    hp = netsnmp_gethostbyname(name);
  806|       |    if (hp == NULL) {
  807|       |        DEBUGMSGTL(("get_thisaddr",
  808|       |                    "hostname (couldn't resolve)\n"));
  809|       |        return -1;
  810|       |    } else if (hp->h_addrtype != AF_INET) {
  811|       |        DEBUGMSGTL(("get_thisaddr",
  812|       |                    "hostname (not AF_INET!)\n"));
  813|       |        return -1;
  814|       |    } else {
  815|       |        DEBUGMSGTL(("get_thisaddr",
  816|       |                    "hostname (resolved okay)\n"));
  817|       |        memcpy(addr_out, hp->h_addr, sizeof(in_addr_t));
  818|       |    }
  819|       |    return 0;
  820|       |
  821|       |#elif defined(HAVE_GETIPNODEBYNAME)
  822|       |    struct hostent *hp = NULL;
  823|       |    int             err;
  824|       |
  825|       |    hp = getipnodebyname(peername, AF_INET, 0, &err);
  826|       |    if (hp == NULL) {
  827|       |        DEBUGMSGTL(("get_thisaddr",
  828|       |                    "hostname (couldn't resolve = %d)\n", err));
  829|       |        return -1;
  830|       |    }
  831|       |    DEBUGMSGTL(("get_thisaddr",
  832|       |                "hostname (resolved okay)\n"));
  833|       |    memcpy(addr_out, hp->h_addr, sizeof(in_addr_t));
  834|       |    return 0;
  835|       |
  836|       |#else /* HAVE_GETIPNODEBYNAME */
  837|       |    return -1;
  838|       |#endif
  839|     66|}
netsnmp_getaddrinfo:
  844|     66|{
  845|     66|#ifdef HAVE_GETADDRINFO
  846|     66|    struct addrinfo *addrs = NULL;
  847|     66|    struct addrinfo hint;
  848|     66|    int             err;
  849|       |#ifdef DNSSEC_LOCAL_VALIDATION
  850|       |    val_status_t    val_status;
  851|       |#endif
  852|       |
  853|     66|    DEBUGMSGTL(("dns:getaddrinfo", "looking up "));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  854|     66|    if (name)
  ------------------
  |  Branch (854:9): [True: 66, False: 0]
  ------------------
  855|     66|        DEBUGMSG(("dns:getaddrinfo", "\"%s\"", name));
  ------------------
  |  |   61|     66|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 66]
  |  |  ------------------
  ------------------
  856|      0|    else
  857|      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]
  |  |  ------------------
  ------------------
  858|       |
  859|     66|    if (service)
  ------------------
  |  Branch (859:9): [True: 0, False: 66]
  ------------------
  860|      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]
  |  |  ------------------
  ------------------
  861|       |
  862|     66|    if (hints)
  ------------------
  |  Branch (862:9): [True: 66, False: 0]
  ------------------
  863|     66|	DEBUGMSG(("dns:getaddrinfo",
  ------------------
  |  |   61|     66|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:56): [True: 0, False: 0]
  |  |  |  Branch (61:56): [True: 0, False: 0]
  |  |  |  Branch (61:56): [True: 0, False: 0]
  |  |  |  Branch (61:67): [Folded, False: 66]
  |  |  ------------------
  ------------------
  864|     66|                  " with hints ({.ai_flags = %#x, .ai_family = %s})",
  865|     66|                  hints->ai_flags, hints->ai_family == 0 ? "0" :
  866|     66|                  hints->ai_family == AF_INET ? "AF_INET" :
  867|     66|                  hints->ai_family == AF_INET6 ? "AF_INET6" : "?"));
  868|      0|    else
  869|      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]
  |  |  ------------------
  ------------------
  870|       |
  871|     66|    DEBUGMSG(("dns:getaddrinfo", "\n"));
  ------------------
  |  |   61|     66|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 66]
  |  |  ------------------
  ------------------
  872|       |
  873|     66|    if (NULL == hints) {
  ------------------
  |  Branch (873:9): [True: 0, False: 66]
  ------------------
  874|      0|        memset(&hint, 0, sizeof hint);
  875|      0|        hint.ai_flags = 0;
  876|      0|        hint.ai_family = PF_INET;
  877|      0|        hint.ai_socktype = SOCK_DGRAM;
  878|      0|        hint.ai_protocol = 0;
  879|      0|        hints = &hint;
  880|     66|    } else {
  881|     66|        memcpy(&hint, hints, sizeof hint);
  882|     66|    }
  883|       |
  884|     66|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  885|       |    /*
  886|       |     * Fuzz targets must not perform network I/O. Without network access,
  887|       |     * DNS queries block until they time out. Hence, only allow lookups
  888|       |     * that can be resolved without querying a DNS server.
  889|       |     */
  890|     66|    if (name && strcmp(name, "localhost") != 0)
  ------------------
  |  Branch (890:9): [True: 66, False: 0]
  |  Branch (890:17): [True: 66, False: 0]
  ------------------
  891|     66|        hint.ai_flags |= AI_NUMERICHOST;
  892|     66|#endif
  893|       |
  894|     66|#ifndef DNSSEC_LOCAL_VALIDATION
  895|     66|    err = getaddrinfo(name, NULL, &hint, &addrs);
  896|       |#else /* DNSSEC_LOCAL_VALIDATION */
  897|       |    err = val_getaddrinfo(netsnmp_validator_context(), name, NULL, &hint,
  898|       |                          &addrs, &val_status);
  899|       |    DEBUGMSGTL(("dns:sec:val", "err %d, val_status %d / %s; trusted: %d\n",
  900|       |                err, val_status, p_val_status(val_status),
  901|       |                val_istrusted(val_status)));
  902|       |    if (! val_istrusted(val_status)) {
  903|       |        int rc;
  904|       |        if ((err != 0) && VAL_GETADDRINFO_HAS_STATUS(err)) {
  905|       |            snmp_log(LOG_WARNING,
  906|       |                     "WARNING: UNTRUSTED error in DNS resolution for %s!\n",
  907|       |                     name);
  908|       |            rc = EAI_FAIL;
  909|       |        } else {
  910|       |            snmp_log(LOG_WARNING,
  911|       |                     "The authenticity of DNS response is not trusted (%s)\n",
  912|       |                     p_val_status(val_status));
  913|       |            rc = EAI_NONAME;
  914|       |        }
  915|       |        /** continue anyways if DNSSEC_WARN_ONLY is set */
  916|       |        if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
  917|       |                                    NETSNMP_DS_LIB_DNSSEC_WARN_ONLY))
  918|       |            return rc;
  919|       |    }
  920|       |
  921|       |
  922|       |#endif /* DNSSEC_LOCAL_VALIDATION */
  923|     66|    *res = addrs;
  924|     66|    DEBUGIF("dns:getaddrinfo") {
  ------------------
  |  |  145|     66|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|    132|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  925|      0|        if (err == 0 && addrs && addrs->ai_addr) {
  ------------------
  |  Branch (925:13): [True: 0, False: 0]
  |  Branch (925:25): [True: 0, False: 0]
  |  Branch (925:34): [True: 0, False: 0]
  ------------------
  926|      0|            const char *fam = "?";
  927|      0|            char dst[64] = "?";
  928|      0|            uint16_t port = 0;
  929|       |
  930|      0|            switch (addrs->ai_addr->sa_family) {
  ------------------
  |  Branch (930:21): [True: 0, False: 0]
  ------------------
  931|      0|            case AF_INET: {
  ------------------
  |  Branch (931:13): [True: 0, False: 0]
  ------------------
  932|      0|                struct sockaddr_in *sin = (struct sockaddr_in *)addrs->ai_addr;
  933|       |
  934|      0|                fam = "AF_INET";
  935|      0|                inet_ntop(AF_INET, &sin->sin_addr, dst, sizeof(dst));
  936|      0|                port = ntohs(sin->sin_port);
  937|      0|                break;
  938|      0|            }
  939|      0|            case AF_INET6: {
  ------------------
  |  Branch (939:13): [True: 0, False: 0]
  ------------------
  940|      0|                struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)
  941|      0|                    addrs->ai_addr;
  942|       |
  943|      0|                fam = "AF_INET6";
  944|      0|                inet_ntop(AF_INET6, &sin6->sin6_addr, dst, sizeof(dst));
  945|      0|                port = ntohs(sin6->sin6_port);
  946|      0|                break;
  947|      0|            }
  948|      0|            }
  949|      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]
  |  |  ------------------
  ------------------
  950|      0|                        port));
  951|      0|        }
  952|      0|    }
  953|     66|    return err;
  954|       |#else
  955|       |    NETSNMP_LOGONCE((LOG_ERR, "getaddrinfo not available"));
  956|       |    return EAI_FAIL;
  957|       |#endif /* getaddrinfo */
  958|     66|}
calculate_sectime_diff:
 1210|    161|{
 1211|    161|    struct timeval  diff;
 1212|       |
 1213|    161|    NETSNMP_TIMERSUB(now, then, &diff);
  ------------------
  |  |  173|    161|#define NETSNMP_TIMERSUB(a, b, res) do {                        \
  |  |  174|    161|    (res)->tv_sec  = (a)->tv_sec  - (b)->tv_sec - 1;            \
  |  |  175|    161|    (res)->tv_usec = (a)->tv_usec - (b)->tv_usec + 1000000L;    \
  |  |  176|    161|    if ((res)->tv_usec >= 1000000L) {                           \
  |  |  ------------------
  |  |  |  Branch (176:9): [True: 161, False: 0]
  |  |  ------------------
  |  |  177|    161|        (res)->tv_usec -= 1000000L;                             \
  |  |  178|    161|        (res)->tv_sec++;                                        \
  |  |  179|    161|    }                                                           \
  |  |  180|    161|} while (0)
  |  |  ------------------
  |  |  |  Branch (180:10): [Folded, False: 161]
  |  |  ------------------
  ------------------
 1214|    161|    return (u_int)(diff.tv_sec + (diff.tv_usec >= 500000L));
 1215|    161|}
netsnmp_os_prematch:
 1417|     66|{
 1418|     66|#ifdef HAVE_SYS_UTSNAME_H
 1419|     66|  static int printOSonce = 1;
 1420|     66|  struct utsname utsbuf;
 1421|     66|  if ( 0 > uname(&utsbuf))
  ------------------
  |  Branch (1421:8): [True: 0, False: 66]
  ------------------
 1422|      0|    return -1;
 1423|       |
 1424|     66|  if (printOSonce) {
  ------------------
  |  Branch (1424:7): [True: 1, False: 65]
  ------------------
 1425|      1|    printOSonce = 0;
 1426|       |    /* show the four elements that the kernel can be sure of */
 1427|      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]
  |  |  ------------------
  ------------------
 1428|      1|      utsbuf.sysname, utsbuf.release, utsbuf.version, utsbuf.machine));
 1429|      1|  }
 1430|     66|  if (0 != strcasecmp(utsbuf.sysname, ospmname)) return -1;
  ------------------
  |  Branch (1430:7): [True: 0, False: 66]
  ------------------
 1431|       |
 1432|       |  /* Required to match only the leading characters */
 1433|     66|  return strncasecmp(utsbuf.release, ospmrelprefix, strlen(ospmrelprefix));
 1434|       |
 1435|       |#else
 1436|       |
 1437|       |  return -1;
 1438|       |
 1439|       |#endif /* HAVE_SYS_UTSNAME_H */
 1440|     66|}

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

netsnmp_aal5pvc_ctor:
  379|     66|{
  380|     66|    aal5pvcDomain.name = netsnmp_AAL5PVCDomain;
  381|     66|    aal5pvcDomain.name_length = OID_LENGTH(netsnmp_AAL5PVCDomain);
  ------------------
  |  |   57|     66|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
  382|     66|    aal5pvcDomain.prefix = calloc(3, sizeof(char *));
  383|     66|    if (!aal5pvcDomain.prefix) {
  ------------------
  |  Branch (383:9): [True: 0, False: 66]
  ------------------
  384|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  385|      0|        return;
  386|      0|    }
  387|     66|    aal5pvcDomain.prefix[0] = "aal5pvc";
  388|     66|    aal5pvcDomain.prefix[1] = "pvc";
  389|       |
  390|     66|    aal5pvcDomain.f_create_from_tstring_new = netsnmp_aal5pvc_create_tstring;
  391|     66|    aal5pvcDomain.f_create_from_ostring     = netsnmp_aal5pvc_create_ostring;
  392|       |
  393|     66|    netsnmp_tdomain_register(&aal5pvcDomain);
  394|     66|}

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

netsnmp_dtlsudp_ctor:
 1832|     66|{
 1833|     66|    static const char indexname[] = "_netsnmp_addr_info";
 1834|     66|    static const char *prefixes[] = { "dtlsudp", "dtls"
 1835|     66|#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
 1836|     66|                                      , "dtlsudp6", "dtls6"
 1837|     66|#endif
 1838|     66|    };
 1839|     66|    int i, num_prefixes = sizeof(prefixes) / sizeof(char *);
 1840|     66|#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
 1841|     66|    static const char indexname6[] = "_netsnmp_addr_info6";
 1842|     66|#endif
 1843|       |
 1844|     66|    DEBUGMSGTL(("dtlsudp", "registering DTLS constructor\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 1845|       |
 1846|       |    /* config settings */
 1847|       |
 1848|     66|#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
 1849|     66|    if (!openssl_addr_index6)
  ------------------
  |  Branch (1849:9): [True: 1, False: 65]
  ------------------
 1850|      1|        openssl_addr_index6 =
 1851|      1|            SSL_get_ex_new_index(0, NETSNMP_REMOVE_CONST(void *, indexname6),
 1852|     66|                                 NULL, NULL, NULL);
 1853|     66|#endif
 1854|       |
 1855|     66|    dtlsudpDomain.name = netsnmpDTLSUDPDomain;
 1856|     66|    dtlsudpDomain.name_length = netsnmpDTLSUDPDomain_len;
 1857|     66|    dtlsudpDomain.prefix = calloc(num_prefixes + 1, sizeof(char *));
 1858|     66|    if (!dtlsudpDomain.prefix) {
  ------------------
  |  Branch (1858:9): [True: 0, False: 66]
  ------------------
 1859|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
 1860|      0|        return;
 1861|      0|    }
 1862|    330|    for (i = 0; i < num_prefixes; ++ i)
  ------------------
  |  Branch (1862:17): [True: 264, False: 66]
  ------------------
 1863|    264|        dtlsudpDomain.prefix[i] = prefixes[i];
 1864|       |
 1865|     66|    dtlsudpDomain.f_create_from_tstring_new = netsnmp_dtlsudp_create_tstring;
 1866|     66|    dtlsudpDomain.f_create_from_ostring     = netsnmp_dtlsudp_create_ostring;
 1867|       |
 1868|     66|    if (!openssl_addr_index)
  ------------------
  |  Branch (1868:9): [True: 1, False: 65]
  ------------------
 1869|      1|        openssl_addr_index =
 1870|      1|            SSL_get_ex_new_index(0, NETSNMP_REMOVE_CONST(void *, indexname),
 1871|     66|                                 NULL, NULL, NULL);
 1872|       |
 1873|     66|    netsnmp_tdomain_register(&dtlsudpDomain);
 1874|     66|}

netsnmp_parse_ep_str:
   31|     66|{
   32|     66|    char *dup, *cp, *addrstr = NULL, *iface = NULL, *portstr = NULL;
   33|     66|    unsigned port;
   34|       |
   35|     66|    if (!endpoint)
  ------------------
  |  Branch (35:9): [True: 0, False: 66]
  ------------------
   36|      0|        return 0;
   37|       |
   38|     66|    dup = strdup(endpoint);
   39|     66|    if (!dup)
  ------------------
  |  Branch (39:9): [True: 0, False: 66]
  ------------------
   40|      0|        return 0;
   41|       |
   42|     66|    cp = dup;
   43|     66|    if (netsnmp_isnumber(cp)) {
  ------------------
  |  Branch (43:9): [True: 0, False: 66]
  ------------------
   44|      0|        portstr = cp;
   45|     66|    } else {
   46|     66|        if (*cp == '[') {
  ------------------
  |  Branch (46:13): [True: 0, False: 66]
  ------------------
   47|      0|            addrstr = cp + 1;
   48|      0|            cp = strchr(cp, ']');
   49|      0|            if (cp) {
  ------------------
  |  Branch (49:17): [True: 0, False: 0]
  ------------------
   50|      0|                cp[0] = '\0';
   51|      0|                cp++;
   52|      0|            } else {
   53|      0|                goto err;
   54|      0|            }
   55|     66|        } else if (*cp != '@' && (*cp != ':' || cp[1] == ':')) {
  ------------------
  |  Branch (55:20): [True: 66, False: 0]
  |  Branch (55:35): [True: 66, False: 0]
  |  Branch (55:49): [True: 0, False: 0]
  ------------------
   56|     66|            addrstr = cp;
   57|     66|            cp = strchr(addrstr, '@');
   58|     66|            if (!cp) {
  ------------------
  |  Branch (58:17): [True: 66, False: 0]
  ------------------
   59|     66|                cp = strrchr(addrstr, ':');
   60|     66|                if (cp && strchr(dup, ':') < cp)
  ------------------
  |  Branch (60:21): [True: 66, False: 0]
  |  Branch (60:27): [True: 0, False: 66]
  ------------------
   61|      0|                    cp = NULL;
   62|     66|            }
   63|     66|        }
   64|     66|        if (cp && *cp == '@') {
  ------------------
  |  Branch (64:13): [True: 66, False: 0]
  |  Branch (64:19): [True: 0, False: 66]
  ------------------
   65|      0|            *cp = '\0';
   66|      0|            iface = cp + 1;
   67|      0|            cp = strchr(cp + 1, ':');
   68|      0|        }
   69|     66|        if (cp && *cp == ':') {
  ------------------
  |  Branch (69:13): [True: 66, False: 0]
  |  Branch (69:19): [True: 66, False: 0]
  ------------------
   70|     66|            *cp++ = '\0';
   71|     66|            portstr = cp;
   72|     66|            if (!netsnmp_isnumber(cp))
  ------------------
  |  Branch (72:17): [True: 0, False: 66]
  ------------------
   73|      0|                goto err;
   74|     66|        } else if (cp && *cp) {
  ------------------
  |  Branch (74:20): [True: 0, False: 0]
  |  Branch (74:26): [True: 0, False: 0]
  ------------------
   75|      0|            goto err;
   76|      0|        }
   77|     66|    }
   78|       |
   79|     66|    if (addrstr) {
  ------------------
  |  Branch (79:9): [True: 66, False: 0]
  ------------------
   80|     66|        ep_str->addr = strdup(addrstr);
   81|     66|        if (!ep_str->addr)
  ------------------
  |  Branch (81:13): [True: 0, False: 66]
  ------------------
   82|      0|            goto err;
   83|     66|    }
   84|     66|    if (iface)
  ------------------
  |  Branch (84:9): [True: 0, False: 66]
  ------------------
   85|      0|        strlcpy(ep_str->iface, iface, sizeof(ep_str->iface));
   86|     66|    if (portstr) {
  ------------------
  |  Branch (86:9): [True: 66, False: 0]
  ------------------
   87|     66|        port = atoi(portstr);
   88|     66|        if (port <= 0xffff)
  ------------------
  |  Branch (88:13): [True: 66, False: 0]
  ------------------
   89|     66|            strlcpy(ep_str->port, portstr, sizeof(ep_str->port));
   90|      0|        else
   91|      0|            goto err;
   92|     66|    }
   93|       |
   94|     66|    free(dup);
   95|     66|    return 1;
   96|       |
   97|      0|err:
   98|      0|    free(ep_str->addr);
   99|       |    ep_str->addr = NULL;
  100|      0|    free(dup);
  101|      0|    return 0;
  102|     66|}
netsnmp_bindtodevice:
  105|     66|{
  106|       |    /* If no interface name has been specified, report success. */
  107|     66|    if (!iface || iface[0] == '\0')
  ------------------
  |  Branch (107:9): [True: 0, False: 66]
  |  Branch (107:19): [True: 66, False: 0]
  ------------------
  108|     66|        return 0;
  109|       |
  110|      0|#ifdef HAVE_SO_BINDTODEVICE
  111|      0|    {
  112|       |        /*
  113|       |         * +1 to work around the Linux kernel bug that the passed in name is not
  114|       |         * '\0'-terminated.
  115|       |         */
  116|      0|        int ifacelen = strlen(iface) + 1;
  117|      0|        int ret;
  118|       |
  119|      0|        ret = setsockopt(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|     66|    }
  125|       |#else
  126|       |    errno = EINVAL;
  127|       |    return -1;
  128|       |#endif
  129|     66|}
netsnmp_bind_ep_iface:
  145|     66|{
  146|     66|    if (!ep || ep->iface[0] == '\0')
  ------------------
  |  Branch (146:9): [True: 0, False: 66]
  |  Branch (146:16): [True: 66, False: 0]
  ------------------
  147|     66|        return;
  148|       |
  149|      0|    if (netsnmp_bindtodevice(sock, ep->iface))
  ------------------
  |  Branch (149:9): [True: 0, False: 0]
  ------------------
  150|      0|        DEBUGMSGTL((token, "VRF: Could not bind socket %" NETSNMP_FMT_SKT
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  151|      0|                    " to %s\n", sock, ep->iface));
  152|      0|    else
  153|      0|        DEBUGMSGTL((token, "VRF: Bound socket %" NETSNMP_FMT_SKT " to %s\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  154|      0|                    sock, ep->iface));
  155|      0|}
netsnmp_ipbase_session_init:
  158|     66|                            struct snmp_session *sess) {
  159|     66|    union {
  160|     66|        struct sockaddr     sa;
  161|     66|        struct sockaddr_in  sin;
  162|     66|        struct sockaddr_in6 sin6;
  163|     66|    } ss;
  164|     66|    socklen_t len = sizeof(ss);
  165|       |
  166|     66|    if (!sess) {
  ------------------
  |  Branch (166:9): [True: 0, False: 66]
  ------------------
  167|      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]
  |  |  ------------------
  ------------------
  168|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  169|      0|    }
  170|       |
  171|     66|    if (getsockname(transport->sock, (struct sockaddr *)&ss, &len) == -1) {
  ------------------
  |  Branch (171:9): [True: 0, False: 66]
  ------------------
  172|      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]
  |  |  ------------------
  ------------------
  173|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  174|      0|    }
  175|     66|    switch (ss.sa.sa_family) {
  176|     66|    case AF_INET:
  ------------------
  |  Branch (176:5): [True: 66, False: 0]
  ------------------
  177|     66|        sess->local_port = ntohs(ss.sin.sin_port);
  178|     66|        break;
  179|      0|    case AF_INET6:
  ------------------
  |  Branch (179:5): [True: 0, False: 66]
  ------------------
  180|      0|        sess->local_port = ntohs(ss.sin6.sin6_port);
  181|      0|        break;
  182|      0|    default:
  ------------------
  |  Branch (182:5): [True: 0, False: 66]
  ------------------
  183|      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]
  |  |  ------------------
  ------------------
  184|      0|                    ss.sa.sa_family));
  185|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  186|     66|    }
  187|       |
  188|     66|    DEBUGMSGTL(("netsnmp_ipbase", "local port number %d\n", sess->local_port));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  189|       |
  190|     66|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|     66|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  191|     66|}
snmpIPBaseDomain.c:netsnmp_isnumber:
   12|    132|{
   13|    132|    if (!*cp)
  ------------------
  |  Branch (13:9): [True: 0, False: 132]
  ------------------
   14|      0|        return 0;
   15|       |
   16|    132|    while (isdigit((unsigned char)*cp))
  ------------------
  |  Branch (16:12): [True: 462, False: 132]
  ------------------
   17|    462|        cp++;
   18|    132|    return *cp == '\0';
   19|    132|}

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

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

netsnmp_std_ctor:
  288|     66|{
  289|     66|    stdDomain.name = netsnmp_snmpSTDDomain;
  290|     66|    stdDomain.name_length = OID_LENGTH(netsnmp_snmpSTDDomain);
  ------------------
  |  |   57|     66|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
  291|     66|    stdDomain.prefix = calloc(2, sizeof(char *));
  292|     66|    if (!stdDomain.prefix) {
  ------------------
  |  Branch (292:9): [True: 0, False: 66]
  ------------------
  293|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  294|      0|        return;
  295|      0|    }
  296|     66|    stdDomain.prefix[0] = "std";
  297|       |
  298|     66|    stdDomain.f_create_from_tstring_new = netsnmp_std_create_tstring;
  299|     66|    stdDomain.f_create_from_ostring     = netsnmp_std_create_ostring;
  300|       |
  301|     66|    netsnmp_tdomain_register(&stdDomain);
  302|     66|}

netsnmp_socketbase_close:
   49|     66|int netsnmp_socketbase_close(netsnmp_transport *t) {
   50|     66|    int rc = -1;
   51|     66|    if (NETSNMP_IS_VALID_SOCKET(t->sock)) {
  ------------------
  |  |   44|     66|#define NETSNMP_IS_VALID_SOCKET(_sock) ((_sock) != -1)
  |  |  ------------------
  |  |  |  Branch (44:40): [True: 66, False: 0]
  |  |  ------------------
  ------------------
   52|     66|#ifndef HAVE_CLOSESOCKET
   53|     66|        rc = close(t->sock);
   54|       |#else
   55|       |        rc = closesocket(t->sock);
   56|       |#endif
   57|     66|        t->sock = NETSNMP_INVALID_SOCKET;
  ------------------
  |  |   43|     66|#define NETSNMP_INVALID_SOCKET -1
  ------------------
   58|     66|    }
   59|     66|    return rc;
   60|     66|}
netsnmp_sock_buffer_set:
  227|    132|{
  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|    132|    const char     *buftype;
  233|    132|    int            curbuf = 0;
  234|    132|    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|    132|    if (0 == size)
  ------------------
  |  Branch (254:9): [True: 132, False: 0]
  ------------------
  255|    132|        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|    132|    if ((getsockopt(sock, SOL_SOCKET, optname, (void *) &curbuf,
  ------------------
  |  Branch (262:9): [True: 132, False: 0]
  ------------------
  263|    132|                    &curbuflen) == 0) 
  264|    132|        && (curbuflen == sizeof(int))) {
  ------------------
  |  Branch (264:12): [True: 132, False: 0]
  ------------------
  265|       |        
  266|    132|        DEBUGMSGT(("verbose:socket:buffer", "Original %s is %d\n",
  ------------------
  |  |   62|    132|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    132|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 132]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 132]
  |  |  ------------------
  ------------------
  267|    132|                   buftype, curbuf));
  268|    132|        if (curbuf >= size) {
  ------------------
  |  Branch (268:13): [True: 132, False: 0]
  ------------------
  269|    132|            DEBUGMSGT(("verbose:socket:buffer",
  ------------------
  |  |   62|    132|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    132|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 132]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 132]
  |  |  ------------------
  ------------------
  270|    132|                      "New %s size is smaller than original!\n", buftype));
  271|    132|        }
  272|    132|    }
  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|    132|    if (size <= 0) {
  ------------------
  |  Branch (278:9): [True: 132, False: 0]
  ------------------
  279|    132|       DEBUGMSGT(("socket:buffer",
  ------------------
  |  |   62|    132|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    132|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 132]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 132]
  |  |  ------------------
  ------------------
  280|    132|                    "%s not valid or not specified; using OS default(%d)\n",
  281|    132|                    buftype,curbuf));
  282|    132|       return curbuf;
  283|    132|    }
  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|    132|#endif
  339|    132|}
snmpSocketBaseDomain.c:_sock_buffer_size_get:
  166|    132|{
  167|    132|    int size;
  168|       |
  169|    132|    if (NULL != buftype)
  ------------------
  |  Branch (169:9): [True: 132, False: 0]
  ------------------
  170|    132|        *buftype = _sock_buf_type_get(optname, local);
  171|       |
  172|    132|    if (optname == SO_SNDBUF) {
  ------------------
  |  Branch (172:9): [True: 66, False: 66]
  ------------------
  173|     66|        if (local) {
  ------------------
  |  Branch (173:13): [True: 66, False: 0]
  ------------------
  174|     66|            size = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  175|     66|                    NETSNMP_DS_LIB_SERVERSENDBUF);
  ------------------
  |  |  122|     66|#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|     66|        } 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|     66|    } else if (optname == SO_RCVBUF) {
  ------------------
  |  Branch (188:16): [True: 66, False: 0]
  ------------------
  189|     66|        if (local) {
  ------------------
  |  Branch (189:13): [True: 66, False: 0]
  ------------------
  190|     66|            size = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  191|     66|                    NETSNMP_DS_LIB_SERVERRECVBUF);
  ------------------
  |  |  123|     66|#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|     66|        } 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|     66|    } else {
  205|      0|        size = 0;
  206|      0|    }
  207|       |
  208|    132|    DEBUGMSGTL(("socket:buffer", "Requested %s is %d\n",
  ------------------
  |  |   66|    132|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    132|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 132]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 132]
  |  |  ------------------
  ------------------
  209|    132|                (buftype) ? *buftype : "unknown buffer", size));
  210|       |
  211|    132|    return(size);
  212|    132|}
snmpSocketBaseDomain.c:_sock_buf_type_get:
  139|    132|{
  140|    132|    if (optname == SO_SNDBUF) {
  ------------------
  |  Branch (140:9): [True: 66, False: 66]
  ------------------
  141|     66|        if (local)
  ------------------
  |  Branch (141:13): [True: 66, False: 0]
  ------------------
  142|     66|            return "server send buffer";
  143|      0|        else
  144|      0|            return "client send buffer";
  145|     66|    } else if (optname == SO_RCVBUF) {
  ------------------
  |  Branch (145:16): [True: 66, False: 0]
  ------------------
  146|     66|        if (local)
  ------------------
  |  Branch (146:13): [True: 66, False: 0]
  ------------------
  147|     66|            return "server receive buffer";
  148|      0|        else
  149|      0|            return "client receive buffer";
  150|     66|    }
  151|       |
  152|      0|    return "unknown buffer";
  153|    132|}

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

netsnmp_tcpipv6_ctor:
  377|     66|{
  378|     66|    tcp6Domain.name = netsnmp_TCPIPv6Domain;
  379|     66|    tcp6Domain.name_length = OID_LENGTH(netsnmp_TCPIPv6Domain);
  ------------------
  |  |   57|     66|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
  380|     66|    tcp6Domain.f_create_from_tstring_new = netsnmp_tcp6_create_tstring;
  381|     66|    tcp6Domain.f_create_from_ostring     = netsnmp_tcp6_create_ostring;
  382|     66|    tcp6Domain.prefix = calloc(4, sizeof(char *));
  383|     66|    if (!tcp6Domain.prefix) {
  ------------------
  |  Branch (383:9): [True: 0, False: 66]
  ------------------
  384|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  385|      0|        return;
  386|      0|    }
  387|     66|    tcp6Domain.prefix[0] = "tcp6";
  388|     66|    tcp6Domain.prefix[1] = "tcpv6";
  389|     66|    tcp6Domain.prefix[2] = "tcpipv6";
  390|       |
  391|     66|    netsnmp_tdomain_register(&tcp6Domain);
  392|     66|}

netsnmp_tlsbase_ctor:
 1132|     66|netsnmp_tlsbase_ctor(void) {
 1133|       |
 1134|       |    /* bootstrap ssl since we'll need it */
 1135|     66|    netsnmp_init_openssl();
 1136|       |
 1137|       |    /* the private client cert to authenticate with */
 1138|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "extraX509SubDir",
  ------------------
  |  |   67|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
 1139|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1140|     66|                               NETSNMP_DS_LIB_CERT_EXTRA_SUBDIR);
  ------------------
  |  |  177|     66|#define NETSNMP_DS_LIB_CERT_EXTRA_SUBDIR 26
  ------------------
 1141|       |
 1142|       |    /* Do we have a CRL list? */
 1143|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "x509CRLFile",
  ------------------
  |  |   67|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
 1144|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1145|     66|                               NETSNMP_DS_LIB_X509_CRL_FILE);
  ------------------
  |  |  179|     66|#define NETSNMP_DS_LIB_X509_CRL_FILE     28
  ------------------
 1146|       |
 1147|       |    /* What TLS algorithms should be use */
 1148|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "tlsAlgorithms",
  ------------------
  |  |   67|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
 1149|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1150|     66|                               NETSNMP_DS_LIB_TLS_ALGORITMS);
  ------------------
  |  |  180|     66|#define NETSNMP_DS_LIB_TLS_ALGORITMS     29
  ------------------
 1151|       |
 1152|       |    /* What TLS version should be used at least */
 1153|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "tlsMinVersion",
  ------------------
  |  |   67|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
 1154|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1155|     66|                               NETSNMP_DS_LIB_TLS_MIN_VERSION);
  ------------------
  |  |  187|     66|#define NETSNMP_DS_LIB_TLS_MIN_VERSION   36
  ------------------
 1156|       |
 1157|       |    /* What TLS version should be used at max */
 1158|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "tlsMaxVersion",
  ------------------
  |  |   67|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
 1159|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1160|     66|                               NETSNMP_DS_LIB_TLS_MAX_VERSION);
  ------------------
  |  |  188|     66|#define NETSNMP_DS_LIB_TLS_MAX_VERSION   37
  ------------------
 1161|       |
 1162|       |    /*
 1163|       |     * for the client
 1164|       |     */
 1165|       |
 1166|       |    /* the public client cert to authenticate with */
 1167|     66|    register_config_handler("snmp", "clientCert", _parse_client_cert, NULL,
 1168|     66|                            NULL);
 1169|       |
 1170|       |    /*
 1171|       |     * for the server
 1172|       |     */
 1173|       |
 1174|       |    /* The X509 server key to use */
 1175|     66|    register_config_handler("snmp", "serverCert", _parse_server_cert, NULL,
 1176|     66|                            NULL);
 1177|       |    /*
 1178|       |     * remove cert config ambiguity: localCert, peerCert
 1179|       |     */
 1180|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "localCert",
  ------------------
  |  |   67|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
 1181|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1182|     66|                               NETSNMP_DS_LIB_TLS_LOCAL_CERT);
  ------------------
  |  |  181|     66|#define NETSNMP_DS_LIB_TLS_LOCAL_CERT    30
  ------------------
 1183|     66|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "peerCert",
  ------------------
  |  |   67|     66|#define ASN_OCTET_STR	    0x04U
  ------------------
 1184|     66|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     66|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1185|     66|                               NETSNMP_DS_LIB_TLS_PEER_CERT);
  ------------------
  |  |  182|     66|#define NETSNMP_DS_LIB_TLS_PEER_CERT     31
  ------------------
 1186|       |
 1187|       |    /*
 1188|       |     * register our boot-strapping needs
 1189|       |     */
 1190|     66|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     66|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1191|     66|			   SNMP_CALLBACK_POST_PREMIB_READ_CONFIG,
  ------------------
  |  |   27|     66|#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG	3
  ------------------
 1192|     66|			   tls_bootstrap, NULL);
 1193|       |
 1194|     66|}
snmpTLSBaseDomain.c:tls_bootstrap:
 1084|     66|tls_bootstrap(int majorid, int minorid, void *serverarg, void *clientarg) {
 1085|     66|    char indexname[] = "_netsnmp_verify_info";
 1086|       |
 1087|       |    /* don't do this more than once */
 1088|     66|    if (have_done_bootstrap)
  ------------------
  |  Branch (1088:9): [True: 65, False: 1]
  ------------------
 1089|     65|        return 0;
 1090|      1|    have_done_bootstrap = 1;
 1091|       |
 1092|      1|    netsnmp_certs_load();
 1093|       |
 1094|      1|    openssl_local_index =
 1095|      1|        SSL_get_ex_new_index(0, indexname, NULL, NULL, verify_info_free);
 1096|       |
 1097|      1|    return 0;
 1098|     66|}

netsnmp_tlstcp_ctor:
 1221|     66|{
 1222|     66|    DEBUGMSGTL(("tlstcp", "registering TLS constructor\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
 1223|       |
 1224|       |    /* config settings */
 1225|       |
 1226|     66|    tlstcpDomain.name = netsnmpTLSTCPDomain;
 1227|     66|    tlstcpDomain.name_length = netsnmpTLSTCPDomain_len;
 1228|     66|    tlstcpDomain.prefix = calloc(3, sizeof(char *));
 1229|     66|    if (!tlstcpDomain.prefix) {
  ------------------
  |  Branch (1229:9): [True: 0, False: 66]
  ------------------
 1230|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
 1231|      0|        return;
 1232|      0|    }
 1233|     66|    tlstcpDomain.prefix[0] = "tlstcp";
 1234|     66|    tlstcpDomain.prefix[1] = "tls";
 1235|       |
 1236|     66|    tlstcpDomain.f_create_from_tstring_new = netsnmp_tlstcp_create_tstring;
 1237|     66|    tlstcpDomain.f_create_from_ostring     = netsnmp_tlstcp_create_ostring;
 1238|       |
 1239|     66|    netsnmp_tdomain_register(&tlstcpDomain);
 1240|     66|}

_netsnmp_udp_sockopt_set:
   69|     66|{
   70|     66|#ifdef  SO_BSDCOMPAT
   71|       |    /*
   72|       |     * Patch for Linux.  Without this, UDP packets that fail get an ICMP
   73|       |     * response.  Linux turns the failed ICMP response into an error message
   74|       |     * and return value, unlike all other OS's.  
   75|       |     */
   76|     66|    if (0 == netsnmp_os_prematch("Linux","2.4"))
  ------------------
  |  Branch (76:9): [True: 0, False: 66]
  ------------------
   77|      0|    {
   78|      0|        int             one = 1;
   79|      0|        DEBUGMSGTL(("socket:option", "setting socket option SO_BSDCOMPAT\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
   80|      0|        setsockopt(sock, SOL_SOCKET, SO_BSDCOMPAT, (void *) &one, sizeof(one));
   81|      0|    }
   82|     66|#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|     66|    netsnmp_sock_buffer_set(sock, SO_SNDBUF, local, 0);
  110|       |    netsnmp_sock_buffer_set(sock, SO_RCVBUF, local, 0);
  111|     66|}
netsnmp_udpbase_recvfrom:
  143|     65|{
  144|     65|    int r;
  145|     65|#if !defined(WIN32)
  146|     65|    struct iovec iov;
  147|     65|    char cmsg[CMSG_SPACE(cmsg_data_size)];
  148|     65|    struct cmsghdr *cm;
  149|     65|    struct msghdr msg;
  150|       |
  151|     65|    iov.iov_base = buf;
  152|     65|    iov.iov_len = len;
  153|       |
  154|     65|    memset(&msg, 0, sizeof msg);
  155|     65|    msg.msg_name = from;
  156|     65|    msg.msg_namelen = *fromlen;
  157|     65|    msg.msg_iov = &iov;
  158|     65|    msg.msg_iovlen = 1;
  159|     65|    msg.msg_control = &cmsg;
  160|     65|    msg.msg_controllen = sizeof(cmsg);
  161|       |
  162|     65|    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|     65|    if (r == -1) {
  ------------------
  |  Branch (190:9): [True: 0, False: 65]
  ------------------
  191|      0|        return -1;
  192|      0|    }
  193|       |
  194|     65|    DEBUGMSGTL(("udpbase:recv", "got source addr: %s\n",
  ------------------
  |  |   66|     65|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 65]
  |  |  ------------------
  ------------------
  195|     65|                inet_ntoa(((struct sockaddr_in *)from)->sin_addr)));
  196|       |
  197|     65|    {
  198|       |        /* Get the local port number for use in diagnostic messages */
  199|     65|        int r2 = getsockname(sock, dstip, dstlen);
  200|     65|        netsnmp_assert(r2 == 0);
  ------------------
  |  |   47|     65|#      define netsnmp_assert(x)  do { \
  |  |   48|     65|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 65, False: 0]
  |  |  ------------------
  |  |   49|     65|                 ; \
  |  |   50|     65|              else \
  |  |   51|     65|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     65|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 65]
  |  |  ------------------
  ------------------
  201|     65|    }
  202|       |
  203|     65|#if !defined(WIN32)
  204|    130|    for (cm = CMSG_FIRSTHDR(&msg); cm != NULL; cm = CMSG_NXTHDR(&msg, cm)) {
  ------------------
  |  Branch (204:15): [True: 65, False: 0]
  |  Branch (204:36): [True: 65, False: 65]
  ------------------
  205|     65|#if defined(HAVE_IP_PKTINFO)
  206|     65|        if (cm->cmsg_level == SOL_IP && cm->cmsg_type == IP_PKTINFO) {
  ------------------
  |  Branch (206:13): [True: 65, False: 0]
  |  Branch (206:41): [True: 65, False: 0]
  ------------------
  207|     65|            struct in_pktinfo* src = (struct in_pktinfo *)CMSG_DATA(cm);
  208|     65|            netsnmp_assert(dstip->sa_family == AF_INET);
  ------------------
  |  |   47|     65|#      define netsnmp_assert(x)  do { \
  |  |   48|     65|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 65, False: 0]
  |  |  ------------------
  |  |   49|     65|                 ; \
  |  |   50|     65|              else \
  |  |   51|     65|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1733|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     65|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 65]
  |  |  ------------------
  ------------------
  209|     65|            ((struct sockaddr_in*)dstip)->sin_addr = src->ipi_addr;
  210|     65|            *if_index = src->ipi_ifindex;
  211|     65|            DEBUGMSGTL(("udpbase:recv",
  ------------------
  |  |   66|     65|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     65|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 65]
  |  |  ------------------
  ------------------
  212|     65|                        "got destination (local) addr %s, iface %d\n",
  213|     65|                        inet_ntoa(src->ipi_addr), *if_index));
  214|     65|        }
  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|     65|    }
  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|     65|    return r;
  238|     65|}
netsnmp_udpbase_sendto_unix:
  245|      3|{
  246|      3|    struct iovec iov;
  247|      3|    struct msghdr m = { NULL };
  248|      3|    char          cmsg[CMSG_SPACE(cmsg_data_size)];
  249|      3|    int           rc;
  250|      3|    char          iface[IFNAMSIZ];
  251|      3|    socklen_t     ifacelen = IFNAMSIZ;
  252|       |
  253|      3|    iov.iov_base = NETSNMP_REMOVE_CONST(void *, data);
  ------------------
  |  |   91|      3|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  254|      3|    iov.iov_len  = len;
  255|       |
  256|      3|    {
  257|      3|        struct sockaddr_storage peer;
  258|      3|        socklen_t peer_len = sizeof(peer);
  259|       |
  260|      3|        if (getpeername(sock, (struct sockaddr *)&peer, &peer_len) == 0) {
  ------------------
  |  Branch (260:13): [True: 0, False: 3]
  ------------------
  261|      0|            m.msg_name = NULL;
  262|      0|            m.msg_namelen = 0;
  263|      3|        } else {
  264|      3|            m.msg_name = NETSNMP_REMOVE_CONST(void *, remote);
  ------------------
  |  |   91|      3|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  265|      3|            m.msg_namelen = sizeof(struct sockaddr_in);
  266|      3|            if (errno != ENOTCONN) {
  ------------------
  |  Branch (266:17): [True: 0, False: 3]
  ------------------
  267|      0|                snmp_log(LOG_ERR, "udpbase:sendto: fd %d getpeername failed: %d (%s)\n",
  268|      0|                         sock, errno, strerror(errno));
  269|      0|            }
  270|      3|        }
  271|      3|    }
  272|      3|    m.msg_iov		= &iov;
  273|      3|    m.msg_iovlen	= 1;
  274|      3|    m.msg_flags		= 0;
  275|       |
  276|      3|    if (srcip && srcip->s_addr != INADDR_ANY) {
  ------------------
  |  Branch (276:9): [True: 3, False: 0]
  |  Branch (276:18): [True: 3, False: 0]
  ------------------
  277|      3|        struct cmsghdr *cm;
  278|      3|        struct in_pktinfo ipi;
  279|      3|        int use_sendto = FALSE;
  ------------------
  |  |  125|      3|#define FALSE 0
  ------------------
  280|       |
  281|      3|        memset(cmsg, 0, sizeof(cmsg));
  282|       |
  283|      3|        m.msg_control    = &cmsg;
  284|      3|        m.msg_controllen = sizeof(cmsg);
  285|       |
  286|      3|        cm = CMSG_FIRSTHDR(&m);
  ------------------
  |  Branch (286:14): [True: 3, False: 0]
  ------------------
  287|      3|        cm->cmsg_len = CMSG_LEN(cmsg_data_size);
  288|       |
  289|      3|#if defined(HAVE_IP_PKTINFO)
  290|      3|        cm->cmsg_level = SOL_IP;
  291|      3|        cm->cmsg_type = IP_PKTINFO;
  292|       |
  293|      3|        memset(&ipi, 0, sizeof(ipi));
  294|      3|#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|      3|        if (getsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, iface,
  ------------------
  |  Branch (300:13): [True: 0, False: 3]
  ------------------
  301|      3|                       &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|      3|        } else if (ifacelen == 0) {
  ------------------
  |  Branch (305:20): [True: 3, False: 0]
  ------------------
  306|      3|            DEBUGMSGTL(("udpbase:sendto",
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 3]
  |  |  ------------------
  ------------------
  307|      3|                        "sendto: SO_BINDTODEVICE not set\n"));
  308|      3|        } 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|      3|#endif /* HAVE_SO_BINDTODEVICE */
  315|       |
  316|      3|#ifdef HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST
  317|      3|        DEBUGMSGTL(("udpbase:sendto", "sending from %s\n",
  ------------------
  |  |   66|      3|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 3]
  |  |  ------------------
  ------------------
  318|      3|                    inet_ntoa(*srcip)));
  319|      3|        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|      3|        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|      3|        if (use_sendto)
  ------------------
  |  Branch (331:13): [True: 0, False: 3]
  ------------------
  332|      0|            rc = sendto(sock, data, len, MSG_DONTWAIT, remote,
  333|      0|                        sizeof(struct sockaddr));
  334|      3|        else
  335|      3|            rc = sendmsg(sock, &m, MSG_DONTWAIT);
  336|      3|        if (rc >= 0 || (errno != EINVAL && errno != ENETUNREACH))
  ------------------
  |  Branch (336:13): [True: 3, False: 0]
  |  Branch (336:25): [True: 0, False: 0]
  |  Branch (336:44): [True: 0, False: 0]
  ------------------
  337|      3|            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|      3|}
netsnmp_udpbase_sendto:
  436|      3|{
  437|      3|#if !defined(WIN32)
  438|      3|    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|      3|}
netsnmp_udpbase_recv:
  454|     65|{
  455|     65|    int             rc = -1;
  456|     65|    socklen_t       fromlen = sizeof(netsnmp_sockaddr_storage);
  457|     65|    netsnmp_indexed_addr_pair *addr_pair = NULL;
  458|     65|    struct sockaddr *from;
  459|       |
  460|     65|    if (t && NETSNMP_IS_VALID_SOCKET(t->sock)) {
  ------------------
  |  |   44|     65|#define NETSNMP_IS_VALID_SOCKET(_sock) ((_sock) != -1)
  |  |  ------------------
  |  |  |  Branch (44:40): [True: 65, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (460:9): [True: 65, False: 0]
  ------------------
  461|     65|        addr_pair = SNMP_MALLOC_TYPEDEF(netsnmp_indexed_addr_pair);
  ------------------
  |  |   73|     65|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  462|     65|        if (addr_pair == NULL) {
  ------------------
  |  Branch (462:13): [True: 0, False: 65]
  ------------------
  463|      0|            *opaque = NULL;
  464|      0|            *olength = 0;
  465|      0|            return -1;
  466|      0|        } else
  467|     65|            from = &addr_pair->remote_addr.sa;
  468|       |
  469|    130|	while (rc < 0) {
  ------------------
  |  Branch (469:9): [True: 65, False: 65]
  ------------------
  470|     65|#ifdef netsnmp_udpbase_recvfrom_sendto_defined
  471|     65|            socklen_t local_addr_len = sizeof(addr_pair->local_addr);
  472|     65|            rc = netsnmp_udp_recvfrom(t->sock, buf, size, from, &fromlen,
  473|     65|                                      &addr_pair->local_addr.sa,
  474|     65|                                      &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|     65|	    if (rc < 0 && errno != EINTR) {
  ------------------
  |  Branch (478:10): [True: 0, False: 65]
  |  Branch (478:20): [True: 0, False: 0]
  ------------------
  479|      0|		break;
  480|      0|	    }
  481|     65|	}
  482|       |
  483|     65|        if (rc >= 0) {
  ------------------
  |  Branch (483:13): [True: 65, False: 0]
  ------------------
  484|     65|            DEBUGIF("netsnmp_udp") {
  ------------------
  |  |  145|     65|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|    130|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  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|     65|        } 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|     65|        *opaque = (void *)addr_pair;
  497|     65|        *olength = sizeof(netsnmp_indexed_addr_pair);
  498|     65|    }
  499|     65|    return rc;
  500|     65|}
netsnmp_udpbase_send:
  507|      3|{
  508|      3|    int rc = -1;
  509|      3|    const netsnmp_indexed_addr_pair *addr_pair = NULL;
  510|      3|    const struct sockaddr *to = NULL;
  511|       |
  512|      3|    if (opaque && *opaque && olength) {
  ------------------
  |  Branch (512:9): [True: 3, False: 0]
  |  Branch (512:19): [True: 3, False: 0]
  |  Branch (512:30): [True: 3, False: 0]
  ------------------
  513|      3|        if (*olength == sizeof(netsnmp_indexed_addr_pair)) {
  ------------------
  |  Branch (513:13): [True: 3, False: 0]
  ------------------
  514|      3|            addr_pair = *opaque;
  515|      3|            to = &addr_pair->remote_addr.sa;
  516|      3|        } 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|      3|    } 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|      3|    if (to && t && NETSNMP_IS_VALID_SOCKET(t->sock)) {
  ------------------
  |  |   44|      3|#define NETSNMP_IS_VALID_SOCKET(_sock) ((_sock) != -1)
  |  |  ------------------
  |  |  |  Branch (44:40): [True: 3, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (535:9): [True: 3, False: 0]
  |  Branch (535:15): [True: 3, False: 0]
  ------------------
  536|      3|        DEBUGIF("netsnmp_udp") {
  ------------------
  |  |  145|      3|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|      6|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  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|      6|	while (rc < 0) {
  ------------------
  |  Branch (545:9): [True: 3, False: 3]
  ------------------
  546|      3|#ifdef netsnmp_udpbase_recvfrom_sendto_defined
  547|      3|            rc = netsnmp_udp_sendto(t->sock,
  548|      3|                    addr_pair ? &(addr_pair->local_addr.sin.sin_addr) : NULL,
  ------------------
  |  Branch (548:21): [True: 3, False: 0]
  ------------------
  549|      3|                    addr_pair ? addr_pair->if_index : 0, to, buf, size);
  ------------------
  |  Branch (549:21): [True: 3, 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|      3|	    if (rc < 0 && errno != EINTR) {
  ------------------
  |  Branch (562:10): [True: 0, False: 3]
  |  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|      3|	}
  570|      3|    }
  571|      3|    return rc;
  572|      3|}

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

netsnmp_udpipv4_recvfrom:
   64|     65|{
   65|     65|    return netsnmp_udpbase_recvfrom(sock, buf, len, from, fromlen, dstip, dstlen,
   66|     65|                                    if_index);
   67|     65|}
netsnmp_udpipv4_sendto:
   72|      3|{
   73|      3|    return netsnmp_udpbase_sendto(sock, srcip, if_index, remote, data, len);
   74|      3|}
netsnmp_udpipv4base_transport_init:
   79|     66|{
   80|     66|    netsnmp_transport *t;
   81|     66|    const struct sockaddr_in *addr = &ep->a.sin;
   82|     66|    u_char *addr_ptr;
   83|       |
   84|     66|    if (addr == NULL || addr->sin_family != AF_INET) {
  ------------------
  |  Branch (84:9): [True: 0, False: 66]
  |  Branch (84:25): [True: 0, False: 66]
  ------------------
   85|      0|        return NULL;
   86|      0|    }
   87|       |
   88|     66|    t = netsnmp_transport_alloc();
   89|     66|    if (NULL == t)
  ------------------
  |  Branch (89:9): [True: 0, False: 66]
  ------------------
   90|      0|        return NULL;
   91|       |
   92|     66|    addr_ptr = netsnmp_memdup(addr, sizeof(*addr));
   93|     66|    if (NULL == addr_ptr) {
  ------------------
  |  Branch (93:9): [True: 0, False: 66]
  ------------------
   94|      0|        free(t);
   95|      0|        return NULL;
   96|      0|    }
   97|       |
   98|     66|    if (local) {
  ------------------
  |  Branch (98:9): [True: 66, False: 0]
  ------------------
   99|       |        /** This is a server session. */
  100|     66|        t->local_length = sizeof(*addr);
  101|     66|        t->local = addr_ptr;
  102|     66|    } else {
  103|       |        /** This is a client session. */
  104|      0|        t->remote = addr_ptr;
  105|      0|        t->remote_length = sizeof(*addr);
  106|      0|    }
  107|       |
  108|     66|    DEBUGIF("netsnmp_udpbase") {
  ------------------
  |  |  145|     66|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|    132|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  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|     66|    if (!local) {
  ------------------
  |  Branch (120:9): [True: 0, False: 66]
  ------------------
  121|      0|        netsnmp_indexed_addr_pair *addr_pair;
  122|       |
  123|       |        /*
  124|       |         * allocate space to save the (remote) address in the
  125|       |         * transport-specific data pointer for later use by netsnmp_udp_send.
  126|       |         */
  127|      0|        t->data = calloc(1, sizeof(netsnmp_indexed_addr_pair));
  128|      0|        if (NULL == t->data) {
  ------------------
  |  Branch (128:13): [True: 0, False: 0]
  ------------------
  129|      0|            netsnmp_transport_free(t);
  130|      0|            return NULL;
  131|      0|        }
  132|      0|        t->data_length = sizeof(netsnmp_indexed_addr_pair);
  133|       |
  134|      0|        addr_pair = (netsnmp_indexed_addr_pair *)t->data;
  135|      0|        memcpy(&addr_pair->remote_addr, addr, sizeof(*addr));
  136|      0|    }
  137|     66|    return t;
  138|     66|}
netsnmp_udpipv4base_transport_socket:
  142|     66|{
  143|     66|    int local = flags & NETSNMP_TSPEC_LOCAL;
  ------------------
  |  |  117|     66|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  144|     66|    NETSNMP_SOCKET sock;
  ------------------
  |  |   42|     66|#define NETSNMP_SOCKET         int
  ------------------
  145|       |
  146|     66|    sock = socket(PF_INET, SOCK_DGRAM, 0);
  147|     66|    DEBUGMSGTL(("UDPBase", "opened socket %" NETSNMP_FMT_SKT " as local=%d\n",
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  148|     66|                sock, local));
  149|     66|    if (!NETSNMP_IS_VALID_SOCKET(sock))
  ------------------
  |  |   44|     66|#define NETSNMP_IS_VALID_SOCKET(_sock) ((_sock) != -1)
  ------------------
  |  Branch (149:9): [True: 0, False: 66]
  ------------------
  150|      0|        return NETSNMP_INVALID_SOCKET;
  ------------------
  |  |   43|      0|#define NETSNMP_INVALID_SOCKET -1
  ------------------
  151|       |
  152|     66|    _netsnmp_udp_sockopt_set(sock, local);
  153|       |
  154|     66|    return sock;
  155|     66|}
netsnmp_udpipv4base_transport_bind:
  160|     66|{
  161|     66|    const struct sockaddr_in *addr = &ep->a.sin;
  162|     66|#if defined(HAVE_IP_PKTINFO) || defined(HAVE_IP_RECVDSTADDR) || defined(WIN32)
  163|     66|    int                sockopt = 1;
  164|     66|#endif
  165|     66|    int                rc;
  166|       |
  167|     66|    if (flags & NETSNMP_TSPEC_LOCAL) {
  ------------------
  |  |  117|     66|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  |  Branch (167:9): [True: 66, False: 0]
  ------------------
  168|       |#ifdef NETSNMP_NO_LISTEN_SUPPORT
  169|       |        return NULL;
  170|       |#endif /* NETSNMP_NO_LISTEN_SUPPORT */
  171|     66|#if defined(HAVE_IP_PKTINFO) && !defined(WIN32)
  172|     66|        if (setsockopt(t->sock, SOL_IP, IP_PKTINFO, &sockopt, sizeof sockopt) == -1) {
  ------------------
  |  Branch (172:13): [True: 0, False: 66]
  ------------------
  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|     66|        DEBUGMSGTL(("netsnmp_udpbase", "set IP_PKTINFO\n"));
  ------------------
  |  |   66|     66|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 66]
  |  |  ------------------
  ------------------
  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|     66|    }
  195|       |
  196|     66|    DEBUGIF("netsnmp_udpbase") {
  ------------------
  |  |  145|     66|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|    132|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  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|     66|    if (flags & NETSNMP_TSPEC_PREBOUND) {
  ------------------
  |  |  118|     66|#define NETSNMP_TSPEC_PREBOUND                  0x02 /* 1=bound by systemd, 0=needs bind in the library */
  ------------------
  |  Branch (208:9): [True: 0, False: 66]
  ------------------
  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|     66|    rc = netsnmp_bindtodevice(t->sock, ep->iface);
  215|     66|    if (rc != 0) {
  ------------------
  |  Branch (215:9): [True: 0, False: 66]
  ------------------
  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|     66|    rc = bind(t->sock, (const struct sockaddr *)addr, sizeof(*addr));
  221|     66|    if ( rc != 0 ) {
  ------------------
  |  Branch (221:10): [True: 0, False: 66]
  ------------------
  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|     66|    return 0;
  229|       |
  230|      0|err:
  231|      0|    netsnmp_socketbase_close(t);
  232|      0|    return 1;
  233|     66|}
netsnmp_udpipv4base_transport_with_source:
  270|     66|{
  271|     66|    netsnmp_transport         *t = NULL;
  272|     66|    const struct netsnmp_ep   *bind_addr;
  273|     66|    int                        rc, flags = 0;
  274|       |
  275|     66|    t = netsnmp_udpipv4base_transport_init(ep, local);
  276|     66|    if (NULL == t)
  ------------------
  |  Branch (276:9): [True: 0, False: 66]
  ------------------
  277|      0|         return NULL;
  278|       |
  279|     66|    if (local) {
  ------------------
  |  Branch (279:9): [True: 66, False: 0]
  ------------------
  280|     66|        bind_addr = ep;
  281|     66|        flags |= NETSNMP_TSPEC_LOCAL;
  ------------------
  |  |  117|     66|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  282|       |
  283|     66|#ifndef NETSNMP_NO_SYSTEMD
  284|       |        /*
  285|       |         * Maybe the socket was already provided by systemd...
  286|       |         */
  287|     66|        t->sock = netsnmp_sd_find_inet_socket(PF_INET, SOCK_DGRAM, -1,
  288|     66|                                              ntohs(ep->a.sin.sin_port));
  289|     66|        if (t->sock >= 0)
  ------------------
  |  Branch (289:13): [True: 0, False: 66]
  ------------------
  290|      0|            flags |= NETSNMP_TSPEC_PREBOUND;
  ------------------
  |  |  118|      0|#define NETSNMP_TSPEC_PREBOUND                  0x02 /* 1=bound by systemd, 0=needs bind in the library */
  ------------------
  291|     66|#endif
  292|     66|    }
  293|      0|    else
  294|      0|        bind_addr = src_addr;
  295|       |
  296|     66|    if (!NETSNMP_IS_VALID_SOCKET(t->sock))
  ------------------
  |  |   44|     66|#define NETSNMP_IS_VALID_SOCKET(_sock) ((_sock) != -1)
  ------------------
  |  Branch (296:9): [True: 66, False: 0]
  ------------------
  297|     66|        t->sock = netsnmp_udpipv4base_transport_socket(flags);
  298|     66|    if (!NETSNMP_IS_VALID_SOCKET(t->sock)) {
  ------------------
  |  |   44|     66|#define NETSNMP_IS_VALID_SOCKET(_sock) ((_sock) != -1)
  ------------------
  |  Branch (298:9): [True: 0, False: 66]
  ------------------
  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|     66|    if (NULL == bind_addr)
  ------------------
  |  Branch (307:9): [True: 0, False: 66]
  ------------------
  308|      0|        return t;
  309|       |
  310|       |    /*
  311|       |     * An interface specified in bind_addr takes precedence since
  312|       |     * netsnmp_udpipv4base_transport_bind() is called after this.
  313|       |     */
  314|     66|    netsnmp_bind_ep_iface(t->sock, ep, "netsnmp_udpbase");
  315|       |
  316|     66|    rc = netsnmp_udpipv4base_transport_bind(t, bind_addr, flags);
  317|     66|    if (rc) {
  ------------------
  |  Branch (317:9): [True: 0, False: 66]
  ------------------
  318|      0|        netsnmp_transport_free(t);
  319|      0|        t = NULL;
  320|      0|    }
  321|     66|    else if (!local)
  ------------------
  |  Branch (321:14): [True: 0, False: 66]
  ------------------
  322|      0|        netsnmp_udpipv4base_transport_get_bound_addr(t);
  323|       |
  324|     66|    return t;
  325|     66|}
netsnmp_udpipv4base_tspec_transport:
  329|     66|{
  330|     66|    struct netsnmp_ep addr;
  331|     66|    int local;
  332|       |
  333|     66|    if (NULL == tspec)
  ------------------
  |  Branch (333:9): [True: 0, False: 66]
  ------------------
  334|      0|        return NULL;
  335|       |
  336|     66|    local = tspec->flags & NETSNMP_TSPEC_LOCAL;
  ------------------
  |  |  117|     66|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  337|       |
  338|       |    /** get address from target */
  339|     66|    if (!netsnmp_sockaddr_in3(&addr, tspec->target, tspec->default_target))
  ------------------
  |  Branch (339:9): [True: 0, False: 66]
  ------------------
  340|      0|        return NULL;
  341|       |
  342|     66|    if (NULL != tspec->source) {
  ------------------
  |  Branch (342:9): [True: 0, False: 66]
  ------------------
  343|      0|        struct netsnmp_ep src_addr;
  344|       |
  345|       |        /** get sockaddr from source */
  346|      0|        if (!netsnmp_sockaddr_in3(&src_addr, tspec->source, ":0"))
  ------------------
  |  Branch (346:13): [True: 0, False: 0]
  ------------------
  347|      0|            return NULL;
  348|      0|        return netsnmp_udpipv4base_transport_with_source(&addr, local,
  349|      0|                                                         &src_addr);
  350|      0|    }
  351|       |
  352|       |    /** no source and default client address ok */
  353|     66|    return netsnmp_udpipv4base_transport(&addr, local);
  354|     66|}
netsnmp_udpipv4base_transport:
  358|     66|{
  359|     66|    struct netsnmp_ep client_ep;
  360|     66|    const char *client_addr;
  361|     66|    int uses_port;
  362|       |
  363|     66|    memset(&client_ep, 0, sizeof(client_ep));
  364|     66|    client_ep.a.sin.sin_family = AF_INET;
  365|       |
  366|     66|    if (local)
  ------------------
  |  Branch (366:9): [True: 66, False: 0]
  ------------------
  367|     66|        goto out;
  368|       |
  369|      0|    client_addr = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  370|      0|                                        NETSNMP_DS_LIB_CLIENT_ADDR);
  ------------------
  |  |  165|      0|#define NETSNMP_DS_LIB_CLIENT_ADDR       14
  ------------------
  371|      0|    if (!client_addr)
  ------------------
  |  Branch (371:9): [True: 0, False: 0]
  ------------------
  372|      0|        goto out;
  373|       |
  374|      0|    if (netsnmp_sockaddr_in3(&client_ep, client_addr, ":0") < 0) {
  ------------------
  |  Branch (374:9): [True: 0, False: 0]
  ------------------
  375|      0|        snmp_log(LOG_ERR, "Parsing clientaddr %s failed\n", client_addr);
  376|      0|        goto out;
  377|      0|    }
  378|       |
  379|      0|    uses_port = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  380|      0|                                       NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT);
  ------------------
  |  |  102|      0|#define NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT 42 /* NETSNMP_DS_LIB_CLIENT_ADDR includes address and also port */
  ------------------
  381|      0|    if (!uses_port)
  ------------------
  |  Branch (381:9): [True: 0, False: 0]
  ------------------
  382|      0|        client_ep.a.sin.sin_port = 0;
  383|       |
  384|     66|out:
  385|     66|    return netsnmp_udpipv4base_transport_with_source(ep, local, &client_ep);
  386|      0|}

netsnmp_udpipv6_ctor:
 1324|     66|{
 1325|     66|    udp6Domain.name = netsnmp_UDPIPv6Domain;
 1326|     66|    udp6Domain.name_length = OID_LENGTH(netsnmp_UDPIPv6Domain);
  ------------------
  |  |   57|     66|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
 1327|     66|    udp6Domain.f_create_from_tstring_new = netsnmp_udp6_create_tstring;
 1328|     66|    udp6Domain.f_create_from_tspec       = netsnmp_udp6_create_tspec;
 1329|     66|    udp6Domain.f_create_from_ostring     = netsnmp_udp6_create_ostring;
 1330|     66|    udp6Domain.prefix = calloc(5, sizeof(char *));
 1331|     66|    if (!udp6Domain.prefix) {
  ------------------
  |  Branch (1331:9): [True: 0, False: 66]
  ------------------
 1332|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
 1333|      0|        return;
 1334|      0|    }
 1335|     66|    udp6Domain.prefix[0] = "udp6";
 1336|     66|    udp6Domain.prefix[1] = "ipv6";
 1337|     66|    udp6Domain.prefix[2] = "udpv6";
 1338|     66|    udp6Domain.prefix[3] = "udpipv6";
 1339|       |
 1340|     66|    netsnmp_tdomain_register(&udp6Domain);
 1341|     66|}

netsnmp_udpshared_ctor:
  454|     66|{
  455|     66|    static netsnmp_tdomain domain;
  456|     66|    static int done = 0;
  457|       |
  458|     66|    if (done)
  ------------------
  |  Branch (458:9): [True: 65, False: 1]
  ------------------
  459|     65|        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:
  536|     66|{
  537|     66|    unixDomain.name = netsnmp_UnixDomain;
  538|     66|    unixDomain.name_length = OID_LENGTH(netsnmp_UnixDomain);
  ------------------
  |  |   57|     66|#define OID_LENGTH(x)  (sizeof(x) / sizeof((x)[0]))
  ------------------
  539|     66|    unixDomain.prefix = calloc(2, sizeof(char *));
  540|     66|    if (!unixDomain.prefix) {
  ------------------
  |  Branch (540:9): [True: 0, False: 66]
  ------------------
  541|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  542|      0|        return;
  543|      0|    }
  544|     66|    unixDomain.prefix[0] = "unix";
  545|       |
  546|     66|    unixDomain.f_create_from_tstring_new = netsnmp_unix_create_tstring;
  547|     66|    unixDomain.f_create_from_ostring     = netsnmp_unix_create_ostring;
  548|       |
  549|     66|    netsnmp_tdomain_register(&unixDomain);
  550|     66|}

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

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

