Module: kamailio
Branch: master
Commit: fb1f6397cd58b8186558bfb719f73d9765281ff2
URL: 
https://github.com/kamailio/kamailio/commit/fb1f6397cd58b8186558bfb719f73d9765281ff2

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-12-16T09:32:12+01:00

auth: export pv_www/proxy_authenticate(...) to kemi

- GH #4067

---

Modified: src/modules/auth/auth_mod.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/fb1f6397cd58b8186558bfb719f73d9765281ff2.diff
Patch: 
https://github.com/kamailio/kamailio/commit/fb1f6397cd58b8186558bfb719f73d9765281ff2.patch

---

diff --git a/src/modules/auth/auth_mod.c b/src/modules/auth/auth_mod.c
index 9407c415bd2..cf0ede401c8 100644
--- a/src/modules/auth/auth_mod.c
+++ b/src/modules/auth/auth_mod.c
@@ -686,6 +686,16 @@ int pv_authenticate(struct sip_msg *msg, str *realm, str 
*passwd, int flags,
        return ret;
 }
 
+/**
+ *
+ */
+static int ki_pv_proxy_authenticate(
+               sip_msg_t *msg, str *realm, str *passwd, int flags)
+{
+       return pv_authenticate(msg, realm, passwd, flags, HDR_PROXYAUTH_T,
+                       &msg->first_line.u.request.method);
+}
+
 /**
  *
  */
@@ -727,6 +737,26 @@ static int pv_proxy_authenticate(
        return AUTH_ERROR;
 }
 
+/**
+ *
+ */
+static int ki_pv_www_authenticate(
+               sip_msg_t *msg, str *realm, str *passwd, int flags)
+{
+       return pv_authenticate(msg, realm, passwd, flags, HDR_AUTHORIZATION_T,
+                       &msg->first_line.u.request.method);
+}
+
+/**
+ *
+ */
+static int ki_pv_www_authenticate_method(
+               sip_msg_t *msg, str *realm, str *passwd, int flags, str *method)
+{
+       return pv_authenticate(
+                       msg, realm, passwd, flags, HDR_AUTHORIZATION_T, method);
+}
+
 /**
  *
  */
@@ -1403,6 +1433,21 @@ static sr_kemi_t sr_kemi_auth_exports[] = {
                { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_INT,
                        SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE }
        },
+       { str_init("auth"), str_init("pv_proxy_authenticate"),
+               SR_KEMIP_INT, ki_pv_proxy_authenticate,
+               { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_INT,
+                       SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+       },
+       { str_init("auth"), str_init("pv_www_authenticate"),
+               SR_KEMIP_INT, ki_pv_www_authenticate,
+               { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_INT,
+                       SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+       },
+       { str_init("auth"), str_init("pv_www_authenticate_method"),
+               SR_KEMIP_INT, ki_pv_www_authenticate_method,
+               { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_INT,
+                       SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE }
+       },
        { str_init("auth"), str_init("has_credentials"),
                SR_KEMIP_INT, ki_has_credentials,
                { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to