On Wed, 17 Apr 2013, [email protected] wrote:
Here is a little patch, I am not sure it's 100% ok, it does not resolve the
problem entirely, it only handles LIBSSH2_ERROR_SOCKET_DISCONNECT. Maybe
just returning "rc" would be better.
I think so. I'd prefer a patch like the one attached here!
Thoughts?
--
/ daniel.haxx.se
From f90d602affa8aac375d32f7e416823545f8dd936 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <[email protected]>
Date: Wed, 17 Apr 2013 15:31:12 +0200
Subject: [PATCH] userauth_password: pass on the underlying error code
_libssh2_packet_requirev() may return different errors and we pass that
to the parent instead of rewriting it.
Bug: http://libssh2.org/mail/libssh2-devel-archive-2013-04/0029.shtml
Reported by: Cosmin
---
src/userauth.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/userauth.c b/src/userauth.c
index a0733d5..65dae46 100644
--- a/src/userauth.c
+++ b/src/userauth.c
@@ -276,13 +276,13 @@ userauth_password(LIBSSH2_SESSION *session,
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");
+
+ if (rc) {
+ if (rc != LIBSSH2_ERROR_EAGAIN)
+ session->userauth_pswd_state = libssh2_NB_state_idle;
+
+ return _libssh2_error(session, rc,
+ "Waiting for password response");
}
if (session->userauth_pswd_data[0] == SSH_MSG_USERAUTH_SUCCESS) {
--
1.7.10.4
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel