diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2002-03-07 14:32:53 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2002-03-07 14:32:53 +0000 |
commit | c8c3824dc883d32c96053d5e9a7e44490374fc38 (patch) | |
tree | 9cce0880cb5808082f57464460df2becbe2f0e26 /winsup/cygwin/security.cc | |
parent | b56dedef3ef4219f4e0ffcd5e548b62bcc17f49c (diff) | |
download | cygnal-c8c3824dc883d32c96053d5e9a7e44490374fc38.tar.gz cygnal-c8c3824dc883d32c96053d5e9a7e44490374fc38.tar.bz2 cygnal-c8c3824dc883d32c96053d5e9a7e44490374fc38.zip |
* 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.
Diffstat (limited to 'winsup/cygwin/security.cc')
-rw-r--r-- | winsup/cygwin/security.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index b33360d1a..83c8f2080 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -200,8 +200,7 @@ static BOOL get_lsa_srv_inf (LSA_HANDLE lsa, char *logonserver, char *domain) { NET_API_STATUS ret; - LPSERVER_INFO_101 buf; - DWORD cnt, tot; + WCHAR *buf; char name[INTERNET_MAX_HOST_NAME_LENGTH + 1]; WCHAR account[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); LsaFreeMemory (pdi); - if ((ret = NetServerEnum (NULL, 101, (LPBYTE *) &buf, MAX_PREFERRED_LENGTH, - &cnt, &tot, SV_TYPE_DOMAIN_CTRL, primary, NULL)) - == STATUS_SUCCESS && cnt > 0) + /* If the SID given in the primary domain info is NULL, the machine is + not member of a domain. The name in the primary domain info is the + 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) sys_wcstombs (domain, primary, INTERNET_MAX_HOST_NAME_LENGTH + 1); } |