diff options
author | Dave Davenport <qball@gmpclient.org> | 2019-03-04 23:16:14 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2019-03-04 23:16:14 +0100 |
commit | ec81a17c410fac2aa5512088ed038b69d524789b (patch) | |
tree | c24faea3940d58945e698f0d61d784ed08a44d6c | |
parent | 906a48f566d8c1c3366daefb3c454a17466e8e21 (diff) |
[SSH] Expand path and use right strcmp.
Issue: #928
-rw-r--r-- | source/dialogs/ssh.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c index 2d998034..df17f6e9 100644 --- a/source/dialogs/ssh.c +++ b/source/dialogs/ssh.c @@ -321,9 +321,12 @@ static SshEntry *read_hosts_file ( SshEntry * retv, unsigned int *length ) static void add_known_hosts_file ( SSHModePrivateData *pd, const char *token ) { - GList *item = g_list_find_custom ( pd->user_known_hosts, token, g_str_equal ); + GList *item = g_list_find_custom ( pd->user_known_hosts, token, (GCompareFunc)g_strcmp0 ); if ( item == NULL ) { + g_debug("Add '%s' to UserKnownHost list", token); pd->user_known_hosts = g_list_append ( pd->user_known_hosts, g_strdup ( token ) ); + } else { + g_debug("File '%s' already in UserKnownHostsFile list", token); } } @@ -476,7 +479,9 @@ static SshEntry * get_ssh ( SSHModePrivateData *pd, unsigned int *length ) retv = read_known_hosts_file ( path, retv, length ); g_free ( path ); for ( GList *iter = g_list_first ( pd->user_known_hosts); iter; iter = g_list_next ( iter ) ) { - retv = read_known_hosts_file ( (const char*)iter->data, retv, length ); + char *path = rofi_expand_path ( (const char *)iter->data); + retv = read_known_hosts_file ( (const char*)path, retv, length ); + g_free (path); } } if ( config.parse_hosts == TRUE ) { |