From 11fb69b0b1fe3f0f50797b7502dd607e2918203f Mon Sep 17 00:00:00 2001 From: blackhedd Date: Tue, 19 Dec 2006 16:40:10 +0000 Subject: [PATCH] fixed mishandling of community string in parser --- tests/testsnmp.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/testsnmp.rb b/tests/testsnmp.rb index a5ad9ca..93cfb91 100644 --- a/tests/testsnmp.rb +++ b/tests/testsnmp.rb @@ -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" 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 end @@ -122,6 +124,13 @@ class TestSnmp < Test::Unit::TestCase assert_equal( "C\001d", t32.to_ber ) 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