ctdb-daemon: Schedule running of callback if there are no event scripts
commited7a8f45039d2998b0e18522f3ec34e160c2a65b
authorMartin Schwenke <martin@meltin.net>
Fri, 26 Aug 2016 06:29:47 +0000 (26 16:29 +1000)
committerKarolin Seeger <kseeger@samba.org>
Tue, 13 Sep 2016 10:27:29 +0000 (13 12:27 +0200)
tree254a9dd3868dca6d0324acd60ddc7a3cc6b26346
parent438a79ede0f658313a51bee5df507d996c079636
ctdb-daemon: Schedule running of callback if there are no event scripts

The callback should never be called before an immediate return.  The
callback might reply to a control and the caller of
ctdb_event_script_callback_v() may not have assigned/stolen the
pointer to control structure into the private data.  Therefore,
calling the callback can dereference an uninitialised pointer to the
control structure when attempting to reply.

ctdb_event_script_callback_v() must succeed when there are no event
scripts.  On success the caller will mark the call as asynchronous and
expect the callback to be called.  Given that it can't be called
before return then it needs to be scheduled.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12180

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 9076c44f35bf309b9e183bae98829f7154b93f33)
ctdb/server/eventscript.c