diff options
author | Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com> | 2014-02-12 10:12:04 -0500 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-02-12 22:30:55 +0100 |
commit | a3c8390d19593b1e5277d95bfb4ab206d4785150 (patch) | |
tree | 2eb4e5432f4f79a75589c03b1513b656879ebf9c /src/responder/sudo | |
parent | cc026fd9ba386f2197e3217940d597dcad1a26fe (diff) | |
download | sssd-a3c8390d19593b1e5277d95bfb4ab206d4785150.tar.gz sssd-a3c8390d19593b1e5277d95bfb4ab206d4785150.tar.xz sssd-a3c8390d19593b1e5277d95bfb4ab206d4785150.zip |
Make DEBUG macro invocations variadic
Use a script to update DEBUG macro invocations to use it as a variadic
macro, supplying format string and its arguments directly, instead of
wrapping them in parens.
This script was used to update the code:
grep -rwl --include '*.[hc]' DEBUG . |
while read f; do
mv "$f"{,.orig}
perl -e \
'use strict;
use File::Slurp;
my $text=read_file(\*STDIN);
$text=~s#(\bDEBUG\s*\([^(]+)\((.*?)\)\s*\)\s*;#$1$2);#gs;
print $text;' < "$f.orig" > "$f"
rm "$f.orig"
done
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Stephen Gallagher <sgallagh@redhat.com>
Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'src/responder/sudo')
-rw-r--r-- | src/responder/sudo/sudosrv.c | 24 | ||||
-rw-r--r-- | src/responder/sudo/sudosrv_cmd.c | 50 | ||||
-rw-r--r-- | src/responder/sudo/sudosrv_dp.c | 16 | ||||
-rw-r--r-- | src/responder/sudo/sudosrv_get_sudorules.c | 134 | ||||
-rw-r--r-- | src/responder/sudo/sudosrv_query.c | 40 |
5 files changed, 132 insertions, 132 deletions
diff --git a/src/responder/sudo/sudosrv.c b/src/responder/sudo/sudosrv.c index e6bd997ec..b821c96cd 100644 --- a/src/responder/sudo/sudosrv.c +++ b/src/responder/sudo/sudosrv.c @@ -64,7 +64,7 @@ static void sudo_dp_reconnect_init(struct sbus_connection *conn, /* Did we reconnect successfully? */ if (status == SBUS_RECONNECT_SUCCESS) { - DEBUG(SSSDBG_TRACE_FUNC, ("Reconnected to the Data Provider.\n")); + DEBUG(SSSDBG_TRACE_FUNC, "Reconnected to the Data Provider.\n"); /* Identify ourselves to the data provider */ ret = dp_common_send_id(be_conn->conn, @@ -78,8 +78,8 @@ static void sudo_dp_reconnect_init(struct sbus_connection *conn, } /* Failed to reconnect */ - DEBUG(SSSDBG_FATAL_FAILURE, ("Could not reconnect to %s provider.\n", - be_conn->domain->name)); + DEBUG(SSSDBG_FATAL_FAILURE, "Could not reconnect to %s provider.\n", + be_conn->domain->name); } int sudo_process_init(TALLOC_CTX *mem_ctx, @@ -105,13 +105,13 @@ int sudo_process_init(TALLOC_CTX *mem_ctx, &sudo_dp_interface, &rctx); if (ret != EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, ("sss_process_init() failed\n")); + DEBUG(SSSDBG_FATAL_FAILURE, "sss_process_init() failed\n"); return ret; } sudo_ctx = talloc_zero(rctx, struct sudo_ctx); if (!sudo_ctx) { - DEBUG(SSSDBG_FATAL_FAILURE, ("fatal error initializing sudo_ctx\n")); + DEBUG(SSSDBG_FATAL_FAILURE, "fatal error initializing sudo_ctx\n"); ret = ENOMEM; goto fail; } @@ -126,7 +126,7 @@ int sudo_process_init(TALLOC_CTX *mem_ctx, 3, &max_retries); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, - ("Failed to set up automatic reconnection\n")); + "Failed to set up automatic reconnection\n"); goto fail; } @@ -143,18 +143,18 @@ int sudo_process_init(TALLOC_CTX *mem_ctx, CONFDB_DEFAULT_SUDO_TIMED, &sudo_ctx->timed); if (ret != EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, ("Error reading from confdb (%d) [%s]\n", - ret, strerror(ret))); + DEBUG(SSSDBG_FATAL_FAILURE, "Error reading from confdb (%d) [%s]\n", + ret, strerror(ret)); goto fail; } ret = schedule_get_domains_task(rctx, rctx->ev, rctx); if (ret != EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, ("schedule_get_domains_tasks failed.\n")); + DEBUG(SSSDBG_FATAL_FAILURE, "schedule_get_domains_tasks failed.\n"); goto fail; } - DEBUG(SSSDBG_TRACE_FUNC, ("SUDO Initialization complete\n")); + DEBUG(SSSDBG_TRACE_FUNC, "SUDO Initialization complete\n"); return EOK; @@ -205,8 +205,8 @@ int main(int argc, const char *argv[]) ret = die_if_parent_died(); if (ret != EOK) { /* This is not fatal, don't return */ - DEBUG(SSSDBG_OP_FAILURE, ("Could not set up to exit " - "when parent process does\n")); + DEBUG(SSSDBG_OP_FAILURE, "Could not set up to exit " + "when parent process does\n"); } ret = sudo_process_init(main_ctx, diff --git a/src/responder/sudo/sudosrv_cmd.c b/src/responder/sudo/sudosrv_cmd.c index 8f07e8b3a..fd8c46d63 100644 --- a/src/responder/sudo/sudosrv_cmd.c +++ b/src/responder/sudo/sudosrv_cmd.c @@ -47,15 +47,15 @@ static errno_t sudosrv_cmd_send_reply(struct sudo_cmd_ctx *cmd_ctx, &cli_ctx->creq->out); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Unable to create a new packet [%d]; %s\n", - ret, strerror(ret))); + "Unable to create a new packet [%d]; %s\n", + ret, strerror(ret)); goto done; } ret = sss_packet_grow(cli_ctx->creq->out, response_len); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Unable to create response: %s\n", strerror(ret))); + "Unable to create response: %s\n", strerror(ret)); goto done; } sss_packet_get_body(cli_ctx->creq->out, &packet_body, &packet_len); @@ -80,8 +80,8 @@ static errno_t sudosrv_cmd_send_error(TALLOC_CTX *mem_ctx, int ret = EOK; if (error == EOK) { - DEBUG(SSSDBG_MINOR_FAILURE, ("Everything is fine but we are " - "returning error?\n")); + DEBUG(SSSDBG_MINOR_FAILURE, "Everything is fine but we are " + "returning error?\n"); return EFAULT; } @@ -109,8 +109,8 @@ errno_t sudosrv_cmd_done(struct sudo_cmd_ctx *cmd_ctx, int ret) if (cmd_ctx->sudo_ctx->timed) { /* filter rules by time */ - DEBUG(SSSDBG_TRACE_FUNC, ("Applying time restrictions on" - "%u rules\n", cmd_ctx->num_rules)); + DEBUG(SSSDBG_TRACE_FUNC, "Applying time restrictions on" + "%u rules\n", cmd_ctx->num_rules); ret = sysdb_sudo_filter_rules_by_time(cmd_ctx, cmd_ctx->num_rules, cmd_ctx->rules, 0, @@ -119,8 +119,8 @@ errno_t sudosrv_cmd_done(struct sudo_cmd_ctx *cmd_ctx, int ret) return EFAULT; } - DEBUG(SSSDBG_TRACE_FUNC, ("Got %u rules after time filter\n", - num_rules)); + DEBUG(SSSDBG_TRACE_FUNC, "Got %u rules after time filter\n", + num_rules); } /* send result */ @@ -155,7 +155,7 @@ errno_t sudosrv_cmd_done(struct sudo_cmd_ctx *cmd_ctx, int ret) } if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Fatal error, killing connection!\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Fatal error, killing connection!\n"); talloc_free(cmd_ctx->cli_ctx); return EFAULT; } @@ -179,7 +179,7 @@ static int sudosrv_cmd(enum sss_sudo_type type, struct cli_ctx *cli_ctx) cmd_ctx = talloc_zero(cli_ctx, struct sudo_cmd_ctx); if (cmd_ctx == NULL) { /* kill the connection here as we have no context for reply */ - DEBUG(SSSDBG_FATAL_FAILURE, ("Out of memory?\n")); + DEBUG(SSSDBG_FATAL_FAILURE, "Out of memory?\n"); return ENOMEM; } @@ -188,25 +188,25 @@ static int sudosrv_cmd(enum sss_sudo_type type, struct cli_ctx *cli_ctx) cmd_ctx->type = type; cmd_ctx->sudo_ctx = talloc_get_type(cli_ctx->rctx->pvt_ctx, struct sudo_ctx); if (cmd_ctx->sudo_ctx == NULL) { - DEBUG(SSSDBG_FATAL_FAILURE, ("sudo_ctx not set, killing connection!\n")); + DEBUG(SSSDBG_FATAL_FAILURE, "sudo_ctx not set, killing connection!\n"); return EFAULT; } /* if protocol is invalid return */ switch (protocol) { case 0: - DEBUG(SSSDBG_FATAL_FAILURE, ("Protocol [%d] is not secure. " - "SSSD does not allow to use this protocol.\n", protocol)); + DEBUG(SSSDBG_FATAL_FAILURE, "Protocol [%d] is not secure. " + "SSSD does not allow to use this protocol.\n", protocol); ret = EFAULT; goto done; break; case SSS_SUDO_PROTOCOL_VERSION: - DEBUG(SSSDBG_TRACE_INTERNAL, ("Using protocol version [%d]\n", - protocol)); + DEBUG(SSSDBG_TRACE_INTERNAL, "Using protocol version [%d]\n", + protocol); break; default: - DEBUG(SSSDBG_FATAL_FAILURE, ("Invalid protocol version [%d]!\n", - protocol)); + DEBUG(SSSDBG_FATAL_FAILURE, "Invalid protocol version [%d]!\n", + protocol); ret = EFAULT; goto done; } @@ -215,7 +215,7 @@ static int sudosrv_cmd(enum sss_sudo_type type, struct cli_ctx *cli_ctx) sss_packet_get_body(cli_ctx->creq->in, &query_body, &query_len); if (query_len <= 0 || query_body == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Query is empty\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Query is empty\n"); ret = EINVAL; goto done; } @@ -247,8 +247,8 @@ static void sudosrv_cmd_parse_query_done(struct tevent_req *req) &cmd_ctx->username, &cmd_ctx->domain); talloc_zfree(req); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Invalid query [%d]: %s\n", - ret, strerror(ret))); + DEBUG(SSSDBG_CRIT_FAILURE, "Invalid query [%d]: %s\n", + ret, strerror(ret)); goto done; } @@ -256,14 +256,14 @@ static void sudosrv_cmd_parse_query_done(struct tevent_req *req) switch (cmd_ctx->type) { case SSS_SUDO_DEFAULTS: - DEBUG(SSSDBG_FUNC_DATA, ("Requesting default options " + DEBUG(SSSDBG_FUNC_DATA, "Requesting default options " "for [%s] from [%s]\n", cmd_ctx->username, - cmd_ctx->domain ? cmd_ctx->domain->name : "<ALL>")); + cmd_ctx->domain ? cmd_ctx->domain->name : "<ALL>"); break; case SSS_SUDO_USER: - DEBUG(SSSDBG_FUNC_DATA, ("Requesting rules " + DEBUG(SSSDBG_FUNC_DATA, "Requesting rules " "for [%s] from [%s]\n", cmd_ctx->username, - cmd_ctx->domain ? cmd_ctx->domain->name : "<ALL>")); + cmd_ctx->domain ? cmd_ctx->domain->name : "<ALL>"); break; } diff --git a/src/responder/sudo/sudosrv_dp.c b/src/responder/sudo/sudosrv_dp.c index 3cd8fe8d8..483533ccc 100644 --- a/src/responder/sudo/sudosrv_dp.c +++ b/src/responder/sudo/sudosrv_dp.c @@ -99,8 +99,8 @@ sss_dp_get_sudoers_send(TALLOC_CTX *mem_ctx, talloc_free(key); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Could not issue DP request [%d]: %s\n", - ret, strerror(ret))); + "Could not issue DP request [%d]: %s\n", + ret, strerror(ret)); goto error; } @@ -144,14 +144,14 @@ sss_dp_get_sudoers_msg(void *pvt) DP_INTERFACE, DP_METHOD_SUDOHANDLER); if (msg == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Out of memory?!\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Out of memory?!\n"); return NULL; } /* create the message */ DEBUG(SSSDBG_TRACE_FUNC, - ("Creating SUDOers request for [%s][%u][%s][%u]\n", - info->dom->name, be_type, info->name, info->num_rules)); + "Creating SUDOers request for [%s][%u][%s][%u]\n", + info->dom->name, be_type, info->name, info->num_rules); dbus_message_iter_init_append(msg, &iter); @@ -172,8 +172,8 @@ sss_dp_get_sudoers_msg(void *pvt) for (i = 0; i < info->num_rules; i++) { ret = sysdb_attrs_get_string(info->rules[i], SYSDB_NAME, &rule_name); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("Could not get rule name [%d]: %s\n", - ret, strerror(ret))); + DEBUG(SSSDBG_OP_FAILURE, "Could not get rule name [%d]: %s\n", + ret, strerror(ret)); goto fail; } @@ -188,7 +188,7 @@ sss_dp_get_sudoers_msg(void *pvt) return msg; fail: - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to build message\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to build message\n"); dbus_message_unref(msg); return NULL; } diff --git a/src/responder/sudo/sudosrv_get_sudorules.c b/src/responder/sudo/sudosrv_get_sudorules.c index fa461b4f0..9d8ef5d2a 100644 --- a/src/responder/sudo/sudosrv_get_sudorules.c +++ b/src/responder/sudo/sudosrv_get_sudorules.c @@ -39,11 +39,11 @@ errno_t sudosrv_get_sudorules(struct sudo_dom_ctx *dctx) ret = sudosrv_get_user(dctx); if (ret == EAGAIN) { DEBUG(SSSDBG_TRACE_INTERNAL, - ("Looking up the user info from Data Provider\n")); + "Looking up the user info from Data Provider\n"); return EAGAIN; } else if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Error looking up user information [%d]: %s\n", ret, strerror(ret))); + "Error looking up user information [%d]: %s\n", ret, strerror(ret)); return ret; } @@ -51,11 +51,11 @@ errno_t sudosrv_get_sudorules(struct sudo_dom_ctx *dctx) ret = sudosrv_get_rules(dctx->cmd_ctx); if (ret == EAGAIN) { DEBUG(SSSDBG_TRACE_INTERNAL, - ("Looking up the sudo rules from Data Provider\n")); + "Looking up the sudo rules from Data Provider\n"); return EAGAIN; } else if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Error looking up sudo rules [%d]: %s\n", ret, strerror(ret))); + "Error looking up sudo rules [%d]: %s\n", ret, strerror(ret)); return ret; } @@ -83,7 +83,7 @@ static errno_t sudosrv_get_user(struct sudo_dom_ctx *dctx) tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_new() failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_new() failed\n"); return ENOMEM; } @@ -103,25 +103,25 @@ static errno_t sudosrv_get_user(struct sudo_dom_ctx *dctx) name = sss_get_cased_name(tmp_ctx, cmd_ctx->username, dom->case_sensitive); if (name == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Out of memory\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Out of memory\n"); ret = ENOMEM; goto done; } - DEBUG(SSSDBG_FUNC_DATA, ("Requesting info about [%s@%s]\n", - name, dom->name)); + DEBUG(SSSDBG_FUNC_DATA, "Requesting info about [%s@%s]\n", + name, dom->name); ret = sysdb_getpwnam(dctx, dctx->domain, name, &user); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Failed to make request to our cache!\n")); + "Failed to make request to our cache!\n"); ret = EIO; goto done; } if (user->count > 1) { DEBUG(SSSDBG_CRIT_FAILURE, - ("getpwnam call returned more than one result !?!\n")); + "getpwnam call returned more than one result !?!\n"); ret = EIO; goto done; } @@ -134,7 +134,7 @@ static errno_t sudosrv_get_user(struct sudo_dom_ctx *dctx) if (dom) continue; } - DEBUG(SSSDBG_MINOR_FAILURE, ("No results for getpwnam call\n")); + DEBUG(SSSDBG_MINOR_FAILURE, "No results for getpwnam call\n"); ret = ENOENT; goto done; } @@ -154,7 +154,7 @@ static errno_t sudosrv_get_user(struct sudo_dom_ctx *dctx) cmd_ctx->username, 0, NULL); if (!dpreq) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Out of memory sending data provider request\n")); + "Out of memory sending data provider request\n"); ret = ENOMEM; goto done; } @@ -188,7 +188,7 @@ static errno_t sudosrv_get_user(struct sudo_dom_ctx *dctx) if (dom) continue; } - DEBUG(SSSDBG_MINOR_FAILURE, ("UID does not match\n")); + DEBUG(SSSDBG_MINOR_FAILURE, "UID does not match\n"); ret = ENOENT; goto done; } @@ -197,7 +197,7 @@ static errno_t sudosrv_get_user(struct sudo_dom_ctx *dctx) original_name = ldb_msg_find_attr_as_string(user->msgs[0], SYSDB_NAME, NULL); if (original_name == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("A user with no name?\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "A user with no name?\n"); ret = EFAULT; goto done; } @@ -205,7 +205,7 @@ static errno_t sudosrv_get_user(struct sudo_dom_ctx *dctx) cmd_ctx->cased_username = talloc_move(cmd_ctx, &name); cmd_ctx->orig_username = talloc_strdup(cmd_ctx, original_name); if (cmd_ctx->orig_username == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Out of memory\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Out of memory\n"); ret = ENOMEM; goto done; } @@ -213,8 +213,8 @@ static errno_t sudosrv_get_user(struct sudo_dom_ctx *dctx) /* and set domain */ cmd_ctx->domain = dom; - DEBUG(SSSDBG_TRACE_FUNC, ("Returning info for user [%s@%s]\n", - cmd_ctx->username, dctx->domain->name)); + DEBUG(SSSDBG_TRACE_FUNC, "Returning info for user [%s@%s]\n", + cmd_ctx->username, dctx->domain->name); ret = EOK; goto done; } @@ -241,7 +241,7 @@ static void sudosrv_dp_send_acct_req_done(struct tevent_req *req) talloc_zfree(req); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Fatal error, killing connection!\n")); + "Fatal error, killing connection!\n"); talloc_free(cb_ctx->cctx); return; } @@ -257,33 +257,33 @@ static void sudosrv_check_user_dp_callback(uint16_t err_maj, uint32_t err_min, if (err_maj) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Unable to get information from Data Provider\n" + "Unable to get information from Data Provider\n" "Error: %u, %u, %s\n", - (unsigned int)err_maj, (unsigned int)err_min, err_msg)); + (unsigned int)err_maj, (unsigned int)err_min, err_msg); } DEBUG(SSSDBG_TRACE_INTERNAL, - ("Data Provider returned, check the cache again\n")); + "Data Provider returned, check the cache again\n"); dctx->check_provider = false; ret = sudosrv_get_user(dctx); if (ret == EAGAIN) { goto done; } else if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Could not look up the user [%d]: %s\n", - ret, strerror(ret))); + "Could not look up the user [%d]: %s\n", + ret, strerror(ret)); sudosrv_cmd_done(dctx->cmd_ctx, ret); return; } - DEBUG(SSSDBG_TRACE_INTERNAL, ("Looking up sudo rules..\n")); + DEBUG(SSSDBG_TRACE_INTERNAL, "Looking up sudo rules..\n"); ret = sudosrv_get_rules(dctx->cmd_ctx); if (ret == EAGAIN) { goto done; } else if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Error getting sudo rules [%d]: %s\n", - ret, strerror(ret))); + "Error getting sudo rules [%d]: %s\n", + ret, strerror(ret)); sudosrv_cmd_done(dctx->cmd_ctx, EIO); return; } @@ -326,26 +326,26 @@ errno_t sudosrv_get_rules(struct sudo_cmd_ctx *cmd_ctx) NULL }; if (cmd_ctx->domain == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Domain is not set!\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Domain is not set!\n"); return EFAULT; } tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_new() failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_new() failed\n"); return ENOMEM; } switch (cmd_ctx->type) { case SSS_SUDO_DEFAULTS: - DEBUG(SSSDBG_TRACE_FUNC, ("Retrieving default options " + DEBUG(SSSDBG_TRACE_FUNC, "Retrieving default options " "for [%s] from [%s]\n", cmd_ctx->orig_username, - cmd_ctx->domain->name)); + cmd_ctx->domain->name); break; case SSS_SUDO_USER: - DEBUG(SSSDBG_TRACE_FUNC, ("Retrieving rules " + DEBUG(SSSDBG_TRACE_FUNC, "Retrieving rules " "for [%s] from [%s]\n", cmd_ctx->orig_username, - cmd_ctx->domain->name)); + cmd_ctx->domain->name); break; } @@ -358,7 +358,7 @@ errno_t sudosrv_get_rules(struct sudo_cmd_ctx *cmd_ctx) cmd_ctx->orig_username, NULL, &groupnames); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Unable to retrieve user info [%d]: %s\n", ret, strerror(ret))); + "Unable to retrieve user info [%d]: %s\n", ret, strerror(ret)); goto done; } @@ -372,16 +372,16 @@ errno_t sudosrv_get_rules(struct sudo_cmd_ctx *cmd_ctx) cmd_ctx->uid, groupnames, &expired_rules, &expired_rules_num); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Unable to retrieve expired sudo rules " - "[%d]: %s\n", ret, strerror(ret))); + DEBUG(SSSDBG_CRIT_FAILURE, "Unable to retrieve expired sudo rules " + "[%d]: %s\n", ret, strerror(ret)); goto done; } cmd_ctx->expired_rules_num = expired_rules_num; if (expired_rules_num > 0) { /* refresh expired rules then continue */ - DEBUG(SSSDBG_TRACE_INTERNAL, ("Refreshing %d expired rules\n", - expired_rules_num)); + DEBUG(SSSDBG_TRACE_INTERNAL, "Refreshing %d expired rules\n", + expired_rules_num); dpreq = sss_dp_get_sudoers_send(tmp_ctx, cmd_ctx->cli_ctx->rctx, cmd_ctx->domain, false, SSS_DP_SUDO_REFRESH_RULES, @@ -389,7 +389,7 @@ errno_t sudosrv_get_rules(struct sudo_cmd_ctx *cmd_ctx) expired_rules_num, expired_rules); if (dpreq == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Cannot issue DP request.\n")); + "Cannot issue DP request.\n"); ret = EIO; goto done; } @@ -411,14 +411,14 @@ errno_t sudosrv_get_rules(struct sudo_cmd_ctx *cmd_ctx) } else { /* nothing is expired return what we have in the cache */ - DEBUG(SSSDBG_TRACE_INTERNAL, ("About to get sudo rules from cache\n")); + DEBUG(SSSDBG_TRACE_INTERNAL, "About to get sudo rules from cache\n"); ret = sudosrv_get_sudorules_from_cache(cmd_ctx, cmd_ctx, &cmd_ctx->rules, &cmd_ctx->num_rules); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Failed to make a request to our cache [%d]: %s\n", - ret, strerror(ret))); + "Failed to make a request to our cache [%d]: %s\n", + ret, strerror(ret)); goto done; } } @@ -455,7 +455,7 @@ sudosrv_dp_req_done(struct tevent_req *req) &err_msg); talloc_free(req); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Fatal error, killing connection!\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Fatal error, killing connection!\n"); talloc_free(cli_ctx); return; } @@ -466,7 +466,7 @@ sudosrv_dp_req_done(struct tevent_req *req) static void sudosrv_dp_oob_req_done(struct tevent_req *req) { - DEBUG(SSSDBG_TRACE_FUNC, ("Out of band refresh finished\n")); + DEBUG(SSSDBG_TRACE_FUNC, "Out of band refresh finished\n"); talloc_free(req); } @@ -480,19 +480,19 @@ sudosrv_get_sudorules_dp_callback(uint16_t err_maj, uint32_t err_min, if (err_maj) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Unable to get information from Data Provider\n" + "Unable to get information from Data Provider\n" "Error: %u, %u, %s\n" "Will try to return what we have in cache\n", - (unsigned int)err_maj, (unsigned int)err_min, err_msg)); + (unsigned int)err_maj, (unsigned int)err_min, err_msg); } - DEBUG(SSSDBG_TRACE_INTERNAL, ("About to get sudo rules from cache\n")); + DEBUG(SSSDBG_TRACE_INTERNAL, "About to get sudo rules from cache\n"); ret = sudosrv_get_sudorules_from_cache(cmd_ctx, cmd_ctx, &cmd_ctx->rules, &cmd_ctx->num_rules); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Failed to make a request to our cache [%d]: %s\n", - ret, strerror(ret))); + "Failed to make a request to our cache [%d]: %s\n", + ret, strerror(ret)); sudosrv_cmd_done(cmd_ctx, EIO); return; } @@ -500,8 +500,8 @@ sudosrv_get_sudorules_dp_callback(uint16_t err_maj, uint32_t err_min, if (cmd_ctx->expired_rules_num > 0 && err_min == ENOENT) { DEBUG(SSSDBG_TRACE_INTERNAL, - ("Some expired rules were removed from the server, " - "scheduling full refresh out of band\n")); + "Some expired rules were removed from the server, " + "scheduling full refresh out of band\n"); dpreq = sss_dp_get_sudoers_send(cmd_ctx->cli_ctx->rctx, cmd_ctx->cli_ctx->rctx, cmd_ctx->domain, false, @@ -510,7 +510,7 @@ sudosrv_get_sudorules_dp_callback(uint16_t err_maj, uint32_t err_min, 0, NULL); if (dpreq == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Cannot issue DP request.\n")); + "Cannot issue DP request.\n"); } else { tevent_req_set_callback(dpreq, sudosrv_dp_oob_req_done, NULL); } @@ -545,13 +545,13 @@ static errno_t sudosrv_get_sudorules_from_cache(TALLOC_CTX *mem_ctx, NULL }; if (cmd_ctx->domain == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Domain is not set!\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Domain is not set!\n"); return EFAULT; } tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_new() failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_new() failed\n"); return ENOMEM; } @@ -564,8 +564,8 @@ static errno_t sudosrv_get_sudorules_from_cache(TALLOC_CTX *mem_ctx, NULL, &groupnames); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Unable to retrieve user info [%d]: %s\n", - ret, strerror(ret))); + "Unable to retrieve user info [%d]: %s\n", + ret, strerror(ret)); goto done; } flags = SYSDB_SUDO_FILTER_USERINFO | SYSDB_SUDO_FILTER_INCLUDE_ALL; @@ -583,12 +583,12 @@ static errno_t sudosrv_get_sudorules_from_cache(TALLOC_CTX *mem_ctx, &rules, &num_rules); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Unable to retrieve sudo rules [%d]: %s\n", ret, strerror(ret))); + "Unable to retrieve sudo rules [%d]: %s\n", ret, strerror(ret)); goto done; } - DEBUG(SSSDBG_TRACE_FUNC, ("Returning %d rules for [%s@%s]\n", - num_rules, debug_name, cmd_ctx->domain->name)); + DEBUG(SSSDBG_TRACE_FUNC, "Returning %d rules for [%s@%s]\n", + num_rules, debug_name, cmd_ctx->domain->name); if (_rules != NULL) { *_rules = talloc_steal(mem_ctx, rules); @@ -631,12 +631,12 @@ static errno_t sudosrv_get_sudorules_query_cache(TALLOC_CTX *mem_ctx, flags, &filter); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Could not construct the search filter [%d]: %s\n", - ret, strerror(ret))); + "Could not construct the search filter [%d]: %s\n", + ret, strerror(ret)); goto done; } - DEBUG(SSSDBG_FUNC_DATA, ("Searching sysdb with [%s]\n", filter)); + DEBUG(SSSDBG_FUNC_DATA, "Searching sysdb with [%s]\n", filter); if (IS_SUBDOMAIN(domain)) { /* rules are stored inside parent domain tree */ @@ -647,7 +647,7 @@ static errno_t sudosrv_get_sudorules_query_cache(TALLOC_CTX *mem_ctx, SUDORULE_SUBDIR, attrs, &count, &msgs); if (ret != EOK && ret != ENOENT) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Error looking up SUDO rules")); + DEBUG(SSSDBG_CRIT_FAILURE, "Error looking up SUDO rules"); goto done; } if (ret == ENOENT) { *_rules = NULL; @@ -659,14 +659,14 @@ static errno_t sudosrv_get_sudorules_query_cache(TALLOC_CTX *mem_ctx, ret = sysdb_msg2attrs(tmp_ctx, count, msgs, &rules); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Could not convert ldb message to sysdb_attrs\n")); + "Could not convert ldb message to sysdb_attrs\n"); goto done; } ret = sort_sudo_rules(rules, count); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Could not sort rules by sudoOrder\n")); + "Could not sort rules by sudoOrder\n"); goto done; } @@ -689,7 +689,7 @@ sudo_order_cmp_fn(const void *a, const void *b) r1 = * (struct sysdb_attrs * const *) a; r2 = * (struct sysdb_attrs * const *) b; if (!r1 || !r2) { - DEBUG(SSSDBG_CRIT_FAILURE, ("BUG: Wrong data?\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "BUG: Wrong data?\n"); return 0; } @@ -699,7 +699,7 @@ sudo_order_cmp_fn(const void *a, const void *b) * a value of 0 is assumed */ o1 = 0; } else if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("Cannot get sudoOrder value\n")); + DEBUG(SSSDBG_OP_FAILURE, "Cannot get sudoOrder value\n"); return 0; } @@ -709,7 +709,7 @@ sudo_order_cmp_fn(const void *a, const void *b) * a value of 0 is assumed */ o2 = 0; } else if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("Cannot get sudoOrder value\n")); + DEBUG(SSSDBG_OP_FAILURE, "Cannot get sudoOrder value\n"); return 0; } diff --git a/src/responder/sudo/sudosrv_query.c b/src/responder/sudo/sudosrv_query.c index c60202f5e..632afa712 100644 --- a/src/responder/sudo/sudosrv_query.c +++ b/src/responder/sudo/sudosrv_query.c @@ -39,7 +39,7 @@ static int sudosrv_response_append_string(TALLOC_CTX *mem_ctx, response_body = talloc_realloc(mem_ctx, response_body, uint8_t, response_len + (str_len * sizeof(char))); if (response_body == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_realloc() failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_realloc() failed\n"); return ENOMEM; } memcpy(response_body + response_len, str, str_len); @@ -62,7 +62,7 @@ static int sudosrv_response_append_uint32(TALLOC_CTX *mem_ctx, response_body = talloc_realloc(mem_ctx, response_body, uint8_t, response_len + sizeof(uint32_t)); if (response_body == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_realloc() failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_realloc() failed\n"); return ENOMEM; } SAFEALIGN_SET_UINT32(response_body + response_len, number, &response_len); @@ -88,7 +88,7 @@ static int sudosrv_response_append_attr(TALLOC_CTX *mem_ctx, tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_new() failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_new() failed\n"); return ENOMEM; } @@ -109,7 +109,7 @@ static int sudosrv_response_append_attr(TALLOC_CTX *mem_ctx, /* values */ for (i = 0; i < values_num; i++) { if (strlen((char*)(values[i].data)) != values[i].length) { - DEBUG(SSSDBG_CRIT_FAILURE, ("value is not a string")); + DEBUG(SSSDBG_CRIT_FAILURE, "value is not a string"); ret = EINVAL; goto done; } @@ -147,7 +147,7 @@ static int sudosrv_response_append_rule(TALLOC_CTX *mem_ctx, tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_new() failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_new() failed\n"); return ENOMEM; } @@ -201,7 +201,7 @@ errno_t sudosrv_build_response(TALLOC_CTX *mem_ctx, tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_new() failed\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "talloc_new() failed\n"); return ENOMEM; } @@ -277,7 +277,7 @@ struct tevent_req *sudosrv_parse_query_send(TALLOC_CTX *mem_ctx, req = tevent_req_create(mem_ctx, &state, struct sudosrv_parse_query_state); if (req == NULL) { - DEBUG(SSSDBG_FATAL_FAILURE, ("tevent_req_create() failed\n")); + DEBUG(SSSDBG_FATAL_FAILURE, "tevent_req_create() failed\n"); return NULL; } @@ -286,7 +286,7 @@ struct tevent_req *sudosrv_parse_query_send(TALLOC_CTX *mem_ctx, /* uid */ if (query_len < sizeof(uid_t)) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Query is too small\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Query is too small\n"); ret = EINVAL; goto done; } @@ -298,19 +298,19 @@ struct tevent_req *sudosrv_parse_query_send(TALLOC_CTX *mem_ctx, rawname_len = query_len - offset; /* strlen + zero */ if (rawname[rawname_len - 1] != '\0') { - DEBUG(SSSDBG_CRIT_FAILURE, ("Username is not zero terminated\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Username is not zero terminated\n"); ret = EINVAL; goto done; } if (rawname_len < 2) { /* at least one character and zero */ - DEBUG(SSSDBG_CRIT_FAILURE, ("Query does not contain username\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Query does not contain username\n"); ret = EINVAL; goto done; } if (!sss_utf8_check((uint8_t*)rawname, rawname_len - 1)) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Supplied data is not valid UTF-8 string\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Supplied data is not valid UTF-8 string\n"); ret = EINVAL; goto done; } @@ -322,8 +322,8 @@ struct tevent_req *sudosrv_parse_query_send(TALLOC_CTX *mem_ctx, rctx->default_domain, state->rawname, &domainname, NULL); if (ret == EAGAIN) { - DEBUG(SSSDBG_TRACE_FUNC, ("Domain [%s] not found, " - "sending subdomain request\n", domainname)); + DEBUG(SSSDBG_TRACE_FUNC, "Domain [%s] not found, " + "sending subdomain request\n", domainname); subreq = sss_dp_get_domains_send(state, rctx, true, domainname); if (subreq == NULL) { @@ -334,7 +334,7 @@ struct tevent_req *sudosrv_parse_query_send(TALLOC_CTX *mem_ctx, } goto done; } else if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Invalid name received [%s]\n", rawname)); + DEBUG(SSSDBG_CRIT_FAILURE, "Invalid name received [%s]\n", rawname); goto done; } @@ -386,7 +386,7 @@ errno_t sudosrv_parse_query_recv(TALLOC_CTX *mem_ctx, TEVENT_REQ_RETURN_ON_ERROR(req); if (state->rawname == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("No query specified?!\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "No query specified?!\n"); return EINVAL; } @@ -399,13 +399,13 @@ errno_t sudosrv_parse_query_recv(TALLOC_CTX *mem_ctx, state->rawname, &domainname, &username); if (ret != EOK) { - DEBUG(SSSDBG_TRACE_FUNC, ("Unable to parse domain [%d]: %s\n", - ret, strerror(ret))); + DEBUG(SSSDBG_TRACE_FUNC, "Unable to parse domain [%d]: %s\n", + ret, strerror(ret)); return ret; } if (username == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("No username specified!\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "No username specified!\n"); return EINVAL; } @@ -414,8 +414,8 @@ errno_t sudosrv_parse_query_recv(TALLOC_CTX *mem_ctx, * so I cannot easily steal it */ domain = responder_get_domain(state->rctx, domainname); if (domain == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("Corresponding domain [%s] has not been " - "found\n", domainname)); + DEBUG(SSSDBG_OP_FAILURE, "Corresponding domain [%s] has not been " + "found\n", domainname); return ENOENT; } } |