mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-22 00:24:19 +01:00
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:
committed by
neil saitug
parent
ae71a87c40
commit
981fd2326a
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user