summaryrefslogtreecommitdiff
path: root/src/providers/ldap
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-10-09 19:02:22 +0200
committerJakub Hrozek <jhrozek@redhat.com>2012-10-12 09:56:54 +0200
commite7a24374d97e1d1c32d3e18561a20e8c5e6319ec (patch)
tree7acc2bb1d30f9e3cc72b500a5810ae4e48748743 /src/providers/ldap
parent115cc768599d7df4b3206426652d3e7a3971d597 (diff)
downloadsssd-e7a24374d97e1d1c32d3e18561a20e8c5e6319ec.tar.gz
sssd-e7a24374d97e1d1c32d3e18561a20e8c5e6319ec.tar.bz2
sssd-e7a24374d97e1d1c32d3e18561a20e8c5e6319ec.zip
Collect krb5 trace on high debug levels
If the debug level contains SSSDBG_TRACE_ALL, then the logs would also include tracing information from libkrb5. https://fedorahosted.org/sssd/ticket/1539
Diffstat (limited to 'src/providers/ldap')
-rw-r--r--src/providers/ldap/ldap_child.c24
-rw-r--r--src/providers/ldap/sdap_child_helpers.c2
2 files changed, 25 insertions, 1 deletions
diff --git a/src/providers/ldap/ldap_child.c b/src/providers/ldap/ldap_child.c
index 35e0c0f5..de25fc07 100644
--- a/src/providers/ldap/ldap_child.c
+++ b/src/providers/ldap/ldap_child.c
@@ -141,6 +141,25 @@ static int pack_buffer(struct response *r, int result, krb5_error_code krberr,
return EOK;
}
+static errno_t
+set_child_debugging(krb5_context ctx)
+{
+ krb5_error_code kerr;
+
+ /* Set the global error context */
+ krb5_error_ctx = ctx;
+
+ if (debug_level & SSSDBG_TRACE_ALL) {
+ kerr = krb5_set_trace_callback(ctx, sss_child_krb5_trace_cb, NULL);
+ if (kerr) {
+ LDAP_CHILD_DEBUG(SSSDBG_MINOR_FAILURE, kerr);
+ return EIO;
+ }
+ }
+
+ return EOK;
+}
+
static krb5_error_code ldap_child_get_tgt_sync(TALLOC_CTX *memctx,
const char *realm_str,
const char *princ_str,
@@ -173,6 +192,11 @@ static krb5_error_code ldap_child_get_tgt_sync(TALLOC_CTX *memctx,
}
DEBUG(SSSDBG_TRACE_INTERNAL, ("Kerberos context initialized\n"));
+ krberr = set_child_debugging(context);
+ if (krberr != EOK) {
+ DEBUG(SSSDBG_MINOR_FAILURE, ("Cannot set krb5_child debugging\n"));
+ }
+
if (!realm_str) {
krberr = krb5_get_default_realm(context, &default_realm);
if (krberr) {
diff --git a/src/providers/ldap/sdap_child_helpers.c b/src/providers/ldap/sdap_child_helpers.c
index 5e86fce5..f2412f9e 100644
--- a/src/providers/ldap/sdap_child_helpers.c
+++ b/src/providers/ldap/sdap_child_helpers.c
@@ -457,7 +457,7 @@ int setup_child(struct sdap_id_ctx *ctx)
FILE *debug_filep;
if (debug_to_file != 0 && ldap_child_debug_fd == -1) {
- ret = open_debug_file_ex("ldap_child", &debug_filep);
+ ret = open_debug_file_ex(LDAP_CHILD_LOG_FILE, &debug_filep);
if (ret != EOK) {
DEBUG(0, ("Error setting up logging (%d) [%s]\n",
ret, strerror(ret)));