The branch, v3-6-test has been updated
       via  19d20dc s3:winbind correct a copy&paste error
       via  5957f1d s3: Correctly calculate the wbinfo -s result
      from  bde0ecf Add in fsp->access_mask checks. Not required (underlying 
system does this) but makes logic cleaner. Pointed out by Metze.

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


- Log -----------------------------------------------------------------
commit 19d20dc0b17b328951255a8085d576792bbf3d80
Author: Christian Ambach <christian.amb...@de.ibm.com>
Date:   Wed Nov 24 11:57:59 2010 +0100

    s3:winbind correct a copy&paste error
    
    negative results of sid->gid lookups should be stored with
    idmap_cache_set_sid2gid instead of idmap_cache_set_sid2uid
    
    This seems to be a copy&paste error when similar logic from the
    sid2uid path was copied here in 84b88f4b.
    
    Autobuild-User: Volker Lendecke <vlen...@samba.org>
    Autobuild-Date: Wed Nov 24 16:53:01 CET 2010 on sn-devel-104

commit 5957f1de89018c14ec38bb6e72c4630a3b6c79d3
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Nov 23 14:28:45 2010 +0100

    s3: Correctly calculate the wbinfo -s result

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

Summary of changes:
 source3/rpc_client/cli_lsarpc.c |   34 +++++++++++++++++++++++++---------
 source3/winbindd/idmap_util.c   |    6 +++---
 2 files changed, 28 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c
index 823bdfa..35b2ca4 100644
--- a/source3/rpc_client/cli_lsarpc.c
+++ b/source3/rpc_client/cli_lsarpc.c
@@ -288,6 +288,8 @@ static NTSTATUS rpccli_lsa_lookup_sids_generic(struct 
rpc_pipe_client *cli,
        char **domains = NULL;
        char **names = NULL;
        enum lsa_SidType *types = NULL;
+       bool have_mapped = false;
+       bool have_unmapped = false;
 
        if (num_sids) {
                if (!(domains = TALLOC_ARRAY(mem_ctx, char *, num_sids))) {
@@ -347,14 +349,21 @@ static NTSTATUS rpccli_lsa_lookup_sids_generic(struct 
rpc_pipe_client *cli,
                        goto fail;
                }
 
-               /* adapt overall result */
-               if (( NT_STATUS_IS_OK(result) &&
-                    !NT_STATUS_IS_OK(hunk_result))
-                   ||
-                   ( NT_STATUS_EQUAL(result, NT_STATUS_NONE_MAPPED) &&
-                    !NT_STATUS_EQUAL(hunk_result, NT_STATUS_NONE_MAPPED)))
-               {
-                       result = STATUS_SOME_UNMAPPED;
+               if (NT_STATUS_IS_OK(hunk_result)) {
+                       have_mapped = true;
+               }
+               if (NT_STATUS_EQUAL(hunk_result, NT_STATUS_NONE_MAPPED)) {
+                       have_unmapped = true;
+               }
+               if (NT_STATUS_EQUAL(hunk_result, STATUS_SOME_UNMAPPED)) {
+                       int i;
+                       for (i=0; i<hunk_num_sids; i++) {
+                               if (hunk_types[i] == SID_NAME_UNKNOWN) {
+                                       have_unmapped = true;
+                               } else {
+                                       have_mapped = true;
+                               }
+                       }
                }
 
                sids_left -= hunk_num_sids;
@@ -368,7 +377,14 @@ static NTSTATUS rpccli_lsa_lookup_sids_generic(struct 
rpc_pipe_client *cli,
        *pdomains = domains;
        *pnames = names;
        *ptypes = types;
-       return result;
+
+       if (!have_mapped) {
+               return NT_STATUS_NONE_MAPPED;
+       }
+       if (have_unmapped) {
+               return STATUS_SOME_UNMAPPED;
+       }
+       return NT_STATUS_OK;
 
 fail:
        TALLOC_FREE(domains);
diff --git a/source3/winbindd/idmap_util.c b/source3/winbindd/idmap_util.c
index d743f8c..f44e613 100644
--- a/source3/winbindd/idmap_util.c
+++ b/source3/winbindd/idmap_util.c
@@ -131,7 +131,7 @@ backend:
                if (winbindd_use_idmap_cache()) {
                        struct dom_sid null_sid;
                        ZERO_STRUCT(null_sid);
-                       idmap_cache_set_sid2uid(&null_sid, gid);
+                       idmap_cache_set_sid2gid(&null_sid, gid);
                }
                DEBUG(10, ("gid [%lu] not mapped\n", (unsigned long)gid));
                return NT_STATUS_NONE_MAPPED;
@@ -257,7 +257,7 @@ backend:
                DEBUG(10, ("idmap_backends_sid_to_unixid failed: %s\n",
                           nt_errstr(ret)));
                if (winbindd_use_idmap_cache()) {
-                       idmap_cache_set_sid2uid(sid, -1);
+                       idmap_cache_set_sid2gid(sid, -1);
                }
                return ret;
        }
@@ -265,7 +265,7 @@ backend:
        if (map.status != ID_MAPPED) {
                DEBUG(10, ("sid [%s] is not mapped\n", sid_string_dbg(sid)));
                if (winbindd_use_idmap_cache()) {
-                       idmap_cache_set_sid2uid(sid, -1);
+                       idmap_cache_set_sid2gid(sid, -1);
                }
                return NT_STATUS_NONE_MAPPED;
        }


-- 
Samba Shared Repository

Reply via email to