SCCS-vsn: libexec/telnetd/ext.h 5.3
SCCS-vsn: libexec/telnetd/state.c 5.4
SCCS-vsn: libexec/telnetd/telnetd.c 5.41
SCCS-vsn: libexec/telnetd/termstat.c 5.3
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#)ext.h 5.2 (Berkeley) %G%
+ * @(#)ext.h 5.3 (Berkeley) %G%
+#ifdef CRAY2
+extern int unpcc; /* characters left unprocessed by CRAY-2 terminal routine */
+extern char *unptyip; /* pointer to remaining characters in buffer */
+#endif
+
extern int pty, net;
extern char *line;
extern int SYNCHing; /* we are in TELNET SYNCH mode */
extern int pty, net;
extern char *line;
extern int SYNCHing; /* we are in TELNET SYNCH mode */
-static char sccsid[] = "@(#)state.c 5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)state.c 5.4 (Berkeley) %G%";
#endif /* not lint */
#include "telnetd.h"
#endif /* not lint */
#include "telnetd.h"
if ((do_dont_resp[option] == 0 && hisopts[option] == OPT_YES) ||
hiswants[option] == OPT_YES)
return;
if ((do_dont_resp[option] == 0 && hisopts[option] == OPT_YES) ||
hiswants[option] == OPT_YES)
return;
- hiswants[option] = OPT_YES;
+ /*
+ * Special case for TELOPT_TM: We send a DO, but pretend
+ * that we sent a DONT, so that we can send more DOs if
+ * we want to.
+ */
+ if (option == TELOPT_TM)
+ hiswants[option] = OPT_NO;
+ else
+ hiswants[option] = OPT_YES;
do_dont_resp[option]++;
}
(void) sprintf(nfrontp, doopt, option);
do_dont_resp[option]++;
}
(void) sprintf(nfrontp, doopt, option);
if (do_dont_resp[option] && hisopts[option] == OPT_YES)
do_dont_resp[option]--;
}
if (do_dont_resp[option] && hisopts[option] == OPT_YES)
do_dont_resp[option]--;
}
- if ((do_dont_resp[option] == 0) && (hiswants[option] != OPT_YES)) {
+ if (do_dont_resp[option] == 0) {
+ if (hiswants[option] != OPT_YES) {
switch (option) {
case TELOPT_BINARY:
switch (option) {
case TELOPT_BINARY:
}
#endif /* defined(LINEMODE) && defined(KLUDGELINEMODE) */
/*
}
#endif /* defined(LINEMODE) && defined(KLUDGELINEMODE) */
/*
- * Cheat the state machine so that it
- * looks like we got back a WONT.
+ * We never respond to a WILL TM, and
+ * we leave the state OPT_NO.
- hiswants[TELOPT_TM] = OPT_NO;
return;
case TELOPT_LFLOW:
return;
case TELOPT_LFLOW:
case TELOPT_SGA:
case TELOPT_NAWS:
case TELOPT_TSPEED:
case TELOPT_SGA:
case TELOPT_NAWS:
case TELOPT_TSPEED:
#ifdef LINEMODE
case TELOPT_LINEMODE:
#ifdef LINEMODE
case TELOPT_LINEMODE:
+# ifdef KLUDGELINEMODE
+ /*
+ * Note client's desire to use linemode.
+ */
+ lmodetype = REAL_LINEMODE;
+# endif /* KLUDGELINEMODE */
+ clientstat(TELOPT_LINEMODE, WILL, 0);
do_dont_resp[option]++;
send_dont(option, 0);
}
do_dont_resp[option]++;
send_dont(option, 0);
}
}
hisopts[option] = OPT_YES;
}
hisopts[option] = OPT_YES;
-
- /*
- * Handle other processing that should occur after we have
- * responded to client input.
- */
- switch (option) {
-#ifdef LINEMODE
- case TELOPT_LINEMODE:
-# ifdef KLUDGELINEMODE
- /*
- * Note client's desire to use linemode.
- */
- lmodetype = REAL_LINEMODE;
-# endif /* KLUDGELINEMODE */
- clientstat(TELOPT_LINEMODE, WILL, 0);
- break;
-#endif LINEMODE
-
- default:
- break;
- }
} /* end of willoption */
send_dont(option, init)
} /* end of willoption */
send_dont(option, init)
if (do_dont_resp[option] && hisopts[option] == OPT_NO)
do_dont_resp[option]--;
}
if (do_dont_resp[option] && hisopts[option] == OPT_NO)
do_dont_resp[option]--;
}
- if ((do_dont_resp[option] == 0) && (hiswants[option] != OPT_NO)) {
+ if (do_dont_resp[option] == 0) {
+ if (hiswants[option] != OPT_NO) {
/* it is always ok to change to negative state */
switch (option) {
case TELOPT_ECHO:
/* it is always ok to change to negative state */
switch (option) {
case TELOPT_ECHO:
#endif LINEMODE
case TELOPT_TM:
#endif LINEMODE
case TELOPT_TM:
-#if defined(LINEMODE) && defined(KLUDGELINEMODE)
- if (lmodetype < REAL_LINEMODE) {
- lmodetype = NO_LINEMODE;
- clientstat(TELOPT_LINEMODE, WONT, 0);
- send_will(TELOPT_SGA, 1);
-/*@*/ send_will(TELOPT_ECHO, 1);
- }
-#endif /* defined(LINEMODE) && defined(KLUDGELINEMODE) */
/*
* If we get a WONT TM, and had sent a DO TM,
* don't respond with a DONT TM, just leave it
* as is. Short circut the state machine to
/*
* If we get a WONT TM, and had sent a DO TM,
* don't respond with a DONT TM, just leave it
* as is. Short circut the state machine to
- * achive this. The bad part of this is that if
- * the client sends a WONT TM on his own to
- * turn off linemode, then he won't get a
- * response.
*/
hiswants[TELOPT_TM] = OPT_NO;
*/
hiswants[TELOPT_TM] = OPT_NO;
-#ifdef notdef
- do_dont_resp[TELOPT_TM]--;
-#endif
return;
case TELOPT_LFLOW:
return;
case TELOPT_LFLOW:
hiswants[option] = OPT_NO;
fmt = dont;
send_dont(option, 0);
hiswants[option] = OPT_NO;
fmt = dont;
send_dont(option, 0);
- } else if (option == TELOPT_TM) {
- /*
- * Special case for TM.
- */
- hiswants[option] = OPT_NO;
+ } else {
+ switch (option) {
+ case TELOPT_TM:
+#if defined(LINEMODE) && defined(KLUDGELINEMODE)
+ if (lmodetype < REAL_LINEMODE) {
+ lmodetype = NO_LINEMODE;
+ clientstat(TELOPT_LINEMODE, WONT, 0);
+ send_will(TELOPT_SGA, 1);
+/*@*/ send_will(TELOPT_ECHO, 1);
+ }
+#endif /* defined(LINEMODE) && defined(KLUDGELINEMODE) */
+ default:
+ break;
+ }
+ }
}
hisopts[option] = OPT_NO;
}
hisopts[option] = OPT_NO;
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)telnetd.c 5.40 (Berkeley) %G%";
+static char sccsid[] = "@(#)telnetd.c 5.41 (Berkeley) %G%";
#endif /* not lint */
#include "telnetd.h"
#endif /* not lint */
#include "telnetd.h"
ptyip = ptyibuf+1;
#else /* CRAY2 */
if (!uselinemode) {
ptyip = ptyibuf+1;
#else /* CRAY2 */
if (!uselinemode) {
- pcc = term_output(ptyibuf, ptyibuf2,
- pcc, BUFSIZ);
+ unpcc = pcc;
+ unptyip = ptyibuf;
+ pcc = term_output(&unptyip, ptyibuf2,
+ &unpcc, BUFSIZ);
ptyip = ptyibuf2;
} else
ptyip = ptyibuf;
ptyip = ptyibuf2;
} else
ptyip = ptyibuf;
+#ifdef CRAY2
+ /*
+ * If chars were left over from the terminal driver,
+ * note their existence.
+ */
+ if (!uselinemode && unpcc) {
+ pcc = unpcc;
+ unpcc = 0;
+ ptyip = unptyip;
+ }
+#endif /* CRAY2 */
+
if (FD_ISSET(f, &obits) && (nfrontp - nbackp) > 0)
netflush();
if (ncc > 0)
if (FD_ISSET(f, &obits) && (nfrontp - nbackp) > 0)
netflush();
if (ncc > 0)
-static char sccsid[] = "@(#)termstat.c 5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)termstat.c 5.3 (Berkeley) %G%";
#endif /* not lint */
#include "telnetd.h"
#endif /* not lint */
#include "telnetd.h"
send_dont(TELOPT_LINEMODE, 1);
# ifdef KLUDGELINEMODE
else if (lmodetype == KLUDGE_LINEMODE)
send_dont(TELOPT_LINEMODE, 1);
# ifdef KLUDGELINEMODE
else if (lmodetype == KLUDGE_LINEMODE)
- send_wont(TELOPT_SGA, 1);
+ send_will(TELOPT_SGA, 1);
# endif /* KLUDGELINEMODE */
linemode = uselinemode;
goto done;
# endif /* KLUDGELINEMODE */
linemode = uselinemode;
goto done;