mirror of
https://github.com/libssh2/libssh2.git
synced 2025-08-08 19:02:07 +03:00
libssh2_userauth_list has return code
This commit is contained in:
@@ -503,6 +503,7 @@ typedef struct _LIBSSH2_POLLFD {
|
|||||||
#define LIBSSH2_ERROR_KNOWN_HOSTS -46
|
#define LIBSSH2_ERROR_KNOWN_HOSTS -46
|
||||||
#define LIBSSH2_ERROR_CHANNEL_WINDOW_FULL -47
|
#define LIBSSH2_ERROR_CHANNEL_WINDOW_FULL -47
|
||||||
#define LIBSSH2_ERROR_KEYFILE_AUTH_FAILED -48
|
#define LIBSSH2_ERROR_KEYFILE_AUTH_FAILED -48
|
||||||
|
#define LIBSSH2_ERROR_MISSING_AUTH_BANNER -49
|
||||||
|
|
||||||
/* this is a define to provide the old (<= 1.2.7) name */
|
/* this is a define to provide the old (<= 1.2.7) name */
|
||||||
#define LIBSSH2_ERROR_BANNER_NONE LIBSSH2_ERROR_BANNER_RECV
|
#define LIBSSH2_ERROR_BANNER_NONE LIBSSH2_ERROR_BANNER_RECV
|
||||||
@@ -611,8 +612,8 @@ LIBSSH2_API const char *libssh2_session_banner_get(LIBSSH2_SESSION *session);
|
|||||||
LIBSSH2_API char *libssh2_userauth_list(LIBSSH2_SESSION *session,
|
LIBSSH2_API char *libssh2_userauth_list(LIBSSH2_SESSION *session,
|
||||||
const char *username,
|
const char *username,
|
||||||
unsigned int username_len);
|
unsigned int username_len);
|
||||||
LIBSSH2_API char *libssh2_userauth_banner(LIBSSH2_SESSION * session,
|
LIBSSH2_API int libssh2_userauth_banner(LIBSSH2_SESSION* session,
|
||||||
size_t *banner_len_out);
|
char **banner_out);
|
||||||
LIBSSH2_API int libssh2_userauth_authenticated(LIBSSH2_SESSION *session);
|
LIBSSH2_API int libssh2_userauth_authenticated(LIBSSH2_SESSION *session);
|
||||||
|
|
||||||
LIBSSH2_API int
|
LIBSSH2_API int
|
||||||
|
@@ -237,24 +237,25 @@ libssh2_userauth_list(LIBSSH2_SESSION * session, const char *user,
|
|||||||
*
|
*
|
||||||
* Retrieve banner message from server, if available.
|
* Retrieve banner message from server, if available.
|
||||||
* If no such message is sent by the server or if no authentication attempt has
|
* If no such message is sent by the server or if no authentication attempt has
|
||||||
* been made, this function returns NULL.
|
* been made, this function returns LIBSSH2_ERROR_MISSING_AUTH_BANNER.
|
||||||
* libssh2_userauth_list makes a "none" authentication attempt and is
|
* libssh2_userauth_list makes a "none" authentication attempt and is
|
||||||
* sufficient to collect the pre-auth banner message.
|
* sufficient to collect the pre-auth banner message.
|
||||||
*
|
*
|
||||||
* Banner ought to be UTF-8 encoded, and will be truncated to
|
* Banner ought to be UTF-8 encoded, and will be truncated to
|
||||||
* LIBSSH2_USERAUTH_MAX_BANNER bytes. Length will be returned in
|
* LIBSSH2_USERAUTH_MAX_BANNER bytes.
|
||||||
* banner_len_out.
|
|
||||||
*/
|
*/
|
||||||
LIBSSH2_API char *
|
LIBSSH2_API int
|
||||||
libssh2_userauth_banner(LIBSSH2_SESSION* session,
|
libssh2_userauth_banner(LIBSSH2_SESSION* session,
|
||||||
size_t *banner_len_out)
|
char **banner_out)
|
||||||
{
|
{
|
||||||
char *ptr = NULL;
|
if(!session->userauth_banner) {
|
||||||
if(session->userauth_banner) {
|
return _libssh2_error(session,
|
||||||
ptr = session->userauth_banner;
|
LIBSSH2_ERROR_MISSING_AUTH_BANNER,
|
||||||
*banner_len_out = session->userauth_banner_len;
|
"Missing authentication banner");
|
||||||
}
|
}
|
||||||
return ptr;
|
|
||||||
|
*banner_out = session->userauth_banner;
|
||||||
|
return LIBSSH2_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user