r26229: Set loadparm context as opaque pointer in ldb, remove more uses of global_loa...
[jelmer/samba4-debian.git] / source / kdc / kdc.c
index f26e5a7e9b7490cde38f7d9cdfa1dec4d69bbfe8..b24b58f8d440004034c8c6844ba76dd001db4e6a 100644 (file)
@@ -38,6 +38,7 @@
 #include "heimdal/kdc/windc_plugin.h"
 #include "heimdal/lib/krb5/krb5_locl.h"
 #include "heimdal/kdc/kdc_locl.h"
+#include "param/param.h"
 
 
 /* Disgusting hack to get a mem_ctx into the hdb plugin, when used as a keytab */
@@ -50,7 +51,7 @@ struct kdc_reply {
        DATA_BLOB packet;
 };
 
-typedef BOOL (*kdc_process_fn_t)(struct kdc_server *kdc,
+typedef bool (*kdc_process_fn_t)(struct kdc_server *kdc,
                                 TALLOC_CTX *mem_ctx, 
                                 DATA_BLOB *input, 
                                 DATA_BLOB *reply,
@@ -310,7 +311,7 @@ static void kdc_tcp_send(struct stream_connection *conn, uint16_t flags)
    calling conventions
 */
 
-static BOOL kdc_process(struct kdc_server *kdc,
+static bool kdc_process(struct kdc_server *kdc,
                        TALLOC_CTX *mem_ctx, 
                        DATA_BLOB *input, 
                        DATA_BLOB *reply,
@@ -336,7 +337,7 @@ static BOOL kdc_process(struct kdc_server *kdc,
                                            datagram_reply);
        if (ret == -1) {
                *reply = data_blob(NULL, 0);
-               return False;
+               return false;
        }
        if (k5_reply.length) {
                *reply = data_blob_talloc(mem_ctx, k5_reply.data, k5_reply.length);
@@ -344,7 +345,7 @@ static BOOL kdc_process(struct kdc_server *kdc,
        } else {
                *reply = data_blob(NULL, 0);    
        }
-       return True;
+       return true;
 }
 
 /*
@@ -515,7 +516,7 @@ static NTSTATUS kdc_add_socket(struct kdc_server *kdc, const char *address,
 /*
   setup our listening sockets on the configured network interfaces
 */
-static NTSTATUS kdc_startup_interfaces(struct kdc_server *kdc)
+static NTSTATUS kdc_startup_interfaces(struct kdc_server *kdc, struct loadparm_context *lp_ctx)
 {
        int num_interfaces = iface_count();
        TALLOC_CTX *tmp_ctx = talloc_new(kdc);
@@ -525,8 +526,8 @@ static NTSTATUS kdc_startup_interfaces(struct kdc_server *kdc)
        
        for (i=0; i<num_interfaces; i++) {
                const char *address = talloc_strdup(tmp_ctx, iface_n_ip(i));
-               status = kdc_add_socket(kdc, address, lp_krb5_port(), 
-                                       lp_kpasswd_port());
+               status = kdc_add_socket(kdc, address, lp_krb5_port(lp_ctx), 
+                                       lp_kpasswd_port(lp_ctx));
                NT_STATUS_NOT_OK_RETURN(status);
        }
 
@@ -554,7 +555,7 @@ static void kdc_task_init(struct task_server *task)
        NTSTATUS status;
        krb5_error_code ret;
 
-       switch (lp_server_role()) {
+       switch (lp_server_role(task->lp_ctx)) {
        case ROLE_STANDALONE:
                task_server_terminate(task, "kdc: no KDC required in standalone configuration");
                return;
@@ -635,7 +636,7 @@ static void kdc_task_init(struct task_server *task)
        kdc_mem_ctx = kdc->smb_krb5_context;
 
        /* start listening on the configured network interfaces */
-       status = kdc_startup_interfaces(kdc);
+       status = kdc_startup_interfaces(kdc, task->lp_ctx);
        if (!NT_STATUS_IS_OK(status)) {
                task_server_terminate(task, "kdc failed to setup interfaces");
                return;