Allow building without the exec() supported ...

.. to satisfy restricted environment or fuzzers

We are encountering weird issues in the oss-fuzz that the file disappears during
coverage build so I assume some corpus sneaked in, that contains some commands
that end up being executed as part of the coverage run causing it randomly
failing.

The solution I propose is to build fuzzers without ability to call arbitrary
commands on the filesystem (such as `rm -rf /`) as this is not the point the
fuzzers should be testing.

This is controlled by the WITH_EXEC CMake option (enabled by default).

https://github.com/google/oss-fuzz/issues/10136

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Sahana Prasad <sahana@redhat.com>
Reviewed-by: Eshan Kelkar <eshankelkar@galorithm.com>
This commit is contained in:
Jakub Jelen
2024-07-04 18:28:43 +02:00
committed by Sahana Prasad
parent 2fe9ed1764
commit bed4438695
12 changed files with 81 additions and 34 deletions

View File

@@ -589,11 +589,16 @@ int ssh_connect(ssh_session session)
session->session_state = SSH_SESSION_STATE_SOCKET_CONNECTED;
ssh_socket_set_fd(session->socket, session->opts.fd);
ret = SSH_OK;
#ifndef _WIN32
} else if (session->opts.ProxyCommand != NULL) {
#ifdef WITH_EXEC
ret = ssh_socket_connect_proxycommand(session->socket,
session->opts.ProxyCommand);
#endif
#else
ssh_set_error(session,
SSH_FATAL,
"The libssh is built without support for proxy commands.");
ret = SSH_ERROR;
#endif /* WITH_EXEC */
} else {
ret = ssh_socket_connect(session->socket,
session->opts.host,