From 0a2910152aaafa1c7d484f8a0ade869d7962d4e3 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 3 May 2013 10:28:59 +0000 Subject: [PATCH] idmap: Store negative cache entries if the backend fails 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 Reviewed-by: Michael Adam Autobuild-User(master): Michael Adam Autobuild-Date(master): Fri May 3 14:48:35 CEST 2013 on sn-devel-104 --- source3/winbindd/idmap_util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/winbindd/idmap_util.c b/source3/winbindd/idmap_util.c index 7bd81a141d2..e671acf837e 100644 --- a/source3/winbindd/idmap_util.c +++ b/source3/winbindd/idmap_util.c @@ -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) { -- 2.34.1