]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libnetapi: Save lines with any_nt_status_not_ok()
authorVolker Lendecke <vl@samba.org>
Sun, 25 Jul 2021 08:26:30 +0000 (10:26 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 6 Aug 2021 17:22:30 +0000 (17:22 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/netapi/group.c
source3/lib/netapi/localgroup.c
source3/lib/netapi/samr.c
source3/lib/netapi/user.c

index e0b7458e58cfaf25d000ea098ac163777d19fdb7..5258549ce66a98ba1c7d83a568f901b7bd99d8b0 100644 (file)
@@ -120,14 +120,10 @@ WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx,
                                               &rid,
                                               &result);
 
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        switch (r->in.level) {
                case 1:
@@ -152,14 +148,11 @@ WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx,
                                                                  GROUPINFODESCRIPTION,
                                                                  &info,
                                                                  &result);
-                               if (!NT_STATUS_IS_OK(status)) {
+                               if (any_nt_status_not_ok(
+                                           status, result, &status)) {
                                        werr = ntstatus_to_werror(status);
                                        goto failed;
                                }
-                               if (!NT_STATUS_IS_OK(result)) {
-                                       werr = ntstatus_to_werror(result);
-                                       goto failed;
-                               }
                        }
 
                        if (info2->grpi2_attributes != 0) {
@@ -182,14 +175,11 @@ WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx,
                                                                  GROUPINFODESCRIPTION,
                                                                  &info,
                                                                  &result);
-                               if (!NT_STATUS_IS_OK(status)) {
+                               if (any_nt_status_not_ok(
+                                           status, result, &status)) {
                                        werr = ntstatus_to_werror(status);
                                        goto failed;
                                }
-                               if (!NT_STATUS_IS_OK(result)) {
-                                       werr = ntstatus_to_werror(result);
-                                       goto failed;
-                               }
                        }
 
                        if (info3->grpi3_attributes != 0) {
@@ -205,14 +195,10 @@ WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx,
                        break;
        }
 
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto failed;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto failed;
-       }
 
        werr = WERR_OK;
        goto done;
