binding = talloc_asprintf(mem_ctx, "ncacn_np:%s", query_host);
status = dcerpc_pipe_connect(mem_ctx, &p, binding,
- DCERPC_SRVSVC_UUID,
- DCERPC_SRVSVC_VERSION,
+ &dcerpc_table_srvsvc,
cmdline_credentials, NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Failed to connect to %s - %s\n",
cli_credentials_set_gtk_callbacks(credentials);
status = dcerpc_pipe_connect(talloc_autofree_context(), &epmapper_pipe, bs,
- DCERPC_EPMAPPER_UUID, DCERPC_EPMAPPER_VERSION,
+ &dcerpc_table_epmapper,
credentials, NULL);
if (NT_STATUS_IS_ERR(status)) {
refresh_eps();
- status = dcerpc_secondary_context(epmapper_pipe, &mgmt_pipe, DCERPC_MGMT_UUID, DCERPC_MGMT_VERSION);
+ status = dcerpc_secondary_context(epmapper_pipe, &mgmt_pipe, &dcerpc_table_mgmt);
if (NT_STATUS_IS_ERR(status)) {
mgmt_pipe = NULL;
status = dcerpc_pipe_connect_b(mem_ctx, &at_pipe,
gtk_rpc_binding_dialog_get_binding(d, mem_ctx),
- DCERPC_ATSVC_UUID,
- DCERPC_ATSVC_VERSION,
+ &dcerpc_table_atsvc,
credentials, NULL);
if(!NT_STATUS_IS_OK(status)) {
/* If connected, get list of jobs */
status = dcerpc_pipe_connect_b(mem_ctx, &sam_pipe,
gtk_rpc_binding_dialog_get_binding(d, mem_ctx),
- DCERPC_SAMR_UUID, DCERPC_SAMR_VERSION, cred, NULL);
+ &dcerpc_table_samr, cred, NULL);
if(!NT_STATUS_IS_OK(status)) {
gtk_show_ntstatus(mainwin, "While connecting to SAMR interface", status);
if (server == NULL) {
return dcerpc_pipe_connect(ctx, p, "ncalrpc",
- DCERPC_IREMOTEACTIVATION_UUID,
- DCERPC_IREMOTEACTIVATION_VERSION,
- ctx->dcom->credentials, ctx->event_ctx);
+ &dcerpc_table_IRemoteActivation,
+ ctx->dcom->credentials, ctx->event_ctx);
}
/* Allow server name to contain a binding string */
if (NT_STATUS_IS_OK(dcerpc_parse_binding(mem_ctx, server, &bd))) {
status = dcerpc_pipe_connect_b(ctx, p, bd,
- DCERPC_IREMOTEACTIVATION_UUID,
- DCERPC_IREMOTEACTIVATION_VERSION,
- ctx->dcom->credentials, ctx->event_ctx);
+ &dcerpc_table_IRemoteActivation,
+ ctx->dcom->credentials, ctx->event_ctx);
talloc_free(mem_ctx);
return status;
}
status = dcerpc_pipe_connect(ctx, p, binding,
- DCERPC_IREMOTEACTIVATION_UUID,
- DCERPC_IREMOTEACTIVATION_VERSION,
+ &dcerpc_table_IRemoteActivation,
ctx->dcom->credentials, ctx->event_ctx);
if (NT_STATUS_IS_OK(status)) {
if (!GUID_equal(&p->syntax.uuid, &iid)) {
struct dcerpc_pipe *p2;
ox->pipe->syntax.uuid = iid;
- status = dcerpc_secondary_context(p, &p2, uuid, 0);
+
+ /* interface will always be present, so
+ * idl_iface_by_uuid can't return NULL */
+ status = dcerpc_secondary_context(p, &p2, idl_iface_by_uuid(uuid));
+
if (NT_STATUS_IS_OK(status)) {
p = p2;
}
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Error parsing string binding"));
} else {
- /* TODO: jelmer, please look at this. The
- "NULL" here should be a real event
- context */
status = dcerpc_pipe_connect_b(NULL, &p, binding,
- uuid, 0.0,
+ idl_iface_by_uuid(uuid),
iface->ctx->dcom->credentials,
- NULL);
+ iface->ctx->event_ctx);
}
talloc_free(binding);
i++;
status = dcerpc_pipe_connect(*ctx /* TALLOC_CTX */,
&p, location,
- DCERPC_WINREG_UUID,
- DCERPC_WINREG_VERSION,
+ &dcerpc_table_winreg,
credentials, ev);
(*ctx)->backend_data = p;
}
/* bind to the LSA pipe */
- status = dcerpc_bind_auth_none(lsa->pipe, DCERPC_LSARPC_UUID, DCERPC_LSARPC_VERSION);
+ status = dcerpc_bind_auth_none(lsa->pipe, &dcerpc_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(lsa);
return status;
status = dcerpc_pipe_connect_b(tmp_ctx,
&drsuapi_pipe,
drsuapi_binding,
- DCERPC_DRSUAPI_UUID,
- DCERPC_DRSUAPI_VERSION,
+ &dcerpc_table_drsuapi,
ctx->cred,
ctx->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
c->level = LIBNET_RPC_CONNECT_BINDING;
c->in.binding = r->in.binding;
}
- c->in.dcerpc_iface_name = DCERPC_LSARPC_NAME;
- c->in.dcerpc_iface_uuid = DCERPC_LSARPC_UUID;
- c->in.dcerpc_iface_version = DCERPC_LSARPC_VERSION;
+ c->in.dcerpc_iface = &dcerpc_table_lsarpc;
/* connect to the LSA pipe of the PDC */
/* Make binding string for samr, not the other pipe */
status = dcerpc_epm_map_binding(tmp_ctx, samr_binding,
- DCERPC_SAMR_UUID, DCERPC_SAMR_VERSION,
+ &dcerpc_table_samr,
lsa_pipe->conn->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_asprintf(mem_ctx,
return status;
}
- status = dcerpc_pipe_auth(samr_pipe, samr_binding, DCERPC_SAMR_UUID,
- DCERPC_SAMR_VERSION, ctx->cred);
+ status = dcerpc_pipe_auth(samr_pipe, samr_binding, &dcerpc_table_samr, ctx->cred);
if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_asprintf(mem_ctx,
"SAMR bind failed: %s",
/* prepare connect to the SAMR pipe of the users domain PDC */
c.level = LIBNET_RPC_CONNECT_PDC;
c.in.domain_name = r->samr.in.domain_name;
- c.in.dcerpc_iface_name = DCERPC_SAMR_NAME;
- c.in.dcerpc_iface_uuid = DCERPC_SAMR_UUID;
- c.in.dcerpc_iface_version = DCERPC_SAMR_VERSION;
+ c.in.dcerpc_iface = &dcerpc_table_samr;
/* 1. connect to the SAMR pipe of users domain PDC (maybe a standalone server or workstation) */
status = libnet_RpcConnect(ctx, mem_ctx, &c);
/* prepare connect to the SAMR pipe of users domain PDC */
c.level = LIBNET_RPC_CONNECT_PDC;
c.in.domain_name = r->samr.in.domain_name;
- c.in.dcerpc_iface_name = DCERPC_SAMR_NAME;
- c.in.dcerpc_iface_uuid = DCERPC_SAMR_UUID;
- c.in.dcerpc_iface_version = DCERPC_SAMR_VERSION;
+ c.in.dcerpc_iface = &dcerpc_table_samr;
/* 1. connect to the SAMR pipe of users domain PDC (maybe a standalone server or workstation) */
status = libnet_RpcConnect(ctx, mem_ctx, &c);
/* connect to remote dcerpc pipe */
status = dcerpc_pipe_connect(mem_ctx, &r->out.dcerpc_pipe,
- binding, r->in.dcerpc_iface_uuid, r->in.dcerpc_iface_version,
+ binding, r->in.dcerpc_iface,
ctx->cred, ctx->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_asprintf(mem_ctx,
"dcerpc_pipe_connect to pipe %s failed with %s\n",
- r->in.dcerpc_iface_name, binding);
+ r->in.dcerpc_iface->name, binding);
return status;
}
/* ok, pdc has been found so do attempt to rpc connect */
r2.level = LIBNET_RPC_CONNECT_SERVER;
r2.in.domain_name = talloc_strdup(mem_ctx, f.out.address[0]);
- r2.in.dcerpc_iface_name = r->in.dcerpc_iface_name;
- r2.in.dcerpc_iface_uuid = r->in.dcerpc_iface_uuid;
- r2.in.dcerpc_iface_version = r->in.dcerpc_iface_version;
+ r2.in.dcerpc_iface = r->in.dcerpc_iface;
status = libnet_RpcConnect(ctx, mem_ctx, &r2);
struct {
const char *domain_name;
const char *binding;
- const char *dcerpc_iface_name;
- const char *dcerpc_iface_uuid;
- uint32_t dcerpc_iface_version;
+ const struct dcerpc_interface_table *dcerpc_iface;
} in;
struct {
struct dcerpc_pipe *dcerpc_pipe;
c.level = LIBNET_RPC_CONNECT_SERVER;
c.in.domain_name = r->in.server_name;
- c.in.dcerpc_iface_name = DCERPC_SRVSVC_NAME;
- c.in.dcerpc_iface_uuid = DCERPC_SRVSVC_UUID;
- c.in.dcerpc_iface_version = DCERPC_SRVSVC_VERSION;
+ c.in.dcerpc_iface = &dcerpc_table_srvsvc;
status = libnet_RpcConnect(ctx, mem_ctx, &c);
if (!NT_STATUS_IS_OK(status)) {
c.level = LIBNET_RPC_CONNECT_SERVER;
c.in.domain_name = r->in.server_name;
- c.in.dcerpc_iface_name = DCERPC_SRVSVC_NAME;
- c.in.dcerpc_iface_uuid = DCERPC_SRVSVC_UUID;
- c.in.dcerpc_iface_version = DCERPC_SRVSVC_VERSION;
+ c.in.dcerpc_iface = &dcerpc_table_srvsvc;
status = libnet_RpcConnect(ctx, mem_ctx, &c);
if (!NT_STATUS_IS_OK(status)) {
c.level = LIBNET_RPC_CONNECT_SERVER;
c.in.domain_name = r->in.server_name;
- c.in.dcerpc_iface_name = DCERPC_SRVSVC_NAME;
- c.in.dcerpc_iface_uuid = DCERPC_SRVSVC_UUID;
- c.in.dcerpc_iface_version = DCERPC_SRVSVC_VERSION;
+ c.in.dcerpc_iface = &dcerpc_table_srvsvc;
status = libnet_RpcConnect(ctx, mem_ctx, &c);
if (!NT_STATUS_IS_OK(status)) {
/* prepare connect to the SRVSVC pipe of a timeserver */
c.level = LIBNET_RPC_CONNECT_SERVER;
c.in.domain_name = r->srvsvc.in.server_name;
- c.in.dcerpc_iface_name = DCERPC_SRVSVC_NAME;
- c.in.dcerpc_iface_uuid = DCERPC_SRVSVC_UUID;
- c.in.dcerpc_iface_version = DCERPC_SRVSVC_VERSION;
+ c.in.dcerpc_iface = &dcerpc_table_srvsvc;
/* 1. connect to the SRVSVC pipe of a timeserver */
status = libnet_RpcConnect(ctx, mem_ctx, &c);
/* connect rpc service of remote server */
cn.level = LIBNET_RPC_CONNECT_SERVER;
cn.in.domain_name = talloc_strdup(mem_ctx, *fp.out.address);
- cn.in.dcerpc_iface_name = DCERPC_SAMR_NAME;
- cn.in.dcerpc_iface_uuid = DCERPC_SAMR_UUID;
- cn.in.dcerpc_iface_version = DCERPC_SAMR_VERSION;
+ cn.in.dcerpc_iface = &dcerpc_table_samr;
status = libnet_RpcConnect(ctx, mem_ctx, &cn);
if (!NT_STATUS_IS_OK(status)) {
/* Setup schannel */
nt_status = dcerpc_pipe_connect_b(samsync_ctx, &p, b,
- DCERPC_NETLOGON_UUID,
- DCERPC_NETLOGON_VERSION,
+ &dcerpc_table_netlogon,
machine_account, ctx->event_ctx);
if (!NT_STATUS_IS_OK(nt_status)) {
/*
return the rpc syntax and transfer syntax given the pipe uuid and version
*/
-NTSTATUS dcerpc_init_syntaxes(const char *uuid, uint_t version,
+NTSTATUS dcerpc_init_syntaxes(const struct dcerpc_interface_table *table,
struct dcerpc_syntax_id *syntax,
struct dcerpc_syntax_id *transfer_syntax)
{
NTSTATUS status;
- status = GUID_from_string(uuid, &syntax->uuid);
+ status = GUID_from_string(table->uuid, &syntax->uuid);
if (!NT_STATUS_IS_OK(status)) return status;
- syntax->if_version = version;
+ syntax->if_version = table->if_version;
status = GUID_from_string(NDR_GUID, &transfer_syntax->uuid);
if (!NT_STATUS_IS_OK(status)) return status;
/* perform a dcerpc bind, using the uuid as the key */
NTSTATUS dcerpc_bind_byuuid(struct dcerpc_pipe *p,
TALLOC_CTX *mem_ctx,
- const char *uuid, uint_t version)
+ const struct dcerpc_interface_table *table)
{
struct dcerpc_syntax_id syntax;
struct dcerpc_syntax_id transfer_syntax;
NTSTATUS status;
- status = dcerpc_init_syntaxes(uuid, version,
+ status = dcerpc_init_syntaxes(table,
&syntax, &transfer_syntax);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(2,("Invalid uuid string in dcerpc_bind_byuuid\n"));
struct dcerpc_pipe_connect {
struct dcerpc_pipe *pipe;
struct dcerpc_binding *binding;
- const char *pipe_uuid;
const char *pipe_name;
- uint32_t pipe_version;
+ const struct dcerpc_interface_table *interface;
struct cli_credentials *creds;
};
struct composite_context *dcerpc_bind_auth_none_send(TALLOC_CTX *mem_ctx,
struct dcerpc_pipe *p,
- const char *uuid,
- uint_t version)
+ const struct dcerpc_interface_table *table)
{
struct dcerpc_syntax_id syntax;
struct dcerpc_syntax_id transfer_syntax;
c = talloc_zero(mem_ctx, struct composite_context);
if (c == NULL) return NULL;
- c->status = dcerpc_init_syntaxes(uuid, version,
+ c->status = dcerpc_init_syntaxes(table,
&syntax, &transfer_syntax);
if (!NT_STATUS_IS_OK(c->status)) {
DEBUG(2,("Invalid uuid string in "
}
NTSTATUS dcerpc_bind_auth_none(struct dcerpc_pipe *p,
- const char *uuid, uint_t version)
+ const struct dcerpc_interface_table *table)
{
struct composite_context *ctx;
- ctx = dcerpc_bind_auth_none_send(p, p, uuid, version);
+ ctx = dcerpc_bind_auth_none_send(p, p, table);
return dcerpc_bind_auth_none_recv(ctx);
}
struct composite_context *dcerpc_bind_auth_send(TALLOC_CTX *mem_ctx,
struct dcerpc_pipe *p,
- const char *uuid, uint_t version,
+ const struct dcerpc_interface_table *table,
struct cli_credentials *credentials,
uint8_t auth_type,
const char *service)
state->pipe = p;
- c->status = dcerpc_init_syntaxes(uuid, version,
+ c->status = dcerpc_init_syntaxes(table,
&syntax,
&transfer_syntax);
if (!NT_STATUS_IS_OK(c->status)) goto failed;
setup GENSEC on a DCE-RPC pipe
*/
NTSTATUS dcerpc_bind_auth(struct dcerpc_pipe *p,
- const char *uuid, uint_t version,
+ const struct dcerpc_interface_table *table,
struct cli_credentials *credentials,
uint8_t auth_type,
const char *service)
{
struct composite_context *creq;
- creq = dcerpc_bind_auth_send(p, p, uuid, version, credentials,
+ creq = dcerpc_bind_auth_send(p, p, table, credentials,
auth_type, service);
return dcerpc_bind_auth_recv(creq);
}
/* Make binding string for netlogon, not the other pipe */
status = dcerpc_epm_map_binding(tmp_ctx, b,
- DCERPC_NETLOGON_UUID, DCERPC_NETLOGON_VERSION,
+ &dcerpc_table_netlogon,
p->conn->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to map DCERPC/TCP NCACN_NP pipe for '%s' - %s\n",
return status;
}
- status = dcerpc_bind_auth_none(p2, DCERPC_NETLOGON_UUID,
- DCERPC_NETLOGON_VERSION);
+ status = dcerpc_bind_auth_none(p2, &dcerpc_table_netlogon);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(p2);
return status;
NTSTATUS dcerpc_bind_auth_schannel(TALLOC_CTX *tmp_ctx,
struct dcerpc_pipe *p,
- const char *uuid, uint_t version,
+ const struct dcerpc_interface_table *table,
struct cli_credentials *credentials)
{
NTSTATUS status;
return status;
}
- return dcerpc_bind_auth(p, uuid, version,
- credentials, DCERPC_AUTH_TYPE_SCHANNEL,
+ return dcerpc_bind_auth(p, table, credentials, DCERPC_AUTH_TYPE_SCHANNEL,
NULL);
}
}
NTSTATUS dcerpc_epm_map_binding(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding,
- const char *uuid, uint_t version, struct event_context *ev)
+ const struct dcerpc_interface_table *table, struct event_context *ev)
{
struct dcerpc_pipe *p;
NTSTATUS status;
struct GUID guid;
struct epm_twr_t twr, *twr_r;
struct dcerpc_binding *epmapper_binding;
- const struct dcerpc_interface_table *table = idl_iface_by_uuid(uuid);
int i;
struct cli_credentials *anon_creds
status = dcerpc_pipe_connect_b(mem_ctx,
&p,
epmapper_binding,
- DCERPC_EPMAPPER_UUID,
- DCERPC_EPMAPPER_VERSION,
+ &dcerpc_table_epmapper,
anon_creds, ev);
if (!NT_STATUS_IS_OK(status)) {
ZERO_STRUCT(handle);
ZERO_STRUCT(guid);
- status = GUID_from_string(uuid, &binding->object);
+ status = GUID_from_string(table->uuid, &binding->object);
if (NT_STATUS_IS_ERR(status)) {
return status;
}
- binding->object_version = version;
+ binding->object_version = table->if_version;
status = dcerpc_binding_build_tower(p, binding, &twr.tower);
if (NT_STATUS_IS_ERR(status)) {
*/
NTSTATUS dcerpc_pipe_auth(struct dcerpc_pipe *p,
struct dcerpc_binding *binding,
- const char *pipe_uuid,
- uint32_t pipe_version,
+ const struct dcerpc_interface_table *table,
struct cli_credentials *credentials)
{
NTSTATUS status;
/* If we don't already have netlogon credentials for
* the schannel bind, then we have to get these
* first */
- status = dcerpc_bind_auth_schannel(tmp_ctx,
- p, pipe_uuid, pipe_version,
- credentials);
+ status = dcerpc_bind_auth_schannel(tmp_ctx, p, table, credentials);
} else if (!cli_credentials_is_anonymous(credentials) &&
!(binding->transport == NCACN_NP &&
!(binding->flags & DCERPC_SIGN) &&
auth_type = DCERPC_AUTH_TYPE_NTLMSSP;
}
- status = dcerpc_bind_auth(p, pipe_uuid, pipe_version,
+ status = dcerpc_bind_auth(p, table,
credentials, auth_type,
binding->authservice);
} else {
- status = dcerpc_bind_auth_none(p, pipe_uuid, pipe_version);
+ status = dcerpc_bind_auth_none(p, table);
}
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("Failed to bind to uuid %s - %s\n", pipe_uuid, nt_errstr(status)));
+ DEBUG(0,("Failed to bind to uuid %s - %s\n", table->uuid, nt_errstr(status)));
}
talloc_free(tmp_ctx);
return status;
static NTSTATUS dcerpc_pipe_connect_ncalrpc(TALLOC_CTX *tmp_ctx,
struct dcerpc_pipe *p,
struct dcerpc_binding *binding,
- const char *pipe_uuid,
- uint32_t pipe_version)
+ const struct dcerpc_interface_table *table)
{
NTSTATUS status;
static NTSTATUS dcerpc_pipe_connect_ncacn_unix_stream(TALLOC_CTX *tmp_ctx,
struct dcerpc_pipe *p,
struct dcerpc_binding *binding,
- const char *pipe_uuid,
- uint32_t pipe_version)
+ const struct dcerpc_interface_table *table)
{
NTSTATUS status;
DEBUG(0,("Failed to open unix socket %s - %s\n",
binding->endpoint, nt_errstr(status)));
talloc_free(p);
- return status;
+ return status;
}
return status;
static NTSTATUS dcerpc_pipe_connect_ncacn_ip_tcp(TALLOC_CTX *tmp_ctx,
struct dcerpc_pipe *p,
struct dcerpc_binding *binding,
- const char *pipe_uuid,
- uint32_t pipe_version)
+ const struct dcerpc_interface_table *table)
{
NTSTATUS status;
uint32_t port = 0;
NTSTATUS dcerpc_pipe_connect_b(TALLOC_CTX *parent_ctx,
struct dcerpc_pipe **pp,
struct dcerpc_binding *binding,
- const char *pipe_uuid,
- uint32_t pipe_version,
+ const struct dcerpc_interface_table *table,
struct cli_credentials *credentials,
struct event_context *ev)
{
case NCACN_IP_TCP:
case NCALRPC:
if (!binding->endpoint) {
- status = dcerpc_epm_map_binding(tmp_ctx, binding,
- pipe_uuid, pipe_version,
+ status = dcerpc_epm_map_binding(tmp_ctx, binding, table,
p->conn->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to map DCERPC endpoint for '%s' - %s\n",
- pipe_uuid, nt_errstr(status)));
+ table->uuid, nt_errstr(status)));
return status;
}
DEBUG(2,("Mapped to DCERPC endpoint %s\n", binding->endpoint));
pc.pipe = p;
pc.binding = binding;
- pc.pipe_uuid = pipe_uuid;
- pc.pipe_version = pipe_version;
+ pc.interface = table;
pc.creds = credentials;
switch (binding->transport) {
case NCACN_IP_TCP:
status = dcerpc_pipe_connect_ncacn_ip_tcp(tmp_ctx,
- p, binding, pipe_uuid, pipe_version);
+ p, binding, table);
break;
case NCACN_UNIX_STREAM:
status = dcerpc_pipe_connect_ncacn_unix_stream(tmp_ctx,
- p, binding, pipe_uuid, pipe_version);
+ p, binding, table);
break;
case NCALRPC:
status = dcerpc_pipe_connect_ncalrpc(tmp_ctx,
- p, binding, pipe_uuid, pipe_version);
+ p, binding, table);
break;
default:
return NT_STATUS_NOT_SUPPORTED;
return status;
}
- status = dcerpc_pipe_auth(p, binding, pipe_uuid, pipe_version, credentials);
+ status = dcerpc_pipe_auth(p, binding, table, credentials);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(p);
return status;
binding to determine the endpoint and options */
NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx,
struct dcerpc_pipe **pp,
- const char *binding,
- const char *pipe_uuid,
- uint32_t pipe_version,
+ const char *binding,
+ const struct dcerpc_interface_table *table,
struct cli_credentials *credentials,
struct event_context *ev)
{
DEBUG(3,("Using binding %s\n", dcerpc_binding_string(tmp_ctx, b)));
- status = dcerpc_pipe_connect_b(tmp_ctx,
- pp, b, pipe_uuid, pipe_version,
- credentials, ev);
+ status = dcerpc_pipe_connect_b(tmp_ctx, pp, b, table, credentials, ev);
if (NT_STATUS_IS_OK(status)) {
*pp = talloc_steal(parent_ctx, *pp);
*/
NTSTATUS dcerpc_secondary_context(struct dcerpc_pipe *p,
struct dcerpc_pipe **pp2,
- const char *pipe_uuid,
- uint32_t pipe_version)
+ const struct dcerpc_interface_table *table)
{
NTSTATUS status;
struct dcerpc_pipe *p2;
p2->context_id = ++p->conn->next_context_id;
- status = GUID_from_string(pipe_uuid, &p2->syntax.uuid);
+ status = GUID_from_string(table->uuid, &p2->syntax.uuid);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(p2);
return status;
}
- p2->syntax.if_version = pipe_version;
+ p2->syntax.if_version = table->if_version;
status = GUID_from_string(NDR_GUID, &p2->transfer_syntax.uuid);
if (!NT_STATUS_IS_OK(status)) {
static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface)
{
NTSTATUS status;
+ const struct dcerpc_interface_table *table;
struct dcesrv_remote_private *private;
const char *binding = lp_parm_string(-1, "dcerpc_remote", "binding");
const char *user, *pass, *domain;
dce_call->context->private = private;
if (!binding) {
- DEBUG(0,("You must specify a ncacn binding string\n"));
+ DEBUG(0,("You must specify a DCE/RPC binding string\n"));
return NT_STATUS_INVALID_PARAMETER;
}
pass = lp_parm_string(-1, "dcerpc_remote", "password");
domain = lp_parm_string(-1, "dceprc_remote", "domain");
+ table = idl_iface_by_uuid(iface->uuid); /* FIXME: What about if_version ? */
+ if (!table) {
+ dce_call->fault_code = DCERPC_FAULT_UNK_IF;
+ return NT_STATUS_NET_WRITE_FAULT;
+ }
+
if (user && pass) {
DEBUG(5, ("dcerpc_remote: RPC Proxy: Using specified account\n"));
credentials = cli_credentials_init(private);
}
status = dcerpc_pipe_connect(private,
- &(private->c_pipe), binding,
- iface->uuid, iface->if_version,
+ &(private->c_pipe), binding, table,
credentials, dce_call->event_ctx);
talloc_free(credentials);
static BOOL remote_op_interface_by_name(struct dcesrv_interface *iface, const char *name)
{
- const struct dcerpc_interface_list *l;
+ const struct dcerpc_interface_table *tbl = idl_iface_by_name(name);
- for (l=librpc_dcerpc_pipes();l;l=l->next) {
- if (strcmp(l->table->name, name)==0) {
- return remote_fill_interface(iface, l->table);
- }
- }
+ if (tbl)
+ return remote_fill_interface(iface, tbl);
return False;
}
ev = event_context_find(mprMemCtx());
- status = dcerpc_pipe_connect(this, &p, binding,
- iface->uuid, iface->if_version,
- creds, ev);
+ status = dcerpc_pipe_connect(this, &p, binding, iface, creds, ev);
if (!NT_STATUS_IS_OK(status)) goto done;
/* callers don't allocate ref vars in the ejs interface */
#include "includes.h"
#include "asn_1.h"
#include "libcli/ldap/ldap.h"
-#include "auth/gensec/gensec.h"
NTSTATUS torture_ldap_bind(struct ldap_connection *conn, const char *userdn, const char *password)
{
status = torture_rpc_connection(mem_ctx,
&p,
- DCERPC_SAMR_NAME,
- DCERPC_SAMR_UUID,
- DCERPC_SAMR_VERSION);
+ &dcerpc_table_samr);
if (!NT_STATUS_IS_OK(status)) {
return False;
struct libnet_RpcConnect connect;
connect.level = LIBNET_RPC_CONNECT_PDC;
connect.in.domain_name = lp_workgroup();
- connect.in.dcerpc_iface_name = DCERPC_LSARPC_NAME;
- connect.in.dcerpc_iface_uuid = DCERPC_LSARPC_UUID;
- connect.in.dcerpc_iface_version = DCERPC_LSARPC_VERSION;
+ connect.in.dcerpc_iface = &dcerpc_table_lsarpc;
status = libnet_RpcConnect(ctx, ctx, &connect);
if (!NT_STATUS_IS_OK(status)) {
printf("Couldn't connect to rpc service %s on %s: %s\n",
- connect.in.dcerpc_iface_name, connect.in.domain_name,
+ connect.in.dcerpc_iface->name, connect.in.domain_name,
nt_errstr(status));
return False;
struct libnet_RpcConnect connect;
connect.level = LIBNET_RPC_CONNECT_PDC;
connect.in.domain_name = lp_workgroup();
- connect.in.dcerpc_iface_name = DCERPC_SAMR_NAME;
- connect.in.dcerpc_iface_uuid = DCERPC_SAMR_UUID;
- connect.in.dcerpc_iface_version = DCERPC_SAMR_VERSION;
+ connect.in.dcerpc_iface = &dcerpc_table_samr;
status = libnet_RpcConnect(ctx, ctx, &connect);
if (!NT_STATUS_IS_OK(status)) {
printf("Couldn't connect to rpc service %s on %s: %s\n",
- connect.in.dcerpc_iface_name, connect.in.domain_name,
+ connect.in.dcerpc_iface->name, connect.in.domain_name,
nt_errstr(status));
return False;
status = torture_rpc_connection(mem_ctx,
&p,
- DCERPC_SRVSVC_NAME,
- DCERPC_SRVSVC_UUID,
- DCERPC_SRVSVC_VERSION);
+ &dcerpc_table_srvsvc);
if (!test_addshare(p, mem_ctx, host, TEST_SHARENAME)) {
ret = False;
status = torture_rpc_connection(mem_ctx,
&p,
- DCERPC_SAMR_NAME,
- DCERPC_SAMR_UUID,
- DCERPC_SAMR_VERSION);
+ &dcerpc_table_samr);
if (!NT_STATUS_IS_OK(status)) {
return False;
status = torture_rpc_connection(mem_ctx,
&p,
- DCERPC_SAMR_NAME,
- DCERPC_SAMR_UUID,
- DCERPC_SAMR_VERSION);
+ &dcerpc_table_samr);
if (!NT_STATUS_IS_OK(status)) {
return False;
status = torture_rpc_connection(mem_ctx,
&p,
- DCERPC_SAMR_NAME,
- DCERPC_SAMR_UUID,
- DCERPC_SAMR_VERSION);
+ &dcerpc_table_samr);
if (!NT_STATUS_IS_OK(status)) {
return False;
status = torture_rpc_connection(mem_ctx,
&p,
- DCERPC_SAMR_NAME,
- DCERPC_SAMR_UUID,
- DCERPC_SAMR_VERSION);
+ &dcerpc_table_samr);
if (!NT_STATUS_IS_OK(status)) {
return False;
TALLOC_CTX *mem_ctx;
BOOL ret = True;
struct policy_handle *handle;
+ struct dcerpc_interface_table tmptbl;
struct dcerpc_syntax_id syntax;
struct dcerpc_syntax_id transfer_syntax;
mem_ctx = talloc_init("torture_rpc_alter_context");
printf("opening LSA connection\n");
- status = torture_rpc_connection(mem_ctx, &p,
- DCERPC_LSARPC_NAME,
- DCERPC_LSARPC_UUID,
- DCERPC_LSARPC_VERSION);
+ status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
}
printf("Opening secondary DSSETUP context\n");
- status = dcerpc_secondary_context(p, &p2, DCERPC_DSSETUP_UUID, DCERPC_DSSETUP_VERSION);
+ status = dcerpc_secondary_context(p, &p2, &dcerpc_table_dssetup);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
printf("dcerpc_alter_context failed - %s\n", nt_errstr(status));
return False;
}
+ tmptbl = dcerpc_table_dssetup;
+ tmptbl.if_version += 100;
printf("Opening bad secondary connection\n");
- status = dcerpc_secondary_context(p, &p2, DCERPC_DSSETUP_UUID, DCERPC_DSSETUP_VERSION+100);
+ status = dcerpc_secondary_context(p, &p2, &tmptbl);
if (NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
printf("dcerpc_alter_context with wrong version should fail\n");
mem_ctx = talloc_init("torture_rpc_atsvc");
- status = torture_rpc_connection(mem_ctx,
- &p,
- DCERPC_ATSVC_NAME,
- DCERPC_ATSVC_UUID,
- DCERPC_ATSVC_VERSION);
+ status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_atsvc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
talloc_free(*p);
status = torture_rpc_connection(mem_ctx,
- p, iface->endpoints->names[0],
- iface->uuid, iface->if_version);
+ p, iface);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to reopen '%s' - %s\n", iface->name, nt_errstr(status));
exit(1);
status = torture_rpc_connection(mem_ctx,
&p,
- DCERPC_SRVSVC_NAME,
- DCERPC_SRVSVC_UUID,
- DCERPC_SRVSVC_VERSION);
+ &dcerpc_table_srvsvc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
BOOL torture_multi_bind(void)
{
struct dcerpc_pipe *p;
- const char *pipe_uuid = DCERPC_LSARPC_UUID;
- uint32_t pipe_version = DCERPC_LSARPC_VERSION;
struct dcerpc_binding *binding;
const char *binding_string = lp_parm_string(-1, "torture", "binding");
TALLOC_CTX *mem_ctx;
return False;
}
- status = torture_rpc_connection(mem_ctx,
- &p,
- NULL,
- pipe_uuid,
- pipe_version);
+ status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
}
- status = dcerpc_pipe_auth(p, binding, pipe_uuid, pipe_version,
- cmdline_credentials);
+ status = dcerpc_pipe_auth(p, binding, &dcerpc_table_lsarpc, cmdline_credentials);
if (NT_STATUS_IS_OK(status)) {
printf("(incorrectly) allowed re-bind to uuid %s - %s\n",
- pipe_uuid, nt_errstr(status));
+ dcerpc_table_lsarpc.uuid, nt_errstr(status));
ret = False;
} else {
printf("\n");
return False;
}
- status = torture_rpc_connection(NULL, &p, iface->endpoints->names[0],
- iface->uuid, iface->if_version);
+ status = torture_rpc_connection(NULL, &p, iface);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to open '%s' - %s\n", iface->name, nt_errstr(status));
return False;
mem_ctx = talloc_init("torture_rpc_dcom");
- status = torture_rpc_connection(mem_ctx, &p,
- DCERPC_IOXIDRESOLVER_NAME,
- DCERPC_IOXIDRESOLVER_UUID,
- DCERPC_IOXIDRESOLVER_VERSION);
+ status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_IOXIDResolver);
if (!NT_STATUS_IS_OK(status)) {
ret = False;
}
status = torture_rpc_connection(mem_ctx,
&p,
- DCERPC_NETDFS_NAME,
- DCERPC_NETDFS_UUID,
- DCERPC_NETDFS_VERSION);
+ &dcerpc_table_netdfs);
if (!NT_STATUS_IS_OK(status)) {
return False;
}
status = torture_rpc_connection(mem_ctx,
&p,
- DCERPC_DRSUAPI_NAME,
- DCERPC_DRSUAPI_UUID,
- DCERPC_DRSUAPI_VERSION);
+ &dcerpc_table_drsuapi);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
status = torture_rpc_connection(mem_ctx,
&p,
- DCERPC_DRSUAPI_NAME,
- DCERPC_DRSUAPI_UUID,
- DCERPC_DRSUAPI_VERSION);
+ &dcerpc_table_drsuapi);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
}
- printf("Connected to DRAUAPI pipe\n");
+ printf("Connected to DRSUAPI pipe\n");
ZERO_STRUCT(priv);
mem_ctx = talloc_init("torture_rpc_dssetup");
- status = torture_rpc_connection(mem_ctx, &p,
- DCERPC_DSSETUP_NAME,
- DCERPC_DSSETUP_UUID,
- DCERPC_DSSETUP_VERSION);
+ status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_dssetup);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
status = dcerpc_pipe_connect_b(ctx,
&b->pipe, ctx->drsuapi_binding,
- DCERPC_DRSUAPI_UUID,
- DCERPC_DRSUAPI_VERSION,
+ &dcerpc_table_drsuapi,
credentials, event);
if (!NT_STATUS_IS_OK(status)) {
status = torture_rpc_connection(mem_ctx,
&p,
- DCERPC_RPCECHO_NAME,
- DCERPC_RPCECHO_UUID,
- DCERPC_RPCECHO_VERSION);
+ &dcerpc_table_rpcecho);
if (!NT_STATUS_IS_OK(status)) {
return False;
}
mem_ctx = talloc_init("torture_rpc_epmapper");
- status = torture_rpc_connection(mem_ctx,
- &p,
- DCERPC_EPMAPPER_NAME,
- DCERPC_EPMAPPER_UUID,
- DCERPC_EPMAPPER_VERSION);
+ status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_epmapper);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
mem_ctx = talloc_init("torture_rpc_atsvc");
- status = torture_rpc_connection(mem_ctx,
- &p,
- DCERPC_EVENTLOG_NAME,
- DCERPC_EVENTLOG_UUID,
- DCERPC_EVENTLOG_VERSION);
+ status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_eventlog);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
mem_ctx = talloc_init("torture_rpc_initshutdown");
- status = torture_rpc_connection(mem_ctx,
- &p,
- DCERPC_INITSHUTDOWN_NAME,
- DCERPC_INITSHUTDOWN_UUID,
- DCERPC_INITSHUTDOWN_VERSION);
+ status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_initshutdown);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
mem_ctx = talloc_init("torture_rpc_lsa");
- status = torture_rpc_connection(mem_ctx,
- &p,
- DCERPC_LSARPC_NAME,
- DCERPC_LSARPC_UUID,
- DCERPC_LSARPC_VERSION);
+ status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
printf("\nTesting pipe '%s'\n", l->table->name);
if (b->transport == NCACN_IP_TCP) {
- status = dcerpc_epm_map_binding(loop_ctx, b,
- l->table->uuid,
- l->table->if_version, NULL);
+ status = dcerpc_epm_map_binding(loop_ctx, b, l->table, NULL);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(loop_ctx);
printf("Failed to map port for uuid %s\n", l->table->uuid);
lp_set_cmdline("torture:binding", dcerpc_binding_string(loop_ctx, b));
- status = torture_rpc_connection(loop_ctx,
- &p,
- l->table->name,
- DCERPC_MGMT_UUID,
- DCERPC_MGMT_VERSION);
+ status = torture_rpc_connection(loop_ctx, &p, &dcerpc_table_mgmt);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(loop_ctx);
ret = False;
return False;
}
- status = dcerpc_bind_auth_none(p2, DCERPC_LSARPC_UUID,
- DCERPC_LSARPC_VERSION);
+ status = dcerpc_bind_auth_none(p2, &dcerpc_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to create bind on secondary connection\n");
return False;
machine_password = cli_credentials_get_password(machine_credentials);
- status = torture_rpc_connection(mem_ctx, &p,
- DCERPC_NETLOGON_NAME,
- DCERPC_NETLOGON_UUID,
- DCERPC_NETLOGON_VERSION);
+ status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_netlogon);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
status = torture_rpc_connection(mem_ctx,
&premact,
- DCERPC_IREMOTEACTIVATION_NAME,
- DCERPC_IREMOTEACTIVATION_UUID,
- DCERPC_IREMOTEACTIVATION_VERSION);
+ &dcerpc_table_IRemoteActivation);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
status = torture_rpc_connection(mem_ctx,
&p,
- DCERPC_IOXIDRESOLVER_NAME,
- DCERPC_IOXIDRESOLVER_UUID,
- DCERPC_IOXIDRESOLVER_VERSION);
+ &dcerpc_table_IOXIDResolver);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
status = torture_rpc_connection(mem_ctx,
&p,
- DCERPC_IREMOTEACTIVATION_NAME,
- DCERPC_IREMOTEACTIVATION_UUID,
- DCERPC_IREMOTEACTIVATION_VERSION);
+ &dcerpc_table_IRemoteActivation);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
status = torture_rpc_connection(mem_ctx,
&p,
- DCERPC_ROT_NAME,
- DCERPC_ROT_UUID,
- DCERPC_ROT_VERSION);
+ &dcerpc_table_rot);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
b->flags |= DCERPC_SCHANNEL | DCERPC_SIGN | DCERPC_SCHANNEL_128;
status = dcerpc_pipe_connect_b(mem_ctx, &p, b,
- DCERPC_NETLOGON_UUID,
- DCERPC_NETLOGON_VERSION,
+ &dcerpc_table_netlogon,
machine_credentials, NULL);
if (!NT_STATUS_IS_OK(status)) {
mem_ctx = talloc_init("torture_rpc_samr");
- status = torture_rpc_connection(mem_ctx,
- &p,
- DCERPC_SAMR_NAME,
- DCERPC_SAMR_UUID,
- DCERPC_SAMR_VERSION);
+ status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_samr);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
status = torture_rpc_connection(samsync_state,
&samsync_state->p_lsa,
- DCERPC_LSARPC_NAME,
- DCERPC_LSARPC_UUID,
- DCERPC_LSARPC_VERSION);
+ &dcerpc_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
ret = False;
status = dcerpc_pipe_connect_b(samsync_state,
&samsync_state->p, b,
- DCERPC_NETLOGON_UUID,
- DCERPC_NETLOGON_VERSION,
+ &dcerpc_table_netlogon,
credentials, NULL);
if (!NT_STATUS_IS_OK(status)) {
status = dcerpc_pipe_connect_b(samsync_state,
&samsync_state->p_netlogon_wksta,
b_netlogon_wksta,
- DCERPC_NETLOGON_UUID,
- DCERPC_NETLOGON_VERSION,
+ &dcerpc_table_netlogon,
credentials_wksta, NULL);
if (!NT_STATUS_IS_OK(status)) {
int i;
DATA_BLOB stub_in, stub_out;
int idl_calls;
+ struct dcerpc_interface_table tbl;
- uuid = GUID_string(mem_ctx, &id->uuid);
+ /* FIXME: This should be fixed when torture_rpc_connection
+ * takes a dcerpc_syntax_id */
+ tbl.name = iface->name;
+ tbl.uuid = GUID_string(mem_ctx, &id->uuid);
+ tbl.if_version = id->if_version;
status = torture_rpc_connection(mem_ctx,
- &p, iface->name,
- uuid, id->if_version);
+ &p, iface);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to '%s' on '%s' - %s\n",
uuid, iface->name, nt_errstr(status));
printf("\nTesting pipe '%s'\n", l->table->name);
if (b->transport == NCACN_IP_TCP) {
- status = dcerpc_epm_map_binding(mem_ctx, b,
- l->table->uuid,
- l->table->if_version, NULL);
+ status = dcerpc_epm_map_binding(mem_ctx, b, l->table, NULL);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(loop_ctx);
printf("Failed to map port for uuid %s\n", l->table->uuid);
lp_set_cmdline("torture:binding", dcerpc_binding_string(mem_ctx, b));
- status = torture_rpc_connection(loop_ctx,
- &p,
- l->table->name,
- DCERPC_MGMT_UUID,
- DCERPC_MGMT_VERSION);
+ status = torture_rpc_connection(loop_ctx, &p, &dcerpc_table_mgmt);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(loop_ctx);
ret = False;
b->flags &= ~DCERPC_AUTH_OPTIONS;
b->flags |= dcerpc_flags;
- status = dcerpc_pipe_connect_b(test_ctx,
- &p, b,
- DCERPC_SAMR_UUID,
- DCERPC_SAMR_VERSION,
+ status = dcerpc_pipe_connect_b(test_ctx, &p, b, &dcerpc_table_samr,
credentials, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect with schannel: %s\n", nt_errstr(status));
* the second */
/* Swap the binding details from SAMR to NETLOGON */
- status = dcerpc_epm_map_binding(test_ctx, b, DCERPC_NETLOGON_UUID,
- DCERPC_NETLOGON_VERSION, NULL);
+ status = dcerpc_epm_map_binding(test_ctx, b, &dcerpc_table_netlogon, NULL);
if (!NT_STATUS_IS_OK(status)) {
goto failed;
}
goto failed;
}
- status = dcerpc_bind_auth(p_netlogon,
- DCERPC_NETLOGON_UUID,
- DCERPC_NETLOGON_VERSION,
+ status = dcerpc_bind_auth(p_netlogon, &dcerpc_table_netlogon,
credentials, DCERPC_AUTH_TYPE_SCHANNEL,
NULL);
}
/* Swap the binding details from SAMR to LSARPC */
- status = dcerpc_epm_map_binding(test_ctx, b, DCERPC_LSARPC_UUID,
- DCERPC_LSARPC_VERSION, NULL);
+ status = dcerpc_epm_map_binding(test_ctx, b, &dcerpc_table_lsarpc, NULL);
if (!NT_STATUS_IS_OK(status)) {
goto failed;
}
goto failed;
}
- status = dcerpc_bind_auth(p_lsa,
- DCERPC_LSARPC_UUID,
- DCERPC_LSARPC_VERSION,
+ status = dcerpc_bind_auth(p_lsa, &dcerpc_table_lsarpc,
credentials, DCERPC_AUTH_TYPE_SCHANNEL,
NULL);
status = torture_rpc_connection(mem_ctx,
&p,
- DCERPC_LSARPC_NAME,
- DCERPC_LSARPC_UUID,
- DCERPC_LSARPC_VERSION);
+ &dcerpc_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
return False;
}
- status = dcerpc_bind_auth_none(p2, DCERPC_SPOOLSS_UUID,
- DCERPC_SPOOLSS_VERSION);
+ status = dcerpc_bind_auth_none(p2, &dcerpc_table_spoolss);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to create bind on secondary connection\n");
talloc_free(p2);
mem_ctx = talloc_init("torture_rpc_spoolss");
- status = torture_rpc_connection(mem_ctx,
- &p,
- DCERPC_SPOOLSS_NAME,
- DCERPC_SPOOLSS_UUID,
- DCERPC_SPOOLSS_VERSION);
+ status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_spoolss);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
mem_ctx = talloc_init("torture_rpc_srvsvc");
- status = torture_rpc_connection(mem_ctx,
- &p,
- DCERPC_SRVSVC_NAME,
- DCERPC_SRVSVC_UUID,
- DCERPC_SRVSVC_VERSION);
+ status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_srvsvc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
mem_ctx = talloc_init("torture_rpc_svcctl");
- status = torture_rpc_connection(mem_ctx,
- &p,
- DCERPC_SVCCTL_NAME,
- DCERPC_SVCCTL_UUID,
- DCERPC_SVCCTL_VERSION);
+ status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_svcctl);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
status = torture_rpc_connection(join,
&join->p,
- DCERPC_SAMR_NAME,
- DCERPC_SAMR_UUID,
- DCERPC_SAMR_VERSION);
+ &dcerpc_table_samr);
if (!NT_STATUS_IS_OK(status)) {
return NULL;
}
mem_ctx = talloc_init("torture_rpc_unixinfo");
- status = torture_rpc_connection(mem_ctx, &p,
- DCERPC_UNIXINFO_NAME,
- DCERPC_UNIXINFO_UUID,
- DCERPC_UNIXINFO_VERSION);
+ status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_unixinfo);
if (!NT_STATUS_IS_OK(status)) {
return False;
}
int i;
mem_ctx = talloc_init("torture_rpc_winreg");
- status = torture_rpc_connection(mem_ctx,
- &p,
- DCERPC_WINREG_NAME,
- DCERPC_WINREG_UUID,
- DCERPC_WINREG_VERSION);
+ status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_winreg);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
mem_ctx = talloc_init("torture_rpc_wkssvc");
- status = torture_rpc_connection(mem_ctx,
- &p,
- DCERPC_WKSSVC_NAME,
- DCERPC_WKSSVC_UUID,
- DCERPC_WKSSVC_VERSION);
+ status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_wkssvc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
/* open a rpc connection to the chosen binding string */
NTSTATUS torture_rpc_connection(TALLOC_CTX *parent_ctx,
struct dcerpc_pipe **p,
- const char *pipe_name,
- const char *pipe_uuid,
- uint32_t pipe_version)
+ const struct dcerpc_interface_table *table)
{
NTSTATUS status;
const char *binding = lp_parm_string(-1, "torture", "binding");
}
status = dcerpc_pipe_connect(parent_ctx,
- p, binding, pipe_uuid, pipe_version,
+ p, binding, table,
cmdline_credentials, NULL);
return status;
/* open a rpc connection to a specific transport */
NTSTATUS torture_rpc_connection_transport(TALLOC_CTX *parent_ctx,
struct dcerpc_pipe **p,
- const char *pipe_name,
- const char *pipe_uuid,
- uint32_t pipe_version,
+ const struct dcerpc_interface_table *table,
enum dcerpc_transport_t transport)
{
NTSTATUS status;
b->transport = transport;
- status = dcerpc_pipe_connect_b(mem_ctx, p, b, pipe_uuid, pipe_version,
+ status = dcerpc_pipe_connect_b(mem_ctx, p, b, table,
cmdline_credentials, NULL);
if (NT_STATUS_IS_OK(status)) {
OPT_MULTIPLEX,
};
- int main(int argc, const char **argv)
+int main(int argc, const char **argv)
{
static const char *helper_protocol;
int opt;
if (!composite_is_ok(c)) return;
creq = dcerpc_bind_auth_none_send(state, state->p,
- DCERPC_NETLOGON_UUID,
- DCERPC_NETLOGON_VERSION);
+ &dcerpc_table_netlogon);
composite_continue(c, creq, get_schannel_creds_recv_anonbind, c);
}
switch (state->auth_type) {
case DCERPC_AUTH_TYPE_NONE:
ctx = dcerpc_bind_auth_none_send(state, state->lsa_pipe,
- DCERPC_LSARPC_UUID,
- DCERPC_LSARPC_VERSION);
+ &dcerpc_table_lsarpc);
composite_continue(state->ctx, ctx, init_lsa_recv_anon_bind,
state);
break;
}
state->lsa_pipe->conn->flags |= (DCERPC_SIGN | DCERPC_SEAL);
ctx = dcerpc_bind_auth_send(state, state->lsa_pipe,
- DCERPC_LSARPC_UUID,
- DCERPC_LSARPC_VERSION,
+ &dcerpc_table_lsarpc,
state->creds, state->auth_type,
NULL);
composite_continue(state->ctx, ctx, init_lsa_recv_auth_bind,
switch (state->auth_type) {
case DCERPC_AUTH_TYPE_NONE:
ctx = dcerpc_bind_auth_none_send(state, state->samr_pipe,
- DCERPC_SAMR_UUID,
- DCERPC_SAMR_VERSION);
+ &dcerpc_table_samr);
composite_continue(state->ctx, ctx,
connect_samr_recv_anon_bind, state);
break;
}
state->samr_pipe->conn->flags |= (DCERPC_SIGN | DCERPC_SEAL);
ctx = dcerpc_bind_auth_send(state, state->samr_pipe,
- DCERPC_SAMR_UUID,
- DCERPC_SAMR_VERSION,
+ &dcerpc_table_samr,
state->creds, state->auth_type,
NULL);
composite_continue(state->ctx, ctx,
state->domain->netlogon_pipe->conn->flags |=
(DCERPC_SIGN | DCERPC_SEAL);
ctx = dcerpc_bind_auth_send(state, state->domain->netlogon_pipe,
- DCERPC_NETLOGON_UUID,
- DCERPC_NETLOGON_VERSION,
+ &dcerpc_table_netlogon,
state->domain->schannel_creds,
DCERPC_AUTH_TYPE_SCHANNEL,
NULL);