Skip to contentSkip to conversation

checkpolicy/test: Show all options for dispol and dismod in -h

PATCH Applied Vit Mojzis 3 participants 3 messages Apr 20 – May 15 SELinux security module

lore
Share & tools
lore

Vit Mojzis

author
#0 lore raw

PATCH 1/1 checkpolicy/test: Show all options for dispol and dismod in -h

Show the following options, which were hidden in the usage message, because they require additional input:

dispol:

  7    change a boolean value
  f    set output file
  m    display menu
  q    quit

dismod:

  l    Link in a module
  f    set output file
  m    display menu
  q    quit

Fixes:
$dispol -h
Usage:
sedispol [OPTIONS] binary_pol_file

  Options:
   -h, --help   print this help message
   -a, --actions ACTIONS   run non-interactively

Actions:

    1    display unconditional AVTAB
    2    display conditional AVTAB (entirely)
    3    display conditional AVTAB (only ENABLED rules)
    4    display conditional AVTAB (only DISABLED rules)
    5    display booleans
    6    display conditional expressions
    8    display role transitions
    c    display policy capabilities
    C    display classes
    u    display users
    r    display roles
    t    display types
    a    display type attributes
    p    display the list of permissive types
    U    display unknown handling setting
    F    display filename_trans rules

With the patch:

Actions:

    1    display unconditional AVTAB
    2    display conditional AVTAB (entirely)
    3    display conditional AVTAB (only ENABLED rules)
    4    display conditional AVTAB (only DISABLED rules)
    5    display booleans
    6    display conditional expressions
    7    change a boolean value
    8    display role transitions
    c    display policy capabilities
    C    display classes
    u    display users
    r    display roles
    t    display types
    a    display type attributes
    p    display the list of permissive types
    U    display unknown handling setting
    F    display filename_trans rules
    f    set output file
    m    display menu
    q    quit
---
 checkpolicy/test/dismod.c | 3 +--
 checkpolicy/test/dispol.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
checkpolicy/test/dismod.c +1 -2
index 4868190f..ed5aaa45 100644
@@ -106,8 +106,7 @@ static __attribute__((__noreturn__)) void usage(const char *progname)
 	puts("");
 	puts("Actions:");
 	for (unsigned int i = 0; commands[i].meta != EOL; i++) {
-		if (commands[i].meta == HEADER
-		    || commands[i].meta & NOOPT)
+		if (!(commands[i].meta & CMD))
 			continue;
 		printf("  %c    %s\n", commands[i].cmd, commands[i].desc);
 	}
checkpolicy/test/dispol.c +1 -2
index 3f80c1a2..c3339b88 100644
@@ -79,8 +79,7 @@ static __attribute__((__noreturn__)) void usage(const char *progname)
 	puts("");
 	puts("Actions:");
 	for (unsigned int i = 0; commands[i].meta != EOL; i++) {
-		if (commands[i].meta == HEADER
-		    || commands[i].meta & NOOPT)
+		if (!(commands[i].meta & CMD))
 			continue;
 		printf("  %c    %s\n", commands[i].cmd, commands[i].desc);
 	}
Signature · 1 line
2.53.0
Acked-by on v1 1/1
#1 lore raw
Quoted 67 lines · Vit Mojzis

Show the following options, which were hidden in the usage message, because they require additional input:

dispol:

  7    change a boolean value
  f    set output file
  m    display menu
  q    quit

dismod:

  l    Link in a module
  f    set output file
  m    display menu
  q    quit

Fixes:
$dispol -h
Usage:
sedispol [OPTIONS] binary_pol_file

  Options:
   -h, --help   print this help message
   -a, --actions ACTIONS   run non-interactively

Actions:

    1    display unconditional AVTAB
    2    display conditional AVTAB (entirely)
    3    display conditional AVTAB (only ENABLED rules)
    4    display conditional AVTAB (only DISABLED rules)
    5    display booleans
    6    display conditional expressions
    8    display role transitions
    c    display policy capabilities
    C    display classes
    u    display users
    r    display roles
    t    display types
    a    display type attributes
    p    display the list of permissive types
    U    display unknown handling setting
    F    display filename_trans rules

With the patch:

Actions:

    1    display unconditional AVTAB
    2    display conditional AVTAB (entirely)
    3    display conditional AVTAB (only ENABLED rules)
    4    display conditional AVTAB (only DISABLED rules)
    5    display booleans
    6    display conditional expressions
    7    change a boolean value
    8    display role transitions
    c    display policy capabilities
    C    display classes
    u    display users
    r    display roles
    t    display types
    a    display type attributes
    p    display the list of permissive types
    U    display unknown handling setting
    F    display filename_trans rules
    f    set output file
    m    display menu
    q    quit
