kamailio: add patch fixing fragile kamcmd
authorChristian Marangi <ansuelsmth@gmail.com>
Fri, 3 Nov 2023 02:33:16 +0000 (03:33 +0100)
committerChristian Marangi <ansuelsmth@gmail.com>
Fri, 3 Nov 2023 02:33:16 +0000 (03:33 +0100)
Add patch fixing fragile kamcmd where output bin can be renamed to
invalid names due to ENV variable clash.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
net/kamailio/Makefile
net/kamailio/patches/100-kamcmd-don-t-clash-with-ENV-NAME-or-ctl.so-module.patch [new file with mode: 0644]

index e7502012067722d18ee90d4b159bd7863f19fd2b..cea0c6a2450fe2e5e2aa663ddb1f402b5d045ea2 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=kamailio
 PKG_VERSION:=5.6.2
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE_URL:=https://www.kamailio.org/pub/kamailio/$(PKG_VERSION)/src
 PKG_SOURCE:=kamailio-$(PKG_VERSION)_src.tar.gz
diff --git a/net/kamailio/patches/100-kamcmd-don-t-clash-with-ENV-NAME-or-ctl.so-module.patch b/net/kamailio/patches/100-kamcmd-don-t-clash-with-ENV-NAME-or-ctl.so-module.patch
new file mode 100644 (file)
index 0000000..893cf6a
--- /dev/null
@@ -0,0 +1,45 @@
+From 8421e2be8331a03b0087eb33241fac98e1fd821f Mon Sep 17 00:00:00 2001
+From: Christian Marangi <ansuelsmth@gmail.com>
+Date: Fri, 3 Nov 2023 03:09:21 +0100
+Subject: [PATCH] kamcmd: don't clash with ENV NAME or ctl.so module
+
+NAME variable might be set to the current HOSTNAME in some shell and
+also clash with the value set by the module calling MOD_INSTALL_UTILS by
+passing a NAME variable.
+
+With commit 1774cee62098 ("kamcmd: allow defining the name of the
+application from command line") this resulted in the kamcmd bin being
+renamed to all kind of name from hostname to ctl.so.
+
+Fix this by checking the variable to a more safe name that is not
+already defined in shell by default and also that doesn't clash with
+module variables, use UTIL_NAME as an alternative to NAME.
+
+UTIL_NAME now needs to be used to create kamcmd with custom name.
+
+Fixes: 1774cee62098 ("kamcmd: allow defining the name of the application from command line")
+Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+---
+ utils/kamcmd/Makefile | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+--- a/utils/kamcmd/Makefile
++++ b/utils/kamcmd/Makefile
+@@ -8,10 +8,15 @@ include $(COREPATH)/Makefile.targets
+ auto_gen=
+ RELEASE=1.5
+ UTIL_SRC_NAME=kamcmd
++# Pass CUSTOM_NAME to overwrite the kamcmd/sercmd bin name
++ifeq ($(CUSTOM_NAME),)
+ ifeq ($(FLAVOUR),ser)
+-      NAME?=sercmd
++      NAME=sercmd
+ else
+-      NAME?=kamcmd
++      NAME=kamcmd
++endif
++else
++      NAME=$(CUSTOM_NAME)
+ endif
+ readline_localpath=$(LOCALBASE)/include/readline/readline.h