winbind cache bug

Gavrie Philipson gavrie at
Tue Sep 10 09:55:01 GMT 2002


I think I've found a bug in the winbind caching mechanism.
In winbindd_cache.c, in the function query_user, the user info is looked
up in the cache. If it isn't found, the info structure is initialized to
zero and the backend (winbindd_rpc in my case) is called to retrieve the
user info.
However, the query_user method in winbindd_rpc doesn't fill in the
user_rid field of the user_info structure, causing the user_rid to
always remain zero.
This, in turn, causes the cache to always store an entry for a user with
a zero RID (instead of with the correct RID), which of course causes a
cache miss next time.

The following little patch solves the problem:

samba-3.0-alpha19/source/nsswitch/winbindd_rpc.c nsswitch/winbindd_rpc.c
--- old/nsswitch/winbindd_rpc.c        Sat Aug 17 16:35:21 2002
+++ new/nsswitch/winbindd_rpc.c     Tue Sep 10 12:17:02 2002
@@ -315,6 +315,7 @@
        cli_samr_close(hnd->cli, mem_ctx, &user_pol);
        got_user_pol = False;

+       user_info->user_rid = user_rid;
        user_info->group_rid = ctr->info.id21->group_rid;
        user_info->acct_name = unistr2_tdup(mem_ctx,

Gavrie Philipson
DiskSites Ltd.

More information about the samba-technical mailing list