[Pkg-shadow-commits] r3538 - in upstream/trunk: . man src

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Sun Nov 6 18:37:45 UTC 2011


Author: nekral-guest
Date: 2011-11-06 18:37:45 +0000 (Sun, 06 Nov 2011)
New Revision: 3538

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/NEWS
   upstream/trunk/man/groupadd.8.xml
   upstream/trunk/src/groupadd.c
Log:
	* NEWS, src/groupadd.c, man/groupadd.8.xml: Add --root option. Open
	audit after the potential chroot.
	* src/groupadd.c: Check atexit failures.
	* src/groupadd.c: Return E_SUCCESS instead of exit'ing at the end
	of main().

Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2011-11-06 18:37:39 UTC (rev 3537)
+++ upstream/trunk/ChangeLog	2011-11-06 18:37:45 UTC (rev 3538)
@@ -10,6 +10,11 @@
 	audit and syslog after the potential chroot. userdel's usage split
 	in smaller messages.
 	* NEWS, src/usermod.c, man/usermod.8.xml: Likewise
+	* NEWS, src/groupadd.c, man/groupadd.8.xml: Add --root option. Open
+	audit after the potential chroot.
+	* src/groupadd.c: Check atexit failures.
+	* src/groupadd.c: Return E_SUCCESS instead of exit'ing at the end
+	of main().
 
 2011-10-22  Nicolas François  <nicolas.francois at centraliens.net>
 

Modified: upstream/trunk/NEWS
===================================================================
--- upstream/trunk/NEWS	2011-11-06 18:37:39 UTC (rev 3537)
+++ upstream/trunk/NEWS	2011-11-06 18:37:45 UTC (rev 3538)
@@ -31,6 +31,8 @@
 - faillog
   * The -l, -m, -r, -t options only act on the existing users, unless -a is
     specified.
+- groupadd
+  * Add --root option.
 - groupmod
   * Fixed groupmod when configured with --enable-account-tools-setuid.
   * When the gshadow file exists but there are no gshadow entries, an entry

Modified: upstream/trunk/man/groupadd.8.xml
===================================================================
--- upstream/trunk/man/groupadd.8.xml	2011-11-06 18:37:39 UTC (rev 3537)
+++ upstream/trunk/man/groupadd.8.xml	2011-11-06 18:37:45 UTC (rev 3538)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
    Copyright (c) 1991       , Julianne Frances Haugh
-   Copyright (c) 2007 - 2009, Nicolas François
+   Copyright (c) 2007 - 2011, Nicolas François
    All rights reserved.
   
    Redistribution and use in source and binary forms, with or without
@@ -180,6 +180,19 @@
 	  </para>
 	</listitem>
       </varlistentry>
+      <varlistentry>
+	<term>
+	  <option>-R</option>, <option>--root</option>
+	  <replaceable>CHROOT_DIR</replaceable>
+	</term>
+	<listitem>
+	  <para>
+	    Apply changes in the <replaceable>CHROOT_DIR</replaceable>
+	    directory and use the configuration files from the
+	    <replaceable>CHROOT_DIR</replaceable> directory.
+	  </para>
+	</listitem>
+      </varlistentry>
     </variablelist>
   </refsect1>
 

Modified: upstream/trunk/src/groupadd.c
===================================================================
--- upstream/trunk/src/groupadd.c	2011-11-06 18:37:39 UTC (rev 3537)
+++ upstream/trunk/src/groupadd.c	2011-11-06 18:37:45 UTC (rev 3538)
@@ -122,6 +122,7 @@
 	                "                                (non-unique) GID\n"), usageout);
 	(void) fputs (_("  -p, --password PASSWORD       use this encrypted password for the new group\n"), usageout);
 	(void) fputs (_("  -r, --system                  create a system account\n"), usageout);
+	(void) fputs (_("  -R, --root CHROOT_DIR         directory to chroot into\n"), usageout);
 	(void) fputs ("\n", usageout);
 	exit (status);
 }
@@ -375,7 +376,6 @@
 	 * Parse the command line options.
 	 */
 	char *cp;
-	int option_index = 0;
 	int c;
 	static struct option long_options[] = {
 		{"force", no_argument, NULL, 'f'},
@@ -385,12 +385,12 @@
 		{"non-unique", no_argument, NULL, 'o'},
 		{"password", required_argument, NULL, 'p'},
 		{"system", no_argument, NULL, 'r'},
+		{"root", required_argument, NULL, 'R'},
 		{NULL, 0, NULL, '\0'}
 	};
 
-	while ((c =
-		getopt_long (argc, argv, "fg:hK:op:r", long_options,
-		             &option_index)) != -1) {
+	while ((c = getopt_long (argc, argv, "fg:hK:op:rR:",
+		                 long_options, NULL)) != -1) {
 		switch (c) {
 		case 'f':
 			/*
@@ -444,6 +444,8 @@
 		case 'r':
 			rflg = true;
 			break;
+		case 'R': /* no-op, handled in process_root_flag () */
+			break;
 		default:
 			usage (E_USAGE);
 		}
@@ -563,11 +565,6 @@
  */
 int main (int argc, char **argv)
 {
-#ifdef WITH_AUDIT
-	audit_help_open ();
-#endif
-	atexit (do_cleanups);
-
 	/*
 	 * Get my name so that I can use it to report errors.
 	 */
@@ -577,8 +574,20 @@
 	(void) bindtextdomain (PACKAGE, LOCALEDIR);
 	(void) textdomain (PACKAGE);
 
+	process_root_flag ("-R", argc, argv);
+
 	OPENLOG ("groupadd");
+#ifdef WITH_AUDIT
+	audit_help_open ();
+#endif
 
+	if (atexit (do_cleanups) != 0) {
+		fprintf (stderr,
+		         _("%s: Cannot setup cleanup service.\n"),
+		         Prog);
+		exit (1);
+	}
+
 	/*
 	 * Parse the command line options.
 	 */
@@ -607,7 +616,6 @@
 
 	nscd_flush_cache ("group");
 
-	exit (E_SUCCESS);
-	/*@notreached@*/
+	return E_SUCCESS;
 }
 




More information about the Pkg-shadow-commits mailing list