Module: kamailio Branch: 5.3 Commit: 599ecd66399daca786c065ff49d76537ffd619ac URL: https://github.com/kamailio/kamailio/commit/599ecd66399daca786c065ff49d76537...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2020-10-30T14:44:48+01:00
permissions: exported allow_trusted() to kemi
- related to #2509
(cherry picked from commit 843b22b4efb0d343f13230d6e90d2484f370dbdb) (cherry picked from commit 12ebd41d0dae516f39933eeabcda1919cb10b71e)
---
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/599ecd66399daca786c065ff49d76537... Patch: https://github.com/kamailio/kamailio/commit/599ecd66399daca786c065ff49d76537...
---
diff --git a/src/modules/permissions/permissions.c b/src/modules/permissions/permissions.c index f31cadfa23..e5e67c7af5 100644 --- a/src/modules/permissions/permissions.c +++ b/src/modules/permissions/permissions.c @@ -1047,6 +1047,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 0381646948..eee710915a 100644 --- a/src/modules/permissions/trusted.c +++ b/src/modules/permissions/trusted.c @@ -506,7 +506,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]; @@ -529,6 +529,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 d8dfae047c..9a1e4866ed 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