@@ -300,14 +286,10 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx,
                                         &rids,
                                         &types,
                                         &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        if (rids.count != 1) {
                werr = WERR_BAD_NET_RESP;
@@ -333,28 +315,20 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx,
                                       rids.ids[0],
                                       &group_handle,
                                       &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        status = dcerpc_samr_QueryGroupInfo(b, talloc_tos(),
                                            &group_handle,
                                            GROUPINFOATTRIBUTES,
                                            &info,
                                            &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
 #if 0
        /* breaks against NT4 */
@@ -367,14 +341,10 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx,
                                              &group_handle,
                                              &rid_array,
                                              &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        {
        struct lsa_Strings names;
@@ -387,14 +357,10 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx,
                                        &names,
                                        &member_types,
                                        &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
        if (names.count != rid_array->count) {
                werr = WERR_BAD_NET_RESP;
                goto done;
@@ -411,27 +377,19 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx,
                                                       &group_handle,
                                                       rid_array->rids[i],
                                                       &result);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (any_nt_status_not_ok(status, result, &status)) {
                        werr = ntstatus_to_werror(status);
                        goto done;
                }
-               if (!NT_STATUS_IS_OK(result)) {
-                       werr = ntstatus_to_werror(result);
-                       goto done;
-               }
        }
 
        status = dcerpc_samr_DeleteDomainGroup(b, talloc_tos(),
                                               &group_handle,
                                               &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        ZERO_STRUCT(group_handle);
 
@@ -520,14 +478,10 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx,
                                         &rids,
                                         &types,
                                         &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
        if (rids.count != 1) {
                werr = WERR_BAD_NET_RESP;
                goto done;
@@ -549,14 +503,10 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx,
                                       rids.ids[0],
                                       &group_handle,
                                       &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        switch (r->in.level) {
                case 0:
@@ -585,14 +535,10 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx,
                                                          GROUPINFODESCRIPTION,
                                                          &info,
                                                          &result);
-                       if (!NT_STATUS_IS_OK(status)) {
+                       if (any_nt_status_not_ok(status, result, &status)) {
                                werr = ntstatus_to_werror(status);
                                goto done;
                        }
-                       if (!NT_STATUS_IS_OK(result)) {
-                               werr = ntstatus_to_werror(result);
-                               goto done;
-                       }
 
                        info.attributes.attributes = g2->grpi2_attributes;
                        status = dcerpc_samr_SetGroupInfo(b, talloc_tos(),
@@ -609,14 +555,10 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx,
                                                          GROUPINFODESCRIPTION,
                                                          &info,
                                                          &result);
-                       if (!NT_STATUS_IS_OK(status)) {
+                       if (any_nt_status_not_ok(status, result, &status)) {
                                werr = ntstatus_to_werror(status);
                                goto done;
                        }
-                       if (!NT_STATUS_IS_OK(result)) {
-                               werr = ntstatus_to_werror(result);
-                               goto done;
-                       }
 
                        info.attributes.attributes = g3->grpi3_attributes;
                        status = dcerpc_samr_SetGroupInfo(b, talloc_tos(),
@@ -648,14 +590,10 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx,
                        break;
        }
 
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        werr = WERR_OK;
 
@@ -798,14 +736,10 @@ WERROR NetGroupGetInfo_r(struct libnetapi_ctx *ctx,
                                         &rids,
                                         &types,
                                         &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
        if (rids.count != 1) {
                werr = WERR_BAD_NET_RESP;
                goto done;
@@ -826,14 +760,10 @@ WERROR NetGroupGetInfo_r(struct libnetapi_ctx *ctx,
                                       rids.ids[0],
                                       &group_handle,
                                       &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        status = dcerpc_samr_QueryGroupInfo(b, talloc_tos(),
                                            &group_handle,
@@ -974,14 +904,10 @@ WERROR NetGroupAddUser_r(struct libnetapi_ctx *ctx,
                                       rids.ids[0],
                                       &group_handle,
                                       &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        init_lsa_String(&lsa_user_name, r->in.user_name);
 
@@ -1019,14 +945,10 @@ WERROR NetGroupAddUser_r(struct libnetapi_ctx *ctx,
                                            rids.ids[0],
                                            7, /* why ? */
                                            &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        werr = WERR_OK;
 
@@ -1134,14 +1056,10 @@ WERROR NetGroupDelUser_r(struct libnetapi_ctx *ctx,
                                       rids.ids[0],
                                       &group_handle,
                                       &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        init_lsa_String(&lsa_user_name, r->in.user_name);
 
@@ -1179,14 +1097,10 @@ WERROR NetGroupDelUser_r(struct libnetapi_ctx *ctx,
                                               &group_handle,
                                               rids.ids[0],
                                               &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        werr = WERR_OK;
 
@@ -1423,14 +1337,10 @@ WERROR NetGroupEnum_r(struct libnetapi_ctx *ctx,
                                             2,
                                             &domain_info,
                                             &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        if (r->out.total_entries) {
                *r->out.total_entries = domain_info->general.num_groups;
@@ -1572,14 +1482,10 @@ WERROR NetGroupGetUsers_r(struct libnetapi_ctx *ctx,
                                         &group_rids,
                                         &name_types,
                                         &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
        if (group_rids.count != 1) {
                werr = WERR_BAD_NET_RESP;
                goto done;
@@ -1595,27 +1501,19 @@ WERROR NetGroupGetUsers_r(struct libnetapi_ctx *ctx,
                                       group_rids.ids[0],
                                       &group_handle,
                                       &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        status = dcerpc_samr_QueryGroupMember(b, talloc_tos(),
                                              &group_handle,
                                              &rid_array,
                                              &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        status = dcerpc_samr_LookupRids(b, talloc_tos(),
                                        &domain_handle,
@@ -1624,14 +1522,10 @@ WERROR NetGroupGetUsers_r(struct libnetapi_ctx *ctx,
                                        &names,
                                        &member_types,
                                        &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
        if (names.count != rid_array->count) {
                werr = WERR_BAD_NET_RESP;
                goto done;
@@ -1764,14 +1658,10 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx,
                                         &group_rids,
                                         &group_types,
                                         &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
        if (group_rids.count != 1) {
                werr = WERR_BAD_NET_RESP;
                goto done;
@@ -1790,28 +1680,20 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx,
                                       group_rids.ids[0],
                                       &group_handle,
                                       &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        status = dcerpc_samr_QueryGroupInfo(b, talloc_tos(),
                                            &group_handle,
                                            GROUPINFOATTRIBUTES,
                                            &group_info,
                                            &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        switch (r->in.level) {
                case 0:
@@ -1849,14 +1731,10 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx,
                                         &user_rids,
                                         &name_types,
                                         &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        if (r->in.num_entries != user_rids.count) {
                werr = WERR_BAD_NET_RESP;
@@ -1873,14 +1751,10 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx,
                                              &group_handle,
                                              &rid_array,
                                              &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        /* add list */
 
@@ -1930,14 +1804,10 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx,
                                                    add_rids[i],
                                                    7 /* ? */,
                                                    &result);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (any_nt_status_not_ok(status, result, &status)) {
                        werr = ntstatus_to_werror(status);
                        goto done;
                }
-               if (!NT_STATUS_IS_OK(result)) {
-                       werr = ntstatus_to_werror(result);
-                       goto done;
-               }
        }
 
        /* del list */
@@ -1947,14 +1817,10 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx,
                                                       &group_handle,
                                                       del_rids[i],
                                                       &result);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (any_nt_status_not_ok(status, result, &status)) {
                        werr = ntstatus_to_werror(status);
                        goto done;
                }
-               if (!NT_STATUS_IS_OK(result)) {
-                       werr = ntstatus_to_werror(result);
-                       goto done;
-               }
        }
 
        werr = WERR_OK;
index f3667987b1aed42c0cbc81dc968c3a756b74a935..5d6ad174fb1d3a3904239156fa605945f8a7fa4d 100644 (file)
@@ -52,12 +52,9 @@ static NTSTATUS libnetapi_samr_lookup_and_open_alias(TALLOC_CTX *mem_ctx,
                                         &user_rids,
                                         &name_types,
                                         &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                return status;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               return result;
-       }
        if (user_rids.count != 1) {
                return NT_STATUS_INVALID_NETWORK_RESPONSE;
        }
@@ -110,11 +107,7 @@ static NTSTATUS libnetapi_samr_open_alias_queryinfo(TALLOC_CTX *mem_ctx,
                                       rid,
                                       &alias_handle,
                                       &result);
-       if (!NT_STATUS_IS_OK(status)) {
-               goto done;
-       }
-       if (!NT_STATUS_IS_OK(result)) {
-               status = result;
+       if (any_nt_status_not_ok(status, result, &status)) {
                goto done;
        }
 
@@ -123,11 +116,7 @@ static NTSTATUS libnetapi_samr_open_alias_queryinfo(TALLOC_CTX *mem_ctx,
                                            level,
                                            &_alias_info,
                                            &result);
-       if (!NT_STATUS_IS_OK(status)) {
-               goto done;
-       }
-       if (!NT_STATUS_IS_OK(result)) {
-               status = result;
+       if (any_nt_status_not_ok(status, result, &status)) {
                goto done;
        }
 
@@ -239,15 +228,10 @@ WERROR NetLocalGroupAdd_r(struct libnetapi_ctx *ctx,
                                            &alias_handle,
                                            &rid,
                                            &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
-
 
        if (r->in.level == 1 && info1->lgrpi1_comment) {
 
@@ -260,14 +244,10 @@ WERROR NetLocalGroupAdd_r(struct libnetapi_ctx *ctx,
                                                  ALIASINFODESCRIPTION,
                                                  &alias_info,
                                                  &result);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (any_nt_status_not_ok(status, result, &status)) {
                        werr = ntstatus_to_werror(status);
                        goto done;
                }
-               if (!NT_STATUS_IS_OK(result)) {
-                       werr = ntstatus_to_werror(result);
-                       goto done;
-               }
        }
 
        werr = WERR_OK;
@@ -383,14 +363,10 @@ WERROR NetLocalGroupDel_r(struct libnetapi_ctx *ctx,
        status = dcerpc_samr_DeleteDomAlias(b, talloc_tos(),
                                            &alias_handle,
                                            &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        ZERO_STRUCT(alias_handle);
 
@@ -564,14 +540,10 @@ WERROR NetLocalGroupGetInfo_r(struct libnetapi_ctx *ctx,
                                            ALIASINFOALL,
                                            &alias_info,
                                            &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        werr = map_alias_info_to_buffer(ctx,
                                        r->in.group_name,
@@ -750,14 +722,10 @@ WERROR NetLocalGroupSetInfo_r(struct libnetapi_ctx *ctx,
                                          alias_level,
                                          alias_info,
                                          &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        werr = WERR_OK;
 
@@ -866,14 +834,10 @@ WERROR NetLocalGroupEnum_r(struct libnetapi_ctx *ctx,
                                             2,
                                             &builtin_info,
                                             &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        if (r->out.total_entries) {
                *r->out.total_entries += builtin_info->general.num_aliases;
@@ -884,14 +848,10 @@ WERROR NetLocalGroupEnum_r(struct libnetapi_ctx *ctx,
                                             2,
                                             &domain_info,
                                             &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        if (r->out.total_entries) {
                *r->out.total_entries += domain_info->general.num_aliases;
@@ -904,14 +864,10 @@ WERROR NetLocalGroupEnum_r(struct libnetapi_ctx *ctx,
                                               r->in.prefmaxlen,
                                               &entries_read,
                                               &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        for (i=0; i<builtin_sam_array->count; i++) {
                union samr_AliasInfo *alias_info = NULL;
@@ -945,14 +901,10 @@ WERROR NetLocalGroupEnum_r(struct libnetapi_ctx *ctx,
                                               r->in.prefmaxlen,
                                               &entries_read,
                                               &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        for (i=0; i<domain_sam_array->count; i++) {
 
@@ -1259,14 +1211,10 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx,
                                                       &alias_handle,
                                                       &current_sids,
                                                       &result);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (any_nt_status_not_ok(status, result, &status)) {
                        werr = ntstatus_to_werror(status);
                        goto done;
                }
-               if (!NT_STATUS_IS_OK(result)) {
-                       werr = ntstatus_to_werror(result);
-                       goto done;
-               }
 
                /* add list */
 
@@ -1320,14 +1268,10 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx,
                                                    &alias_handle,
                                                    &add_sids[i],
                                                    &result);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (any_nt_status_not_ok(status, result, &status)) {
                        werr = ntstatus_to_werror(status);
                        goto done;
                }
-               if (!NT_STATUS_IS_OK(result)) {
-                       werr = ntstatus_to_werror(result);
-                       goto done;
-               }
        }
 
        /* del list */
@@ -1337,14 +1281,10 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx,
                                                       &alias_handle,
                                                       &del_sids[i],
                                                       &result);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (any_nt_status_not_ok(status, result, &status)) {
                        werr = ntstatus_to_werror(status);
                        goto done;
                }
-               if (!NT_STATUS_IS_OK(result)) {
-                       werr = ntstatus_to_werror(result);
-                       goto done;
-               }
        }
 
        werr = WERR_OK;
index 97c61d18099c181ff393c49579e79cfcee9a1763..c1b7cfa1125f98310d1ff851fd17e990f11fb7c7 100644 (file)
@@ -87,14 +87,10 @@ WERROR libnetapi_samr_open_domain(struct libnetapi_ctx *mem_ctx,
                                                  connect_mask,
                                                  connect_handle,
                                                  &result);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (any_nt_status_not_ok(status, result, &status)) {
                        werr = ntstatus_to_werror(status);
                        goto done;
                }
-               if (!NT_STATUS_IS_OK(result)) {
-                       werr = ntstatus_to_werror(result);
-                       goto done;
-               }
        }
 
        status = dcerpc_samr_EnumDomains(b, mem_ctx,
@@ -104,14 +100,10 @@ WERROR libnetapi_samr_open_domain(struct libnetapi_ctx *mem_ctx,
                                         0xffffffff,
                                         &num_entries,
                                         &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        for (i=0; i<num_entries; i++) {
 
@@ -137,14 +129,10 @@ WERROR libnetapi_samr_open_domain(struct libnetapi_ctx *mem_ctx,
                                          &lsa_domain_name,
                                          domain_sid,
                                          &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        status = dcerpc_samr_OpenDomain(b, mem_ctx,
                                        connect_handle,
@@ -152,14 +140,10 @@ WERROR libnetapi_samr_open_domain(struct libnetapi_ctx *mem_ctx,
                                        *domain_sid,
                                        domain_handle,
                                        &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        priv->samr.cli                  = pipe_cli;
 
@@ -227,14 +211,10 @@ WERROR libnetapi_samr_open_builtin_domain(struct libnetapi_ctx *mem_ctx,
                                                  connect_mask,
                                                  connect_handle,
                                                  &result);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (any_nt_status_not_ok(status, result, &status)) {
                        werr = ntstatus_to_werror(status);
                        goto done;
                }
-               if (!NT_STATUS_IS_OK(result)) {
-                       werr = ntstatus_to_werror(result);
-                       goto done;
-               }
        }
 
        status = dcerpc_samr_OpenDomain(b, mem_ctx,
@@ -243,14 +223,10 @@ WERROR libnetapi_samr_open_builtin_domain(struct libnetapi_ctx *mem_ctx,
                                        discard_const_p(struct dom_sid, &global_sid_Builtin),
                                        builtin_handle,
                                        &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        priv->samr.cli                  = pipe_cli;
 
index fb38b233b86e0fc96cd2761a542e7b716b9738de..a7f4c9d7c0121b201fb94ddce6fb1164f43c7e66 100644 (file)
@@ -448,28 +448,20 @@ WERROR NetUserAdd_r(struct libnetapi_ctx *ctx,
                                         &access_granted,
                                         &rid,
                                         &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        status = dcerpc_samr_QueryUserInfo(b, talloc_tos(),
                                           &user_handle,
                                           16,
                                           &user_info,
                                           &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        if (!(user_info->info16.acct_flags & ACB_NORMAL)) {
                werr = WERR_INVALID_PARAMETER;
@@ -480,14 +472,10 @@ WERROR NetUserAdd_r(struct libnetapi_ctx *ctx,
                                           &user_handle,
                                           &pw_info,
                                           &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        status = cli_get_session_key(talloc_tos(), pipe_cli, &session_key);
        if (!NT_STATUS_IS_OK(status)) {
@@ -584,14 +572,10 @@ WERROR NetUserDel_r(struct libnetapi_ctx *ctx,
                                        discard_const_p(struct dom_sid, &global_sid_Builtin),
                                        &builtin_handle,
                                        &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        init_lsa_String(&lsa_account_name, r->in.user_name);
 
@@ -602,14 +586,10 @@ WERROR NetUserDel_r(struct libnetapi_ctx *ctx,
                                         &user_rids,
                                         &name_types,
                                         &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
        if (user_rids.count != 1) {
                werr = WERR_BAD_NET_RESP;
                goto done;
@@ -625,14 +605,10 @@ WERROR NetUserDel_r(struct libnetapi_ctx *ctx,
                                      user_rids.ids[0],
                                      &user_handle,
                                      &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        sid_compose(&user_sid, domain_sid, user_rids.ids[0]);
 
@@ -640,26 +616,18 @@ WERROR NetUserDel_r(struct libnetapi_ctx *ctx,
                                                           &builtin_handle,
                                                           &user_sid,
                                                           &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        status = dcerpc_samr_DeleteUser(b, talloc_tos(),
                                        &user_handle,
                                        &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        werr = WERR_OK;
 
@@ -746,11 +714,7 @@ static NTSTATUS libnetapi_samr_lookup_user(TALLOC_CTX *mem_ctx,
                                      rid,
                                      &user_handle,
                                      &result);
-       if (!NT_STATUS_IS_OK(status)) {
-               goto done;
-       }
-       if (!NT_STATUS_IS_OK(result)) {
-               status = result;
+       if (any_nt_status_not_ok(status, result, &status)) {
                goto done;
        }
 
@@ -759,11 +723,7 @@ static NTSTATUS libnetapi_samr_lookup_user(TALLOC_CTX *mem_ctx,
                                           21,
                                           &user_info,
                                           &result);
-       if (!NT_STATUS_IS_OK(status)) {
-               goto done;
-       }
-       if (!NT_STATUS_IS_OK(result)) {
-               status = result;
+       if (any_nt_status_not_ok(status, result, &status)) {
                goto done;
        }
 
@@ -772,11 +732,7 @@ static NTSTATUS libnetapi_samr_lookup_user(TALLOC_CTX *mem_ctx,
                                           SECINFO_DACL,
                                           sec_desc,
                                           &result);
-       if (!NT_STATUS_IS_OK(status)) {
-               goto done;
-       }
-       if (!NT_STATUS_IS_OK(result)) {
-               status = result;
+       if (any_nt_status_not_ok(status, result, &status)) {
                goto done;
        }
 
@@ -792,11 +748,7 @@ static NTSTATUS libnetapi_samr_lookup_user(TALLOC_CTX *mem_ctx,
                                                      &user_handle,
                                                      &rid_array,
                                                      &result);
-               if (!NT_STATUS_IS_OK(status)) {
-                       goto done;
-               }
-               if (!NT_STATUS_IS_OK(result)) {
-                       status = result;
+               if (any_nt_status_not_ok(status, result, &status)) {
                        goto done;
                }
 
@@ -820,11 +772,7 @@ static NTSTATUS libnetapi_samr_lookup_user(TALLOC_CTX *mem_ctx,
                                                        &sid_array,
                                                        &alias_rids,
                                                        &result);
-               if (!NT_STATUS_IS_OK(status)) {
-                       goto done;
-               }
-               if (!NT_STATUS_IS_OK(result)) {
-                       status = result;
+               if (any_nt_status_not_ok(status, result, &status)) {
                        goto done;
                }
 
@@ -1806,14 +1754,10 @@ WERROR NetUserGetInfo_r(struct libnetapi_ctx *ctx,
                                         &user_rids,
                                         &name_types,
                                         &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
        if (user_rids.count != 1) {
                werr = WERR_BAD_NET_RESP;
                goto done;
@@ -1979,14 +1923,10 @@ WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx,
                                         &user_rids,
                                         &name_types,
                                         &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
        if (user_rids.count != 1) {
                werr = WERR_BAD_NET_RESP;
                goto done;
@@ -2002,14 +1942,10 @@ WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx,
                                      user_rids.ids[0],
                                      &user_handle,
                                      &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        status = construct_USER_INFO_X(r->in.level, r->in.buffer, &uX);
        if (!NT_STATUS_IS_OK(status)) {
@@ -3046,14 +2982,10 @@ WERROR NetUserGetGroups_r(struct libnetapi_ctx *ctx,
                                         &user_rids,
                                         &name_types,
                                         &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
        if (user_rids.count != 1) {
                werr = WERR_BAD_NET_RESP;
                goto done;
@@ -3069,27 +3001,19 @@ WERROR NetUserGetGroups_r(struct libnetapi_ctx *ctx,
                                      user_rids.ids[0],
                                      &user_handle,
                                      &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        status = dcerpc_samr_GetGroupsForUser(b, talloc_tos(),
                                              &user_handle,
                                              &rid_array,
                                              &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        rids = talloc_array(ctx, uint32_t, rid_array->count);
        if (!rids) {
@@ -3237,14 +3161,10 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx,
                                         &user_rids,
                                         &name_types,
                                         &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
        if (user_rids.count != 1) {
                werr = WERR_BAD_NET_RESP;
                goto done;
@@ -3260,14 +3180,10 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx,
                                      user_rids.ids[0],
                                      &user_handle,
                                      &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        switch (r->in.level) {
                case 0:
@@ -3305,14 +3221,10 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx,
                                         &group_rids,
                                         &name_types,
                                         &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
        if (group_rids.count != r->in.num_entries) {
                werr = WERR_BAD_NET_RESP;
                goto done;
@@ -3328,14 +3240,10 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx,
                                              &user_handle,
                                              &rid_array,
                                              &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        /* add list */
 
@@ -3386,28 +3294,20 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx,
                                               add_rids[i],
                                               &group_handle,
                                               &result);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (any_nt_status_not_ok(status, result, &status)) {
                        werr = ntstatus_to_werror(status);
                        goto done;
                }
-               if (!NT_STATUS_IS_OK(result)) {
-                       werr = ntstatus_to_werror(result);
-                       goto done;
-               }
 
                status = dcerpc_samr_AddGroupMember(b, talloc_tos(),
                                                    &group_handle,
                                                    user_rids.ids[0],
                                                    7 /* ? */,
                                                    &result);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (any_nt_status_not_ok(status, result, &status)) {
                        werr = ntstatus_to_werror(status);
                        goto done;
                }
-               if (!NT_STATUS_IS_OK(result)) {
-                       werr = ntstatus_to_werror(result);
-                       goto done;
-               }
 
                if (is_valid_policy_hnd(&group_handle)) {
                        dcerpc_samr_Close(b, talloc_tos(), &group_handle, &result);
@@ -3423,27 +3323,19 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx,
                                               del_rids[i],
                                               &group_handle,
                                               &result);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (any_nt_status_not_ok(status, result, &status)) {
                        werr = ntstatus_to_werror(status);
                        goto done;
                }
-               if (!NT_STATUS_IS_OK(result)) {
-                       werr = ntstatus_to_werror(result);
-                       goto done;
-               }
 
                status = dcerpc_samr_DeleteGroupMember(b, talloc_tos(),
                                                       &group_handle,
                                                       user_rids.ids[0],
                                                       &result);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (any_nt_status_not_ok(status, result, &status)) {
                        werr = ntstatus_to_werror(status);
                        goto done;
                }
-               if (!NT_STATUS_IS_OK(result)) {
-                       werr = ntstatus_to_werror(result);
-                       goto done;
-               }
 
                if (is_valid_policy_hnd(&group_handle)) {
                        dcerpc_samr_Close(b, talloc_tos(), &group_handle, &result);
@@ -3590,14 +3482,10 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx,
                                         &user_rids,
                                         &name_types,
                                         &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
        if (user_rids.count != 1) {
                werr = WERR_BAD_NET_RESP;
                goto done;
@@ -3613,27 +3501,19 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx,
                                      user_rids.ids[0],
                                      &user_handle,
                                      &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        status = dcerpc_samr_GetGroupsForUser(b, talloc_tos(),
                                              &user_handle,
                                              &rid_array,
                                              &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        if (!sid_compose(&user_sid, domain_sid, user_rids.ids[0])) {
                werr = WERR_NOT_ENOUGH_MEMORY;
@@ -3673,14 +3553,10 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx,
                                                &sid_array,
                                                &domain_rids,
                                                &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        for (i=0; i < domain_rids.count; i++) {
                if (!add_rid_to_array_unique(ctx, domain_rids.ids[i],
@@ -3695,14 +3571,10 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx,
                                                &sid_array,
                                                &builtin_rids,
                                                &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
 
        for (i=0; i < builtin_rids.count; i++) {
                if (!add_rid_to_array_unique(ctx, builtin_rids.ids[i],
@@ -3719,14 +3591,10 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx,
                                        &names,
                                        &types,
                                        &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (any_nt_status_not_ok(status, result, &status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               werr = ntstatus_to_werror(result);
-               goto done;
-       }
        if (names.count != num_rids) {
                werr = WERR_BAD_NET_RESP;
                goto done;