2003-06-18 Pierre Humblet <pierre.humblet@ieee.org>
* autoload.cc (GetNetworkParams): Add. * net.cc (getdomainname): Call GetNetworkParams and read the DhcpDomain registry value if warranted.
This commit is contained in:
parent
2302957c53
commit
c9a5cfa0d3
@ -1,3 +1,9 @@
|
|||||||
|
2003-06-18 Pierre Humblet <pierre.humblet@ieee.org>
|
||||||
|
|
||||||
|
* autoload.cc (GetNetworkParams): Add.
|
||||||
|
* net.cc (getdomainname): Call GetNetworkParams and read the
|
||||||
|
DhcpDomain registry value if warranted.
|
||||||
|
|
||||||
2003-06-17 Christopher Faylor <cgf@redhat.com>
|
2003-06-17 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* path.cc (mount): Do more strict checking on posix path arguments.
|
* path.cc (mount): Do more strict checking on posix path arguments.
|
||||||
|
@ -492,6 +492,7 @@ LoadDLLfuncEx (WSAEnumNetworkEvents, 12, ws2_32, 1)
|
|||||||
LoadDLLfuncEx (GetIfTable, 12, iphlpapi, 1)
|
LoadDLLfuncEx (GetIfTable, 12, iphlpapi, 1)
|
||||||
LoadDLLfuncEx (GetIfEntry, 4, iphlpapi, 1)
|
LoadDLLfuncEx (GetIfEntry, 4, iphlpapi, 1)
|
||||||
LoadDLLfuncEx (GetIpAddrTable, 12, iphlpapi, 1)
|
LoadDLLfuncEx (GetIpAddrTable, 12, iphlpapi, 1)
|
||||||
|
LoadDLLfuncEx (GetNetworkParams, 8, iphlpapi, 1)
|
||||||
|
|
||||||
LoadDLLfunc (CoInitialize, 4, ole32)
|
LoadDLLfunc (CoInitialize, 4, ole32)
|
||||||
LoadDLLfunc (CoUninitialize, 0, ole32)
|
LoadDLLfunc (CoUninitialize, 0, ole32)
|
||||||
|
@ -1291,20 +1291,39 @@ getdomainname (char *domain, size_t len)
|
|||||||
if (__check_null_invalid_struct_errno (domain, len))
|
if (__check_null_invalid_struct_errno (domain, len))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
PFIXED_INFO info = NULL;
|
||||||
|
ULONG size = 0;
|
||||||
|
|
||||||
|
if (GetNetworkParams(info, &size) == ERROR_BUFFER_OVERFLOW
|
||||||
|
&& (info = (PFIXED_INFO) alloca(size))
|
||||||
|
&& GetNetworkParams(info, &size) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
strncpy(domain, info->DomainName, len);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is only used by Win95 and NT <= 4.0.
|
||||||
|
The registry names are language independent.
|
||||||
|
FIXME: Handle DHCP on Win95. The DhcpDomain(s) may be available
|
||||||
|
in ..VxD\DHCP\DhcpInfoXX\OptionInfo, RFC 1533 format */
|
||||||
|
|
||||||
reg_key r (HKEY_LOCAL_MACHINE, KEY_READ,
|
reg_key r (HKEY_LOCAL_MACHINE, KEY_READ,
|
||||||
(!wincap.is_winnt ()) ? "System" : "SYSTEM",
|
(!wincap.is_winnt ()) ? "System" : "SYSTEM",
|
||||||
"CurrentControlSet", "Services",
|
"CurrentControlSet", "Services",
|
||||||
(!wincap.is_winnt ()) ? "VxD" : "Tcpip",
|
(!wincap.is_winnt ()) ? "VxD" : "Tcpip",
|
||||||
(!wincap.is_winnt ()) ? "MSTCP" : "Parameters", NULL);
|
(!wincap.is_winnt ()) ? "MSTCP" : "Parameters", NULL);
|
||||||
|
|
||||||
/* FIXME: Are registry keys case sensitive? */
|
if (!r.error ())
|
||||||
if (r.error () || r.get_string ("Domain", domain, len, "") != ERROR_SUCCESS)
|
|
||||||
{
|
{
|
||||||
__seterrno ();
|
int res1, res2 = 0; /* Suppress compiler warning */
|
||||||
return -1;
|
res1 = r.get_string ("Domain", domain, len, "");
|
||||||
|
if (res1 != ERROR_SUCCESS || !domain[0])
|
||||||
|
res2 = r.get_string ("DhcpDomain", domain, len, "");
|
||||||
|
if (res1 == ERROR_SUCCESS || res2 == ERROR_SUCCESS)
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
__seterrno ();
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill out an ifconf struct. */
|
/* Fill out an ifconf struct. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user