selinux-h: improve stub types and add more stub functions
authorPádraig Brady <P@draigBrady.com>
Wed, 27 Nov 2013 21:53:19 +0000 (21:53 +0000)
committerPádraig Brady <P@draigBrady.com>
Thu, 28 Nov 2013 00:27:37 +0000 (00:27 +0000)
* 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
lib/se-context.in.h
lib/se-selinux.in.h

index 2e99de8..61b5f40 100644 (file)
--- 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-27  Paul Eggert  <eggert@cs.ucla.edu>
 
        ignore-value: prefer GCC version back through 2.0
index bd586e8..c3890a2 100644 (file)
@@ -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
 
index 62a5d86..43690c0 100644 (file)
@@ -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)