1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-09-10 02:09:25 +03:00

knownhosts: Introduce new known hosts managing functions

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Andreas Schneider
2017-02-05 20:30:04 +01:00
parent 250bf37a28
commit 702e9e8ad5
5 changed files with 538 additions and 0 deletions

View File

@@ -267,6 +267,16 @@ enum ssh_keycmp_e {
SSH_KEY_CMP_PRIVATE
};
#define SSH_ADDRSTRLEN 46
struct ssh_knownhosts_entry {
char *hostname;
char *unparsed;
ssh_key publickey;
char *comment;
};
/* Error return codes */
#define SSH_OK 0 /* No error */
#define SSH_ERROR -1 /* Error of some kind */
@@ -505,6 +515,19 @@ LIBSSH_API int ssh_is_blocking(ssh_session session);
LIBSSH_API int ssh_is_connected(ssh_session session);
LIBSSH_API int ssh_is_server_known(ssh_session session);
/* KNOWN HOSTS */
LIBSSH_API void ssh_knownhosts_entry_free(struct ssh_knownhosts_entry *entry);
#define SSH_KNOWNHOSTS_ENTRY_FREE(e) do { \
if ((e) != NULL) { \
ssh_knownhosts_entry_free(e); \
e = NULL; \
} \
} while(0)
LIBSSH_API int ssh_known_hosts_parse_line(const char *host,
const char *line,
struct ssh_knownhosts_entry **entry);
/* LOGGING */
LIBSSH_API int ssh_set_log_level(int level);
LIBSSH_API int ssh_get_log_level(void);