]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
mit-samba: Send the logging to the kdc log facility
authorAndreas Schneider <asn@samba.org>
Mon, 11 Jun 2018 14:15:10 +0000 (16:15 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 5 Aug 2021 09:46:30 +0000 (09:46 +0000)
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/kdc/mit_samba.c

index b3bb6b1b0321fade0a2213f76a43cb28cd27adce..0a142513608e906d6c36e05295c8c5745caa3450 100644 (file)
@@ -25,6 +25,7 @@
 #include "param/param.h"
 #include "dsdb/samdb/samdb.h"
 #include "system/kerberos.h"
+#include <com_err.h>
 #include <kdb.h>
 #include <kadm5/kadm_err.h>
 #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);