pam_get_item(3) expects a const void **, not a const void *. Also

check that the pam_conv structure it returns is not NULL.

Sponsored by:	DARPA, NAI Labs


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@57 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
Dag-Erling Smørgrav 2002-02-13 02:17:31 +00:00
parent 104cfd8443
commit 105c3d4de7
1 changed files with 8 additions and 3 deletions

View File

@ -58,16 +58,21 @@ pam_vprompt(pam_handle_t *pamh,
struct pam_message msg;
const struct pam_message *msgp;
struct pam_response *rsp;
struct pam_conv conv;
struct pam_conv *conv;
int r;
if ((r = pam_get_item(pamh, PAM_CONV, (void *)&conv)) != PAM_SUCCESS)
r = pam_get_item(pamh, PAM_CONV, (const void **)&conv);
if (r != PAM_SUCCESS)
return (r);
if (conv == NULL) {
openpam_log(PAM_LOG_ERROR, "no conversation function");
return (PAM_SYSTEM_ERR);
}
vsnprintf(msgbuf, PAM_MAX_MSG_SIZE, fmt, ap);
msg.msg_style = style;
msg.msg = msgbuf;
msgp = &msg;
r = (conv.conv)(1, &msgp, &rsp, conv.appdata_ptr);
r = (conv->conv)(1, &msgp, &rsp, conv->appdata_ptr);
*resp = rsp == NULL ? NULL : rsp->resp;
free(rsp);
return (r);