Register types rather than constructors, display structs as classes.
[jelmer/samba4-debian.git] / source / winbind / wb_init_domain.c
index 7d050d5c673182b9cb1024c7da585faf18eb01c8..fc35f11db629ab3f7a29963ef45075bd5b65c055 100644 (file)
@@ -101,7 +101,8 @@ static struct dcerpc_binding *init_domain_binding(struct init_domain_state *stat
        binding->host = state->domain->dc_address;
 
        /* This shouldn't make a network call, as the mappings for named pipes are well known */
-       status = dcerpc_epm_map_binding(binding, binding, table, state->service->task->event_ctx);
+       status = dcerpc_epm_map_binding(binding, binding, table, state->service->task->event_ctx,
+                                       state->service->task->lp_ctx);
        if (!NT_STATUS_IS_OK(status)) {
                return NULL;
        }
@@ -143,7 +144,8 @@ struct composite_context *wb_init_domain_send(TALLOC_CTX *mem_ctx,
        state->domain->dc_name = dom_info->dcs[0].name;
        state->domain->dc_address = dom_info->dcs[0].address;
 
-       state->domain->libnet_ctx = libnet_context_init(service->task->event_ctx);
+       state->domain->libnet_ctx = libnet_context_init(service->task->event_ctx, 
+                                                       service->task->lp_ctx);
 
        /* Create a credentials structure */
        state->domain->libnet_ctx->cred = cli_credentials_init(state->domain);
@@ -151,11 +153,11 @@ struct composite_context *wb_init_domain_send(TALLOC_CTX *mem_ctx,
 
        cli_credentials_set_event_context(state->domain->libnet_ctx->cred, service->task->event_ctx);
 
-       cli_credentials_set_conf(state->domain->libnet_ctx->cred, global_loadparm);
+       cli_credentials_set_conf(state->domain->libnet_ctx->cred, service->task->lp_ctx);
 
        /* Connect the machine account to the credentials */
        state->ctx->status =
-               cli_credentials_set_machine_account(state->domain->libnet_ctx->cred);
+               cli_credentials_set_machine_account(state->domain->libnet_ctx->cred, state->domain->libnet_ctx->lp_ctx);
        if (!NT_STATUS_IS_OK(state->ctx->status)) goto failed;
 
        state->domain->netlogon_binding = init_domain_binding(state, &ndr_table_netlogon);
@@ -163,14 +165,14 @@ struct composite_context *wb_init_domain_send(TALLOC_CTX *mem_ctx,
        state->domain->netlogon_pipe = NULL;
 
        if ((!cli_credentials_is_anonymous(state->domain->libnet_ctx->cred)) &&
-           ((lp_server_role(global_loadparm) == ROLE_DOMAIN_MEMBER) ||
-            (lp_server_role(global_loadparm) == ROLE_DOMAIN_CONTROLLER)) &&
+           ((lp_server_role(service->task->lp_ctx) == ROLE_DOMAIN_MEMBER) ||
+            (lp_server_role(service->task->lp_ctx) == ROLE_DOMAIN_CONTROLLER)) &&
            (dom_sid_equal(state->domain->info->sid,
                           state->service->primary_sid))) {
                state->domain->netlogon_binding->flags |= DCERPC_SCHANNEL;
 
                /* For debugging, it can be a real pain if all the traffic is encrypted */
-               if (lp_winbind_sealed_pipes(global_loadparm)) {
+               if (lp_winbind_sealed_pipes(service->task->lp_ctx)) {
                        state->domain->netlogon_binding->flags |= (DCERPC_SIGN | DCERPC_SEAL );
                } else {
                        state->domain->netlogon_binding->flags |= (DCERPC_SIGN);
@@ -182,7 +184,8 @@ struct composite_context *wb_init_domain_send(TALLOC_CTX *mem_ctx,
        ctx = dcerpc_pipe_connect_b_send(state, state->domain->netlogon_binding, 
                                         &ndr_table_netlogon,
                                         state->domain->libnet_ctx->cred,
-                                        service->task->event_ctx);
+                                        service->task->event_ctx,
+                                        service->task->lp_ctx);
        
        if (composite_nomem(ctx, state->ctx)) {
                goto failed;
@@ -216,7 +219,7 @@ static void init_domain_recv_netlogonpipe(struct composite_context *ctx)
        state->domain->lsa_binding = init_domain_binding(state, &ndr_table_lsarpc);
 
        /* For debugging, it can be a real pain if all the traffic is encrypted */
-       if (lp_winbind_sealed_pipes(global_loadparm)) {
+       if (lp_winbind_sealed_pipes(state->service->task->lp_ctx)) {
                state->domain->lsa_binding->flags |= (DCERPC_SIGN | DCERPC_SEAL );
        } else {
                state->domain->lsa_binding->flags |= (DCERPC_SIGN);
@@ -229,7 +232,8 @@ static void init_domain_recv_netlogonpipe(struct composite_context *ctx)
        ctx = dcerpc_secondary_auth_connection_send(state->domain->netlogon_pipe,
                                                    state->domain->lsa_binding,
                                                    &ndr_table_lsarpc,
-                                                   state->domain->libnet_ctx->cred
+                                                   state->domain->libnet_ctx->cred,
+                                                   state->domain->libnet_ctx->lp_ctx
                );
        composite_continue(state->ctx, ctx, init_domain_recv_lsa_pipe, state);
 }
@@ -255,7 +259,8 @@ static bool retry_with_schannel(struct init_domain_state *state,
                ctx = dcerpc_secondary_auth_connection_send(state->domain->netlogon_pipe,
                                                            binding,
                                                            table, 
-                                                           state->domain->libnet_ctx->cred);
+                                                           state->domain->libnet_ctx->cred,
+                                                           state->domain->libnet_ctx->lp_ctx);
                composite_continue(state->ctx, ctx, continuation, state);               
                return true;
        } else {
@@ -400,7 +405,7 @@ static void init_domain_recv_samr(struct composite_context *ctx)
        state->domain->libnet_ctx->samr.sid = state->domain->info->sid;
 
        state->domain->ldap_conn =
-               ldap4_new_connection(state->domain, state->ctx->event_ctx);
+               ldap4_new_connection(state->domain, state->domain->libnet_ctx->lp_ctx, state->ctx->event_ctx);
        composite_nomem(state->domain->ldap_conn, state->ctx);
 
        ldap_url = talloc_asprintf(state, "ldap://%s/",
@@ -424,7 +429,8 @@ static void init_domain_recv_ldapconn(struct composite_context *ctx)
                                      state->domain->dc_name);
                state->ctx->status =
                        ldap_bind_sasl(state->domain->ldap_conn,
-                                      state->domain->libnet_ctx->cred);
+                                      state->domain->libnet_ctx->cred,
+                                      state->domain->libnet_ctx->lp_ctx);
                DEBUG(0, ("ldap_bind returned %s\n",
                          nt_errstr(state->ctx->status)));
        }