Use a different default prompt if PAM_RHOST != PAM_HOST.
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@510 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
parent
8ec4a16273
commit
596b3af085
|
@ -50,6 +50,7 @@
|
|||
#include "openpam_impl.h"
|
||||
|
||||
static const char authtok_prompt[] = "Password:";
|
||||
static const char authtok_prompt_remote[] = "Password for %u@%h:";
|
||||
static const char oldauthtok_prompt[] = "Old Password:";
|
||||
static const char newauthtok_prompt[] = "New Password:";
|
||||
|
||||
|
@ -69,6 +70,7 @@ pam_get_authtok(pam_handle_t *pamh,
|
|||
size_t prompt_size;
|
||||
const void *oldauthtok, *prevauthtok, *promptp;
|
||||
const char *prompt_option, *default_prompt;
|
||||
const void *lhost, *rhost;
|
||||
char *resp, *resp2;
|
||||
int pitem, r, style, twice;
|
||||
|
||||
|
@ -82,6 +84,14 @@ pam_get_authtok(pam_handle_t *pamh,
|
|||
pitem = PAM_AUTHTOK_PROMPT;
|
||||
prompt_option = "authtok_prompt";
|
||||
default_prompt = authtok_prompt;
|
||||
r = pam_get_item(pamh, PAM_RHOST, &rhost);
|
||||
if (r == PAM_SUCCESS && rhost != NULL) {
|
||||
r = pam_get_item(pamh, PAM_HOST, &lhost);
|
||||
if (r == PAM_SUCCESS && lhost != NULL) {
|
||||
if (strcmp(rhost, lhost) != 0)
|
||||
default_prompt = authtok_prompt_remote;
|
||||
}
|
||||
}
|
||||
r = pam_get_item(pamh, PAM_OLDAUTHTOK, &oldauthtok);
|
||||
if (r == PAM_SUCCESS && oldauthtok != NULL) {
|
||||
default_prompt = newauthtok_prompt;
|
||||
|
|
Loading…
Reference in New Issue