libsepol: Create policydb_sort_ocontexts()

Create the function called policydb_sort_ocontexts() that calls
the internal function sort_ocontexts() to sort the ocontexts of
a policydb.

The function sort_ocontexts() is already used by
sepol_kernel_policydb_to_conf() and sepol_kernel_policydb_to_cil()
when converting a binary policy to cil or policy.conf format.

Signed-off-by: James Carter <jwcart2@tycho.nsa.gov>
This commit is contained in:
James Carter 2018-10-11 08:35:42 -04:00 committed by William Roberts
parent c7fa63150e
commit b816808e7f
2 changed files with 7 additions and 0 deletions

View file

@ -640,6 +640,8 @@ extern void policydb_destroy(policydb_t * p);
extern int policydb_load_isids(policydb_t * p, sidtab_t * s);
extern int policydb_sort_ocontexts(policydb_t *p);
/* Deprecated */
extern int policydb_context_isvalid(const policydb_t * p,
const context_struct_t * c);

View file

@ -51,6 +51,7 @@
#include <sepol/policydb/util.h>
#include <sepol/policydb/flask.h>
#include "kernel_to_common.h"
#include "private.h"
#include "debug.h"
#include "mls.h"
@ -4301,3 +4302,7 @@ int policydb_set_target_platform(policydb_t *p, int platform)
return 0;
}
int policydb_sort_ocontexts(policydb_t *p)
{
return sort_ocontexts(p);
}