Package init
This commit is contained in:
commit
211b6c9c33
13
netkit-telnet-0.17-core-dump.patch
Normal file
13
netkit-telnet-0.17-core-dump.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/telnet/main.c.old b/telnet/main.c
|
||||
index 599f0af..cf67ea6 100644
|
||||
--- a/telnet/main.c.old
|
||||
+++ b/telnet/main.c
|
||||
@@ -337,7 +337,7 @@ main(int argc, char *argv[])
|
||||
argv += optind;
|
||||
|
||||
if (argc) {
|
||||
- char *args[7], **argp = args;
|
||||
+ char *args[8], **argp = args;
|
||||
|
||||
if (argc > 2)
|
||||
usage();
|
||||
121
netkit-telnet-0.17-gcc7.patch
Normal file
121
netkit-telnet-0.17-gcc7.patch
Normal file
@ -0,0 +1,121 @@
|
||||
diff --git a/telnet/utilities.c b/telnet/utilities.c
|
||||
index 0bb0eab..d89ca37 100644
|
||||
--- a/telnet/utilities.c
|
||||
+++ b/telnet/utilities.c
|
||||
@@ -748,6 +748,7 @@ printsub(char direction, unsigned char *pointer, int length)
|
||||
env_common:
|
||||
{
|
||||
register int noquote = 2;
|
||||
+ char* msg;
|
||||
#if defined(ENV_HACK) && defined(OLD_ENVIRON)
|
||||
extern int old_env_var, old_env_value;
|
||||
#endif
|
||||
@@ -758,14 +759,24 @@ printsub(char direction, unsigned char *pointer, int length)
|
||||
/* case NEW_ENV_OVAR: */
|
||||
if (pointer[0] == TELOPT_OLD_ENVIRON) {
|
||||
# ifdef ENV_HACK
|
||||
- if (old_env_var == OLD_ENV_VALUE)
|
||||
- fprintf(NetTrace, "\" (VALUE) " + noquote);
|
||||
- else
|
||||
+ if (old_env_var == OLD_ENV_VALUE) {
|
||||
+ msg = "\" (VALUE) ";
|
||||
+ fprintf(NetTrace, "%s", msg + noquote);
|
||||
+ }
|
||||
+ else {
|
||||
# endif
|
||||
- fprintf(NetTrace, "\" VAR " + noquote);
|
||||
+ msg = "\" VAR ";
|
||||
+ fprintf(NetTrace, "%s", msg + noquote);
|
||||
+# ifdef ENV_HACK
|
||||
+ }
|
||||
+#endif /*ENV_HACK*/
|
||||
} else
|
||||
#endif /* OLD_ENVIRON */
|
||||
- fprintf(NetTrace, "\" VALUE " + noquote);
|
||||
+ msg = "\" VALUE ";
|
||||
+ fprintf(NetTrace, "%s", msg + noquote);
|
||||
+#ifdef OLD_ENVIRON
|
||||
+ }
|
||||
+#endif /* OLD_ENVIRON */
|
||||
noquote = 2;
|
||||
break;
|
||||
|
||||
@@ -774,24 +785,36 @@ printsub(char direction, unsigned char *pointer, int length)
|
||||
/* case OLD_ENV_VALUE: */
|
||||
if (pointer[0] == TELOPT_OLD_ENVIRON) {
|
||||
# ifdef ENV_HACK
|
||||
- if (old_env_value == OLD_ENV_VAR)
|
||||
- fprintf(NetTrace, "\" (VAR) " + noquote);
|
||||
- else
|
||||
+ if (old_env_value == OLD_ENV_VAR) {
|
||||
+ msg = "\" (VAR) ";
|
||||
+ fprintf(NetTrace, "%s", msg + noquote);
|
||||
+ }
|
||||
+ else {
|
||||
# endif
|
||||
- fprintf(NetTrace, "\" VALUE " + noquote);
|
||||
- } else
|
||||
+ msg = "\" VALUE ";
|
||||
+ fprintf(NetTrace, "%s", msg + noquote);
|
||||
+# ifdef ENV_HACK
|
||||
+ }
|
||||
+# endif
|
||||
+ } else {
|
||||
#endif /* OLD_ENVIRON */
|
||||
- fprintf(NetTrace, "\" VAR " + noquote);
|
||||
+ msg = "\" VAR ";
|
||||
+ fprintf(NetTrace, "%s", msg + noquote);
|
||||
+#ifdef OLD_ENVIRON
|
||||
+ }
|
||||
+#endif
|
||||
noquote = 2;
|
||||
break;
|
||||
|
||||
case ENV_ESC:
|
||||
- fprintf(NetTrace, "\" ESC " + noquote);
|
||||
+ msg = "\" ESC ";
|
||||
+ fprintf(NetTrace, "%s", msg + noquote);
|
||||
noquote = 2;
|
||||
break;
|
||||
|
||||
case ENV_USERVAR:
|
||||
- fprintf(NetTrace, "\" USERVAR " + noquote);
|
||||
+ msg = "\" USERVAR ";
|
||||
+ fprintf(NetTrace, "%s", msg + noquote);
|
||||
noquote = 2;
|
||||
break;
|
||||
|
||||
diff --git a/telnetd/utility.c b/telnetd/utility.c
|
||||
index 4a438be..82edee5 100644
|
||||
--- a/telnetd/utility.c
|
||||
+++ b/telnetd/utility.c
|
||||
@@ -969,22 +969,26 @@ printsub(char direction, unsigned char *pointer, int length)
|
||||
env_common:
|
||||
{
|
||||
register int noquote = 2;
|
||||
+ char* msg;
|
||||
for (i = 2; i < length; i++ ) {
|
||||
switch (pointer[i]) {
|
||||
case ENV_VAR:
|
||||
if (pointer[1] == TELQUAL_SEND)
|
||||
goto def_case;
|
||||
- netoprintf("\" VAR " + noquote);
|
||||
+ msg = "\" VAR ";
|
||||
+ netoprintf("%s", msg + noquote);
|
||||
noquote = 2;
|
||||
break;
|
||||
|
||||
case ENV_VALUE:
|
||||
- netoprintf("\" VALUE " + noquote);
|
||||
+ msg = "\" VALUE ";
|
||||
+ netoprintf("%s", msg + noquote);
|
||||
noquote = 2;
|
||||
break;
|
||||
|
||||
case ENV_ESC:
|
||||
- netoprintf("\" ESC " + noquote);
|
||||
+ msg = "\" ESC ";
|
||||
+ netoprintf("%s", msg + noquote);
|
||||
noquote = 2;
|
||||
break;
|
||||
|
||||
265
netkit-telnet-0.17-ipv6.diff
Normal file
265
netkit-telnet-0.17-ipv6.diff
Normal file
@ -0,0 +1,265 @@
|
||||
diff -uNr netkit-telnet-0.17/telnetd/telnetd.c netkit-telnet-0.17.ipv6/telnetd/telnetd.c
|
||||
--- netkit-telnet-0.17/telnetd/telnetd.c 2006-07-13 08:37:18.000000000 +0200
|
||||
+++ netkit-telnet-0.17.ipv6/telnetd/telnetd.c 2006-07-14 08:36:11.000000000 +0200
|
||||
@@ -49,6 +49,7 @@
|
||||
/* #include <netinet/ip.h> */ /* Don't think this is used at all here */
|
||||
#include <arpa/inet.h>
|
||||
#include <assert.h>
|
||||
+#include <sys/poll.h>
|
||||
#include "telnetd.h"
|
||||
#include "pathnames.h"
|
||||
#include "setproctitle.h"
|
||||
@@ -68,7 +69,7 @@
|
||||
#define HAS_IPPROTO_IP
|
||||
#endif
|
||||
|
||||
-static void doit(struct sockaddr_in *who);
|
||||
+static void doit(struct sockaddr *who, socklen_t wholen);
|
||||
static int terminaltypeok(const char *s);
|
||||
|
||||
/*
|
||||
@@ -90,7 +91,7 @@
|
||||
int
|
||||
main(int argc, char *argv[], char *env[])
|
||||
{
|
||||
- struct sockaddr_in from;
|
||||
+ struct sockaddr from;
|
||||
int on = 1;
|
||||
socklen_t fromlen;
|
||||
register int ch;
|
||||
@@ -248,64 +249,89 @@
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
- if (debug) {
|
||||
- int s, ns;
|
||||
- socklen_t foo;
|
||||
- struct servent *sp;
|
||||
- struct sockaddr_in sn;
|
||||
+ int s = 0;
|
||||
|
||||
- memset(&sn, 0, sizeof(sn));
|
||||
- sn.sin_family = AF_INET;
|
||||
+ if (debug) {
|
||||
+ struct addrinfo *ai;
|
||||
+ unsigned int nfds = 0;
|
||||
+ struct pollfd fds[2];
|
||||
|
||||
if (argc > 1) {
|
||||
- usage();
|
||||
- /* NOTREACHED */
|
||||
- } else if (argc == 1) {
|
||||
- if ((sp = getservbyname(*argv, "tcp"))!=NULL) {
|
||||
- sn.sin_port = sp->s_port;
|
||||
- }
|
||||
- else {
|
||||
- int pt = atoi(*argv);
|
||||
- if (pt <= 0) {
|
||||
- fprintf(stderr, "telnetd: %s: bad port number\n",
|
||||
- *argv);
|
||||
- usage();
|
||||
- /* NOTREACHED */
|
||||
- }
|
||||
- sn.sin_port = htons(pt);
|
||||
- }
|
||||
+ usage();
|
||||
+ /* NOTREACHED */
|
||||
} else {
|
||||
- sp = getservbyname("telnet", "tcp");
|
||||
- if (sp == 0) {
|
||||
- fprintf(stderr, "telnetd: tcp/telnet: unknown service\n");
|
||||
- exit(1);
|
||||
- }
|
||||
- sn.sin_port = sp->s_port;
|
||||
- }
|
||||
+ struct addrinfo hints;
|
||||
+
|
||||
+ memset (&hints, '\0', sizeof (hints));
|
||||
+ hints.ai_socktype = SOCK_STREAM;
|
||||
+ hints.ai_flags = AI_ADDRCONFIG | AI_PASSIVE;
|
||||
+ hints.ai_protocol = IPPROTO_TCP;
|
||||
+
|
||||
+ if (argc == 0) {
|
||||
+ if (getaddrinfo(NULL, "telnet", &hints, &ai) != 0) {
|
||||
+ fprintf(stderr, "telnetd: %s: bad port number\n", *argv);
|
||||
+ usage();
|
||||
+ /* NOTREACHED */
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (getaddrinfo(NULL, *argv, &hints, &ai) != 0) {
|
||||
+ fprintf(stderr, "telnetd: %s: bad port number\n", *argv);
|
||||
+ usage();
|
||||
+ /* NOTREACHED */
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- s = socket(AF_INET, SOCK_STREAM, 0);
|
||||
- if (s < 0) {
|
||||
+ struct addrinfo *runp;
|
||||
+ int b = 0;
|
||||
+ for (runp = ai; ((runp != NULL) && (nfds < sizeof (fds) / sizeof (fds[0]))); runp = runp->ai_next) {
|
||||
+ fds[nfds].fd = socket(runp->ai_family, runp->ai_socktype, runp->ai_protocol);
|
||||
+ if (fds[nfds].fd < 0) {
|
||||
perror("telnetd: socket");;
|
||||
- exit(1);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ fds[nfds].events = POLLIN;
|
||||
+ (void) setsockopt(fds[nfds].fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
|
||||
+
|
||||
+ if (bind(fds[nfds].fd, runp->ai_addr, runp->ai_addrlen) != 0) {
|
||||
+ // Unable to bind to given port. One of the reason can be
|
||||
+ // that we can't bind to both IPv4 and IPv6
|
||||
+ break;
|
||||
+ } else {
|
||||
+ b++;
|
||||
+ }
|
||||
+
|
||||
+ if (listen(fds[nfds].fd, 1) < 0) {
|
||||
+ perror("listen");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ nfds++;
|
||||
}
|
||||
- (void) setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
|
||||
- if (bind(s, (struct sockaddr *)&sn, sizeof(sn)) < 0) {
|
||||
- perror("bind");
|
||||
- exit(1);
|
||||
- }
|
||||
- if (listen(s, 1) < 0) {
|
||||
- perror("listen");
|
||||
- exit(1);
|
||||
+ freeaddrinfo(ai);
|
||||
+
|
||||
+ if (b == 0) {
|
||||
+ perror("bind");
|
||||
+ exit(1);
|
||||
}
|
||||
- foo = sizeof(sn);
|
||||
- ns = accept(s, (struct sockaddr *)&sn, &foo);
|
||||
- if (ns < 0) {
|
||||
- perror("accept");
|
||||
- exit(1);
|
||||
+
|
||||
+ int n = poll (fds, nfds, -1);
|
||||
+ if (n > 0) {
|
||||
+ unsigned int i;
|
||||
+ for (i = 0; i < nfds; i++) {
|
||||
+ if (fds[i].revents & POLLIN) {
|
||||
+ struct sockaddr_storage rem;
|
||||
+ socklen_t remlen = sizeof(rem);
|
||||
+ int fd = accept(fds[i].fd, (struct sockaddr *) &rem, &remlen);
|
||||
+
|
||||
+ if (fd < 0) {
|
||||
+ perror("accept");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
+ s = fd;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
- (void) dup2(ns, 0);
|
||||
- (void) close(ns);
|
||||
- (void) close(s);
|
||||
} else if (argc > 0) {
|
||||
usage();
|
||||
/* NOT REACHED */
|
||||
@@ -313,13 +339,13 @@
|
||||
|
||||
openlog("telnetd", LOG_PID | LOG_ODELAY, LOG_DAEMON);
|
||||
fromlen = sizeof (from);
|
||||
- if (getpeername(0, (struct sockaddr *)&from, &fromlen) < 0) {
|
||||
+ if (getpeername(s, &from, &fromlen) < 0) {
|
||||
fprintf(stderr, "%s: ", progname);
|
||||
perror("getpeername");
|
||||
_exit(1);
|
||||
}
|
||||
if (keepalive &&
|
||||
- setsockopt(0, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof (on)) < 0) {
|
||||
+ setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof (on)) < 0) {
|
||||
syslog(LOG_WARNING, "setsockopt (SO_KEEPALIVE): %m");
|
||||
}
|
||||
|
||||
@@ -333,13 +359,13 @@
|
||||
if (tos < 0)
|
||||
tos = 020; /* Low Delay bit */
|
||||
if (tos
|
||||
- && (setsockopt(0, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0)
|
||||
+ && (setsockopt(s, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0)
|
||||
&& (errno != ENOPROTOOPT) )
|
||||
syslog(LOG_WARNING, "setsockopt (IP_TOS): %m");
|
||||
}
|
||||
#endif /* defined(HAS_IPPROTO_IP) && defined(IP_TOS) */
|
||||
- net = 0;
|
||||
- doit(&from);
|
||||
+ net = s;
|
||||
+ doit(&from, fromlen);
|
||||
/* NOTREACHED */
|
||||
return 0;
|
||||
} /* end of main */
|
||||
@@ -608,10 +634,9 @@
|
||||
* Get a pty, scan input lines.
|
||||
*/
|
||||
static void
|
||||
-doit(struct sockaddr_in *who)
|
||||
+doit(struct sockaddr *who, socklen_t wholen)
|
||||
{
|
||||
const char *host;
|
||||
- struct hostent *hp;
|
||||
int level;
|
||||
char user_name[256];
|
||||
|
||||
@@ -623,12 +648,18 @@
|
||||
fatal(net, "All network ports in use");
|
||||
|
||||
/* get name of connected client */
|
||||
- hp = gethostbyaddr((char *)&who->sin_addr, sizeof (struct in_addr),
|
||||
- who->sin_family);
|
||||
- if (hp)
|
||||
- host = hp->h_name;
|
||||
- else
|
||||
- host = inet_ntoa(who->sin_addr);
|
||||
+ int error = -1;
|
||||
+ char namebuf[255];
|
||||
+
|
||||
+ error = getnameinfo(who, wholen, namebuf, sizeof(namebuf), NULL, 0, 0);
|
||||
+
|
||||
+ if (error) {
|
||||
+ perror("getnameinfo: localhost");
|
||||
+ perror(gai_strerror(error));
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
+ host = namebuf;
|
||||
|
||||
/*
|
||||
* We must make a copy because Kerberos is probably going
|
||||
@@ -649,13 +680,21 @@
|
||||
|
||||
/* Get local host name */
|
||||
{
|
||||
- struct hostent *h;
|
||||
+ struct addrinfo hints;
|
||||
+ struct addrinfo *res;
|
||||
+ int e;
|
||||
+
|
||||
+ memset(&hints, '\0', sizeof(hints));
|
||||
+ hints.ai_socktype = SOCK_STREAM;
|
||||
+ hints.ai_flags = AI_ADDRCONFIG;
|
||||
+
|
||||
gethostname(host_name, sizeof(host_name));
|
||||
- h = gethostbyname(host_name);
|
||||
- if (h) {
|
||||
- strncpy(host_name, h->h_name, sizeof(host_name));
|
||||
- host_name[sizeof(host_name)-1] = 0;
|
||||
+ if ((e = getaddrinfo(host_name, NULL, &hints, &res)) != 0) {
|
||||
+ perror("getaddrinfo: localhost");
|
||||
+ perror(gai_strerror(e));
|
||||
+ exit(1);
|
||||
}
|
||||
+ freeaddrinfo(res);
|
||||
}
|
||||
|
||||
#if defined(AUTHENTICATE) || defined(ENCRYPT)
|
||||
15
netkit-telnet-0.17-manpage.patch
Normal file
15
netkit-telnet-0.17-manpage.patch
Normal file
@ -0,0 +1,15 @@
|
||||
diff --git a/telnet/telnet.1 b/telnet/telnet.1
|
||||
index f30e034..e3a873e 100644
|
||||
--- a/telnet/telnet.1
|
||||
+++ b/telnet/telnet.1
|
||||
@@ -74,6 +74,10 @@ If it is invoked with arguments, it performs an
|
||||
.Ic open
|
||||
command with those arguments.
|
||||
.Pp
|
||||
+If a hostname is resolved to multiple IP addresses,
|
||||
+.Nm
|
||||
+attempts to establish a connection with each address until one of them is successful or until no more addresses are left.
|
||||
+.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl 4
|
||||
43
netkit-telnet-0.17-nodns.patch
Normal file
43
netkit-telnet-0.17-nodns.patch
Normal file
@ -0,0 +1,43 @@
|
||||
--- netkit-telnet-0.17.orig/telnetd/telnetd.c 2007-03-13 16:31:20.000000000 +0000
|
||||
+++ netkit-telnet-0.17.orig/telnetd/telnetd.c 2007-03-13 16:31:26.000000000 +0000
|
||||
@@ -653,6 +653,11 @@ doit(struct sockaddr *who, socklen_t who
|
||||
|
||||
error = getnameinfo(who, wholen, namebuf, sizeof(namebuf), NULL, 0, 0);
|
||||
|
||||
+ /* if we can't get a hostname now, settle for an address */
|
||||
+ if(error == EAI_AGAIN)
|
||||
+ error = getnameinfo(who, wholen, namebuf, sizeof(namebuf),
|
||||
+ NULL, 0, NI_NUMERICHOST);
|
||||
+
|
||||
if (error) {
|
||||
perror("getnameinfo: localhost");
|
||||
perror(gai_strerror(error));
|
||||
@@ -681,7 +686,7 @@ doit(struct sockaddr *who, socklen_t who
|
||||
/* Get local host name */
|
||||
{
|
||||
struct addrinfo hints;
|
||||
- struct addrinfo *res;
|
||||
+ struct addrinfo *res = 0;
|
||||
int e;
|
||||
|
||||
memset(&hints, '\0', sizeof(hints));
|
||||
@@ -690,11 +695,14 @@ doit(struct sockaddr *who, socklen_t who
|
||||
|
||||
gethostname(host_name, sizeof(host_name));
|
||||
if ((e = getaddrinfo(host_name, NULL, &hints, &res)) != 0) {
|
||||
- perror("getaddrinfo: localhost");
|
||||
- perror(gai_strerror(e));
|
||||
- exit(1);
|
||||
+ if(e != EAI_AGAIN) {
|
||||
+ fprintf(stderr, "getaddrinfo: localhost %s\n",
|
||||
+ gai_strerror(e));
|
||||
+ exit(1);
|
||||
+ }
|
||||
}
|
||||
- freeaddrinfo(res);
|
||||
+ if(res)
|
||||
+ freeaddrinfo(res);
|
||||
}
|
||||
|
||||
#if defined(AUTHENTICATE) || defined(ENCRYPT)
|
||||
|
||||
88
netkit-telnet-0.17-reallynodns.patch
Normal file
88
netkit-telnet-0.17-reallynodns.patch
Normal file
@ -0,0 +1,88 @@
|
||||
--- netkit-telnet-0.17.orig/telnetd/telnetd.c.reallynodns 2009-03-12 14:32:29.000000000 -0700
|
||||
+++ netkit-telnet-0.17.orig/telnetd/telnetd.c 2009-03-12 14:51:59.000000000 -0700
|
||||
@@ -85,6 +85,7 @@
|
||||
int keepalive = 1;
|
||||
char *loginprg = _PATH_LOGIN;
|
||||
char *progname;
|
||||
+int lookupself = 1;
|
||||
|
||||
extern void usage(void);
|
||||
|
||||
@@ -111,7 +112,7 @@
|
||||
|
||||
progname = *argv;
|
||||
|
||||
- while ((ch = getopt(argc, argv, "d:a:e:lhnr:I:D:B:sS:a:X:L:")) != EOF) {
|
||||
+ while ((ch = getopt(argc, argv, "d:a:e:lhnr:I:D:B:sS:a:X:L:N")) != EOF) {
|
||||
switch(ch) {
|
||||
|
||||
#ifdef AUTHENTICATE
|
||||
@@ -210,6 +211,10 @@
|
||||
keepalive = 0;
|
||||
break;
|
||||
|
||||
+ case 'N':
|
||||
+ lookupself = 0;
|
||||
+ break;
|
||||
+
|
||||
#ifdef SecurID
|
||||
case 's':
|
||||
/* SecurID required */
|
||||
@@ -393,6 +398,7 @@
|
||||
#endif
|
||||
fprintf(stderr, " [-L login_program]");
|
||||
fprintf(stderr, " [-n]");
|
||||
+ fprintf(stderr, " [-N]");
|
||||
#ifdef SecurID
|
||||
fprintf(stderr, " [-s]");
|
||||
#endif
|
||||
@@ -691,15 +697,20 @@
|
||||
|
||||
memset(&hints, '\0', sizeof(hints));
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
- hints.ai_flags = AI_ADDRCONFIG;
|
||||
+ hints.ai_flags = AI_CANONNAME;
|
||||
|
||||
gethostname(host_name, sizeof(host_name));
|
||||
- if ((e = getaddrinfo(host_name, NULL, &hints, &res)) != 0) {
|
||||
- if(e != EAI_AGAIN) {
|
||||
- fprintf(stderr, "getaddrinfo: localhost %s\n",
|
||||
- gai_strerror(e));
|
||||
- exit(1);
|
||||
- }
|
||||
+ /*
|
||||
+ * Optionally canonicalize the local host name, in case
|
||||
+ * gethostname() returns foo, we want foo.example.com
|
||||
+ */
|
||||
+ if (lookupself &&
|
||||
+ (e = getaddrinfo(host_name, NULL, &hints, &res)) == 0) {
|
||||
+ if (res->ai_canonname) {
|
||||
+ strncpy(host_name, res->ai_canonname,
|
||||
+ sizeof(host_name)-1);
|
||||
+ host_name[sizeof(host_name)-1] = 0;
|
||||
+ }
|
||||
}
|
||||
if(res)
|
||||
freeaddrinfo(res);
|
||||
--- netkit-telnet-0.17.orig/telnetd/telnetd.8.reallynodns 2009-03-12 14:54:54.000000000 -0700
|
||||
+++ netkit-telnet-0.17.orig/telnetd/telnetd.8 2009-03-12 14:56:58.000000000 -0700
|
||||
@@ -42,7 +42,7 @@
|
||||
protocol server
|
||||
.Sh SYNOPSIS
|
||||
.Nm /usr/sbin/in.telnetd
|
||||
-.Op Fl hns
|
||||
+.Op Fl hnNs
|
||||
.Op Fl a Ar authmode
|
||||
.Op Fl D Ar debugmode
|
||||
.Op Fl L Ar loginprg
|
||||
@@ -175,6 +175,10 @@
|
||||
if the client is still there, so that idle connections
|
||||
from machines that have crashed or can no longer
|
||||
be reached may be cleaned up.
|
||||
+.It Fl N
|
||||
+Do not use DNS to canonicalize the local hostname;
|
||||
+.Fn gethostname 2
|
||||
+returns a fully qualified name.
|
||||
.It Fl s
|
||||
This option is only enabled if
|
||||
.Nm telnetd
|
||||
19
netkit-telnet-0.17-telnetrc.patch
Normal file
19
netkit-telnet-0.17-telnetrc.patch
Normal file
@ -0,0 +1,19 @@
|
||||
diff --git a/telnet/commands.c b/telnet/commands.c
|
||||
index 636fb5c..c0cc9b9 100644
|
||||
--- a/telnet/commands.c
|
||||
+++ b/telnet/commands.c
|
||||
@@ -2217,11 +2217,11 @@ cmdrc(char *m1, char *m2)
|
||||
if (isspace(line[0]))
|
||||
continue;
|
||||
if (strncasecmp(line, m1, l1) == 0)
|
||||
- strncpy(line, &line[l1], sizeof(line) - l1);
|
||||
+ memmove(line, &line[l1], sizeof(line) - l1);
|
||||
else if (strncasecmp(line, m2, l2) == 0)
|
||||
- strncpy(line, &line[l2], sizeof(line) - l2);
|
||||
+ memmove(line, &line[l2], sizeof(line) - l2);
|
||||
else if (strncasecmp(line, "DEFAULT", 7) == 0)
|
||||
- strncpy(line, &line[7], sizeof(line) - 7);
|
||||
+ memmove(line, &line[7], sizeof(line) - 7);
|
||||
else
|
||||
continue;
|
||||
if (line[0] != ' ' && line[0] != '\t' && line[0] != '\n')
|
||||
BIN
netkit-telnet-0.17.tar.gz
Normal file
BIN
netkit-telnet-0.17.tar.gz
Normal file
Binary file not shown.
33
telnet-0.17-8bit.patch
Normal file
33
telnet-0.17-8bit.patch
Normal file
@ -0,0 +1,33 @@
|
||||
diff -ru netkit-telnet-0.17.orig/telnet/main.c netkit-telnet-0.17/telnet/main.c
|
||||
--- netkit-telnet-0.17.orig/telnet/main.c 2003-05-15 20:07:40.000000000 +0200
|
||||
+++ netkit-telnet-0.17/telnet/main.c 2003-05-16 00:18:28.000000000 +0200
|
||||
@@ -143,7 +143,7 @@
|
||||
while ((ch = getopt(argc, argv, "78DEKLS:X:ab:cde:fFk:l:n:rt:x")) != -1) {
|
||||
switch(ch) {
|
||||
case '8':
|
||||
- eight = 3; /* binary output and input */
|
||||
+ binary = 3; /* send TELNET BINARY option for output and input */
|
||||
break;
|
||||
case '7':
|
||||
eight = 0;
|
||||
@@ -165,7 +165,7 @@
|
||||
#endif
|
||||
break;
|
||||
case 'L':
|
||||
- eight |= 2; /* binary output only */
|
||||
+ binary = 2; /* send TELNET BINARY option for output only */
|
||||
break;
|
||||
case 'S':
|
||||
{
|
||||
diff -ru netkit-telnet-0.17.orig/telnet/telnet.1 netkit-telnet-0.17/telnet/telnet.1
|
||||
--- netkit-telnet-0.17.orig/telnet/telnet.1 2003-05-15 20:07:40.000000000 +0200
|
||||
+++ netkit-telnet-0.17/telnet/telnet.1 2003-05-15 23:38:37.000000000 +0200
|
||||
@@ -76,6 +76,8 @@
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width Ds
|
||||
+.It Fl 7
|
||||
+Strip 8th bit on input and output. Telnet is 8-bit clean by default but doesn't send the TELNET BINARY option unless forced.
|
||||
.It Fl 8
|
||||
Specifies an 8-bit data path.
|
||||
This causes an attempt to negotiate the
|
||||
179
telnet-0.17-CAN-2005-468_469.patch
Normal file
179
telnet-0.17-CAN-2005-468_469.patch
Normal file
@ -0,0 +1,179 @@
|
||||
--- netkit-telnet-0.17/telnet/telnet.c.CAN-2005-468_469 2005-03-17 13:48:58.000000000 +0100
|
||||
+++ netkit-telnet-0.17/telnet/telnet.c 2005-03-17 14:02:27.000000000 +0100
|
||||
@@ -1310,22 +1310,66 @@
|
||||
}
|
||||
|
||||
|
||||
-unsigned char slc_reply[128];
|
||||
+#define SLC_REPLY_SIZE 128
|
||||
+unsigned char *slc_reply;
|
||||
unsigned char *slc_replyp;
|
||||
+unsigned char *slc_replyend;
|
||||
|
||||
void
|
||||
slc_start_reply(void)
|
||||
{
|
||||
+ slc_reply = (unsigned char *)malloc(SLC_REPLY_SIZE);
|
||||
+ if (slc_reply == NULL) {
|
||||
+/*@*/ printf("slc_start_reply: malloc()/realloc() failed!!!\n");
|
||||
+ slc_reply = slc_replyp = slc_replyend = NULL;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
slc_replyp = slc_reply;
|
||||
+ slc_replyend = slc_reply + SLC_REPLY_SIZE;
|
||||
*slc_replyp++ = IAC;
|
||||
*slc_replyp++ = SB;
|
||||
*slc_replyp++ = TELOPT_LINEMODE;
|
||||
*slc_replyp++ = LM_SLC;
|
||||
}
|
||||
|
||||
+static int
|
||||
+slc_assure_buffer(int want_len);
|
||||
+
|
||||
+ static int
|
||||
+slc_assure_buffer(int want_len)
|
||||
+{
|
||||
+ if ((slc_replyp + want_len) >= slc_replyend) {
|
||||
+ int len;
|
||||
+ int old_len = slc_replyp - slc_reply;
|
||||
+ unsigned char *p;
|
||||
+
|
||||
+ len = old_len
|
||||
+ + (want_len / SLC_REPLY_SIZE + 1) * SLC_REPLY_SIZE;
|
||||
+ p = (unsigned char *)realloc(slc_reply, len);
|
||||
+ if (p == NULL)
|
||||
+ free(slc_reply);
|
||||
+ slc_reply = p;
|
||||
+ if (slc_reply == NULL) {
|
||||
+/*@*/ printf("slc_add_reply: realloc() failed!!!\n");
|
||||
+ slc_reply = slc_replyp = slc_replyend = NULL;
|
||||
+ return 1;
|
||||
+ }
|
||||
+ slc_replyp = slc_reply + old_len;
|
||||
+ slc_replyend = slc_reply + len;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
void
|
||||
slc_add_reply(unsigned char func, unsigned char flags, cc_t value)
|
||||
{
|
||||
+ if (slc_assure_buffer(6))
|
||||
+ return;
|
||||
+
|
||||
+ if (slc_replyp == NULL)
|
||||
+ return;
|
||||
+
|
||||
if ((*slc_replyp++ = func) == IAC)
|
||||
*slc_replyp++ = IAC;
|
||||
if ((*slc_replyp++ = flags) == IAC)
|
||||
@@ -1339,6 +1383,12 @@
|
||||
{
|
||||
int len;
|
||||
|
||||
+ if (slc_assure_buffer(2))
|
||||
+ return;
|
||||
+
|
||||
+ if (slc_replyp == NULL)
|
||||
+ return;
|
||||
+
|
||||
*slc_replyp++ = IAC;
|
||||
*slc_replyp++ = SE;
|
||||
len = slc_replyp - slc_reply;
|
||||
@@ -1456,7 +1506,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
-#define OPT_REPLY_SIZE 256
|
||||
+#define OPT_REPLY_SIZE 1024
|
||||
unsigned char *opt_reply;
|
||||
unsigned char *opt_replyp;
|
||||
unsigned char *opt_replyend;
|
||||
@@ -1490,10 +1540,38 @@
|
||||
env_opt_start_info(void)
|
||||
{
|
||||
env_opt_start();
|
||||
- if (opt_replyp)
|
||||
+ if (opt_replyp && (opt_replyp > opt_reply))
|
||||
opt_replyp[-1] = TELQUAL_INFO;
|
||||
}
|
||||
|
||||
+static int
|
||||
+env_opt_assure_buffer(int want_len);
|
||||
+
|
||||
+ static int
|
||||
+env_opt_assure_buffer(int want_len)
|
||||
+{
|
||||
+ if ((opt_replyp + want_len) >= opt_replyend) {
|
||||
+ int len;
|
||||
+ unsigned char *p;
|
||||
+ int old_len = opt_replyp - opt_reply;
|
||||
+
|
||||
+ len = old_len
|
||||
+ + (want_len / OPT_REPLY_SIZE + 1) * OPT_REPLY_SIZE;
|
||||
+ p = (unsigned char *)realloc(opt_reply, len);
|
||||
+ if (p == NULL)
|
||||
+ free(opt_reply);
|
||||
+ opt_reply = p;
|
||||
+ if (opt_reply == NULL) {
|
||||
+/*@*/ printf("env_opt_add: realloc() failed!!!\n");
|
||||
+ opt_reply = opt_replyp = opt_replyend = NULL;
|
||||
+ return 1;
|
||||
+ }
|
||||
+ opt_replyp = opt_reply + old_len;
|
||||
+ opt_replyend = opt_reply + len;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
void
|
||||
env_opt_add(unsigned char *ep)
|
||||
{
|
||||
@@ -1515,25 +1593,12 @@
|
||||
return;
|
||||
}
|
||||
vp = env_getvalue(ep, 1);
|
||||
- if (opt_replyp + (vp ? strlen((char *)vp) : 0) +
|
||||
- strlen((char *)ep) + 6 > opt_replyend)
|
||||
- {
|
||||
- int len;
|
||||
- unsigned char *p;
|
||||
- opt_replyend += OPT_REPLY_SIZE;
|
||||
- len = opt_replyend - opt_reply;
|
||||
- p = (unsigned char *)realloc(opt_reply, len);
|
||||
- if (p == NULL)
|
||||
- free(opt_reply);
|
||||
- opt_reply = p;
|
||||
- if (opt_reply == NULL) {
|
||||
-/*@*/ printf("env_opt_add: realloc() failed!!!\n");
|
||||
- opt_reply = opt_replyp = opt_replyend = NULL;
|
||||
- return;
|
||||
- }
|
||||
- opt_replyp = opt_reply + len - (opt_replyend - opt_replyp);
|
||||
- opt_replyend = opt_reply + len;
|
||||
- }
|
||||
+
|
||||
+ /* use the double length in case it gots escaped */
|
||||
+ if (env_opt_assure_buffer((vp ? strlen((char *)vp)*2 : 0) +
|
||||
+ strlen((char *)ep)*2 + 6))
|
||||
+ return;
|
||||
+
|
||||
if (opt_welldefined((char *)ep))
|
||||
#ifdef OLD_ENVIRON
|
||||
if (telopt_environ == TELOPT_OLD_ENVIRON)
|
||||
@@ -1588,8 +1653,14 @@
|
||||
{
|
||||
int len;
|
||||
|
||||
+ if (opt_reply == NULL) /*XXX*/
|
||||
+ return; /*XXX*/
|
||||
+
|
||||
+
|
||||
len = opt_replyp - opt_reply + 2;
|
||||
if (emptyok || len > 6) {
|
||||
+ if (env_opt_assure_buffer(2))
|
||||
+ return;
|
||||
*opt_replyp++ = IAC;
|
||||
*opt_replyp++ = SE;
|
||||
if (NETROOM() > len) {
|
||||
12
telnet-0.17-argv.patch
Normal file
12
telnet-0.17-argv.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -ur netkit-telnet-0.17/telnetd/setproctitle.c netkit-telnet-0.17.new/telnetd/setproctitle.c
|
||||
--- netkit-telnet-0.17/telnetd/setproctitle.c 1999-12-11 00:06:39.000000000 +0100
|
||||
+++ netkit-telnet-0.17.new/telnetd/setproctitle.c 2004-06-28 16:48:51.153514392 +0200
|
||||
@@ -139,7 +139,7 @@
|
||||
(void) strcpy(Argv[0], buf);
|
||||
p = &Argv[0][i];
|
||||
while (p < LastArgv)
|
||||
- *p++ = ' ';
|
||||
+ *p++ = '\0';
|
||||
Argv[1] = NULL;
|
||||
}
|
||||
|
||||
11
telnet-0.17-cleanup_race.patch
Normal file
11
telnet-0.17-cleanup_race.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- netkit-telnet-0.17/telnetd/telnetd.c.cleanup_race 2005-01-11 18:39:49.578123000 -0500
|
||||
+++ netkit-telnet-0.17/telnetd/telnetd.c 2005-01-11 18:42:45.909616000 -0500
|
||||
@@ -1081,6 +1081,8 @@
|
||||
if (FD_ISSET(p, &obits) && (pfrontp - pbackp) > 0)
|
||||
ptyflush();
|
||||
}
|
||||
+ /* to avoid a race for wtmp lock */
|
||||
+ signal(SIGCHLD, SIG_IGN);
|
||||
cleanup(0);
|
||||
} /* end of telnet */
|
||||
|
||||
23
telnet-0.17-conf.patch
Normal file
23
telnet-0.17-conf.patch
Normal file
@ -0,0 +1,23 @@
|
||||
--- netkit-telnet-0.17/configure.confverb 2000-07-29 20:00:29.000000000 +0200
|
||||
+++ netkit-telnet-0.17/configure 2004-07-05 10:50:36.492963840 +0200
|
||||
@@ -263,14 +263,19 @@
|
||||
cat <<EOF >__conftest.cc
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
-int count=0;
|
||||
+volatile int count=0;
|
||||
void handle(int foo) { count++; }
|
||||
int main() {
|
||||
+ sigset_t sset;
|
||||
int pid=getpid();
|
||||
+ sigemptyset(&sset);
|
||||
+ sigaddset(&sset, SIGINT);
|
||||
+ sigprocmask(SIG_UNBLOCK, &sset, NULL);
|
||||
signal(SIGINT, handle);
|
||||
kill(pid,SIGINT);
|
||||
kill(pid,SIGINT);
|
||||
kill(pid,SIGINT);
|
||||
+ sleep(1);
|
||||
if (count!=3) return 1;
|
||||
return 0;
|
||||
}
|
||||
84
telnet-0.17-env.patch
Normal file
84
telnet-0.17-env.patch
Normal file
@ -0,0 +1,84 @@
|
||||
--- netkit-telnet-0.17-pre-20000204/telnet/commands.c.env Thu Apr 8 19:30:20 1999
|
||||
+++ netkit-telnet-0.17-pre-20000204/telnet/commands.c Tue May 16 17:19:47 2000
|
||||
@@ -1815,11 +1815,11 @@
|
||||
}
|
||||
|
||||
unsigned char *
|
||||
-env_getvalue(unsigned char *var)
|
||||
+env_getvalue(unsigned char *var, int exported_only)
|
||||
{
|
||||
- struct env_lst *ep;
|
||||
+ struct env_lst *ep = env_find(var);
|
||||
|
||||
- if ((ep = env_find(var)))
|
||||
+ if (ep && (!exported_only || ep->export))
|
||||
return(ep->value);
|
||||
return(NULL);
|
||||
}
|
||||
--- netkit-telnet-0.17-pre-20000204/telnet/telnet.c.env Tue May 16 17:19:47 2000
|
||||
+++ netkit-telnet-0.17-pre-20000204/telnet/telnet.c Tue May 16 17:19:47 2000
|
||||
@@ -438,7 +438,7 @@
|
||||
#endif
|
||||
|
||||
case TELOPT_XDISPLOC: /* X Display location */
|
||||
- if (env_getvalue((unsigned char *)"DISPLAY"))
|
||||
+ if (env_getvalue((unsigned char *)"DISPLAY", 0))
|
||||
new_state_ok = 1;
|
||||
break;
|
||||
|
||||
@@ -693,7 +693,7 @@
|
||||
resettermname = 0;
|
||||
if (tnamep && tnamep != unknown)
|
||||
free(tnamep);
|
||||
- if ((tname = (char *)env_getvalue((unsigned char *)"TERM")) &&
|
||||
+ if ((tname = (char *)env_getvalue((unsigned char *)"TERM", 0)) &&
|
||||
(setupterm(tname, 1, &errret) == 0)) {
|
||||
tnamep = mklist(ttytype, tname);
|
||||
} else {
|
||||
@@ -870,7 +870,7 @@
|
||||
unsigned char temp[50], *dp;
|
||||
int len;
|
||||
|
||||
- if ((dp = env_getvalue((unsigned char *)"DISPLAY")) == NULL) {
|
||||
+ if ((dp = env_getvalue((unsigned char *)"DISPLAY", 0)) == NULL) {
|
||||
/*
|
||||
* Something happened, we no longer have a DISPLAY
|
||||
* variable. So, turn off the option.
|
||||
@@ -1527,7 +1527,7 @@
|
||||
env_opt_add(ep);
|
||||
return;
|
||||
}
|
||||
- vp = env_getvalue(ep);
|
||||
+ vp = env_getvalue(ep, 1);
|
||||
if (opt_replyp + (vp ? strlen((char *)vp) : 0) +
|
||||
strlen((char *)ep) + 6 > opt_replyend)
|
||||
{
|
||||
@@ -2170,7 +2170,7 @@
|
||||
send_will(TELOPT_LINEMODE, 1);
|
||||
send_will(TELOPT_NEW_ENVIRON, 1);
|
||||
send_do(TELOPT_STATUS, 1);
|
||||
- if (env_getvalue((unsigned char *)"DISPLAY"))
|
||||
+ if (env_getvalue((unsigned char *)"DISPLAY", 0))
|
||||
send_will(TELOPT_XDISPLOC, 1);
|
||||
if (binary)
|
||||
tel_enter_binary(binary);
|
||||
--- netkit-telnet-0.17-pre-20000204/telnet/externs.h.env Mon Feb 8 15:56:11 1999
|
||||
+++ netkit-telnet-0.17-pre-20000204/telnet/externs.h Tue May 16 17:19:47 2000
|
||||
@@ -203,7 +203,7 @@
|
||||
void env_send (unsigned char *);
|
||||
void env_list (void);
|
||||
unsigned char * env_default(int init, int welldefined);
|
||||
-unsigned char * env_getvalue(unsigned char *var);
|
||||
+unsigned char * env_getvalue(unsigned char *var, int exported_only);
|
||||
|
||||
void set_escape_char(char *s);
|
||||
unsigned long sourceroute(char *arg, char **cpp, int *lenp);
|
||||
@@ -335,7 +335,7 @@
|
||||
void env_opt_end (int);
|
||||
|
||||
unsigned char *env_default (int, int);
|
||||
-unsigned char *env_getvalue (unsigned char *);
|
||||
+unsigned char *env_getvalue (unsigned char *, int);
|
||||
|
||||
int get_status (void);
|
||||
int dosynch (void);
|
||||
24
telnet-0.17-errno_test_sys_bsd.patch
Normal file
24
telnet-0.17-errno_test_sys_bsd.patch
Normal file
@ -0,0 +1,24 @@
|
||||
diff -up netkit-telnet-0.17/telnet/sys_bsd.c.errnosysbsd netkit-telnet-0.17/telnet/sys_bsd.c
|
||||
--- netkit-telnet-0.17/telnet/sys_bsd.c.errnosysbsd 2007-09-20 10:57:58.000000000 +0200
|
||||
+++ netkit-telnet-0.17/telnet/sys_bsd.c 2007-09-20 11:10:08.000000000 +0200
|
||||
@@ -375,6 +375,7 @@ TerminalNewMode(int f)
|
||||
int onoff;
|
||||
int old;
|
||||
cc_t esc;
|
||||
+ int err;
|
||||
|
||||
globalmode = f&~MODE_FORCE;
|
||||
if (prevmode == f)
|
||||
@@ -407,6 +408,12 @@ TerminalNewMode(int f)
|
||||
tcsetattr(tin, TCSADRAIN, &tmp_tc);
|
||||
#endif /* USE_TERMIO */
|
||||
old = ttyflush(SYNCHing|flushout);
|
||||
+ if (old < 0) {
|
||||
+ err = errno;
|
||||
+ if (! ((err == EINTR) || (err == EAGAIN) || (err == ENOSPC))) {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
} while (old < 0 || old > 1);
|
||||
}
|
||||
|
||||
132
telnet-0.17-force-ipv6-ipv4.patch
Normal file
132
telnet-0.17-force-ipv6-ipv4.patch
Normal file
@ -0,0 +1,132 @@
|
||||
diff --git a/commands.c b/commands.c
|
||||
index 49619ac..636fb5c 100644
|
||||
--- a/telnet/commands.c
|
||||
+++ b/telnet/commands.c
|
||||
@@ -2267,6 +2267,7 @@ tn(int argc, char *argv[])
|
||||
char *srp = 0;
|
||||
int srlen;
|
||||
#endif
|
||||
+ int family = AF_UNSPEC;
|
||||
char *cmd, *hostp = 0, *portp = 0, *user = 0, *aliasp = 0;
|
||||
int retry;
|
||||
#ifdef NI_WITHSCOPEID
|
||||
@@ -2317,6 +2318,21 @@ tn(int argc, char *argv[])
|
||||
autologin = 1;
|
||||
continue;
|
||||
}
|
||||
+
|
||||
+ if (strcmp(*argv, "-6") == 0) {
|
||||
+ --argc; ++argv;
|
||||
+#ifdef AF_INET6
|
||||
+ family = AF_INET6;
|
||||
+#else
|
||||
+ puts("IPv6 unsupported");
|
||||
+#endif
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (strcmp(*argv, "-4") == 0) {
|
||||
+ --argc; ++argv;
|
||||
+ family = AF_INET;
|
||||
+ continue;
|
||||
+ }
|
||||
if (hostp == 0) {
|
||||
hostp = *argv++;
|
||||
--argc;
|
||||
@@ -2355,7 +2371,7 @@ tn(int argc, char *argv[])
|
||||
{
|
||||
hostname = hostp;
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
- hints.ai_family = PF_UNSPEC;
|
||||
+ hints.ai_family = family;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
if (portp == NULL) {
|
||||
diff --git a/main.c b/main.c
|
||||
index 5fa96e8..599f0af 100644
|
||||
--- a/telnet/main.c
|
||||
+++ b/telnet/main.c
|
||||
@@ -80,10 +80,10 @@ usage(void)
|
||||
fprintf(stderr, "Usage: %s %s%s%s%s\n",
|
||||
prompt,
|
||||
#ifdef AUTHENTICATION
|
||||
- "[-8] [-E] [-K] [-L] [-S tos] [-X atype] [-a] [-c] [-d] [-e char]",
|
||||
+ "[-4] [-6] [-8] [-E] [-K] [-L] [-S tos] [-X atype] [-a] [-c] [-d] [-e char]",
|
||||
"\n\t[-k realm] [-l user] [-f/-F] [-n tracefile] [-b hostalias ] ",
|
||||
#else
|
||||
- "[-8] [-E] [-L] [-S tos] [-a] [-c] [-d] [-e char] [-l user]",
|
||||
+ "[-4] [-6] [-8] [-E] [-L] [-S tos] [-a] [-c] [-d] [-e char] [-l user]",
|
||||
"\n\t[-n tracefile] [-b hostalias ] ",
|
||||
#endif
|
||||
#if defined(TN3270) && defined(unix)
|
||||
@@ -116,6 +116,7 @@ main(int argc, char *argv[])
|
||||
#endif
|
||||
int ch;
|
||||
char *user, *alias;
|
||||
+ int family;
|
||||
#ifdef FORWARD
|
||||
extern int forward_flags;
|
||||
#endif /* FORWARD */
|
||||
@@ -130,7 +131,6 @@ main(int argc, char *argv[])
|
||||
prompt = argv[0];
|
||||
|
||||
user = alias = NULL;
|
||||
-
|
||||
rlogin = (strncmp(prompt, "rlog", 4) == 0) ? '~' : _POSIX_VDISABLE;
|
||||
|
||||
/*
|
||||
@@ -139,9 +139,19 @@ main(int argc, char *argv[])
|
||||
* passed
|
||||
*/
|
||||
autologin = -1;
|
||||
-
|
||||
- while ((ch = getopt(argc, argv, "78DEKLS:X:ab:cde:fFk:l:n:rt:x")) != -1) {
|
||||
+ family = 0;
|
||||
+ while ((ch = getopt(argc, argv, "4678DEKLS:X:ab:cde:fFk:l:n:rt:x")) != -1) {
|
||||
switch(ch) {
|
||||
+ case '4':
|
||||
+ family = AF_INET;
|
||||
+ break;
|
||||
+ case '6':
|
||||
+#ifdef AF_INET6
|
||||
+ family = AF_INET6;
|
||||
+#else
|
||||
+ fputs("IPv6 unsupported\n", stderr);
|
||||
+#endif
|
||||
+ break;
|
||||
case '8':
|
||||
binary = 3; /* send TELNET BINARY option for output and input */
|
||||
break;
|
||||
@@ -340,6 +350,9 @@ main(int argc, char *argv[])
|
||||
*argp++ = "-b";
|
||||
*argp++ = alias;
|
||||
}
|
||||
+ if (family) {
|
||||
+ *argp++ = family == AF_INET ? "-4" : "-6";
|
||||
+ }
|
||||
*argp++ = argv[0]; /* host */
|
||||
if (argc > 1)
|
||||
*argp++ = argv[1]; /* port */
|
||||
diff --git a/telnet.1 b/telnet.1
|
||||
index 50015a6..f30e034 100644
|
||||
--- a/telnet/telnet.1
|
||||
+++ b/telnet/telnet.1
|
||||
@@ -44,7 +44,7 @@
|
||||
protocol
|
||||
.Sh SYNOPSIS
|
||||
.Nm telnet
|
||||
-.Op Fl 8EFKLacdfrx
|
||||
+.Op Fl 468EFKLacdfrx
|
||||
.Op Fl X Ar authtype
|
||||
.Op Fl b Ar hostalias
|
||||
.Op Fl e Ar escapechar
|
||||
@@ -76,6 +76,10 @@ command with those arguments.
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width Ds
|
||||
+.It Fl 4
|
||||
+Force IPv4 address resolution.
|
||||
+.It Fl 6
|
||||
+Force IPv6 address resolution.
|
||||
.It Fl 7
|
||||
Strip 8th bit on input and output. Telnet is 8-bit clean by default but doesn't send the TELNET BINARY option unless forced.
|
||||
.It Fl 8
|
||||
81
telnet-0.17-issue.patch
Normal file
81
telnet-0.17-issue.patch
Normal file
@ -0,0 +1,81 @@
|
||||
--- netkit-telnet-0.17/telnetd/utility.c.issue Sun Dec 12 09:59:45 1999
|
||||
+++ netkit-telnet-0.17/telnetd/utility.c Wed Jul 18 11:14:11 2001
|
||||
@@ -460,13 +460,13 @@
|
||||
putlocation = where;
|
||||
|
||||
while (*cp) {
|
||||
- if (*cp != '%') {
|
||||
+ if (*cp != '%' && *cp != '\\') {
|
||||
putchr(*cp++);
|
||||
continue;
|
||||
}
|
||||
switch (*++cp) {
|
||||
|
||||
- case 't':
|
||||
+ case 'l':
|
||||
slash = strrchr(line, '/');
|
||||
if (slash == NULL)
|
||||
putstr(line);
|
||||
@@ -474,21 +474,28 @@
|
||||
putstr(slash+1);
|
||||
break;
|
||||
|
||||
+ case 'n':
|
||||
case 'h':
|
||||
putstr(editedhost);
|
||||
break;
|
||||
|
||||
+ case 't':
|
||||
case 'd':
|
||||
(void)time(&t);
|
||||
(void)strftime(db, sizeof(db), fmtstr, localtime(&t));
|
||||
putstr(db);
|
||||
break;
|
||||
|
||||
+ case '\\':
|
||||
+ putchr('\\');
|
||||
+ break;
|
||||
+
|
||||
case '%':
|
||||
putchr('%');
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
+ case 'o':
|
||||
{
|
||||
char buff[128];
|
||||
|
||||
@@ -515,7 +522,7 @@
|
||||
c = fgetc(fp);
|
||||
} while (c != EOF && c != '\n');
|
||||
continue;
|
||||
- } else if (c == '%') {
|
||||
+ } else if (c == '%' || c == '\\') {
|
||||
buff[0] = c;
|
||||
c = fgetc(fp);
|
||||
if (c == EOF) break;
|
||||
--- netkit-telnet-0.17/telnetd/issue.net.5.issue Sun Jul 30 19:57:09 2000
|
||||
+++ netkit-telnet-0.17/telnetd/issue.net.5 Wed Jul 18 11:03:09 2001
|
||||
@@ -15,16 +15,17 @@
|
||||
.Pa /etc/issue.net
|
||||
is a text file which contains a message or system identification to be
|
||||
printed before the login prompt of a telnet session. It may contain
|
||||
-various `%-char' sequences. The following sequences are supported by
|
||||
+various `%-char' (or, alternatively, '\\-char') sequences. The following
|
||||
+sequences are supported by
|
||||
.Ic telnetd :
|
||||
.Bl -tag -offset indent -compact -width "abcde"
|
||||
-.It %t
|
||||
+.It %l
|
||||
- show the current tty
|
||||
-.It %h
|
||||
+.It %h, %n
|
||||
- show the system node name (FQDN)
|
||||
-.It %D
|
||||
+.It %D, %o
|
||||
- show the name of the NIS domain
|
||||
-.It %d
|
||||
+.It %d, %t
|
||||
- show the current time and date
|
||||
.It %s
|
||||
- show the name of the operating system
|
||||
37
telnet-0.17-pek.patch
Normal file
37
telnet-0.17-pek.patch
Normal file
@ -0,0 +1,37 @@
|
||||
diff -u a/telnet/commands.c b/telnet.new/commands.c
|
||||
--- a/telnet/commands.c Sat Sep 1 12:55:18 2001
|
||||
+++ b/telnet.new/commands.c Sat Sep 1 12:54:36 2001
|
||||
@@ -2354,6 +2354,7 @@
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
if (portp == NULL) {
|
||||
portp = "telnet";
|
||||
+ telnetport = 1;
|
||||
} else if (*portp == '-') {
|
||||
portp++;
|
||||
telnetport = 1;
|
||||
@@ -2397,7 +2398,6 @@
|
||||
if (error) {
|
||||
warn("%s: %s", aliasp, gai_strerror(error));
|
||||
close(net);
|
||||
- freeaddrinfo(ares);
|
||||
continue;
|
||||
}
|
||||
if (bind(net, ares->ai_addr, ares->ai_addrlen) < 0) {
|
||||
@@ -2414,7 +2414,7 @@
|
||||
perror("setsockopt (IP_OPTIONS)");
|
||||
#endif
|
||||
#if defined(IPPROTO_IP) && defined(IP_TOS)
|
||||
- {
|
||||
+ if (res->ai_family == AF_INET) {
|
||||
# if defined(HAS_GETTOS)
|
||||
struct tosent *tp;
|
||||
if (tos < 0 && (tp = gettosbyname("telnet", "tcp")))
|
||||
@@ -2438,7 +2438,7 @@
|
||||
char hbuf[NI_MAXHOST];
|
||||
|
||||
if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof(hbuf),
|
||||
- NULL, 0, NI_NUMERICHOST) != 0) {
|
||||
+ NULL, 0, niflags) != 0) {
|
||||
strcpy(hbuf, "(invalid)");
|
||||
}
|
||||
fprintf(stderr, "telnet: connect to address %s: %s\n", hbuf,
|
||||
208
telnet-0.17-sa-01-49.patch
Normal file
208
telnet-0.17-sa-01-49.patch
Normal file
@ -0,0 +1,208 @@
|
||||
diff -up netkit-telnet-0.17/telnetd/ext.h.sa-01-49 netkit-telnet-0.17/telnetd/ext.h
|
||||
--- netkit-telnet-0.17/telnetd/ext.h.sa-01-49 1999-12-12 15:59:44.000000000 +0100
|
||||
+++ netkit-telnet-0.17/telnetd/ext.h 2011-01-20 22:39:54.000000000 +0100
|
||||
@@ -86,7 +86,10 @@ extern char *neturg; /* one past last b
|
||||
extern int pcc, ncc;
|
||||
|
||||
/* printf into netobuf */
|
||||
-void netoprintf(const char *fmt, ...) __attribute((format (printf, 1, 2)));
|
||||
+/* void netoprintf(const char *fmt, ...) __attribute((format (printf, 1, 2))); */
|
||||
+#define netoprintf output_data
|
||||
+int output_data(const char *, ...) __attribute((format (printf, 1, 2)));
|
||||
+void output_datalen(const char *, int);
|
||||
|
||||
extern int pty, net;
|
||||
extern char *line;
|
||||
@@ -182,7 +185,10 @@ void tty_setsofttab(int);
|
||||
void tty_tspeed(int);
|
||||
void willoption(int);
|
||||
void wontoption(int);
|
||||
+
|
||||
+#if 0
|
||||
void writenet(unsigned char *, int);
|
||||
+#endif
|
||||
|
||||
#if defined(ENCRYPT)
|
||||
extern void (*encrypt_output)(unsigned char *, int);
|
||||
diff -up netkit-telnet-0.17/telnetd/slc.c.sa-01-49 netkit-telnet-0.17/telnetd/slc.c
|
||||
--- netkit-telnet-0.17/telnetd/slc.c.sa-01-49 1999-12-12 15:59:44.000000000 +0100
|
||||
+++ netkit-telnet-0.17/telnetd/slc.c 2011-01-20 22:39:54.000000000 +0100
|
||||
@@ -183,7 +183,7 @@ int end_slc(unsigned char **bufp) {
|
||||
else {
|
||||
snprintf(slcbuf+slcoff, sizeof(slcbuf)-slcoff, "%c%c", IAC, SE);
|
||||
slcoff += 2;
|
||||
- writenet(slcbuf, slcoff);
|
||||
+ output_datalen(slcbuf, slcoff);
|
||||
netflush(); /* force it out immediately */
|
||||
}
|
||||
}
|
||||
diff -up netkit-telnet-0.17/telnetd/state.c.sa-01-49 netkit-telnet-0.17/telnetd/state.c
|
||||
--- netkit-telnet-0.17/telnetd/state.c.sa-01-49 1999-12-12 20:41:44.000000000 +0100
|
||||
+++ netkit-telnet-0.17/telnetd/state.c 2011-01-20 22:43:34.000000000 +0100
|
||||
@@ -37,6 +37,7 @@
|
||||
char state_rcsid[] =
|
||||
"$Id: state.c,v 1.12 1999/12/12 19:41:44 dholland Exp $";
|
||||
|
||||
+#include <stdarg.h>
|
||||
#include "telnetd.h"
|
||||
|
||||
int not42 = 1;
|
||||
@@ -1365,7 +1366,7 @@ void send_status(void) {
|
||||
ADD(IAC);
|
||||
ADD(SE);
|
||||
|
||||
- writenet(statusbuf, ncp - statusbuf);
|
||||
+ output_datalen(statusbuf, ncp - statusbuf);
|
||||
netflush(); /* Send it on its way */
|
||||
|
||||
DIAG(TD_OPTIONS, {printsub('>', statusbuf, ncp - statusbuf); netflush();});
|
||||
diff -up netkit-telnet-0.17/telnetd/termstat.c.sa-01-49 netkit-telnet-0.17/telnetd/termstat.c
|
||||
--- netkit-telnet-0.17/telnetd/termstat.c.sa-01-49 1999-12-12 15:59:45.000000000 +0100
|
||||
+++ netkit-telnet-0.17/telnetd/termstat.c 2011-01-20 22:39:54.000000000 +0100
|
||||
@@ -128,7 +128,6 @@ static int _terminit = 0;
|
||||
void
|
||||
localstat()
|
||||
{
|
||||
- void netflush();
|
||||
int need_will_echo = 0;
|
||||
|
||||
/*
|
||||
diff -up netkit-telnet-0.17/telnetd/utility.c.sa-01-49 netkit-telnet-0.17/telnetd/utility.c
|
||||
--- netkit-telnet-0.17/telnetd/utility.c.sa-01-49 2011-01-20 22:39:54.000000000 +0100
|
||||
+++ netkit-telnet-0.17/telnetd/utility.c 2011-01-20 22:48:02.000000000 +0100
|
||||
@@ -38,8 +38,10 @@ char util_rcsid[] =
|
||||
"$Id: utility.c,v 1.11 1999/12/12 14:59:45 dholland Exp $";
|
||||
|
||||
#define PRINTOPTIONS
|
||||
+#define _GNU_SOURCE
|
||||
|
||||
#include <stdarg.h>
|
||||
+#include <stdio.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#ifdef AUTHENTICATE
|
||||
@@ -52,6 +54,53 @@ char util_rcsid[] =
|
||||
* utility functions performing io related tasks
|
||||
*/
|
||||
|
||||
+/*
|
||||
+ * This function appends data to nfrontp and advances nfrontp.
|
||||
+ * Returns the number of characters written altogether (the
|
||||
+ * buffer may have been flushed in the process).
|
||||
+ */
|
||||
+
|
||||
+int
|
||||
+output_data(const char *format, ...)
|
||||
+{
|
||||
+ va_list args;
|
||||
+ int len;
|
||||
+ char *buf;
|
||||
+
|
||||
+ va_start(args, format);
|
||||
+ if ((len = vasprintf(&buf, format, args)) == -1)
|
||||
+ return -1;
|
||||
+ output_datalen(buf, len);
|
||||
+ va_end(args);
|
||||
+ free(buf);
|
||||
+ return (len);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+output_datalen(const char *buf, int len)
|
||||
+{
|
||||
+ int remaining, copied;
|
||||
+
|
||||
+ remaining = BUFSIZ - (nfrontp - netobuf);
|
||||
+ while (len > 0) {
|
||||
+ /* Free up enough space if the room is too low*/
|
||||
+ if ((len > BUFSIZ ? BUFSIZ : len) > remaining) {
|
||||
+ netflush();
|
||||
+ remaining = BUFSIZ - (nfrontp - netobuf);
|
||||
+ }
|
||||
+
|
||||
+ /* Copy out as much as will fit */
|
||||
+ copied = remaining > len ? len : remaining;
|
||||
+ memmove(nfrontp, buf, copied);
|
||||
+ nfrontp += copied;
|
||||
+ len -= copied;
|
||||
+ remaining -= copied;
|
||||
+ buf += copied;
|
||||
+ }
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
void
|
||||
netoprintf(const char *fmt, ...)
|
||||
{
|
||||
@@ -67,7 +116,7 @@ netoprintf(const char *fmt, ...)
|
||||
va_end(ap);
|
||||
|
||||
if (len<0 || len==maxsize) {
|
||||
- /* didn't fit */
|
||||
+ / * did not fit * /
|
||||
netflush();
|
||||
}
|
||||
else {
|
||||
@@ -76,6 +125,7 @@ netoprintf(const char *fmt, ...)
|
||||
}
|
||||
nfrontp += len;
|
||||
}
|
||||
+*/
|
||||
|
||||
/*
|
||||
* ttloop
|
||||
@@ -273,10 +323,15 @@ netflush(void)
|
||||
int n;
|
||||
|
||||
if ((n = nfrontp - nbackp) > 0) {
|
||||
+
|
||||
+#if 0
|
||||
+ /* XXX This causes output_data() to recurse and die */
|
||||
DIAG(TD_REPORT,
|
||||
{ netoprintf("td: netflush %d chars\r\n", n);
|
||||
n = nfrontp - nbackp; /* update count */
|
||||
});
|
||||
+#endif
|
||||
+
|
||||
#if defined(ENCRYPT)
|
||||
if (encrypt_output) {
|
||||
char *s = nclearto ? nclearto : nbackp;
|
||||
@@ -310,11 +365,14 @@ netflush(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
- if (n < 0) {
|
||||
- if (errno == EWOULDBLOCK || errno == EINTR)
|
||||
- return;
|
||||
- cleanup(0);
|
||||
- }
|
||||
+
|
||||
+ if (n == -1) {
|
||||
+ if (errno == EWOULDBLOCK || errno == EINTR)
|
||||
+ return;
|
||||
+ cleanup(0);
|
||||
+ /* NOTREACHED */
|
||||
+ }
|
||||
+
|
||||
nbackp += n;
|
||||
#if defined(ENCRYPT)
|
||||
if (nbackp > nclearto)
|
||||
@@ -332,7 +390,7 @@ netflush(void)
|
||||
return;
|
||||
} /* end of netflush */
|
||||
|
||||
-
|
||||
+#if 0
|
||||
/*
|
||||
* writenet
|
||||
*
|
||||
@@ -355,7 +413,7 @@ void writenet(register unsigned char *pt
|
||||
nfrontp += len;
|
||||
|
||||
} /* end of writenet */
|
||||
-
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* miscellaneous functions doing a variety of little jobs follow ...
|
||||
1721
telnet-client-cvs.patch
Normal file
1721
telnet-client-cvs.patch
Normal file
File diff suppressed because it is too large
Load Diff
BIN
telnet-client.tar.gz
Normal file
BIN
telnet-client.tar.gz
Normal file
Binary file not shown.
48
telnet-gethostbyname.patch
Normal file
48
telnet-gethostbyname.patch
Normal file
@ -0,0 +1,48 @@
|
||||
--- netkit-telnet-0.17/telnet/commands.c.old 2006-04-30 10:24:49.000000000 -0700
|
||||
+++ netkit-telnet-0.17/telnet/commands.c 2006-04-30 10:37:10.000000000 -0700
|
||||
@@ -1669,9 +1669,15 @@
|
||||
|
||||
/* If this is not the full name, try to get it via DNS */
|
||||
if (strchr(hbuf, '.') == 0) {
|
||||
- struct hostent *he = gethostbyname(hbuf);
|
||||
- if (he != 0)
|
||||
- strncpy(hbuf, he->h_name, sizeof hbuf-1);
|
||||
+ struct addrinfo hints;
|
||||
+ struct addrinfo *res;
|
||||
+ memset (&hints, '\0', sizeof (hints));
|
||||
+ hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG | AI_CANONNAME;
|
||||
+ if (getaddrinfo (hbuf, NULL, &hints, &res) == 0) {
|
||||
+ if (res->ai_canonname != NULL)
|
||||
+ strncpy(hbuf, res->ai_canonname, sizeof hbuf-1);
|
||||
+ freeaddrinfo (res);
|
||||
+ }
|
||||
hbuf[sizeof hbuf-1] = '\0';
|
||||
}
|
||||
|
||||
@@ -2832,17 +2838,15 @@
|
||||
if (!c)
|
||||
cp2 = 0;
|
||||
|
||||
- if ((tmp = inet_addr(cp)) != -1) {
|
||||
- sin_addr.s_addr = tmp;
|
||||
- } else if ((host = gethostbyname(cp))) {
|
||||
-#if defined(h_addr)
|
||||
- memmove((caddr_t)&sin_addr,
|
||||
- host->h_addr_list[0],
|
||||
- sizeof(sin_addr));
|
||||
-#else
|
||||
- memmove((caddr_t)&sin_addr, host->h_addr,
|
||||
- sizeof(sin_addr));
|
||||
-#endif
|
||||
+ struct addrinfo hints;
|
||||
+ memset (&hints, '\0', sizeof (hints));
|
||||
+ // XXX The code here seems to allow only IPv4 addresses.
|
||||
+ hints.ai_family = AF_INET;
|
||||
+ hints.ai_flags = AI_ADDRCONFIG;
|
||||
+ struct addrinfo *aires;
|
||||
+ if (getaddrinfo (cp, NULL, &hints, &aires) == 0) {
|
||||
+ sin_addr = ((struct sockaddr_in *) aires->ai_addr)->sin_addr;
|
||||
+ freeaddrinfo (aires);
|
||||
} else {
|
||||
*cpp = cp;
|
||||
return(0);
|
||||
47
telnet-rh674942.patch
Normal file
47
telnet-rh674942.patch
Normal file
@ -0,0 +1,47 @@
|
||||
--- netkit-telnet-0.17/telnetd/telnetd.c.orig 2011-01-31 12:05:37.942942871 -0600
|
||||
+++ netkit-telnet-0.17/telnetd/telnetd.c 2011-01-31 18:20:22.400743499 -0600
|
||||
@@ -82,6 +82,7 @@ char ptyibuf2[BUFSIZ];
|
||||
int hostinfo = 1; /* do we print login banner? */
|
||||
|
||||
int debug = 0;
|
||||
+int debugsix = 0;
|
||||
int keepalive = 1;
|
||||
char *loginprg = _PATH_LOGIN;
|
||||
char *progname;
|
||||
@@ -150,8 +151,11 @@ main(int argc, char *argv[], char *env[]
|
||||
#endif /* BFTPDAEMON */
|
||||
|
||||
case 'd':
|
||||
- if (strcmp(optarg, "ebug") == 0) {
|
||||
+ if (strncmp(optarg, "ebug", 4) == 0) {
|
||||
debug++;
|
||||
+ if (strncmp(optarg, "ebug6", 5) == 0) {
|
||||
+ debugsix++;
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
usage();
|
||||
@@ -271,6 +275,8 @@ main(int argc, char *argv[], char *env[]
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_flags = AI_ADDRCONFIG | AI_PASSIVE;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
+ if (debugsix)
|
||||
+ hints.ai_family = AF_INET6;
|
||||
|
||||
if (argc == 0) {
|
||||
if (getaddrinfo(NULL, "telnet", &hints, &ai) != 0) {
|
||||
@@ -380,12 +386,12 @@ usage(void)
|
||||
{
|
||||
fprintf(stderr, "Usage: telnetd");
|
||||
#ifdef AUTHENTICATE
|
||||
- fprintf(stderr, " [-a (debug|other|user|valid|off)]\n\t");
|
||||
+ fprintf(stderr, " [-a (debug|debug6|other|user|valid|off)]\n\t");
|
||||
#endif
|
||||
#ifdef BFTPDAEMON
|
||||
fprintf(stderr, " [-B]");
|
||||
#endif
|
||||
- fprintf(stderr, " [-debug]");
|
||||
+ fprintf(stderr, " [-debug|-debug6]");
|
||||
#ifdef DIAGNOSTICS
|
||||
fprintf(stderr, " [-D (options|report|exercise|netdata|ptydata)]\n\t");
|
||||
#endif
|
||||
21
telnet-rh678324.patch
Normal file
21
telnet-rh678324.patch
Normal file
@ -0,0 +1,21 @@
|
||||
diff -up netkit-telnet-0.17/telnetd/telnetd.c.rh678324 netkit-telnet-0.17/telnetd/telnetd.c
|
||||
--- netkit-telnet-0.17/telnetd/telnetd.c.rh678324 2011-06-28 14:51:09.996726296 +0200
|
||||
+++ netkit-telnet-0.17/telnetd/telnetd.c 2011-06-28 14:52:38.212726283 +0200
|
||||
@@ -92,7 +92,7 @@ extern void usage(void);
|
||||
int
|
||||
main(int argc, char *argv[], char *env[])
|
||||
{
|
||||
- struct sockaddr from;
|
||||
+ struct sockaddr_storage from;
|
||||
int on = 1;
|
||||
socklen_t fromlen;
|
||||
register int ch;
|
||||
@@ -344,7 +344,7 @@ main(int argc, char *argv[], char *env[]
|
||||
|
||||
openlog("telnetd", LOG_PID | LOG_ODELAY, LOG_DAEMON);
|
||||
fromlen = sizeof (from);
|
||||
- if (getpeername(s, &from, &fromlen) < 0) {
|
||||
+ if (getpeername(s, (struct sockaddr *)&from, &fromlen) < 0) {
|
||||
fprintf(stderr, "%s: ", progname);
|
||||
perror("getpeername");
|
||||
_exit(1);
|
||||
24
telnet-rh704604.patch
Normal file
24
telnet-rh704604.patch
Normal file
@ -0,0 +1,24 @@
|
||||
--- netkit-telnet-0.17/telnet/commands.c.hostalias 2011-07-11 08:07:22.000000000 -0400
|
||||
+++ netkit-telnet-0.17/telnet/commands.c 2011-07-11 08:10:12.131039660 -0400
|
||||
@@ -2400,17 +2400,21 @@
|
||||
ahints.ai_family = PF_UNSPEC;
|
||||
ahints.ai_socktype = SOCK_STREAM;
|
||||
ahints.ai_flags = AI_PASSIVE;
|
||||
error = getaddrinfo(aliasp, "0", &ahints, &ares);
|
||||
if (error) {
|
||||
+ printf ("Couldn't get address for %s\n", aliasp);
|
||||
warn("%s: %s", aliasp, gai_strerror(error));
|
||||
close(net);
|
||||
+ net = -1;
|
||||
continue;
|
||||
}
|
||||
if (bind(net, ares->ai_addr, ares->ai_addrlen) < 0) {
|
||||
+ printf ("Couldn't bind to %s\n", aliasp);
|
||||
perror(aliasp);
|
||||
(void) close(net); /* dump descriptor */
|
||||
+ net = -1;
|
||||
freeaddrinfo(ares);
|
||||
continue;
|
||||
}
|
||||
freeaddrinfo(ares);
|
||||
}
|
||||
25
telnet-rh825946.patch
Normal file
25
telnet-rh825946.patch
Normal file
@ -0,0 +1,25 @@
|
||||
diff -up netkit-telnet-0.17/telnetd/sys_term.c.rh825946 netkit-telnet-0.17/telnetd/sys_term.c
|
||||
--- netkit-telnet-0.17/telnetd/sys_term.c.rh825946 1999-12-17 15:28:47.000000000 +0100
|
||||
+++ netkit-telnet-0.17/telnetd/sys_term.c 2012-06-14 14:05:30.538342755 +0200
|
||||
@@ -723,6 +723,9 @@ void cleanup(int sig) {
|
||||
char *p;
|
||||
(void)sig;
|
||||
|
||||
+ /* to avoid a race for wtmp lock */
|
||||
+ signal(SIGCHLD, SIG_IGN);
|
||||
+
|
||||
p = line + sizeof("/dev/") - 1;
|
||||
if (logout(p)) logwtmp(p, "", "");
|
||||
#ifdef PARANOID_TTYS
|
||||
diff -up netkit-telnet-0.17/telnetd/telnetd.c.rh825946 netkit-telnet-0.17/telnetd/telnetd.c
|
||||
--- netkit-telnet-0.17/telnetd/telnetd.c.rh825946 2012-06-14 14:04:42.000000000 +0200
|
||||
+++ netkit-telnet-0.17/telnetd/telnetd.c 2012-06-14 14:06:01.547291404 +0200
|
||||
@@ -1147,8 +1147,6 @@ void telnet(int f, int p)
|
||||
if (FD_ISSET(p, &obits) && (pfrontp - pbackp) > 0)
|
||||
ptyflush();
|
||||
}
|
||||
- /* to avoid a race for wtmp lock */
|
||||
- signal(SIGCHLD, SIG_IGN);
|
||||
cleanup(0);
|
||||
} /* end of telnet */
|
||||
|
||||
10
telnet.socket
Normal file
10
telnet.socket
Normal file
@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Telnet Server Activation Socket
|
||||
Documentation=man:telnetd(8)
|
||||
|
||||
[Socket]
|
||||
ListenStream=23
|
||||
Accept=true
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
105
telnet.spec
Normal file
105
telnet.spec
Normal file
@ -0,0 +1,105 @@
|
||||
Name: telnet
|
||||
Epoch: 1
|
||||
Version: 0.17
|
||||
Release: 75
|
||||
Summary: Client and Server programs for the Telnet communication protocol
|
||||
License: BSD
|
||||
Url: http://web.archive.org/web/20070819111735/www.hcs.harvard.edu/~dholland/computers/old-netkit.html
|
||||
Source0: ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/netkit-telnet-%{version}.tar.gz
|
||||
#sources form fedora/redhat
|
||||
Source1: telnet-client.tar.gz
|
||||
Source2: telnet@.service
|
||||
Source3: telnet.socket
|
||||
|
||||
#patches from fedora/redhat repositories
|
||||
Patch0001: telnet-client-cvs.patch
|
||||
Patch0002: telnetd-0.17.diff
|
||||
Patch0003: telnet-0.17-env.patch
|
||||
Patch0004: telnet-0.17-pek.patch
|
||||
Patch0005: telnet-0.17-issue.patch
|
||||
Patch0006: telnet-0.17-sa-01-49.patch
|
||||
Patch0007: telnet-0.17-8bit.patch
|
||||
Patch0008: telnet-0.17-argv.patch
|
||||
Patch0009: telnet-0.17-conf.patch
|
||||
Patch0010: telnet-0.17-cleanup_race.patch
|
||||
Patch0011: telnetd-0.17-pty_read.patch
|
||||
Patch0012: telnet-0.17-CAN-2005-468_469.patch
|
||||
Patch0013: telnet-gethostbyname.patch
|
||||
Patch0014: netkit-telnet-0.17-ipv6.diff
|
||||
Patch0015: netkit-telnet-0.17-nodns.patch
|
||||
Patch0016: telnet-0.17-errno_test_sys_bsd.patch
|
||||
Patch0017: netkit-telnet-0.17-reallynodns.patch
|
||||
Patch0018: telnet-rh678324.patch
|
||||
Patch0019: telnet-rh674942.patch
|
||||
Patch0020: telnet-rh704604.patch
|
||||
Patch0021: telnet-rh825946.patch
|
||||
Patch0022: telnet-0.17-force-ipv6-ipv4.patch
|
||||
Patch0023: netkit-telnet-0.17-core-dump.patch
|
||||
Patch0024: netkit-telnet-0.17-gcc7.patch
|
||||
Patch0025: netkit-telnet-0.17-manpage.patch
|
||||
Patch0026: netkit-telnet-0.17-telnetrc.patch
|
||||
|
||||
BuildRequires: gcc-c++ ncurses-devel systemd
|
||||
Requires: systemd
|
||||
Provides: %{name}-server
|
||||
Obsoletes: %{name}-server
|
||||
|
||||
%description
|
||||
Telnet is an application protocol used on the Internet or local area
|
||||
network to provide a bidirectional interactive text-oriented communication
|
||||
facility using a virtual terminal connection. The package includes a remote
|
||||
login client program for telnet and a server daemon.
|
||||
|
||||
%package help
|
||||
Summary: Help package for %{name}, including doc and man files.
|
||||
|
||||
%description help
|
||||
This is the help package for %{name}. It includes a doc file and
|
||||
some man files.
|
||||
|
||||
%prep
|
||||
%setup -q -n netkit-telnet-%{version}
|
||||
mv -f telnet telnet-NETKIT
|
||||
|
||||
%autosetup -T -D -a 1 -n netkit-telnet-%{version} -p1
|
||||
|
||||
%build
|
||||
%{_configure} --with-c-compiler=gcc --prefix=%{_prefix} --exec-prefix=%{_exec_prefix}
|
||||
sed -i 's,-O2,\$(CC_FLAGS),;s,LDFLAGS=.*,LDFLAGS=\$(LD_FLAGS),;s,^MANDIR=.*$,MANDIR=%{_mandir},' MCONFIG
|
||||
sed -i 's,install [+-]s,install,g' ./telnet/GNUmakefile ./telnetd/Makefile ./telnetlogin/Makefile ./telnet-NETKIT/Makefile
|
||||
|
||||
%make_build CC_FLAGS="$RPM_OPT_FLAGS -fpie" LD_FLAGS="$LD_FLAGS -z now -pie"
|
||||
|
||||
%install
|
||||
install -d %{buildroot}{%{_bindir},%{_sbindir},%{_mandir}/man{1,5,8}}
|
||||
make install INSTALLROOT=%{buildroot}
|
||||
|
||||
install -Dpm644 %{SOURCE2} %{buildroot}%{_unitdir}/telnet@.service
|
||||
install -pm644 %{SOURCE3} %{buildroot}%{_unitdir}/telnet.socket
|
||||
|
||||
%post
|
||||
%systemd_post telnet.socket
|
||||
|
||||
%preun
|
||||
%systemd_preun telnet.socket
|
||||
|
||||
%postun
|
||||
%systemd_postun_with_restart telnet.socket
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%{_unitdir}/*
|
||||
%{_sbindir}/in.telnetd
|
||||
%{_bindir}/telnet
|
||||
|
||||
%files help
|
||||
%defattr(-,root,root,-)
|
||||
%doc README
|
||||
%{_mandir}/man5/issue.net.5*
|
||||
%{_mandir}/man8/in.telnetd.8*
|
||||
%{_mandir}/man8/telnetd.8*
|
||||
%{_mandir}/man1/telnet.1*
|
||||
|
||||
%changelog
|
||||
* Sat Sep 14 2019 huzhiyu<huzhiyu1@huawei.com> - 1:0.17-75
|
||||
- Package init
|
||||
7
telnet@.service
Normal file
7
telnet@.service
Normal file
@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=Telnet Server
|
||||
After=local-fs.target
|
||||
|
||||
[Service]
|
||||
ExecStart=-/usr/sbin/in.telnetd
|
||||
StandardInput=socket
|
||||
25
telnetd-0.17-pty_read.patch
Normal file
25
telnetd-0.17-pty_read.patch
Normal file
@ -0,0 +1,25 @@
|
||||
--- a/telnetd/telnetd.c 2005-01-19 14:37:25.000000000 +0000
|
||||
+++ b/telnetd/telnetd.c.new 2005-01-19 14:48:12.000000000 +0000
|
||||
@@ -697,6 +697,7 @@
|
||||
int on = 1;
|
||||
char *HE;
|
||||
const char *IM;
|
||||
+ int pty_read_ok = 0; /* track whether the pty read has worked yet */
|
||||
|
||||
/*
|
||||
* Initialize the slc mapping table.
|
||||
@@ -1016,12 +1017,13 @@
|
||||
* off the master side before the slave side is
|
||||
* opened, we get EIO.
|
||||
*/
|
||||
- if (pcc < 0 && (errno == EWOULDBLOCK || errno == EIO)) {
|
||||
+ if (pcc < 0 && (errno == EWOULDBLOCK || (errno == EIO && pty_read_ok == 0))) {
|
||||
pcc = 0;
|
||||
}
|
||||
else {
|
||||
if (pcc <= 0)
|
||||
break;
|
||||
+ pty_read_ok = 1; /* mark connection up for read */
|
||||
#ifdef LINEMODE
|
||||
/*
|
||||
* If ioctl from pty, pass it through net
|
||||
21
telnetd-0.17.diff
Normal file
21
telnetd-0.17.diff
Normal file
@ -0,0 +1,21 @@
|
||||
--- a/telnetd/telnetd.c Thu Apr 13 00:36:12 2000
|
||||
+++ b/telnetd.new/telnetd.c Sun Mar 11 03:10:43 2001
|
||||
@@ -44,7 +44,7 @@
|
||||
#include "../version.h"
|
||||
|
||||
#include <netdb.h>
|
||||
-#include <termcap.h>
|
||||
+#include <ncurses/termcap.h>
|
||||
#include <netinet/in.h>
|
||||
/* #include <netinet/ip.h> */ /* Don't think this is used at all here */
|
||||
#include <arpa/inet.h>
|
||||
--- a/telnetd/defs.h Mon Aug 2 06:14:03 1999
|
||||
+++ b/telnetd.new/defs.h Sun Mar 11 03:28:13 2001
|
||||
@@ -56,6 +56,7 @@
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
+#include <time.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/telnet.h>
|
||||
Loading…
x
Reference in New Issue
Block a user