aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2020-04-08 15:08:34 +0200
committerAndreas Schneider <asn@cryptomilk.org>2020-04-09 11:25:49 +0200
commite3e3a2786362f89fc72cd8a8a67fd52a435a1597 (patch)
tree431379950e6ea6eeadbcbe7a74e87642cbe3c920 /src
parent0f33eecc0166205b1157b9897ab201b9b22d1dec (diff)
downloadlibssh-e3e3a2786362f89fc72cd8a8a67fd52a435a1597.tar.gz
libssh-e3e3a2786362f89fc72cd8a8a67fd52a435a1597.tar.xz
libssh-e3e3a2786362f89fc72cd8a8a67fd52a435a1597.zip
client: Check if the library is initialized in ssh_connect()
If the library is not initialized, SSH_ERROR is returned and the error message is set properly. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src')
-rw-r--r--src/client.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/client.c b/src/client.c
index d26b99a2..36d3ea2c 100644
--- a/src/client.c
+++ b/src/client.c
@@ -509,6 +509,13 @@ int ssh_connect(ssh_session session)
{
int ret;
+ if (!is_ssh_initialized()) {
+ ssh_set_error(session, SSH_FATAL,
+ "Library not initialized.");
+
+ return SSH_ERROR;
+ }
+
if (session == NULL) {
return SSH_ERROR;
}