diff options
author | Ryo Nakamura <upa@haeena.net> | 2022-12-02 22:28:56 +0900 |
---|---|---|
committer | Ryo Nakamura <upa@haeena.net> | 2022-12-02 22:28:56 +0900 |
commit | 03a3a6dc4beacd77093a9619aed9b9fd6d9e786b (patch) | |
tree | 80dae3a69079873a2e99b1e0bc28915f539bd989 /src/ssh.c | |
parent | 03b857b51a53763ce4fecff935bd98f79aae77db (diff) |
add auth callback for input passphrase of privkey
Diffstat (limited to 'src/ssh.c')
-rw-r--r-- | src/ssh.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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; |