Re: [PATCH] libsepol: Shorten the policy capability enum names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 8, 2022 at 10:02 AM Richard Haines
<richard_c_haines@xxxxxxxxxxxxxx> wrote:
>
> Shorten "CAPABILITY" to "CAP" following the kernel naming convention.
>
> The SELinux policy capability enum names should now follow the
> "POLICYDB_CAP_XXX" format.
>
> Signed-off-by: Richard Haines <richard_c_haines@xxxxxxxxxxxxxx>

Acked-by: James Carter <jwcart2@xxxxxxxxx>

> ---
>  libsepol/include/sepol/policydb/polcaps.h | 20 ++++++++++----------
>  libsepol/src/polcaps.c                    | 20 ++++++++++----------
>  2 files changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/libsepol/include/sepol/policydb/polcaps.h b/libsepol/include/sepol/policydb/polcaps.h
> index 39c99839..f5e32e60 100644
> --- a/libsepol/include/sepol/policydb/polcaps.h
> +++ b/libsepol/include/sepol/policydb/polcaps.h
> @@ -7,17 +7,17 @@ extern "C" {
>
>  /* Policy capabilities */
>  enum {
> -       POLICYDB_CAPABILITY_NETPEER,
> -       POLICYDB_CAPABILITY_OPENPERM,
> -       POLICYDB_CAPABILITY_EXTSOCKCLASS,
> -       POLICYDB_CAPABILITY_ALWAYSNETWORK,
> -       POLICYDB_CAPABILITY_CGROUPSECLABEL,
> -       POLICYDB_CAPABILITY_NNP_NOSUID_TRANSITION,
> -       POLICYDB_CAPABILITY_GENFS_SECLABEL_SYMLINKS,
> -       POLICYDB_CAPABILITY_IOCTL_SKIP_CLOEXEC,
> -       __POLICYDB_CAPABILITY_MAX
> +       POLICYDB_CAP_NETPEER,
> +       POLICYDB_CAP_OPENPERM,
> +       POLICYDB_CAP_EXTSOCKCLASS,
> +       POLICYDB_CAP_ALWAYSNETWORK,
> +       POLICYDB_CAP_CGROUPSECLABEL,
> +       POLICYDB_CAP_NNP_NOSUID_TRANSITION,
> +       POLICYDB_CAP_GENFS_SECLABEL_SYMLINKS,
> +       POLICYDB_CAP_IOCTL_SKIP_CLOEXEC,
> +       __POLICYDB_CAP_MAX
>  };
> -#define POLICYDB_CAPABILITY_MAX (__POLICYDB_CAPABILITY_MAX - 1)
> +#define POLICYDB_CAP_MAX (__POLICYDB_CAP_MAX - 1)
>
>  /* Convert a capability name to number. */
>  extern int sepol_polcap_getnum(const char *name);
> diff --git a/libsepol/src/polcaps.c b/libsepol/src/polcaps.c
> index a5e515f2..687e971c 100644
> --- a/libsepol/src/polcaps.c
> +++ b/libsepol/src/polcaps.c
> @@ -6,14 +6,14 @@
>  #include <sepol/policydb/polcaps.h>
>
>  static const char * const polcap_names[] = {
> -       "network_peer_controls",        /* POLICYDB_CAPABILITY_NETPEER */
> -       "open_perms",                   /* POLICYDB_CAPABILITY_OPENPERM */
> -       "extended_socket_class",        /* POLICYDB_CAPABILITY_EXTSOCKCLASS */
> -       "always_check_network",         /* POLICYDB_CAPABILITY_ALWAYSNETWORK */
> -       "cgroup_seclabel",              /* POLICYDB_CAPABILITY_SECLABEL */
> -       "nnp_nosuid_transition",        /* POLICYDB_CAPABILITY_NNP_NOSUID_TRANSITION */
> -       "genfs_seclabel_symlinks",      /* POLICYDB_CAPABILITY_GENFS_SECLABEL_SYMLINKS */
> -       "ioctl_skip_cloexec",           /* POLICYDB_CAPABILITY_IOCTL_SKIP_CLOEXEC */
> +       "network_peer_controls",        /* POLICYDB_CAP_NETPEER */
> +       "open_perms",                   /* POLICYDB_CAP_OPENPERM */
> +       "extended_socket_class",        /* POLICYDB_CAP_EXTSOCKCLASS */
> +       "always_check_network",         /* POLICYDB_CAP_ALWAYSNETWORK */
> +       "cgroup_seclabel",              /* POLICYDB_CAP_SECLABEL */
> +       "nnp_nosuid_transition",        /* POLICYDB_CAP_NNP_NOSUID_TRANSITION */
> +       "genfs_seclabel_symlinks",      /* POLICYDB_CAP_GENFS_SECLABEL_SYMLINKS */
> +       "ioctl_skip_cloexec",           /* POLICYDB_CAP_IOCTL_SKIP_CLOEXEC */
>         NULL
>  };
>
> @@ -21,7 +21,7 @@ int sepol_polcap_getnum(const char *name)
>  {
>         int capnum;
>
> -       for (capnum = 0; capnum <= POLICYDB_CAPABILITY_MAX; capnum++) {
> +       for (capnum = 0; capnum <= POLICYDB_CAP_MAX; capnum++) {
>                 if (polcap_names[capnum] == NULL)
>                         continue;
>                 if (strcasecmp(polcap_names[capnum], name) == 0)
> @@ -32,7 +32,7 @@ int sepol_polcap_getnum(const char *name)
>
>  const char *sepol_polcap_getname(unsigned int capnum)
>  {
> -       if (capnum > POLICYDB_CAPABILITY_MAX)
> +       if (capnum > POLICYDB_CAP_MAX)
>                 return NULL;
>
>         return polcap_names[capnum];
> --
> 2.35.1
>



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux