From 75729e6703c5b5dff7feefed590086898fc03c74 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 11 Dec 2012 02:00:38 +0100 Subject: libcli/security: implement object_in_list() Signed-off-by: Stefan Metzmacher Reviewed-by: Michael Adam --- libcli/security/create_descriptor.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'libcli/security') diff --git a/libcli/security/create_descriptor.c b/libcli/security/create_descriptor.c index 0cac2e4a5f..1456d84e57 100644 --- a/libcli/security/create_descriptor.c +++ b/libcli/security/create_descriptor.c @@ -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 */ -- cgit