lib: Make idmap_cache return negative mappings
authorVolker Lendecke <vl@samba.org>
Mon, 25 Feb 2019 13:38:50 +0000 (14:38 +0100)
committerVolker Lendecke <vl@samba.org>
Thu, 28 Feb 2019 12:57:23 +0000 (12:57 +0000)
Without this we'd query non-existent mappings over and over
again.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813

source3/lib/idmap_cache.c

index 77618dd5aa1489630a825794809148383d71f3a2..244a727e01bda72f0353df8660e85b03aa10c6b7 100644 (file)
@@ -215,7 +215,12 @@ static void idmap_cache_xid2sid_parser(const struct gencache_timeout *timeout,
 
        value = (char *)blob.data;
 
-       if (value[0] != '-') {
+       if ((value[0] == '-') && (value[1] == '\0')) {
+               /*
+                * Return NULL SID, see comment to uid2sid
+                */
+               state->ret = true;
+       } else {
                state->ret = string_to_sid(state->sid, value);
        }
        if (state->ret) {