summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-04-14 05:46:23 +0000
committerAndrew Tridgell <tridge@samba.org>2002-04-14 05:46:23 +0000
commit58c7f38368df7bb3d5757540ef3210c2505c6e73 (patch)
tree7989cba4aa6395a189e2a747ad0c4cf9b1f35d9d /source3/nsswitch
parent35bc06d35cfff9d5f4ebf3c0d47a57165df09fd6 (diff)
downloadsamba-58c7f38368df7bb3d5757540ef3210c2505c6e73.tar.gz
samba-58c7f38368df7bb3d5757540ef3210c2505c6e73.tar.bz2
samba-58c7f38368df7bb3d5757540ef3210c2505c6e73.zip
hanle the case where the win2000 username is completely different from
the pre-win2000 username (This used to be commit aa139ba507e4b898377fdfc9b27f7febf029d5a4)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r--source3/nsswitch/winbindd_ads.c11
1 files changed, 3 insertions, 8 deletions
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)) {