All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Brindle <jbrindle@tresys.com>
To: Karl MacMillan <kmacmillan@mentalrootkit.com>
Cc: SELinux List <selinux@tycho.nsa.gov>
Subject: Re: [PATCH] allow semodule -i to accept list of modules
Date: Mon, 08 Jan 2007 23:08:40 -0500	[thread overview]
Message-ID: <45A31548.8030807@tresys.com> (raw)
In-Reply-To: <1168292627.14203.2.camel@localhost.localdomain>

Karl MacMillan wrote:
> The following patch allows semodule to handle a list of modules for
> installation (i.e., semodule -i *.pp now works).
>
>   
Hrm, while the current syntax isn't ideal I don't think its the best 
idea to change it abruptly. maybe you could make -I use the rest of the 
arguments or something otherwise this will break any number of rpm's, 
portage, the refpolicy makefiles and so on.

> Signed-off-by: Karl MacMillan <kmacmillan@mentalrootkit.com>
>
> diff -r e37f9d8d6611 policycoreutils/semodule/semodule.c
> --- a/policycoreutils/semodule/semodule.c	Mon Jan 08 15:00:14 2007 -0500
> +++ b/policycoreutils/semodule/semodule.c	Mon Jan 08 16:37:23 2007 -0500
> @@ -225,15 +225,6 @@ static void parse_command_line(int argc,
>  			}
>  		}
>  	}
> -	if (optind < argc) {
> -		fprintf(stderr, "Extraneous arguments:  ");
> -		while (optind < argc)
> -			fprintf(stderr, "%s", argv[optind++]);
> -		fprintf(stderr, "\n");
> -		usage(argv[0]);
> -		cleanup();
> -		exit(1);
> -	}
>  	if ((build || reload) && num_commands) {
>  		fprintf(stderr,
>  			"build or reload should not be used with other commands\n");
> @@ -244,6 +235,24 @@ static void parse_command_line(int argc,
>  		fprintf(stderr, "At least one mode must be specified.\n");
>  		usage(argv[0]);
>  		exit(1);
> +	}
> +
> +	if (optind < argc) {
> +		/* if -i was the last command treat any remaining
> +		 * arguments as modules to allow 'semodule -i *.pp' to
> +		 * work as expected.
> +		 */
> +		if (commands[num_commands - 1].mode == INSTALL_M) {
> +			while (optind < argc)
> +				set_mode(INSTALL_M, argv[optind++]);
> +		} else {
> +			fprintf(stderr, "unknown additional arguments:\n");
> +			while (optind < argc)
> +				fprintf(stderr, " %s", argv[optind++]);
> +			fprintf(stderr, "\n\n");
> +			usage(argv[0]);
> +			exit(1);
> +		}
>  	}
>  }
>  
>
>
>
> --
> 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.
>
>   



--
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.

  reply	other threads:[~2007-01-09  4:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-08 21:43 [PATCH] allow semodule -i to accept list of modules Karl MacMillan
2007-01-09  4:08 ` Joshua Brindle [this message]
2007-01-09 14:34   ` Karl MacMillan
2007-01-09 15:10     ` Joshua Brindle
2007-01-09 15:27       ` Karl MacMillan
2007-01-09 16:17 ` Joshua Brindle
2007-01-09 20:17   ` Stephen Smalley
2007-01-09 20:43     ` Stephen Smalley
2007-01-09 21:52       ` Karl MacMillan
2007-01-10 13:46         ` Stephen Smalley
2007-01-11 17:36           ` Stephen Smalley
2007-01-09 21:53       ` Joshua Brindle
2007-01-10 13:29         ` Stephen Smalley

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=45A31548.8030807@tresys.com \
    --to=jbrindle@tresys.com \
    --cc=kmacmillan@mentalrootkit.com \
    --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.