diff --git a/hsmd/hsmd.c b/hsmd/hsmd.c index 96d480e95..28eafd153 100644 --- a/hsmd/hsmd.c +++ b/hsmd/hsmd.c @@ -633,9 +633,10 @@ static struct io_plan *handle_client(struct io_conn *conn, struct client *c) /* Before we do anything else, is this client allowed to do * what he asks for? */ - if (!check_client_capabilities(c->hsmd_client, t)) + if (!hsmd_check_client_capabilities(c->hsmd_client, t)) return bad_req_fmt(conn, c, c->msg_in, - "does not have capability to run %d", t); + "client does not have capability to run %d", + t); /* Now actually go and do what the client asked for */ switch (t) { diff --git a/hsmd/libhsmd.c b/hsmd/libhsmd.c index 328914653..cef38c5b3 100644 --- a/hsmd/libhsmd.c +++ b/hsmd/libhsmd.c @@ -50,7 +50,8 @@ struct hsmd_client *hsmd_client_new_peer(const tal_t *ctx, u64 capabilities, } /*~ This routine checks that a client is allowed to call the handler. */ -bool check_client_capabilities(struct hsmd_client *client, enum hsmd_wire t) +bool hsmd_check_client_capabilities(struct hsmd_client *client, + enum hsmd_wire t) { /*~ Here's a useful trick: enums in C are not real types, they're * semantic sugar sprinkled over an int, bascally (in fact, older @@ -1319,7 +1320,7 @@ u8 *hsmd_handle_client_message(const tal_t *ctx, struct hsmd_client *client, /* Before we do anything else, is this client allowed to do * what he asks for? */ - if (!check_client_capabilities(client, t)) + if (!hsmd_check_client_capabilities(client, t)) return hsmd_status_bad_request_fmt( client, msg, "does not have capability to run %d", t); diff --git a/hsmd/libhsmd.h b/hsmd/libhsmd.h index 080fceda1..cf0016d63 100644 --- a/hsmd/libhsmd.h +++ b/hsmd/libhsmd.h @@ -90,9 +90,9 @@ void hsmd_status_fmt(enum log_level level, void hsmd_status_failed(enum status_failreason code, const char *fmt, ...) PRINTF_FMT(2,3); -/* The following declarations are here only temporarily while we migrate logic from hsmd.c to libhsmd.c */ +/* Given a message type and a client that sent the message, determine + * whether the client was permitted to send such a message. */ +bool hsmd_check_client_capabilities(struct hsmd_client *client, + enum hsmd_wire t); -bool check_client_capabilities(struct hsmd_client *client, enum hsmd_wire t); - -/* end of temporary global declarations. The above will be removed once we complete the migration. */ #endif /* LIGHTNING_HSMD_LIBHSMD_H */