For plugin events, set the sudo event base for setbase(NULL).
This makes it possible for a plugin to change the event base to a local one and then reset it back to its original value.
This commit is contained in:
@@ -1122,16 +1122,11 @@ handle_server_hello(ServerHello *msg, struct client_closure *closure)
|
|||||||
__func__, n + 1, msg->servers[n]);
|
__func__, n + 1, msg->servers[n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move read event back to main sudo event loop. */
|
/*
|
||||||
closure->read_ev->del(closure->read_ev);
|
* Move read event back to main sudo event loop.
|
||||||
if (closure->read_ev->set(closure->read_ev, closure->sock,
|
* Server messages may occur at any time, so no timeout.
|
||||||
SUDO_PLUGIN_EV_READ|SUDO_PLUGIN_EV_PERSIST,
|
*/
|
||||||
server_msg_cb, closure) == -1) {
|
closure->read_ev->setbase(closure->read_ev, NULL);
|
||||||
sudo_warn(U_("unable to add event to queue"));
|
|
||||||
debug_return_bool(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Server messages may occur at arbitrary times so no timeout. */
|
|
||||||
if (closure->read_ev->add(closure->read_ev, NULL) == -1) {
|
if (closure->read_ev->add(closure->read_ev, NULL) == -1) {
|
||||||
sudo_warn(U_("unable to add event to queue"));
|
sudo_warn(U_("unable to add event to queue"));
|
||||||
debug_return_bool(false);
|
debug_return_bool(false);
|
||||||
|
@@ -1807,6 +1807,7 @@ plugin_event_loopbreak(struct sudo_plugin_event *pev)
|
|||||||
/*
|
/*
|
||||||
* Reset the event base of a struct sudo_plugin_event.
|
* Reset the event base of a struct sudo_plugin_event.
|
||||||
* The event is removed from the old base (if any) first.
|
* The event is removed from the old base (if any) first.
|
||||||
|
* A NULL base can be used to set the default sudo event base.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
plugin_event_setbase(struct sudo_plugin_event *pev, void *base)
|
plugin_event_setbase(struct sudo_plugin_event *pev, void *base)
|
||||||
@@ -1817,7 +1818,7 @@ plugin_event_setbase(struct sudo_plugin_event *pev, void *base)
|
|||||||
ev_int = __containerof(pev, struct sudo_plugin_event_int, public);
|
ev_int = __containerof(pev, struct sudo_plugin_event_int, public);
|
||||||
if (ev_int->private.base != NULL)
|
if (ev_int->private.base != NULL)
|
||||||
sudo_ev_del(ev_int->private.base, &ev_int->private);
|
sudo_ev_del(ev_int->private.base, &ev_int->private);
|
||||||
ev_int->private.base = base;
|
ev_int->private.base = base ? base : sudo_event_base;
|
||||||
debug_return;
|
debug_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user