1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-09 00:23:50 +03:00

r11889: added support for dcerpc ncacn_np over SMB2. You use it by giving the

flag 'smb2' in the dcerpc binding string. This gives a pretty good
test to the new SMB2 trans call.
This commit is contained in:
Andrew Tridgell
2005-11-25 05:25:37 +00:00
committed by Gerald (Jerry) Carter
parent aef915f312
commit f99bef585d
6 changed files with 564 additions and 22 deletions

View File

@@ -201,7 +201,8 @@ static const struct {
{"validate", DCERPC_DEBUG_VALIDATE_BOTH},
{"print", DCERPC_DEBUG_PRINT_BOTH},
{"padcheck", DCERPC_DEBUG_PAD_CHECK},
{"bigendian", DCERPC_PUSH_BIGENDIAN}
{"bigendian", DCERPC_PUSH_BIGENDIAN},
{"smb2", DCERPC_SMB2}
};
const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
@@ -1014,12 +1015,12 @@ NTSTATUS dcerpc_pipe_auth(struct dcerpc_pipe *p,
/* open a rpc connection to a rpc pipe on SMB using the binding
structure to determine the endpoint and options */
static NTSTATUS dcerpc_pipe_connect_ncacn_np(TALLOC_CTX *tmp_ctx,
struct dcerpc_pipe *p,
struct dcerpc_binding *binding,
const char *pipe_uuid,
uint32_t pipe_version,
struct cli_credentials *credentials)
static NTSTATUS dcerpc_pipe_connect_ncacn_np_smb(TALLOC_CTX *tmp_ctx,
struct dcerpc_pipe *p,
struct dcerpc_binding *binding,
const char *pipe_uuid,
uint32_t pipe_version,
struct cli_credentials *credentials)
{
NTSTATUS status;
struct smbcli_state *cli;
@@ -1056,6 +1057,63 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_np(TALLOC_CTX *tmp_ctx,
return NT_STATUS_OK;
}
/* open a rpc connection to a rpc pipe on SMB2 using the binding
structure to determine the endpoint and options */
static NTSTATUS dcerpc_pipe_connect_ncacn_np_smb2(TALLOC_CTX *tmp_ctx,
struct dcerpc_pipe *p,
struct dcerpc_binding *binding,
const char *pipe_uuid,
uint32_t pipe_version,
struct cli_credentials *credentials)
{
NTSTATUS status;
struct smb2_tree *tree;
const char *pipe_name = NULL;
if (binding->flags & DCERPC_SCHANNEL) {
credentials = cli_credentials_init(tmp_ctx);
cli_credentials_set_anonymous(credentials);
cli_credentials_guess(credentials);
}
status = smb2_connect(tmp_ctx, binding->host, "IPC$", credentials, &tree,
p->conn->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to connect to %s - %s\n",
binding->host, nt_errstr(status)));
return status;
}
pipe_name = binding->endpoint;
status = dcerpc_pipe_open_smb2(p->conn, tree, pipe_name);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to open pipe %s - %s\n", pipe_name, nt_errstr(status)));
return status;
}
talloc_steal(p->conn, tree);
return NT_STATUS_OK;
}
/* open a rpc connection to a rpc pipe on SMB using the binding
structure to determine the endpoint and options */
static NTSTATUS dcerpc_pipe_connect_ncacn_np(TALLOC_CTX *tmp_ctx,
struct dcerpc_pipe *p,
struct dcerpc_binding *binding,
const char *pipe_uuid,
uint32_t pipe_version,
struct cli_credentials *credentials)
{
if (binding->flags & DCERPC_SMB2) {
return dcerpc_pipe_connect_ncacn_np_smb2(tmp_ctx, p, binding, pipe_uuid,
pipe_version, credentials);
}
return dcerpc_pipe_connect_ncacn_np_smb(tmp_ctx, p, binding, pipe_uuid,
pipe_version, credentials);
}
/* open a rpc connection to a rpc pipe on SMP using the binding
structure to determine the endpoint and options */
static NTSTATUS dcerpc_pipe_connect_ncalrpc(TALLOC_CTX *tmp_ctx,