s3-passdb: Fix negative SID->uid/gid/both cache handling
authorIra Cooper <ira@samba.org>
Thu, 24 May 2012 01:42:26 +0000 (21:42 -0400)
committerStefan Metzmacher <metze@samba.org>
Thu, 24 May 2012 20:30:23 +0000 (22:30 +0200)
-1 uid/gid/both signals a non existent uid/gid/both.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/passdb/lookup_sid.c

index 4ceba3cdd2d2f0d45fd6b0208e7133e11050e50a..3f8b06dfca96c8bdd2cd52cd63a51302bd1b25d3 100644 (file)
@@ -1347,6 +1347,20 @@ bool sids_to_unixids(const struct dom_sid *sids, uint32_t num_sids,
                }
        }
 done:
+       for (i=0; i<num_sids; i++) {
+               switch(ids[i].type) {
+               case WBC_ID_TYPE_GID:
+               case WBC_ID_TYPE_UID:
+               case WBC_ID_TYPE_BOTH:
+                       if (ids[i].id == -1) {
+                               ids[i].type = ID_TYPE_NOT_SPECIFIED;
+                       }
+                       break;
+               case WBC_ID_TYPE_NOT_SPECIFIED:
+                       break;
+               }
+       }
+
        ret = true;
 fail:
        TALLOC_FREE(wbc_ids);