[sr-dev] git:master: ims_auth: Fix crash, if the third parameter was ommited on ims_www_challenge.

Carsten Bock carsten at ng-voice.com
Thu Sep 11 11:37:22 CEST 2014


Module: sip-router
Branch: master
Commit: 81fbf1504548c0978f4e8f056df594f57d681e88
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=81fbf1504548c0978f4e8f056df594f57d681e88

Author: Carsten Bock <carsten at ng-voice.com>
Committer: Carsten Bock <carsten at ng-voice.com>
Date:   Thu Sep 11 11:17:43 2014 +0200

ims_auth: Fix crash, if the third parameter was ommited on ims_www_challenge.

---

 modules/ims_auth/authims_mod.c |    4 ++--
 modules/ims_auth/authorize.c   |    5 ++++-
 modules/ims_auth/authorize.h   |    3 ++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/modules/ims_auth/authims_mod.c b/modules/ims_auth/authims_mod.c
index 8d8afd1..dcdd421 100644
--- a/modules/ims_auth/authims_mod.c
+++ b/modules/ims_auth/authims_mod.c
@@ -112,8 +112,8 @@ int ignore_failed_auth = 0;
  */
 static cmd_export_t cmds[] = {
     {"ims_www_authenticate", (cmd_function) www_authenticate, 1, auth_fixup, 0, REQUEST_ROUTE},
-    {"ims_www_challenge", (cmd_function) www_challenge, 2, challenge_fixup_async, 0, REQUEST_ROUTE},
-    {"ims_www_challenge", (cmd_function) www_challenge, 3, challenge_fixup_async, 0, REQUEST_ROUTE},
+    {"ims_www_challenge", (cmd_function) www_challenge2, 2, challenge_fixup_async, 0, REQUEST_ROUTE},
+    {"ims_www_challenge", (cmd_function) www_challenge3, 3, challenge_fixup_async, 0, REQUEST_ROUTE},
     {"ims_www_resync_auth", (cmd_function) www_resync_auth, 2, challenge_fixup_async, 0, REQUEST_ROUTE},
     {"ims_proxy_authenticate", (cmd_function) proxy_authenticate, 1, auth_fixup, 0, REQUEST_ROUTE},
     {"ims_proxy_challenge", (cmd_function) proxy_challenge, 2, auth_fixup_async, 0, REQUEST_ROUTE},
diff --git a/modules/ims_auth/authorize.c b/modules/ims_auth/authorize.c
index bb93ffa..bebb4fc 100644
--- a/modules/ims_auth/authorize.c
+++ b/modules/ims_auth/authorize.c
@@ -476,8 +476,11 @@ int challenge(struct sip_msg* msg, char* str1, char* alg, int is_proxy_auth, cha
     }
     return CSCF_RETURN_BREAK;
 }
+int www_challenge2(struct sip_msg* msg, char* _route, char* str1, char* str2) {
+    return challenge(msg, str1, 0, 0, _route);
+}
 
-int www_challenge(struct sip_msg* msg, char* _route, char* str1, char* str2) {
+int www_challenge3(struct sip_msg* msg, char* _route, char* str1, char* str2) {
     return challenge(msg, str1, str2, 0, _route);
 }
 
diff --git a/modules/ims_auth/authorize.h b/modules/ims_auth/authorize.h
index 54942bb..41360b7 100644
--- a/modules/ims_auth/authorize.h
+++ b/modules/ims_auth/authorize.h
@@ -139,7 +139,8 @@ int proxy_challenge(struct sip_msg* msg, char* route, char* _realm, char* str2);
  * Authorize using WWW-Authorization header field
  */
 int www_authenticate(struct sip_msg* _msg, char* _realm, char* _table);
-int www_challenge(struct sip_msg* msg, char* route, char* _realm, char* str2);
+int www_challenge2(struct sip_msg* msg, char* route, char* _realm, char* str2);
+int www_challenge3(struct sip_msg* msg, char* route, char* _realm, char* str2);
 int www_resync_auth(struct sip_msg* msg, char* _route, char* str1, char* str2);
 
 




More information about the sr-dev mailing list