natInetAddress.cc (lookup): Preserve caller-supplied hostname in returned InetAddress objects.

* 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.

From-SVN: r27587
This commit is contained in:
Bryce McKinlay 1999-06-18 01:17:28 +00:00 committed by Bryce McKinlay
parent 9ddab891df
commit e0cb3930ca
3 changed files with 18 additions and 6 deletions

View File

@ -1,3 +1,13 @@
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

View File

@ -177,7 +177,7 @@ public final class InetAddress
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;
}
@ -243,7 +243,8 @@ public final class InetAddress
{
try
{
localhost = getByName(hostname);
localhost = new InetAddress(null, null);
lookup(hostname, localhost, false);
}
catch (Exception ex)
{

View File

@ -199,8 +199,8 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr,
#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)
@ -246,7 +246,8 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr,
{
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];
@ -269,7 +270,7 @@ java::net::InetAddress::getLocalHostname ()
#elif HAVE_UNAME
struct utsname stuff;
if (uname (&stuff) != 0)
return NULL:
return NULL;
chars = stuff.nodename;
#else
return NULL;