summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-06-13 22:25:05 +0000
committerBenny Prijono <bennylp@teluu.com>2006-06-13 22:25:05 +0000
commit94e741d055535156504bfbb182c8b63412299fb9 (patch)
tree9bbdcab59c969c7c69aaee029eb89e02504bbe78 /pjsip
parent3ce16e8a22d2e8e11a749902c621673f87f187be (diff)
Fixed bugs in client authentication: (1)tx_data in reinit_req() is not invalidated, and (2)caching caused multiple identical authorization headers to be sent in one request
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@502 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/src/pjsip/sip_auth_client.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/pjsip/src/pjsip/sip_auth_client.c b/pjsip/src/pjsip/sip_auth_client.c
index 1c2a5570..20e18710 100644
--- a/pjsip/src/pjsip/sip_auth_client.c
+++ b/pjsip/src/pjsip/sip_auth_client.c
@@ -610,16 +610,19 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_init_req( pjsip_auth_clt_sess *sess,
pjsip_authorization_hdr *hauth;
hauth = pjsip_hdr_shallow_clone(tdata->pool, entry->hdr);
pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)hauth);
- } else {
-# if defined(PJSIP_AUTH_AUTO_SEND_NEXT) && \
- PJSIP_AUTH_AUTO_SEND_NEXT!=0
- {
- new_auth_for_req( tdata, sess, auth, NULL);
- }
-# endif
+ break;
}
entry = entry->next;
}
+
+# if defined(PJSIP_AUTH_AUTO_SEND_NEXT) && \
+ PJSIP_AUTH_AUTO_SEND_NEXT!=0
+ {
+ if (entry == &auth->cached_hdr)
+ new_auth_for_req( tdata, sess, auth, NULL);
+ }
+# endif
+
}
# elif defined(PJSIP_AUTH_AUTO_SEND_NEXT) && \
PJSIP_AUTH_AUTO_SEND_NEXT!=0
@@ -825,6 +828,9 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_reinit_req( pjsip_auth_clt_sess *sess,
via = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL);
via->branch_param.slen = 0;
+ /* Must invalidate the message! */
+ pjsip_tx_data_invalidate_msg(tdata);
+
/* Increment reference counter. */
pjsip_tx_data_add_ref(tdata);