[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Jan 23 20:42:11 UTC 2020


The branch, master has been updated
       via  4fca8d7aa77 tdb: Align integer types
       via  2d3cbc53cc9 dbwrap: Do direct struct initalization in db_ctdb_store_db_seqnum()
       via  a0b967ec15b librpc: Use PRIu32 printf specifiers
       via  3c224ee2327 smbclient: Fix a typo
       via  4864a4bb965 librpc: Use the MAX() macro where appropriate
       via  7b5edaebced librpc: Fix a gcc warning
       via  1393011b1e2 smbd: Call string_term_tdb_data() once instead of 6 times
      from  ad236bb7590 s3: lib: nmblib. Clean up and harden nmb packet processing.

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


- Log -----------------------------------------------------------------
commit 4fca8d7aa77db648a08051f54fb181d4eaa8b94d
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Jan 22 11:47:55 2020 +0100

    tdb: Align integer types
    
    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): Thu Jan 23 20:41:46 UTC 2020 on sn-devel-184

commit 2d3cbc53cc90e12eba4ded9713a9926370aebedc
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jan 20 14:06:11 2020 +0100

    dbwrap: Do direct struct initalization in db_ctdb_store_db_seqnum()
    
    Save a few lines
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a0b967ec15b485329cefa037de85484b97b9d50d
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Jan 22 10:21:17 2020 +0100

    librpc: Use PRIu32 printf specifiers
    
    Both values printed are uint32_t's
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3c224ee2327e3ae1a97c090f5d5c5c7a833526d5
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Jan 15 13:11:20 2020 +0100

    smbclient: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 4864a4bb96541417b32461c0b59525bff4178290
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Jan 21 13:20:07 2020 +0100

    librpc: Use the MAX() macro where appropriate
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 7b5edaebced3167bb9df8a0d4db83af43c309ef9
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Jan 21 13:17:13 2020 +0100

    librpc: Fix a gcc warning
    
    gcc does not like const before static
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 1393011b1e2f1b73ff196ed2360bf18b0f81bef9
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Jan 22 16:14:01 2020 +0100

    smbd: Call string_term_tdb_data() once instead of 6 times
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 lib/tdb/common/mutex.c           |  5 +++--
 librpc/ndr/ndr.c                 | 18 +++++++++---------
 source3/client/client.c          |  5 ++++-
 source3/lib/dbwrap/dbwrap_ctdb.c | 10 ++--------
 source3/smbd/server.c            | 23 +++++++++++------------
 5 files changed, 29 insertions(+), 32 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tdb/common/mutex.c b/lib/tdb/common/mutex.c
