kamailio: add patch fixing fragile kamcmd

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>
This commit is contained in:
Christian Marangi 2023-11-03 03:33:16 +01:00
parent 5f998af5ee
commit ceb721c048
No known key found for this signature in database
GPG key ID: AC001D09ADBFEAD7
2 changed files with 46 additions and 1 deletions

View 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

View file

@ -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