diff options
author | Volker Lendecke <vlendec@samba.org> | 2005-11-26 22:04:28 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:05:36 -0500 |
commit | 046a8873b9001662eff7bbdf549d2a511216c092 (patch) | |
tree | b254d6ecf8b3266cc964bb66f45ea3cb05a2f8cd /source3/passdb/pdb_ldap.c | |
parent | fcf14ebee21378064187dd4389c01d8eaea3ca2a (diff) | |
download | samba-046a8873b9001662eff7bbdf549d2a511216c092.tar.gz samba-046a8873b9001662eff7bbdf549d2a511216c092.tar.bz2 samba-046a8873b9001662eff7bbdf549d2a511216c092.zip |
r11922: Looks bigger than it is: There's no point in allocating arrays in
samr_lookup_rids twice. It was done in the srv_samr_nt.c code as well as in
the pdb module. Remove the latter, this might happen more often.
Volker
(This used to be commit 57f0cf8cdd6928f4759036e5dd53d41736aa910d)
Diffstat (limited to 'source3/passdb/pdb_ldap.c')
-rw-r--r-- | source3/passdb/pdb_ldap.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index ef9eb81fbb..1254dba2b8 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -3514,12 +3514,11 @@ static NTSTATUS ldapsam_get_account_policy(struct pdb_methods *methods, int poli } static NTSTATUS ldapsam_lookup_rids(struct pdb_methods *methods, - TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid, int num_rids, uint32 *rids, - const char ***names, - uint32 **attrs) + const char **names, + uint32 *attrs) { struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)methods->private_data; @@ -3532,7 +3531,7 @@ static NTSTATUS ldapsam_lookup_rids(struct pdb_methods *methods, NTSTATUS result = NT_STATUS_UNSUCCESSFUL; if (!lp_parm_bool(-1, "ldapsam", "trusted", False)) - return pdb_default_lookup_rids(methods, mem_ctx, domain_sid, + return pdb_default_lookup_rids(methods, domain_sid, num_rids, rids, names, attrs); if (!sid_equal(domain_sid, get_global_sam_sid())) { @@ -3541,14 +3540,8 @@ static NTSTATUS ldapsam_lookup_rids(struct pdb_methods *methods, goto done; } - (*names) = TALLOC_ZERO_ARRAY(mem_ctx, const char *, num_rids); - (*attrs) = TALLOC_ARRAY(mem_ctx, uint32, num_rids); - - if ((num_rids != 0) && (((*names) == NULL) || ((*attrs) == NULL))) - return NT_STATUS_NO_MEMORY; - for (i=0; i<num_rids; i++) - (*attrs)[i] = SID_NAME_UNKNOWN; + attrs[i] = SID_NAME_UNKNOWN; allsids = SMB_STRDUP(""); if (allsids == NULL) return NT_STATUS_NO_MEMORY; @@ -3618,9 +3611,9 @@ static NTSTATUS ldapsam_lookup_rids(struct pdb_methods *methods, continue; } - (*attrs)[rid_index] = SID_NAME_USER; - (*names)[rid_index] = talloc_strdup(mem_ctx, str); - if ((*names)[rid_index] == NULL) return NT_STATUS_NO_MEMORY; + attrs[rid_index] = SID_NAME_USER; + names[rid_index] = talloc_strdup(names, str); + if (names[rid_index] == NULL) return NT_STATUS_NO_MEMORY; num_mapped += 1; } @@ -3683,9 +3676,9 @@ static NTSTATUS ldapsam_lookup_rids(struct pdb_methods *methods, continue; } - (*attrs)[rid_index] = SID_NAME_DOM_GRP; - (*names)[rid_index] = talloc_strdup(mem_ctx, str); - if ((*names)[rid_index] == NULL) return NT_STATUS_NO_MEMORY; + attrs[rid_index] = SID_NAME_DOM_GRP; + names[rid_index] = talloc_strdup(names, str); + if (names[rid_index] == NULL) return NT_STATUS_NO_MEMORY; num_mapped += 1; } |