From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from goalie.tycho.ncsc.mil (goalie.tycho.ncsc.mil [144.51.242.250]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id w93I7wqF020013 for ; Wed, 3 Oct 2018 14:07:58 -0400 Received: by mail-wr1-f68.google.com with SMTP id u12-v6so7130257wrr.4 for ; Wed, 03 Oct 2018 11:05:44 -0700 (PDT) MIME-Version: 1.0 References: <20181003155007.26898-1-omosnace@redhat.com> In-Reply-To: <20181003155007.26898-1-omosnace@redhat.com> From: Jason Zaman Date: Thu, 4 Oct 2018 02:05:32 +0800 Message-ID: To: Ondrej Mosnacek Cc: SELinux ML Content-Type: multipart/alternative; boundary="000000000000ffa3f3057756e2b9" Subject: Re: [PATCH] restorecond: Do not ignore the -f option List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: --000000000000ffa3f3057756e2b9 Content-Type: text/plain; charset="UTF-8" Ack. (sorry for the HTML email) On Wed, 3 Oct 2018, 23:52 Ondrej Mosnacek, wrote: > Since the default value of watch_file is set unconditionally *after* the > command-line arguments have been parsed, the -f option is (and has > always been) effectively ignored. Fix this by setting it before the > parsing. > > Fixes: 48681bb49c03 ("policycoreutils: restorecond: make restorecond > dbuss-able") > Signed-off-by: Ondrej Mosnacek > --- > restorecond/restorecond.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/restorecond/restorecond.c b/restorecond/restorecond.c > index e1d26cb9..7b984b29 100644 > --- a/restorecond/restorecond.c > +++ b/restorecond/restorecond.c > @@ -148,6 +148,8 @@ int main(int argc, char **argv) > if (is_selinux_enabled() != 1) > return 0; > > + watch_file = server_watch_file; > + > /* Set all options to zero/NULL except for ignore_noent & digest. > */ > memset(&r_opts, 0, sizeof(r_opts)); > r_opts.ignore_noent = SELINUX_RESTORECON_IGNORE_NOENTRY; > @@ -205,7 +207,6 @@ int main(int argc, char **argv) > return 0; > } > > - watch_file = server_watch_file; > read_config(master_fd, watch_file); > > if (!debug_mode) { > -- > 2.17.1 > > _______________________________________________ > Selinux mailing list > Selinux@tycho.nsa.gov > To unsubscribe, send email to Selinux-leave@tycho.nsa.gov. > To get help, send an email containing "help" to > Selinux-request@tycho.nsa.gov. > --000000000000ffa3f3057756e2b9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Ack. (sorry for the HTML email)

On Wed, 3 Oct 2018, 23:52 Ondrej Mosnacek, <= omosnace@redhat.com> wrote:
Since the default value of watch_fil= e is set unconditionally *after* the
command-line arguments have been parsed, the -f option is (and has
always been) effectively ignored. Fix this by setting it before the
parsing.

Fixes: 48681bb49c03 ("policycoreutils: restorecond: make restorecond d= buss-able")
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
---
=C2=A0restorecond/restorecond.c | 3 ++-
=C2=A01 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/restorecond/restorecond.c b/restorecond/restorecond.c
index e1d26cb9..7b984b29 100644
--- a/restorecond/restorecond.c
+++ b/restorecond/restorecond.c
@@ -148,6 +148,8 @@ int main(int argc, char **argv)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (is_selinux_enabled() !=3D 1)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;

+=C2=A0 =C2=A0 =C2=A0 =C2=A0watch_file =3D server_watch_file;
+
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Set all options to zero/NULL except for igno= re_noent & digest. */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 memset(&r_opts, 0, sizeof(r_opts));
=C2=A0 =C2=A0 =C2=A0 =C2=A0 r_opts.ignore_noent =3D SELINUX_RESTORECON_IGNO= RE_NOENTRY;
@@ -205,7 +207,6 @@ int main(int argc, char **argv)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }

-=C2=A0 =C2=A0 =C2=A0 =C2=A0watch_file =3D server_watch_file;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 read_config(master_fd, watch_file);

=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!debug_mode) {
--
2.17.1

_______________________________________________
Selinux mailing list
Selinux@tycho.nsa.gov
To unsubscribe, send email to Selinux-leave@tycho.nsa.gov.
To get help, send an email containing "help" to Selinu= x-request@tycho.nsa.gov.
--000000000000ffa3f3057756e2b9--