Changeset 75 in openpam for trunk


Ignore:
Timestamp:
Feb 22, 2002, 10:04:11 PM (18 years ago)
Author:
Dag-Erling Smørgrav
Message:

Respect echo_pass, try_first_pass, use_first_pass options.

Sponsored by: DARPA, NAI Labs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/pam_get_authtok.c

    r68 r75  
    5454{
    5555        char *p, *resp;
    56         int r;
     56        int r, style;
    5757
    5858        if (pamh == NULL || authtok == NULL)
    5959                return (PAM_SYSTEM_ERR);
    6060
    61         r = pam_get_item(pamh, PAM_AUTHTOK, (const void **)authtok);
    62         if (r == PAM_SUCCESS && *authtok != NULL)
    63                 return (PAM_SUCCESS);
     61        if (openpam_get_option(pamh, "try_first_pass") ||
     62            openpam_get_option(pamh, "use_first_pass")) {
     63                r = pam_get_item(pamh, PAM_AUTHTOK, (const void **)authtok);
     64                if (r == PAM_SUCCESS && *authtok != NULL)
     65                        return (PAM_SUCCESS);
     66                else if (openpam_get_option(pamh, "use_first_pass"))
     67                        return (r == PAM_SUCCESS ? PAM_AUTH_ERR : r);
     68        }
    6469        if (pam_get_item(pamh, PAM_AUTHTOK_PROMPT,
    6570            (const void **)&p) != PAM_SUCCESS || p == NULL)
    6671                if (prompt == NULL)
    6772                        prompt = "Password:";
    68         r = pam_prompt(pamh, PAM_PROMPT_ECHO_OFF, &resp,
    69             "%s", p ? p : prompt);
     73        style = openpam_get_option(pamh, "echo_pass") ?
     74            PAM_PROMPT_ECHO_ON : PAM_PROMPT_ECHO_OFF;
     75        r = pam_prompt(pamh, style, &resp, "%s", p ? p : prompt);
    7076        if (r != PAM_SUCCESS)
    7177                return (r);
Note: See TracChangeset for help on using the changeset viewer.