The branch, master has been updated
       via  3c74117 s3:idmap_cache: also store negative entries for unknown sids
       via  a65173a s3:winbindd: do not expose negative cache idmap entries as 
valid mappings (bug #9002)
       via  2481158 s3:winbindd: discard the expired gid cache if we're online 
(bug #9002)
      from  a7f4c2b s3: Remove an unnecessary ()

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3c74117e2eb6616b8f539807ae8824d963f7987c
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jun 20 14:07:51 2012 +0200

    s3:idmap_cache: also store negative entries for unknown sids
    
    metze
    
    Autobuild-User(master): Stefan Metzmacher <me...@samba.org>
    Autobuild-Date(master): Thu Jun 21 18:04:05 CEST 2012 on sn-devel-104

commit a65173ae68a489875a2758b7e0b5640e9ac412fe
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu May 24 09:08:21 2012 +0200

    s3:winbindd: do not expose negative cache idmap entries as valid mappings 
(bug #9002)
    
    metze

commit 2481158a16f530d1f2d7dc64a09d6b9b2ae07045
Author: Stefan Metzmacher <me...@samba.org>
Date:   Fri Mar 2 05:08:17 2012 +0100

    s3:winbindd: discard the expired gid cache if we're online (bug #9002)
    
    This matches the uid case...
    
    metze

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

Summary of changes:
 source3/lib/idmap_cache.c                |    7 +++++++
 source3/winbindd/winbindd_sids_to_xids.c |   27 ++++++++++++++++++++-------
 2 files changed, 27 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/idmap_cache.c b/source3/lib/idmap_cache.c
index 011a017..edf37a8 100644
--- a/source3/lib/idmap_cache.c
+++ b/source3/lib/idmap_cache.c
@@ -89,6 +89,10 @@ bool idmap_cache_find_sid2unixid(const struct dom_sid *sid, 
struct unixid *id,
                        tmp_id.type = ID_TYPE_BOTH;
                        break;
 
+               case 'N':
+                       tmp_id.type = ID_TYPE_NOT_SPECIFIED;
+                       break;
+
                case '\0':
                        DEBUG(0, ("FAILED to parse value for key [%s] "
                                  "(id=[%llu], endptr=[%s]): "
@@ -289,6 +293,9 @@ void idmap_cache_set_sid2unixid(const struct dom_sid *sid, 
struct unixid *unix_i
                case ID_TYPE_BOTH:
                        fstr_sprintf(value, "%d:B", (int)unix_id->id);
                        break;
+               case ID_TYPE_NOT_SPECIFIED:
+                       fstr_sprintf(value, "%d:N", (int)unix_id->id);
+                       break;
                default:
                        return;
                }
diff --git a/source3/winbindd/winbindd_sids_to_xids.c 
b/source3/winbindd/winbindd_sids_to_xids.c
index 8201739..09d9a9b 100644
--- a/source3/winbindd/winbindd_sids_to_xids.c
+++ b/source3/winbindd/winbindd_sids_to_xids.c
@@ -130,7 +130,7 @@ static bool winbindd_sids_to_xids_in_cache(struct dom_sid 
*sid,
                return false;
        }
        if (idmap_cache_find_sid2unixid(sid, &id, &expired)) {
-               if (expired && is_domain_offline(find_our_domain())) {
+               if (expired && is_domain_online(find_our_domain())) {
                        return false;
                }
                map->sid = sid;
@@ -240,22 +240,30 @@ NTSTATUS winbindd_sids_to_xids_recv(struct tevent_req 
*req,
 
        for (i=0; i<state->num_sids; i++) {
                char type;
-               uint64_t unix_id = (uint64_t)-1;
+               uint32_t unix_id = UINT32_MAX;
                bool found = true;
 
                if (state->cached[i].sid != NULL) {
                        unix_id = state->cached[i].xid.id;
-                       if (state->cached[i].xid.type == ID_TYPE_UID) {
+
+                       switch (state->cached[i].xid.type) {
+                       case ID_TYPE_UID:
                                type = 'U';
-                       } else {
+                               break;
+                       case ID_TYPE_GID:
                                type = 'G';
+                               break;
+                       case ID_TYPE_BOTH:
+                               type = 'B';
+                               break;
+                       default:
+                               found = false;
+                               break;
                        }
                } else {
                        struct unixid id;
+
                        unix_id = state->ids.ids[num_non_cached].unix_id;
-                       if (unix_id == -1) {
-                               found = false;
-                       }
 
                        id.id = unix_id;
                        id.type = state->ids.ids[num_non_cached].type;
@@ -275,10 +283,15 @@ NTSTATUS winbindd_sids_to_xids_recv(struct tevent_req 
*req,
                                break;
                        default:
                                found = false;
+                               break;
                        }
                        num_non_cached += 1;
                }
 
+               if (unix_id == UINT32_MAX) {
+                       found = false;
+               }
+
                if (found) {
                        result = talloc_asprintf_append_buffer(
                                result, "%c%lu\n", type,


-- 
Samba Shared Repository

Reply via email to