Subject: libssh2_userauth_password return value

libssh2_userauth_password return value

From: <>
Date: Wed, 17 Apr 2013 01:00:04 -0700

If the authentication fails for a couple of times (libssh2_userauth_password() returns LIBSSH2_ERROR_AUTHENTICATION_FAILED) and the server closes the connection because of too many authentication failures libssh2_userauth_password() returns LIBSSH2_ERROR_TIMEOUT but in this case it should return LIBSSH2_ERROR_SOCKET_DISCONNECT.


        if (session->userauth_pswd_state == libssh2_NB_state_sent) {
            rc = _libssh2_packet_requirev(session, reply_codes,
                                          0, NULL, 0,
            if (rc == LIBSSH2_ERROR_EAGAIN) {
                return _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
                                      "Would block waiting");
            } else if (rc) {
                session->userauth_pswd_state = libssh2_NB_state_idle;
                return _libssh2_error(session, LIBSSH2_ERROR_TIMEOUT,
                                      "Would block waiting");

I think it should return the actual error from the transport layer and not a "general" LIBSSH2_ERROR_TIMEOUT error.

Received on 2013-04-17