Module: kamailio
Branch: master
Commit: 18e4d38e4d57ce88cbe16eec4cfb2a5a1b5554a4
URL:
https://github.com/kamailio/kamailio/commit/18e4d38e4d57ce88cbe16eec4cfb2a5…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-05-14T18:13:04+02:00
auth: export auth_algorithm(...) to kemi
---
Modified: src/modules/auth/auth_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/18e4d38e4d57ce88cbe16eec4cfb2a5…
Patch:
https://github.com/kamailio/kamailio/commit/18e4d38e4d57ce88cbe16eec4cfb2a5…
---
diff --git a/src/modules/auth/auth_mod.c b/src/modules/auth/auth_mod.c
index b2854d468bf..2fcb9169f26 100644
--- a/src/modules/auth/auth_mod.c
+++ b/src/modules/auth/auth_mod.c
@@ -488,12 +488,9 @@ int w_has_credentials(sip_msg_t *msg, char *realm, char *s2)
/**
*
*/
-int w_auth_algorithm(sip_msg_t *msg, char *alg, char *s2)
+static int ki_auth_algorithm(sip_msg_t *msg, str *alg)
{
- if(fixup_get_svalue(msg, (gparam_t *)alg, &auth_algorithm) < 0) {
- LM_ERR("failed to get algorithm value\n");
- return -1;
- }
+ auth_algorithm = *alg;
if(strcmp(auth_algorithm.s, "MD5") == 0) {
hash_hex_len = HASHHEXLEN;
@@ -512,6 +509,21 @@ int w_auth_algorithm(sip_msg_t *msg, char *alg, char *s2)
return 1;
}
+/**
+ *
+ */
+int w_auth_algorithm(sip_msg_t *msg, char *alg, char *s2)
+{
+ str salg = str_init("");
+
+ if(fixup_get_svalue(msg, (gparam_t *)alg, &salg) < 0) {
+ LM_ERR("failed to get algorithm value\n");
+ return -1;
+ }
+
+ return ki_auth_algorithm(msg, &salg);
+}
+
#ifdef USE_NC
/**
* Calls auth_check_hdr_md5 with the update_nonce flag set to false.
@@ -1384,6 +1396,11 @@ static sr_kemi_t sr_kemi_auth_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_STR,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init("auth"), str_init("auth_algorithm"),
+ SR_KEMIP_INT, ki_auth_algorithm,
+ { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
};