+1999-06-18 Bryce McKinlay <bryce@albatross.co.nz>
+
+ * java/net/natInetAddress.cc (lookup): Preserve caller-supplied
+ hostname in returned InetAddress objects.
+ (getLocalHostname): Fix typo.
+ * java/net/InetAddress.java (getByName): Set hostname on return
+ object.
+ (getLocalHost): Call lookup directly to ensure that a fully-qualified
+ name is returned.
+
1999-06-17 Bryce McKinlay <bryce@albatross.co.nz>
* java/net/natPlainSocketImpl.cc (bind): Bind to any/all network
byte[] address = aton(host);
if (address != null)
return new InetAddress(address, null);
- InetAddress iaddr = new InetAddress(null, null);
+ InetAddress iaddr = new InetAddress(null, host);
lookup(host, iaddr, false);
return iaddr;
}
{
try
{
- localhost = getByName(hostname);
+ localhost = new InetAddress(null, null);
+ lookup(hostname, localhost, false);
}
catch (Exception ex)
{
#endif /* HAVE_GETHOSTBYADDR_R */
}
if (hptr != NULL)
- {
- if (host == NULL)
+ {
+ if (!all)
host = JvNewStringUTF (hptr->h_name);
java::lang::SecurityException *ex = checkConnect (host);
if (ex != NULL)
{
if (iaddrs[i] == NULL)
iaddrs[i] = new java::net::InetAddress (NULL, NULL);
- iaddrs[i]->hostname = host;
+ if (iaddrs[i]->hostname == NULL)
+ iaddrs[i]->hostname = host;
if (iaddrs[i]->address == NULL)
{
char *bytes = hptr->h_addr_list[i];
#elif HAVE_UNAME
struct utsname stuff;
if (uname (&stuff) != 0)
- return NULL:
+ return NULL;
chars = stuff.nodename;
#else
return NULL;