SELinux Security Module development
 help / color / mirror / Atom feed
From: Petr Lautrbach <lautrbach@redhat.com>
To: James Carter <jwcart2@gmail.com>, Masatake YAMATO <yamato@redhat.com>
Cc: selinux@vger.kernel.org
Subject: Re: [PATCH v2 1/2] dismod: print the policy version only in interactive mode
Date: Fri, 30 Jun 2023 14:25:18 +0200	[thread overview]
Message-ID: <87zg4hyw5t.fsf@redhat.com> (raw)
In-Reply-To: <CAP+JOzQXyjmqh65=uXi18Z7_yNAg0ne0cPhxyXs7miqfb5F0Xg@mail.gmail.com>

James Carter <jwcart2@gmail.com> writes:

> On Wed, Jun 14, 2023 at 3:23 PM Masatake YAMATO <yamato@redhat.com> wrote:
>>
>> Instead, a new action, 'v' for printing the policy (and/or
>> module) version in batch mode is added.
>>
>> Signed-off-by: Masatake YAMATO <yamato@redhat.com>
>
> For both patches:
> Acked-by: James Carter <jwcart2@gmail.com>

both merged, thanks!


>> ---
>>  checkpolicy/test/dismod.c | 30 ++++++++++++++++++++----------
>>  1 file changed, 20 insertions(+), 10 deletions(-)
>>
>> diff --git a/checkpolicy/test/dismod.c b/checkpolicy/test/dismod.c
>> index 515fc9a5..fa729ef2 100644
>> --- a/checkpolicy/test/dismod.c
>> +++ b/checkpolicy/test/dismod.c
>> @@ -91,6 +91,7 @@ static struct command {
>>         {CMD|NOOPT, 'l', "Link in a module"},
>>         {CMD,       'u', "Display the unknown handling setting"},
>>         {CMD,       'F', "Display filename_trans rules"},
>> +       {CMD,       'v', "display the version of policy and/or module"},
>>         {HEADER, 0, ""},
>>         {CMD|NOOPT, 'f',  "set output file"},
>>         {CMD|NOOPT, 'm',  "display menu"},
>> @@ -899,6 +900,19 @@ static int menu(void)
>>         return 0;
>>  }
>>
>> +static void print_version_info(policydb_t * p, FILE * fp)
>> +{
>> +       if (p->policy_type == POLICY_BASE) {
>> +               fprintf(fp, "Binary base policy file loaded.\n");
>> +       } else {
>> +               fprintf(fp, "Binary policy module file loaded.\n");
>> +               fprintf(fp, "Module name: %s\n", p->name);
>> +               fprintf(fp, "Module version: %s\n", p->version);
>> +       }
>> +
>> +       fprintf(fp, "Policy version: %d\n\n", p->policyvers);
>> +}
>> +
>>  int main(int argc, char **argv)
>>  {
>>         char *ops = NULL;
>> @@ -952,17 +966,10 @@ int main(int argc, char **argv)
>>                 exit(1);
>>         }
>>
>> -       if (policydb.policy_type == POLICY_BASE) {
>> -               printf("Binary base policy file loaded.\n");
>> -       } else {
>> -               printf("Binary policy module file loaded.\n");
>> -               printf("Module name: %s\n", policydb.name);
>> -               printf("Module version: %s\n", policydb.version);
>> -       }
>> -
>> -       printf("Policy version: %d\n\n", policydb.policyvers);
>> -       if (!ops)
>> +       if (!ops) {
>> +               print_version_info(&policydb, stdout);
>>                 menu();
>> +       }
>>         for (;;) {
>>                 if (ops) {
>>                         puts("");
>> @@ -1069,6 +1076,9 @@ int main(int argc, char **argv)
>>                 case 'l':
>>                         link_module(&policydb, out_fp);
>>                         break;
>> +               case 'v':
>> +                       print_version_info(&policydb, out_fp);
>> +                       break;
>>                 case 'q':
>>                         policydb_destroy(&policydb);
>>                         exit(0);
>> --
>> 2.40.1
>>


      reply	other threads:[~2023-06-30 12:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-14 19:16 [PATCH v2 1/2] dismod: print the policy version only in interactive mode Masatake YAMATO
2023-06-14 19:16 ` [PATCH v2 2/2] dismod, dispol: reduce the messages in batch mode Masatake YAMATO
2023-06-14 19:54 ` [PATCH v2 1/2] dismod: print the policy version only in interactive mode James Carter
2023-06-30 12:25   ` Petr Lautrbach [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zg4hyw5t.fsf@redhat.com \
    --to=lautrbach@redhat.com \
    --cc=jwcart2@gmail.com \
    --cc=selinux@vger.kernel.org \
    --cc=yamato@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox