All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libselinux: Add openrc_contexts functions
@ 2016-09-22 14:43 Jason Zaman
  2016-09-22 17:34 ` Stephen Smalley
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Zaman @ 2016-09-22 14:43 UTC (permalink / raw)
  To: selinux

The file will initially contain:
run_init=run_init_t
There can not be any spaces around the = since OpenRC's existing config
files and the methods it uses require it.

Signed-off-by: Jason Zaman <jason@perfinion.com>
---
 libselinux/include/selinux/selinux.h |  1 +
 libselinux/src/file_path_suffixes.h  |  1 +
 libselinux/src/selinux_config.c      | 10 +++++++++-
 libselinux/src/selinux_internal.h    |  1 +
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h
index 3d8673f..45dd6ca 100644
--- a/libselinux/include/selinux/selinux.h
+++ b/libselinux/include/selinux/selinux.h
@@ -543,6 +543,7 @@ extern const char *selinux_virtual_image_context_path(void);
 extern const char *selinux_lxc_contexts_path(void);
 extern const char *selinux_x_context_path(void);
 extern const char *selinux_sepgsql_context_path(void);
+extern const char *selinux_openrc_contexts_path(void);
 extern const char *selinux_openssh_contexts_path(void);
 extern const char *selinux_snapperd_contexts_path(void);
 extern const char *selinux_systemd_contexts_path(void);
diff --git a/libselinux/src/file_path_suffixes.h b/libselinux/src/file_path_suffixes.h
index 95b228b..2d3ca49 100644
--- a/libselinux/src/file_path_suffixes.h
+++ b/libselinux/src/file_path_suffixes.h
@@ -23,6 +23,7 @@ S_(BINPOLICY, "/policy/policy")
     S_(VIRTUAL_DOMAIN, "/contexts/virtual_domain_context")
     S_(VIRTUAL_IMAGE, "/contexts/virtual_image_context")
     S_(LXC_CONTEXTS, "/contexts/lxc_contexts")
+    S_(OPENRC_CONTEXTS, "/contexts/openrc_contexts")
     S_(OPENSSH_CONTEXTS, "/contexts/openssh_contexts")
     S_(SNAPPERD_CONTEXTS, "/contexts/snapperd_contexts")
     S_(SYSTEMD_CONTEXTS, "/contexts/systemd_contexts")
diff --git a/libselinux/src/selinux_config.c b/libselinux/src/selinux_config.c
index c519a77..88bcc85 100644
--- a/libselinux/src/selinux_config.c
+++ b/libselinux/src/selinux_config.c
@@ -51,7 +51,8 @@
 #define OPENSSH_CONTEXTS  28
 #define SYSTEMD_CONTEXTS  29
 #define SNAPPERD_CONTEXTS 30
-#define NEL               31
+#define OPENRC_CONTEXTS   31
+#define NEL               32
 
 /* Part of one-time lazy init */
 static pthread_once_t once = PTHREAD_ONCE_INIT;
@@ -493,6 +494,13 @@ const char *selinux_lxc_contexts_path(void)
 
 hidden_def(selinux_lxc_contexts_path)
 
+const char *selinux_openrc_contexts_path(void)
+{
+    return get_path(OPENRC_CONTEXTS);
+}
+
+hidden_def(selinux_openrc_contexts_path)
+
 const char *selinux_openssh_contexts_path(void)
 {
     return get_path(OPENSSH_CONTEXTS);
diff --git a/libselinux/src/selinux_internal.h b/libselinux/src/selinux_internal.h
index 9b9145c..3d5c9fb 100644
--- a/libselinux/src/selinux_internal.h
+++ b/libselinux/src/selinux_internal.h
@@ -83,6 +83,7 @@ hidden_proto(selinux_mkload_policy)
     hidden_proto(selinux_media_context_path)
     hidden_proto(selinux_x_context_path)
     hidden_proto(selinux_sepgsql_context_path)
+    hidden_proto(selinux_openrc_contexts_path)
     hidden_proto(selinux_openssh_contexts_path)
     hidden_proto(selinux_snapperd_contexts_path)
     hidden_proto(selinux_systemd_contexts_path)
-- 
2.7.3

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

* Re: [PATCH] libselinux: Add openrc_contexts functions
  2016-09-22 14:43 [PATCH] libselinux: Add openrc_contexts functions Jason Zaman
@ 2016-09-22 17:34 ` Stephen Smalley
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Smalley @ 2016-09-22 17:34 UTC (permalink / raw)
  To: Jason Zaman, selinux

