aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authormilo <milo@r0ot.me>2011-02-08 00:40:18 +0100
committermilo <milo@r0ot.me>2011-02-10 14:39:20 +0100
commit3c0a4781e49a4912e191b20ea8ccaeb884eb9dcd (patch)
tree12da3549867512351a797bfa571f841b1d214708 /include
parent32e23a25da4e7d23bdede1cee4cadc6c80306c23 (diff)
downloadlibssh-3c0a4781e49a4912e191b20ea8ccaeb884eb9dcd.tar.gz
libssh-3c0a4781e49a4912e191b20ea8ccaeb884eb9dcd.tar.xz
libssh-3c0a4781e49a4912e191b20ea8ccaeb884eb9dcd.zip
Added the keyboard-interactive authentication method
Diffstat (limited to 'include')
-rw-r--r--include/libssh/auth.h21
-rw-r--r--include/libssh/libssh.h2
-rw-r--r--include/libssh/messages.h1
-rw-r--r--include/libssh/server.h5
-rw-r--r--include/libssh/session.h1
5 files changed, 29 insertions, 1 deletions
diff --git a/include/libssh/auth.h b/include/libssh/auth.h
index 343b3091..c2fba2af 100644
--- a/include/libssh/auth.h
+++ b/include/libssh/auth.h
@@ -29,6 +29,27 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_failure);
SSH_PACKET_CALLBACK(ssh_packet_userauth_success);
SSH_PACKET_CALLBACK(ssh_packet_userauth_pk_ok);
SSH_PACKET_CALLBACK(ssh_packet_userauth_info_request);
+SSH_PACKET_CALLBACK(ssh_packet_userauth_info_response);
+
+/** @internal
+ * kdbint structure must be shared with message.c
+ * and server.c
+ */
+struct ssh_kbdint_struct {
+ uint32_t nprompts;
+ uint32_t nanswers;
+ char *name;
+ char *instruction;
+ char **prompts;
+ unsigned char *echo; /* bool array */
+ char **answers;
+};
+typedef struct ssh_kbdint_struct* ssh_kbdint;
+
+ssh_kbdint kbdint_new(void);
+void kbdint_clean(ssh_kbdint kbd);
+void kbdint_free(ssh_kbdint kbd);
+
#ifdef WITH_SSH1
void ssh_auth1_handler(ssh_session session, uint8_t type);
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h
index a215c31e..5430786b 100644
--- a/include/libssh/libssh.h
+++ b/include/libssh/libssh.h
@@ -446,6 +446,8 @@ LIBSSH_API const char *ssh_userauth_kbdint_getinstruction(ssh_session session);
LIBSSH_API const char *ssh_userauth_kbdint_getname(ssh_session session);
LIBSSH_API int ssh_userauth_kbdint_getnprompts(ssh_session session);
LIBSSH_API const char *ssh_userauth_kbdint_getprompt(ssh_session session, unsigned int i, char *echo);
+LIBSSH_API int ssh_userauth_kbdint_getnanswers(ssh_session session);
+LIBSSH_API const char *ssh_userauth_kbdint_getanswer(ssh_session session, unsigned int i);
LIBSSH_API int ssh_userauth_kbdint_setanswer(ssh_session session, unsigned int i,
const char *answer);
LIBSSH_API int ssh_userauth_list(ssh_session session, const char *username);
diff --git a/include/libssh/messages.h b/include/libssh/messages.h
index 419c3cbb..5001fbe0 100644
--- a/include/libssh/messages.h
+++ b/include/libssh/messages.h
@@ -30,6 +30,7 @@ struct ssh_auth_request {
char *password;
struct ssh_public_key_struct *public_key;
char signature_state;
+ char kbdint_response;
};
struct ssh_channel_request_open {
diff --git a/include/libssh/server.h b/include/libssh/server.h
index cd334c1d..8f67d26d 100644
--- a/include/libssh/server.h
+++ b/include/libssh/server.h
@@ -173,6 +173,7 @@ LIBSSH_API int ssh_message_reply_default(ssh_message msg);
LIBSSH_API char *ssh_message_auth_user(ssh_message msg);
LIBSSH_API char *ssh_message_auth_password(ssh_message msg);
LIBSSH_API ssh_public_key ssh_message_auth_publickey(ssh_message msg);
+LIBSSH_API int ssh_message_auth_kbdint_is_response(ssh_message msg);
LIBSSH_API enum ssh_publickey_state_e ssh_message_auth_publickey_state(ssh_message msg);
LIBSSH_API int ssh_message_auth_reply_success(ssh_message msg,int partial);
LIBSSH_API int ssh_message_auth_reply_pk_ok(ssh_message msg, ssh_string algo, ssh_string pubkey);
@@ -180,6 +181,10 @@ LIBSSH_API int ssh_message_auth_reply_pk_ok_simple(ssh_message msg);
LIBSSH_API int ssh_message_auth_set_methods(ssh_message msg, int methods);
+LIBSSH_API int ssh_message_auth_interactive_request(ssh_message msg,
+ const char *name, const char *instruction,
+ unsigned int num_prompts, const char **prompts, char *echo);
+
LIBSSH_API int ssh_message_service_reply_success(ssh_message msg);
LIBSSH_API char *ssh_message_service_service(ssh_message msg);
diff --git a/include/libssh/session.h b/include/libssh/session.h
index 58df0d58..f6ad8c67 100644
--- a/include/libssh/session.h
+++ b/include/libssh/session.h
@@ -27,7 +27,6 @@
#include "libssh/auth.h"
#include "libssh/channels.h"
#include "libssh/poll.h"
-typedef struct ssh_kbdint_struct* ssh_kbdint;
/* These are the different states a SSH session can be into its life */
enum ssh_session_state_e {