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

Author: Federico Cabiddu <federico.cabi...@gmail.com>
Committer: Federico Cabiddu <federico.cabi...@gmail.com>
Date: 2024-11-20T14:19:11+01:00

crypto: add fixup_free function

---

Modified: src/modules/crypto/crypto_mod.c

---

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

---

diff --git a/src/modules/crypto/crypto_mod.c b/src/modules/crypto/crypto_mod.c
index f3e644000f9..84f70813602 100644
--- a/src/modules/crypto/crypto_mod.c
+++ b/src/modules/crypto/crypto_mod.c
@@ -69,6 +69,7 @@ static int w_crypto_nio_decrypt(sip_msg_t *msg, char *p1, 
char *p2);
 static int w_crypto_hmac_sha256(
                sip_msg_t *msg, char *inb, char *keyb, char *outb);
 static int fixup_crypto_hmac(void **param, int param_no);
+static int fixup_free_crypto_hmac(void **param, int param_no);
 
 static char *_crypto_salt_param = "k8hTm4aZ";
 
@@ -95,7 +96,7 @@ static cmd_export_t cmds[] = {
                {"crypto_netio_decrypt", (cmd_function)w_crypto_nio_decrypt, 0, 
0, 0,
                                ANY_ROUTE},
                {"crypto_hmac_sha256", (cmd_function)w_crypto_hmac_sha256, 3,
-                               fixup_crypto_hmac, 0, ANY_ROUTE},
+                               fixup_crypto_hmac, fixup_free_crypto_hmac, 
ANY_ROUTE},
                {"load_crypto", (cmd_function)load_crypto, 0, 0, 0, 0},
                {0, 0, 0, 0, 0, 0}};
 
@@ -451,6 +452,19 @@ static int fixup_crypto_hmac(void **param, int param_no)
        return 0;
 }
 
+/**
+ *
+ */
+static int fixup_free_crypto_hmac(void **param, int param_no)
+{
+       if(param_no == 1 || param_no == 2) {
+               fixup_free_spve_null(param, 1);
+       } else if(param_no == 3) {
+               fixup_free_pvar_null(param, 1);
+       }
+       return 0;
+}
+
 /**
  *
  */

_______________________________________________
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