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

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


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

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/NEWS
   upstream/trunk/man/groupmod.8.xml
   upstream/trunk/src/groupadd.c
   upstream/trunk/src/groupmod.c
Log:
	* NEWS, src/groupadd.c, man/groupadd.8.xml: Add --root option. Open
	audit and syslog after the potential chroot.
	* src/groupmod.c: The index of long options is not used.

Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2011-11-06 18:37:45 UTC (rev 3538)
+++ upstream/trunk/ChangeLog	2011-11-06 18:37:51 UTC (rev 3539)
@@ -11,10 +11,13 @@
 	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.
+	audit and syslog 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().
+	* NEWS, src/groupadd.c, man/groupadd.8.xml: Add --root option. Open
+	audit and syslog after the potential chroot.
+	* src/groupmod.c: The index of long options is not used.
 
 2011-10-22  Nicolas François  <nicolas.francois at centraliens.net>
 

Modified: upstream/trunk/NEWS
===================================================================
--- upstream/trunk/NEWS	2011-11-06 18:37:45 UTC (rev 3538)
+++ upstream/trunk/NEWS	2011-11-06 18:37:51 UTC (rev 3539)
@@ -38,6 +38,7 @@
   * When the gshadow file exists but there are no gshadow entries, an entry
     is created if the password is changed and group requires a
     shadow entry.
+  * Add --root option.
 - grpck
   * NIS entries were dropped by -s (sort).
 -login

Modified: upstream/trunk/man/groupmod.8.xml
===================================================================
--- upstream/trunk/man/groupmod.8.xml	2011-11-06 18:37:45 UTC (rev 3538)
+++ upstream/trunk/man/groupmod.8.xml	2011-11-06 18:37:51 UTC (rev 3539)
@@ -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
@@ -148,6 +148,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:45 UTC (rev 3538)
+++ upstream/trunk/src/groupadd.c	2011-11-06 18:37:51 UTC (rev 3539)
@@ -2,7 +2,7 @@
  * Copyright (c) 1991 - 1993, Julianne Frances Haugh
  * Copyright (c) 1996 - 2000, Marek Michałkiewicz
  * Copyright (c) 2000 - 2006, Tomasz Kłoczko
- * 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
@@ -88,7 +88,7 @@
 #endif
 
 /* local function prototypes */
-static void usage (int status);
+static /*@noreturn@*/void usage (int status);
 static void new_grent (struct group *grent);
 
 #ifdef SHADOWGRP
@@ -105,7 +105,7 @@
 /*
  * usage - display usage message and exit
  */
-static void usage (int status)
+static /*@noreturn@*/void usage (int status)
 {
 	FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
 	(void) fprintf (usageout,
@@ -414,7 +414,7 @@
 			break;
 		case 'h':
 			usage (E_SUCCESS);
-			break;
+			/*@notreached@*/break;
 		case 'K':
 			/*
 			 * override login.defs defaults (-K name=value)

Modified: upstream/trunk/src/groupmod.c
===================================================================
--- upstream/trunk/src/groupmod.c	2011-11-06 18:37:45 UTC (rev 3538)
+++ upstream/trunk/src/groupmod.c	2011-11-06 18:37:51 UTC (rev 3539)
@@ -127,6 +127,7 @@
 	(void) fputs (_("  -o, --non-unique              allow to use a duplicate (non-unique) GID\n"), usageout);
 	(void) fputs (_("  -p, --password PASSWORD       change the password to this (encrypted)\n"
 	                "                                PASSWORD\n"), usageout);
+	(void) fputs (_("  -R, --root CHROOT_DIR         directory to chroot into\n"), usageout);
 	(void) fputs ("\n", usageout);
 	exit (status);
 }
@@ -367,7 +368,6 @@
  */
 static void process_flags (int argc, char **argv)
 {
-	int option_index = 0;
 	int c;
 	static struct option long_options[] = {
 		{"gid", required_argument, NULL, 'g'},
@@ -375,11 +375,11 @@
 		{"new-name", required_argument, NULL, 'n'},
 		{"non-unique", no_argument, NULL, 'o'},
 		{"password", required_argument, NULL, 'p'},
+		{"root", required_argument, NULL, 'R'},
 		{NULL, 0, NULL, '\0'}
 	};
-	while ((c =
-		getopt_long (argc, argv, "g:hn:op:",
-		             long_options, &option_index)) != -1) {
+	while ((c = getopt_long (argc, argv, "g:hn:op:R:",
+		                 long_options, NULL)) != -1) {
 		switch (c) {
 		case 'g':
 			gflg = true;
@@ -405,6 +405,8 @@
 			group_passwd = optarg;
 			pflg = true;
 			break;
+		case 'R': /* no-op, handled in process_root_flag () */
+			break;
 		default:
 			usage (E_USAGE);
 		}
@@ -734,10 +736,6 @@
 #endif				/* USE_PAM */
 #endif				/* ACCT_TOOLS_SETUID */
 
-#ifdef WITH_AUDIT
-	audit_help_open ();
-#endif
-
 	/*
 	 * Get my name so that I can use it to report errors.
 	 */
@@ -747,6 +745,13 @@
 	(void) bindtextdomain (PACKAGE, LOCALEDIR);
 	(void) textdomain (PACKAGE);
 
+	process_root_flag ("-R", argc, argv);
+
+	OPENLOG ("groupmod");
+#ifdef WITH_AUDIT
+	audit_help_open ();
+#endif
+
 	if (atexit (do_cleanups) != 0) {
 		fprintf (stderr,
 		         _("%s: Cannot setup cleanup service.\n"),
@@ -756,8 +761,6 @@
 
 	process_flags (argc, argv);
 
-	OPENLOG ("groupmod");
-
 #ifdef ACCT_TOOLS_SETUID
 #ifdef USE_PAM
 	{




More information about the Pkg-shadow-commits mailing list