All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] restorecond: compatible with the use of EUID
@ 2023-08-05  7:06 Huizhao Wang
  2023-10-31 17:02 ` Petr Lautrbach
  0 siblings, 1 reply; 3+ messages in thread
From: Huizhao Wang @ 2023-08-05  7:06 UTC (permalink / raw)
  To: selinux; +Cc: weiyuchen3, dongxinhua, wanghuizhao1

The `EUID` does not exist in some shell environments. To ensure compatibility,
use `id -u` instead of `EUID` when `EUID` does not exist.

Signed-off-by: Huizhao Wang <wanghuizhao1@huawei.com>
---
 restorecond/restorecond.init | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/restorecond/restorecond.init b/restorecond/restorecond.init
index c1cbb247..4e71a2c6 100644
--- a/restorecond/restorecond.init
+++ b/restorecond/restorecond.init
@@ -29,7 +29,11 @@ PATH=/sbin:/bin:/usr/bin:/usr/sbin
 [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled || exit 7
 
 # Check that we are root ... so non-root users stop here
-test $EUID = 0  || exit 4
+if [ $EUID  ]; then
+	test $EUID = 0  || exit 4
+else
+	test `id -u` = 0  || exit 4
+fi
 
 test -x /usr/sbin/restorecond  || exit 5
 test -f /etc/selinux/restorecond.conf  || exit 6
-- 
2.12.3


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

* Re: [PATCH] restorecond: compatible with the use of EUID
  2023-08-05  7:06 [PATCH] restorecond: compatible with the use of EUID Huizhao Wang
@ 2023-10-31 17:02 ` Petr Lautrbach
  2023-11-07 21:39   ` James Carter
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Lautrbach @ 2023-10-31 17:02 UTC (permalink / raw)
  To: Huizhao Wang, selinux; +Cc: weiyuchen3, dongxinhua, wanghuizhao1

Huizhao Wang <wanghuizhao1@huawei.com> writes:

> The `EUID` does not exist in some shell environments. To ensure compatibility,
> use `id -u` instead of `EUID` when `EUID` does not exist.
>
> Signed-off-by: Huizhao Wang <wanghuizhao1@huawei.com>

Acked-by: Petr Lautrbach <lautrbach@redhat.com>

> ---
>  restorecond/restorecond.init | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/restorecond/restorecond.init b/restorecond/restorecond.init
> index c1cbb247..4e71a2c6 100644
> --- a/restorecond/restorecond.init
> +++ b/restorecond/restorecond.init
> @@ -29,7 +29,11 @@ PATH=/sbin:/bin:/usr/bin:/usr/sbin
>  [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled || exit 7
>  
>  # Check that we are root ... so non-root users stop here
> -test $EUID = 0  || exit 4
> +if [ $EUID  ]; then
> +	test $EUID = 0  || exit 4
> +else
> +	test `id -u` = 0  || exit 4
> +fi
>  
>  test -x /usr/sbin/restorecond  || exit 5
>  test -f /etc/selinux/restorecond.conf  || exit 6
> -- 
> 2.12.3


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

* Re: [PATCH] restorecond: compatible with the use of EUID
  2023-10-31 17:02 ` Petr Lautrbach
@ 2023-11-07 21:39   ` James Carter
  0 siblings, 0 replies; 3+ messages in thread
From: James Carter @ 2023-11-07 21:39 UTC (permalink / raw)
  To: Petr Lautrbach; +Cc: Huizhao Wang, selinux, weiyuchen3, dongxinhua

On Tue, Oct 31, 2023 at 1:04 PM Petr Lautrbach <lautrbach@redhat.com> wrote:
>
> Huizhao Wang <wanghuizhao1@huawei.com> writes:
>
> > The `EUID` does not exist in some shell environments. To ensure compatibility,
> > use `id -u` instead of `EUID` when `EUID` does not exist.
> >
> > Signed-off-by: Huizhao Wang <wanghuizhao1@huawei.com>
>
> Acked-by: Petr Lautrbach <lautrbach@redhat.com>
>

Merged.
Thanks,
Jim

> > ---
> >  restorecond/restorecond.init | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/restorecond/restorecond.init b/restorecond/restorecond.init
> > index c1cbb247..4e71a2c6 100644
> > --- a/restorecond/restorecond.init
> > +++ b/restorecond/restorecond.init
> > @@ -29,7 +29,11 @@ PATH=/sbin:/bin:/usr/bin:/usr/sbin
> >  [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled || exit 7
> >
> >  # Check that we are root ... so non-root users stop here
> > -test $EUID = 0  || exit 4
> > +if [ $EUID  ]; then
> > +     test $EUID = 0  || exit 4
> > +else
> > +     test `id -u` = 0  || exit 4
> > +fi
> >
> >  test -x /usr/sbin/restorecond  || exit 5
> >  test -f /etc/selinux/restorecond.conf  || exit 6
> > --
> > 2.12.3
>

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

end of thread, other threads:[~2023-11-07 21:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-05  7:06 [PATCH] restorecond: compatible with the use of EUID Huizhao Wang
2023-10-31 17:02 ` Petr Lautrbach
2023-11-07 21:39   ` 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.