From b68a1e782c4a4567dd5252fac1795804e2c20458 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Thu, 9 Jul 2020 23:01:34 +0200 Subject: ssh: Add userdata to sshnc hostkey checker --- ssh/sshnc.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ssh/sshnc.h') diff --git a/ssh/sshnc.h b/ssh/sshnc.h index 3e4bcfe..77edc8d 100644 --- a/ssh/sshnc.h +++ b/ssh/sshnc.h @@ -14,8 +14,10 @@ struct sshnc_client; // Should return 'true' if the key is trusted, 'false' otherwise. The hash is -// sha256 in byte form, not yet encoded in hexadecimal or similar. -typedef bool (*sshnc_hostkey_checker_t)(const unsigned char *hash, size_t length); +// sha256 in byte form, not yet encoded in hexadecimal or similar. The +// 'userdata' pointer comes from the 'sshnc_connect' invocation. +typedef bool (*sshnc_hostkey_checker_t)( + const unsigned char *hash, size_t length, void *userdata); // Convenience function to convert a hash to a human-readable form. Returns a // reference to an internal static buffer. @@ -55,12 +57,14 @@ const char* sshnc_strerror(enum sshnc_retval code); // If successful, stores a new connection structure in 'client' and returns // SSHNC_OK. On error, stores NULL in 'client' and returns an error code. +// The hostkey checker is invoked with the 'userdata' pointer. enum sshnc_retval sshnc_connect( const char *hostname, int port, const char *username, const char *subsystem, sshnc_hostkey_checker_t checker, + void *userdata, struct sshnc_client **client // output ); -- cgit v1.2.3-54-g00ecf