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

Bug#2322: _checkhost (inet/rcmd.c) function will only work with long hostnames



Package: libc5 (and libc4)
Version: 5.2.18-1 (and libc4 4.6.27-11)


The _checkhost (inet/rcmd.c) function will only work with
long host names. If a short host name is used the function
has to use gethostbyname to get the long host name.


The following patch should fix the problem:

--- inet/rcmd.c.orig Thu Aug 24 04:03:26 1995
+++ inet/rcmd.c     Fri Jan 27 03:49:07 1995
@@ -436,6 +386,7 @@
        static char ldomain[MAXHOSTNAMELEN + 1];
        static char *domainp = NULL;
        static int nodomain = 0;
+       static struct hostent *hp;
        register char *cp;

        if (len == -1)
@@ -453,8 +404,9 @@
                        nodomain = 1;
                        return(0);
                }
-               if ((domainp = index(ldomain, '.')) == (char *)NULL) {
+               if ((hp = gethostbyname(ldomain)) == NULL)
+                       return(0);
+               if ((domainp = index(hp->h_name, '.')) == (char *)NULL) {
                        nodomain = 1;
                        return(0);
                }



Thanks,

Peter

--
 Peter Tobias                                EMail:
 Fachhochschule Ostfriesland                 tobias@et-inf.fho-emden.de
 Fachbereich Elektrotechnik und Informatik   tobias@perseus.fho-emden.de
 Constantiaplatz 4, 26723 Emden, Germany


Reply to: