comparison extensions/app_sip/multimediaauth.c @ 368:a1f26147ec61

Corrected bugs on app_sip and rgwx_sip
author Alexandre Westfahl <awestfahl@freediameter.net>
date Sat, 03 Jul 2010 00:40:00 +0900
parents da11085cf6d9
children c2fb5b26bfcb
comparison
equal deleted inserted replaced
367:a2c268b2d8fe 368:a1f26147ec61
34 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 34 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
35 *********************************************************************************************************/ 35 *********************************************************************************************************/
36 #include "diamsip.h" 36 #include "diamsip.h"
37 37
38 38
39 int diamsip_MAR_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act) 39 int diamsip_MAR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, enum disp_action * act)
40 { 40 {
41 struct msg *ans, *qry; 41 struct msg *ans, *qry;
42 struct avp *a2, *authdataitem; 42 struct avp *avp, *a2, *authdataitem;
43 struct msg_hdr * header = NULL; 43 struct msg_hdr * header = NULL;
44 struct avp_hdr * avphdr=NULL, *avpheader=NULL, *avpheader_auth=NULL,*digestheader=NULL; 44 struct avp_hdr * avphdr=NULL, *avpheader=NULL, *avpheader_auth=NULL,*digestheader=NULL;
45 union avp_value val; 45 union avp_value val;
46 int found_cnonce=0; 46 int found_cnonce=0;
47 struct avp * tempavp=NULL,*sipAuthentication=NULL,*sipAuthenticate=NULL; 47 struct avp * tempavp=NULL,*sipAuthentication=NULL,*sipAuthenticate=NULL;
48 char * result; 48 char * result;
49 char password[51]; 49 char password[51];
50 int idx=0, idx2=0, number_of_auth_items=0,i=0;; 50 int idx=0, idx2=0, number_of_auth_items=0,i=0;
51 //Flags and variables for Database 51 //Flags and variables for Database
52 int sipurinotstored=0, authenticationpending=0, querylen=0, usernamelen=0; 52 int sipurinotstored=0, authenticationpending=0, querylen=0, usernamelen=0;
53 char *query=NULL,*username=NULL; 53 char *query=NULL,*username=NULL;
54 54
55 //The nonce we will store and retrieve in session 55 //The nonce we will store and retrieve in session
79 79
80 80
81 /* Add the Auth-Application-Id */ 81 /* Add the Auth-Application-Id */
82 { 82 {
83 CHECK_FCT( fd_msg_avp_new ( sip_dict.Auth_Application_Id, 0, &avp ) ); 83 CHECK_FCT( fd_msg_avp_new ( sip_dict.Auth_Application_Id, 0, &avp ) );
84 ASSERT(avp);
84 val.i32 = header->msg_appl; 85 val.i32 = header->msg_appl;
85 CHECK_FCT( fd_msg_avp_setvalue ( avp, &val ) ); 86 CHECK_FCT( fd_msg_avp_setvalue ( avp, &val ) );
86 CHECK_FCT( fd_msg_avp_add ( ans, MSG_BRW_LAST_CHILD, avp) ); 87 CHECK_FCT( fd_msg_avp_add ( ans, MSG_BRW_LAST_CHILD, avp) );
87 } 88 }
88 } 89 }
667 668
668 } 669 }
669 //We calculate Digest_Response_Auth 670 //We calculate Digest_Response_Auth
670 DigestCalcResponseAuth(HA1, digest_nonce, digest_noncecount, digest_cnonce, digest_qop,digest_method, digest_uri, HA2, responseauth); 671 DigestCalcResponseAuth(HA1, digest_nonce, digest_noncecount, digest_cnonce, digest_qop,digest_method, digest_uri, HA2, responseauth);
671 672
672 673 TRACE_DEBUG(FULL,"Response calculated by Diameter server:%s",response);
674 TRACE_DEBUG(FULL,"Response calculated by UA:%s",digest_response);
673 if(strcmp(digest_qop,"auth-int")==0) 675 if(strcmp(digest_qop,"auth-int")==0)
674 { 676 {
675 //Digest-HA1 MUST be used instead of Digest-Response-Auth if Digest-Qop is 'auth-int'. 677 //Digest-HA1 MUST be used instead of Digest-Response-Auth if Digest-Qop is 'auth-int'.
676 CHECK_FCT( fd_msg_avp_new ( sip_dict.Digest_HA1, 0, &a2 ) ); 678 CHECK_FCT( fd_msg_avp_new ( sip_dict.Digest_HA1, 0, &a2 ) );
677 val.os.data=HA1; 679 val.os.data=HA1;
"Welcome to our mercurial repository"