Skip to contentSkip to conversation

Patch to load_policy to enforce quiet option

PATCH Daniel J Walsh 4 participants 6 messages Nov 29, 2006 – Jan 3, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw
load_policy/load_policy.c +5 -5
diff --exclude-from=exclude --exclude POTFILES.in --exclude='*.po' --exclude='*.pot' -N -u -r nsapolicycoreutils/load_policy/load_policy.c policycoreutils-1.33.5/load_policy/load_policy.c
@@ -50,12 +50,12 @@
 	nargs = argc - optind;
 	if (nargs > 2)
 		usage(argv[0]);
-	if (nargs >= 1) {
-		fprintf(stderr,
-			"%s:  Warning!  Policy file argument (%s) is no longer supported, installed policy is always loaded.  Continuing...\n",
-			argv[0], argv[optind++]);
+	if (nargs >= 1 && !quiet) {
+			fprintf(stderr,
+				"%s:  Warning!  Policy file argument (%s) is no longer supported, installed policy is always loaded.  Continuing...\n",
+				argv[0], argv[optind++]);
 	}
-	if (nargs == 2) {
+	if (nargs == 2 && ! quiet) {
 		fprintf(stderr,
 			"%s:  Warning!  Boolean file argument (%s) is no longer supported, installed booleans file is always used.  Continuing...\n",
 			argv[0], argv[optind++]);
#1 lore raw
Quoted 15 lines · Daniel J Walsh

------------------------------------------------------------------------

diff --exclude-from=exclude --exclude POTFILES.in --exclude='*.po' --exclude='*.pot' -N -u -r nsapolicycoreutils/load_policy/load_policy.c policycoreutils-1.33.5/load_policy/load_policy.c

load_policy/load_policy.c +0 -4
@@ -50,12 +50,12 @@
 	nargs = argc - optind;
 	if (nargs > 2)
 		usage(argv[0]);
-	if (nargs >= 1) {
-		fprintf(stderr,
-			"%s:  Warning!  Policy file argument (%s) is no longer supported, installed policy is always loaded.  Continuing...\n",
-			argv[0], argv[optind++]);

load_policy/load_policy.c line 61

Quoted 10 lines
load_policy/load_policy.c +5 -1
+	if (nargs >= 1 && !quiet) {
+			fprintf(stderr,
+				"%s:  Warning!  Policy file argument (%s) is no longer supported, installed policy is always loaded.  Continuing...\n",
+				argv[0], argv[optind++]);
 	}
-	if (nargs == 2) {
+	if (nargs == 2 && ! quiet) {
 		fprintf(stderr,
 			"%s:  Warning!  Boolean file argument (%s) is no longer supported, installed booleans file is always used.  Continuing...\n",
 			argv[0], argv[optind++]);

Hrm. Should quiet really squelch warnings? Also, it looks like load_policy is using a deprecated interface to squelch other output from libsepol, this should probably be fixed.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#2 lore raw
Quoted 28 lines · Joshua Brindle
Quoted 27 lines · Daniel J Walsh

------------------------------------------------------------------------

diff --exclude-from=exclude --exclude POTFILES.in --exclude='*.po' --exclude='*.pot' -N -u -r
nsapolicycoreutils/load_policy/load_policy.c policycoreutils-1.33.5/load_policy/load_policy.c
--- nsapolicycoreutils/load_policy/load_policy.c 2006-11-16
17:14:31.000000000 -0500
+++ policycoreutils-1.33.5/load_policy/load_policy.c 2006-11-28
10:44:25.000000000 -0500

load_policy/load_policy.c +4 -5
@@ -50,12 +50,12 @@
     nargs = argc - optind;
     if (nargs > 2)
         usage(argv[0]);
-    if (nargs >= 1) {
-        fprintf(stderr,
-            "%s:  Warning!  Policy file argument (%s) is no longer 
 supported, installed policy is always loaded.  Continuing...\n",
-            argv[0], argv[optind++]);
+    if (nargs >= 1 && !quiet) {
+            fprintf(stderr,
+                "%s:  Warning!  Policy file argument (%s) is no 
 longer supported, installed policy is always loaded.  Continuing...\n",
+                argv[0], argv[optind++]);
     }
-    if (nargs == 2) {
Quoted 9 lines
Quoted 5 lines
load_policy/load_policy.c +1 -0
+    if (nargs == 2 && ! quiet) {
         fprintf(stderr,

"%s: Warning! Boolean file argument (%s) is no longer
supported, installed booleans file is always used. Continuing...\n",

             argv[0], argv[optind++]);

Hrm. Should quiet really squelch warnings? Also, it looks like load_policy is using a deprecated interface to squelch other output from libsepol, this should probably be fixed.

man load_policy
...
-q suppress warning messages.
...

I think this was originally added to stop things like boolean is no longer in this package. It might not be necessary any longer, but if we have it we should be consistant.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#3 lore raw
Quoted 38 lines · Daniel J Walsh
Quoted 28 lines · Joshua Brindle
Quoted 27 lines · Daniel J Walsh

------------------------------------------------------------------------

diff --exclude-from=exclude --exclude POTFILES.in --exclude='*.po' --exclude='*.pot' -N -u -r
nsapolicycoreutils/load_policy/load_policy.c policycoreutils-1.33.5/load_policy/load_policy.c
--- nsapolicycoreutils/load_policy/load_policy.c 2006-11-16
17:14:31.000000000 -0500
+++ policycoreutils-1.33.5/load_policy/load_policy.c 2006-11-28
10:44:25.000000000 -0500

load_policy/load_policy.c +4 -5
@@ -50,12 +50,12 @@
     nargs = argc - optind;
     if (nargs > 2)
         usage(argv[0]);
-    if (nargs >= 1) {
-        fprintf(stderr,
-            "%s:  Warning!  Policy file argument (%s) is no longer 
 supported, installed policy is always loaded.  Continuing...\n",
-            argv[0], argv[optind++]);
+    if (nargs >= 1 && !quiet) {
+            fprintf(stderr,
+                "%s:  Warning!  Policy file argument (%s) is no 
 longer supported, installed policy is always loaded.  Continuing...\n",
+                argv[0], argv[optind++]);
     }
-    if (nargs == 2) {
Quoted 9 lines
Quoted 5 lines
load_policy/load_policy.c +1 -0
+    if (nargs == 2 && ! quiet) {
         fprintf(stderr,

"%s: Warning! Boolean file argument (%s) is no longer
supported, installed booleans file is always used. Continuing...\n",

             argv[0], argv[optind++]);

Hrm. Should quiet really squelch warnings? Also, it looks like load_policy is using a deprecated interface to squelch other output from libsepol, this should probably be fixed.

Quoted 8 lines

man load_policy
...
-q suppress warning messages.
...

I think this was originally added to stop things like boolean is no longer in this package. It might not be necessary any longer, but if we have it we should be consistant.

What is the status of this? I'm fine with the patch, but I didn't see it get merged or any resolution.

Karl

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#4 lore raw
Quoted 48 lines · Karl MacMillan
Quoted 47 lines · Daniel J Walsh
Quoted 31 lines · Joshua Brindle
Quoted 30 lines · Daniel J Walsh

------------------------------------------------------------------------

diff --exclude-from=exclude --exclude POTFILES.in --exclude='*.po' --exclude='*.pot' -N -u -r nsapolicycoreutils/load_policy/load_policy.c policycoreutils-1.33.5/load_policy/load_policy.c
--- nsapolicycoreutils/load_policy/load_policy.c 2006-11-16
17:14:31.000000000 -0500
+++ policycoreutils-1.33.5/load_policy/load_policy.c 2006-11-28
10:44:25.000000000 -0500

load_policy/load_policy.c +5 -5
@@ -50,12 +50,12 @@
     nargs = argc - optind;
     if (nargs > 2)
         usage(argv[0]);
-    if (nargs >= 1) {
-        fprintf(stderr,
-            "%s:  Warning!  Policy file argument (%s) is no longer 
 supported, installed policy is always loaded.  Continuing...\n",
-            argv[0], argv[optind++]);
+    if (nargs >= 1 && !quiet) {
+            fprintf(stderr,
+                "%s:  Warning!  Policy file argument (%s) is no 
 longer supported, installed policy is always loaded.  Continuing...\n",
+                argv[0], argv[optind++]);
     }
-    if (nargs == 2) {
+    if (nargs == 2 && ! quiet) {
         fprintf(stderr,
Quoted 9 lines
Quoted 3 lines

"%s: Warning! Boolean file argument (%s) is no longer
supported, installed booleans file is always used. Continuing...\n",

             argv[0], argv[optind++]);

Hrm. Should quiet really squelch warnings? Also, it looks like load_policy is using a deprecated interface to squelch other output from libsepol, this should probably be fixed.

man load_policy
...
-q suppress warning messages.
...

Quoted 7 lines
Quoted 4 lines

I think this was originally added to stop things like boolean is no longer in this package. It might not be necessary any longer, but if we have it we should be consistant.

What is the status of this? I'm fine with the patch, but I didn't see it get merged or any resolution.

The patch is ok. Separate patch to remove or replace the sepol_debug() call would be appropriate, but likely requires a bit of examination of the impact - even with the modern policy loading logic, load policy will end up triggering a sepol_genbools_array() call to preserve active boolean settings, and that will emit warnings about removed booleans unless some action is taken to suppress them (modern interface for doing that would be sepol_msg_set_callback()).

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#5 lore raw
In reply to Daniel J Walsh
Quoted 2 lines · Daniel J Walsh

This patch was merged as policycoreutils 1.33.7.

Karl

Quoted 13 lines

------------------------------------------------------------------------

diff --exclude-from=exclude --exclude POTFILES.in --exclude='*.po' --exclude='*.pot' -N -u -r nsapolicycoreutils/load_policy/load_policy.c policycoreutils-1.33.5/load_policy/load_policy.c

load_policy/load_policy.c +0 -4
@@ -50,12 +50,12 @@
 	nargs = argc - optind;
 	if (nargs > 2)
 		usage(argv[0]);
-	if (nargs >= 1) {
-		fprintf(stderr,
-			"%s:  Warning!  Policy file argument (%s) is no longer supported, installed policy is always loaded.  Continuing...\n",
-			argv[0], argv[optind++]);

load_policy/load_policy.c line 61

Quoted 10 lines
load_policy/load_policy.c +5 -1
+	if (nargs >= 1 && !quiet) {
+			fprintf(stderr,
+				"%s:  Warning!  Policy file argument (%s) is no longer supported, installed policy is always loaded.  Continuing...\n",
+				argv[0], argv[optind++]);
 	}
-	if (nargs == 2) {
+	if (nargs == 2 && ! quiet) {
 		fprintf(stderr,
 			"%s:  Warning!  Boolean file argument (%s) is no longer supported, installed booleans file is always used.  Continuing...\n",
 			argv[0], argv[optind++]);

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.