Remove all uses of the NT_STATUS_NOT_OK_RETURN_AND_FREE macro from the codebase.
authorGarming Sam <garming@catalyst.net.nz>
Fri, 14 Feb 2014 05:04:22 +0000 (18:04 +1300)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 5 Mar 2014 15:33:22 +0000 (16:33 +0100)
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>
source3/auth/auth_samba4.c
source4/auth/session.c
source4/ntvfs/posix/pvfs_acl.c
source4/rpc_server/lsa/dcesrv_lsa.c
source4/torture/util_smb.c
source4/wrepl_server/wrepl_in_call.c

index 901acf9f8ac1c6772d8702f0817346527748436c..0350fec34557f8355b8b232ab2c052a60aa472f8 100644 (file)
@@ -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,
index 11f2766bc153b95d032420502198ace539410da3..b4b4200337ac20adfbee3d49eed1e33538f0bc4f 100644 (file)
@@ -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;
 
index b8632d2b46a257785900d2243ca754796d7c4457..ad1787c8034f0f94b0a1f8476709caacc8703504 100644 (file)
@@ -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 */
index c1ddd90a58d12990bf479c7cbeb176ae470d29c8..6063ebe09b1e3866f805e49429b63ab2867a3ce5 100644 (file)
@@ -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) {
index 343c8a7f351142a07858a9202cc0c42df65e700f..588ac055c7ed458f7b4a8a1140056e863d3744da 100644 (file)
@@ -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 */
index 111d9a405ad1e52645f7777275eaa18f561af06e..9fc723fd31e01eccae7c0ce433a96d7f05c76de7 100644 (file)
@@ -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;