Message ID | 20220307105417.11913-1-richard_c_haines@btinternet.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 0d84ebcbc475 |
Headers | show |
Series | libsepol: Shorten the policy capability enum names | expand |
On Tue, Mar 8, 2022 at 10:02 AM Richard Haines <richard_c_haines@btinternet.com> 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@btinternet.com> Acked-by: James Carter <jwcart2@gmail.com> > --- > 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 >
On Thu, Mar 10, 2022 at 1:33 PM James Carter <jwcart2@gmail.com> wrote: > > On Tue, Mar 8, 2022 at 10:02 AM Richard Haines > <richard_c_haines@btinternet.com> 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@btinternet.com> > > Acked-by: James Carter <jwcart2@gmail.com> > Merged. Thanks, Jim > > --- > > 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 > >
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];
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@btinternet.com> --- libsepol/include/sepol/policydb/polcaps.h | 20 ++++++++++---------- libsepol/src/polcaps.c | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-)