Ejemplo n.º 1
0
void
snmpd_parse_config_informsink(const char *word, char *cptr)
{
    char tmpbuf[1024];
    char *sp, *cp, *pp = NULL;
    u_short sinkport;
  
    if (!snmp_trapcommunity) snmp_trapcommunity = strdup("public");
    sp = strtok(cptr, " \t\n");
    cp = strtok(NULL, " \t\n");
    if (cp) pp = strtok(NULL, " \t\n");
    if (cp && pp) {
	sinkport = atoi(pp);
	if ((sinkport < 1) || (sinkport > 0xffff)) {
	    config_perror("trapsink port out of range");
	    sinkport = SNMP_TRAP_PORT;
	}
    } else {
	sinkport = SNMP_TRAP_PORT;
    }
    if (create_v2_inform_session(sp, sinkport,
				 cp ? cp : snmp_trapcommunity) == 0) {
	sprintf(tmpbuf,"cannot create informsink: %s", cptr);
	config_perror(tmpbuf);
    }
}
Ejemplo n.º 2
0
void
snmpd_parse_config_informsink(const char *word, char *cptr)
{
    char           *st, *sp, *cp, *pp = NULL;

    if (!snmp_trapcommunity)
        snmp_trapcommunity = strdup("public");
    sp = strtok_r(cptr, " \t\n", &st);
    cp = strtok_r(NULL, " \t\n", &st);
    if (cp)
        pp = strtok_r(NULL, " \t\n", &st);
    if (pp)
	config_pwarn("The separate port argument to informsink is deprecated");
    if (create_v2_inform_session(sp, pp, cp ? cp : snmp_trapcommunity) == 0) {
	netsnmp_config_error("cannot create informsink: %s", cptr);
    }
}
Ejemplo n.º 3
0
void
snmpd_parse_config_informsink(const char *word, char *cptr)
{
    char            tmpbuf[1024];
    char           *sp, *cp, *pp = NULL;
    int             sinkport;
    char            *st;

    if (!snmp_trapcommunity)
        snmp_trapcommunity = strdup("public");
    sp = strtok_r(cptr, " \t\n", &st);
    cp = strtok_r(NULL, " \t\n", &st);
    if (cp)
        pp = strtok_r(NULL, " \t\n", &st);
    if (pp)
	config_pwarn("The separate port argument to informsink is deprecated");
    if (create_v2_inform_session(sp, pp, cp ? cp : snmp_trapcommunity) == 0) {
        snprintf(tmpbuf, sizeof(tmpbuf), "cannot create informsink: %s", cptr);
        tmpbuf[sizeof(tmpbuf)-1] = '\0';
        config_perror(tmpbuf);
    }
}