Module: kamailio
Branch: 5.4
Commit: 12ebd41d0dae516f39933eeabcda1919cb10b71e
URL:
https://github.com/kamailio/kamailio/commit/12ebd41d0dae516f39933eeabcda191…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-10-23T10:56:02+02:00
permissions: exported allow_trusted() to kemi
- related to #2509
(cherry picked from commit 843b22b4efb0d343f13230d6e90d2484f370dbdb)
---
Modified: src/modules/permissions/permissions.c
Modified: src/modules/permissions/trusted.c
Modified: src/modules/permissions/trusted.h
---
Diff:
https://github.com/kamailio/kamailio/commit/12ebd41d0dae516f39933eeabcda191…
Patch:
https://github.com/kamailio/kamailio/commit/12ebd41d0dae516f39933eeabcda191…
---
diff --git a/src/modules/permissions/permissions.c
b/src/modules/permissions/permissions.c
index 18cf398f8f..be22963d81 100644
--- a/src/modules/permissions/permissions.c
+++ b/src/modules/permissions/permissions.c
@@ -1058,6 +1058,11 @@ static sr_kemi_t sr_kemi_permissions_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init("permissions"), str_init("allow_trusted"),
+ SR_KEMIP_INT, ki_allow_trusted,
+ { SR_KEMIP_NONE, 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 } }
};
diff --git a/src/modules/permissions/trusted.c b/src/modules/permissions/trusted.c
index eed1041581..2f9c7d42a4 100644
--- a/src/modules/permissions/trusted.c
+++ b/src/modules/permissions/trusted.c
@@ -507,7 +507,7 @@ int allow_trusted(struct sip_msg* msg, char *src_ip, int proto, char
*from_uri)
* Checks based on request's source address, protocol, and From URI
* if request can be trusted without authentication.
*/
-int allow_trusted_0(struct sip_msg* _msg, char* str1, char* str2)
+int ki_allow_trusted(sip_msg_t* _msg)
{
str furi;
char furi_string[MAX_URI_SIZE+1];
@@ -530,6 +530,15 @@ int allow_trusted_0(struct sip_msg* _msg, char* str1, char* str2)
furi_string);
}
+/*
+ * Checks based on request's source address, protocol, and From URI
+ * if request can be trusted without authentication.
+ */
+int allow_trusted_0(struct sip_msg* _msg, char* str1, char* str2)
+{
+ return ki_allow_trusted(_msg);
+}
+
/*
* Checks based on source address and protocol given in pvar arguments and
* provided uri, if request can be trusted without authentication.
diff --git a/src/modules/permissions/trusted.h b/src/modules/permissions/trusted.h
index 8a8ab2cc11..72da2d70e7 100644
--- a/src/modules/permissions/trusted.h
+++ b/src/modules/permissions/trusted.h
@@ -55,6 +55,10 @@ int reload_trusted_table(void);
*/
void clean_trusted(void);
+/*
+ * Check if request comes from trusted ip address with matching from URI
+ */
+int ki_allow_trusted(sip_msg_t* _msg);
/*
* Check if request comes from trusted ip address with matching from URI