diff --git a/libsepol/include/sepol/roles.h b/libsepol/include/sepol/roles.h deleted file mode 100644 index e750078c..00000000 --- a/libsepol/include/sepol/roles.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _SEPOL_ROLES_H_ -#define _SEPOL_ROLES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int sepol_role_exists(const sepol_policydb_t * policydb, - const char *role, int *response); - -extern int sepol_role_list(const sepol_policydb_t * policydb, - char ***roles, unsigned int *nroles); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/libsepol/src/roles.c b/libsepol/src/roles.c deleted file mode 100644 index 4540cee8..00000000 --- a/libsepol/src/roles.c +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include - -#include -#include - -#include "debug.h" -#include "handle.h" - -/* Check if a role exists */ -int sepol_role_exists(sepol_handle_t * handle __attribute__ ((unused)), - sepol_policydb_t * p, const char *role, int *response) -{ - - policydb_t *policydb = &p->p; - *response = (hashtab_search(policydb->p_roles.table, role) != NULL); - - return STATUS_SUCCESS; -} - -/* Fill an array with all valid roles */ -int sepol_role_list(sepol_handle_t * handle, - sepol_policydb_t * p, char ***roles, unsigned int *nroles) -{ - - policydb_t *policydb = &p->p; - unsigned int tmp_nroles = policydb->p_roles.nprim; - char **tmp_roles = (char **)malloc(tmp_nroles * sizeof(char *)); - char **ptr; - unsigned int i; - if (!tmp_roles) - goto omem; - - for (i = 0; i < tmp_nroles; i++) { - tmp_roles[i] = strdup(policydb->p_role_val_to_name[i]); - if (!tmp_roles[i]) - goto omem; - } - - *nroles = tmp_nroles; - *roles = tmp_roles; - - return STATUS_SUCCESS; - - omem: - ERR(handle, "out of memory, could not list roles"); - - ptr = tmp_roles; - while (ptr && *ptr) - free(*ptr++); - free(tmp_roles); - return STATUS_ERR; -}