]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-common: Ignore event scripts with multiple '.'s
authorAmitay Isaacs <amitay@gmail.com>
Thu, 12 Oct 2017 03:42:59 +0000 (14:42 +1100)
committerKarolin Seeger <kseeger@samba.org>
Wed, 25 Oct 2017 06:43:02 +0000 (08:43 +0200)
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@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 7720ca0729b127a93d78401aaf1341d79f9603a4)

ctdb/config/events.d/README
ctdb/server/ctdb_eventd.c

index 11da7028be9e6e1c0fb8327106dcc27b5f99d1df..69f5904c3c2a3335298bf407110b1dc088519512 100644 (file)
@@ -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.
index 232711ce4e24586bd463f8e478196239a64dfdc4..c9a9bf6fa0e5baeec83830d14bbbb878b1d1c763 100644 (file)
@@ -425,6 +425,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;
 }