This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
struct composite_context *pipe_connect_req;
/* composite context allocation and setup */
- c = talloc_zero(mem_ctx, struct composite_context);
- if (c == NULL) return NULL;
+ c = composite_create(ctx, ctx->event_ctx);
+ if (c == NULL) return c;
s = talloc_zero(c, struct rpc_connect_srv_state);
if (composite_nomem(s, c)) return c;
- c->state = COMPOSITE_STATE_IN_PROGRESS;
c->private_data = s;
- c->event_ctx = ctx->event_ctx;
s->ctx = ctx;
s->r = *r;
struct composite_context *lookup_dc_req;
/* composite context allocation and setup */
- c = talloc_zero(mem_ctx, struct composite_context);
- if (c == NULL) return NULL;
+ c = composite_create(ctx, ctx->event_ctx);
+ if (c == NULL) return c;
s = talloc_zero(c, struct rpc_connect_dc_state);
if (composite_nomem(s, c)) return c;
- c->state = COMPOSITE_STATE_IN_PROGRESS;
c->private_data = s;
- c->event_ctx = ctx->event_ctx;
s->ctx = ctx;
s->r = *r;
s->r.out.dcerpc_pipe = s->r2.out.dcerpc_pipe;
/* prepare a monitor message and post it */
- msg.type = net_pipe_connected;
- msg.data = NULL;
- msg.data_size = 0;
-
data.host = s->r.out.dcerpc_pipe->binding->host;
data.endpoint = s->r.out.dcerpc_pipe->binding->endpoint;
data.transport = s->r.out.dcerpc_pipe->binding->transport;
+ msg.type = net_pipe_connected;
+ msg.data = (void*)&data;
+ msg.data_size = sizeof(data);
+
if (s->monitor_fn) s->monitor_fn(&msg);
composite_done(c);
static void continue_lsa_query_info2(struct rpc_request *req);
static void continue_epm_map_binding(struct composite_context *ctx);
static void continue_secondary_conn(struct composite_context *ctx);
+static void continue_epm_map_binding_send(struct composite_context *c);
/**
struct rpc_connect_dci_state *s;
/* composite context allocation and setup */
- c = talloc_zero(mem_ctx, struct composite_context);
- if (c == NULL) return NULL;
+ c = composite_create(ctx, ctx->event_ctx);
+ if (c == NULL) return c;
s = talloc_zero(c, struct rpc_connect_dci_state);
if (composite_nomem(s, c)) return c;
- c->state = COMPOSITE_STATE_IN_PROGRESS;
c->private_data = s;
- c->event_ctx = ctx->event_ctx;
s->ctx = ctx;
s->r = *r;
struct rpc_connect_dci_state *s;
struct rpc_request *query_info_req;
- c = talloc_get_type(req->async.private, struct composite_context);
+ c = talloc_get_type(req->async.private_data, struct composite_context);
s = talloc_get_type(c->private_data, struct rpc_connect_dci_state);
c->status = dcerpc_ndr_request_recv(req);
return;
}
- if (!NT_STATUS_IS_OK(s->lsa_query_info2.out.result)) {
- composite_error(c, s->lsa_query_info2.out.result);
+ if (NT_STATUS_EQUAL(s->lsa_open_policy.out.result, NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED)) {
+ s->r.out.realm = NULL;
+ s->r.out.guid = NULL;
+ s->r.out.domain_name = NULL;
+ s->r.out.domain_sid = NULL;
+ /* Skip to the creating the actual connection, no info available on this transport */
+ continue_epm_map_binding_send(c);
+ return;
+ } else if (!NT_STATUS_IS_OK(s->lsa_open_policy.out.result)) {
+ composite_error(c, s->lsa_open_policy.out.result);
return;
}
struct rpc_connect_dci_state *s;
struct rpc_request *query_info_req;
- c = talloc_get_type(req->async.private, struct composite_context);
+ c = talloc_get_type(req->async.private_data, struct composite_context);
s = talloc_get_type(c->private_data, struct rpc_connect_dci_state);
c->status = dcerpc_ndr_request_recv(req);
/*
- Step 5 of RpcConnectDCInfo: Get domain name and sid and request endpoint
- map binding
+ Step 5 of RpcConnectDCInfo: Get domain name and sid
*/
static void continue_lsa_query_info(struct rpc_request *req)
{
- struct composite_context *c, *epm_map_req;
+ struct composite_context *c;
struct rpc_connect_dci_state *s;
- c = talloc_get_type(req->async.private, struct composite_context);
+ c = talloc_get_type(req->async.private_data, struct composite_context);
s = talloc_get_type(c->private_data, struct rpc_connect_dci_state);
c->status = dcerpc_ndr_request_recv(req);
s->r.out.domain_sid = s->lsa_query_info.out.info->domain.sid;
s->r.out.domain_name = s->lsa_query_info.out.info->domain.name.string;
+ continue_epm_map_binding_send(c);
+}
+
+/*
+ Step 5 (continued) of RpcConnectDCInfo: request endpoint
+ map binding.
+
+ We may short-cut to this step if we dont' support LSA OpenPolicy on this transport
+*/
+static void continue_epm_map_binding_send(struct composite_context *c)
+{
+ struct rpc_connect_dci_state *s;
+ struct composite_context *epm_map_req;
+ s = talloc_get_type(c->private_data, struct rpc_connect_dci_state);
/* prepare to get endpoint mapping for the requested interface */
s->final_binding = talloc(s, struct dcerpc_binding);
composite_continue(c, epm_map_req, continue_epm_map_binding, c);
}
-
/*
Step 6 of RpcConnectDCInfo: Receive endpoint mapping and create secondary
rpc connection derived from already used pipe but connected to the requested
/*
- Step 7 of RpcConnectDCInfo: Get actual lsa pipe to be returned
+ Step 7 of RpcConnectDCInfo: Get actual pipe to be returned
and complete this composite call
*/
static void continue_secondary_conn(struct composite_context *ctx)