summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/ldap.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-02-13 14:04:03 +0000
committerCorinna Vinschen <corinna@vinschen.de>2014-02-13 14:04:03 +0000
commit85b8256d2ede42f03b5a2791790584853e404fef (patch)
tree72b64130d93020445f3b9fef105729d0f13f4da8 /winsup/cygwin/ldap.cc
parent5f51881a6dac85522fddeedd9484c8d7d48d261b (diff)
downloadcygnal-85b8256d2ede42f03b5a2791790584853e404fef.tar.gz
cygnal-85b8256d2ede42f03b5a2791790584853e404fef.tar.bz2
cygnal-85b8256d2ede42f03b5a2791790584853e404fef.zip
* ldap.cc (cyg_ldap::fetch_posix_offset_for_domain): If domain name
has no dot, it's a Netbios name. Change the search filter expression accordingly and filter by flatName. Add comment. * uinfo.cc (cygheap_domain_info::init): Gracefully handle NULL DnsDomainName and DomainSid members in DS_DOMAIN_TRUSTSW strutures. Add comment. Fix comment preceeding fetching the mapping server from registry. (pwdgrp::fetch_account_from_file): Convert str to a local array. (fetch_posix_offset): New static function. (pwdgrp::fetch_account_from_windows): Add debug output in case LookupAccountSidW fails. Simplify code by calling fetch_posix_offset where appropriate. If LookupAccountSidW fails, check if the SID is one of the known trusted domains. If so, create a more informative account entry.
Diffstat (limited to 'winsup/cygwin/ldap.cc')
-rw-r--r--winsup/cygwin/ldap.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/winsup/cygwin/ldap.cc b/winsup/cygwin/ldap.cc
index 66a7dbb76..64e8949da 100644
--- a/winsup/cygwin/ldap.cc
+++ b/winsup/cygwin/ldap.cc
@@ -289,7 +289,10 @@ cyg_ldap::fetch_posix_offset_for_domain (PCWSTR domain)
ldap_value_freeW (val);
val = NULL;
}
- __small_swprintf (filter, L"(&(objectClass=trustedDomain)(name=%W))", domain);
+ /* If domain name has no dot, it's a Netbios name. In that case, filter
+ by flatName rather than by name. */
+ __small_swprintf (filter, L"(&(objectClass=trustedDomain)(%W=%W))",
+ wcschr (domain, L'.') ? L"name" : L"flatName", domain);
if ((ret = ldap_search_stW (lh, rootdse, LDAP_SCOPE_SUBTREE, filter,
attr = tdom_attr, 0, &tv, &msg)) != LDAP_SUCCESS)
{