diff options
Diffstat (limited to 'squark-auth.c')
-rw-r--r-- | squark-auth.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/squark-auth.c b/squark-auth.c index 73f9e0f..88f4d61 100644 --- a/squark-auth.c +++ b/squark-auth.c @@ -90,7 +90,7 @@ struct switch_info; static int num_queries = 0, running = TRUE; -static const char *snmp_community = "public"; +static const char *snmp_community = NULL; static const char *username_format = "%w"; static struct switch_info *all_switches[SWITCH_HASH_SIZE]; static struct switch_info *l3_root_dev, *l2_root_dev; @@ -524,9 +524,11 @@ struct switch_info *get_switch(sockaddr_any *addr) addr_copy(&si->addr, addr); snmp_sess_init(&config); - config.version = SNMP_VERSION_2c; - config.community = (unsigned char *) snmp_community; - config.community_len = strlen(snmp_community); + if (snmp_community != NULL) { + config.version = SNMP_VERSION_2c; + config.community = (unsigned char *) snmp_community; + config.community_len = strlen(snmp_community); + } config.peername = (char *) addr_print(addr); si->session = snmp_open(&config); @@ -1176,6 +1178,9 @@ int main(int argc, char **argv) fd_set fdset; int opt, fds, block; + setenv("MIBS", "", 1); + init_snmp("squark-auth"); + while ((opt = getopt(argc, argv, "c:r:i:R:v:f:T:")) != -1) { switch (opt) { case 'c': |