Small patch for SunOS

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

 



	Hi. I've just compiled 1.0 on a SunOS 4.1.3u1 machine. This
version of SunOS shares a bug with early versions of Solaris, in that
gethostbyaddr/gethostbyname does not normally return the fully
qualified domain name. A way to force gethostbyname to return the FQDN
is to append a trailing dot to the hostname returned by gethostbyaddr.
Of course, this may not appropriate in all contexts, for example, if
the machine does not use NIS (which in its turn can be set up to call
DNS for name resolution.)

	No doubt this can be fixed in a simple and elegant manner. For
example, there is no problem if gethostbyaddr returns a host name that
contains at least one dot. If there is no dot in the returned host
name it's possible that appending a dot causes gethostbyaddr to fail
(I haven't checked this). The small patch below shows how I dealt with
it; I'm certain you can improve on it ;-)
	

447a448,453
> #define RWI
> #ifdef RWI
> 		host1 = malloc(strlen((char *) hp->h_name) + 2);
> 		strcpy(host1, hp->h_name);
> 		strcat(host1, ".");
> #else
448a455
> #endif
458a466,469
> #ifdef RWI
> 			free(host1);
> 			host1 = Sstrdup((char *) hp->h_name);
> #endif

	//Raymond.


[Index of Archives]     [Yosemite]     [Yosemite Campsites]     [Bugtraq]     [Linux]     [Trn]

Powered by Linux