mirror of
https://github.com/aljazceru/plugins.git
synced 2025-12-24 00:24:19 +01:00
commando: don't deadlock if the make us call into ourselves.
For now we only support calling into commando-rune, not chaining commando commands! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -143,6 +143,16 @@ def try_command(plugin, peer_id, idnum, method, params, runestr):
|
||||
ok, failstr = check_rune(plugin, peer_id, runestr, method, params)
|
||||
if not ok:
|
||||
res = {'error': 'Not authorized: ' + failstr}
|
||||
elif method in plugin.methods:
|
||||
# Don't try to call indirectly into ourselves; we deadlock!
|
||||
# But commando-rune is useful, so hardcode that.
|
||||
if method == "commando-rune":
|
||||
if isinstance(params, list):
|
||||
res = {'result': commando_rune(plugin, *params)}
|
||||
else:
|
||||
res = {'result': commando_rune(plugin, **params)}
|
||||
else:
|
||||
res = {'error': 'FIXME: Refusing to call inside ourselves'}
|
||||
else:
|
||||
try:
|
||||
res = {'result': plugin.rpc.call(method, params)}
|
||||
|
||||
Reference in New Issue
Block a user