From a3c8390d19593b1e5277d95bfb4ab206d4785150 Mon Sep 17 00:00:00 2001 From: Nikolai Kondrashov Date: Wed, 12 Feb 2014 10:12:04 -0500 Subject: 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 Reviewed-by: Stephen Gallagher Reviewed-by: Simo Sorce --- src/providers/proxy/proxy_auth.c | 134 +++++++++++++++++++-------------------- 1 file changed, 67 insertions(+), 67 deletions(-) (limited to 'src/providers/proxy/proxy_auth.c') diff --git a/src/providers/proxy/proxy_auth.c b/src/providers/proxy/proxy_auth.c index fa766dc4e..27ac5c455 100644 --- a/src/providers/proxy/proxy_auth.c +++ b/src/providers/proxy/proxy_auth.c @@ -64,7 +64,7 @@ void proxy_pam_handler(struct be_req *req) be_req_terminate(req, DP_ERR_OK, EOK, NULL); return; default: - DEBUG(1, ("Unsupported PAM task.\n")); + DEBUG(1, "Unsupported PAM task.\n"); pd->pam_status = PAM_MODULE_UNKNOWN; be_req_terminate(req, DP_ERR_OK, EINVAL, "Unsupported PAM task"); return; @@ -102,13 +102,13 @@ static int proxy_child_destructor(TALLOC_CTX *ctx) hash_key_t key; int hret; - DEBUG(8, ("Removing proxy child id [%d]\n", child_ctx->id)); + DEBUG(8, "Removing proxy child id [%d]\n", child_ctx->id); key.type = HASH_KEY_ULONG; key.ul = child_ctx->id; hret = hash_delete(child_ctx->auth_ctx->request_table, &key); if (!(hret == HASH_SUCCESS || hret == HASH_ERROR_KEY_NOT_FOUND)) { - DEBUG(1, ("Hash error [%d][%s]\n", hret, hash_error_string(hret))); + DEBUG(1, "Hash error [%d][%s]\n", hret, hash_error_string(hret)); /* Nothing we can do about this, so just continue */ } return 0; @@ -132,7 +132,7 @@ static struct tevent_req *proxy_child_send(TALLOC_CTX *mem_ctx, req = tevent_req_create(mem_ctx, &state, struct proxy_child_ctx); if (req == NULL) { - DEBUG(1, ("Could not send PAM request to child\n")); + DEBUG(1, "Could not send PAM request to child\n"); return NULL; } @@ -156,7 +156,7 @@ static struct tevent_req *proxy_child_send(TALLOC_CTX *mem_ctx, if (auth_ctx->next_id == first) { /* We've looped through all possible integers! */ - DEBUG(0, ("Serious error: queue is too long!\n")); + DEBUG(0, "Serious error: queue is too long!\n"); talloc_zfree(req); return NULL; } @@ -167,11 +167,11 @@ static struct tevent_req *proxy_child_send(TALLOC_CTX *mem_ctx, value.type = HASH_VALUE_PTR; value.ptr = req; - DEBUG(SSSDBG_TRACE_INTERNAL, ("Queueing request [%lu]\n", key.ul)); + DEBUG(SSSDBG_TRACE_INTERNAL, "Queueing request [%lu]\n", key.ul); hret = hash_enter(auth_ctx->request_table, &key, &value); if (hret != HASH_SUCCESS) { - DEBUG(1, ("Could not add request to the queue\n")); + DEBUG(1, "Could not add request to the queue\n"); talloc_zfree(req); return NULL; } @@ -187,7 +187,7 @@ static struct tevent_req *proxy_child_send(TALLOC_CTX *mem_ctx, auth_ctx->running++; subreq = proxy_child_init_send(auth_ctx, state, auth_ctx); if (!subreq) { - DEBUG(1, ("Could not fork child process\n")); + DEBUG(1, "Could not fork child process\n"); auth_ctx->running--; talloc_zfree(req); return NULL; @@ -200,7 +200,7 @@ static struct tevent_req *proxy_child_send(TALLOC_CTX *mem_ctx, /* If there was no available slot, it will be queued * until a slot is available */ - DEBUG(8, ("All available child slots are full, queuing request\n")); + DEBUG(8, "All available child slots are full, queuing request\n"); } return req; } @@ -234,7 +234,7 @@ static struct tevent_req *proxy_child_init_send(TALLOC_CTX *mem_ctx, req = tevent_req_create(mem_ctx, &state, struct pc_init_ctx); if (req == NULL) { - DEBUG(1, ("Could not create tevent_req\n")); + DEBUG(1, "Could not create tevent_req\n"); return NULL; } @@ -248,16 +248,16 @@ static struct tevent_req *proxy_child_init_send(TALLOC_CTX *mem_ctx, auth_ctx->be->domain->name, child_ctx->id); if (state->command == NULL) { - DEBUG(1, ("talloc_asprintf failed.\n")); + DEBUG(1, "talloc_asprintf failed.\n"); return NULL; } - DEBUG(7, ("Starting proxy child with args [%s]\n", state->command)); + DEBUG(7, "Starting proxy child with args [%s]\n", state->command); pid = fork(); if (pid < 0) { ret = errno; - DEBUG(1, ("fork failed [%d][%s].\n", ret, strerror(ret))); + DEBUG(1, "fork failed [%d][%s].\n", ret, strerror(ret)); talloc_zfree(req); return NULL; } @@ -267,8 +267,8 @@ static struct tevent_req *proxy_child_init_send(TALLOC_CTX *mem_ctx, execvp(proxy_child_args[0], proxy_child_args); ret = errno; - DEBUG(0, ("Could not start proxy child [%s]: [%d][%s].\n", - state->command, ret, strerror(ret))); + DEBUG(0, "Could not start proxy child [%s]: [%d][%s].\n", + state->command, ret, strerror(ret)); _exit(1); } @@ -282,7 +282,7 @@ static struct tevent_req *proxy_child_init_send(TALLOC_CTX *mem_ctx, SIGCHLD, SA_SIGINFO, pc_init_sig_handler, req); if (state->sige == NULL) { - DEBUG(1, ("tevent_add_signal failed.\n")); + DEBUG(1, "tevent_add_signal failed.\n"); talloc_zfree(req); return NULL; } @@ -322,42 +322,42 @@ static void pc_init_sig_handler(struct tevent_context *ev, struct pc_init_ctx *init_ctx; if (count <= 0) { - DEBUG(0, ("SIGCHLD handler called with invalid child count\n")); + DEBUG(0, "SIGCHLD handler called with invalid child count\n"); return; } req = talloc_get_type(pvt, struct tevent_req); init_ctx = tevent_req_data(req, struct pc_init_ctx); - DEBUG(7, ("Waiting for child [%d].\n", init_ctx->pid)); + DEBUG(7, "Waiting for child [%d].\n", init_ctx->pid); errno = 0; ret = waitpid(init_ctx->pid, &child_status, WNOHANG); if (ret == -1) { ret = errno; - DEBUG(1, ("waitpid failed [%d][%s].\n", ret, strerror(ret))); + DEBUG(1, "waitpid failed [%d][%s].\n", ret, strerror(ret)); } else if (ret == 0) { - DEBUG(1, ("waitpid did not find a child with changed status.\n")); + DEBUG(1, "waitpid did not find a child with changed status.\n"); } else { if (WIFEXITED(child_status)) { - DEBUG(4, ("child [%d] exited with status [%d].\n", ret, - WEXITSTATUS(child_status))); + DEBUG(4, "child [%d] exited with status [%d].\n", ret, + WEXITSTATUS(child_status)); tevent_req_error(req, EIO); } else if (WIFSIGNALED(child_status)) { - DEBUG(4, ("child [%d] was terminate by signal [%d].\n", ret, - WTERMSIG(child_status))); + DEBUG(4, "child [%d] was terminate by signal [%d].\n", ret, + WTERMSIG(child_status)); tevent_req_error(req, EIO); } else { if (WIFSTOPPED(child_status)) { - DEBUG(1, ("child [%d] was stopped by signal [%d].\n", ret, - WSTOPSIG(child_status))); + DEBUG(1, "child [%d] was stopped by signal [%d].\n", ret, + WSTOPSIG(child_status)); } if (WIFCONTINUED(child_status)) { - DEBUG(1, ("child [%d] was resumed by delivery of SIGCONT.\n", - ret)); + DEBUG(1, "child [%d] was resumed by delivery of SIGCONT.\n", + ret); } - DEBUG(1, ("Child is still running, no new child is started.\n")); + DEBUG(1, "Child is still running, no new child is started.\n"); return; } } @@ -369,7 +369,7 @@ static void pc_init_timeout(struct tevent_context *ev, { struct tevent_req *req; - DEBUG(2, ("Client timed out before Identification!\n")); + DEBUG(2, "Client timed out before Identification!\n"); req = talloc_get_type(ptr, struct tevent_req); tevent_req_error(req, ETIMEDOUT); } @@ -421,7 +421,7 @@ static void proxy_child_init_done(struct tevent_req *subreq) { ret = proxy_child_init_recv(subreq, &child_ctx->pid, &child_ctx->conn); talloc_zfree(subreq); if (ret != EOK) { - DEBUG(6, ("Proxy child init failed [%d]\n", ret)); + DEBUG(6, "Proxy child init failed [%d]\n", ret); tevent_req_error(req, ret); return; } @@ -431,7 +431,7 @@ static void proxy_child_init_done(struct tevent_req *subreq) { child_ctx->conn, child_ctx->pd, child_ctx->pid); if (!subreq) { - DEBUG(1,("Could not start PAM conversation\n")); + DEBUG(1,"Could not start PAM conversation\n"); tevent_req_error(req, EIO); return; } @@ -443,7 +443,7 @@ static void proxy_child_init_done(struct tevent_req *subreq) { */ sig_ctx = talloc_zero(child_ctx->auth_ctx, struct proxy_child_sig_ctx); if(sig_ctx == NULL) { - DEBUG(1, ("tevent_add_signal failed.\n")); + DEBUG(1, "tevent_add_signal failed.\n"); tevent_req_error(req, ENOMEM); return; } @@ -456,7 +456,7 @@ static void proxy_child_init_done(struct tevent_req *subreq) { proxy_child_sig_handler, sig_ctx); if (sige == NULL) { - DEBUG(1, ("tevent_add_signal failed.\n")); + DEBUG(1, "tevent_add_signal failed.\n"); tevent_req_error(req, ENOMEM); return; } @@ -485,44 +485,44 @@ static void proxy_child_sig_handler(struct tevent_context *ev, struct tevent_immediate *imm2; if (count <= 0) { - DEBUG(0, ("SIGCHLD handler called with invalid child count\n")); + DEBUG(0, "SIGCHLD handler called with invalid child count\n"); return; } sig_ctx = talloc_get_type(pvt, struct proxy_child_sig_ctx); - DEBUG(7, ("Waiting for child [%d].\n", sig_ctx->pid)); + DEBUG(7, "Waiting for child [%d].\n", sig_ctx->pid); errno = 0; ret = waitpid(sig_ctx->pid, &child_status, WNOHANG); if (ret == -1) { ret = errno; - DEBUG(1, ("waitpid failed [%d][%s].\n", ret, strerror(ret))); + DEBUG(1, "waitpid failed [%d][%s].\n", ret, strerror(ret)); } else if (ret == 0) { - DEBUG(1, ("waitpid did not found a child with changed status.\n")); + DEBUG(1, "waitpid did not found a child with changed status.\n"); } else { if (WIFEXITED(child_status)) { - DEBUG(4, ("child [%d] exited with status [%d].\n", ret, - WEXITSTATUS(child_status))); + DEBUG(4, "child [%d] exited with status [%d].\n", ret, + WEXITSTATUS(child_status)); } else if (WIFSIGNALED(child_status)) { - DEBUG(4, ("child [%d] was terminated by signal [%d].\n", ret, - WTERMSIG(child_status))); + DEBUG(4, "child [%d] was terminated by signal [%d].\n", ret, + WTERMSIG(child_status)); } else { if (WIFSTOPPED(child_status)) { - DEBUG(1, ("child [%d] was stopped by signal [%d].\n", ret, - WSTOPSIG(child_status))); + DEBUG(1, "child [%d] was stopped by signal [%d].\n", ret, + WSTOPSIG(child_status)); } if (WIFCONTINUED(child_status)) { - DEBUG(1, ("child [%d] was resumed by delivery of SIGCONT.\n", - ret)); + DEBUG(1, "child [%d] was resumed by delivery of SIGCONT.\n", + ret); } - DEBUG(1, ("Child is still running, no new child is started.\n")); + DEBUG(1, "Child is still running, no new child is started.\n"); return; } imm = tevent_create_immediate(ev); if (imm == NULL) { - DEBUG(1, ("tevent_create_immediate failed.\n")); + DEBUG(1, "tevent_create_immediate failed.\n"); return; } @@ -532,7 +532,7 @@ static void proxy_child_sig_handler(struct tevent_context *ev, /* schedule another immediate timer to delete the sigchld handler */ imm2 = tevent_create_immediate(ev); if (imm2 == NULL) { - DEBUG(1, ("tevent_create_immediate failed.\n")); + DEBUG(1, "tevent_create_immediate failed.\n"); return; } @@ -583,17 +583,17 @@ static struct tevent_req *proxy_pam_conv_send(TALLOC_CTX *mem_ctx, DP_INTERFACE, DP_METHOD_PAMHANDLER); if (msg == NULL) { - DEBUG(1, ("dbus_message_new_method_call failed.\n")); + DEBUG(1, "dbus_message_new_method_call failed.\n"); talloc_zfree(req); return NULL; } - DEBUG(4, ("Sending request with the following data:\n")); + DEBUG(4, "Sending request with the following data:\n"); DEBUG_PAM_DATA(4, pd); dp_ret = dp_pack_pam_request(msg, pd); if (!dp_ret) { - DEBUG(1, ("Failed to build message\n")); + DEBUG(1, "Failed to build message\n"); dbus_message_unref(msg); talloc_zfree(req); return NULL; @@ -620,7 +620,7 @@ static void proxy_pam_conv_reply(DBusPendingCall *pending, void *ptr) int type; int ret; - DEBUG(8, ("Handling pam conversation reply\n")); + DEBUG(8, "Handling pam conversation reply\n"); req = talloc_get_type(ptr, struct tevent_req); state = tevent_req_data(req, struct proxy_conv_ctx); @@ -630,8 +630,8 @@ static void proxy_pam_conv_reply(DBusPendingCall *pending, void *ptr) reply = dbus_pending_call_steal_reply(pending); dbus_pending_call_unref(pending); if (reply == NULL) { - DEBUG(0, ("Severe error. A reply callback was called but no reply was" - "received and no timeout occurred\n")); + DEBUG(0, "Severe error. A reply callback was called but no reply was" + "received and no timeout occurred\n"); state->pd->pam_status = PAM_SYSTEM_ERR; tevent_req_error(req, EIO); } @@ -641,23 +641,23 @@ static void proxy_pam_conv_reply(DBusPendingCall *pending, void *ptr) case DBUS_MESSAGE_TYPE_METHOD_RETURN: ret = dp_unpack_pam_response(reply, state->pd, &dbus_error); if (!ret) { - DEBUG(0, ("Failed to parse reply.\n")); + DEBUG(0, "Failed to parse reply.\n"); state->pd->pam_status = PAM_SYSTEM_ERR; dbus_message_unref(reply); tevent_req_error(req, EIO); return; } - DEBUG(4, ("received: [%d][%s]\n", + DEBUG(4, "received: [%d][%s]\n", state->pd->pam_status, - state->pd->domain)); + state->pd->domain); break; case DBUS_MESSAGE_TYPE_ERROR: - DEBUG(0, ("Reply error [%s].\n", - dbus_message_get_error_name(reply))); + DEBUG(0, "Reply error [%s].\n", + dbus_message_get_error_name(reply)); state->pd->pam_status = PAM_SYSTEM_ERR; break; default: - DEBUG(0, ("Default... what now?.\n")); + DEBUG(0, "Default... what now?.\n"); state->pd->pam_status = PAM_SYSTEM_ERR; } dbus_message_unref(reply); @@ -686,7 +686,7 @@ static void proxy_pam_conv_done(struct tevent_req *subreq) ret = proxy_pam_conv_recv(subreq); talloc_zfree(subreq); if (ret != EOK) { - DEBUG(6, ("Proxy PAM conversation failed [%d]\n", ret)); + DEBUG(6, "Proxy PAM conversation failed [%d]\n", ret); tevent_req_error(req, ret); return; } @@ -725,7 +725,7 @@ static void proxy_child_done(struct tevent_req *req) client_ctx->auth_ctx->running--; imm = tevent_create_immediate(be_ctx->ev); if (imm == NULL) { - DEBUG(1, ("tevent_create_immediate failed.\n")); + DEBUG(1, "tevent_create_immediate failed.\n"); /* We'll still finish the current request, but we're * likely to have problems if there are queued events * if we've gotten into this state. @@ -753,7 +753,7 @@ static void proxy_child_done(struct tevent_req *req) ret = sss_authtok_get_password(pd->authtok, &password, NULL); if (ret) { /* password caching failures are not fatal errors */ - DEBUG(2, ("Failed to cache password\n")); + DEBUG(2, "Failed to cache password\n"); goto done; } @@ -762,8 +762,8 @@ static void proxy_child_done(struct tevent_req *req) /* password caching failures are not fatal errors */ /* so we just log it any return */ if (ret != EOK) { - DEBUG(2, ("Failed to cache password (%d)[%s]!?\n", - ret, strerror(ret))); + DEBUG(2, "Failed to cache password (%d)[%s]!?\n", + ret, strerror(ret)); } } @@ -807,7 +807,7 @@ static void run_proxy_child_queue(struct tevent_context *ev, auth_ctx->running++; subreq = proxy_child_init_send(auth_ctx, state, auth_ctx); if (!subreq) { - DEBUG(1, ("Could not fork child process\n")); + DEBUG(1, "Could not fork child process\n"); auth_ctx->running--; talloc_zfree(req); return; -- cgit