connman.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Replace hardcoded paths with configurable runstatedir
@ 2022-04-06 18:02 Daniel Linjama
  2022-04-06 18:02 ` [PATCH 1/2] build: Support configurable run dir with RUNSTATEDIR Daniel Linjama
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Daniel Linjama @ 2022-04-06 18:02 UTC (permalink / raw)
  To: connman; +Cc: Daniel Linjama

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(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] build: Support configurable run dir with RUNSTATEDIR
  2022-04-06 18:02 [PATCH 0/2] Replace hardcoded paths with configurable runstatedir Daniel Linjama
@ 2022-04-06 18:02 ` Daniel Linjama
  2022-04-07 12:30   ` [PATCH v2 " Daniel Linjama
  2022-04-06 18:02 ` [PATCH 2/2] vpn: Replace hardcoded paths " Daniel Linjama
  2022-04-08  7:20 ` [PATCH 0/2] Replace hardcoded paths with configurable runstatedir Daniel Wagner
  2 siblings, 1 reply; 5+ messages in thread
From: Daniel Linjama @ 2022-04-06 18:02 UTC (permalink / raw)
  To: connman; +Cc: Daniel Linjama

Add configurable $(runstatedir) to CFLAGS as RUNSTATEDIR
---
 Makefile.am      | 2 ++
 Makefile.plugins | 1 +
 2 files changed, 3 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 15178eca..3779eab9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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
 
diff --git a/Makefile.plugins b/Makefile.plugins
index 8e323617..bd5049ec 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -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
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] vpn: Replace hardcoded paths with RUNSTATEDIR
  2022-04-06 18:02 [PATCH 0/2] Replace hardcoded paths with configurable runstatedir Daniel Linjama
  2022-04-06 18:02 ` [PATCH 1/2] build: Support configurable run dir with RUNSTATEDIR Daniel Linjama
@ 2022-04-06 18:02 ` Daniel Linjama
  2022-04-08  7:20 ` [PATCH 0/2] Replace hardcoded paths with configurable runstatedir Daniel Wagner
  2 siblings, 0 replies; 5+ messages in thread
From: Daniel Linjama @ 2022-04-06 18:02 UTC (permalink / raw)
  To: connman; +Cc: Daniel Linjama

Replace hardcoded /var/run paths with configurable RUNSTATEDIR
---
 vpn/plugins/vpnc.c | 2 +-
 vpn/vpn-util.c     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/vpn/plugins/vpnc.c b/vpn/plugins/vpnc.c
index d11b9111..73012c5b 100644
--- a/vpn/plugins/vpnc.c
+++ b/vpn/plugins/vpnc.c
@@ -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,
diff --git a/vpn/vpn-util.c b/vpn/vpn-util.c
index 9ef14d38..bc3b01dd 100644
--- a/vpn/vpn-util.c
+++ b/vpn/vpn-util.c
@@ -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)
 {
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] build: Support configurable run dir with RUNSTATEDIR
  2022-04-06 18:02 ` [PATCH 1/2] build: Support configurable run dir with RUNSTATEDIR Daniel Linjama
@ 2022-04-07 12:30   ` Daniel Linjama
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Linjama @ 2022-04-07 12:30 UTC (permalink / raw)
  To: connman; +Cc: Daniel Linjama

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(+)

diff --git a/Makefile.am b/Makefile.am
index 15178eca..c108b8f3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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
 
diff --git a/Makefile.plugins b/Makefile.plugins
index 8e323617..bd5049ec 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -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
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] Replace hardcoded paths with configurable runstatedir
  2022-04-06 18:02 [PATCH 0/2] Replace hardcoded paths with configurable runstatedir Daniel Linjama
  2022-04-06 18:02 ` [PATCH 1/2] build: Support configurable run dir with RUNSTATEDIR Daniel Linjama
  2022-04-06 18:02 ` [PATCH 2/2] vpn: Replace hardcoded paths " Daniel Linjama
@ 2022-04-08  7:20 ` Daniel Wagner
  2 siblings, 0 replies; 5+ messages in thread
From: Daniel Wagner @ 2022-04-08  7:20 UTC (permalink / raw)
  To: Daniel Linjama, connman; +Cc: Daniel Wagner

On Wed, 6 Apr 2022 21:02:38 +0300, Daniel Linjama wrote:
> 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(-)
> 
> [...]

Applied, thanks!

[1/2] build: Support configurable run dir with RUNSTATEDIR
      commit: a18acc883b7312d425eb0565e5f2c4d5235f2182
[2/2] vpn: Replace hardcoded paths with RUNSTATEDIR
      commit: 7c341aef347eb2a399a2717aa79ac6043f503430

Best regards,
-- 
Daniel Wagner <wagi@monom.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-08  7:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06 18:02 [PATCH 0/2] Replace hardcoded paths with configurable runstatedir Daniel Linjama
2022-04-06 18:02 ` [PATCH 1/2] build: Support configurable run dir with RUNSTATEDIR Daniel Linjama
2022-04-07 12:30   ` [PATCH v2 " Daniel Linjama
2022-04-06 18:02 ` [PATCH 2/2] vpn: Replace hardcoded paths " Daniel Linjama
2022-04-08  7:20 ` [PATCH 0/2] Replace hardcoded paths with configurable runstatedir Daniel Wagner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).