[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: setcred, keychains..



>Luke Howard wrote:
>> FWIW, I got {use,try}_mapped_pass working: because most
>> of the modules use the pam_get_pass() function, which
>
>Yuch! Do they have a man page for this? Is is callable from the app or
>module or both?

No man page. The code is pretty short so I'm pasting it
in below, minus the keychain stuff. The "standard
options" are defined in pam_mod_misc.h and are 
parsed from argv using pam_std_option().



-- Luke

int pam_get_pass(pam_handle_t *pamh, const char **passp, const char *prompt,
    int options)
{
        int retval;
        const void *item = NULL;

        /*
         * Grab the already-entered password if we might want to use it.
         */
        if (options & (PAM_OPT_TRY_FIRST_PASS | PAM_OPT_USE_FIRST_PASS)) {
                if ((retval = pam_get_item(pamh, PAM_AUTHTOK, &item)) !=
                    PAM_SUCCESS)
                        return retval;
        }
        
        if (item == NULL) {
                /* The user hasn't entered a password yet. */
                if (options & PAM_OPT_USE_FIRST_PASS)
                        return PAM_AUTH_ERR;
 
                /* Use the conversation function to get a password. */
                if ((retval = pam_conv_pass(pamh, prompt, options)) !=
                        PAM_SUCCESS ||
                        (retval = pam_get_item(pamh, PAM_AUTHTOK, &item)) !=
                        PAM_SUCCESS)
                        return retval;
        }               
        *passp = (const char *)item;
        return PAM_SUCCESS;     
}

--
Luke Howard | lukeh@padl.com
PADL Software | www.padl.com





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []