]> granicus.if.org Git - linux-pam/commitdiff
Respect PAM_AUTHTOK_TYPE in pam_get_authtok_verify().
authorTomas Mraz <tmraz@fedoraproject.org>
Mon, 13 Aug 2012 18:06:44 +0000 (20:06 +0200)
committerTomas Mraz <tmraz@fedoraproject.org>
Mon, 13 Aug 2012 18:06:44 +0000 (20:06 +0200)
libpam/pam_get_authtok.c (pam_get_authtok_internal): Set the PAM_AUTHTOK_TYPE
item when obtained from module options.
(pam_get_authtok_verify): Use the PAM_AUTHTOK_TYPE item when prompting.

libpam/pam_get_authtok.c

index ecd29910dfe136d3b5170776d1726328a5febfa8..31bb1627153b2b96697359becb0ffcea1b84dac3 100644 (file)
@@ -102,6 +102,8 @@ pam_get_authtok_internal (pam_handle_t *pamh, int item,
          if (retval != PAM_SUCCESS || authtok_type == NULL)
            authtok_type = "";
        }
+      else
+        pam_set_item(pamh, PAM_AUTHTOK_TYPE, authtok_type);
     }
 
   retval = pam_get_item (pamh, item, &prevauthtok);
@@ -210,6 +212,9 @@ pam_get_authtok_verify (pam_handle_t *pamh, const char **authtok,
     }
   else
     {
+      retval = pam_get_item (pamh, PAM_AUTHTOK_TYPE, (const void **)&authtok_type);
+      if (retval != PAM_SUCCESS || authtok_type == NULL)
+        authtok_type = "";
       retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp,
                           PROMPT2, authtok_type,
                           strlen (authtok_type) > 0?" ":"");