[SCM] Samba Shared Repository - branch v4-14-test updated

Karolin Seeger kseeger at samba.org
Fri Mar 5 14:26:01 UTC 2021


The branch, v4-14-test has been updated
       via  1c02f82ec6f s3:modules:vfs_virusfilter: Recent talloc changes cause infinite start-up failure
       via  4d1ed9c319d wscript: use --as-needed only if tested successfully
      from  1fb83efd7d5 s3: VFS: nfs4_acls. Add missing TALLOC_FREE(frame) in error path.

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-14-test


- Log -----------------------------------------------------------------
commit 1c02f82ec6f179e4dc6b66fd3d76bae955e781fe
Author: Trever L. Adams <trever.adams at gmail.com>
Date:   Fri Feb 26 14:52:03 2021 -0800

    s3:modules:vfs_virusfilter: Recent talloc changes cause infinite start-up failure
    
    Recent talloc changes cause the current check for failure to allocate to be incorrectly triggered.
    
    This patch checks to see if the original parameter to be checked for NULL if the talloc returns NULL. This allows for rapid passing in the ca
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14634
    RN: Fix failure of vfs_virusfilter starting due to talloc changes
    
    Signed-off-by: Trever L. Adams" <trever.adams at gmail.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Noel Power <noel.power at suse.com>
    (cherry picked from commit 5a92810082c9a9d2833946ae0d83ce05a6bde597)
    
    Autobuild-User(v4-14-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-14-test): Fri Mar  5 14:25:49 UTC 2021 on sn-devel-184

commit 4d1ed9c319deac5cba1682611dcefdf002cb9d48
Author: Björn Jacke <bj at sernet.de>
Date:   Tue Mar 2 22:47:35 2021 +0100

    wscript: use --as-needed only if tested successfully
    
    Some OSes like Solaris based OmiOS don't support this.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14288
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 996560191ac6bd603901dcd6c0de5d239e019ef4)

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

Summary of changes:
 source3/modules/vfs_virusfilter.c | 157 ++++++++++++++++++++++----------------
 wscript                           |   3 +-
 2 files changed, 92 insertions(+), 68 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_virusfilter.c b/source3/modules/vfs_virusfilter.c
