Skip to content
Snippets Groups Projects
Commit fbaf72ed authored by Nick Kralevich's avatar Nick Kralevich Committed by Gerrit Code Review
Browse files

Merge "sepolicy-analyze: Implement booleans test."

parents c01f7fd1 a7b2c5f4
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@ LOCAL_MODULE := sepolicy-analyze
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := external/libsepol/include
LOCAL_CFLAGS := -Wall -Werror
LOCAL_SRC_FILES := sepolicy-analyze.c dups.c neverallow.c perm.c typecmp.c utils.c
LOCAL_SRC_FILES := sepolicy-analyze.c dups.c neverallow.c perm.c typecmp.c booleans.c utils.c
LOCAL_STATIC_LIBRARIES := libsepol
include $(BUILD_HOST_EXECUTABLE)
......@@ -53,6 +53,13 @@ sepolicy-analyze
permissive domains can be helpful during development, they
should not be present in a final -user build.
BOOLEANS (booleans)
sepolicy-analyze out/target/product/<board>/root/sepolicy booleans
Displays the number of booleans defined in the policy. Policy
booleans are forbidden in Android policy, so if the output is
non-zero, the policy will fail CTS.
NEVERALLOW CHECKING (neverallow)
sepolicy-analyze out/target/product/<board>/root/sepolicy neverallow \
[-w] [-d] [-f neverallows.conf] | [-n "neverallow string"]
......
#include "booleans.h"
#include <sepol/booleans.h>
void booleans_usage() {
fprintf(stderr, "\tbooleans\n");
}
int booleans_func (int argc, __attribute__ ((unused)) char **argv, policydb_t *policydb) {
int rc;
unsigned int count;
if (argc != 1) {
USAGE_ERROR = true;
return -1;
}
rc = sepol_bool_count(NULL, (const struct sepol_policydb *) policydb,
&count);
if (rc)
return rc;
printf("%u\n", count);
return 0;
}
#ifndef BOOLEANS_H
#define BOOLEANS_H
#include <sepol/policydb/policydb.h>
#include "utils.h"
void booleans_usage(void);
int booleans_func(int argc, char **argv, policydb_t *policydb);
#endif /* BOOLEANS_H */
......@@ -6,6 +6,7 @@
#include "neverallow.h"
#include "perm.h"
#include "typecmp.h"
#include "booleans.h"
#include "utils.h"
#define NUM_COMPONENTS (int) (sizeof(analyze_components)/sizeof(analyze_components[0]))
......@@ -20,7 +21,8 @@ static struct {
COMP(dups),
COMP(neverallow),
COMP(permissive),
COMP(typecmp)
COMP(typecmp),
COMP(booleans)
};
void usage(char *arg0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment