From: Amitay Isaacs Date: Thu, 12 Oct 2017 03:42:59 +0000 (+1100) Subject: ctdb-common: Ignore event scripts with multiple '.'s X-Git-Tag: tevent-0.9.34~191 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7720ca0729b127a93d78401aaf1341d79f9603a4;p=thirdparty%2Fsamba.git 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 Reviewed-by: Martin Schwenke --- diff --git a/ctdb/common/run_event.c b/ctdb/common/run_event.c index e5d562c96b3..0961d657a74 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 36f94bb8d35..7025a4b4432 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.