lightningd: convert plugin->cmd to absolute path, fail plugin early when non-existent

Otherwise different relative paths (e.g. /dir/plugin and /dir/../dir/plugin) to same plugin
executable would not be recognized as the same plugin
This commit is contained in:
Simon Vrouwe
2022-06-15 08:47:57 +03:00
committed by neil saitug
parent ae71a87c40
commit 981fd2326a
4 changed files with 24 additions and 7 deletions

View File

@@ -458,11 +458,14 @@ static char *opt_add_proxy_addr(const char *arg, struct lightningd *ld)
static char *opt_add_plugin(const char *arg, struct lightningd *ld)
{
struct plugin *p;
if (plugin_blacklisted(ld->plugins, arg)) {
log_info(ld->log, "%s: disabled via disable-plugin", arg);
return NULL;
}
plugin_register(ld->plugins, arg, NULL, false, NULL, NULL);
p = plugin_register(ld->plugins, arg, NULL, false, NULL, NULL);
if (!p)
return tal_fmt(NULL, "Failed to register %s: %s", arg, strerror(errno));
return NULL;
}
@@ -485,11 +488,14 @@ static char *opt_clear_plugins(struct lightningd *ld)
static char *opt_important_plugin(const char *arg, struct lightningd *ld)
{
struct plugin *p;
if (plugin_blacklisted(ld->plugins, arg)) {
log_info(ld->log, "%s: disabled via disable-plugin", arg);
return NULL;
}
plugin_register(ld->plugins, arg, NULL, true, NULL, NULL);
p = plugin_register(ld->plugins, arg, NULL, true, NULL, NULL);
if (!p)
return tal_fmt(NULL, "Failed to register %s: %s", arg, strerror(errno));
return NULL;
}