The branch, v3-6-test has been updated
       via  afcbaf3 BUG 9766: Cache name_to_sid/sid_to_name correctly.
      from  d9b8bd0 BUG 9139: Fix the username map optimization.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit afcbaf373a1959f2323ffa729886b688c2b965e3
Author: Andreas Schneider <[email protected]>
Date:   Thu Apr 4 12:18:25 2013 +0200

    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 <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>
    Signed-off-by: Andreas Schneider <[email protected]>
    
    Autobuild-User(master): Günther Deschner <[email protected]>
    Autobuild-Date(master): Tue Apr  9 16:32:44 CEST 2013 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 source3/winbindd/winbindd_cache.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/winbindd/winbindd_cache.c 
b/source3/winbindd/winbindd_cache.c
index 81b9b17..033ea77 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -945,6 +945,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);
@@ -965,6 +974,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);
@@ -1781,6 +1798,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) {


-- 
Samba Shared Repository

Reply via email to