From: Christof Schmitt Date: Mon, 11 Mar 2019 23:14:02 +0000 (-0700) Subject: winbind: Use domain name from lsa query for sid_to_name cache entry X-Git-Tag: tdb-1.4.1~360 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aec9bda25f10ca2710d91fb680cca7904e92f9de;p=thirdparty%2Fsamba.git winbind: Use domain name from lsa query for sid_to_name cache entry When winbindd is asked to map a name like realm.com\name to a SID ,that is sucessfully resolved through the lsa lookup name call. The same call also returns the short domain name (netbios name of the domain). Use that short domain name for the sid_to_name cache entry, so that subsequent sid_to_name queries return the expected netbiosname\name result and not realm.com\name. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13831 Signed-off-by: Christof Schmitt Reviewed-by: Volker Lendecke --- diff --git a/selftest/knownfail b/selftest/knownfail index 29cce4bc2f7..c588f2f5c6b 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -368,4 +368,3 @@ ^samba.tests.ntlmdisabled.python\(ktest\).python2.ntlmdisabled.NtlmDisabledTests.test_samr_change_password\(ktest\) ^samba.tests.ntlmdisabled.python\(ad_dc_no_ntlm\).python3.ntlmdisabled.NtlmDisabledTests.test_ntlm_connection\(ad_dc_no_ntlm\) ^samba.tests.ntlmdisabled.python\(ad_dc_no_ntlm\).python2.ntlmdisabled.NtlmDisabledTests.test_ntlm_connection\(ad_dc_no_ntlm\) -^samba3.wbinfo_name_lookup.Verify DOMAIN/USER output\(ad_member\) diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index 92a5e1d333b..abdfd11dc53 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -1794,6 +1794,7 @@ NTSTATUS wb_cache_name_to_sid(struct winbindd_domain *domain, { NTSTATUS status; bool old_status; + const char *dom_name; old_status = domain->online; @@ -1820,7 +1821,7 @@ NTSTATUS wb_cache_name_to_sid(struct winbindd_domain *domain, winbindd_domain_init_backend(domain); status = domain->backend->name_to_sid(domain, mem_ctx, domain_name, - name, flags, NULL, sid, type); + name, flags, &dom_name, sid, type); if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT) || NT_STATUS_EQUAL(status, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND)) { @@ -1855,7 +1856,7 @@ NTSTATUS wb_cache_name_to_sid(struct winbindd_domain *domain, } (void)strlower_m(discard_const_p(char, name)); wcache_save_sid_to_name(domain, status, sid, - domain_name, name, save_type); + dom_name, name, save_type); } }