~vcs-imports/ipfire/ipfire-2.x

« back to all changes in this revision

Viewing changes to src/patches/netkit-telnet-0.17-reallynodns.patch

  • Committer: Daniel Glanzmann
  • Date: 2008-09-26 17:05:28 UTC
  • mto: (1394.1.12)
  • mto: This revision was merged to the branch mainline in revision 1401.
  • Revision ID: git-v1:19ac4d1b6e234e1391b3d406381e3b74e92c40dd
added new useragent thunderbird

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
3
 
@@ -85,6 +85,7 @@
4
 
 int keepalive = 1;
5
 
 char *loginprg = _PATH_LOGIN;
6
 
 char *progname;
7
 
+int lookupself = 1;
8
 
 
9
 
 extern void usage(void);
10
 
 
11
 
@@ -111,7 +112,7 @@
12
 
 
13
 
        progname = *argv;
14
 
 
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) {
17
 
                switch(ch) {
18
 
 
19
 
 #ifdef AUTHENTICATE
20
 
@@ -210,6 +211,10 @@
21
 
                        keepalive = 0;
22
 
                        break;
23
 
 
24
 
+                case 'N':
25
 
+                        lookupself = 0;
26
 
+                        break;
27
 
+
28
 
 #ifdef SecurID
29
 
                case 's':
30
 
                        /* SecurID required */
31
 
@@ -393,6 +398,7 @@
32
 
 #endif
33
 
        fprintf(stderr, " [-L login_program]");
34
 
        fprintf(stderr, " [-n]");
35
 
+       fprintf(stderr, " [-N]");
36
 
 #ifdef SecurID
37
 
        fprintf(stderr, " [-s]");
38
 
 #endif
39
 
@@ -691,15 +697,20 @@
40
 
 
41
 
                memset(&hints, '\0', sizeof(hints));
42
 
                hints.ai_socktype = SOCK_STREAM;
43
 
-               hints.ai_flags = AI_ADDRCONFIG;
44
 
+               hints.ai_flags = AI_CANONNAME;
45
 
 
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", 
50
 
-                                       gai_strerror(e));
51
 
-                               exit(1);
52
 
-                       }
53
 
+                /*
54
 
+                 * Optionally canonicalize the local host name, in case
55
 
+                 * gethostname() returns foo, we want foo.example.com
56
 
+                 */
57
 
+               if (lookupself &&
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;
63
 
+                        }
64
 
                }
65
 
                if(res)
66
 
                        freeaddrinfo(res);
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
69
 
@@ -42,7 +42,7 @@
70
 
 protocol server
71
 
 .Sh SYNOPSIS
72
 
 .Nm /usr/sbin/in.telnetd
73
 
-.Op Fl hns
74
 
+.Op Fl hnNs
75
 
 .Op Fl a Ar authmode
76
 
 .Op Fl D Ar debugmode
77
 
 .Op Fl L Ar loginprg
78
 
@@ -175,6 +175,10 @@
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.
82
 
+.It Fl N
83
 
+Do not use DNS to canonicalize the local hostname;
84
 
+.Fn gethostname 2
85
 
+returns a fully qualified name.
86
 
 .It Fl s
87
 
 This option is only enabled if
88
 
 .Nm telnetd