Changeset 202 in openpam for trunk


Ignore:
Timestamp:
Feb 7, 2003, 4:07:07 PM (17 years ago)
Author:
Dag-Erling Smørgrav
Message:

If the saved effective uid is the same as the current effective uid,
just destroy the saved credentials and return.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/openpam_restore_cred.c

    r187 r202  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_restore_cred.c#3 $
     34 * $P4: //depot/projects/openpam/lib/openpam_restore_cred.c#4 $
    3535 */
    3636
     
    6363        if (scred == NULL)
    6464                RETURNC(PAM_SYSTEM_ERR);
    65         if (seteuid(scred->euid) == -1 ||
    66             setgroups(scred->ngroups, scred->groups) == -1 ||
    67             setegid(scred->egid) == -1)
    68                 RETURNC(PAM_SYSTEM_ERR);
     65        if (scred->euid != geteuid()) {
     66                if (seteuid(scred->euid) == -1 ||
     67                    setgroups(scred->ngroups, scred->groups) == -1 ||
     68                    setegid(scred->egid) == -1)
     69                        RETURNC(PAM_SYSTEM_ERR);
     70        }
    6971        pam_set_data(pamh, PAM_SAVED_CRED, NULL, NULL);
    7072        RETURNC(PAM_SUCCESS);
Note: See TracChangeset for help on using the changeset viewer.