Skip to contentSkip to conversation

libselinux: add man page redirections

PATCH In review Christian Göttsche 2 participants 7 messages May 20, 2022 – Jun 15, 2022 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 libselinux: add man page redirections

The following interfaces are documented but do not have a redirection:

- context_str(3)
- security_get_checkreqprot(3)
- security_set_boolean_list(3)
- selinux_sepgsql_context_path(3)
- setexecfilecon(3)

---
 libselinux/man/man3/context_str.3                  | 1 +
 libselinux/man/man3/security_get_checkreqprot.3    | 1 +
 libselinux/man/man3/security_set_boolean_list.3    | 1 +
 libselinux/man/man3/selinux_sepgsql_context_path.3 | 1 +
 libselinux/man/man3/setexecfilecon.3               | 1 +
 5 files changed, 5 insertions(+)
 create mode 100644 libselinux/man/man3/context_str.3
 create mode 100644 libselinux/man/man3/security_get_checkreqprot.3
 create mode 100644 libselinux/man/man3/security_set_boolean_list.3
 create mode 100644 libselinux/man/man3/selinux_sepgsql_context_path.3
 create mode 100644 libselinux/man/man3/setexecfilecon.3
libselinux/man/man3/context_str.3 new file +1 -0
new file mode 100644
index 00000000..f4f03a6d
@@ -0,0 +1 @@
+.so man3/context_new.3
libselinux/man/man3/security_get_checkreqprot.3 new file +1 -0
new file mode 100644
index 00000000..d59e5c2c
@@ -0,0 +1 @@
+.so man3/security_getenforce.3
libselinux/man/man3/security_set_boolean_list.3 new file +1 -0
new file mode 100644
index 00000000..29731efa
@@ -0,0 +1 @@
+.so man3/security_load_booleans.3
libselinux/man/man3/selinux_sepgsql_context_path.3 new file +1 -0
new file mode 100644
index 00000000..175a611a
@@ -0,0 +1 @@
+.so man3/selinux_binary_policy_path.3
libselinux/man/man3/setexecfilecon.3 new file +1 -0
new file mode 100644
index 00000000..b2e6ab81
@@ -0,0 +1 @@
+.so man3/getexeccon.3
Signature · 1 line
2.36.1
#1 lore raw

PATCH 2/4 libselinux: enclose macro definition in parenthesis

Avoid potential precedence issues.

---
 libselinux/include/selinux/avc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libselinux/include/selinux/avc.h +1 -1
index 9b23357a..4bbd2382 100644
@@ -24,7 +24,7 @@ struct security_id {
 };
 typedef struct security_id *security_id_t;
 
-#define SECSID_WILD (security_id_t)NULL	/* unspecified SID */
+#define SECSID_WILD ((security_id_t)NULL)	/* unspecified SID */
 
 /**
  * avc_sid_to_context - get copy of context corresponding to SID.
Signature · 1 line
2.36.1
#2 lore raw

PATCH 3/4 libselinux: name parameters in context.h

In reply to Christian Göttsche
---
 libselinux/include/selinux/context.h | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
libselinux/include/selinux/context.h +11 -11
index 949fb1e1..1fb3a69c 100644
@@ -17,7 +17,7 @@ extern "C" {
 
 /* Return a new context initialized to a context string */
 
-	extern context_t context_new(const char *);
+	extern context_t context_new(const char *str);
 
 /* 
  * Return a pointer to the string value of the context_t
@@ -25,24 +25,24 @@ extern "C" {
  * for the same context_t*
  */
 
-	extern char *context_str(context_t);
+	extern char *context_str(context_t con);
 
 /* Free the storage used by a context */
-	extern void context_free(context_t);
+	extern void context_free(context_t con);
 
 /* Get a pointer to the string value of a context component */
 
-	extern const char *context_type_get(context_t);
-	extern const char *context_range_get(context_t);
-	extern const char *context_role_get(context_t);
-	extern const char *context_user_get(context_t);
+	extern const char *context_type_get(context_t con);
+	extern const char *context_range_get(context_t con);
+	extern const char *context_role_get(context_t con);
+	extern const char *context_user_get(context_t con);
 
 /* Set a context component.  Returns nonzero if unsuccessful */
 
