2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include <afs/param.h>
17 #include <security/pam_appl.h>
18 #include "afs_pam_msg.h"
19 #include "afs_message.h"
24 pam_afs_printf(struct pam_conv *pam_convp, int error, int fmt_msgid, ...)
27 char buf[PAM_MAX_MSG_SIZE];
30 struct pam_message mesg;
31 PAM_CONST struct pam_message *mesgp = &mesg;
32 struct pam_response *resp = NULL;
35 if (pam_convp == NULL || pam_convp->conv == NULL)
38 fmt_msg = pam_afs_message(fmt_msgid, &freeit);
39 va_start(args, fmt_msgid);
40 vsprintf(buf, fmt_msg, args);
45 mesg.msg_style = error ? PAM_ERROR_MSG : PAM_TEXT_INFO;
47 errcode = (*(pam_convp->conv)) (1, &mesgp, &resp, pam_convp->appdata_ptr);
58 pam_afs_prompt(struct pam_conv *pam_convp, char **response, int echo,
62 char buf[PAM_MAX_MSG_SIZE];
65 struct pam_message mesg;
66 PAM_CONST struct pam_message *mesgp = &mesg;
67 struct pam_response *resp = NULL;
70 if (pam_convp == NULL || pam_convp->conv == NULL || response == NULL)
75 fmt_msg = pam_afs_message(fmt_msgid, &freeit);
76 va_start(args, fmt_msgid);
77 vsprintf(buf, fmt_msg, args);
82 mesg.msg_style = echo ? PAM_PROMPT_ECHO_ON : PAM_PROMPT_ECHO_OFF;
85 errcode = (*(pam_convp->conv)) (1, &mesgp, &resp, pam_convp->appdata_ptr);
87 *response = resp->resp;
89 free(resp); /* but not resp->resp */