Replace hardcoded paths with configurable runstatedir
cover Replace hardcoded paths with configurable runstatedir
Add support for configurable $(runstatedir) with RUNSTATEDIR and replace hardcoded /var/run paths
Daniel Linjama (2):
build: Support configurable run dir with RUNSTATEDIR
vpn: Replace hardcoded paths with RUNSTATEDIR
Makefile.am | 2 ++ Makefile.plugins | 1 + vpn/plugins/vpnc.c | 2 +- vpn/vpn-util.c | 4 ++-- 4 files changed, 6 insertions(+), 3 deletions(-)
Signature · 1 line
2.35.1
PATCH 1/2 build: Support configurable run dir with RUNSTATEDIR
Add configurable $(runstatedir) to CFLAGS as RUNSTATEDIR
--- Makefile.am | 2 ++ Makefile.plugins | 1 + 2 files changed, 3 insertions(+)
Makefile.am +2 -0
@@ -243,6 +243,7 @@ AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ \ -DSCRIPTDIR=\""$(build_scriptdir)"\" \ -DSTORAGEDIR=\""$(storagedir)\"" \ -DVPN_STORAGEDIR=\""$(vpn_storagedir)\"" \ + -DRUNSTATEDIR=\""$(runstatedir)\"" \ -DCONFIGDIR=\""$(configdir)\"" if VPN
@@ -275,6 +276,7 @@ vpn_connman_vpnd_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ \ -DSCRIPTDIR=\""$(build_scriptdir)"\" \ -DSTORAGEDIR=\""$(storagedir)\"" \ -DVPN_STORAGEDIR=\""$(vpn_storagedir)\"" \ + -DRUNSTATEDIR=\""$(runstatedir)\"" \ -DCONFIGDIR=\""$(configdir)\"" \ -I$(builddir)/vpn
Makefile.plugins +1 -0
@@ -138,6 +138,7 @@ vpn_plugin_objects += $(plugins_vpnc_la_OBJECTS) vpn_plugins_vpnc_la_SOURCES = vpn/plugins/vpnc.c vpn_plugins_vpnc_la_CFLAGS = $(plugin_cflags) -DVPNC=\"@VPNC@\" \ -DVPN_STATEDIR=\""$(vpn_statedir)"\" \ + -DRUNSTATEDIR=\""$(runstatedir)"\" \ -DSCRIPTDIR=\""$(build_scriptdir)"\" vpn_plugins_vpnc_la_LDFLAGS = $(plugin_ldflags) endif
Signature · 1 line
2.35.1
PATCH v2 1/2 build: Support configurable run dir with RUNSTATEDIR
Add configurable $(runstatedir) to CFLAGS as RUNSTATEDIR
---
v1 -> v2:
- Changed quotes escaping from \""$(runstatedir)\"" -> \""$(runstatedir)"\"
Makefile.am | 2 ++ Makefile.plugins | 1 + 2 files changed, 3 insertions(+)
Makefile.am +2 -0
@@ -243,6 +243,7 @@ AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ \ -DSCRIPTDIR=\""$(build_scriptdir)"\" \ -DSTORAGEDIR=\""$(storagedir)\"" \ -DVPN_STORAGEDIR=\""$(vpn_storagedir)\"" \ + -DRUNSTATEDIR=\""$(runstatedir)"\" \ -DCONFIGDIR=\""$(configdir)\"" if VPN
@@ -275,6 +276,7 @@ vpn_connman_vpnd_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ \ -DSCRIPTDIR=\""$(build_scriptdir)"\" \ -DSTORAGEDIR=\""$(storagedir)\"" \ -DVPN_STORAGEDIR=\""$(vpn_storagedir)\"" \ + -DRUNSTATEDIR=\""$(runstatedir)"\" \ -DCONFIGDIR=\""$(configdir)\"" \ -I$(builddir)/vpn
Makefile.plugins +1 -0
@@ -138,6 +138,7 @@ vpn_plugin_objects += $(plugins_vpnc_la_OBJECTS) vpn_plugins_vpnc_la_SOURCES = vpn/plugins/vpnc.c vpn_plugins_vpnc_la_CFLAGS = $(plugin_cflags) -DVPNC=\"@VPNC@\" \ -DVPN_STATEDIR=\""$(vpn_statedir)"\" \ + -DRUNSTATEDIR=\""$(runstatedir)"\" \ -DSCRIPTDIR=\""$(build_scriptdir)"\" vpn_plugins_vpnc_la_LDFLAGS = $(plugin_ldflags) endif
Signature · 1 line
2.35.1
PATCH 2/2 vpn: Replace hardcoded paths with RUNSTATEDIR
In reply to Daniel LinjamaReplace hardcoded /var/run paths with configurable RUNSTATEDIR
--- vpn/plugins/vpnc.c | 2 +- vpn/vpn-util.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
vpn/plugins/vpnc.c +1 -1
@@ -54,7 +54,7 @@#include "../vpn.h" #define ARRAY_SIZE (a) (sizeof(a)/sizeof(a[0])) -#define PID_PATH_ROOT "/var/run/user" +#define PID_PATH_ROOT RUNSTATEDIR "/user"enum {OPT_STRING =1 ,
vpn/vpn-util.c +2 -2
@@ -102,8 +102,8 @@ struct group *vpn_util_get_group(const char *groupname)* running a VPN plugin as a different user and thus, user specific run dir is * allowed and limitation to access any other system dir is restricted. */ -static const char *allowed_prefixes[] = {"/var/run/connman-vpn/" , -"/var/run/user/" ,"/tmp/" ,NULL }; +static const char *allowed_prefixes[] = {RUNSTATEDIR "/connman-vpn/" , +RUNSTATEDIR "/user/" ,"/tmp/" ,NULL };static int is_path_allowed (const char *path) {
Signature · 1 line
2.35.1
Daniel Wagner
AppliedQuoted 6 lines · Daniel Linjama
Add support for configurable $(runstatedir) with RUNSTATEDIR and replace hardcoded
/var/runpathsDaniel Linjama (2):
build: Support configurable run dir with RUNSTATEDIR
vpn: Replace hardcoded paths with RUNSTATEDIR
Quoted 7 lines
Makefile.am | 2 ++
Makefile.plugins | 1 + vpn/plugins/vpnc.c | 2 +- vpn/vpn-util.c | 4 ++-- 4 files changed, 6 insertions(+), 3 deletions(-)[...]
Applied, thanks!
[1/2] build: Support configurable run dir with RUNSTATEDIR
commit: a18acc883b7312d425eb0565e5f2c4d5235f2182
[2/2] vpn: Replace hardcoded paths with RUNSTATEDIR
commit: 7c341aef347eb2a399a2717aa79ac6043f503430Best regards,
Signature · 1 line
Daniel Wagner <[email protected]>