Changeset 24 in openpam for trunk/lib/pam_get_user.c


Ignore:
Timestamp:
Feb 4, 2002, 2:53:46 PM (19 years ago)
Author:
Dag-Erling Smørgrav
Message:

Circumvent constness issues. OpenPAM is now WARNS4-clean.

Sponsored by: DARPA, NAI Labs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/pam_get_user.c

    r16 r24  
    5353        const char *prompt)
    5454{
     55        char *p;
    5556        int r;
    5657
     
    5859                return (PAM_SYSTEM_ERR);
    5960
    60         if ((r = pam_get_item(pamh, PAM_USER, (void **)user)) == PAM_SUCCESS)
     61        r = pam_get_item(pamh, PAM_USER, (void **)user);
     62        if (r == PAM_SUCCESS)
    6163                return (PAM_SUCCESS);
    62         if (prompt == NULL)
    63                 pam_get_item(pamh, PAM_USER_PROMPT, (void **)&prompt);
    64         if (prompt == NULL)
    65                 prompt = "Login: ";
    66         if ((r = pam_prompt(pamh, user, 0, "%s", prompt)) != PAM_SUCCESS)
     64        if (prompt == NULL) {
     65                if (pam_get_item(pamh, PAM_USER_PROMPT, (void **)&p) !=
     66                    PAM_SUCCESS || p == NULL)
     67                        prompt = "Login: ";
     68        }
     69        r = pam_prompt(pamh, user, 0, "%s", prompt ? prompt : p);
     70        if (r != PAM_SUCCESS)
    6771                return (r);
    6872        return (pam_set_item(pamh, PAM_USER, *user));
Note: See TracChangeset for help on using the changeset viewer.