libsepol: remove unused files
libsepol/src/roles.c contains functions which do not match its header file libsepol/include/sepol/roles.h: // In roles.c int sepol_role_exists(sepol_handle_t * handle __attribute__ ((unused)), sepol_policydb_t * p, const char *role, int *response) // In roles.h extern int sepol_role_exists(const sepol_policydb_t * policydb, const char *role, int *response); and: // In roles.c int sepol_role_list(sepol_handle_t * handle, sepol_policydb_t * p, char ***roles, unsigned int *nroles) // In roles.h extern int sepol_role_list(const sepol_policydb_t * policydb, char ***roles, unsigned int *nroles); Instead of fixing the parameter type (using sepol_handle_t or sepol_policydb_t but not different ones), remove these functions, as they appear not to be used. They are not exported in libsepol.so. Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
parent
2c7c4a84c3
commit
72a88d753d
|
@ -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
|
|
|
@ -1,53 +0,0 @@
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <sepol/policydb/hashtab.h>
|
|
||||||
#include <sepol/policydb/policydb.h>
|
|
||||||
|
|
||||||
#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;
|
|
||||||
}
|
|
Loading…
Reference in New Issue