fixed mishandling of community string in parser
This commit is contained in:
parent
40b5554389
commit
11fb69b0b1
|
@ -14,6 +14,8 @@ class TestSnmp < Test::Unit::TestCase
|
||||||
SnmpGetRequest = "0'\002\001\000\004\006public\240\032\002\002?*\002\001\000\002\001\0000\0160\f\006\b+\006\001\002\001\001\001\000\005\000"
|
SnmpGetRequest = "0'\002\001\000\004\006public\240\032\002\002?*\002\001\000\002\001\0000\0160\f\006\b+\006\001\002\001\001\001\000\005\000"
|
||||||
SnmpGetResponse = "0+\002\001\000\004\006public\242\036\002\002'\017\002\001\000\002\001\0000\0220\020\006\b+\006\001\002\001\001\001\000\004\004test"
|
SnmpGetResponse = "0+\002\001\000\004\006public\242\036\002\002'\017\002\001\000\002\001\0000\0220\020\006\b+\006\001\002\001\001\001\000\004\004test"
|
||||||
|
|
||||||
|
SnmpGetRequestXXX = "0'\002\001\000\004\006xxxxxx\240\032\002\002?*\002\001\000\002\001\0000\0160\f\006\b+\006\001\002\001\001\001\000\005\000"
|
||||||
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
end
|
end
|
||||||
|
@ -122,6 +124,13 @@ class TestSnmp < Test::Unit::TestCase
|
||||||
assert_equal( "C\001d", t32.to_ber )
|
assert_equal( "C\001d", t32.to_ber )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_community
|
||||||
|
data = SnmpGetRequestXXX.dup
|
||||||
|
ary = data.read_ber(Net::SNMP::AsnSyntax)
|
||||||
|
pdu = Net::SnmpPdu.parse( ary )
|
||||||
|
assert_equal( "xxxxxx", pdu.community )
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue