diff mbox series

[RFC,v2,37/40,WIP] libsepol: export policydb_validate

Message ID 20211105154542.38434-38-cgzones@googlemail.com (mailing list archive)
State Not Applicable
Headers show
Series libsepol: add fuzzer for reading binary policies | expand

Commit Message

Christian Göttsche Nov. 5, 2021, 3:45 p.m. UTC
Export the interface to validate a policydb structure.
It can be used e.g. in compilers to verify they generate valid policies.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 libsepol/include/sepol/policydb/validate.h | 17 +++++++++++++++++
 libsepol/src/policydb_validate.h           |  4 +---
 2 files changed, 18 insertions(+), 3 deletions(-)
 create mode 100644 libsepol/include/sepol/policydb/validate.h
diff mbox series

Patch

diff --git a/libsepol/include/sepol/policydb/validate.h b/libsepol/include/sepol/policydb/validate.h
new file mode 100644
index 00000000..eff0779e
--- /dev/null
+++ b/libsepol/include/sepol/policydb/validate.h
@@ -0,0 +1,17 @@ 
+#ifndef _SEPOL_POLICYDB_VALIDATE_H
+#define _SEPOL_POLICYDB_VALIDATE_H
+
+#include <sepol/handle.h>
+#include <sepol/policydb/policydb.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int validate_policydb(sepol_handle_t *handle, policydb_t *p);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/libsepol/src/policydb_validate.h b/libsepol/src/policydb_validate.h
index d9f7229b..c2980403 100644
--- a/libsepol/src/policydb_validate.h
+++ b/libsepol/src/policydb_validate.h
@@ -1,7 +1,5 @@ 
 #include <stdint.h>
 
-#include <sepol/handle.h>
-#include <sepol/policydb/policydb.h>
+#include <sepol/policydb/validate.h>
 
 int value_isvalid(uint32_t value, uint32_t nprim);
-int validate_policydb(sepol_handle_t *handle, policydb_t *p);