[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#2699: ytalk doesn't use FQDNs



Package: ytalk
Version: 3.0.2-1

If A@HostA.Domain wishes to talk to B@HostB.Domain, and thus types
"ytalk B@HostB", and B in return types "ytalk A@HostA", the two can connect up
perfectly well. However, if A then decides to add C@OtherHost.OtherDomain
to the conversation, when C tries to import a connection to B, the
address given by A is simply B@HostB. Obviously, C is unable to resolve
this address. The problem also occurs if two people on the same machine
are talking to each other, and one of them adds a user on a machine in a
different domain. The problem does not occur if the users specify FQDNs
when starting ytalk or adding new users.

A possible fix for this is to patch the new_user() function, which generates
the user records to be exported to other ytalk sessions, to ensure that
the hostname being exported is fully qualified. This works with the
scenario above, and with various other combinations of local and fully
qualified hostnames in ytalk sessions.

--- ytalk-3.0.2/user.c  Sun May 21 07:06:59 1995
+++ user.c      Sat Jan 20 16:41:21 1996
@@ -18,6 +18,7 @@

 #include "header.h"
 #include <pwd.h>
+#include <netdb.h>

 extern char *getlogin();

@@ -185,6 +186,7 @@
 {
     register yuser *out, *u;
     ylong addr;
+    struct hostent* hostent;

     /* find the host address */

@@ -199,6 +201,18 @@
        show_error(errstr);
        return NULL;
     }
+
+    /* find the full hostname - gethostname() on Linux doesn't always
+     * get it right
+     */
+
+    if((hostent = gethostbyname(hostname)) == NULL)
+    {
+        show_error("new_user: gethostbyname() failed");
+       bail(YTE_ERROR);
+    }
+
+    hostname = (char *) hostent->h_name;

     /* create the user record */
-----------------------------------------------------------------------

Paul Menage    Magdalene College, Cambridge    pbm1001@hermes.cam.ac.uk




Reply to: