1441 static PyObject *
1442 netsnmp_create_session_tunneled(PyObject *self, PyObject *args)
1443 {
1444 int version;
1445 char *peer;
1446 int lport;
1447 int retries;
1448 int timeout;
1449 char * sec_name;
1450 int sec_level;
1451 char * sec_eng_id;
1452 char * context_eng_id;
1453 char * context;
1454 char * our_identity;
1455 char * their_identity;
1456 char * their_hostname;
1457 char * trust_cert;
1458 SnmpSession session = {0};
1459 SnmpSession *ss = NULL;
1460 int verbose = py_netsnmp_verbose();
1461
1462 if (!PyArg_ParseTuple(args, "isiiisissssss", &version,
when PyArg_ParseTuple() succeeds
taking False path
1463 &peer, &lport, &retries, &timeout,
1464 &sec_name, &sec_level,
1465 &context_eng_id, &context,
1466 &our_identity, &their_identity,
1467 &their_hostname, &trust_cert))
1468 return NULL;
1469
1470 __libraries_init("python");
1471 snmp_sess_init(&session);
1472
1473 if (version != 3) {
when considering range: -0x80000000 <= value <= 2
taking True path
1474 session.version = SNMP_VERSION_3;
1475 if (verbose)
when considering range: -0x80000000 <= value <= -1
taking True path
1476 printf("Using version 3 as it's the only version that supports tunneling\n");
1477 }
1478
1479 session.peername = peer;
1480 session.retries = retries; /* 5 */
1481 session.timeout = timeout; /* 1000000L */
1482 session.contextNameLen = STRLEN(context);
when treating unknown const char * from netsnmp/client_intf.c:1462 as non-NULL
taking True path
1483 session.contextName = context;
1484 session.securityNameLen = STRLEN(sec_name);
when treating unknown const char * from netsnmp/client_intf.c:1462 as non-NULL
taking True path
1485 session.securityName = sec_name;
1486 session.securityLevel = sec_level;
1487 session.securityModel = NETSNMP_TSM_SECURITY_MODEL;
1488
1489 /* create the transport configuration store */
1490 if (!session.transport_configuration) {
when treating unknown struct netsnmp_container_s * from netsnmp/client_intf.c:1490 as non-NULL
taking False path
1491 netsnmp_container_init_list();
1492 session.transport_configuration =
1493 netsnmp_container_find("transport_configuration:fifo");
1494 if (!session.transport_configuration) {
1495 fprintf(stderr, "failed to initialize the transport configuration container\n");
1496 return NULL;
1497 }
1498
1499 session.transport_configuration->compare =
1500 (netsnmp_container_compare*)
1501 netsnmp_transport_config_compare;
1502 }
1503
1504 if (our_identity && our_identity[0] != '\0')
when treating unknown const char * from netsnmp/client_intf.c:1462 as non-NULL
taking True path
when considering range: -128 <= value <= -1
taking True path
1505 CONTAINER_INSERT(session.transport_configuration,
1506 netsnmp_transport_create_config("localCert",
1507 our_identity));
1508
1509 if (their_identity && their_identity[0] != '\0')
when treating unknown const char * from netsnmp/client_intf.c:1462 as non-NULL
taking True path
when considering range: -128 <= value <= -1
taking True path
1510 CONTAINER_INSERT(session.transport_configuration,
1511 netsnmp_transport_create_config("peerCert",
1512 their_identity));
1513
1514 if (their_hostname && their_hostname[0] != '\0')
when treating unknown const char * from netsnmp/client_intf.c:1462 as non-NULL
taking True path
when considering value == (char)0 from netsnmp/client_intf.c:1514
taking False path
1515 CONTAINER_INSERT(session.transport_configuration,
1516 netsnmp_transport_create_config("their_hostname",
1517 their_hostname));
1518
1519 if (trust_cert && trust_cert[0] != '\0')
when treating unknown const char * from netsnmp/client_intf.c:1462 as non-NULL
taking True path
when considering range: -128 <= value <= -1
taking True path
1520 CONTAINER_INSERT(session.transport_configuration,
1521 netsnmp_transport_create_config("trust_cert",
1522 trust_cert));
1523
1524 ss = snmp_sess_open(&session);
1525
1526 if (!ss)
when treating unknown void * from netsnmp/client_intf.c:1524 as NULL
taking True path
1527 return NULL;
1528 return Py_BuildValue("i", (int)ss);
1529 }
returning (PyObject*)NULL without setting an exception
found 6 similar trace(s) to this