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:
Todd C. Miller
2020-02-02 12:37:11 -07:00
parent 49e7e4ecd5
commit 658702b6d4
2 changed files with 7 additions and 11 deletions

View File

@@ -1807,6 +1807,7 @@ plugin_event_loopbreak(struct sudo_plugin_event *pev)
/*
* Reset the event base of a struct sudo_plugin_event.
* 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
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);
if (ev_int->private.base != NULL)
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;
}