summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2013-04-04 12:18:25 +0200
committerGünther Deschner <gd@samba.org>2013-04-09 16:32:44 +0200
commit045c446b5a3ffc7e56d46ac4aa4acae9d27d9f49 (patch)
tree5b9f6c5cdbaa31f7bdfe766dc2779b71e30c1cd7 /source3/winbindd
parentb7c0330b7429ce1b9cda8b1c2446b3a21cbd29db (diff)
downloadsamba-045c446b5a3ffc7e56d46ac4aa4acae9d27d9f49.tar.gz
samba-045c446b5a3ffc7e56d46ac4aa4acae9d27d9f49.tar.bz2
samba-045c446b5a3ffc7e56d46ac4aa4acae9d27d9f49.zip
BUG 9766: Cache name_to_sid/sid_to_name correctly.
If there is no domain_name specified we still need to set to for caching else we will not find the entry later if we lookup the entry with the domain_name. Reviewed-by: Guenther Deschner <gd@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Tue Apr 9 16:32:44 CEST 2013 on sn-devel-104
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/winbindd_cache.c21
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) {