All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libselinux: support objname in compute_create
@ 2022-08-30 17:54 Christian Göttsche
  2022-10-11 16:16 ` Christian Göttsche
  2022-10-12 15:39 ` James Carter
  0 siblings, 2 replies; 4+ messages in thread
From: Christian Göttsche @ 2022-08-30 17:54 UTC (permalink / raw)
  To: selinux

Support passing an optional object name to compute_create for name
based type transitions.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 libselinux/utils/compute_create.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libselinux/utils/compute_create.c b/libselinux/utils/compute_create.c
index c6481f4b..5401fe96 100644
--- a/libselinux/utils/compute_create.c
+++ b/libselinux/utils/compute_create.c
@@ -10,10 +10,11 @@ int main(int argc, char **argv)
 {
 	char *buf;
 	security_class_t tclass;
+	const char *objname;
 	int ret;
 
-	if (argc != 4) {
-		fprintf(stderr, "usage:  %s scontext tcontext tclass\n",
+	if (argc != 4 && argc != 5) {
+		fprintf(stderr, "usage:  %s scontext tcontext tclass [objname]\n",
 			argv[0]);
 		exit(1);
 	}
@@ -34,7 +35,9 @@ int main(int argc, char **argv)
 		exit(2);
 	}
 
-	ret = security_compute_create(argv[1], argv[2], tclass, &buf);
+	objname = (argc == 5) ? argv[4] : NULL;
+
+	ret = security_compute_create_name(argv[1], argv[2], tclass, objname, &buf);
 	if (ret < 0) {
 		fprintf(stderr, "%s:  security_compute_create failed:  %s\n",
 			argv[0], strerror(errno));
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] libselinux: support objname in compute_create
  2022-08-30 17:54 [PATCH] libselinux: support objname in compute_create Christian Göttsche
@ 2022-10-11 16:16 ` Christian Göttsche
  2022-10-12 15:39 ` James Carter
  1 sibling, 0 replies; 4+ messages in thread
From: Christian Göttsche @ 2022-10-11 16:16 UTC (permalink / raw)
  To: selinux

On Tue, 30 Aug 2022 at 19:55, Christian Göttsche <cgzones@googlemail.com> wrote:
>
> Support passing an optional object name to compute_create for name
> based type transitions.
>

Any comments?

Patchwork:
https://patchwork.kernel.org/project/selinux/patch/20220830175455.40660-1-cgzones@googlemail.com/

> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
> ---
>  libselinux/utils/compute_create.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/libselinux/utils/compute_create.c b/libselinux/utils/compute_create.c
> index c6481f4b..5401fe96 100644
> --- a/libselinux/utils/compute_create.c
> +++ b/libselinux/utils/compute_create.c
> @@ -10,10 +10,11 @@ int main(int argc, char **argv)
>  {
>         char *buf;
>         security_class_t tclass;
> +       const char *objname;
>         int ret;
>
> -       if (argc != 4) {
> -               fprintf(stderr, "usage:  %s scontext tcontext tclass\n",
> +       if (argc != 4 && argc != 5) {
> +               fprintf(stderr, "usage:  %s scontext tcontext tclass [objname]\n",
>                         argv[0]);
>                 exit(1);
>         }
> @@ -34,7 +35,9 @@ int main(int argc, char **argv)
>                 exit(2);
>         }
>
> -       ret = security_compute_create(argv[1], argv[2], tclass, &buf);
> +       objname = (argc == 5) ? argv[4] : NULL;
> +
> +       ret = security_compute_create_name(argv[1], argv[2], tclass, objname, &buf);
>         if (ret < 0) {
>                 fprintf(stderr, "%s:  security_compute_create failed:  %s\n",
>                         argv[0], strerror(errno));
> --
> 2.37.2
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libselinux: support objname in compute_create
  2022-08-30 17:54 [PATCH] libselinux: support objname in compute_create Christian Göttsche
  2022-10-11 16:16 ` Christian Göttsche
@ 2022-10-12 15:39 ` James Carter
  2022-10-13 15:26   ` James Carter
  1 sibling, 1 reply; 4+ messages in thread
From: James Carter @ 2022-10-12 15:39 UTC (permalink / raw)
  To: Christian Göttsche; +Cc: selinux

On Tue, Aug 30, 2022 at 2:04 PM Christian Göttsche
<cgzones@googlemail.com> wrote:
>
> Support passing an optional object name to compute_create for name
> based type transitions.
>
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>

Acked-by: James Carter <jwcart2@gmail.com>

> ---
>  libselinux/utils/compute_create.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/libselinux/utils/compute_create.c b/libselinux/utils/compute_create.c
> index c6481f4b..5401fe96 100644
> --- a/libselinux/utils/compute_create.c
> +++ b/libselinux/utils/compute_create.c
> @@ -10,10 +10,11 @@ int main(int argc, char **argv)
>  {
>         char *buf;
>         security_class_t tclass;
> +       const char *objname;
>         int ret;
>
> -       if (argc != 4) {
> -               fprintf(stderr, "usage:  %s scontext tcontext tclass\n",
> +       if (argc != 4 && argc != 5) {
> +               fprintf(stderr, "usage:  %s scontext tcontext tclass [objname]\n",
>                         argv[0]);
>                 exit(1);
>         }
> @@ -34,7 +35,9 @@ int main(int argc, char **argv)
>                 exit(2);
>         }
>
> -       ret = security_compute_create(argv[1], argv[2], tclass, &buf);
> +       objname = (argc == 5) ? argv[4] : NULL;
> +
> +       ret = security_compute_create_name(argv[1], argv[2], tclass, objname, &buf);
>         if (ret < 0) {
>                 fprintf(stderr, "%s:  security_compute_create failed:  %s\n",
>                         argv[0], strerror(errno));
> --
> 2.37.2
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libselinux: support objname in compute_create
  2022-10-12 15:39 ` James Carter
@ 2022-10-13 15:26   ` James Carter
  0 siblings, 0 replies; 4+ messages in thread
From: James Carter @ 2022-10-13 15:26 UTC (permalink / raw)
  To: Christian Göttsche; +Cc: selinux

On Wed, Oct 12, 2022 at 11:39 AM James Carter <jwcart2@gmail.com> wrote:
>
> On Tue, Aug 30, 2022 at 2:04 PM Christian Göttsche
> <cgzones@googlemail.com> wrote:
> >
> > Support passing an optional object name to compute_create for name
> > based type transitions.
> >
> > Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
>
> Acked-by: James Carter <jwcart2@gmail.com>
>

Merged.
Jim

> > ---
> >  libselinux/utils/compute_create.c | 9 ++++++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/libselinux/utils/compute_create.c b/libselinux/utils/compute_create.c
> > index c6481f4b..5401fe96 100644
> > --- a/libselinux/utils/compute_create.c
> > +++ b/libselinux/utils/compute_create.c
> > @@ -10,10 +10,11 @@ int main(int argc, char **argv)
> >  {
> >         char *buf;
> >         security_class_t tclass;
> > +       const char *objname;
> >         int ret;
> >
> > -       if (argc != 4) {
> > -               fprintf(stderr, "usage:  %s scontext tcontext tclass\n",
> > +       if (argc != 4 && argc != 5) {
> > +               fprintf(stderr, "usage:  %s scontext tcontext tclass [objname]\n",
> >                         argv[0]);
> >                 exit(1);
> >         }
> > @@ -34,7 +35,9 @@ int main(int argc, char **argv)
> >                 exit(2);
> >         }
> >
> > -       ret = security_compute_create(argv[1], argv[2], tclass, &buf);
> > +       objname = (argc == 5) ? argv[4] : NULL;
> > +
> > +       ret = security_compute_create_name(argv[1], argv[2], tclass, objname, &buf);
> >         if (ret < 0) {
> >                 fprintf(stderr, "%s:  security_compute_create failed:  %s\n",
> >                         argv[0], strerror(errno));
> > --
> > 2.37.2
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-13 15:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-30 17:54 [PATCH] libselinux: support objname in compute_create Christian Göttsche
2022-10-11 16:16 ` Christian Göttsche
2022-10-12 15:39 ` James Carter
2022-10-13 15:26   ` James Carter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.