-	extern int context_type_set(context_t, const char *);
-	extern int context_range_set(context_t, const char *);
-	extern int context_role_set(context_t, const char *);
-	extern int context_user_set(context_t, const char *);
+	extern int context_type_set(context_t con, const char *type);
+	extern int context_range_set(context_t con, const char *range);
+	extern int context_role_set(context_t con, const char *role);
+	extern int context_user_set(context_t con, const char *user);
 
 #ifdef __cplusplus
 }
Signature · 1 line
2.36.1
#3 lore raw

PATCH v2 3/4 libselinux: name parameters in context.h

---
v2:
- Rebase on top of dd98fa32 ("libselinux: declare return value of

    context_str(3) const")
---
 libselinux/include/selinux/context.h | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
libselinux/include/selinux/context.h +11 -11
index 82f4e690..59d9bb69 100644
@@ -17,7 +17,7 @@ extern "C" {
 
 /* Return a new context initialized to a context string */
 
-	extern context_t context_new(const char *);
+	extern context_t context_new(const char *str);
 
 /* 
  * Return a pointer to the string value of the context_t
@@ -25,24 +25,24 @@ extern "C" {
  * for the same context_t*
  */
 
-	extern const char *context_str(context_t);
+	extern const char *context_str(context_t con);
 
 /* Free the storage used by a context */
-	extern void context_free(context_t);
+	extern void context_free(context_t con);
 
 /* Get a pointer to the string value of a context component */
 
-	extern const char *context_type_get(context_t);
-	extern const char *context_range_get(context_t);
-	extern const char *context_role_get(context_t);
-	extern const char *context_user_get(context_t);
+	extern const char *context_type_get(context_t con);
+	extern const char *context_range_get(context_t con);
+	extern const char *context_role_get(context_t con);
+	extern const char *context_user_get(context_t con);
 
 /* Set a context component.  Returns nonzero if unsuccessful */
 
-	extern int context_type_set(context_t, const char *);
-	extern int context_range_set(context_t, const char *);
-	extern int context_role_set(context_t, const char *);
-	extern int context_user_set(context_t, const char *);
+	extern int context_type_set(context_t con, const char *type);
+	extern int context_range_set(context_t con, const char *range);
+	extern int context_role_set(context_t con, const char *role);
+	extern int context_user_set(context_t con, const char *user);
 
 #ifdef __cplusplus
 }
Signature · 1 line
2.36.1
#4 lore raw

PATCH 4/4 libselinux: declare parameter of security_load_policy(3) const

In reply to Christian Göttsche

security_load_policy(3) takes a read-only memory address for a binary policy to be loaded.

---
 libselinux/include/selinux/selinux.h       | 2 +-
 libselinux/man/man3/security_load_policy.3 | 2 +-
 libselinux/src/load_policy.c               | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
libselinux/include/selinux/selinux.h +1 -1
index ae98a92e..47af9953 100644
@@ -279,7 +279,7 @@ extern int security_validatetrans_raw(const char *scon,
 				      const char *newcon);
 
 /* Load a policy configuration. */
-extern int security_load_policy(void *data, size_t len);
+extern int security_load_policy(const void *data, size_t len);
 
 /* Get the context of an initial kernel security identifier by name.  
    Caller must free via freecon */
libselinux/man/man3/security_load_policy.3 +1 -1
index af561636..b2da0256 100644
@@ -5,7 +5,7 @@ security_load_policy \- load a new SELinux policy
 .SH "SYNOPSIS"
 .B #include <selinux/selinux.h>
 .sp
-.BI "int security_load_policy(void *" data ", size_t "len );
+.BI "int security_load_policy(const void *" data ", size_t "len );
 .sp
 .BI "int selinux_mkload_policy(int " preservebools ");"
 .sp
libselinux/src/load_policy.c +1 -1
index d8c715ed..17918e8b 100644
@@ -23,7 +23,7 @@
 #define MNT_DETACH 2
 #endif
 