index 290d9a23335..c9f5e2bf908 100644
--- a/source3/modules/vfs_virusfilter.c
+++ b/source3/modules/vfs_virusfilter.c
@@ -267,18 +267,21 @@ static int virusfilter_vfs_connect(
 
 	infected_file_command = lp_parm_const_string(
 		snum, "virusfilter", "infected file command", NULL);
-	config->infected_file_command = talloc_strdup(config, infected_file_command);
-	if (config->infected_file_command == NULL) {
-		DBG_ERR("virusfilter-vfs: out of memory!\n");
-		return -1;
+	if (infected_file_command != NULL) {
+		config->infected_file_command = talloc_strdup(config, infected_file_command);
+		if (config->infected_file_command == NULL) {
+			DBG_ERR("virusfilter-vfs: out of memory!\n");
+			return -1;
+		}
 	}
-
 	scan_error_command = lp_parm_const_string(
 		snum, "virusfilter", "scan error command", NULL);
-	config->scan_error_command = talloc_strdup(config, scan_error_command);
-	if (config->scan_error_command == NULL) {
-		DBG_ERR("virusfilter-vfs: out of memory!\n");
-		return -1;
+	if (scan_error_command != NULL) {
+		config->scan_error_command = talloc_strdup(config, scan_error_command);
+		if (config->scan_error_command == NULL) {
+			DBG_ERR("virusfilter-vfs: out of memory!\n");
+			return -1;
+		}
 	}
 
 	config->block_access_on_error = lp_parm_bool(
@@ -290,10 +293,12 @@ static int virusfilter_vfs_connect(
 	quarantine_dir = lp_parm_const_string(
 		snum, "virusfilter", "quarantine directory",
 		tmp ? tmp : "/tmp/.quarantine");
-	config->quarantine_dir = talloc_strdup(config, quarantine_dir);
-	if (config->quarantine_dir == NULL) {
-		DBG_ERR("virusfilter-vfs: out of memory!\n");
-		return -1;
+	if (quarantine_dir != NULL) {
+		config->quarantine_dir = talloc_strdup(config, quarantine_dir);
+		if (config->quarantine_dir == NULL) {
+			DBG_ERR("virusfilter-vfs: out of memory!\n");
+			return -1;
+		}
 	}
 
 	if (tmp != config->quarantine_dir) {
@@ -311,42 +316,50 @@ static int virusfilter_vfs_connect(
 	quarantine_prefix = lp_parm_const_string(
 		snum, "virusfilter", "quarantine prefix",
 		VIRUSFILTER_DEFAULT_QUARANTINE_PREFIX);
-	config->quarantine_prefix = talloc_strdup(config, quarantine_prefix);
-	if (config->quarantine_prefix == NULL) {
-		DBG_ERR("virusfilter-vfs: out of memory!\n");
-		return -1;
+	if (quarantine_prefix != NULL) {
+		config->quarantine_prefix = talloc_strdup(config, quarantine_prefix);
+		if (config->quarantine_prefix == NULL) {
+			DBG_ERR("virusfilter-vfs: out of memory!\n");
+			return -1;
+		}
 	}
 
 	quarantine_suffix = lp_parm_const_string(
 		snum, "virusfilter", "quarantine suffix",
 		VIRUSFILTER_DEFAULT_QUARANTINE_SUFFIX);
-	config->quarantine_suffix = talloc_strdup(config, quarantine_suffix);
-	if (config->quarantine_suffix == NULL) {
-		DBG_ERR("virusfilter-vfs: out of memory!\n");
-		return -1;
+	if (quarantine_suffix != NULL) {
+		config->quarantine_suffix = talloc_strdup(config, quarantine_suffix);
+		if (config->quarantine_suffix == NULL) {
+			DBG_ERR("virusfilter-vfs: out of memory!\n");
+			return -1;
+		}
 	}
 
 	/*
 	 * Make sure prefixes and suffixes do not contain directory
 	 * delimiters
 	 */
-	sret = strstr(config->quarantine_prefix, "/");
-	if (sret != NULL) {
-		DBG_ERR("quarantine prefix must not contain directory "
-			"delimiter(s) such as '/' (%s replaced with %s)\n",
-			config->quarantine_prefix,
-			VIRUSFILTER_DEFAULT_QUARANTINE_PREFIX);
-		config->quarantine_prefix =
-			VIRUSFILTER_DEFAULT_QUARANTINE_PREFIX;
-	}
-	sret = strstr(config->quarantine_suffix, "/");
-	if (sret != NULL) {
-		DBG_ERR("quarantine suffix must not contain directory "
-			"delimiter(s) such as '/' (%s replaced with %s)\n",
-			config->quarantine_suffix,
-			VIRUSFILTER_DEFAULT_QUARANTINE_SUFFIX);
-		config->quarantine_suffix =
-			VIRUSFILTER_DEFAULT_QUARANTINE_SUFFIX;
+	if (config->quarantine_prefix != NULL) {
+		sret = strstr(config->quarantine_prefix, "/");
+		if (sret != NULL) {
+			DBG_ERR("quarantine prefix must not contain directory "
+				"delimiter(s) such as '/' (%s replaced with %s)\n",
+				config->quarantine_prefix,
+				VIRUSFILTER_DEFAULT_QUARANTINE_PREFIX);
+			config->quarantine_prefix =
+				VIRUSFILTER_DEFAULT_QUARANTINE_PREFIX;
+		}
+	}
+	if (config->quarantine_suffix != NULL) {
+		sret = strstr(config->quarantine_suffix, "/");
+		if (sret != NULL) {
+			DBG_ERR("quarantine suffix must not contain directory "
+				"delimiter(s) such as '/' (%s replaced with %s)\n",
+				config->quarantine_suffix,
+				VIRUSFILTER_DEFAULT_QUARANTINE_SUFFIX);
+			config->quarantine_suffix =
+				VIRUSFILTER_DEFAULT_QUARANTINE_SUFFIX;
+		}
 	}
 
 	config->quarantine_keep_tree = lp_parm_bool(
@@ -358,42 +371,50 @@ static int virusfilter_vfs_connect(
 	rename_prefix = lp_parm_const_string(
 		snum, "virusfilter", "rename prefix",
 		VIRUSFILTER_DEFAULT_RENAME_PREFIX);
-	config->rename_prefix = talloc_strdup(config, rename_prefix);
-	if (config->rename_prefix == NULL) {
-		DBG_ERR("virusfilter-vfs: out of memory!\n");
-		return -1;
+	if (rename_prefix != NULL) {
+		config->rename_prefix = talloc_strdup(config, rename_prefix);
+		if (config->rename_prefix == NULL) {
+			DBG_ERR("virusfilter-vfs: out of memory!\n");
+			return -1;
+		}
 	}
 
 	rename_suffix = lp_parm_const_string(
 		snum, "virusfilter", "rename suffix",
 		VIRUSFILTER_DEFAULT_RENAME_SUFFIX);
-	config->rename_suffix = talloc_strdup(config, rename_suffix);
-	if (config->rename_suffix == NULL) {
-		DBG_ERR("virusfilter-vfs: out of memory!\n");
-		return -1;
+	if (rename_suffix != NULL) {
+		config->rename_suffix = talloc_strdup(config, rename_suffix);
+		if (config->rename_suffix == NULL) {
+			DBG_ERR("virusfilter-vfs: out of memory!\n");
+			return -1;
+		}
 	}
 
 	/*
 	 * Make sure prefixes and suffixes do not contain directory
 	 * delimiters
 	 */
-	sret = strstr(config->rename_prefix, "/");
-	if (sret != NULL) {
-		DBG_ERR("rename prefix must not contain directory "
-			"delimiter(s) such as '/' (%s replaced with %s)\n",
-			config->rename_prefix,
-			VIRUSFILTER_DEFAULT_RENAME_PREFIX);
-		config->rename_prefix =
-			VIRUSFILTER_DEFAULT_RENAME_PREFIX;
-	}
-	sret = strstr(config->rename_suffix, "/");
-	if (sret != NULL) {
-		DBG_ERR("rename suffix must not contain directory "
-			"delimiter(s) such as '/' (%s replaced with %s)\n",
-			config->rename_suffix,
-			VIRUSFILTER_DEFAULT_RENAME_SUFFIX);
-		config->rename_suffix =
-			VIRUSFILTER_DEFAULT_RENAME_SUFFIX;
+	if (config->rename_prefix != NULL) {
+		sret = strstr(config->rename_prefix, "/");
+		if (sret != NULL) {
+			DBG_ERR("rename prefix must not contain directory "
+				"delimiter(s) such as '/' (%s replaced with %s)\n",
+				config->rename_prefix,
+				VIRUSFILTER_DEFAULT_RENAME_PREFIX);
+			config->rename_prefix =
+				VIRUSFILTER_DEFAULT_RENAME_PREFIX;
+		}
+	}
+	if (config->rename_suffix != NULL) {
+		sret = strstr(config->rename_suffix, "/");
+		if (sret != NULL) {
+			DBG_ERR("rename suffix must not contain directory "
+				"delimiter(s) such as '/' (%s replaced with %s)\n",
+				config->rename_suffix,
+				VIRUSFILTER_DEFAULT_RENAME_SUFFIX);
+			config->rename_suffix =
+				VIRUSFILTER_DEFAULT_RENAME_SUFFIX;
+		}
 	}
 
 	config->infected_open_errno = lp_parm_int(
@@ -410,10 +431,12 @@ static int virusfilter_vfs_connect(
 
 	socket_path = lp_parm_const_string(
 		snum, "virusfilter", "socket path", NULL);
-	config->socket_path = talloc_strdup(config, socket_path);
-	if (config->socket_path == NULL) {
-		DBG_ERR("virusfilter-vfs: out of memory!\n");
-		return -1;
+	if (socket_path != NULL) {
+		config->socket_path = talloc_strdup(config, socket_path);
+		if (config->socket_path == NULL) {
+			DBG_ERR("virusfilter-vfs: out of memory!\n");
+			return -1;
+		}
 	}
 
 	/* canonicalize socket_path */
diff --git a/wscript b/wscript
index 334b2988234..3c6b130bd22 100644
--- a/wscript
+++ b/wscript
@@ -340,7 +340,8 @@ def configure(conf):
     # allows us to find problems on our development hosts faster.
     # It also results in faster load time.
 
-    conf.add_as_needed()
+    conf.ADD_LDFLAGS('-Wl,--as-needed', testflags=True)
+
 
     if not conf.CHECK_NEED_LC("-lc not needed"):
         conf.ADD_LDFLAGS('-lc', testflags=False)


-- 
Samba Shared Repository



More information about the samba-cvs mailing list