Merge branch 'V5-4-patches' into V5-5-patches
* V5-4-patches:
Simplify snmpTargetAddr_rowStatusCheck()
testing/fulltests/default/T068execfix_simple: Simplify
CHANGES: Win32: perl: BUG: 2488: Avoid "Free to wrong pool" error
CHANGES: perl: BUG: 2402: Add support for SNMPv3 traps
Conflicts:
agent/mibgroup/target/snmpTargetAddrEntry.c
diff --git a/agent/mibgroup/target/snmpTargetAddrEntry.c b/agent/mibgroup/target/snmpTargetAddrEntry.c
index 17b9a45..52f77b4 100644
--- a/agent/mibgroup/target/snmpTargetAddrEntry.c
+++ b/agent/mibgroup/target/snmpTargetAddrEntry.c
@@ -257,18 +257,14 @@
/*
- * snmpTargetAddr_rowStatusCheck is boolean funciton that checks
+ * snmpTargetAddr_rowStatusCheck is boolean function that checks
* the status of a row's values in order to determine whether
- * the row should be notReady or notInService
+ * the row should be notReady or notInService.
*/
-int
-snmpTargetAddr_rowStatusCheck(struct targetAddrTable_struct *entry)
+static int
+snmpTargetAddr_rowStatusCheck(const struct targetAddrTable_struct *entry)
{
- if ((entry->tDomainLen == 0) || (entry->tAddress == NULL) ||
- (entry->params == NULL))
- return 0;
- else
- return 1;
+ return entry->tDomainLen && entry->tAddress && entry->params;
} /* snmtpTargetAddrTable_rowStatusCheck */
diff --git a/perl/SNMP/SNMP.pm b/perl/SNMP/SNMP.pm
index 58ca690..a79cb91 100644
--- a/perl/SNMP/SNMP.pm
+++ b/perl/SNMP/SNMP.pm
@@ -1158,7 +1158,7 @@
my $specific = $param{specific} || 0;
@res = SNMP::_trapV1($this, $enterprise, $agent, $generic, $specific,
$uptime, $varbind_list_ref);
- } elsif (($this->{Version} eq '2')|| ($this->{Version} eq '2c')) {
+ } elsif ($this->{Version} =~ '^[23]') {
my $trap_oid = $param{oid} || $param{trapoid} || '.0.0';
my $uptime = $param{uptime} || SNMP::_sys_uptime();
@res = SNMP::_trapV2($this, $uptime, $trap_oid, $varbind_list_ref);
diff --git a/perl/SNMP/SNMP.xs b/perl/SNMP/SNMP.xs
index 3fe4f8d..4a1f502 100644
--- a/perl/SNMP/SNMP.xs
+++ b/perl/SNMP/SNMP.xs
@@ -941,7 +941,7 @@
if (!soid_str || !*soid_str) return SUCCESS;/* successfully added nothing */
if (*soid_str == '.') soid_str++;
- soid_buf = strdup(soid_str);
+ soid_buf = netsnmp_strdup(soid_str);
if (!soid_buf)
return FAILURE;
cp = strtok_r(soid_buf,".",&st);
@@ -950,7 +950,7 @@
/* doid_arr[(*doid_arr_len)++] = atoi(cp); */
cp = strtok_r(NULL,".",&st);
}
- free(soid_buf);
+ netsnmp_free(soid_buf);
return(SUCCESS);
}
diff --git a/testing/tests/T068execfix b/testing/tests/T068execfix
index c319a89..f49206e 100644
--- a/testing/tests/T068execfix
+++ b/testing/tests/T068execfix
@@ -22,20 +22,13 @@
# Begin test
#
if [ "x$OSTYPE" = xmsys ]; then
- cmd1="echo null"
+ cmd1="true"
cmd2="false"
- output1="null"
echo="echo"
else
- if which /bin/true >/dev/null; then
- cmd1="/bin/true"
- cmd2="/bin/false"
- else
- cmd1="/usr/bin/true"
- cmd2="/usr/bin/false"
- fi
- output1=""
- echo=/bin/echo
+ cmd1="$(which true)"
+ cmd2="$(which false)"
+ echo="$(which echo)"
fi
CONFIGAGENT exec true-command $cmd1
CONFIGAGENT execfix true-command $cmd1
@@ -51,7 +44,7 @@
CHECK 'UCD-SNMP-MIB::extNames.1 = STRING: true-command$'
CHECK 'UCD-SNMP-MIB::extCommand.1 = STRING: '"$cmd1"
CHECK 'UCD-SNMP-MIB::extResult.1 = INTEGER: 0$'
-CHECK 'UCD-SNMP-MIB::extOutput.1 = STRING: '"$output1"'$'
+CHECK 'UCD-SNMP-MIB::extOutput.1 = STRING: $'
CHECK 'UCD-SNMP-MIB::extErrFix.1 = INTEGER: noError(0)$'
CHECK 'UCD-SNMP-MIB::extErrFixCmd.1 = STRING: '"$cmd1"
CHECK 'UCD-SNMP-MIB::extNames.2 = STRING: false-command$'