77eb27
diff --git a/libpam/pam_get_authtok.c b/libpam/pam_get_authtok.c
77eb27
index 800c6e5..3cdec5e 100644
77eb27
--- a/libpam/pam_get_authtok.c
77eb27
+++ b/libpam/pam_get_authtok.c
77eb27
@@ -140,6 +140,8 @@ pam_get_authtok_internal (pam_handle_t *pamh, int item,
77eb27
     }
77eb27
   else if (chpass)
77eb27
     {
77eb27
+      pamh->authtok_verified = 0;
77eb27
+
77eb27
       retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0],
77eb27
 			   PROMPT1, authtok_type,
77eb27
 			   strlen (authtok_type) > 0?" ":"");
77eb27
@@ -184,6 +186,9 @@ pam_get_authtok_internal (pam_handle_t *pamh, int item,
77eb27
   if (retval != PAM_SUCCESS)
77eb27
     return retval;
77eb27
 
77eb27
+  if (chpass > 1)
77eb27
+    pamh->authtok_verified = 1;
77eb27
+
77eb27
   return pam_get_item(pamh, item, (const void **)authtok);
77eb27
 }
77eb27
 
77eb27
@@ -214,6 +219,9 @@ pam_get_authtok_verify (pam_handle_t *pamh, const char **authtok,
77eb27
   if (authtok == NULL || pamh->choice != PAM_CHAUTHTOK)
77eb27
     return PAM_SYSTEM_ERR;
77eb27
 
77eb27
+  if (pamh->authtok_verified)
77eb27
+    return pam_get_item (pamh, PAM_AUTHTOK, (const void **)authtok);
77eb27
+
77eb27
   if (prompt != NULL)
77eb27
     {
77eb27
       retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp,
77eb27
@@ -239,6 +247,7 @@ pam_get_authtok_verify (pam_handle_t *pamh, const char **authtok,
77eb27
 
77eb27
   if (strcmp (*authtok, resp) != 0)
77eb27
     {
77eb27
+      pamh->authtok_verified = 0;
77eb27
       pam_set_item (pamh, PAM_AUTHTOK, NULL);
77eb27
       pam_error (pamh, MISTYPED_PASS);
77eb27
       _pam_overwrite (resp);
77eb27
@@ -252,5 +261,7 @@ pam_get_authtok_verify (pam_handle_t *pamh, const char **authtok,
77eb27
   if (retval != PAM_SUCCESS)
77eb27
     return retval;
77eb27
 
77eb27
+  pamh->authtok_verified = 1;
77eb27
+
77eb27
   return pam_get_item(pamh, PAM_AUTHTOK, (const void **)authtok);
77eb27
 }
77eb27
diff --git a/libpam/pam_private.h b/libpam/pam_private.h
77eb27
index 7ff9f75..58a26f5 100644
77eb27
--- a/libpam/pam_private.h
77eb27
+++ b/libpam/pam_private.h
77eb27
@@ -172,6 +172,7 @@ struct pam_handle {
77eb27
 #ifdef HAVE_LIBAUDIT
77eb27
     int audit_state;             /* keep track of reported audit messages */
77eb27
 #endif
77eb27
+    int authtok_verified;
77eb27
 };
77eb27
 
77eb27
 /* Values for select arg to _pam_dispatch() */
77eb27
diff --git a/libpam/pam_start.c b/libpam/pam_start.c
77eb27
index 328416d..e27c64b 100644
77eb27
--- a/libpam/pam_start.c
77eb27
+++ b/libpam/pam_start.c
77eb27
@@ -94,6 +94,7 @@ int pam_start (
77eb27
 #endif
77eb27
     (*pamh)->xdisplay = NULL;
77eb27
     (*pamh)->authtok_type = NULL;
77eb27
+    (*pamh)->authtok_verified = 0;
77eb27
     memset (&((*pamh)->xauth), 0, sizeof ((*pamh)->xauth));
77eb27
 
77eb27
     if (((*pamh)->pam_conversation = (struct pam_conv *)