From: <ssm...@us...> - 2007-01-09 20:47:54
|
Revision: 2163 http://svn.sourceforge.net/selinux/?rev=2163&view=rev Author: ssmalley Date: 2007-01-09 12:47:51 -0800 (Tue, 09 Jan 2007) Log Message: ----------- The following patch allows semodule to handle a list of modules for installation (i.e., semodule -i *.pp now works). Signed-off-by: Karl MacMillan <kma...@me...> Acked-by: Joshua Brindle <jbr...@tr...> Author: Karl MacMillan Email: kma...@me... Subject: allow semodule -i to accept list of modules Date: Mon, 08 Jan 2007 16:43:47 -0500 Modified Paths: -------------- trunk/policycoreutils/semodule/semodule.c Modified: trunk/policycoreutils/semodule/semodule.c =================================================================== --- trunk/policycoreutils/semodule/semodule.c 2007-01-09 20:41:26 UTC (rev 2162) +++ trunk/policycoreutils/semodule/semodule.c 2007-01-09 20:47:51 UTC (rev 2163) @@ -225,15 +225,6 @@ } } } - 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"); @@ -245,6 +236,24 @@ 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); + } + } } int main(int argc, char *argv[]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mad...@us...> - 2008-02-22 19:06:31
|
Revision: 2809 http://selinux.svn.sourceforge.net/selinux/?rev=2809&view=rev Author: madmethod Date: 2008-02-22 11:06:24 -0800 (Fri, 22 Feb 2008) Log Message: ----------- On Fri, 2008-02-22 at 11:55 -0500, Joshua Brindle wrote: > > Eric Paris wrote: >> > > I added "allow-unknown = deny" in semanage.conf and ran semodule -R >> > > >> > > [root@dhcp231-146 ~]# semodule -R >> > > error parsing semanage configuration file: syntax error >> > > semodule: Could not create semanage handle >> > > semodule: handle.c:123: semanage_is_connected: Assertion `sh != ((void *)0)' failed. >> > > Segmentation fault >> > > >> > > It was supposed to bail (allow-unknown is not a valid entry, it should >> > > be handle-unknown) but it wasn't supposed to segfault. Maybe someone >> > > who knows this code can find/fix it really quickly, if not I'm sure I'll >> > > get to look at it when it gets to the top of my list in 10 or 12 >> > > months :) >> > > >> > > policycoreutils-2.0.43-2.fc9.x86_64 >> > > > > > > This is totally untested but should fix it: Whitespace damaged, but applied with -l and it fixed the problem. Acked-by: Stephen Smalley <sd...@ty...> Merge at will. > > > > Index: trunk/policycoreutils/semodule/semodule.c > > =================================================================== > > --- trunk/policycoreutils/semodule/semodule.c (revision 2808) > > +++ trunk/policycoreutils/semodule/semodule.c (working copy) > > @@ -285,7 +285,7 @@ > > if (!sh) { > > fprintf(stderr, "%s: Could not create semanage handle\n", > > argv[0]); > > - goto cleanup; > > + goto cleanup_nohandle; > > } > > > > if (store) { > > @@ -473,6 +473,8 @@ > > } > > } > > semanage_handle_destroy(sh); > > + > > + cleanup_nohandle: > > cleanup(); > > exit(status); > > } > > > > > > Revision Links: -------------- http://selinux.svn.sourceforge.net/selinux/?rev=2808&view=rev Modified Paths: -------------- trunk/policycoreutils/semodule/semodule.c Modified: trunk/policycoreutils/semodule/semodule.c =================================================================== --- trunk/policycoreutils/semodule/semodule.c 2008-02-21 16:12:21 UTC (rev 2808) +++ trunk/policycoreutils/semodule/semodule.c 2008-02-22 19:06:24 UTC (rev 2809) @@ -285,7 +285,7 @@ if (!sh) { fprintf(stderr, "%s: Could not create semanage handle\n", argv[0]); - goto cleanup; + goto cleanup_nohandle; } if (store) { @@ -473,6 +473,8 @@ } } semanage_handle_destroy(sh); + + cleanup_nohandle: cleanup(); exit(status); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |