* autoload.cc (NetGetDCName): Add symbol.

(NetServerEnum): Remove symbol.
	* security.cc (get_lsa_srv_inf): Call NetGetDCName() instead of
	NetServerEnum() since it's faster.  Don't call it at all if machine
	is not a domain member.
This commit is contained in:
Corinna Vinschen 2002-03-07 14:32:53 +00:00
parent b56dedef3e
commit c8c3824dc8
3 changed files with 16 additions and 7 deletions

View File

@ -1,3 +1,11 @@
2002-03-07 Corinna Vinschen <corina@vinschen.de>
* autoload.cc (NetGetDCName): Add symbol.
(NetServerEnum): Remove symbol.
* security.cc (get_lsa_srv_inf): Call NetGetDCName() instead of
NetServerEnum() since it's faster. Don't call it at all if machine
is not a domain member.
2002-03-06 Christopher Faylor <cgf@redhat.com> 2002-03-06 Christopher Faylor <cgf@redhat.com>
* path.cc (normalize_posix_path): Avoid runs of '.'s > 2. * path.cc (normalize_posix_path): Avoid runs of '.'s > 2.

View File

@ -365,9 +365,9 @@ LoadDLLfunc (SetSecurityDescriptorOwner, 12, advapi32)
LoadDLLfunc (SetTokenInformation, 16, advapi32) LoadDLLfunc (SetTokenInformation, 16, advapi32)
LoadDLLfunc (NetApiBufferFree, 4, netapi32) LoadDLLfunc (NetApiBufferFree, 4, netapi32)
LoadDLLfunc (NetGetDCName, 12, netapi32)
LoadDLLfunc (NetLocalGroupEnum, 28, netapi32) LoadDLLfunc (NetLocalGroupEnum, 28, netapi32)
LoadDLLfunc (NetLocalGroupGetMembers, 32, netapi32) LoadDLLfunc (NetLocalGroupGetMembers, 32, netapi32)
LoadDLLfunc (NetServerEnum, 36, netapi32)
LoadDLLfunc (NetUserGetGroups, 28, netapi32) LoadDLLfunc (NetUserGetGroups, 28, netapi32)
LoadDLLfunc (NetUserGetInfo, 16, netapi32) LoadDLLfunc (NetUserGetInfo, 16, netapi32)
LoadDLLfunc (NetWkstaUserGetInfo, 12, netapi32) LoadDLLfunc (NetWkstaUserGetInfo, 12, netapi32)

View File

@ -200,8 +200,7 @@ static BOOL
get_lsa_srv_inf (LSA_HANDLE lsa, char *logonserver, char *domain) get_lsa_srv_inf (LSA_HANDLE lsa, char *logonserver, char *domain)
{ {
NET_API_STATUS ret; NET_API_STATUS ret;
LPSERVER_INFO_101 buf; WCHAR *buf;
DWORD cnt, tot;
char name[INTERNET_MAX_HOST_NAME_LENGTH + 1]; char name[INTERNET_MAX_HOST_NAME_LENGTH + 1];
WCHAR account[INTERNET_MAX_HOST_NAME_LENGTH + 1]; WCHAR account[INTERNET_MAX_HOST_NAME_LENGTH + 1];
WCHAR primary[INTERNET_MAX_HOST_NAME_LENGTH + 1]; WCHAR primary[INTERNET_MAX_HOST_NAME_LENGTH + 1];
@ -224,11 +223,13 @@ get_lsa_srv_inf (LSA_HANDLE lsa, char *logonserver, char *domain)
} }
lsa2wchar (primary, pdi->Name, INTERNET_MAX_HOST_NAME_LENGTH + 1); lsa2wchar (primary, pdi->Name, INTERNET_MAX_HOST_NAME_LENGTH + 1);
LsaFreeMemory (pdi); LsaFreeMemory (pdi);
if ((ret = NetServerEnum (NULL, 101, (LPBYTE *) &buf, MAX_PREFERRED_LENGTH, /* If the SID given in the primary domain info is NULL, the machine is
&cnt, &tot, SV_TYPE_DOMAIN_CTRL, primary, NULL)) not member of a domain. The name in the primary domain info is the
== STATUS_SUCCESS && cnt > 0) name of the workgroup then. */
if (pdi->Sid &&
(ret = NetGetDCName(NULL, primary, (LPBYTE *) &buf)) == STATUS_SUCCESS)
{ {
sys_wcstombs (name, buf[0].sv101_name, INTERNET_MAX_HOST_NAME_LENGTH + 1); sys_wcstombs (name, buf, INTERNET_MAX_HOST_NAME_LENGTH + 1);
if (domain) if (domain)
sys_wcstombs (domain, primary, INTERNET_MAX_HOST_NAME_LENGTH + 1); sys_wcstombs (domain, primary, INTERNET_MAX_HOST_NAME_LENGTH + 1);
} }