On 09/22/2016 10:43 AM, Jason Zaman wrote:
> The file will initially contain:
> run_init=run_init_t
> There can not be any spaces around the = since OpenRC's existing config
> files and the methods it uses require it.
> 
> Signed-off-by: Jason Zaman <jason@perfinion.com>

Thanks, applied.  I think however that we can dispense with a bunch of
these hidden_def/hidden_proto declarations; they are only needed for
exported functions that are also called internally by libselinux.  Seems
like that is wrong for several of these functions.

> ---
>  libselinux/include/selinux/selinux.h |  1 +
>  libselinux/src/file_path_suffixes.h  |  1 +
>  libselinux/src/selinux_config.c      | 10 +++++++++-
>  libselinux/src/selinux_internal.h    |  1 +
>  4 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h
> index 3d8673f..45dd6ca 100644
> --- a/libselinux/include/selinux/selinux.h
> +++ b/libselinux/include/selinux/selinux.h
> @@ -543,6 +543,7 @@ extern const char *selinux_virtual_image_context_path(void);
>  extern const char *selinux_lxc_contexts_path(void);
>  extern const char *selinux_x_context_path(void);
>  extern const char *selinux_sepgsql_context_path(void);
> +extern const char *selinux_openrc_contexts_path(void);
>  extern const char *selinux_openssh_contexts_path(void);
>  extern const char *selinux_snapperd_contexts_path(void);
>  extern const char *selinux_systemd_contexts_path(void);
> diff --git a/libselinux/src/file_path_suffixes.h b/libselinux/src/file_path_suffixes.h
> index 95b228b..2d3ca49 100644
> --- a/libselinux/src/file_path_suffixes.h
> +++ b/libselinux/src/file_path_suffixes.h
> @@ -23,6 +23,7 @@ S_(BINPOLICY, "/policy/policy")
>      S_(VIRTUAL_DOMAIN, "/contexts/virtual_domain_context")
>      S_(VIRTUAL_IMAGE, "/contexts/virtual_image_context")
>      S_(LXC_CONTEXTS, "/contexts/lxc_contexts")
> +    S_(OPENRC_CONTEXTS, "/contexts/openrc_contexts")
>      S_(OPENSSH_CONTEXTS, "/contexts/openssh_contexts")
>      S_(SNAPPERD_CONTEXTS, "/contexts/snapperd_contexts")
>      S_(SYSTEMD_CONTEXTS, "/contexts/systemd_contexts")
> diff --git a/libselinux/src/selinux_config.c b/libselinux/src/selinux_config.c
> index c519a77..88bcc85 100644
> --- a/libselinux/src/selinux_config.c
> +++ b/libselinux/src/selinux_config.c
> @@ -51,7 +51,8 @@
>  #define OPENSSH_CONTEXTS  28
>  #define SYSTEMD_CONTEXTS  29
>  #define SNAPPERD_CONTEXTS 30
> -#define NEL               31
> +#define OPENRC_CONTEXTS   31
> +#define NEL               32
>  
>  /* Part of one-time lazy init */
>  static pthread_once_t once = PTHREAD_ONCE_INIT;
> @@ -493,6 +494,13 @@ const char *selinux_lxc_contexts_path(void)
>  
>  hidden_def(selinux_lxc_contexts_path)
>  
> +const char *selinux_openrc_contexts_path(void)
> +{
> +    return get_path(OPENRC_CONTEXTS);
> +}
> +
> +hidden_def(selinux_openrc_contexts_path)
> +
>  const char *selinux_openssh_contexts_path(void)
>  {
>      return get_path(OPENSSH_CONTEXTS);
> diff --git a/libselinux/src/selinux_internal.h b/libselinux/src/selinux_internal.h
> index 9b9145c..3d5c9fb 100644
> --- a/libselinux/src/selinux_internal.h
> +++ b/libselinux/src/selinux_internal.h
> @@ -83,6 +83,7 @@ hidden_proto(selinux_mkload_policy)
>      hidden_proto(selinux_media_context_path)
>      hidden_proto(selinux_x_context_path)
>      hidden_proto(selinux_sepgsql_context_path)
> +    hidden_proto(selinux_openrc_contexts_path)
>      hidden_proto(selinux_openssh_contexts_path)
>      hidden_proto(selinux_snapperd_contexts_path)
>      hidden_proto(selinux_systemd_contexts_path)
> 

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

* Re: [PATCH] libselinux: Add openrc_contexts functions
  2016-07-03  6:22 Jason Zaman
@ 2016-07-03  6:55 ` Jason Zaman
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Zaman @ 2016-07-03  6:55 UTC (permalink / raw)
  To: selinux

I completely screwed up this patch, please ignore it. I missed another
header file.

On Sun, Jul 03, 2016 at 02:22:02PM +0800, Jason Zaman wrote:
> ---
>  libselinux/src/file_path_suffixes.h |  1 +
>  libselinux/src/selinux_config.c     | 10 +++++++++-
>  libselinux/src/selinux_internal.h   |  1 +
>  3 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/libselinux/src/file_path_suffixes.h b/libselinux/src/file_path_suffixes.h
> index 95b228b..2d3ca49 100644
> --- a/libselinux/src/file_path_suffixes.h
> +++ b/libselinux/src/file_path_suffixes.h
> @@ -23,6 +23,7 @@ S_(BINPOLICY, "/policy/policy")
>      S_(VIRTUAL_DOMAIN, "/contexts/virtual_domain_context")
>      S_(VIRTUAL_IMAGE, "/contexts/virtual_image_context")
>      S_(LXC_CONTEXTS, "/contexts/lxc_contexts")
> +    S_(OPENRC_CONTEXTS, "/contexts/openrc_contexts")
>      S_(OPENSSH_CONTEXTS, "/contexts/openssh_contexts")
>      S_(SNAPPERD_CONTEXTS, "/contexts/snapperd_contexts")
>      S_(SYSTEMD_CONTEXTS, "/contexts/systemd_contexts")
> diff --git a/libselinux/src/selinux_config.c b/libselinux/src/selinux_config.c
> index c519a77..88bcc85 100644
> --- a/libselinux/src/selinux_config.c
> +++ b/libselinux/src/selinux_config.c
> @@ -51,7 +51,8 @@
>  #define OPENSSH_CONTEXTS  28
>  #define SYSTEMD_CONTEXTS  29
>  #define SNAPPERD_CONTEXTS 30
> -#define NEL               31
> +#define OPENRC_CONTEXTS   31
> +#define NEL               32
>  
>  /* Part of one-time lazy init */
>  static pthread_once_t once = PTHREAD_ONCE_INIT;
> @@ -493,6 +494,13 @@ const char *selinux_lxc_contexts_path(void)
>  
>  hidden_def(selinux_lxc_contexts_path)
>  
> +const char *selinux_openrc_contexts_path(void)
> +{
> +    return get_path(OPENRC_CONTEXTS);
> +}
> +
> +hidden_def(selinux_openrc_contexts_path)
> +
>  const char *selinux_openssh_contexts_path(void)
>  {
>      return get_path(OPENSSH_CONTEXTS);
> diff --git a/libselinux/src/selinux_internal.h b/libselinux/src/selinux_internal.h
> index 9b9145c..3d5c9fb 100644
> --- a/libselinux/src/selinux_internal.h
> +++ b/libselinux/src/selinux_internal.h
> @@ -83,6 +83,7 @@ hidden_proto(selinux_mkload_policy)
>      hidden_proto(selinux_media_context_path)
>      hidden_proto(selinux_x_context_path)
>      hidden_proto(selinux_sepgsql_context_path)
> +    hidden_proto(selinux_openrc_contexts_path)
>      hidden_proto(selinux_openssh_contexts_path)
>      hidden_proto(selinux_snapperd_contexts_path)
>      hidden_proto(selinux_systemd_contexts_path)
> -- 
> 2.7.3
> 

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

* [PATCH] libselinux: Add openrc_contexts functions
@ 2016-07-03  6:22 Jason Zaman
  2016-07-03  6:55 ` Jason Zaman
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Zaman @ 2016-07-03  6:22 UTC (permalink / raw)
  To: selinux

---
 libselinux/src/file_path_suffixes.h |  1 +
 libselinux/src/selinux_config.c     | 10 +++++++++-
 libselinux/src/selinux_internal.h   |  1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/libselinux/src/file_path_suffixes.h b/libselinux/src/file_path_suffixes.h
index 95b228b..2d3ca49 100644
--- a/libselinux/src/file_path_suffixes.h
+++ b/libselinux/src/file_path_suffixes.h
@@ -23,6 +23,7 @@ S_(BINPOLICY, "/policy/policy")
     S_(VIRTUAL_DOMAIN, "/contexts/virtual_domain_context")
     S_(VIRTUAL_IMAGE, "/contexts/virtual_image_context")
     S_(LXC_CONTEXTS, "/contexts/lxc_contexts")
+    S_(OPENRC_CONTEXTS, "/contexts/openrc_contexts")
     S_(OPENSSH_CONTEXTS, "/contexts/openssh_contexts")
     S_(SNAPPERD_CONTEXTS, "/contexts/snapperd_contexts")
     S_(SYSTEMD_CONTEXTS, "/contexts/systemd_contexts")
diff --git a/libselinux/src/selinux_config.c b/libselinux/src/selinux_config.c
index c519a77..88bcc85 100644
--- a/libselinux/src/selinux_config.c
+++ b/libselinux/src/selinux_config.c
@@ -51,7 +51,8 @@
 #define OPENSSH_CONTEXTS  28
 #define SYSTEMD_CONTEXTS  29
 #define SNAPPERD_CONTEXTS 30
-#define NEL               31
+#define OPENRC_CONTEXTS   31
+#define NEL               32
 
 /* Part of one-time lazy init */
 static pthread_once_t once = PTHREAD_ONCE_INIT;
@@ -493,6 +494,13 @@ const char *selinux_lxc_contexts_path(void)
 
 hidden_def(selinux_lxc_contexts_path)
 
+const char *selinux_openrc_contexts_path(void)
+{
+    return get_path(OPENRC_CONTEXTS);
+}
+
+hidden_def(selinux_openrc_contexts_path)
+
 const char *selinux_openssh_contexts_path(void)
 {
     return get_path(OPENSSH_CONTEXTS);
diff --git a/libselinux/src/selinux_internal.h b/libselinux/src/selinux_internal.h
index 9b9145c..3d5c9fb 100644
--- a/libselinux/src/selinux_internal.h
+++ b/libselinux/src/selinux_internal.h
@@ -83,6 +83,7 @@ hidden_proto(selinux_mkload_policy)
     hidden_proto(selinux_media_context_path)
     hidden_proto(selinux_x_context_path)
     hidden_proto(selinux_sepgsql_context_path)
+    hidden_proto(selinux_openrc_contexts_path)
     hidden_proto(selinux_openssh_contexts_path)
     hidden_proto(selinux_snapperd_contexts_path)
     hidden_proto(selinux_systemd_contexts_path)
-- 
2.7.3

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

end of thread, other threads:[~2016-09-22 17:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-22 14:43 [PATCH] libselinux: Add openrc_contexts functions Jason Zaman
2016-09-22 17:34 ` Stephen Smalley
  -- strict thread matches above, loose matches on Subject: below --
2016-07-03  6:22 Jason Zaman
2016-07-03  6:55 ` Jason Zaman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.