]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Fix allocation of conn->vuid_cache entries
authorVolker Lendecke <vl@samba.org>
Mon, 5 May 2008 12:43:57 +0000 (14:43 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 5 May 2008 12:46:03 +0000 (14:46 +0200)
With the old code, if more than VUID_CACHE_SIZE elements were used all new
entries ended up in slot 0. With this checkin we do cycle.

Jeremy, please revert if the old behaviour was intentional
(This used to be commit 50c891d3dfb75c9f607f7ad2a578aa3ba5d91988)

source3/smbd/uid.c

index ffa643a8f56b5ebe23c8423b3a053b494e22b8fd..343a0cf4905e7c55cacd71dfa960c3ce061b9c02 100644 (file)
@@ -123,9 +123,9 @@ static bool check_user_ok(connection_struct *conn, user_struct *vuser,int snum)
                return False;
        }
 
-       i = conn->vuid_cache.entries % VUID_CACHE_SIZE;
-       if (conn->vuid_cache.entries < VUID_CACHE_SIZE)
-               conn->vuid_cache.entries++;
+       i = conn->vuid_cache.entries;
+       conn->vuid_cache.entries =
+               (conn->vuid_cache.entries + 1) % VUID_CACHE_SIZE;
 
        ent = &conn->vuid_cache.array[i];
        ent->vuid = vuser->vuid;