Module: kamailio
Branch: master
Commit: cac73df6e2f90b6f6d8c051fb1e65c2d9ae01e0f
URL:
https://github.com/kamailio/kamailio/commit/cac73df6e2f90b6f6d8c051fb1e65c2…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-11-12T13:18:06+01:00
secsipid: added modparams to set url file cache options
---
Modified: src/modules/secsipid/libsecsipid.h
Modified: src/modules/secsipid/secsipid_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/cac73df6e2f90b6f6d8c051fb1e65c2…
Patch:
https://github.com/kamailio/kamailio/commit/cac73df6e2f90b6f6d8c051fb1e65c2…
---
diff --git a/src/modules/secsipid/libsecsipid.h b/src/modules/secsipid/libsecsipid.h
index 77cddcb5af..952e480e85 100644
--- a/src/modules/secsipid/libsecsipid.h
+++ b/src/modules/secsipid/libsecsipid.h
@@ -70,20 +70,19 @@ extern "C" {
// SecSIPIDSignJSONHP --
-
-extern int SecSIPIDSignJSONHP(char* p0, char* p1, char* p2, char** p3);
+extern int SecSIPIDSignJSONHP(char* headerJSON, char* payloadJSON, char* prvkeyPath,
char** outPtr);
// SecSIPIDGetIdentity --
-
-extern int SecSIPIDGetIdentity(char* p0, char* p1, char* p2, char* p3, char* p4, char*
p5, char** p6);
+extern int SecSIPIDGetIdentity(char* origTN, char* destTN, char* attestVal, char* origID,
char* x5uVal, char* prvkeyPath, char** outPtr);
// SecSIPIDCheck --
-
-extern int SecSIPIDCheck(char* p0, int p1, int p2, char* p3, int p4);
+extern int SecSIPIDCheck(char* identityVal, int identityLen, int expireVal, char*
pubkeyPath, int timeoutVal);
// SecSIPIDCheckFull --
+extern int SecSIPIDCheckFull(char* identityVal, int identityLen, int expireVal, char*
pubkeyPath, int timeoutVal);
-extern int SecSIPIDCheckFull(char* p0, int p1, int p2, char* p3, int p4);
+// SecSIPIDSetFileCacheOptions --
+extern int SecSIPIDSetFileCacheOptions(char* dirPath, int expireVal);
#ifdef __cplusplus
}
diff --git a/src/modules/secsipid/secsipid_mod.c b/src/modules/secsipid/secsipid_mod.c
index d3ad1c896e..bd757b173d 100644
--- a/src/modules/secsipid/secsipid_mod.c
+++ b/src/modules/secsipid/secsipid_mod.c
@@ -38,6 +38,9 @@ MODULE_VERSION
static int secsipid_expire = 300;
static int secsipid_timeout = 5;
+static int secsipid_cache_expire = 3600;
+static str secsipid_cache_dir = str_init("");
+
static int mod_init(void);
static int child_init(int);
static void mod_destroy(void);
@@ -57,8 +60,10 @@ static cmd_export_t cmds[]={
};
static param_export_t params[]={
- {"expire", PARAM_INT, &secsipid_expire},
- {"timeout", PARAM_INT, &secsipid_timeout},
+ {"expire", PARAM_INT, &secsipid_expire},
+ {"timeout", PARAM_INT, &secsipid_timeout},
+ {"cache_expire", PARAM_INT, &secsipid_cache_expire},
+ {"cache_dir", PARAM_STR, &secsipid_cache_dir},
{0, 0, 0}
};
@@ -127,6 +132,9 @@ static int ki_secsipid_check_identity(sip_msg_t *msg, str *keypath)
ibody = hf->body;
+ if(secsipid_cache_dir.len > 0) {
+ SecSIPIDSetFileCacheOptions(secsipid_cache_dir.s, secsipid_cache_expire);
+ }
ret = SecSIPIDCheckFull(ibody.s, ibody.len, secsipid_expire, keypath->s,
secsipid_timeout);
@@ -281,4 +289,4 @@ int mod_register(char *path, int *dlflags, void *p1, void *p2)
{
sr_kemi_modules_add(sr_kemi_secsipid_exports);
return 0;
-}
\ No newline at end of file
+}