mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-18 15:20:56 +03:00
tidy-up: example, tests continued
- fix skip auth if `userauthlist` is NULL. Closes #836 (Reported-by: @sudipm-mukherjee on github) - fix most silenced `checksrc` warnings. - sync examples/tests code between each other. (output messages, error handling, declaration order, comments) - stop including unnecessary headers. - always deinitialize in case of error. - drop some redundant variables. - add error handling where missing. - show more error codes. - switch `perror()` to `fprintf()`. - fix some `printf()`s to be `fprintf()`. - formatting. Closes #960
This commit is contained in:
@@ -32,12 +32,12 @@ int test(LIBSSH2_SESSION *session)
|
||||
const char *userauth_list =
|
||||
libssh2_userauth_list(session, USERNAME,
|
||||
(unsigned int)strlen(USERNAME));
|
||||
if(userauth_list == NULL) {
|
||||
if(!userauth_list) {
|
||||
print_last_session_error("libssh2_userauth_list");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(strstr(userauth_list, "keyboard-interactive") == NULL) {
|
||||
if(!strstr(userauth_list, "keyboard-interactive")) {
|
||||
fprintf(stderr,
|
||||
"'keyboard-interactive' was expected in userauth list: %s\n",
|
||||
userauth_list);
|
||||
|
||||
Reference in New Issue
Block a user