From 977dac9cf4de095215d35b5716955f2b68fba9fb Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Mon, 25 Jun 2018 14:00:55 +0200 Subject: fixed long-term libssh pki-keygen bug, EMPTY PASSPHRASE is NOT an EMPTY STRING ("") instead it is a NULL-Pointer if libssh version >0.7.3 Signed-off-by: Toni Uhlig --- src/protocol_ssh.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/protocol_ssh.c b/src/protocol_ssh.c index bc33e66..baa1548 100644 --- a/src/protocol_ssh.c +++ b/src/protocol_ssh.c @@ -87,12 +87,13 @@ int ssh_init_cb(protocol_ctx *ctx) if (ssh_version(SSH_VERSION_INT(0,7,3)) == NULL) { W("%s", "Unsupported libssh version < 0.7.3"); + return 1; } - if (ssh_version(SSH_VERSION_INT(0,7,4)) != NULL || - ssh_version(SSH_VERSION_INT(0,7,90)) != NULL) + if (ssh_version(SSH_VERSION_INT(0,7,4)) == NULL && + ssh_version(SSH_VERSION_INT(0,7,90)) == NULL) { W("%s", - "libssh versions > 0.7.3 may suffer " + "libssh versions <= 0.7.3 may suffer " "from problems with the pki key generation/export"); } version_logged = 1; @@ -341,7 +342,7 @@ static int gen_export_sshkey(enum ssh_keytypes_e type, int length, const char *p W2("Generating %s key failed: %d", type_str, s); return 1; } - s = ssh_pki_export_privkey_file(priv_key, "", NULL, + s = ssh_pki_export_privkey_file(priv_key, NULL, NULL, NULL, path); ssh_key_free(priv_key); -- cgit v1.2.3