summaryrefslogtreecommitdiff
path: root/fuzz
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2020-12-06 21:54:01 +0800
committerMatt Johnston <matt@ucc.asn.au>2020-12-06 21:54:01 +0800
commitce536942092aa16258cb4d982a8b635a014e3f1e (patch)
treef411ef5d96aee49ecf9aee5d57b82eaaa75a5eed /fuzz
parent030603579f6c0207ada8944a91ad301d924af914 (diff)
downloaddropbear-ce536942092aa16258cb4d982a8b635a014e3f1e.tar.gz
fuzz: add an always-failing dropbear_listen() replacement
Diffstat (limited to 'fuzz')
-rw-r--r--fuzz/fuzz-common.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/fuzz/fuzz-common.c b/fuzz/fuzz-common.c
index f251e81..887308a 100644
--- a/fuzz/fuzz-common.c
+++ b/fuzz/fuzz-common.c
@@ -255,6 +255,23 @@ struct dropbear_progress_connection *fuzz_connect_remote(const char* UNUSED(remo
return NULL;
}
+/* Fake dropbear_listen, always returns failure for now.
+TODO make it sometimes return success with wrapfd_new_dummy() sockets.
+Making the listeners fake a new incoming connection will be harder. */
+/* Listen on address:port.
+ * Special cases are address of "" listening on everything,
+ * and address of NULL listening on localhost only.
+ * Returns the number of sockets bound on success, or -1 on failure. On
+ * failure, if errstring wasn't NULL, it'll be a newly malloced error
+ * string.*/
+int fuzz_dropbear_listen(const char* UNUSED(address), const char* UNUSED(port),
+ int *UNUSED(socks), unsigned int UNUSED(sockcount), char **errstring, int *UNUSED(maxfd)) {
+ if (errstring) {
+ *errstring = m_strdup("fuzzing can't listen (yet)");
+ }
+ return -1;
+}
+
int fuzz_run_server(const uint8_t *Data, size_t Size, int skip_kexmaths, int postauth) {
static int once = 0;
if (!once) {