diff options
-rw-r--r-- | source3/winbindd/winbindd_cache.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index d7499df673..86f15c2298 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -943,6 +943,15 @@ static void wcache_save_name_to_sid(struct winbindd_domain *domain, centry = centry_start(domain, status); if (!centry) return; + + if (domain_name[0] == '\0') { + struct winbindd_domain *mydomain = + find_domain_from_sid_noinit(sid); + if (mydomain != NULL) { + domain_name = mydomain->name; + } + } + centry_put_uint32(centry, type); centry_put_sid(centry, sid); fstrcpy(uname, name); @@ -963,6 +972,14 @@ static void wcache_save_sid_to_name(struct winbindd_domain *domain, NTSTATUS sta if (!centry) return; + if (domain_name[0] == '\0') { + struct winbindd_domain *mydomain = + find_domain_from_sid_noinit(sid); + if (mydomain != NULL) { + domain_name = mydomain->name; + } + } + if (NT_STATUS_IS_OK(status)) { centry_put_uint32(centry, type); centry_put_string(centry, domain_name); @@ -1793,6 +1810,10 @@ NTSTATUS wcache_name_to_sid(struct winbindd_domain *domain, return NT_STATUS_NO_MEMORY; } + if (domain_name[0] == '\0') { + domain_name = domain->name; + } + centry = wcache_fetch(cache, domain, "NS/%s/%s", domain_name, uname); TALLOC_FREE(uname); if (centry == NULL) { |