1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-01 11:26:52 +03:00

example: Simplify auth_callback of the client.

Found by Coverity.
This commit is contained in:
Andreas Schneider
2012-10-08 20:07:09 +02:00
parent 131a0de32e
commit 87036839f9

View File

@ -47,31 +47,10 @@ static char *proxycommand;
static int auth_callback(const char *prompt, char *buf, size_t len,
int echo, int verify, void *userdata) {
char *answer = NULL;
char *ptr;
(void) verify;
(void) userdata;
(void) verify;
(void) userdata;
if (echo) {
while ((answer = fgets(buf, len, stdin)) == NULL);
if ((ptr = strchr(buf, '\n'))) {
*ptr = '\0';
}
} else {
if (ssh_getpass(prompt, buf, len, 0, 0) < 0) {
return -1;
}
return 0;
}
if (answer == NULL) {
return -1;
}
strncpy(buf, answer, len);
return 0;
return ssh_getpass(prompt, buf, len, echo, verify);
}
struct ssh_callbacks_struct cb = {