s4:auth: make sure we have elements returned at all in authsam_expand_nested_groups()
authorStefan Metzmacher <metze@samba.org>
Fri, 31 Jul 2009 08:38:04 +0000 (10:38 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 31 Jul 2009 12:40:29 +0000 (14:40 +0200)
metze

source4/auth/sam.c

index b991090338b4a93543f102699f130d0140354954..6285c31e5cee79a2a9968cbb49a6e7af623c3b46 100644 (file)
@@ -333,6 +333,12 @@ static NTSTATUS authsam_expand_nested_groups(struct ldb_context *sam_ctx,
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
        }
 
+       if (res[0]->num_elements == 0) {
+               talloc_free(res);
+               talloc_free(tmp_ctx);
+               return NT_STATUS_OK;
+       }
+
        for (i = 0; i < res[0]->elements[0].num_values; i++) {
                tmp_dn = ldb_dn_from_ldb_val(tmp_ctx, sam_ctx,
                        &res[0]->elements[0].values[i]);