From 58c7f38368df7bb3d5757540ef3210c2505c6e73 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 14 Apr 2002 05:46:23 +0000 Subject: hanle the case where the win2000 username is completely different from the pre-win2000 username (This used to be commit aa139ba507e4b898377fdfc9b27f7febf029d5a4) --- source3/nsswitch/winbindd_ads.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'source3') diff --git a/source3/nsswitch/winbindd_ads.c b/source3/nsswitch/winbindd_ads.c index e74bd1e04c..e7db6efab6 100644 --- a/source3/nsswitch/winbindd_ads.c +++ b/source3/nsswitch/winbindd_ads.c @@ -398,14 +398,9 @@ static NTSTATUS name_to_sid(struct winbindd_domain *domain, ads = ads_cached_connection(domain); if (!ads) goto done; - /* when a name is longer than 20 characters, the sAMAccountName can - be long or short! */ - if (strlen(name) > 20) { - asprintf(&exp, "(|(sAMAccountName=%s)(sAMAccountName=%.20s))", - name, name); - } else { - asprintf(&exp, "(sAMAccountName=%s)", name); - } + /* accept either the win2000 or the pre-win2000 username */ + asprintf(&exp, "(|(sAMAccountName=%s)(userPrincipalName=%s@%s))", + name, name, ads->realm); rc = ads_search_retry(ads, &res, exp, attrs); free(exp); if (!ADS_ERR_OK(rc)) { -- cgit