idmap: Store negative cache entries if the backend fails
authorVolker Lendecke <vl@samba.org>
Fri, 3 May 2013 10:28:59 +0000 (10:28 +0000)
committerMichael Adam <obnox@samba.org>
Fri, 3 May 2013 12:48:35 +0000 (14:48 +0200)
This changes the behaviour for out-of-range queries: The tdb backend
(probably all backends) returns NT_STATUS_NONE_MAPPED and does not set the
map.status value to ID_UNMAPPED. This means that we did an early error
exit, not setting a negative cache value. This makes smbd ask winbind
over and over again for out-of-range gids, which can be a performance
problem in certain scenarios.

The new code makes us fall through to the code setting the negative
cache entry in all cases.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Fri May  3 14:48:35 CEST 2013 on sn-devel-104

source3/winbindd/idmap_util.c

index 7bd81a141d25b373e9245f62678a75828c7a0ad3..e671acf837e0db3813c6aa51f1998a81b9147768 100644 (file)
@@ -70,7 +70,7 @@ backend:
        if ( ! NT_STATUS_IS_OK(ret)) {
                DEBUG(10, ("error mapping uid [%lu]: %s\n", (unsigned long)uid,
                           nt_errstr(ret)));
-               return ret;
+               map.status = ID_UNMAPPED;
        }
 
        if (map.status != ID_MAPPED) {
@@ -134,7 +134,7 @@ backend:
        if ( ! NT_STATUS_IS_OK(ret)) {
                DEBUG(10, ("error mapping gid [%lu]: %s\n", (unsigned long)gid,
                           nt_errstr(ret)));
-               return ret;
+               map.status = ID_UNMAPPED;
        }
 
        if (map.status != ID_MAPPED) {