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@xxxxxxxxxx>
Cc: Petr Lautrbach <plautrba@xxxxxxxxxx>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1794518
Signed-off-by: Laszlo Ersek <lersek@xxxxxxxxxx>
---
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@xxxxxxxxxxxxxxxxxxx>