blob: 6b9b8edefa078516d498215931ad81077a0930a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
diff -urb libssh2-0.11/src/session.c libssh2-0.11-jmk/src/session.c
--- libssh2-0.11/src/session.c 2005-06-27 17:24:29.000000000 -0500
+++ libssh2-0.11-jmk/src/session.c 2005-11-10 20:27:34.000000000 -0600
@@ -95,12 +95,19 @@
{
char banner[256];
int banner_len = 0;
+ int wait_count = 0;
while ((banner_len < sizeof(banner)) &&
((banner_len == 0) || (banner[banner_len-1] != '\n'))) {
char c = '\0';
int ret;
+ wait_count++;
+
+ /* If server is not responding, don't wait in loop forever */
+ if (wait_count > 1000)
+ return 1;
+
ret = recv(session->socket_fd, &c, 1, LIBSSH2_SOCKET_RECV_FLAGS(session));
if ((ret < 0) && (ret != EAGAIN)) {
|