Add a struct sudo_conv_callback that contains on_suspend and on_resume
function pointer args plus a closure pointer and at it to the conversation function.
This commit is contained in:
@@ -43,7 +43,7 @@ extern int tgetpass_flags; /* XXX */
|
||||
*/
|
||||
int
|
||||
sudo_conversation(int num_msgs, const struct sudo_conv_message msgs[],
|
||||
struct sudo_conv_reply replies[])
|
||||
struct sudo_conv_reply replies[], struct sudo_conv_callback *callback)
|
||||
{
|
||||
struct sudo_conv_reply *repl;
|
||||
const struct sudo_conv_message *msg;
|
||||
@@ -65,7 +65,7 @@ sudo_conversation(int num_msgs, const struct sudo_conv_message msgs[],
|
||||
if (ISSET(msg->msg_type, SUDO_CONV_PROMPT_ECHO_OK))
|
||||
SET(flags, TGP_NOECHO_TRY);
|
||||
/* Read the password unless interrupted. */
|
||||
pass = tgetpass(msg->msg, msg->timeout, flags);
|
||||
pass = tgetpass(msg->msg, msg->timeout, flags, callback);
|
||||
if (pass == NULL)
|
||||
goto err;
|
||||
if ((repl->reply = strdup(pass)) == NULL) {
|
||||
@@ -103,6 +103,13 @@ err:
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
sudo_conversation_1_7(int num_msgs, const struct sudo_conv_message msgs[],
|
||||
struct sudo_conv_reply replies[])
|
||||
{
|
||||
return sudo_conversation(num_msgs, msgs, replies, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
sudo_conversation_printf(int msg_type, const char *fmt, ...)
|
||||
{
|
||||
|
Reference in New Issue
Block a user