summaryrefslogtreecommitdiff
path: root/logsrvd
diff options
context:
space:
mode:
authorTodd C. Miller <Todd.Miller@sudo.ws>2021-09-28 20:20:28 -0600
committerTodd C. Miller <Todd.Miller@sudo.ws>2021-09-28 20:20:28 -0600
commitcf88831d6d60015c8a47ea4ebd3b735e6196d402 (patch)
tree9ed2ad468808196e0ba2dfce3d4231053b38e6c3 /logsrvd
parent63927ca7ae038e103bfb5ee65c4b80f143094407 (diff)
downloadsudo-cf88831d6d60015c8a47ea4ebd3b735e6196d402.tar.gz
Use a consistent version of fuzz_conversation() with all fuzzers.
Also undo a change to fuzz_sudoers.c that snuck in to the last commit.
Diffstat (limited to 'logsrvd')
-rw-r--r--logsrvd/regress/fuzz/fuzz_logsrvd_conf.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/logsrvd/regress/fuzz/fuzz_logsrvd_conf.c b/logsrvd/regress/fuzz/fuzz_logsrvd_conf.c
index d92cf3942..09787eca0 100644
--- a/logsrvd/regress/fuzz/fuzz_logsrvd_conf.c
+++ b/logsrvd/regress/fuzz/fuzz_logsrvd_conf.c
@@ -47,6 +47,25 @@ static int
fuzz_conversation(int num_msgs, const struct sudo_conv_message msgs[],
struct sudo_conv_reply replies[], struct sudo_conv_callback *callback)
{
+ int n;
+
+ for (n = 0; n < num_msgs; n++) {
+ const struct sudo_conv_message *msg = &msgs[n];
+
+ switch (msg->msg_type & 0xff) {
+ case SUDO_CONV_PROMPT_ECHO_ON:
+ case SUDO_CONV_PROMPT_MASK:
+ case SUDO_CONV_PROMPT_ECHO_OFF:
+ /* input not supported */
+ return -1;
+ case SUDO_CONV_ERROR_MSG:
+ case SUDO_CONV_INFO_MSG:
+ /* no output for fuzzers */
+ break;
+ default:
+ return -1;
+ }
+ }
return 0;
}