s3-passdb: Fix negative SID->uid/gid cache handling. (bug #8952)
authorIra Cooper <ira@samba.org>
Thu, 24 May 2012 01:39:03 +0000 (21:39 -0400)
committerKarolin Seeger <kseeger@samba.org>
Fri, 22 Jun 2012 19:48:51 +0000 (21:48 +0200)
-1 uid/gid signals a non existent uid/gid.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit baac32c43460ed5e78e7f8bb2304f79cae2b15ef)

source3/passdb/lookup_sid.c

index 5cf391f11c7376c87d9d32413039f64bf63c82ab..2afa86e0b6d910cfe946ac0a2bcc85cc4c6fe645 100644 (file)
@@ -1490,7 +1490,24 @@ bool sids_to_unix_ids(const struct dom_sid *sids, uint32_t num_sids,
                        continue;
                }
        }
+
 done:
+       for (i=0; i<num_sids; i++) {
+               switch(ids[i].type) {
+               case WBC_ID_TYPE_GID:
+                       if (ids[i].id.gid == (gid_t)-1) {
+                               ids[i].type = WBC_ID_TYPE_NOT_SPECIFIED;
+                       }
+                       break;
+               case WBC_ID_TYPE_UID:
+                       if (ids[i].id.uid == (uid_t)-1) {
+                               ids[i].type = WBC_ID_TYPE_NOT_SPECIFIED;
+                       }
+                       break;
+               case WBC_ID_TYPE_NOT_SPECIFIED:
+                       break;
+               }
+       }
        ret = true;
 fail:
        TALLOC_FREE(wbc_ids);