1
--- netkit-telnet-0.17.orig/telnetd/telnetd.c.reallynodns 2009-03-12 14:32:29.000000000 -0700
2
+++ netkit-telnet-0.17.orig/telnetd/telnetd.c 2009-03-12 14:51:59.000000000 -0700
5
char *loginprg = _PATH_LOGIN;
9
extern void usage(void);
15
- while ((ch = getopt(argc, argv, "d:a:e:lhnr:I:D:B:sS:a:X:L:")) != EOF) {
16
+ while ((ch = getopt(argc, argv, "d:a:e:lhnr:I:D:B:sS:a:X:L:N")) != EOF) {
30
/* SecurID required */
33
fprintf(stderr, " [-L login_program]");
34
fprintf(stderr, " [-n]");
35
+ fprintf(stderr, " [-N]");
37
fprintf(stderr, " [-s]");
41
memset(&hints, '\0', sizeof(hints));
42
hints.ai_socktype = SOCK_STREAM;
43
- hints.ai_flags = AI_ADDRCONFIG;
44
+ hints.ai_flags = AI_CANONNAME;
46
gethostname(host_name, sizeof(host_name));
47
- if ((e = getaddrinfo(host_name, NULL, &hints, &res)) != 0) {
48
- if(e != EAI_AGAIN) {
49
- fprintf(stderr, "getaddrinfo: localhost %s\n",
54
+ * Optionally canonicalize the local host name, in case
55
+ * gethostname() returns foo, we want foo.example.com
58
+ (e = getaddrinfo(host_name, NULL, &hints, &res)) == 0) {
59
+ if (res->ai_canonname) {
60
+ strncpy(host_name, res->ai_canonname,
61
+ sizeof(host_name)-1);
62
+ host_name[sizeof(host_name)-1] = 0;
67
--- netkit-telnet-0.17.orig/telnetd/telnetd.8.reallynodns 2009-03-12 14:54:54.000000000 -0700
68
+++ netkit-telnet-0.17.orig/telnetd/telnetd.8 2009-03-12 14:56:58.000000000 -0700
72
.Nm /usr/sbin/in.telnetd
79
if the client is still there, so that idle connections
80
from machines that have crashed or can no longer
81
be reached may be cleaned up.
83
+Do not use DNS to canonicalize the local hostname;
85
+returns a fully qualified name.
87
This option is only enabled if