The Samba-Bugzilla – Attachment 13707 Details for
Bug 13070
Avoid running RPM/DPKG-suffixed event scripts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patches for v4-7
BZ13070-v4-7.patch (text/plain), 3.14 KB, created by
Amitay Isaacs
on 2017-10-20 04:21:31 UTC
(
hide
)
Description:
Patches for v4-7
Filename:
MIME Type:
Creator:
Amitay Isaacs
Created:
2017-10-20 04:21:31 UTC
Size:
3.14 KB
patch
obsolete
>From eea5a234bb01ef71743faa26efcd99795305555e Mon Sep 17 00:00:00 2001 >From: Amitay Isaacs <amitay@gmail.com> >Date: Thu, 12 Oct 2017 14:42:59 +1100 >Subject: [PATCH 1/2] 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@gmail.com> >Reviewed-by: Martin Schwenke <martin@meltin.net> >(cherry picked from commit 7720ca0729b127a93d78401aaf1341d79f9603a4) >--- > ctdb/common/run_event.c | 6 ++++++ > ctdb/config/events.d/README | 4 +++- > 2 files changed, 9 insertions(+), 1 deletion(-) > >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 11da7028be9..69f5904c3c2 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. >-- >2.13.6 > > >From 187daec05587dc9dcd624c8dfc1bfde17ab3210c Mon Sep 17 00:00:00 2001 >From: Amitay Isaacs <amitay@gmail.com> >Date: Thu, 12 Oct 2017 14:44:03 +1100 >Subject: [PATCH 2/2] 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@gmail.com> >Reviewed-by: Martin Schwenke <martin@meltin.net> > >Autobuild-User(master): Martin Schwenke <martins@samba.org> >Autobuild-Date(master): Wed Oct 18 10:19:48 CEST 2017 on sn-devel-144 > >(cherry picked from commit 3bc8880ea0532abed1db002710d3dd6a91f750dc) >--- > ctdb/tests/cunit/run_event_001.sh | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > >diff --git a/ctdb/tests/cunit/run_event_001.sh b/ctdb/tests/cunit/run_event_001.sh >index f0ffe4ff0c6..35c256b6fcd 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 > >-- >2.13.6 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
martins
:
review+
Actions:
View
Attachments on
bug 13070
: 13707 |
13708