lifecycle: if lif_config.allow_addon_scripts is disabled, don't run addon scripts

This commit is contained in:
Ariadne Conill 2020-09-14 17:26:45 -06:00
parent c1c9115e5d
commit 4b30dc4573

View file

@ -25,6 +25,7 @@
#include "libifupdown/lifecycle.h"
#include "libifupdown/state.h"
#include "libifupdown/tokenize.h"
#include "libifupdown/config-file.h"
static bool
handle_commands_for_phase(const struct lif_execute_opts *opts, char *const envp[], const struct lif_interface *iface, const char *phase)
@ -240,6 +241,10 @@ lif_lifecycle_run_phase(const struct lif_execute_opts *opts, struct lif_interfac
if (!handle_commands_for_phase(opts, envp, iface, phase))
goto handle_error;
/* if we don't need to support /etc/if-X.d we're done here */
if (!lif_config.allow_addon_scripts)
goto out_free;
/* Check if scripts dir for this phase is present and bail out if it isn't */
struct stat dir_stat;
char dir_path[4096];