summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ssh.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/ssh.c b/src/ssh.c
index f5f9435..3c1da38 100644
--- a/src/ssh.c
+++ b/src/ssh.c
@@ -95,10 +95,24 @@ static int ssh_authenticate(ssh_session ssh, struct ssh_opts *opts)
return -1;
}
+static int _ssh_getpass(const char *prompt, char *buf, size_t len, int echo,
+ int verify, void *userdata)
+{
+ return ssh_getpass(prompt, buf, len, echo, verify);
+}
+
+static struct ssh_callbacks_struct cb = {
+ .auth_function = _ssh_getpass,
+ .userdata = NULL,
+};
+
static ssh_session ssh_init_session(char *sshdst, struct ssh_opts *opts)
{
ssh_session ssh = ssh_new();
+ ssh_callbacks_init(&cb);
+ ssh_set_callbacks(ssh, &cb);
+
if (ssh_set_opts(ssh, opts) != 0)
goto free_out;