Some tests for telnet transfers
This commit is contained in:
parent
0f10842351
commit
676ed2d785
@ -7,6 +7,14 @@ v0.39.2 21-Nov-2003
|
||||
Well, almost certain that it will be removed. This version is
|
||||
in cvs because I need to test it on several machines at once.
|
||||
|
||||
TESTS:
|
||||
Originating calls: send and receive with Radius Ok.
|
||||
Answering call: send and receive with Radius Ok.
|
||||
Originating calls: send to MBSE/mbtelnetd Ok.
|
||||
receive from MBSE/mbtelnetd Error.
|
||||
Problem is in TCP protocol in telnet mode. Hydra is OK.
|
||||
Cause: wrong blocklength with transmitter?
|
||||
|
||||
general:
|
||||
Outgoing telnet finally works.
|
||||
|
||||
|
4
Makefile
4
Makefile
@ -195,6 +195,10 @@ install:
|
||||
rm ${BINDIR}/mbchat ; \
|
||||
echo "removed ${BINDIR}/mbchat"; \
|
||||
fi
|
||||
@if [ -x ${BINDIR}/mbtelnetd ]; then \
|
||||
rm ${BINDIR}/mbtelnetd ; \
|
||||
echo "removed ${BINDIR}/mbtelnetd"; \
|
||||
fi
|
||||
for d in ${SUBDIRS}; do (cd $$d && ${MAKE} $@) || exit; done
|
||||
|
||||
dist tar: ${TARFILE}
|
||||
|
3
TODO
3
TODO
@ -105,6 +105,9 @@ mbfido:
|
||||
|
||||
N: Add statistic mail messages.
|
||||
|
||||
N: With auto created areas golded.inc is not adjusted to the new
|
||||
setup.
|
||||
|
||||
mbcico:
|
||||
N: Upgrade binkp protocol to 1.1.
|
||||
|
||||
|
@ -163,8 +163,8 @@ char *mkemsidat(int caller)
|
||||
}
|
||||
|
||||
p=xstrcat(p,(char *)"{");
|
||||
if (emsi_local_protos & PROT_TCP)
|
||||
p=xstrcat(p,(char *)"TCP,");
|
||||
// if (emsi_local_protos & PROT_TCP)
|
||||
// p=xstrcat(p,(char *)"TCP,");
|
||||
if (emsi_local_protos & PROT_HYD)
|
||||
p=xstrcat(p,(char *)"HYD,");
|
||||
if (emsi_local_protos & PROT_JAN)
|
||||
|
@ -408,13 +408,6 @@ int tty_raw(int speed)
|
||||
if ((rc = tcgetattr(0,&savetios))) {
|
||||
WriteError("$tcgetattr(0,save) return %d",rc);
|
||||
return rc;
|
||||
} else {
|
||||
Syslog('T', "savetios.c_iflag=0x%08x",savetios.c_iflag);
|
||||
Syslog('T', "savetios.c_oflag=0x%08x",savetios.c_oflag);
|
||||
Syslog('T', "savetios.c_cflag=0x%08x",savetios.c_cflag);
|
||||
Syslog('T', "savetios.c_lflag=0x%08x",savetios.c_lflag);
|
||||
Syslog('T', "savetios.c_cc=\"%s\"",printable(savetios.c_cc,NCCS));
|
||||
Syslog('T', "file flags: stdin: 0x%04x, stdout: 0x%04x", fcntl(0,F_GETFL,0L),fcntl(1,F_GETFL,0L));
|
||||
}
|
||||
|
||||
tios = savetios;
|
||||
@ -453,7 +446,7 @@ int tty_local(void)
|
||||
WriteError("$tcgetattr(0,save) return %d",rc);
|
||||
return rc;
|
||||
}
|
||||
Syslog('-', "Dropping DTR");
|
||||
Syslog('+', "Lowering DTR to hangup");
|
||||
|
||||
cflag = Tios.c_cflag | CLOCAL;
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
* Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "../config.h"
|
||||
#include "../lib/libs.h"
|
||||
#include "../lib/clcomm.h"
|
||||
@ -36,12 +35,9 @@
|
||||
#include "telnio.h"
|
||||
|
||||
|
||||
static int tellen;
|
||||
static int buflen = 0;
|
||||
|
||||
|
||||
/* --- This is an artwork of serge terekhov, 2:5000/13@fidonet :) --- */
|
||||
|
||||
void telnet_answer(int tag, int opt)
|
||||
{
|
||||
char buf[3];
|
||||
@ -75,7 +71,6 @@ void telnet_answer(int tag, int opt)
|
||||
int telnet_init(void)
|
||||
{
|
||||
Syslog('s', "telnet_init()");
|
||||
tellen = 0;
|
||||
telnet_answer(DO, TOPT_SUPP);
|
||||
telnet_answer(WILL, TOPT_SUPP);
|
||||
telnet_answer(DO, TOPT_BIN);
|
||||
@ -87,73 +82,6 @@ int telnet_init(void)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Read function for mbtelnetd
|
||||
*/
|
||||
int telnet_read(char *buf, int len)
|
||||
{
|
||||
int n = 0, m;
|
||||
char *q, *p;
|
||||
static char telbuf[4];
|
||||
|
||||
while ((n == 0) && (n = read (0, buf + tellen, H_ZIPBUFLEN - tellen)) > 0) {
|
||||
|
||||
if (n < 0) {
|
||||
return n;
|
||||
}
|
||||
|
||||
if (tellen) {
|
||||
memcpy(buf, telbuf, tellen);
|
||||
n += tellen;
|
||||
tellen = 0;
|
||||
}
|
||||
|
||||
if (memchr (buf, IAC, n)) {
|
||||
for (p = q = buf; n--; )
|
||||
if ((m = (unsigned char)*q++) != IAC)
|
||||
*p++ = m;
|
||||
else {
|
||||
if (n < 2) {
|
||||
memcpy (telbuf, q - 1, tellen = n + 1);
|
||||
break;
|
||||
}
|
||||
--n;
|
||||
switch (m = (unsigned char)*q++) {
|
||||
case WILL: m = (unsigned char)*q++; --n;
|
||||
Syslog('s', "TELNET: recv WILL %d", m);
|
||||
if (m != TOPT_BIN && m != TOPT_SUPP && m != TOPT_ECHO)
|
||||
telnet_answer(DONT, m);
|
||||
break;
|
||||
case WONT: m = *q++;
|
||||
--n;
|
||||
Syslog('s', "TELNET: recv WONT %d", m);
|
||||
break;
|
||||
case DO: m = (unsigned char)*q++;
|
||||
--n;
|
||||
Syslog('s', "TELNET: recv DO %d", m);
|
||||
if (m != TOPT_BIN && m != TOPT_SUPP && m != TOPT_ECHO)
|
||||
telnet_answer(WONT, m);
|
||||
break;
|
||||
case DONT: m = (unsigned char)*q++;
|
||||
--n;
|
||||
Syslog('s', "TELNET: recv DONT %d", m);
|
||||
break;
|
||||
case IAC: Syslog('s', "TELNET: recv 2nd IAC %d", m);
|
||||
*p++ = IAC;
|
||||
break;
|
||||
default: Syslog('s', "TELNET: recv IAC %d", m);
|
||||
break;
|
||||
}
|
||||
}
|
||||
n = p - buf;
|
||||
}
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Telnet output filter, IAC characters are escaped.
|
||||
*/
|
||||
@ -161,20 +89,27 @@ int telnet_write(char *buf, int len)
|
||||
{
|
||||
char *q;
|
||||
int k, l;
|
||||
int c = 0;
|
||||
|
||||
Syslog('s', "telnet_write(buf, %d)", len);
|
||||
l = len;
|
||||
while ((len > 0) && (q = memchr(buf, IAC, len))) {
|
||||
k = (q - buf) + 1;
|
||||
if ((write(1, buf, k) != k) || (write(1, q, 1) != 1)) {
|
||||
return -1;
|
||||
}
|
||||
c += k;
|
||||
c += 1;
|
||||
buf += k;
|
||||
len -= k;
|
||||
}
|
||||
|
||||
c += len;
|
||||
if ((len > 0) && write(1, buf, len) != len) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Syslog('s', "telnet_write: real sent %d", c);
|
||||
return l;
|
||||
}
|
||||
|
||||
@ -190,6 +125,7 @@ int telnet_buffer(char *buf, int len)
|
||||
int i, j, m = 0, rc;
|
||||
static char telbuf[4];
|
||||
|
||||
Syslog('s', "telnet_buffer(buf, %d) buflen=%d", len, buflen);
|
||||
rc = len;
|
||||
|
||||
if (buflen > 2) {
|
||||
@ -283,6 +219,8 @@ int telnet_buffer(char *buf, int len)
|
||||
rc = j;
|
||||
}
|
||||
|
||||
Syslog('s', "telnet_buffer: rc=%d buflen=%d", rc, buflen);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
void telnet_answer(int, int);
|
||||
int telnet_init(void);
|
||||
int telnet_read(char *, int);
|
||||
int telnet_write(char *, int);
|
||||
int telnet_buffer(char *, int);
|
||||
|
||||
|
@ -174,6 +174,8 @@ static int tty_read(char *buf, int size, int tot)
|
||||
fd_set readfds, writefds, exceptfds;
|
||||
struct timeval seltimer;
|
||||
|
||||
Syslog('t', "tty_read(buf, %d, %d)", size, tot);
|
||||
|
||||
if (size == 0)
|
||||
return 0;
|
||||
tty_status = 0;
|
||||
@ -234,6 +236,7 @@ static int tty_read(char *buf, int size, int tot)
|
||||
}
|
||||
|
||||
rc = read(0,buf,size);
|
||||
Syslog('t', "tty_read: real read %d", rc);
|
||||
if (rc <= 0) {
|
||||
Syslog('t', "tty_read: return %d",rc);
|
||||
if (hanged_up || (errno == EPIPE) || (errno == ECONNRESET)) {
|
||||
@ -250,6 +253,7 @@ static int tty_read(char *buf, int size, int tot)
|
||||
}
|
||||
}
|
||||
|
||||
Syslog('t', "tty_read: rc=%d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user