Quoted 1 line
Quoted 37 lines
---
 checkpolicy/test/dismod.c | 3 +--
 checkpolicy/test/dispol.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
checkpolicy/test/dismod.c +1 -2
index 4868190f..ed5aaa45 100644
@@ -106,8 +106,7 @@ static __attribute__((__noreturn__)) void usage(const char *progname)
        puts("");
        puts("Actions:");
        for (unsigned int i = 0; commands[i].meta != EOL; i++) {
-               if (commands[i].meta == HEADER
-                   || commands[i].meta & NOOPT)
+               if (!(commands[i].meta & CMD))
                        continue;
                printf("  %c    %s\n", commands[i].cmd, commands[i].desc);
        }
checkpolicy/test/dispol.c +1 -3
index 3f80c1a2..c3339b88 100644
@@ -79,8 +79,7 @@ static __attribute__((__noreturn__)) void usage(const char *progname)
        puts("");
        puts("Actions:");
        for (unsigned int i = 0; commands[i].meta != EOL; i++) {
-               if (commands[i].meta == HEADER
-                   || commands[i].meta & NOOPT)
+               if (!(commands[i].meta & CMD))
                        continue;
                printf("  %c    %s\n", commands[i].cmd, commands[i].desc);
        }
--

2.53.0

#2 lore raw
Quoted 68 lines · James Carter
Quoted 67 lines · Vit Mojzis

Show the following options, which were hidden in the usage message, because they require additional input:

dispol:

  7    change a boolean value
  f    set output file
  m    display menu
  q    quit

dismod:

  l    Link in a module
  f    set output file
  m    display menu
  q    quit

Fixes:
$dispol -h
Usage:
sedispol [OPTIONS] binary_pol_file

  Options:
   -h, --help   print this help message
   -a, --actions ACTIONS   run non-interactively

Actions:

    1    display unconditional AVTAB
    2    display conditional AVTAB (entirely)
    3    display conditional AVTAB (only ENABLED rules)
    4    display conditional AVTAB (only DISABLED rules)
    5    display booleans
    6    display conditional expressions
    8    display role transitions
    c    display policy capabilities
    C    display classes
    u    display users
    r    display roles
    t    display types
    a    display type attributes
    p    display the list of permissive types
    U    display unknown handling setting
    F    display filename_trans rules

With the patch:

Actions:

    1    display unconditional AVTAB
    2    display conditional AVTAB (entirely)
    3    display conditional AVTAB (only ENABLED rules)
    4    display conditional AVTAB (only DISABLED rules)
    5    display booleans
    6    display conditional expressions
    7    change a boolean value
    8    display role transitions
    c    display policy capabilities
    C    display classes
    u    display users
    r    display roles
    t    display types
    a    display type attributes
    p    display the list of permissive types
    U    display unknown handling setting
    F    display filename_trans rules
    f    set output file
    m    display menu
    q    quit
Quoted 3 lines
Quoted 1 line

Merged, thanks!

Quoted 37 lines
Quoted 37 lines
---
 checkpolicy/test/dismod.c | 3 +--
 checkpolicy/test/dispol.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
checkpolicy/test/dismod.c +1 -2
index 4868190f..ed5aaa45 100644
@@ -106,8 +106,7 @@ static __attribute__((__noreturn__)) void usage(const char *progname)
        puts("");
        puts("Actions:");
        for (unsigned int i = 0; commands[i].meta != EOL; i++) {
-               if (commands[i].meta == HEADER
-                   || commands[i].meta & NOOPT)
+               if (!(commands[i].meta & CMD))
                        continue;
                printf("  %c    %s\n", commands[i].cmd, commands[i].desc);
        }
checkpolicy/test/dispol.c +1 -3
index 3f80c1a2..c3339b88 100644
@@ -79,8 +79,7 @@ static __attribute__((__noreturn__)) void usage(const char *progname)
        puts("");
        puts("Actions:");
        for (unsigned int i = 0; commands[i].meta != EOL; i++) {
-               if (commands[i].meta == HEADER
-                   || commands[i].meta & NOOPT)
+               if (!(commands[i].meta & CMD))
                        continue;
                printf("  %c    %s\n", commands[i].cmd, commands[i].desc);
        }
--

2.53.0