diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2013-07-01 00:08:44 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2013-07-13 15:23:33 +0200 |
commit | 2ab7f2be75df1432fa7caad39ea40518ada95af3 (patch) | |
tree | 51f87fe91da8723fec775de9b1330d99f9e916af /include/libssh/callbacks.h | |
parent | 47a4eea827adcd1bc1c42646827c1045c156ad4e (diff) | |
download | libssh-2ab7f2be75df1432fa7caad39ea40518ada95af3.tar.gz libssh-2ab7f2be75df1432fa7caad39ea40518ada95af3.tar.xz libssh-2ab7f2be75df1432fa7caad39ea40518ada95af3.zip |
server: add pubkey auth callback
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'include/libssh/callbacks.h')
-rw-r--r-- | include/libssh/callbacks.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/libssh/callbacks.h b/include/libssh/callbacks.h index 6c031276..bc3eb79e 100644 --- a/include/libssh/callbacks.h +++ b/include/libssh/callbacks.h @@ -182,6 +182,22 @@ typedef int (*ssh_auth_none_callback) (ssh_session session, const char *user, vo typedef int (*ssh_auth_gssapi_mic_callback) (ssh_session session, const char *user, const char *principal, void *userdata); +/** + * @brief SSH authentication callback. + * @param session Current session handler + * @param user User that wants to authenticate + * @param pubkey public key used for authentication + * @param signature_state SSH_PUBLICKEY_STATE_NONE if the key is not signed (simple public key probe), + * SSH_PUBLICKEY_STATE_VALID if the signature is valid. Others values should be + * replied with a SSH_AUTH_DENIED. + * @param userdata Userdata to be passed to the callback function. + * @returns SSH_AUTH_OK Authentication is accepted. + * @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed. + * @returns SSH_AUTH_DENIED Authentication failed. + */ +typedef int (*ssh_auth_pubkey_callback) (ssh_session session, const char *user, struct ssh_key_struct *pubkey, + char signature_state, void *userdata); + /** * @brief Handles an SSH service request @@ -247,6 +263,7 @@ typedef int (*ssh_gssapi_accept_sec_ctx_callback) (ssh_session session, typedef int (*ssh_gssapi_verify_mic_callback) (ssh_session session, ssh_string mic, void *mic_buffer, size_t mic_buffer_size, void *userdata); + /** * This structure can be used to implement a libssh server, with appropriate callbacks. */ @@ -272,6 +289,12 @@ struct ssh_server_callbacks_struct { * gssapi-mic method. */ ssh_auth_gssapi_mic_callback auth_gssapi_mic_function; + + /** this function gets called when a client tries to authenticate or offer + * a public key. + */ + ssh_auth_pubkey_callback auth_pubkey_function; + /** This functions gets called when a service request is issued by the * client */ |