ssh_handle_packets_termination() must not return SSH_OK when exiting due to
a timeout while the termination function still returns 1.

Signed-off-by: Nicolas Viennot <[email protected]>
---
 src/session.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/session.c b/src/session.c
index 4e71394..fe5d897 100644
--- a/src/session.c
+++ b/src/session.c
@@ -537,8 +537,10 @@ int ssh_handle_packets_termination(ssh_session session, 
int timeout,
                ret = ssh_handle_packets(session, tm);
                if(ret == SSH_ERROR)
                  break;
-               if(ssh_timeout_elapsed(&ts,timeout))
+               if(ssh_timeout_elapsed(&ts,timeout)) {
+                 ret = fct(user) ? SSH_OK : SSH_AGAIN;
                  break;
+               }
                tm = ssh_timeout_update(&ts, timeout);
        }
        return ret;
-- 
1.8.2.1


Reply via email to