Fix a valgrind error in _samr_LookupNames
authorVolker Lendecke <vl@samba.org>
Tue, 20 May 2008 15:29:40 +0000 (17:29 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 20 May 2008 15:51:38 +0000 (17:51 +0200)
(cherry picked from commit fb0a25d59ddd28ea1d5af33ec7d9f817fac3fb9d)
(This used to be commit 89f87efa2394e99802ca23307e712fc5820a5fc6)

source3/rpc_server/srv_samr_nt.c

index f28c771d3ed3b5b7d7fd53ec61c29cedd81c14ea..42431bd482512987194a9ef74fed726d0ec86b8a 100644 (file)
@@ -1786,8 +1786,8 @@ NTSTATUS _samr_LookupNames(pipes_struct *p,
                           struct samr_LookupNames *r)
 {
        NTSTATUS status;
-       uint32 rid[MAX_SAM_ENTRIES];
-       enum lsa_SidType type[MAX_SAM_ENTRIES];
+       uint32 *rid;
+       enum lsa_SidType *type;
        int i;
        int num_rids = r->in.num_names;
        DOM_SID pol_sid;
@@ -1796,9 +1796,6 @@ NTSTATUS _samr_LookupNames(pipes_struct *p,
 
        DEBUG(5,("_samr_LookupNames: %d\n", __LINE__));
 
-       ZERO_ARRAY(rid);
-       ZERO_ARRAY(type);
-
        if (!get_lsa_policy_samr_sid(p, r->in.domain_handle, &pol_sid, &acc_granted, NULL)) {
                return NT_STATUS_OBJECT_TYPE_MISMATCH;
        }
@@ -1815,6 +1812,12 @@ NTSTATUS _samr_LookupNames(pipes_struct *p,
                DEBUG(5,("_samr_LookupNames: truncating entries to %d\n", num_rids));
        }
 
+       rid = talloc_array(p->mem_ctx, uint32, num_rids);
+       NT_STATUS_HAVE_NO_MEMORY(rid);
+
+       type = talloc_array(p->mem_ctx, enum lsa_SidType, num_rids);
+       NT_STATUS_HAVE_NO_MEMORY(rid);
+
        DEBUG(5,("_samr_LookupNames: looking name on SID %s\n",
                 sid_string_dbg(&pol_sid)));