From 2bee0b247aa4eee93a64a34eb5484854c7b91b76 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Apr 07 2021 22:24:59 +0000 Subject: Log: executor: show CRM_OP_REGISTER rc in debug message Previously, process_lrmd_signon() would add the rc to the client reply but not pass it back to process_lrmd_message(), which would always log "OK" in its debug message, even if the sign-on was rejected. --- diff --git a/daemons/execd/execd_commands.c b/daemons/execd/execd_commands.c index 795ee01..47502e0 100644 --- a/daemons/execd/execd_commands.c +++ b/daemons/execd/execd_commands.c @@ -1503,10 +1503,10 @@ free_rsc(gpointer data) free(rsc); } -static xmlNode * -process_lrmd_signon(pcmk__client_t *client, xmlNode *request, int call_id) +static int +process_lrmd_signon(pcmk__client_t *client, xmlNode *request, int call_id, + xmlNode **reply) { - xmlNode *reply = NULL; int rc = pcmk_ok; const char *is_ipc_provider = crm_element_value(request, F_LRMD_IS_IPC_PROVIDER); const char *protocol_version = crm_element_value(request, F_LRMD_PROTOCOL_VERSION); @@ -1517,18 +1517,19 @@ process_lrmd_signon(pcmk__client_t *client, xmlNode *request, int call_id) rc = -EPROTO; } - reply = create_lrmd_reply(__FUNCTION__, rc, call_id); - crm_xml_add(reply, F_LRMD_OPERATION, CRM_OP_REGISTER); - crm_xml_add(reply, F_LRMD_CLIENTID, client->id); - crm_xml_add(reply, F_LRMD_PROTOCOL_VERSION, LRMD_PROTOCOL_VERSION); - if (crm_is_true(is_ipc_provider)) { // This is a remote connection from a cluster node's controller #ifdef SUPPORT_REMOTE ipc_proxy_add_provider(client); #endif } - return reply; + + *reply = create_lrmd_reply(__func__, rc, call_id); + crm_xml_add(*reply, F_LRMD_OPERATION, CRM_OP_REGISTER); + crm_xml_add(*reply, F_LRMD_CLIENTID, client->id); + crm_xml_add(*reply, F_LRMD_PROTOCOL_VERSION, LRMD_PROTOCOL_VERSION); + + return rc; } static int @@ -1841,7 +1842,7 @@ process_lrmd_message(pcmk__client_t *client, uint32_t id, xmlNode *request) #endif do_reply = 1; } else if (crm_str_eq(op, CRM_OP_REGISTER, TRUE)) { - reply = process_lrmd_signon(client, request, call_id); + rc = process_lrmd_signon(client, request, call_id, &reply); do_reply = 1; } else if (crm_str_eq(op, LRMD_OP_RSC_REG, TRUE)) { rc = process_lrmd_rsc_register(client, id, request);