]> sjero.net Git - linphone/commitdiff
add sal_cancel_auth method
authorJehan Monnier <jehan.monnier@linphone.org>
Wed, 9 Feb 2011 07:10:26 +0000 (08:10 +0100)
committerJehan Monnier <jehan.monnier@linphone.org>
Wed, 9 Feb 2011 07:10:26 +0000 (08:10 +0100)
coreapi/callbacks.c
coreapi/sal.h
coreapi/sal_eXosip2.c

index 62cf0083557ee8f67a2bddeaf1f2099022b3db00..28b9803120567d1f4b5a7799f8aee70915a029de 100644 (file)
@@ -524,7 +524,7 @@ static void auth_requested(SalOp *h, const char *realm, const char *username){
                ai->usecount++;
        }else{
                if (ai && ai->works==FALSE) {
-                       register_failure(h, SalErrorFailure, SalReasonForbidden, _("Authentication failure"));
+                       sal_op_cancel_authentication(h);
                } 
                if (lc->vtable.auth_info_requested)
                        lc->vtable.auth_info_requested(lc,realm,username);
index 24cc8582ab9c06bf866aacf3dab528512bfc4915..6df3b7646f933747def21b5f48e86b6aa9778876 100644 (file)
@@ -273,6 +273,7 @@ void sal_op_set_from(SalOp *op, const char *from);
 void sal_op_set_to(SalOp *op, const char *to);
 void sal_op_release(SalOp *h);
 void sal_op_authenticate(SalOp *h, const SalAuthInfo *info);
+void sal_op_cancel_authentication(SalOp *h);
 void sal_op_set_user_pointer(SalOp *h, void *up);
 int sal_op_get_auth_requested(SalOp *h, const char **realm, const char **username);
 const char *sal_op_get_from(const SalOp *op);
index 5c65cf80a1b761c789d9d6ee8dbd04e94bcf7f00..61c7c494d036d20041bb0c8f494bc1c5a8836561 100644 (file)
@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #endif
 
 #include "sal_eXosip2.h"
-
+#include "private.h"
 #include "offeranswer.h"
 
 static void text_received(Sal *sal, eXosip_event_t *ev);
@@ -793,7 +793,16 @@ void sal_op_authenticate(SalOp *h, const SalAuthInfo *info){
                h->auth_info=sal_auth_info_clone(info); /*store auth info for subsequent request*/
        }
 }
+void sal_op_cancel_authentication(SalOp *h) {
+       if (h->rid >0) {
+               sal_op_get_sal(h)->callbacks.register_failure(h,SalErrorFailure, SalReasonForbidden,_("Authentication failure"));
+       } else if (h->cid >0) {
+               sal_op_get_sal(h)->callbacks.call_failure(h,SalErrorFailure, SalReasonForbidden,_("Authentication failure"),0);
+       } else {
+               ms_warning("Auth failure not handled");
+       }
 
+}
 static void set_network_origin(SalOp *op, osip_message_t *req){
        const char *received=NULL;
        int rport=5060;