diff options
author | Petr Cech <pcech@redhat.com> | 2015-07-08 07:17:28 -0400 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2015-08-31 18:30:19 +0200 |
commit | 11e8f3ecdddf8edd8b1bbe9f41b49ce8b709b92a (patch) | |
tree | cc5ae37861c5fb0efdb3e8dfd88bbdd543ab92b9 /src/responder/nss/nsssrv_cmd.c | |
parent | bdf422fde0fd6b40b3412bad3b200f8fd7ea8693 (diff) | |
download | sssd-11e8f3ecdddf8edd8b1bbe9f41b49ce8b709b92a.tar.gz sssd-11e8f3ecdddf8edd8b1bbe9f41b49ce8b709b92a.tar.xz sssd-11e8f3ecdddf8edd8b1bbe9f41b49ce8b709b92a.zip |
UTIL: Function 2string for enum sss_cli_command
Improvement of debug messages.
Instead of:"(0x0400): Running command [17]..."
We could see:"(0x0400): Running command [17][SSS_NSS_GETPWNAM]..."
(It's not used in sss_client. There are only hex numbers of commands.)
Resolves:
https://fedorahosted.org/sssd/ticket/2708
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/responder/nss/nsssrv_cmd.c')
-rw-r--r-- | src/responder/nss/nsssrv_cmd.c | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c index 43cdb135c..ec7e7285a 100644 --- a/src/responder/nss/nsssrv_cmd.c +++ b/src/responder/nss/nsssrv_cmd.c @@ -21,6 +21,7 @@ #include "util/util.h" #include "util/sss_nss.h" +#include "util/sss_cli_cmd.h" #include "responder/nss/nsssrv.h" #include "responder/nss/nsssrv_private.h" #include "responder/nss/nsssrv_netgroup.h" @@ -1071,8 +1072,8 @@ static int nss_cmd_assume_upn(struct nss_dom_ctx *dctx) } break; default: - DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command [%d].\n", - dctx->cmdctx->cmd); + DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command [%d][%s].\n", + dctx->cmdctx->cmd, sss_cmd2str(dctx->cmdctx->cmd)); ret = EINVAL; } @@ -1123,8 +1124,8 @@ static void nss_cmd_getby_dp_callback(uint16_t err_maj, uint32_t err_min, ret = nss_cmd_getbysid_send_reply(dctx); break; default: - DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command [%d].\n", - dctx->cmdctx->cmd); + DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command [%d][%s].\n", + dctx->cmdctx->cmd, sss_cmd2str(dctx->cmdctx->cmd)); ret = EINVAL; } goto done; @@ -1246,8 +1247,8 @@ static void nss_cmd_getby_dp_callback(uint16_t err_maj, uint32_t err_min, } break; default: - DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command [%d].\n", - dctx->cmdctx->cmd); + DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command [%d][%s].\n", + dctx->cmdctx->cmd, sss_cmd2str(dctx->cmdctx->cmd)); ret = EINVAL; } @@ -1353,7 +1354,8 @@ static int nss_cmd_getbynam(enum sss_cli_command cmd, struct cli_ctx *cctx) case SSS_NSS_GETORIGBYNAME: break; default: - DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command type [%d].\n", cmd); + DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command type [%d][%s].\n", + cmd, sss_cmd2str(cmd)); return EINVAL; } @@ -1389,8 +1391,8 @@ static int nss_cmd_getbynam(enum sss_cli_command cmd, struct cli_ctx *cctx) rawname = (const char *)body; dctx->mc_name = rawname; - DEBUG(SSSDBG_TRACE_FUNC, "Running command [%d] with input [%s].\n", - dctx->cmdctx->cmd, rawname); + DEBUG(SSSDBG_TRACE_FUNC, "Running command [%d][%s] with input [%s].\n", + cmd, sss_cmd2str(dctx->cmdctx->cmd), rawname); if (dctx->cmdctx->cmd == SSS_NSS_GETSIDBYNAME) { ret = nss_check_name_of_well_known_sid(cmdctx, rawname); @@ -1509,8 +1511,8 @@ static int nss_cmd_getbynam(enum sss_cli_command cmd, struct cli_ctx *cctx) } break; default: - DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command [%d].\n", - dctx->cmdctx->cmd); + DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command [%d][%s].\n", + dctx->cmdctx->cmd, sss_cmd2str(dctx->cmdctx->cmd)); ret = EINVAL; } @@ -1611,8 +1613,8 @@ static void nss_cmd_getbynam_done(struct tevent_req *req) } break; default: - DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command [%d].\n", - dctx->cmdctx->cmd); + DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command [%d][%s].\n", + dctx->cmdctx->cmd, sss_cmd2str(dctx->cmdctx->cmd)); ret = EINVAL; } @@ -1779,7 +1781,8 @@ static int nss_cmd_getbyid(enum sss_cli_command cmd, struct cli_ctx *cctx) case SSS_NSS_GETSIDBYID: break; default: - DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command type [%d].\n", cmd); + DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command type [%d][%s].\n", + cmd, sss_cmd2str(cmd)); return EINVAL; } @@ -1808,8 +1811,8 @@ static int nss_cmd_getbyid(enum sss_cli_command cmd, struct cli_ctx *cctx) } SAFEALIGN_COPY_UINT32(&cmdctx->id, body, NULL); - DEBUG(SSSDBG_TRACE_FUNC, "Running command [%d] with id [%"PRIu32"].\n", - dctx->cmdctx->cmd, cmdctx->id); + DEBUG(SSSDBG_TRACE_FUNC, "Running command [%d][%s] with id [%"PRIu32"].\n", + dctx->cmdctx->cmd, sss_cmd2str(dctx->cmdctx->cmd), cmdctx->id); switch(dctx->cmdctx->cmd) { case SSS_NSS_GETPWUID: @@ -1850,8 +1853,8 @@ static int nss_cmd_getbyid(enum sss_cli_command cmd, struct cli_ctx *cctx) } break; default: - DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command [%d].\n", - dctx->cmdctx->cmd); + DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command [%d][%s].\n", + dctx->cmdctx->cmd, sss_cmd2str(dctx->cmdctx->cmd)); ret = EINVAL; goto done; } @@ -1896,8 +1899,8 @@ static int nss_cmd_getbyid(enum sss_cli_command cmd, struct cli_ctx *cctx) } break; default: - DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command [%d].\n", - dctx->cmdctx->cmd); + DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command [%d][%s].\n", + dctx->cmdctx->cmd, sss_cmd2str(dctx->cmdctx->cmd)); ret = EINVAL; } @@ -1964,8 +1967,8 @@ static void nss_cmd_getbyid_done(struct tevent_req *req) } break; default: - DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command [%d].\n", - dctx->cmdctx->cmd); + DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command [%d][%s].\n", + dctx->cmdctx->cmd, sss_cmd2str(dctx->cmdctx->cmd)); ret = EINVAL; } @@ -5259,7 +5262,8 @@ static int nss_cmd_getbysid(enum sss_cli_command cmd, struct cli_ctx *cctx) size_t bin_sid_length; if (cmd != SSS_NSS_GETNAMEBYSID && cmd != SSS_NSS_GETIDBYSID) { - DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command type [%d].\n", cmd); + DEBUG(SSSDBG_CRIT_FAILURE, "Invalid command type [%d][%s].\n", + cmd, sss_cmd2str(cmd)); return EINVAL; } @@ -5301,8 +5305,8 @@ static int nss_cmd_getbysid(enum sss_cli_command cmd, struct cli_ctx *cctx) goto done; } - DEBUG(SSSDBG_TRACE_FUNC, "Running command [%d] with SID [%s].\n", - dctx->cmdctx->cmd, sid_str); + DEBUG(SSSDBG_TRACE_FUNC, "Running command [%d][%s] with SID [%s].\n", + dctx->cmdctx->cmd, sss_cmd2str(dctx->cmdctx->cmd), sid_str); cmdctx->secid = talloc_strdup(cmdctx, sid_str); if (cmdctx->secid == NULL) { |