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

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Sun Dec 30 21:48:56 UTC 2007


Author: nekral-guest
Date: 2007-12-30 21:48:55 +0000 (Sun, 30 Dec 2007)
New Revision: 1563

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/groupadd.c
Log:
* Compilation fix for PAM support (pamh needs to be
  global since the function split).
* End the PAM transaction in fail_exit().
* Document check_flags().


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2007-12-30 21:39:57 UTC (rev 1562)
+++ upstream/trunk/ChangeLog	2007-12-30 21:48:55 UTC (rev 1563)
@@ -1,5 +1,12 @@
-2007-12-29  Nicolas François  <nicolas.francois at centraliens.net>
+2007-12-30  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* src/groupadd.c: Compilation fix for PAM support (pamh needs to be
+	global since the function split).
+	* src/groupadd.c: End the PAM transaction in fail_exit().
+	* src/groupadd.c: Document check_flags().
+
+2007-12-30  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* src/vipw.c: Compilation fix for non-gshadow support.
 
 2007-12-29  Nicolas François  <nicolas.francois at centraliens.net>

Modified: upstream/trunk/src/groupadd.c
===================================================================
--- upstream/trunk/src/groupadd.c	2007-12-30 21:39:57 UTC (rev 1562)
+++ upstream/trunk/src/groupadd.c	2007-12-30 21:48:55 UTC (rev 1563)
@@ -76,6 +76,10 @@
 static int gflg = 0;		/* ID value for the new group */
 static int fflg = 0;		/* if group already exists, do nothing and exit(0) */
 
+#ifdef USE_PAM
+static pam_handle_t *pamh = NULL;
+#endif
+
 /* local function prototypes */
 static void usage (void);
 static void new_grent (struct group *grent);
@@ -341,6 +345,15 @@
 		              group_name, -1, 0);
 	}
 #endif
+
+#ifdef USE_PAM
+	if (NULL != pamh) {
+		/* If there is a PAM error, fail_exit is not called.
+		 * We always end the pam transaction with PAM_SUCCESS here.
+		 */
+		pam_end (pamh, PAM_SUCCESS);
+	}
+#endif
 	exit (code);
 }
 
@@ -443,6 +456,11 @@
 	check_flags ();
 }
 
+/*
+ * check_flags - check flags and parameters consistency
+ *
+ *	It will not return if an error is encountered.
+ */
 static void check_flags (void)
 {
 	/* -o does not make sense without -g */
@@ -493,11 +511,12 @@
  *	non-root users to groups.
  *	Without PAM support, only users who can write in the group databases
  *	can add groups.
+ *
+ *	It will not return if the user is not allowed.
  */
 static void check_perms (void)
 {
 #ifdef USE_PAM
-	pam_handle_t *pamh = NULL;
 	int retval = PAM_SUCCESS;
 	struct passwd *pampw;
 




More information about the Pkg-shadow-commits mailing list