aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2020-04-29 15:57:02 +0200
committerAndreas Schneider <asn@cryptomilk.org>2020-05-05 14:23:06 +0200
commitad8dedd4a481a48a51b2fed7371bc7073f0f31bd (patch)
treee56633ef8f4736d191ad0a76d289613978d63d86 /tests
parente26e98e59f93a658adaf933897cd50125433ac6f (diff)
downloadlibssh-ad8dedd4a481a48a51b2fed7371bc7073f0f31bd.tar.gz
libssh-ad8dedd4a481a48a51b2fed7371bc7073f0f31bd.tar.xz
libssh-ad8dedd4a481a48a51b2fed7371bc7073f0f31bd.zip
fuzz: Allow to increase log level from server fuzzer
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/fuzz/ssh_server_fuzzer.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/fuzz/ssh_server_fuzzer.cpp b/tests/fuzz/ssh_server_fuzzer.cpp
index 6796ac8e..b96d46bc 100644
--- a/tests/fuzz/ssh_server_fuzzer.cpp
+++ b/tests/fuzz/ssh_server_fuzzer.cpp
@@ -19,6 +19,7 @@
#include <assert.h>
#include <fcntl.h>
#include <stdint.h>
+#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/socket.h>
@@ -120,6 +121,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
int socket_fds[2] = {-1, -1};
ssize_t nwritten;
bool no = false;
+ const char *env = NULL;
int rc;
/* Our struct holding information about the session. */
@@ -156,6 +158,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
ssh_session session = ssh_new();
assert(session != NULL);
+
+ env = getenv("LIBSSH_VERBOSITY");
+ if (env != NULL && strlen(env) > 0) {
+ rc = ssh_bind_options_set(sshbind,
+ SSH_BIND_OPTIONS_LOG_VERBOSITY_STR,
+ env);
+ assert(rc == 0);
+ }
rc = ssh_bind_options_set(sshbind,
SSH_BIND_OPTIONS_RSAKEY,
"/tmp/libssh_fuzzer_private_key");