diff --git a/sflphone-common/test/sdesnegotiatorTest.cpp b/sflphone-common/test/sdesnegotiatorTest.cpp index 2db3fdff7..34ef4b778 100644 --- a/sflphone-common/test/sdesnegotiatorTest.cpp +++ b/sflphone-common/test/sdesnegotiatorTest.cpp @@ -122,6 +122,26 @@ void SdesNegotiatorTest::testKeyParamsPattern() pattern = NULL; } +void SdesNegotiatorTest::testKeyParamsPatternCiscoStyle() +{ + + std::string subject = "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj"; + + pattern = new sfl::Pattern("(?Pinline|[A-Za-z0-9_]+)\\:" \ + "(?P[A-Za-z0-9\x2B\x2F\x3D]+)" \ + "(\\|2\\^(?P[0-9]+)\\|" \ + "(?P[0-9]+)\\:" \ + "(?P[0-9]{1,3})\\;?)?", "g"); + + *pattern << subject; + pattern->matches(); + CPPUNIT_ASSERT(pattern->group("srtpKeyMethod").compare("inline:")); + CPPUNIT_ASSERT(pattern->group("srtpKeyInfo").compare("d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj") == 0); + + delete pattern; + pattern = NULL; +} + /** * Make sure that all the fields can be extracted * properly from the syntax. diff --git a/sflphone-common/test/sdesnegotiatorTest.h b/sflphone-common/test/sdesnegotiatorTest.h index 2a7b55222..e2fa00a54 100644 --- a/sflphone-common/test/sdesnegotiatorTest.h +++ b/sflphone-common/test/sdesnegotiatorTest.h @@ -65,6 +65,7 @@ class SdesNegotiatorTest : public CppUnit::TestCase { CPPUNIT_TEST( testTagPattern ); CPPUNIT_TEST( testCryptoSuitePattern ); CPPUNIT_TEST( testKeyParamsPattern ); + CPPUNIT_TEST( testKeyParamsPatternCiscoStyle ); CPPUNIT_TEST( testNegotiation ); // CPPUNIT_TEST( testComponent ); CPPUNIT_TEST_SUITE_END(); @@ -90,6 +91,8 @@ class SdesNegotiatorTest : public CppUnit::TestCase { void testCryptoSuitePattern(); void testKeyParamsPattern(); + + void testKeyParamsPatternCiscoStyle(); void testNegotiation();