[newlib-cygwin] Cygwin: load_user_profile: Don't give primary domain to ldap

Corinna Vinschen corinna@sourceware.org
Sat Mar 2 11:49:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=4abac6219346f3b3c06401d8100593c742b094b3

commit 4abac6219346f3b3c06401d8100593c742b094b3
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Sat Mar 2 12:47:54 2019 +0100

    Cygwin: load_user_profile: Don't give primary domain to ldap
    
    If the user domain is the primary domain, LDAP is supposed to
    use the default naming context.  This is accomplished by setting
    domain name to NULL in the call to cyg_ldap::fetch_ad_account.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/sec_auth.cc | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/winsup/cygwin/sec_auth.cc b/winsup/cygwin/sec_auth.cc
index 2f04801..36874b6 100644
--- a/winsup/cygwin/sec_auth.cc
+++ b/winsup/cygwin/sec_auth.cc
@@ -285,9 +285,7 @@ load_user_profile (HANDLE token, struct passwd *pw, cygpsid &usersid)
       PCWSTR dnsdomain = NULL;
 
       debug_printf ("primary domain <%W>", cygheap->dom.primary_flat_name ());
-      if (!wcscasecmp (domain, cygheap->dom.primary_flat_name ()))
-	dnsdomain = cygheap->dom.primary_dns_name ();
-      else
+      if (wcscasecmp (domain, cygheap->dom.primary_flat_name ()))
 	{
 	  PDS_DOMAIN_TRUSTSW td = NULL;
 
@@ -301,21 +299,16 @@ load_user_profile (HANDLE token, struct passwd *pw, cygpsid &usersid)
 		}
 	    }
 	}
-      if (dnsdomain)
+      if (cldap.fetch_ad_account (usersid, false, dnsdomain))
 	{
-	  if (cldap.fetch_ad_account (usersid, false, dnsdomain))
+	  PWCHAR val = cldap.get_profile_path ();
+	  if (val && *val)
 	    {
-	      PWCHAR val = cldap.get_profile_path ();
-	      if (val && *val)
-		{
-		  wcsncpy (userpath, val, MAX_PATH - 1);
-		  userpath[MAX_PATH - 1] = L'\0';
-		  pi.lpProfilePath = userpath;
-		}
+	      wcsncpy (userpath, val, MAX_PATH - 1);
+	      userpath[MAX_PATH - 1] = L'\0';
+	      pi.lpProfilePath = userpath;
 	    }
 	}
-      else
-	debug_printf ("Unknown domain <%W>?", domain);
     }
 
   if (!LoadUserProfileW (token, &pi))



More information about the Cygwin-cvs mailing list