|
cvsdist |
f4325a0 |
--- netkit-telnet-0.17/telnetd/ext.h.sa-01-49 Sun Dec 12 15:59:44 1999
|
|
cvsdist |
f4325a0 |
+++ netkit-telnet-0.17/telnetd/ext.h Tue Jul 31 14:16:01 2001
|
|
cvsdist |
f4325a0 |
@@ -86,7 +86,10 @@
|
|
cvsdist |
f4325a0 |
extern int pcc, ncc;
|
|
cvsdist |
f4325a0 |
|
|
cvsdist |
f4325a0 |
/* printf into netobuf */
|
|
cvsdist |
f4325a0 |
-void netoprintf(const char *fmt, ...) __attribute((format (printf, 1, 2)));
|
|
cvsdist |
f4325a0 |
+/* void netoprintf(const char *fmt, ...) __attribute((format (printf, 1, 2))); */
|
|
cvsdist |
f4325a0 |
+#define netoprintf output_data
|
|
cvsdist |
f4325a0 |
+int output_data(const char *, ...) __attribute((format (printf, 1, 2)));
|
|
cvsdist |
f4325a0 |
+void output_datalen(const char *, int);
|
|
cvsdist |
f4325a0 |
|
|
cvsdist |
f4325a0 |
extern int pty, net;
|
|
cvsdist |
f4325a0 |
extern char *line;
|
|
cvsdist |
f4325a0 |
@@ -182,7 +185,10 @@
|
|
cvsdist |
f4325a0 |
void tty_tspeed(int);
|
|
cvsdist |
f4325a0 |
void willoption(int);
|
|
cvsdist |
f4325a0 |
void wontoption(int);
|
|
cvsdist |
f4325a0 |
+
|
|
cvsdist |
f4325a0 |
+#if 0
|
|
cvsdist |
f4325a0 |
void writenet(unsigned char *, int);
|
|
cvsdist |
f4325a0 |
+#endif
|
|
cvsdist |
f4325a0 |
|
|
cvsdist |
f4325a0 |
#if defined(ENCRYPT)
|
|
cvsdist |
f4325a0 |
extern void (*encrypt_output)(unsigned char *, int);
|
|
cvsdist |
f4325a0 |
--- netkit-telnet-0.17/telnetd/slc.c.sa-01-49 Sun Dec 12 15:59:44 1999
|
|
cvsdist |
f4325a0 |
+++ netkit-telnet-0.17/telnetd/slc.c Tue Jul 31 14:16:01 2001
|
|
cvsdist |
f4325a0 |
@@ -183,7 +183,7 @@
|
|
cvsdist |
f4325a0 |
else {
|
|
cvsdist |
f4325a0 |
snprintf(slcbuf+slcoff, sizeof(slcbuf)-slcoff, "%c%c", IAC, SE);
|
|
cvsdist |
f4325a0 |
slcoff += 2;
|
|
cvsdist |
f4325a0 |
- writenet(slcbuf, slcoff);
|
|
cvsdist |
f4325a0 |
+ output_datalen(slcbuf, slcoff);
|
|
cvsdist |
f4325a0 |
netflush(); /* force it out immediately */
|
|
cvsdist |
f4325a0 |
}
|
|
cvsdist |
f4325a0 |
}
|
|
cvsdist |
f4325a0 |
--- netkit-telnet-0.17/telnetd/state.c.sa-01-49 Sun Dec 12 20:41:44 1999
|
|
cvsdist |
f4325a0 |
+++ netkit-telnet-0.17/telnetd/state.c Tue Jul 31 14:16:01 2001
|
|
cvsdist |
f4325a0 |
@@ -37,6 +37,7 @@
|
|
cvsdist |
f4325a0 |
char state_rcsid[] =
|
|
cvsdist |
f4325a0 |
"$Id: telnet-0.17-sa-01-49.patch,v 1.1 2004/09/09 13:10:15 cvsdist Exp $";
|
|
cvsdist |
f4325a0 |
|
|
cvsdist |
f4325a0 |
+#include <stdarg.h>
|
|
cvsdist |
f4325a0 |
#include "telnetd.h"
|
|
cvsdist |
f4325a0 |
|
|
cvsdist |
f4325a0 |
int not42 = 1;
|
|
cvsdist |
f4325a0 |
@@ -1365,7 +1366,7 @@
|
|
cvsdist |
f4325a0 |
ADD(IAC);
|
|
cvsdist |
f4325a0 |
ADD(SE);
|
|
cvsdist |
f4325a0 |
|
|
cvsdist |
f4325a0 |
- writenet(statusbuf, ncp - statusbuf);
|
|
cvsdist |
f4325a0 |
+ output_datalen(statusbuf, ncp - statusbuf);
|
|
cvsdist |
f4325a0 |
netflush(); /* Send it on its way */
|
|
cvsdist |
f4325a0 |
|
|
cvsdist |
f4325a0 |
DIAG(TD_OPTIONS, {printsub('>', statusbuf, ncp - statusbuf); netflush();});
|
|
cvsdist |
f4325a0 |
--- netkit-telnet-0.17/telnetd/termstat.c.sa-01-49 Sun Dec 12 15:59:45 1999
|
|
cvsdist |
f4325a0 |
+++ netkit-telnet-0.17/telnetd/termstat.c Tue Jul 31 14:16:01 2001
|
|
cvsdist |
f4325a0 |
@@ -128,7 +128,6 @@
|
|
cvsdist |
f4325a0 |
void
|
|
cvsdist |
f4325a0 |
localstat()
|
|
cvsdist |
f4325a0 |
{
|
|
cvsdist |
f4325a0 |
- void netflush();
|
|
cvsdist |
f4325a0 |
int need_will_echo = 0;
|
|
cvsdist |
f4325a0 |
|
|
cvsdist |
f4325a0 |
/*
|
|
cvsdist |
f4325a0 |
--- netkit-telnet-0.17/telnetd/utility.c.sa-01-49 Tue Jul 31 14:16:01 2001
|
|
cvsdist |
f4325a0 |
+++ netkit-telnet-0.17/telnetd/utility.c Tue Jul 31 14:46:15 2001
|
|
cvsdist |
f4325a0 |
@@ -38,8 +38,9 @@
|
|
cvsdist |
f4325a0 |
"$Id: telnet-0.17-sa-01-49.patch,v 1.1 2004/09/09 13:10:15 cvsdist Exp $";
|
|
cvsdist |
f4325a0 |
|
|
cvsdist |
f4325a0 |
#define PRINTOPTIONS
|
|
cvsdist |
f4325a0 |
-
|
|
cvsdist |
f4325a0 |
+#define _GNU_SOURCE
|
|
cvsdist |
f4325a0 |
#include <stdarg.h>
|
|
cvsdist |
f4325a0 |
+#include <stdio.h>
|
|
cvsdist |
f4325a0 |
#include <sys/utsname.h>
|
|
cvsdist |
f4325a0 |
|
|
cvsdist |
f4325a0 |
#ifdef AUTHENTICATE
|
|
cvsdist |
f4325a0 |
@@ -52,6 +53,53 @@
|
|
cvsdist |
f4325a0 |
* utility functions performing io related tasks
|
|
cvsdist |
f4325a0 |
*/
|
|
cvsdist |
f4325a0 |
|
|
cvsdist |
f4325a0 |
+/*
|
|
cvsdist |
f4325a0 |
+ * This function appends data to nfrontp and advances nfrontp.
|
|
cvsdist |
f4325a0 |
+ * Returns the number of characters written altogether (the
|
|
cvsdist |
f4325a0 |
+ * buffer may have been flushed in the process).
|
|
cvsdist |
f4325a0 |
+ */
|
|
cvsdist |
f4325a0 |
+
|
|
cvsdist |
f4325a0 |
+int
|
|
cvsdist |
f4325a0 |
+output_data(const char *format, ...)
|
|
cvsdist |
f4325a0 |
+{
|
|
cvsdist |
f4325a0 |
+ va_list args;
|
|
cvsdist |
f4325a0 |
+ int len;
|
|
cvsdist |
f4325a0 |
+ char *buf;
|
|
cvsdist |
f4325a0 |
+
|
|
cvsdist |
f4325a0 |
+ va_start(args, format);
|
|
cvsdist |
f4325a0 |
+ if ((len = vasprintf(&buf, format, args)) == -1)
|
|
cvsdist |
f4325a0 |
+ return -1;
|
|
cvsdist |
f4325a0 |
+ output_datalen(buf, len);
|
|
cvsdist |
f4325a0 |
+ va_end(args);
|
|
cvsdist |
f4325a0 |
+ free(buf);
|
|
cvsdist |
f4325a0 |
+ return (len);
|
|
cvsdist |
f4325a0 |
+}
|
|
cvsdist |
f4325a0 |
+
|
|
cvsdist |
f4325a0 |
+void
|
|
cvsdist |
f4325a0 |
+output_datalen(const char *buf, int len)
|
|
cvsdist |
f4325a0 |
+{
|
|
cvsdist |
f4325a0 |
+ int remaining, copied;
|
|
cvsdist |
f4325a0 |
+
|
|
cvsdist |
f4325a0 |
+ remaining = BUFSIZ - (nfrontp - netobuf);
|
|
cvsdist |
f4325a0 |
+ while (len > 0) {
|
|
cvsdist |
f4325a0 |
+ /* Free up enough space if the room is too low*/
|
|
cvsdist |
f4325a0 |
+ if ((len > BUFSIZ ? BUFSIZ : len) > remaining) {
|
|
cvsdist |
f4325a0 |
+ netflush();
|
|
cvsdist |
f4325a0 |
+ remaining = BUFSIZ - (nfrontp - netobuf);
|
|
cvsdist |
f4325a0 |
+ }
|
|
cvsdist |
f4325a0 |
+
|
|
cvsdist |
f4325a0 |
+ /* Copy out as much as will fit */
|
|
cvsdist |
f4325a0 |
+ copied = remaining > len ? len : remaining;
|
|
cvsdist |
f4325a0 |
+ memmove(nfrontp, buf, copied);
|
|
cvsdist |
f4325a0 |
+ nfrontp += copied;
|
|
cvsdist |
f4325a0 |
+ len -= copied;
|
|
cvsdist |
f4325a0 |
+ remaining -= copied;
|
|
cvsdist |
f4325a0 |
+ buf += copied;
|
|
cvsdist |
f4325a0 |
+ }
|
|
cvsdist |
f4325a0 |
+ return;
|
|
cvsdist |
f4325a0 |
+}
|
|
cvsdist |
f4325a0 |
+
|
|
cvsdist |
f4325a0 |
+/**
|
|
cvsdist |
f4325a0 |
void
|
|
cvsdist |
f4325a0 |
netoprintf(const char *fmt, ...)
|
|
cvsdist |
f4325a0 |
{
|
|
cvsdist |
f4325a0 |
@@ -67,7 +115,7 @@
|
|
cvsdist |
f4325a0 |
va_end(ap);
|
|
cvsdist |
f4325a0 |
|
|
cvsdist |
f4325a0 |
if (len<0 || len==maxsize) {
|
|
cvsdist |
f4325a0 |
- /* didn't fit */
|
|
cvsdist |
f4325a0 |
+ / * did not fit * /
|
|
cvsdist |
f4325a0 |
netflush();
|
|
cvsdist |
f4325a0 |
}
|
|
cvsdist |
f4325a0 |
else {
|
|
cvsdist |
f4325a0 |
@@ -76,6 +124,7 @@
|
|
cvsdist |
f4325a0 |
}
|
|
cvsdist |
f4325a0 |
nfrontp += len;
|
|
cvsdist |
f4325a0 |
}
|
|
cvsdist |
f4325a0 |
+*/
|
|
cvsdist |
f4325a0 |
|
|
cvsdist |
f4325a0 |
/*
|
|
cvsdist |
f4325a0 |
* ttloop
|
|
cvsdist |
f4325a0 |
@@ -273,10 +322,15 @@
|
|
cvsdist |
f4325a0 |
int n;
|
|
cvsdist |
f4325a0 |
|
|
cvsdist |
f4325a0 |
if ((n = nfrontp - nbackp) > 0) {
|
|
cvsdist |
f4325a0 |
+
|
|
cvsdist |
f4325a0 |
+#if 0
|
|
cvsdist |
f4325a0 |
+ /* XXX This causes output_data() to recurse and die */
|
|
cvsdist |
f4325a0 |
DIAG(TD_REPORT,
|
|
cvsdist |
f4325a0 |
{ netoprintf("td: netflush %d chars\r\n", n);
|
|
cvsdist |
f4325a0 |
n = nfrontp - nbackp; /* update count */
|
|
cvsdist |
f4325a0 |
});
|
|
cvsdist |
f4325a0 |
+#endif
|
|
cvsdist |
f4325a0 |
+
|
|
cvsdist |
f4325a0 |
#if defined(ENCRYPT)
|
|
cvsdist |
f4325a0 |
if (encrypt_output) {
|
|
cvsdist |
f4325a0 |
char *s = nclearto ? nclearto : nbackp;
|
|
cvsdist |
f4325a0 |
@@ -310,11 +364,14 @@
|
|
cvsdist |
f4325a0 |
}
|
|
cvsdist |
f4325a0 |
}
|
|
cvsdist |
f4325a0 |
}
|
|
cvsdist |
f4325a0 |
- if (n < 0) {
|
|
cvsdist |
f4325a0 |
- if (errno == EWOULDBLOCK || errno == EINTR)
|
|
cvsdist |
f4325a0 |
- return;
|
|
cvsdist |
f4325a0 |
- cleanup(0);
|
|
cvsdist |
f4325a0 |
- }
|
|
cvsdist |
f4325a0 |
+
|
|
cvsdist |
f4325a0 |
+ if (n == -1) {
|
|
cvsdist |
f4325a0 |
+ if (errno == EWOULDBLOCK || errno == EINTR)
|
|
cvsdist |
f4325a0 |
+ return;
|
|
cvsdist |
f4325a0 |
+ cleanup(0);
|
|
cvsdist |
f4325a0 |
+ /* NOTREACHED */
|
|
cvsdist |
f4325a0 |
+ }
|
|
cvsdist |
f4325a0 |
+
|
|
cvsdist |
f4325a0 |
nbackp += n;
|
|
cvsdist |
f4325a0 |
#if defined(ENCRYPT)
|
|
cvsdist |
f4325a0 |
if (nbackp > nclearto)
|
|
cvsdist |
f4325a0 |
@@ -332,7 +389,7 @@
|
|
cvsdist |
f4325a0 |
return;
|
|
cvsdist |
f4325a0 |
} /* end of netflush */
|
|
cvsdist |
f4325a0 |
|
|
cvsdist |
f4325a0 |
-
|
|
cvsdist |
f4325a0 |
+#if 0
|
|
cvsdist |
f4325a0 |
/*
|
|
cvsdist |
f4325a0 |
* writenet
|
|
cvsdist |
f4325a0 |
*
|
|
cvsdist |
f4325a0 |
@@ -355,7 +412,7 @@
|
|
cvsdist |
f4325a0 |
nfrontp += len;
|
|
cvsdist |
f4325a0 |
|
|
cvsdist |
f4325a0 |
} /* end of writenet */
|
|
cvsdist |
f4325a0 |
-
|
|
cvsdist |
f4325a0 |
+#endif
|
|
cvsdist |
f4325a0 |
|
|
cvsdist |
f4325a0 |
/*
|
|
cvsdist |
f4325a0 |
* miscellaneous functions doing a variety of little jobs follow ...
|