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>
25 #include <security/pam_appl.h>
26 #include "afs_pam_msg.h"
27 #include "afs_message.h"
32 pam_afs_printf(struct pam_conv *pam_convp, int error, int fmt_msgid, ...)
35 char buf[PAM_MAX_MSG_SIZE];
38 struct pam_message mesg;
39 struct pam_message *mesgp = &mesg;
40 struct pam_response *resp = NULL;
43 if (pam_convp == NULL || pam_convp->conv == NULL)
46 fmt_msg = pam_afs_message(fmt_msgid, &freeit);
47 va_start(args, fmt_msgid);
48 vsprintf(buf, fmt_msg, args);
53 mesg.msg_style = error ? PAM_ERROR_MSG : PAM_TEXT_INFO;
55 errcode = (*(pam_convp->conv)) (1, &mesgp, &resp, pam_convp->appdata_ptr);
66 pam_afs_prompt(struct pam_conv *pam_convp, char **response, int echo,
70 char buf[PAM_MAX_MSG_SIZE];
73 struct pam_message mesg;
74 struct pam_message *mesgp = &mesg;
75 struct pam_response *resp = NULL;
78 if (pam_convp == NULL || pam_convp->conv == NULL || response == NULL)
83 fmt_msg = pam_afs_message(fmt_msgid, &freeit);
84 va_start(args, fmt_msgid);
85 vsprintf(buf, fmt_msg, args);
90 mesg.msg_style = echo ? PAM_PROMPT_ECHO_ON : PAM_PROMPT_ECHO_OFF;
93 errcode = (*(pam_convp->conv)) (1, &mesgp, &resp, pam_convp->appdata_ptr);
95 *response = resp->resp;
97 free(resp); /* but not resp->resp */