[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Fri Aug 6 18:10:01 UTC 2021


The branch, master has been updated
       via  62f206a249a smbd: Simplify mark_share_mode_disconnected()
       via  9e8f7910b29 smbd: Fix fetch_share_mode_send() error return
       via  a1cbb8bc448 net: Use dbwrap_do_locked() in wipedbs_delete_records()
       via  1881240d468 libsmbclient: Avoid a call to SMBC_errno() in SMBC_notify_ctx()
       via  009b6e748ea libsmbclient: Avoid a call to SMBC_errno() in SMBC_attr_server()
       via  4bd69f1e1a5 libsmbclient: Avoid a call to SMBC_errno() in SMBC_splice_ctx()
       via  19df9a2edf1 libsmbclient: Avoid a call to SMBC_errno() in SMBC_read_ctx()
       via  5e98b7dfc03 libsmbclient: Avoid a call to SMBC_errno() in SMBC_open_ctx()
       via  7c2b6a71dce libsmbclient: Avoid a call to SMBC_errno() in SMBC_chmod_ctx()
       via  e80d390b4bd lib: Use TALLOC_FREE() in data_blob_free()
       via  cac5e8287a7 rpc_client: Avoid two casts with proper printf specifiers
       via  cf8601e785d rpc_client: Save 65 .text bytes with -Os
       via  c8768551fb5 rpc_client: Simplify create_rpc_bind_req()
       via  f6c9e2800e6 rpc_client: Replace ZERO_STRUCTP with struct assignment
       via  dbb1047e474 rpc_client: Simplify rpc_pipe_bind_step_one_done()
       via  5cb5fadce4e libnetapi: Save lines with any_nt_status_not_ok()
       via  de1b95791cb net: Align some integer types
       via  3eaa2bcb89d net3: Simplify name_to_sid(): dom_sid_parse checks for "S-" prefix
       via  4a99fe42e67 net3: Save a few lines with any_nt_status_not_ok()
       via  d2a08f5d679 samdb: Fix an uninitialized variable read
       via  621f561a9c2 lib;smbd: Fix the -Os build by initializing variables
       via  fa8c0379b50 lib: Fix a potential error path memleak
       via  e52ce697d9e rpcclient: Align integer types
      from  069d23f0a71 s3: VFS: solarisacl: Fix compile error (missed variable rename).

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 62f206a249a967f427a70730c1760885a72eb080
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Dec 16 18:35:50 2020 +0100

    smbd: Simplify mark_share_mode_disconnected()
    
    We can use reset_share_mode_entry() for this purpose. 32 lines less
    code.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri Aug  6 18:09:06 UTC 2021 on sn-devel-184

commit 9e8f7910b299fca75a1fdb11013036d0a34be4be
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Dec 18 13:04:47 2020 +0100

    smbd: Fix fetch_share_mode_send() error return
    
    The "return" is unnecessary here, but in case the code changes later
    on, it won't be forgotten. Also, we need to tell the callers that we
    found an invalid record.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a1cbb8bc448f9cd1de4afd07fa982d223a176891
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Dec 18 14:57:08 2020 +0100

    net: Use dbwrap_do_locked() in wipedbs_delete_records()
    
    Eventually I'd like to get rid of dbwrap_fetch_locked()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 1881240d46850581ece52ca10c4af1a7797ca549
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Dec 15 17:15:21 2020 +0100

    libsmbclient: Avoid a call to SMBC_errno() in SMBC_notify_ctx()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 009b6e748ea67215f6bd593fc57af3b6b48b09a0
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Dec 15 17:15:21 2020 +0100

    libsmbclient: Avoid a call to SMBC_errno() in SMBC_attr_server()
    
    I think this also fixes the errno return, cli_shutdown() can do a lot and set
    errno in between.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 4bd69f1e1a5c04b76e79cb0b92db773356554e75
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Dec 15 17:15:21 2020 +0100

    libsmbclient: Avoid a call to SMBC_errno() in SMBC_splice_ctx()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 19df9a2edf14201589c66d96c252649c8fb0bc69
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Dec 15 17:15:21 2020 +0100

    libsmbclient: Avoid a call to SMBC_errno() in SMBC_read_ctx()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 5e98b7dfc03afe8ed2eff809134c7922d17af9a2
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Dec 15 17:15:21 2020 +0100

    libsmbclient: Avoid a call to SMBC_errno() in SMBC_open_ctx()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 7c2b6a71dced8cfd2fcea138660089924aaf5a46
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Dec 15 17:15:21 2020 +0100

    libsmbclient: Avoid a call to SMBC_errno() in SMBC_chmod_ctx()
    
    Directly use the return value from cli_setatr(), don't go via the cli_state
    struct member
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e80d390b4bd4cb60adf8ec3eaea079fc83c3a898
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Aug 3 09:09:05 2021 +0200

    lib: Use TALLOC_FREE() in data_blob_free()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit cac5e8287a76b99b069de800d2141d5da969b241
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Aug 3 08:46:11 2021 +0200

    rpc_client: Avoid two casts with proper printf specifiers
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit cf8601e785d8b2e8a68ddc562b3cd6fe466cdfad
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Aug 3 08:43:57 2021 +0200

    rpc_client: Save 65 .text bytes with -Os
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c8768551fb50b0fdd60d26a9c32742f0f41af955
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Aug 3 08:40:59 2021 +0200

    rpc_client: Simplify create_rpc_bind_req()
    
    In former times this switch statement had more than one branch
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f6c9e2800e64690dd0060eafbed57af858e61aff
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jul 29 10:13:37 2021 +0200

    rpc_client: Replace ZERO_STRUCTP with struct assignment
    
    Give the compiler simpler hints
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit dbb1047e4744d4d6187bfe6487b6b7cb39a943ee
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jul 29 08:55:45 2021 +0200

    rpc_client: Simplify rpc_pipe_bind_step_one_done()
    
    With just one case handled specially in a switch statement and the
    rest being default:, a simple if-statement can reduce indentation.
    
    Best viewed with "git show -b".
    
    I wonder if the second "if (pauth->auth_type == DCERPC_AUTH_TYPE_NONE)"
    leads to reachable code, this should have been taken care of already
    further up. But for now I did the 1:1 translation of existing code.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 5cb5fadce4e410e6c6e9bbc0b3e953e44e8c58d5
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jul 25 10:26:30 2021 +0200

    libnetapi: Save lines with any_nt_status_not_ok()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit de1b95791cbb9b3198b8211db41bc07becbe2ef5
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jul 25 10:22:37 2021 +0200

    net: Align some integer types
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3eaa2bcb89d310ce80137226c86bc2a5d8ea586c
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jul 25 09:51:10 2021 +0200

    net3: Simplify name_to_sid(): dom_sid_parse checks for "S-" prefix
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 4a99fe42e67e092cfe86281ce6970cf5ae7f0991
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jul 25 09:46:34 2021 +0200

    net3: Save a few lines with any_nt_status_not_ok()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d2a08f5d679a7f426bd7fb87b0a684c25ca72c12
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jul 23 08:47:47 2021 +0200

    samdb: Fix an uninitialized variable read
    
    When the "(status == LDB_SUCCESS && msg != NULL)" condition in this
    routine is not evaluating to true, "new_rid" is read uninitialized,
    comparing it against ~0. Initialize new_rid and compare it against
    UINT32_MAX instead of ~0.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 621f561a9c2c3fa905211643ae18cceb92ca5dea
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jul 23 08:46:51 2021 +0200

    lib;smbd: Fix the -Os build by initializing variables
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit fa8c0379b50f675e0f072a27448bf2c8c3d7b3d0
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jul 23 08:27:37 2021 +0200

    lib: Fix a potential error path memleak
    
    Don't directly overwrite the pointer for a realloc. On failure, the
    original pointer is still valid.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e52ce697d9ed1962a4fae1dbb5ad09b1883b8dfc
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Jul 21 08:28:20 2021 +0200

    rpcclient: Align integer types
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/mscat/mscat_ctl.c                        |   4 +-
 lib/util/data_blob.c                         |   9 +-
 source3/lib/netapi/group.c                   | 206 +++++----------------------
 source3/lib/netapi/localgroup.c              |  90 ++----------
 source3/lib/netapi/samr.c                    |  36 +----
 source3/lib/netapi/user.c                    | 198 +++++--------------------
 source3/lib/sendfile.c                       |   5 +-
 source3/libsmb/libsmb_dir.c                  |  11 +-
 source3/libsmb/libsmb_file.c                 |   6 +-
 source3/libsmb/libsmb_server.c               |   2 +-
 source3/locking/share_mode_lock.c            |  54 ++-----
 source3/rpc_client/cli_pipe.c                | 151 +++++++++-----------
 source3/rpc_client/cli_winreg_spoolss.c      |  22 +--
 source3/rpc_client/rpc_transport_tstream.c   |   7 +-
 source3/rpcclient/cmd_winreg.c               |   4 +-
 source3/smbd/notifyd/notifyd.c               |   6 +-
 source3/smbd/oplock_linux.c                  |   2 +-
 source3/utils/net_rpc.c                      |  29 ++--
 source3/utils/net_rpc_rights.c               |  12 +-
 source3/utils/net_serverid.c                 | 104 +++++++++-----
 source4/dsdb/samdb/ldb_modules/group_audit.c |   4 +-
 source4/torture/smb2/dir.c                   |   4 +-
 22 files changed, 294 insertions(+), 672 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/mscat/mscat_ctl.c b/lib/mscat/mscat_ctl.c
index 974ace83c30..426ddc57161 100644
--- a/lib/mscat/mscat_ctl.c
+++ b/lib/mscat/mscat_ctl.c
@@ -990,8 +990,8 @@ static int ctl_get_member_attributes(struct mscat_ctl *ctl,
 
 		ok = mscat_asn1_oid_equal(oid, CAT_MEMBERINFO_OBJID);
 		if (ok) {
-			char *name;
-			uint32_t id;
+			char *name = NULL;
+			uint32_t id = 0;
 
 			rc = ctl_parse_member_info(ctl,
 						   tmp_ctx,
diff --git a/lib/util/data_blob.c b/lib/util/data_blob.c
index 6dc58c495db..e528eb093a0 100644
--- a/lib/util/data_blob.c
+++ b/lib/util/data_blob.c
@@ -82,8 +82,7 @@ free a data blob
 _PUBLIC_ void data_blob_free(DATA_BLOB *d)
 {
 	if (d) {
-		talloc_free(d->data);
-		d->data = NULL;
+		TALLOC_FREE(d->data);
 		d->length = 0;
 	}
 }
@@ -212,9 +211,11 @@ _PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length)
 **/
 _PUBLIC_ bool data_blob_realloc(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, size_t length)
 {
-	blob->data = talloc_realloc(mem_ctx, blob->data, uint8_t, length);
-	if (blob->data == NULL)
+	uint8_t *tmp = talloc_realloc(mem_ctx, blob->data, uint8_t, length);
+	if (tmp == NULL) {
 		return false;
+	}
+	blob->data = tmp;
 	blob->length = length;
 	return true;
 }
diff --git a/source3/lib/netapi/group.c b/source3/lib/netapi/group.c
index e0b7458e58c..5258549ce66 100644
--- a/source3/lib/netapi/group.c
+++ b/source3/lib/netapi/group.c
@@ -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;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list