Skip to contentSkip to conversation

policycoreutils diff

PATCH Daniel J Walsh 2 participants 2 messages Feb 7, 2005 SELinux security module

lore
Share & tools
lore
#0 lore raw

sestatus was going into infinite loops with booleans > 30 chars.

Dan

scripts/fixfiles +3 -3
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/fixfiles policycoreutils-1.21.12/scripts/fixfiles
@@ -67,8 +67,8 @@
                -e 's|\?.*|*|g' \
 	       -e 's|\(.*|*|g' \
 	       -e 's|\[.*|*|g' \
-               -e 's|\.\*|*|g' \
-               -e 's|\.\+|*|g' | \
+               -e 's|\.\*.*|*|g' \
+               -e 's|\.\+.*|*|g' | \
 	sort -d -u | \
         while read pattern ; \
 	    do if ! echo "$pattern" | grep -q -f ${TEMPFILE} 2>/dev/null; then \
@@ -79,7 +79,7 @@
                fi; \
             done | \
 	while read pattern ; do find $pattern -maxdepth 0 -print; done 2> /dev/null | \
-	${RESTORECON} -R $2 -v -e /root -e /home -e /tmp -e /var/tmp -e /dev -f - 
+	 ${RESTORECON} -R $2 -v -e /root -e /home -e /tmp -e /var/tmp -e /dev -f - 
 	rm -f ${TEMPFILE}
 fi
 }
sestatus/sestatus.c +8 -9
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/sestatus/sestatus.c policycoreutils-1.21.12/sestatus/sestatus.c
@@ -30,7 +30,7 @@
 #define BUFSIZE 255
 
 /* column to put the output (must be a multiple of 8) */
-#define COL 32
+static int COL=32;
 
 extern char *selinux_mnt;
 
@@ -152,15 +152,10 @@
 }
 
 void printf_tab(const char *outp) {
-	/* print then add appropriate number of tabs */
-	int i, count;
+  char buf[20];
+  snprintf(buf, sizeof(buf), "%%-%ds", COL);
+	printf(buf, outp);
 
-	printf("%s",outp);
-
-	/* insert the right number of tabs */
-	count=((COL - strlen(outp) -1) / 8);
-	for( i=0 ; i<count ; i++ )
-		printf("\t");
 }
 
 int main(int argc, char **argv) {
@@ -276,6 +271,10 @@
 		printf("\nPolicy booleans:\n");
 
 		for( i=0 ; i<nbool ; i++ ) {
+			if (strlen(bools[i]) + 1 > COL) 
+			    COL=strlen(bools[i])+1;
+		}
+		for( i=0 ; i<nbool ; i++ ) {
 			printf_tab(bools[i]);
 
 			rc=security_get_boolean_active(bools[i]);
#1 lore raw
Quoted 1 line · Daniel J Walsh

sestatus was going into infinite loops with booleans > 30 chars.

Thanks, merged as of policycoreutils 1.21.13.

Signature · 8 lines
Stephen Smalley <[email protected]>
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.