1
1

libssh2_userauth_list() requires the lenght of the username to be passed,

and not the sizeof() the array holding it.
Этот коммит содержится в:
James Housley 2007-08-03 15:08:28 +00:00
родитель 02e5b3b423
Коммит 0d78e69016

Просмотреть файл

@ -1,5 +1,5 @@
/* /*
* $Id: ssh2.c,v 1.15 2007/07/31 11:00:29 bagder Exp $ * $Id: ssh2.c,v 1.16 2007/08/03 15:08:28 jehousley Exp $
* *
* Sample showing how to do SSH2 connect. * Sample showing how to do SSH2 connect.
* *
@ -126,7 +126,7 @@ int main(int argc, char *argv[])
printf("\n"); printf("\n");
/* check what authentication methods are available */ /* check what authentication methods are available */
userauthlist = libssh2_userauth_list(session, username, sizeof(username)); userauthlist = libssh2_userauth_list(session, username, strlen(username));
printf("Authentication methods: %s\n", userauthlist); printf("Authentication methods: %s\n", userauthlist);
if (strstr(userauthlist, "password") != NULL) { if (strstr(userauthlist, "password") != NULL) {
auth_pw |= 1; auth_pw |= 1;