r12868: Remove unused code. This has moved to libcli/finddcs.c.
authorAndrew Bartlett <abartlet@samba.org>
Thu, 12 Jan 2006 09:56:15 +0000 (09:56 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:50:56 +0000 (13:50 -0500)
Andrew Bartlett

source/winbind/wb_async_helpers.c
source/winbind/wb_async_helpers.h

index e89c27000bd5e36ad0c7703bc38c99a65724b05c..f4de7d42845e0a81ee78cc4f286498f37b613623 100644 (file)
 #include "librpc/gen_ndr/ndr_irpc.h"
 #include "libcli/auth/credentials.h"
 
 #include "librpc/gen_ndr/ndr_irpc.h"
 #include "libcli/auth/credentials.h"
 
-struct finddcs_state {
-       struct composite_context *ctx;
-       struct messaging_context *msg_ctx;
-
-       const char *domain_name;
-       const struct dom_sid *domain_sid;
-
-       struct nbtd_getdcname r;
-
-       int num_dcs;
-       struct nbt_dc_name *dcs;
-};
-
-static void finddcs_resolve(struct composite_context *ctx);
-static void finddcs_getdc(struct irpc_request *ireq);
-
-struct composite_context *wb_finddcs_send(TALLOC_CTX *mem_ctx,
-                                         const char *domain_name,
-                                         const struct dom_sid *domain_sid,
-                                         struct event_context *event_ctx,
-                                         struct messaging_context *msg_ctx)
-{
-       struct composite_context *result, *ctx;
-       struct finddcs_state *state;
-       struct nbt_name name;
-
-       result = talloc(mem_ctx, struct composite_context);
-       if (result == NULL) goto failed;
-       result->state = COMPOSITE_STATE_IN_PROGRESS;
-       result->async.fn = NULL;
-       result->event_ctx = event_ctx;
-
-       state = talloc(result, struct finddcs_state);
-       if (state == NULL) goto failed;
-       state->ctx = result;
-       result->private_data = state;
-
-       state->domain_name = talloc_strdup(state, domain_name);
-       if (state->domain_name == NULL) goto failed;
-       state->domain_sid = dom_sid_dup(state, domain_sid);
-       if (state->domain_sid == NULL) goto failed;
-       state->msg_ctx = msg_ctx;
-
-       make_nbt_name(&name, state->domain_name, 0x1c);
-       ctx = resolve_name_send(&name, result->event_ctx,
-                               lp_name_resolve_order());
-
-       if (ctx == NULL) goto failed;
-       ctx->async.fn = finddcs_resolve;
-       ctx->async.private_data = state;
-
-       return result;
-
-failed:
-       talloc_free(result);
-       return NULL;
-}
-
-static void finddcs_resolve(struct composite_context *ctx)
-{
-       struct finddcs_state *state =
-               talloc_get_type(ctx->async.private_data, struct finddcs_state);
-       struct irpc_request *ireq;
-       uint32_t *nbt_servers;
-       const char *address;
-
-       state->ctx->status = resolve_name_recv(ctx, state, &address);
-       if (!composite_is_ok(state->ctx)) return;
-
-       state->num_dcs = 1;
-       state->dcs = talloc_array(state, struct nbt_dc_name, state->num_dcs);
-       if (composite_nomem(state->dcs, state->ctx)) return;
-
-       state->dcs[0].address = talloc_steal(state->dcs, address);
-
-       nbt_servers = irpc_servers_byname(state->msg_ctx, "nbt_server");
-       if ((nbt_servers == NULL) || (nbt_servers[0] == 0)) {
-               composite_error(state->ctx, NT_STATUS_NO_LOGON_SERVERS);
-               return;
-       }
-
-       state->r.in.domainname = state->domain_name;
-       state->r.in.ip_address = state->dcs[0].address;
-       state->r.in.my_computername = lp_netbios_name();
-       state->r.in.my_accountname = talloc_asprintf(state, "%s$",
-                                                    lp_netbios_name());
-       if (composite_nomem(state->r.in.my_accountname, state->ctx)) return;
-       state->r.in.account_control = ACB_WSTRUST;
-       state->r.in.domain_sid = dom_sid_dup(state, state->domain_sid);
-       if (composite_nomem(state->r.in.domain_sid, state->ctx)) return;
-
-       ireq = irpc_call_send(state->msg_ctx, nbt_servers[0],
-                             &dcerpc_table_irpc, DCERPC_NBTD_GETDCNAME,
-                             &state->r, state);
-       composite_continue_irpc(state->ctx, ireq, finddcs_getdc, state);
-}
-
-static void finddcs_getdc(struct irpc_request *ireq)
-{
-       struct finddcs_state *state =
-               talloc_get_type(ireq->async.private, struct finddcs_state);
-
-       state->ctx->status = irpc_call_recv(ireq);
-       if (!composite_is_ok(state->ctx)) return;
-
-       state->dcs[0].name = talloc_steal(state->dcs, state->r.out.dcname);
-       composite_done(state->ctx);
-}
-
-NTSTATUS wb_finddcs_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
-                        int *num_dcs, struct nbt_dc_name **dcs)
-{
-       NTSTATUS status = composite_wait(c);
-       if (NT_STATUS_IS_OK(status)) {
-               struct finddcs_state *state =
-                       talloc_get_type(c->private_data, struct finddcs_state);
-               *num_dcs = state->num_dcs;
-               *dcs = talloc_steal(mem_ctx, state->dcs);
-       }
-       talloc_free(c);
-       return status;
-}
-
-NTSTATUS wb_finddcs(TALLOC_CTX *mem_ctx,
-                   const char *domain_name, const struct dom_sid *domain_sid,
-                   struct event_context *event_ctx,
-                   struct messaging_context *msg_ctx,
-                   int *num_dcs, struct nbt_dc_name **dcs)
-{
-       struct composite_context *c = wb_finddcs_send(mem_ctx,
-                                                     domain_name, domain_sid,
-                                                     event_ctx, msg_ctx);
-       return wb_finddcs_recv(c, mem_ctx, num_dcs, dcs);
-}
-
 struct get_schannel_creds_state {
        struct cli_credentials *wks_creds;
        struct dcerpc_pipe *p;
 struct get_schannel_creds_state {
        struct cli_credentials *wks_creds;
        struct dcerpc_pipe *p;
index 532cd9730ceb4cd07e4e24d77ccd89fb4ed70a77..2754a8acd6fbd9759e34c71f1fa32759ee938a23 100644 (file)
 
 #include "librpc/gen_ndr/lsa.h"
 
 
 #include "librpc/gen_ndr/lsa.h"
 
-struct nbt_dc_name {
-       const char *address;
-       const char *name;
-};
-
 struct wb_sid_object {
        enum lsa_SidType type;
        struct dom_sid *sid;
 struct wb_sid_object {
        enum lsa_SidType type;
        struct dom_sid *sid;