Add error codes to session_method_pref()
This commit is contained in:
parent
2e02ad041a
commit
d86bcab2d2
@ -220,6 +220,8 @@ typedef struct _LIBSSH2_LISTENER LIBSSH2_LISTENER;
|
|||||||
#define LIBSSH2_ERROR_SOCKET_TIMEOUT -30
|
#define LIBSSH2_ERROR_SOCKET_TIMEOUT -30
|
||||||
#define LIBSSH2_ERROR_SFTP_PROTOCOL -31
|
#define LIBSSH2_ERROR_SFTP_PROTOCOL -31
|
||||||
#define LIBSSH2_ERROR_REQUEST_DENIED -32
|
#define LIBSSH2_ERROR_REQUEST_DENIED -32
|
||||||
|
#define LIBSSH2_ERROR_METHOD_NOT_SUPPORTED -33
|
||||||
|
#define LIBSSH2_ERROR_INVAL -34
|
||||||
|
|
||||||
/* Session API */
|
/* Session API */
|
||||||
LIBSSH2_API LIBSSH2_SESSION *libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)), LIBSSH2_FREE_FUNC((*my_free)), LIBSSH2_REALLOC_FUNC((*my_realloc)), void *abstract);
|
LIBSSH2_API LIBSSH2_SESSION *libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)), LIBSSH2_FREE_FUNC((*my_free)), LIBSSH2_REALLOC_FUNC((*my_realloc)), void *abstract);
|
||||||
|
@ -1251,6 +1251,7 @@ LIBSSH2_API int libssh2_session_method_pref(LIBSSH2_SESSION *session, int method
|
|||||||
mlist = NULL;
|
mlist = NULL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
libssh2_error(session, LIBSSH2_ERROR_INVAL, "Invalid parameter specified for method_type", 0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1282,6 +1283,7 @@ LIBSSH2_API int libssh2_session_method_pref(LIBSSH2_SESSION *session, int method
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(newprefs) == 0) {
|
if (strlen(newprefs) == 0) {
|
||||||
|
libssh2_error(session, LIBSSH2_ERROR_METHOD_NOT_SUPPORTED, "The requested method(s) are not currently supported", 0);
|
||||||
LIBSSH2_FREE(session, newprefs);
|
LIBSSH2_FREE(session, newprefs);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user