Browse Source

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

Carsten Bock 11 years ago
parent
commit
81fbf15045
3 changed files with 8 additions and 4 deletions
  1. 2 2
      modules/ims_auth/authims_mod.c
  2. 4 1
      modules/ims_auth/authorize.c
  3. 2 1
      modules/ims_auth/authorize.h

+ 2 - 2
modules/ims_auth/authims_mod.c

@@ -112,8 +112,8 @@ int ignore_failed_auth = 0;
  */
  */
 static cmd_export_t cmds[] = {
 static cmd_export_t cmds[] = {
     {"ims_www_authenticate", (cmd_function) www_authenticate, 1, auth_fixup, 0, REQUEST_ROUTE},
     {"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_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_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},
     {"ims_proxy_challenge", (cmd_function) proxy_challenge, 2, auth_fixup_async, 0, REQUEST_ROUTE},

+ 4 - 1
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;
     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);
     return challenge(msg, str1, str2, 0, _route);
 }
 }
 
 

+ 2 - 1
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
  * Authorize using WWW-Authorization header field
  */
  */
 int www_authenticate(struct sip_msg* _msg, char* _realm, char* _table);
 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);
 int www_resync_auth(struct sip_msg* msg, char* _route, char* str1, char* str2);