]> granicus.if.org Git - shadow/commitdiff
* src/groupmems.c (check_perms): Simplify. Always call pam_end()
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 27 Jul 2008 01:41:07 +0000 (01:41 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 27 Jul 2008 01:41:07 +0000 (01:41 +0000)
at the end of the authentication.

ChangeLog
src/groupmems.c

index 2e667bfb7d2631526e126dba38773f49d06efb3d..3daffc8a2dc73957eea3400312bde37fef1b0504 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-27  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/groupmems.c (check_perms): Simplify. Always call pam_end()
+       at the end of the authentication.
+
 2008-07-27  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/groupmems.c: Add fail_exit() to remove the group lock file
index b885c4623cd025eda143efa7710de0cff38b08f3..d05988c07c91e3fbdab88cebe0eb10230d81bd36 100644 (file)
@@ -170,47 +170,32 @@ static void check_perms (void)
 {
 #ifdef USE_PAM
        pam_handle_t *pamh = NULL;
-       int retval;
-#endif
-
-#ifdef USE_PAM
-       retval = PAM_SUCCESS;
+       int retval = PAM_SUCCESS;
+       struct passwd *pampw;
 
-       {
-               struct passwd *pampw;
-               pampw = getpwuid (getuid ()); /* local, no need for xgetpwuid */
-               if (pampw == NULL) {
-                       retval = PAM_USER_UNKNOWN;
-               }
+       pampw = getpwuid (getuid ()); /* local, no need for xgetpwuid */
+       if (pampw == NULL) {
+               retval = PAM_USER_UNKNOWN;
+       }
 
-               if (retval == PAM_SUCCESS) {
-                       retval = pam_start ("groupmod", pampw->pw_name,
-                                           &conv, &pamh);
-               }
+       if (retval == PAM_SUCCESS) {
+               retval = pam_start ("groupmod", pampw->pw_name,
+                                   &conv, &pamh);
        }
 
        if (retval == PAM_SUCCESS) {
                retval = pam_authenticate (pamh, 0);
-               if (retval != PAM_SUCCESS) {
-                       (void) pam_end (pamh, retval);
-               }
        }
 
        if (retval == PAM_SUCCESS) {
                retval = pam_acct_mgmt (pamh, 0);
-               if (retval != PAM_SUCCESS) {
-                       (void) pam_end (pamh, retval);
-               }
        }
 
+       (void) pam_end (pamh, retval);
        if (retval != PAM_SUCCESS) {
                fprintf (stderr, _("%s: PAM authentication failed\n"), Prog);
                fail_exit (1);
        }
-
-       if (retval == PAM_SUCCESS) {
-               (void) pam_end (pamh, PAM_SUCCESS);
-       }
 #endif
 }