Handling of initial protocol error changed

The client accepts a long(er) response time when waiting for server to
enable RFC2217 (telnet option).

Bug in hangling of rx timeout fixed
This commit is contained in:
Frank Rolsted Jensen
2025-06-04 11:19:24 +02:00
parent 4d3f7d384b
commit 10d5c9cf3b
2 changed files with 7 additions and 6 deletions
+5 -4
View File
@@ -7,6 +7,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include "telnet.h"
#include "telnet_param.h"
@@ -284,12 +285,12 @@ int telnet_open(tn_ctx_t *tcc, int mode)
while (1)
{
res = tcc->srv_rx(tcc->cctx, 1000);
if (res <= 0)
return -1;
if (res < 0)
return errno;
else if (tcc->mode_rfc2217)
return 0;
else if (t - time(NULL) > 2)
return -1;
else if (time(NULL) - t > 10)
return EPROTO;
}
}
+2 -2
View File
@@ -470,9 +470,9 @@ static void ttynvt_open(fuse_req_t req, struct fuse_file_info *info)
res =
telnet_open(tty->tn, ttynvt_param.raw ? TN_MODE_RAW : TN_MODE_TELNET);
if (res < 0)
if (res != 0)
{
errno = EPROTO;
errno = res;
goto open_err;
}