summaryrefslogtreecommitdiffstats
path: root/source3/passdb/pdb_samba_dsdb.c
diff options
context:
space:
mode:
authorGarming Sam <garming@catalyst.net.nz>2014-02-13 17:51:11 +1300
committerAndreas Schneider <asn@cryptomilk.org>2014-03-05 16:33:21 +0100
commit952bc3cad05467959ba5aa08682d754bd80d543b (patch)
treeec59adb15fc07fbc6c50b9eeeeb17a7dada26905 /source3/passdb/pdb_samba_dsdb.c
parent1f60aa8ec2e685517235aadbc11324d3b4a1a74d (diff)
downloadsamba-952bc3cad05467959ba5aa08682d754bd80d543b.tar.gz
samba-952bc3cad05467959ba5aa08682d754bd80d543b.tar.xz
samba-952bc3cad05467959ba5aa08682d754bd80d543b.zip
Remove a number of NT_STATUS_HAVE_NO_MEMORY_AND_FREE macros from the codebase.
Following the current coding guidelines, it is considered bad practice to return from within a macro and change control flow as they look like normal function calls. Change-Id: I133eb5a699757ae57b87d3bd3ebbcf5b556b0268 Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/passdb/pdb_samba_dsdb.c')
-rw-r--r--source3/passdb/pdb_samba_dsdb.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/source3/passdb/pdb_samba_dsdb.c b/source3/passdb/pdb_samba_dsdb.c
index 3fc266c4e26..dee20efbf84 100644
--- a/source3/passdb/pdb_samba_dsdb.c
+++ b/source3/passdb/pdb_samba_dsdb.c
@@ -1172,7 +1172,10 @@ static NTSTATUS pdb_samba_dsdb_enum_group_members(struct pdb_methods *m,
}
*pmembers = members = talloc_array(mem_ctx, uint32_t, num_sids);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(*pmembers, tmp_ctx);
+ if (*pmembers == NULL) {
+ TALLOC_FREE(tmp_ctx);
+ return NT_STATUS_NO_MEMORY;
+ }
num_members = 0;
for (i = 0; i < num_sids; i++) {
@@ -1392,7 +1395,10 @@ static NTSTATUS pdb_samba_dsdb_mod_groupmem_by_sid(struct pdb_methods *m,
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
msg = ldb_msg_new(tmp_ctx);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(msg, tmp_ctx);
+ if (msg == NULL) {
+ TALLOC_FREE(tmp_ctx);
+ return NT_STATUS_NO_MEMORY;
+ }
msg->dn = ldb_dn_new_fmt(msg, state->ldb, "<SID=%s>", dom_sid_string(tmp_ctx, groupsid));
if (!msg->dn || !ldb_dn_validate(msg->dn)) {
@@ -1441,9 +1447,15 @@ static NTSTATUS pdb_samba_dsdb_mod_groupmem(struct pdb_methods *m,
dom_sid = samdb_domain_sid(state->ldb);
groupsid = dom_sid_add_rid(tmp_ctx, dom_sid, grouprid);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(groupsid, tmp_ctx);
+ if (groupsid == NULL) {
+ TALLOC_FREE(tmp_ctx);
+ return NT_STATUS_NO_MEMORY;
+ }
membersid = dom_sid_add_rid(tmp_ctx, dom_sid, memberrid);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(membersid, tmp_ctx);
+ if (membersid == NULL) {
+ TALLOC_FREE(tmp_ctx);
+ return NT_STATUS_NO_MEMORY;
+ }
status = pdb_samba_dsdb_mod_groupmem_by_sid(m, tmp_ctx, groupsid, membersid, mod_op);
talloc_free(tmp_ctx);
return status;
@@ -1708,10 +1720,16 @@ static NTSTATUS pdb_samba_dsdb_enum_alias_memberships(struct pdb_methods *m,
for (i = 0; i < num_members; i++) {
sid_string = dom_sid_string(tmp_ctx, &members[i]);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sid_string, tmp_ctx);
+ if (sid_string == NULL) {
+ TALLOC_FREE(tmp_ctx);
+ return NT_STATUS_NO_MEMORY;
+ }
sid_dn = talloc_asprintf(tmp_ctx, "<SID=%s>", sid_string);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sid_dn, tmp_ctx);
+ if (sid_dn == NULL) {
+ TALLOC_FREE(tmp_ctx);
+ return NT_STATUS_NO_MEMORY;
+ }
sid_blob = data_blob_string_const(sid_dn);