s4-dsdb: Add a check to prevent acl_modify from debuging a NULL message
authorBrendan Powers <brendan0powers@gmail.com>
Tue, 15 Dec 2009 01:32:28 +0000 (20:32 -0500)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 18 Dec 2009 03:27:43 +0000 (14:27 +1100)
Check to see if there were any messages passed to acl_modify before
debugging the first one. I think I caused this by some malformed
LDIF.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/samdb/ldb_modules/acl.c

index 6cb50b2098400321bacc5f825f7840c15e17be2d..b70b8956bb2f6ffafa289b724fce8728fa04b5db 100644 (file)
@@ -760,7 +760,11 @@ static int acl_modify(struct ldb_module *module, struct ldb_request *req)
                NULL
        };
 
-       DEBUG(10, ("ldb:acl_modify: %s\n", req->op.mod.message->elements[0].name));
+       /* Don't print this debug statement if elements[0].name is going to be NULL */
+       if(req->op.mod.message->num_elements > 0)
+       {
+               DEBUG(10, ("ldb:acl_modify: %s\n", req->op.mod.message->elements[0].name));
+       }
        if (what_is_user(module) == SECURITY_SYSTEM) {
                return ldb_next_request(module, req);
        }