diff options
author | Garming Sam <garming@catalyst.net.nz> | 2014-02-14 18:04:22 +1300 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2014-03-05 16:33:22 +0100 |
commit | 0b8213ae1cd0129b7a50cf7ba3605512a990520f (patch) | |
tree | e30b7e9f85f1f391060101a833928904f44dbed0 | |
parent | 856c74e013eaa53902479b771e6c0cf1fea67745 (diff) | |
download | samba-0b8213ae1cd0129b7a50cf7ba3605512a990520f.tar.gz |
Remove all uses of the NT_STATUS_NOT_OK_RETURN_AND_FREE macro 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: I421e169275fe323e2b019c6cc5d386289aec07f7
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
-rw-r--r-- | source3/auth/auth_samba4.c | 10 | ||||
-rw-r--r-- | source4/auth/session.c | 5 | ||||
-rw-r--r-- | source4/ntvfs/posix/pvfs_acl.c | 15 | ||||
-rw-r--r-- | source4/rpc_server/lsa/dcesrv_lsa.c | 5 | ||||
-rw-r--r-- | source4/torture/util_smb.c | 5 | ||||
-rw-r--r-- | source4/wrepl_server/wrepl_in_call.c | 5 |
6 files changed, 36 insertions, 9 deletions
diff --git a/source3/auth/auth_samba4.c b/source3/auth/auth_samba4.c index 901acf9f8ac..0350fec3455 100644 --- a/source3/auth/auth_samba4.c +++ b/source3/auth/auth_samba4.c @@ -125,10 +125,16 @@ static NTSTATUS check_samba4_security(const struct auth_context *auth_context, NT_STATUS_NOT_OK_RETURN(nt_status); nt_status = auth_context_set_challenge(auth4_context, auth_context->challenge.data, "auth_samba4"); - NT_STATUS_NOT_OK_RETURN_AND_FREE(nt_status, auth4_context); + if (!NT_STATUS_IS_OK(nt_status)) { + TALLOC_FREE(auth4_context); + return nt_status; + } nt_status = auth_check_password(auth4_context, auth4_context, user_info, &user_info_dc); - NT_STATUS_NOT_OK_RETURN_AND_FREE(nt_status, auth4_context); + if (!NT_STATUS_IS_OK(nt_status)) { + TALLOC_FREE(auth4_context); + return nt_status; + } nt_status = auth_convert_user_info_dc_saminfo3(mem_ctx, user_info_dc, diff --git a/source4/auth/session.c b/source4/auth/session.c index 11f2766bc15..b4b4200337a 100644 --- a/source4/auth/session.c +++ b/source4/auth/session.c @@ -206,7 +206,10 @@ _PUBLIC_ NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx, sids, session_info_flags, &session_info->security_token); - NT_STATUS_NOT_OK_RETURN_AND_FREE(nt_status, tmp_ctx); + if (!NT_STATUS_IS_OK(nt_status)) { + TALLOC_FREE(tmp_ctx); + return nt_status; + } session_info->credentials = NULL; diff --git a/source4/ntvfs/posix/pvfs_acl.c b/source4/ntvfs/posix/pvfs_acl.c index b8632d2b46a..ad1787c8034 100644 --- a/source4/ntvfs/posix/pvfs_acl.c +++ b/source4/ntvfs/posix/pvfs_acl.c @@ -936,7 +936,10 @@ NTSTATUS pvfs_acl_inherited_sd(struct pvfs_state *pvfs, talloc_free(tmp_ctx); return NT_STATUS_OK; } - NT_STATUS_NOT_OK_RETURN_AND_FREE(status, tmp_ctx); + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(tmp_ctx); + return status; + } switch (acl->version) { case 1: @@ -979,7 +982,10 @@ NTSTATUS pvfs_acl_inherited_sd(struct pvfs_state *pvfs, ids[1].status = ID_UNKNOWN; status = wbc_xids_to_sids(pvfs->ntvfs->ctx->event_ctx, ids, 2); - NT_STATUS_NOT_OK_RETURN_AND_FREE(status, tmp_ctx); + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(tmp_ctx); + return status; + } sd->owner_sid = talloc_steal(sd, ids[0].sid); sd->group_sid = talloc_steal(sd, ids[1].sid); @@ -988,7 +994,10 @@ NTSTATUS pvfs_acl_inherited_sd(struct pvfs_state *pvfs, /* fill in the aces from the parent */ status = pvfs_acl_inherit_aces(pvfs, parent_sd, sd, container); - NT_STATUS_NOT_OK_RETURN_AND_FREE(status, tmp_ctx); + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(tmp_ctx); + return status; + } /* if there is nothing to inherit then we fallback to the default acl */ diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c index c1ddd90a58d..6063ebe09b1 100644 --- a/source4/rpc_server/lsa/dcesrv_lsa.c +++ b/source4/rpc_server/lsa/dcesrv_lsa.c @@ -84,7 +84,10 @@ static NTSTATUS dcesrv_build_lsa_sd(TALLOC_CTX *mem_ctx, TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx); status = dom_sid_split_rid(tmp_ctx, sid, &domain_sid, &rid); - NT_STATUS_NOT_OK_RETURN_AND_FREE(status, tmp_ctx); + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(tmp_ctx); + return status; + } domain_admins_sid = dom_sid_add_rid(tmp_ctx, domain_sid, DOMAIN_RID_ADMINS); if (domain_admins_sid == NULL) { diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c index 343c8a7f351..588ac055c7e 100644 --- a/source4/torture/util_smb.c +++ b/source4/torture/util_smb.c @@ -915,7 +915,10 @@ NTSTATUS torture_check_privilege(struct smbcli_state *cli, } status = dom_sid_split_rid(tmp_ctx, sid, NULL, &rid); - NT_STATUS_NOT_OK_RETURN_AND_FREE(status, tmp_ctx); + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(tmp_ctx); + return status; + } if (rid == DOMAIN_RID_ADMINISTRATOR) { /* assume the administrator has them all */ diff --git a/source4/wrepl_server/wrepl_in_call.c b/source4/wrepl_server/wrepl_in_call.c index 111d9a405ad..9fc723fd31e 100644 --- a/source4/wrepl_server/wrepl_in_call.c +++ b/source4/wrepl_server/wrepl_in_call.c @@ -369,7 +369,10 @@ static NTSTATUS wreplsrv_in_update(struct wreplsrv_in_call *call) TALLOC_FREE(wrepl_in->send_queue); status = wrepl_socket_donate_stream(wrepl_out->sock, &wrepl_in->tstream); - NT_STATUS_NOT_OK_RETURN_AND_FREE(status, update_state); + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(update_state); + return status; + } update_state->wrepl_in = wrepl_in; update_state->wrepl_out = wrepl_out; |