Download | Plain Text | Line Numbers
diff -Naur a/lib/Net/SNMP.pm b/lib/Net/SNMP.pm
--- a/lib/Net/SNMP.pm 2011-12-24 00:41:27.000000000 +0100
+++ b/lib/Net/SNMP.pm 2012-02-21 13:17:04.000000000 +0100
@@ -2564,7 +2564,7 @@
if ($this->{_security}->discovered()) {
DEBUG_INFO('discovery complete');
- return $this->_discovery_complete();
+ $this->_discovery_complete();
}
# "If authenticated communication is required, then the discovery
@@ -2618,7 +2618,7 @@
# assume that the synchronization has failed.
if (($this->{_security}->discovered()) &&
- ($this->{_error} =~ /usmStatsNotInTimeWindows/))
+ ((!$this->{_error}) || ($this->{_error} =~ /usmStatsNotInTimeWindows/)))
{
$this->_error_clear();
DEBUG_INFO('discovery and synchronization complete');
diff -Naur a/lib/Net/SNMP/Security/USM.pm b/lib/Net/SNMP/Security/USM.pm
--- a/lib/Net/SNMP/Security/USM.pm 2011-12-24 00:41:27.000000000 +0100
+++ b/lib/Net/SNMP/Security/USM.pm 2012-02-21 13:20:47.000000000 +0100
@@ -471,6 +471,16 @@
);
}
+ # Synchronize the time
+ if (!$this->_synchronize($msg_engine_boots, $msg_engine_time)) {
+ return $this->_error();
+ }
+
+ # Check for timeliness
+ if (!defined $this->_timeliness($msg_engine_boots, $msg_engine_time)) {
+ return $this->_error();
+ }
+
if ($security_level > SECURITY_LEVEL_NOAUTHNOPRIV) {
# Authenticate the message
@@ -478,16 +488,6 @@
return $this->_error();
}
- # Synchronize the time
- if (!$this->_synchronize($msg_engine_boots, $msg_engine_time)) {
- return $this->_error();
- }
-
- # Check for timeliness
- if (!defined $this->_timeliness($msg_engine_boots, $msg_engine_time)) {
- return $this->_error();
- }
-
if ($security_level > SECURITY_LEVEL_AUTHNOPRIV) {
# Validate the msgPrivacyParameters length.