[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Sun Jan 19 19:59:07 UTC 2020


The branch, master has been updated
       via  4dd026d0d33 smbd: Fix claiming version
       via  25bcf0e7890 lib: Use closefrom() in smbrun.c
       via  42a3e2e503b ctdbd: Use struct initialization
       via  b274bc698ed dsdb: Use write_data() to write to the password check script
       via  229518ec01b dsdb: Align integer types
       via  37eb87d2be8 lib: Align integer types
      from  cffcc39f185 heimdal_build: Remove bashism from --address-sanitizer build rule

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


- Log -----------------------------------------------------------------
commit 4dd026d0d33ab5d3c6cc22d63a74917c1c2c2f27
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jan 17 16:00:18 2020 +0100

    smbd: Fix claiming version
    
    We now have to do an explicit DOWNGRADE when we want to change from
    G_LOCK_WRITE to G_LOCK_READ.
    
    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): Sun Jan 19 19:58:01 UTC 2020 on sn-devel-184

commit 25bcf0e7890a690f5f573dc5e8392807c403948c
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Jan 8 16:07:30 2020 +0100

    lib: Use closefrom() in smbrun.c
    
    INSURE is never defined or used.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 42a3e2e503baef456082d40617a7639a9e226491
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jan 17 11:28:31 2020 +0100

    ctdbd: Use struct initialization
    
    2 lines less
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit b274bc698ed26c6897beee6051532244bc30d2ec
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 19 12:29:56 2020 +0100

    dsdb: Use write_data() to write to the password check script
    
    A simple write() might be interrupted or do short writes. Highly
    unlikely, but if it happens, it will be impossible to diagnose.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 229518ec01b495e0133d83d3560a432a08307c0b
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 19 12:29:39 2020 +0100

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

commit 37eb87d2be88e0e47c72287033e9c829e9625d41
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 19 11:50:57 2020 +0100

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

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

Summary of changes:
 ctdb/server/ctdb_daemon.c  |  4 +---
 source3/lib/errmap_unix.c  |  4 ++--
 source3/lib/smbrun.c       | 14 ++------------
 source3/libsmb/errormap.c  |  2 +-
 source3/smbd/server.c      |  2 +-
 source4/dsdb/common/util.c | 13 ++++++++-----
 6 files changed, 15 insertions(+), 24 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c
