From: Paul Moore Date: Mon, 4 Feb 2008 23:31:00 +0000 (+0800) Subject: SELinux: Remove security_get_policycaps() X-Git-Tag: v2.6.25-rc1~516^2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=394c6753978a75cab7558a377f2551a3c1101027;p=linux-2.6 SELinux: Remove security_get_policycaps() The security_get_policycaps() functions has a couple of bugs in it and it isn't currently used by any in-tree code, so get rid of it and all of it's bugginess. Signed-off-by: Paul Moore Signed-off-by: James Morris --- diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h index 23137c17f9..837ce420d2 100644 --- a/security/selinux/include/security.h +++ b/security/selinux/include/security.h @@ -107,7 +107,6 @@ int security_get_classes(char ***classes, int *nclasses); int security_get_permissions(char *class, char ***perms, int *nperms); int security_get_reject_unknown(void); int security_get_allow_unknown(void); -int security_get_policycaps(int *len, int **values); #define SECURITY_FS_USE_XATTR 1 /* use xattr */ #define SECURITY_FS_USE_TRANS 2 /* use transition SIDs, e.g. devpts/tmpfs */ diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index fced6bccee..f374186012 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -2245,39 +2245,6 @@ int security_get_allow_unknown(void) return policydb.allow_unknown; } -/** - * security_get_policycaps - Query the loaded policy for its capabilities - * @len: the number of capability bits - * @values: the capability bit array - * - * Description: - * Get an array of the policy capabilities in @values where each entry in - * @values is either true (1) or false (0) depending the policy's support of - * that feature. The policy capabilities are defined by the - * POLICYDB_CAPABILITY_* enums. The size of the array is stored in @len and it - * is up to the caller to free the array in @values. Returns zero on success, - * negative values on failure. - * - */ -int security_get_policycaps(int *len, int **values) -{ - int rc = -ENOMEM; - unsigned int iter; - - POLICY_RDLOCK; - - *values = kcalloc(POLICYDB_CAPABILITY_MAX, sizeof(int), GFP_ATOMIC); - if (*values == NULL) - goto out; - for (iter = 0; iter < POLICYDB_CAPABILITY_MAX; iter++) - (*values)[iter] = ebitmap_get_bit(&policydb.policycaps, iter); - *len = POLICYDB_CAPABILITY_MAX; - -out: - POLICY_RDUNLOCK; - return rc; -} - /** * security_policycap_supported - Check for a specific policy capability * @req_cap: capability