You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by mj...@apache.org on 2018/06/26 00:25:32 UTC

[10/21] guacamole-server git commit: GUACAMOLE-527: Make sure ssh_known_hosts exists before trying to load.

GUACAMOLE-527: Make sure ssh_known_hosts exists before trying to load.


Project: http://git-wip-us.apache.org/repos/asf/guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-server/commit/27c977ad
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-server/tree/27c977ad
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-server/diff/27c977ad

Branch: refs/heads/staging/1.0.0
Commit: 27c977adb2a78e861a4fe5272ab8a41d8c3cd8c0
Parents: 428243b
Author: Nick Couchman <vn...@apache.org>
Authored: Mon May 28 10:23:47 2018 -0400
Committer: Nick Couchman <ni...@cotyinc.com>
Committed: Mon Jun 25 08:31:37 2018 -0400

----------------------------------------------------------------------
 src/common-ssh/key.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/27c977ad/src/common-ssh/key.c
----------------------------------------------------------------------
diff --git a/src/common-ssh/key.c b/src/common-ssh/key.c
index 570da8e..66b8386 100644
--- a/src/common-ssh/key.c
+++ b/src/common-ssh/key.c
@@ -35,6 +35,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 guac_common_ssh_key* guac_common_ssh_key_alloc(char* data, int length,
         char* passphrase) {
@@ -268,7 +269,8 @@ int guac_common_ssh_verify_host_key(LIBSSH2_SESSION* session, guac_client* clien
     else {
 
         const char *guac_known_hosts = "/etc/guacamole/ssh_known_hosts";
-        known_hosts = libssh2_knownhost_readfile(ssh_known_hosts, guac_known_hosts, LIBSSH2_KNOWNHOST_FILE_OPENSSH);
+        if (access(guac_known_hosts, F_OK) != -1)
+            known_hosts = libssh2_knownhost_readfile(ssh_known_hosts, guac_known_hosts, LIBSSH2_KNOWNHOST_FILE_OPENSSH);
 
     }