summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2016-07-02 15:41:28 +0200
committerJakub Hrozek <jhrozek@redhat.com>2016-07-07 10:30:29 +0200
commit573e86dc3156e481ce53d39ac901da2e99cfa0ca (patch)
treec904f8390a5bb2c6463212122817360104e41706
parent61913b8f0d1ba54d82640500d7486fac5f72b030 (diff)
downloadsssd-573e86dc3156e481ce53d39ac901da2e99cfa0ca.zip
sssd-573e86dc3156e481ce53d39ac901da2e99cfa0ca.tar.gz
sssd-573e86dc3156e481ce53d39ac901da2e99cfa0ca.tar.xz
SUDO: Add more low-level tracing messages
Just adds more debugging messages that are handy in seeing what gets passed between sudo responder and client. Reviewed-by: Sumit Bose <sbose@redhat.com>
-rw-r--r--src/responder/sudo/sudosrv_query.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/responder/sudo/sudosrv_query.c b/src/responder/sudo/sudosrv_query.c
index 36d777e..5b0edb6 100644
--- a/src/responder/sudo/sudosrv_query.c
+++ b/src/responder/sudo/sudosrv_query.c
@@ -83,8 +83,9 @@ static int sudosrv_response_append_attr(TALLOC_CTX *mem_ctx,
uint8_t *response_body = *_response_body;
size_t response_len = *_response_len;
TALLOC_CTX *tmp_ctx = NULL;
- int i = 0;
+ unsigned int i = 0;
int ret = EOK;
+ const char *strval;
tmp_ctx = talloc_new(NULL);
if (tmp_ctx == NULL) {
@@ -108,16 +109,19 @@ 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) {
+ strval = (const char *) values[i].data;
+
+ if (strlen((strval)) != values[i].length) {
DEBUG(SSSDBG_CRIT_FAILURE, "value is not a string\n");
ret = EINVAL;
goto done;
}
ret = sudosrv_response_append_string(tmp_ctx,
- (const char*)values[i].data,
+ strval,
values[i].length + 1,
&response_body, &response_len);
+ DEBUG(SSSDBG_TRACE_INTERNAL, "%s:%s\n", name, strval);
if (ret != EOK) {
goto done;
}
@@ -211,6 +215,7 @@ errno_t sudosrv_build_response(TALLOC_CTX *mem_ctx,
if (ret != EOK) {
goto fail;
}
+ DEBUG(SSSDBG_TRACE_INTERNAL, "error: [%"PRIu32"]\n", error);
if (error != SSS_SUDO_ERROR_OK) {
goto done;
@@ -230,9 +235,11 @@ errno_t sudosrv_build_response(TALLOC_CTX *mem_ctx,
if (ret != EOK) {
goto fail;
}
+ DEBUG(SSSDBG_TRACE_INTERNAL, "rules_num: [%"PRIu32"]\n", error);
/* rules */
for (i = 0; i < rules_num; i++) {
+ DEBUG(SSSDBG_TRACE_INTERNAL, "rule [%"PRIu32"]/[%"PRIu32"]\n", i+1, rules_num);
ret = sudosrv_response_append_rule(tmp_ctx, rules[i]->num, rules[i]->a,
&response_body, &response_len);
if (ret != EOK) {