Thu Jan 8 10:34:22 CST 2009 Pekka Pessi <first.last@nokia.com>

* sip_security.c: allow multiple WWW-Authenticate and Authorization headers



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11775 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2009-02-11 16:15:46 +00:00
parent f92b45a9fa
commit b3e2fcdbb5
3 changed files with 29 additions and 3 deletions

View File

@ -1 +1 @@
Wed Feb 11 10:14:53 CST 2009
Wed Feb 11 10:15:25 CST 2009

View File

@ -128,7 +128,7 @@
*/
msg_hclass_t sip_authorization_class[] =
SIP_HEADER_CLASS_AUTH(authorization, "Authorization", single);
SIP_HEADER_CLASS_AUTH(authorization, "Authorization", append);
issize_t sip_authorization_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
{
@ -309,7 +309,7 @@ issize_t sip_proxy_authorization_e(char b[], isize_t bsiz, sip_header_t const *h
*/
msg_hclass_t sip_www_authenticate_class[] =
SIP_HEADER_CLASS_AUTH(www_authenticate, "WWW-Authenticate", single);
SIP_HEADER_CLASS_AUTH(www_authenticate, "WWW-Authenticate", append);
issize_t sip_www_authenticate_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
{

View File

@ -128,6 +128,7 @@ static int test_identity(void)
sip = sip_object(msg);
TEST_1(sip);
TEST_1(!sip_alert_info(sip));
TEST_1(!sip_reply_to(sip));
TEST_1(!sip_p_asserted_identity(sip));
@ -2283,6 +2284,8 @@ static int test_www_authenticate(void)
sip_www_authenticate_t *www;
su_home_t *home;
char const *s;
msg_t *msg; sip_t *sip;
BEGIN();
TEST_1(home = su_home_create());
@ -2300,6 +2303,29 @@ static int test_www_authenticate(void)
TEST_1(strlen(s) >= 128);
su_home_unref(home);
TEST_1(
msg = read_message(
MSG_DO_EXTRACT_COPY,
"SIP/2.0 401 Unauthorized" "\r\n"
"Date: Wed, 07 Jan 2009 22:24:39 GMT" "\r\n"
"WWW-Authenticate: Kerberos realm=\"SIP Communications Service\", targetname=\"sip/OCS1.flux.local\", version=3" "\r\n"
"WWW-Authenticate: NTLM realm=\"SIP Communications Service\", targetname=\"OCS1.flux.local\", version=3" "\r\n"
"From: <sip:192.168.43.1:5069>;epid=1234567890;tag=48BXgr379e85j" "\r\n"
"To: <sip:1234@192.168.43.20:5061>;transport=tls;tag=B57737091022903031FF204696B79CC4" "\r\n"
"Call-ID: cf12f708-57ac-122c-ad90-6f23d7babf4f" "\r\n"
"CSeq: 109565202 REGISTER" "\r\n"
"Via: SIP/2.0/TLS 192.168.43.1:5069;branch=z9hG4bK47ZUrFK0v5eQa;received=192.168.43.1;ms-received-port=54059;ms-received-cid=E500" "\r\n"
"Content-Length: 0" "\r\n"));
TEST_1(sip = sip_object(msg));
TEST_1(www = sip->sip_www_authenticate);
TEST_S(www->au_scheme, "Kerberos");
TEST_1(www = www->au_next);
TEST_S(www->au_scheme, "NTLM");
msg_destroy(msg);
END();
}