ctdb-common: Ignore event scripts with multiple '.'s
authorAmitay Isaacs <amitay@gmail.com>
Thu, 12 Oct 2017 03:42:59 +0000 (14:42 +1100)
committerMartin Schwenke <martins@samba.org>
Wed, 18 Oct 2017 04:20:18 +0000 (06:20 +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>
ctdb/common/run_event.c
ctdb/config/events.d/README

index e5d562c96b3926600efc0cf3b0e4d370c87a5c55..0961d657a743fabfd31b4e629a4fd70e2081fdca 100644 (file)
@@ -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;
 }
 
index 36f94bb8d35aa9523f8e2b026b0058290cd5b93d..7025a4b44324c99a50e311393c5d797ca3ff8a17 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.