www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: libssh2_userauth_password return value

libssh2_userauth_password return value

From: <cosmin_at_5ivestars.net>
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.

src/userauth.c

        if (session->userauth_pswd_state == libssh2_NB_state_sent) {
            rc = _libssh2_packet_requirev(session, reply_codes,
                                          &session->userauth_pswd_data,
                                          &session->userauth_pswd_data_len,
                                          0, NULL, 0,
                                          &session->
                                          userauth_pswd_packet_requirev_state);
            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.

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2013-04-17

the libssh2 team