From dd8138236bec3635c25e5b482b7a14faa0a9c36b Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 11 Jun 2018 16:15:10 +0200 Subject: [PATCH] mit-samba: Send the logging to the kdc log facility Reviewed-by: Andrew Bartlett --- source4/kdc/mit_samba.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/source4/kdc/mit_samba.c b/source4/kdc/mit_samba.c index b3bb6b1b032..0a142513608 100644 --- a/source4/kdc/mit_samba.c +++ b/source4/kdc/mit_samba.c @@ -25,6 +25,7 @@ #include "param/param.h" #include "dsdb/samdb/samdb.h" #include "system/kerberos.h" +#include #include #include #include "kdc/sdb.h" @@ -54,6 +55,22 @@ void mit_samba_context_free(struct mit_samba_context *ctx) talloc_free(ctx); } +/* + * Implemant a callback to log to the MIT KDC log facility + * + * http://web.mit.edu/kerberos/krb5-devel/doc/plugindev/general.html#logging-from-kdc-and-kadmind-plugin-modules + */ +static void mit_samba_debug(void *private_ptr, int msg_level, const char *msg) +{ + int is_error = 1; + + if (msg_level > 0) { + is_error = 0; + } + + com_err("", is_error, "%s", msg); +} + int mit_samba_context_init(struct mit_samba_context **_ctx) { NTSTATUS status; @@ -80,7 +97,7 @@ int mit_samba_context_init(struct mit_samba_context **_ctx) goto done; } - setup_logging("mitkdc", DEBUG_DEFAULT_STDOUT); + debug_set_callback(NULL, mit_samba_debug); /* init s4 configuration */ s4_conf_file = lpcfg_configfile(base_ctx.lp_ctx);