All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Carter <jwcart2@tycho.nsa.gov>
To: Caleb Case <ccase@tresys.com>
Cc: selinux@tycho.nsa.gov, csellers@tresys.com,
	kmacmillan@tresys.com, jbrindle@tresys.com, sds@tycho.nsa.gov
Subject: Re: [PATCH 14/15] [src-policy] semodule: user message support
Date: Mon, 01 Feb 2010 10:11:52 -0500	[thread overview]
Message-ID: <1265037112.2128.4.camel@localhost> (raw)
In-Reply-To: <1264543701-20638-15-git-send-email-ccase@tresys.com>

On Tue, 2010-01-26 at 17:08 -0500, Caleb Case wrote:
> This adds the -m,--message option to semodule so that users can specify
> a message for the ChangeLog.
> 

Is there plans to add user message support to semanage?  Unfortunately,
in semanage "-m" is already in use.

>   -m,--message=MSG user message for the ChangeLog
> 
> Example:
> 
> # semodule -E alsa -m "Allow alsa to execute cowsay."
> ---
>  policycoreutils/semodule/semodule.8 |    3 +++
>  policycoreutils/semodule/semodule.c |   24 +++++++++++++++++++++++-
>  2 files changed, 26 insertions(+), 1 deletions(-)
> 
> diff --git a/policycoreutils/semodule/semodule.8 b/policycoreutils/semodule/semodule.8
> index 8baad8b..97d31dd 100644
> --- a/policycoreutils/semodule/semodule.8
> +++ b/policycoreutils/semodule/semodule.8
> @@ -87,6 +87,9 @@ prints help message and quit
>  .TP
>  .B  \-v,\-\-verbose     
>  be verbose
> +.TP
> +.B  \-m,\-\-message=MSG
> +user message for the ChangeLog
>  
>  .SH EXAMPLE
>  .nf
> diff --git a/policycoreutils/semodule/semodule.c b/policycoreutils/semodule/semodule.c
> index 3536253..c8bf986 100644
> --- a/policycoreutils/semodule/semodule.c
> +++ b/policycoreutils/semodule/semodule.c
> @@ -58,6 +58,7 @@ static int create_store;
>  static int build;
>  static int disable_dontaudit;
>  static uint16_t priority;
> +static char *message = NULL;
>  
>  static semanage_handle_t *sh = NULL;
>  static char *store;
> @@ -72,6 +73,8 @@ static void cleanup(void)
>  		free(commands[num_commands].output);
>  	}
>  	free(commands);
> +
> +	free(message);
>  }
>  
>  /* Signal handlers. */
> @@ -134,6 +137,7 @@ static void usage(char *progname)
>  	printf("  -h,--help        print this message and quit\n");
>  	printf("  -v,--verbose     be verbose\n");
>  	printf("  -D,--disable_dontaudit	Remove dontaudits from policy\n");
> +	printf("  -m,--message=MSG user message for the ChangeLog\n");
>  }
>  
>  /* Sets the global mode variable to new_mode, but only if no other
> @@ -186,6 +190,7 @@ static void parse_command_line(int argc, char **argv)
>  		{"output", required_argument, NULL, 'o'},
>  		{"cil", 0, NULL, 'c'},
>  		{"edit", required_argument, NULL, 'E'},
> +		{"message", required_argument, NULL, 'm'},
>  		{NULL, 0, NULL, 0}
>  	};
>  	int i;
> @@ -195,7 +200,7 @@ static void parse_command_line(int argc, char **argv)
>  	create_store = 0;
>  	priority = 400;
>  	while ((i =
> -		getopt_long(argc, argv, "s:b:hi:l::vqr:u:RnBDp:e:d:g:o:cE:", opts,
> +		getopt_long(argc, argv, "s:b:hi:l::vqr:u:RnBDp:e:d:g:o:cE:m:", opts,
>  			    NULL)) != -1) {
>  		switch (i) {
>  		case 'b':
> @@ -294,6 +299,13 @@ static void parse_command_line(int argc, char **argv)
>  		case 'E':
>  			set_mode(EDIT_M, optarg);
>  			break;
> +		case 'm':
> +			message = strdup(optarg);
> +			if (message == NULL) {
> +				fprintf(stderr, "Failed to set message (out of memory).");
> +				exit(1);
> +			}
> +			break;
>  		case '?':
>  		default:{
>  				usage(argv[0]);
> @@ -414,6 +426,16 @@ int main(int argc, char *argv[])
>  		goto cleanup;
>  	}
>  
> +	if (message) {
> +		result = semanage_set_log_message(sh, message);
> +		if (result != 0) {
> +			fprintf(stderr,
> +				"%s: Failed to set ChangeLog message.",
> +				argv[0]);
> +			goto cleanup;
> +		}
> +	}
> +
>  	for (i = 0; i < num_commands; i++) {
>  		enum client_modes mode = commands[i].mode;
>  		char *mode_arg = commands[i].arg;

-- 
James Carter <jwcart2@tycho.nsa.gov>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

  parent reply	other threads:[~2010-02-01 15:11 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-26 22:08 [PATCH 00/15] RFC Source Policy Support Caleb Case
2010-01-26 22:08 ` [PATCH 01/15] [src-policy] refpol language and tools Caleb Case
2010-01-26 22:08   ` [PATCH 02/15] [src-policy] corenet " Caleb Case
2010-01-26 22:08     ` [PATCH 03/15] [src-policy] Reference Policy to refpol conversion tool Caleb Case
2010-01-26 22:08       ` [PATCH 04/15] [src-policy] refpol intermediate language compiler (refpol_ilc) Caleb Case
2010-01-26 22:08         ` [PATCH 05/15] [src-policy] language.d and language.conf parser Caleb Case
2010-01-26 22:08           ` [PATCH 06/15] [src-policy] libsemanage: compile hll module Caleb Case
2010-01-26 22:08             ` [PATCH 07/15] [src-policy] libsemanage: compile common intermediary language Caleb Case
2010-01-26 22:08               ` [PATCH 08/15] [src-policy] libsemanage: remove binary interfaces Caleb Case
2010-01-26 22:08                 ` [PATCH 09/15] [src-policy] semodule: remove base module support Caleb Case
2010-01-26 22:08                   ` [PATCH 10/15] [src-policy] libsemanage: get source module Caleb Case
2010-01-26 22:08                     ` [PATCH 11/15] [src-policy] semodule: get module source Caleb Case
2010-01-26 22:08                       ` [PATCH 12/15] [src-policy] semodule: edit module Caleb Case
2010-01-26 22:08                         ` [PATCH 13/15] [src-policy] libsemanage: ChangeLog support Caleb Case
2010-01-26 22:08                           ` [PATCH 14/15] [src-policy] semodule: user message support Caleb Case
2010-01-26 22:08                             ` [PATCH 15/15] [src-policy] semanage: source permissive module Caleb Case
2010-02-01 15:11                             ` James Carter [this message]
2010-02-01 17:00                               ` [PATCH 14/15] [src-policy] semodule: user message support Caleb Case
2010-02-01 17:06                                 ` James Carter
2010-01-27 20:21                         ` [PATCH 12/15] [src-policy] semodule: edit module Stephen Smalley
2010-01-28 20:52                       ` [PATCH 11/15] [src-policy] semodule: get module source James Carter
2010-01-29 20:32                 ` [PATCH 08/15] [src-policy] libsemanage: remove binary interfaces James Carter
2010-01-27 20:18             ` [PATCH 06/15] [src-policy] libsemanage: compile hll module Stephen Smalley
2010-01-27 20:42               ` Caleb Case
2010-01-27 20:46               ` Caleb Case
2010-01-28 21:03         ` [PATCH 04/15] [src-policy] refpol intermediate language compiler (refpol_ilc) James Carter
2010-02-01 17:43           ` Caleb Case
2010-01-27 19:39   ` [PATCH 01/15] [src-policy] refpol language and tools Stephen Smalley
2010-01-27 19:54     ` Caleb Case
2010-01-26 22:41 ` [PATCH 00/15] RFC Source Policy Support Xavier Toth
2010-01-27  1:17   ` Caleb Case
2010-01-27 15:10     ` Xavier Toth
2010-01-27 20:00 ` Stephen Smalley
2010-01-27 20:18   ` Caleb Case

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=1265037112.2128.4.camel@localhost \
    --to=jwcart2@tycho.nsa.gov \
    --cc=ccase@tresys.com \
    --cc=csellers@tresys.com \
    --cc=jbrindle@tresys.com \
    --cc=kmacmillan@tresys.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.