The branch, master has been updated
       via  1092d4b0a8e s3:winbindd: Update non cache entries keys 
(non_centry_keys)
       via  26d87d1fefa s3:winbindd: Use TDB_REPLACE in tdb_store
      from  68a1200f66e Restore empty string default for conf.env['icu-libs']

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


- Log -----------------------------------------------------------------
commit 1092d4b0a8e6d988e6bcbbd5e7cce7e34fc1ed54
Author: Pavel Filipenský <pfilipen...@samba.org>
Date:   Fri Mar 22 13:51:06 2024 +0100

    s3:winbindd: Update non cache entries keys (non_centry_keys)
    
    This change does NOT affect WHAT and HOW is cached. It only avoids
    undefined behavior for "NDR" and "TRUSTDOMCACHE" when processed in
    wcache_flush_cache() and wbcache_upgrade_v1_to_v2().
    
    winbindd_cache.tdb contains two types of entries:
    
    1) cache entries (typed as 'struct cache_entry')
      - internal format is:           [ntstatus; sequence_number; timeout]
    
    2) non cache entries (keys listed in non_centry_keys)
      - for "NDR" internal format is: [sequence_number; timeout]
    
    Without this commit, "NDR" would be processed as the first type (instead
    as the second type). E.g. in the stack below:
    
    wcache_fetch_raw()
    traverse_fn_cleanup()
    wcache_flush_cache()
    
    the triplet [ntstatus; sequence_number; timeout] would be initialized
    from data containing only [sequence_number; timeout], leading to
    mismatched values ('ntstatus' would be filled from 'sequence_number').
    
    Anyway, current code is never calling wcache_flush_cache(), since
    wcache_flush_cache() can be called only from get_cache() and get_cache()
    will call it only if global/static wcache was not set yet. But wcache is
    set very early in the main winbind (and all winbind children get it
    after fork), sooner than any call of get_cache() can happen:
    
       #1 init_wcache + 0x19
       #2 initialize_winbindd_cache + 0x35
       #3 winbindd_cache_validate_and_initialize + 0x25
       #4 main + 0x806
    
    Signed-off-by: Pavel Filipenský <pfilipen...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Tue May 14 21:04:57 UTC 2024 on atb-devel-224

commit 26d87d1fefa67b759bc369983b4c55fcd007dca9
Author: Pavel Filipenský <pfilipen...@samba.org>
Date:   Tue May 7 13:01:02 2024 +0200

    s3:winbindd: Use TDB_REPLACE in tdb_store
    
    tdb_store() should use as a flag TDB_REPLACE instead of undocumented 0
    
    Signed-off-by: Pavel Filipenský <pfilipen...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

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

Summary of changes:
 source3/winbindd/winbindd_cache.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/winbindd/winbindd_cache.c 
b/source3/winbindd/winbindd_cache.c
index ca2341ef456..833862ab99e 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -68,7 +68,9 @@ static bool opt_nocache = False;
  */
 
 static const char *non_centry_keys[] = {
+       "NDR/",
        "SEQNUM/",
+       "TRUSTDOMCACHE/",
        "WINBINDD_OFFLINE",
        WINBINDD_CACHE_VERSION_KEYSTR,
        NULL
@@ -4605,7 +4607,7 @@ static bool wcache_tdc_store_list( struct 
winbindd_tdc_domain *domains, size_t n
                goto done;
        }
 
-       ret = tdb_store( wcache->tdb, key, data, 0 );
+       ret = tdb_store(wcache->tdb, key, data, TDB_REPLACE);
 
  done:
        SAFE_FREE( data.dptr );
@@ -4922,7 +4924,7 @@ void wcache_store_ndr(struct winbindd_domain *domain, 
uint32_t opnum,
        SBVAL(data.dptr, 4, timeout);
        memcpy(data.dptr + 12, resp->data, resp->length);
 
-       tdb_store(wcache->tdb, key, data, 0);
+       tdb_store(wcache->tdb, key, data, TDB_REPLACE);
 
 done:
        TALLOC_FREE(key.dptr);


-- 
Samba Shared Repository

Reply via email to