index d9a6bf6d741..cc688b07e9c 100644
--- a/ctdb/server/ctdb_daemon.c
+++ b/ctdb/server/ctdb_daemon.c
@@ -1173,7 +1173,7 @@ static void ctdb_accept_client(struct tevent_context *ev,
 */
 static int ux_socket_bind(struct ctdb_context *ctdb)
 {
-	struct sockaddr_un addr;
+	struct sockaddr_un addr = { .sun_family = AF_UNIX };
 	int ret;
 
 	ctdb->daemon.sd = socket(AF_UNIX, SOCK_STREAM, 0);
@@ -1181,8 +1181,6 @@ static int ux_socket_bind(struct ctdb_context *ctdb)
 		return -1;
 	}
 
-	memset(&addr, 0, sizeof(addr));
-	addr.sun_family = AF_UNIX;
 	strncpy(addr.sun_path, ctdb->daemon.name, sizeof(addr.sun_path)-1);
 
 	if (! sock_clean(ctdb->daemon.name)) {
diff --git a/source3/lib/errmap_unix.c b/source3/lib/errmap_unix.c
index 9eb30f7b814..5a6dd245023 100644
--- a/source3/lib/errmap_unix.c
+++ b/source3/lib/errmap_unix.c
@@ -126,7 +126,7 @@ static const struct {
 
 NTSTATUS map_nt_error_from_unix(int unix_error)
 {
-	int i = 0;
+	size_t i = 0;
 
 	if (unix_error == 0) {
 		/* we map this to an error, not success, as this
@@ -264,7 +264,7 @@ static const struct {
 
 int map_errno_from_nt_status(NTSTATUS status)
 {
-	int i;
+	size_t i;
 	DEBUG(10,("map_errno_from_nt_status: 32 bit codes: code=%08x\n",
 		NT_STATUS_V(status)));
 
diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c
index 3b7ed542ab2..8e3675fdc22 100644
--- a/source3/lib/smbrun.c
+++ b/source3/lib/smbrun.c
@@ -181,14 +181,9 @@ static int smbrun_internal(const char *cmd, int *outfd, bool sanitize,
 		}
 	}
 
-#ifndef __INSURE__
 	/* close all other file descriptors, leaving only 0, 1 and 2. 0 and
 	   2 point to /dev/null from the startup code */
-	{
-	int fd;
-	for (fd=3;fd<256;fd++) close(fd);
-	}
-#endif
+	closefrom(3);
 
 	{
 		char *newcmd = NULL;
@@ -347,14 +342,9 @@ int smbrunsecret(const char *cmd, const char *secret)
 		}
 	}
 
-#ifndef __INSURE__
 	/* close all other file descriptors, leaving only 0, 1 and 2. 0 and
 	   2 point to /dev/null from the startup code */
-	{
-		int fd;
-		for (fd = 3; fd < 256; fd++) close(fd);
-	}
-#endif
+	closefrom(3);
 
 	execl("/bin/sh", "sh", "-c", cmd, NULL);  
 
diff --git a/source3/libsmb/errormap.c b/source3/libsmb/errormap.c
index ce3bb952207..ba8bc659bab 100644
--- a/source3/libsmb/errormap.c
+++ b/source3/libsmb/errormap.c
@@ -283,7 +283,7 @@ convert a dos eclas/ecode to a NT status32 code
  *****************************************************************************/
 NTSTATUS dos_to_ntstatus(uint8_t eclass, uint32_t ecode)
 {
-	int i;
+	size_t i;
 	if (eclass == 0) return NT_STATUS_OK;
 	for (i=0; i < ARRAY_SIZE(dos_to_ntstatus_map); i++) {
 		if (eclass == dos_to_ntstatus_map[i].dos_class &&
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index cedd2b312a3..10ae5a42dac 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1508,7 +1508,7 @@ static NTSTATUS smbd_claim_version(struct messaging_context *msg,
 		return status;
 	}
 
-	status = g_lock_lock(ctx, string_term_tdb_data(name), G_LOCK_READ,
+	status = g_lock_lock(ctx, string_term_tdb_data(name), 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",
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index f1b28129c38..d88688a8ec1 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -47,6 +47,7 @@
 #include "libds/common/flag_mapping.h"
 #include "lib/util/access.h"
 #include "lib/util/util_str_hex.h"
+#include "lib/util/sys_rw_data.h"
 #include "libcli/util/ntstatus.h"
 
 /*
@@ -2143,9 +2144,9 @@ enum samr_ValidationStatus samdb_check_password(TALLOC_CTX *mem_ctx,
 
 		cps_stdin = samba_runcmd_export_stdin(req);
 
-		nwritten = write(cps_stdin, utf8_blob->data,
-				 utf8_blob->length);
-		if (nwritten != utf8_blob->length) {
+		nwritten = write_data(
+			cps_stdin, utf8_blob->data, utf8_blob->length);
+		if (nwritten == -1) {
 			close(cps_stdin);
 			TALLOC_FREE(password_script);
 			TALLOC_FREE(event_ctx);
@@ -5439,7 +5440,8 @@ NTSTATUS dsdb_update_bad_pwd_count(TALLOC_CTX *mem_ctx,
 				   struct ldb_message *pso_msg,
 				   struct ldb_message **_mod_msg)
 {
-	int i, ret, badPwdCount;
+	int ret, badPwdCount;
+	unsigned int i;
 	int64_t lockoutThreshold, lockOutObservationWindow;
 	struct dom_sid *sid;
 	struct timeval tv_now = timeval_current();
@@ -5537,7 +5539,8 @@ int dsdb_user_obj_set_defaults(struct ldb_context *ldb,
 			       struct ldb_message *usr_obj,
 			       struct ldb_request *req)
 {
-	int i, ret;
+	size_t i;
+	int ret;
 	const struct attribute_values {
 		const char *name;
 		const char *value;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list