Message ID | 20220428065354.27605-4-lersek@redhat.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | selinux_restorecon(3), setfiles(8): skip relabeling errors | expand |
On 4/28/2022 2:53 AM, Laszlo Ersek wrote: > Commit 219eea83cea9 ("policycoreutils: setfiles/restorecon: fix -r/-R > option", 2015-04-16) split the option strings between "setfiles" and > "restorecon". Since that commit, an "iamrestorecon" check has only been > necessary for an option that is (a) accepted by both "setfiles" and > "restorecon", but (b) behaves differently between "setfiles" and > "restorecon". Currently, the only such options are "-r" and "-R". Remove > the "iamrestorecon" checks from the "setfiles"-only "-c" and "-d" options, > and from the "restorecon"-only "-x" option. > > Cc: "Richard W.M. Jones" <rjones@redhat.com> > Cc: Petr Lautrbach <plautrba@redhat.com> > Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1794518 > Signed-off-by: Laszlo Ersek <lersek@redhat.com> > --- > policycoreutils/setfiles/setfiles.c | 11 +---------- > 1 file changed, 1 insertion(+), 10 deletions(-) > > diff --git a/policycoreutils/setfiles/setfiles.c b/policycoreutils/setfiles/setfiles.c > index cf504618d38f..aeec1fdcc2ab 100644 > --- a/policycoreutils/setfiles/setfiles.c > +++ b/policycoreutils/setfiles/setfiles.c > @@ -227,9 +227,6 @@ int main(int argc, char **argv) > { > FILE *policystream; > > - if (iamrestorecon) > - usage(argv[0]); > - > policyfile = optarg; > > policystream = fopen(policyfile, "r"); > @@ -267,8 +264,6 @@ int main(int argc, char **argv) > input_filename = optarg; > break; > case 'd': > - if (iamrestorecon) > - usage(argv[0]); > r_opts.debug = 1; > r_opts.log_matches = > SELINUX_RESTORECON_LOG_MATCHES; > @@ -367,11 +362,7 @@ int main(int argc, char **argv) > null_terminated = 1; > break; > case 'x': > - if (iamrestorecon) { > - r_opts.xdev = SELINUX_RESTORECON_XDEV; > - } else { > - usage(argv[0]); > - } > + r_opts.xdev = SELINUX_RESTORECON_XDEV; > break; > case 'T': > nthreads = strtoull(optarg, &endptr, 10); Reviewed-By: Daniel Burgener <dburgener@linux.microsoft.com>
diff --git a/policycoreutils/setfiles/setfiles.c b/policycoreutils/setfiles/setfiles.c index cf504618d38f..aeec1fdcc2ab 100644 --- a/policycoreutils/setfiles/setfiles.c +++ b/policycoreutils/setfiles/setfiles.c @@ -227,9 +227,6 @@ int main(int argc, char **argv) { FILE *policystream; - if (iamrestorecon) - usage(argv[0]); - policyfile = optarg; policystream = fopen(policyfile, "r"); @@ -267,8 +264,6 @@ int main(int argc, char **argv) input_filename = optarg; break; case 'd': - if (iamrestorecon) - usage(argv[0]); r_opts.debug = 1; r_opts.log_matches = SELINUX_RESTORECON_LOG_MATCHES; @@ -367,11 +362,7 @@ int main(int argc, char **argv) null_terminated = 1; break; case 'x': - if (iamrestorecon) { - r_opts.xdev = SELINUX_RESTORECON_XDEV; - } else { - usage(argv[0]); - } + r_opts.xdev = SELINUX_RESTORECON_XDEV; break; case 'T': nthreads = strtoull(optarg, &endptr, 10);
Commit 219eea83cea9 ("policycoreutils: setfiles/restorecon: fix -r/-R option", 2015-04-16) split the option strings between "setfiles" and "restorecon". Since that commit, an "iamrestorecon" check has only been necessary for an option that is (a) accepted by both "setfiles" and "restorecon", but (b) behaves differently between "setfiles" and "restorecon". Currently, the only such options are "-r" and "-R". Remove the "iamrestorecon" checks from the "setfiles"-only "-c" and "-d" options, and from the "restorecon"-only "-x" option. Cc: "Richard W.M. Jones" <rjones@redhat.com> Cc: Petr Lautrbach <plautrba@redhat.com> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1794518 Signed-off-by: Laszlo Ersek <lersek@redhat.com> --- policycoreutils/setfiles/setfiles.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)