-int security_load_policy(void *data, size_t len)
+int security_load_policy(const void *data, size_t len)
 {
 	char path[PATH_MAX];
 	int fd, ret;
Signature · 1 line
2.36.1
Acked-by on v1 1/4
#5 lore raw
In reply to Christian Göttsche
Quoted 10 lines · Christian Göttsche

The following interfaces are documented but do not have a redirection:

- context_str(3)
- security_get_checkreqprot(3)
- security_set_boolean_list(3)
- selinux_sepgsql_context_path(3)
- setexecfilecon(3)

For these four patches:

Quoted 51 lines
---
 libselinux/man/man3/context_str.3                  | 1 +
 libselinux/man/man3/security_get_checkreqprot.3    | 1 +
 libselinux/man/man3/security_set_boolean_list.3    | 1 +
 libselinux/man/man3/selinux_sepgsql_context_path.3 | 1 +
 libselinux/man/man3/setexecfilecon.3               | 1 +
 5 files changed, 5 insertions(+)
 create mode 100644 libselinux/man/man3/context_str.3
 create mode 100644 libselinux/man/man3/security_get_checkreqprot.3
 create mode 100644 libselinux/man/man3/security_set_boolean_list.3
 create mode 100644 libselinux/man/man3/selinux_sepgsql_context_path.3
 create mode 100644 libselinux/man/man3/setexecfilecon.3
libselinux/man/man3/context_str.3 new file +1 -0
new file mode 100644
index 00000000..f4f03a6d
@@ -0,0 +1 @@
+.so man3/context_new.3
libselinux/man/man3/security_get_checkreqprot.3 new file +1 -0
new file mode 100644
index 00000000..d59e5c2c
@@ -0,0 +1 @@
+.so man3/security_getenforce.3
libselinux/man/man3/security_set_boolean_list.3 new file +1 -0
new file mode 100644
index 00000000..29731efa
@@ -0,0 +1 @@
+.so man3/security_load_booleans.3
libselinux/man/man3/selinux_sepgsql_context_path.3 new file +1 -0
new file mode 100644
index 00000000..175a611a
@@ -0,0 +1 @@
+.so man3/selinux_binary_policy_path.3
libselinux/man/man3/setexecfilecon.3 new file +1 -1
new file mode 100644
index 00000000..b2e6ab81
@@ -0,0 +1 @@
+.so man3/getexeccon.3
--

2.36.1

#6 lore raw
Quoted 12 lines · James Carter
Quoted 9 lines · Christian Göttsche

The following interfaces are documented but do not have a redirection:

- context_str(3)
- security_get_checkreqprot(3)
- security_set_boolean_list(3)
- selinux_sepgsql_context_path(3)
- setexecfilecon(3)

Quoted 5 lines
Quoted 1 line

For these four patches:

This series has been merged.
Thanks,
Jim

Quoted 51 lines
Quoted 51 lines
---
 libselinux/man/man3/context_str.3                  | 1 +
 libselinux/man/man3/security_get_checkreqprot.3    | 1 +
 libselinux/man/man3/security_set_boolean_list.3    | 1 +
 libselinux/man/man3/selinux_sepgsql_context_path.3 | 1 +
 libselinux/man/man3/setexecfilecon.3               | 1 +
 5 files changed, 5 insertions(+)
 create mode 100644 libselinux/man/man3/context_str.3
 create mode 100644 libselinux/man/man3/security_get_checkreqprot.3
 create mode 100644 libselinux/man/man3/security_set_boolean_list.3
 create mode 100644 libselinux/man/man3/selinux_sepgsql_context_path.3
 create mode 100644 libselinux/man/man3/setexecfilecon.3
libselinux/man/man3/context_str.3 new file +1 -0
new file mode 100644
index 00000000..f4f03a6d
@@ -0,0 +1 @@
+.so man3/context_new.3
libselinux/man/man3/security_get_checkreqprot.3 new file +1 -0
new file mode 100644
index 00000000..d59e5c2c
@@ -0,0 +1 @@
+.so man3/security_getenforce.3
libselinux/man/man3/security_set_boolean_list.3 new file +1 -0
new file mode 100644
index 00000000..29731efa
@@ -0,0 +1 @@
+.so man3/security_load_booleans.3
libselinux/man/man3/selinux_sepgsql_context_path.3 new file +1 -0
new file mode 100644
index 00000000..175a611a
@@ -0,0 +1 @@
+.so man3/selinux_binary_policy_path.3
libselinux/man/man3/setexecfilecon.3 new file +1 -1
new file mode 100644
index 00000000..b2e6ab81
@@ -0,0 +1 @@
+.so man3/getexeccon.3
--

2.36.1