Changeset 510 in openpam


Ignore:
Timestamp:
Dec 31, 2011, 1:14:23 PM (2 years ago)
Author:
des
Message:

Use a different default prompt if PAM_RHOST != PAM_HOST.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/pam_get_authtok.c

    r455 r510  
    5151 
    5252static const char authtok_prompt[] = "Password:"; 
     53static const char authtok_prompt_remote[] = "Password for %u@%h:"; 
    5354static const char oldauthtok_prompt[] = "Old Password:"; 
    5455static const char newauthtok_prompt[] = "New Password:"; 
     
    7071        const void *oldauthtok, *prevauthtok, *promptp; 
    7172        const char *prompt_option, *default_prompt; 
     73        const void *lhost, *rhost; 
    7274        char *resp, *resp2; 
    7375        int pitem, r, style, twice; 
     
    8385                prompt_option = "authtok_prompt"; 
    8486                default_prompt = authtok_prompt; 
     87                r = pam_get_item(pamh, PAM_RHOST, &rhost); 
     88                if (r == PAM_SUCCESS && rhost != NULL) { 
     89                        r = pam_get_item(pamh, PAM_HOST, &lhost); 
     90                        if (r == PAM_SUCCESS && lhost != NULL) { 
     91                                if (strcmp(rhost, lhost) != 0) 
     92                                        default_prompt = authtok_prompt_remote; 
     93                        } 
     94                } 
    8595                r = pam_get_item(pamh, PAM_OLDAUTHTOK, &oldauthtok); 
    8696                if (r == PAM_SUCCESS && oldauthtok != NULL) { 
Note: See TracChangeset for help on using the changeset viewer.