libcli/security: implement object_in_list()
authorStefan Metzmacher <metze@samba.org>
Tue, 11 Dec 2012 01:00:38 +0000 (02:00 +0100)
committerMichael Adam <obnox@samba.org>
Tue, 11 Dec 2012 03:45:54 +0000 (04:45 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
libcli/security/create_descriptor.c

index 0cac2e4a5fc656b153a0f60224987e61a679cd36..1456d84e57d85a458eab2f0023ea9df875befa27 100644 (file)
@@ -80,9 +80,30 @@ uint32_t map_generic_rights_ds(uint32_t access_mask)
 * and it does not seem to have any influence */
 static bool object_in_list(struct GUID *object_list, struct GUID *object)
 {
-       return true;
+       size_t i;
+
+       if (object_list == NULL) {
+               return true;
+       }
+
+       if (GUID_all_zero(object)) {
+               return true;
+       }
+
+       for (i=0; ; i++) {
+               if (GUID_all_zero(&object_list[i])) {
+                       return false;
+               }
+               if (!GUID_equal(&object_list[i], object)) {
+                       continue;
+               }
+
+               return true;
+       }
+
+       return false;
 }
+
 /* returns true if the ACE gontains generic information
  * that needs to be processed additionally */