index 8a122d5d6a2..78926db0be8 100644
--- a/lib/tdb/common/mutex.c
+++ b/lib/tdb/common/mutex.c
@@ -149,7 +149,7 @@ static bool tdb_mutex_index(struct tdb_context *tdb, off_t off, off_t len,
 
 static bool tdb_have_mutex_chainlocks(struct tdb_context *tdb)
 {
-	size_t i;
+	int i;
 
 	for (i=0; i < tdb->num_lockrecs; i++) {
 		bool ret;
@@ -559,7 +559,8 @@ int tdb_mutex_init(struct tdb_context *tdb)
 {
 	struct tdb_mutexes *m;
 	pthread_mutexattr_t ma;
-	int i, ret;
+	uint32_t i;
+	int ret;
 
 	ret = tdb_mutex_mmap(tdb);
 	if (ret == -1) {
diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c
index 2259a35b170..c772d53f6ed 100644
--- a/librpc/ndr/ndr.c
+++ b/librpc/ndr/ndr.c
@@ -1326,16 +1326,16 @@ _PUBLIC_ enum ndr_err_code ndr_pull_struct_blob_all_noalloc(const DATA_BLOB *blo
 	};
 	uint32_t highest_ofs;
 	NDR_CHECK(fn(&ndr, NDR_SCALARS|NDR_BUFFERS, p));
-	if (ndr.offset > ndr.relative_highest_offset) {
-		highest_ofs = ndr.offset;
-	} else {
-		highest_ofs = ndr.relative_highest_offset;
-	}
+	highest_ofs = MAX(ndr.offset, ndr.relative_highest_offset);
 	if (highest_ofs < ndr.data_size) {
 		enum ndr_err_code ret;
-		ret = ndr_pull_error(&ndr, NDR_ERR_UNREAD_BYTES,
-				     "not all bytes consumed ofs[%u] size[%u]",
-				     highest_ofs, ndr.data_size);
+		ret = ndr_pull_error(
+			&ndr,
+			NDR_ERR_UNREAD_BYTES,
+			"not all bytes consumed ofs[%"PRIu32"] "
+			"size[%"PRIu32"]",
+			highest_ofs,
+			ndr.data_size);
 		return ret;
 	}
 	return NDR_ERR_SUCCESS;
@@ -1930,7 +1930,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_relative_ptr2(struct ndr_pull *ndr, const vo
 	return ndr_pull_set_offset(ndr, rel_offset);
 }
 
-const static struct {
+static const struct {
 	enum ndr_err_code err;
 	const char *string;
 } ndr_err_code_strings[] = {
diff --git a/source3/client/client.c b/source3/client/client.c
index 29754806e63..76180fc5ba7 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -6512,7 +6512,10 @@ int main(int argc,char *argv[])
 
 	while ((opt = poptGetNextOpt(pc)) != -1) {
 
-		/* if the tar option has been called previouslt, now we need to eat out the leftovers */
+		/*
+		 * if the tar option has been called previously, now
+		 * we need to eat out the leftovers
+		 */
 		/* I see no other way to keep things sane --SSS */
 		if (tar_opt == true) {
 			while (poptPeekArg(pc)) {
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index 6d2a8c839eb..84ea015f385 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -749,14 +749,8 @@ static NTSTATUS db_ctdb_store_db_seqnum(struct db_ctdb_transaction_handle *h,
 					uint64_t seqnum)
 {
 	NTSTATUS status;
-	const char *keyname = CTDB_DB_SEQNUM_KEY;
-	TDB_DATA key;
-	TDB_DATA data;
-
-	key = string_term_tdb_data(keyname);
-
-	data.dptr = (uint8_t *)&seqnum;
-	data.dsize = sizeof(uint64_t);
+	TDB_DATA key = string_term_tdb_data(CTDB_DB_SEQNUM_KEY);
+	TDB_DATA data = { .dptr=(uint8_t *)&seqnum, .dsize=sizeof(seqnum) };
 
 	status = db_ctdb_transaction_store(h, key, data);
 
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 10ae5a42dac..ecfde285e2a 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1447,6 +1447,7 @@ static NTSTATUS smbd_claim_version(struct messaging_context *msg,
 				   const char *version)
 {
 	const char *name = "samba_version_string";
+	const TDB_DATA key = string_term_tdb_data(name);
 	struct smbd_claim_version_state state;
 	struct g_lock_ctx *ctx;
 	NTSTATUS status;
@@ -1457,8 +1458,8 @@ static NTSTATUS smbd_claim_version(struct messaging_context *msg,
 		return NT_STATUS_UNSUCCESSFUL;
 	}
 
-	status = g_lock_lock(ctx, string_term_tdb_data(name), G_LOCK_READ,
-			     (struct timeval) { .tv_sec = 60 });
+	status = g_lock_lock(
+		ctx, key, G_LOCK_READ, (struct timeval) { .tv_sec = 60 });
 	if (!NT_STATUS_IS_OK(status)) {
 		DBG_WARNING("g_lock_lock(G_LOCK_READ) failed: %s\n",
 			    nt_errstr(status));
@@ -1468,12 +1469,11 @@ static NTSTATUS smbd_claim_version(struct messaging_context *msg,
 
 	state = (struct smbd_claim_version_state) { .mem_ctx = ctx };
 
-	status = g_lock_dump(ctx, string_term_tdb_data(name),
-			     smbd_claim_version_parser, &state);
+	status = g_lock_dump(ctx, key, smbd_claim_version_parser, &state);
 	if (!NT_STATUS_IS_OK(status) &&
 	    !NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
 		DBG_ERR("Could not read samba_version_string\n");
-		g_lock_unlock(ctx, string_term_tdb_data(name));
+		g_lock_unlock(ctx, key);
 		TALLOC_FREE(ctx);
 		return status;
 	}
@@ -1487,8 +1487,8 @@ static NTSTATUS smbd_claim_version(struct messaging_context *msg,
 		return NT_STATUS_OK;
 	}
 
-	status = g_lock_lock(ctx, string_term_tdb_data(name), G_LOCK_UPGRADE,
-			     (struct timeval) { .tv_sec = 60 });
+	status = g_lock_lock(
+		ctx, key, G_LOCK_UPGRADE, (struct timeval) { .tv_sec = 60 });
 	if (!NT_STATUS_IS_OK(status)) {
 		DBG_WARNING("g_lock_lock(G_LOCK_WRITE) failed: %s\n",
 			    nt_errstr(status));
@@ -1498,9 +1498,8 @@ static NTSTATUS smbd_claim_version(struct messaging_context *msg,
 		return NT_STATUS_SXS_VERSION_CONFLICT;
 	}
 
-	status = g_lock_write_data(ctx, string_term_tdb_data(name),
-				   (const uint8_t *)version,
-				   strlen(version)+1);
+	status = g_lock_write_data(
+		ctx, key, (const uint8_t *)version, strlen(version)+1);
 	if (!NT_STATUS_IS_OK(status)) {
 		DBG_WARNING("g_lock_write_data failed: %s\n",
 			    nt_errstr(status));
@@ -1508,8 +1507,8 @@ static NTSTATUS smbd_claim_version(struct messaging_context *msg,
 		return status;
 	}
 
-	status = g_lock_lock(ctx, string_term_tdb_data(name), G_LOCK_DOWNGRADE,
-			     (struct timeval) { .tv_sec = 60 });
+	status = g_lock_lock(
+		ctx, key, G_LOCK_DOWNGRADE, (struct timeval) { .tv_sec = 60 });
 	if (!NT_STATUS_IS_OK(status)) {
 		DBG_WARNING("g_lock_lock(G_LOCK_READ) failed: %s\n",
 			    nt_errstr(status));


-- 
Samba Shared Repository



More information about the samba-cvs mailing list