From be15ed423f92923565dbd4acdf4056193a489754 Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 24 Feb 2009 14:46:03 +0000 Subject: [PATCH] Tue Feb 24 07:33:35 CST 2009 Pekka Pessi * sip_parser.c: fixed sip_transport_d() Ignore-this: c14408145a269c25d00dcb20ab2391f6 sip_transport_d() was expected to canonize casing of well-known transports. Thanks for Adrian Gschwend for reporting the problem. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12261 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/sofia-sip/.update | 2 +- .../libsofia-sip-ua/sip/sip_parser.c | 5 ++-- .../libsofia-sip-ua/sip/torture_sip.c | 27 ++++++++++++++++++- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 00f62a4bd1..d2f7835f44 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Tue Feb 24 08:43:18 CST 2009 +Tue Feb 24 08:44:37 CST 2009 diff --git a/libs/sofia-sip/libsofia-sip-ua/sip/sip_parser.c b/libs/sofia-sip/libsofia-sip-ua/sip/sip_parser.c index de0fd055d7..2982df537d 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sip/sip_parser.c +++ b/libs/sofia-sip/libsofia-sip-ua/sip/sip_parser.c @@ -459,8 +459,9 @@ issize_t sip_transport_d(char **ss, char const **ttransport) size_t pn_len, pv_len, pt_len; char *s = *ss; -#define TRANSPORT_MATCH(t) \ - (su_casenmatch(s + 7, t + 7, (sizeof t) - 8) && (IS_LWS(s[sizeof(t)])) \ +#define TRANSPORT_MATCH(t) \ + (su_casenmatch(s + 7, t + 7, (sizeof t) - 8) && \ + (!s[sizeof(t) - 1] || IS_LWS(s[sizeof(t) - 1])) \ && (transport = t, s += sizeof(t) - 1)) if (!su_casenmatch(s, "SIP/2.0", 7) || diff --git a/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c b/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c index 7c79310dd7..2927380728 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c +++ b/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c @@ -710,6 +710,31 @@ int test_basic(void) su_free(home, v), su_free(home, s); } + { + char *input; + char const *output = NULL; + char udp[] = "sip/2.0/udp"; + char tcp[] = "sip/2.0/tCp "; + char sctp[] = "sip/2.0/sctp\t"; + char tls[] = "sip/2.0/tls\r"; + + input = udp; + TEST(sip_transport_d(&input, &output), 0); + TEST_S(output, "SIP/2.0/UDP"); + + input = tcp; + TEST(sip_transport_d(&input, &output), 0); + TEST_S(output, "SIP/2.0/TCP"); + + input = sctp; + TEST(sip_transport_d(&input, &output), 0); + TEST_S(output, "SIP/2.0/SCTP"); + + input = tls; + TEST(sip_transport_d(&input, &output), 0); + TEST_S(output, "SIP/2.0/TLS"); + } + { sip_expires_t *ex; @@ -2323,7 +2348,7 @@ static int test_www_authenticate(void) TEST_S(www->au_scheme, "Kerberos"); TEST_1(www = www->au_next); TEST_S(www->au_scheme, "NTLM"); - + msg_destroy(msg); END();