[Git][NTPsec/ntpsec][master] Correct SNMP INTEGER value to be signed

Ian Bruene gitlab at mg.gitlab.com
Thu Oct 26 21:54:55 UTC 2017


Ian Bruene pushed to branch master at NTPsec / ntpsec


Commits:
c7f4f9e1 by Ian Bruene at 2017-10-26T16:50:44-05:00
Correct SNMP INTEGER value to be signed

- - - - -


1 changed file:

- pylib/agentx.py


Changes:

=====================================
pylib/agentx.py
=====================================
--- a/pylib/agentx.py
+++ b/pylib/agentx.py
@@ -1006,6 +1006,11 @@ def decode_integer32(data, header):
 
 
 def sanity_integer32(data):
+    if type(data) is not int:
+        raise TypeError
+
+
+def sanity_unsigned32(data):
     if data != (data & 0xFFFFFFFF):
         raise ValueError
 
@@ -1332,13 +1337,13 @@ definedValueTypes = {  # Used by the varbind functions
     VALUE_IP_ADDR: (sanity_ipaddr,
                     encode_ipaddr,
                     decode_ipaddr),
-    VALUE_COUNTER32: (sanity_integer32,
+    VALUE_COUNTER32: (sanity_unsigned32,
                       encode_integer32,
                       decode_integer32),
-    VALUE_GAUGE32: (sanity_integer32,
+    VALUE_GAUGE32: (sanity_unsigned32,
                     encode_integer32,
                     decode_integer32),
-    VALUE_TIME_TICKS: (sanity_integer32,
+    VALUE_TIME_TICKS: (sanity_unsigned32,
                        encode_integer32,
                        decode_integer32),
     VALUE_OPAQUE: (sanity_octetstr,



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/c7f4f9e1743181069cc6b1fd8a37f3408e32a0f5

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/c7f4f9e1743181069cc6b1fd8a37f3408e32a0f5
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20171026/e7ff4649/attachment.html>


More information about the vc mailing list