Attached is an improvement to selinux-h that
changes the security_context_t stub type to more flexible.
Also a few more stub functions were added.
These were noticed while implementing new selinux
functionality in coreutils, and while not required there,
are probably worth including.

thanks,
Pádraig.
>From 1a817dc9b6f3a2c90d05230c077eb3859f08b7ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com>
Date: Wed, 27 Nov 2013 21:53:19 +0000
Subject: [PATCH] selinux-h: improve stub types and add more stub functions

* lib/se-selinux.in.h: Change security_context_t to a typedef
rather than a define, as it's a pointer type and so is better
as a typedef to avoid issues declaring multiple variables
with the comma operator.  Also add stub for string_to_security_class().
* lib/se-context.in.h: Add stub functions for
context_{type,range,role,user}_get().
---
 ChangeLog           |   11 +++++++++++
 lib/se-context.in.h |    8 ++++++++
 lib/se-selinux.in.h |    5 ++++-
 3 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 612f99a..3c1764d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2013-11-27  Pádraig Brady <p...@draigbrady.com>
+
+	selinux-h: improve stub types and add more stub functions
+
+	* lib/se-selinux.in.h: Change security_context_t to a typedef
+	rather than a define, as it's a pointer type and so is better
+	as a typedef to avoid issues declaring multiple variables
+	with the comma operator.  Also add stub for string_to_security_class().
+	* lib/se-context.in.h: Add stub functions for
+	context_{type,range,role,user}_get().
+
 2013-11-25  Mats Erik Andersson  <g...@gisladisker.se>
 
 	pty: Activate the signature wrapper of forkpty.
diff --git a/lib/se-context.in.h b/lib/se-context.in.h
index bd586e8..c3890a2 100644
--- a/lib/se-context.in.h
+++ b/lib/se-context.in.h
@@ -32,6 +32,14 @@ SE_CONTEXT_INLINE int context_range_set (context_t sc _GL_UNUSED_PARAMETER,
 SE_CONTEXT_INLINE int context_type_set (context_t sc _GL_UNUSED_PARAMETER,
                                         char const *s _GL_UNUSED_PARAMETER)
   { errno = ENOTSUP; return -1; }
+SE_CONTEXT_INLINE char *context_type_get (context_t sc _GL_UNUSED_PARAMETER)
+  { errno = ENOTSUP; return (void *) 0; }
+SE_CONTEXT_INLINE char *context_range_get (context_t sc _GL_UNUSED_PARAMETER)
+  { errno = ENOTSUP; return (void *) 0; }
+SE_CONTEXT_INLINE char *context_role_get (context_t sc _GL_UNUSED_PARAMETER)
+  { errno = ENOTSUP; return (void *) 0; }
+SE_CONTEXT_INLINE char *context_user_get (context_t sc _GL_UNUSED_PARAMETER)
+  { errno = ENOTSUP; return (void *) 0; }
 
 _GL_INLINE_HEADER_END
 
diff --git a/lib/se-selinux.in.h b/lib/se-selinux.in.h
index 62a5d86..c53f6dc 100644
--- a/lib/se-selinux.in.h
+++ b/lib/se-selinux.in.h
@@ -44,7 +44,7 @@ _GL_INLINE_HEADER_BEGIN
 #  if !GNULIB_defined_security_types
 
 typedef unsigned short security_class_t;
-#   define security_context_t char*
+typedef char* security_context_t;
 #   define is_selinux_enabled() 0
 
 SE_SELINUX_INLINE int
@@ -103,6 +103,9 @@ security_compute_create (security_context_t scon _GL_UNUSED_PARAMETER,
                          security_class_t tclass _GL_UNUSED_PARAMETER,
                          security_context_t *newcon _GL_UNUSED_PARAMETER)
   { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE security_class_t
+string_to_security_class (char const *name)
+  { errno = ENOTSUP; return 0; }
 SE_SELINUX_INLINE int
 matchpathcon_init_prefix (char const *path _GL_UNUSED_PARAMETER,
                           char const *prefix _GL_UNUSED_PARAMETER)
-- 
1.7.7.6

Reply via email to