[SCM] Samba Shared Repository - branch master updated

Martin Schwenke martins at samba.org
Wed Oct 18 08:20:02 UTC 2017


The branch, master has been updated
       via  3bc8880 ctdb-tests: Add tests for event scripts with multiple '.'s
       via  7720ca0 ctdb-common: Ignore event scripts with multiple '.'s
      from  f6d6af3 vfs_catia: Fix a potential memleak

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


- Log -----------------------------------------------------------------
commit 3bc8880ea0532abed1db002710d3dd6a91f750dc
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Oct 12 14:44:03 2017 +1100

    ctdb-tests: Add tests for event scripts with multiple '.'s
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13070
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Wed Oct 18 10:19:48 CEST 2017 on sn-devel-144

commit 7720ca0729b127a93d78401aaf1341d79f9603a4
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Oct 12 14:42:59 2017 +1100

    ctdb-common: Ignore event scripts with multiple '.'s
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13070
    
    This avoids running event script copies left by a package manager.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

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

Summary of changes:
 ctdb/common/run_event.c           |  6 ++++++
 ctdb/config/events.d/README       |  4 +++-
 ctdb/tests/cunit/run_event_001.sh | 21 +++++++++++++++++++++
 3 files changed, 30 insertions(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/common/run_event.c b/ctdb/common/run_event.c
index e5d562c..0961d65 100644
--- a/ctdb/common/run_event.c
+++ b/ctdb/common/run_event.c
@@ -60,6 +60,12 @@ static int script_filter(const struct dirent *de)
 		return 0;
 	}
 
+	/* Ignore filenames with multiple '.'s */
+	ptr = index(&de->d_name[3], '.');
+	if (ptr != NULL) {
+		return 0;
+	}
+
 	return 1;
 }
 
diff --git a/ctdb/config/events.d/README b/ctdb/config/events.d/README
index 36f94bb..7025a4b 100644
--- a/ctdb/config/events.d/README
+++ b/ctdb/config/events.d/README
@@ -11,7 +11,9 @@ alphanumeric sort order.
 
 As a special case, any eventscript that ends with a '~' character will be
 ignored since this is a common postfix that some editors will append to
-older versions of a file.
+older versions of a file.  Similarly, any eventscript with multiple '.'s
+will be ignored as package managers can create copies with additional
+suffix starting with '.' (e.g. .rpmnew, .dpkg-dist).
 
 Only executable event scripts are run by CTDB.  Any event script that
 does not have execute permission is ignored.
diff --git a/ctdb/tests/cunit/run_event_001.sh b/ctdb/tests/cunit/run_event_001.sh
index f0ffe4f..35c256b 100755
--- a/ctdb/tests/cunit/run_event_001.sh
+++ b/ctdb/tests/cunit/run_event_001.sh
@@ -37,6 +37,27 @@ required_result 1 <<EOF
 EOF
 unit_test test -x "${scriptdir}/prog"
 
+cat > "$scriptdir/10.test.rpmnew" <<EOF
+#!/bin/sh
+
+echo hello
+EOF
+chmod +x "$scriptdir/10.test.rpmnew"
+
+# Invalid script with multiple '.'s
+ok <<EOF
+No event scripts found
+EOF
+unit_test run_event_test "$scriptdir" list
+
+ok <<EOF
+Script disable 10.test.rpmnew completed with result=22
+EOF
+unit_test run_event_test "$scriptdir" disable 10.test.rpmnew
+
+ok_null
+unit_test test -x "${scriptdir}/10.test.rpmnew"
+
 cat > "$scriptdir/11.foo" <<EOF
 #!/bin/sh
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list