summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--librpc/rpc/binding.c3
-rw-r--r--source4/librpc/rpc/dcerpc.c12
-rw-r--r--source4/librpc/rpc/dcerpc.h3
-rw-r--r--source4/librpc/rpc/dcerpc_auth.c15
-rw-r--r--source4/librpc/rpc/dcerpc_smb.c6
-rw-r--r--source4/librpc/rpc/dcerpc_util.c2
6 files changed, 33 insertions, 8 deletions
diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c
index 652927b2c5..d773b8b591 100644
--- a/librpc/rpc/binding.c
+++ b/librpc/rpc/binding.c
@@ -84,7 +84,8 @@ static const struct {
{"padcheck", DCERPC_DEBUG_PAD_CHECK},
{"bigendian", DCERPC_PUSH_BIGENDIAN},
{"smb2", DCERPC_SMB2},
- {"hdrsign", DCERPC_HEADER_SIGNING}
+ {"hdrsign", DCERPC_HEADER_SIGNING},
+ {"ndr64", DCERPC_NDR64}
};
const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
index 819edc8eaa..87d44384ce 100644
--- a/source4/librpc/rpc/dcerpc.c
+++ b/source4/librpc/rpc/dcerpc.c
@@ -182,6 +182,10 @@ static struct ndr_pull *ndr_pull_init_flags(struct dcerpc_connection *c,
ndr->flags |= LIBNDR_FLAG_REF_ALLOC;
}
+ if (c->flags & DCERPC_NDR64) {
+ ndr->flags |= LIBNDR_FLAG_NDR64;
+ }
+
return ndr;
}
@@ -368,6 +372,10 @@ static NTSTATUS ncacn_push_request_sign(struct dcerpc_connection *c,
ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
}
+ if (c->flags & DCERPC_NDR64) {
+ ndr->flags |= LIBNDR_FLAG_NDR64;
+ }
+
if (pkt->pfc_flags & DCERPC_PFC_FLAG_OBJECT_UUID) {
ndr->flags |= LIBNDR_FLAG_OBJECT_PRESENT;
hdr_size += 16;
@@ -1378,6 +1386,10 @@ struct rpc_request *dcerpc_ndr_request_send(struct dcerpc_pipe *p,
push->flags |= LIBNDR_FLAG_BIGENDIAN;
}
+ if (p->conn->flags & DCERPC_NDR64) {
+ push->flags |= LIBNDR_FLAG_NDR64;
+ }
+
/* push the structure into a blob */
ndr_err = call->ndr_push(push, NDR_IN, r);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h
index ea92bcc93a..b539fc2620 100644
--- a/source4/librpc/rpc/dcerpc.h
+++ b/source4/librpc/rpc/dcerpc.h
@@ -172,6 +172,9 @@ struct dcerpc_pipe {
/* this triggers the DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN flag in the bind request */
#define DCERPC_HEADER_SIGNING (1<<20)
+/* use NDR64 transport */
+#define DCERPC_NDR64 (1<<21)
+
/* this describes a binding to a particular transport/pipe */
struct dcerpc_binding {
enum dcerpc_transport_t transport;
diff --git a/source4/librpc/rpc/dcerpc_auth.c b/source4/librpc/rpc/dcerpc_auth.c
index 14f0f9deb4..bca7a8d186 100644
--- a/source4/librpc/rpc/dcerpc_auth.c
+++ b/source4/librpc/rpc/dcerpc_auth.c
@@ -32,13 +32,18 @@
return the rpc syntax and transfer syntax given the pipe uuid and version
*/
static NTSTATUS dcerpc_init_syntaxes(const struct ndr_interface_table *table,
- struct ndr_syntax_id *syntax,
- struct ndr_syntax_id *transfer_syntax)
+ uint32_t pipe_flags,
+ struct ndr_syntax_id *syntax,
+ struct ndr_syntax_id *transfer_syntax)
{
syntax->uuid = table->syntax_id.uuid;
syntax->if_version = table->syntax_id.if_version;
- *transfer_syntax = ndr_transfer_syntax;
+ if (pipe_flags & DCERPC_NDR64) {
+ *transfer_syntax = ndr64_transfer_syntax;
+ } else {
+ *transfer_syntax = ndr_transfer_syntax;
+ }
return NT_STATUS_OK;
}
@@ -59,7 +64,7 @@ struct composite_context *dcerpc_bind_auth_none_send(TALLOC_CTX *mem_ctx,
c = composite_create(mem_ctx, p->conn->event_ctx);
if (c == NULL) return NULL;
- c->status = dcerpc_init_syntaxes(table,
+ c->status = dcerpc_init_syntaxes(table, p->conn->flags,
&syntax, &transfer_syntax);
if (!NT_STATUS_IS_OK(c->status)) {
DEBUG(2,("Invalid uuid string in "
@@ -242,7 +247,7 @@ struct composite_context *dcerpc_bind_auth_send(TALLOC_CTX *mem_ctx,
state->pipe = p;
- c->status = dcerpc_init_syntaxes(table,
+ c->status = dcerpc_init_syntaxes(table, p->conn->flags,
&syntax,
&transfer_syntax);
if (!composite_is_ok(c)) return c;
diff --git a/source4/librpc/rpc/dcerpc_smb.c b/source4/librpc/rpc/dcerpc_smb.c
index 8b221747ac..f4e6b8c3dd 100644
--- a/source4/librpc/rpc/dcerpc_smb.c
+++ b/source4/librpc/rpc/dcerpc_smb.c
@@ -325,7 +325,7 @@ static NTSTATUS smb_send_request(struct dcerpc_connection *c, DATA_BLOB *blob,
union smb_write io;
struct smbcli_request *req;
- if (smb->dead) {
+ if (!smb || smb->dead) {
return NT_STATUS_CONNECTION_DISCONNECTED;
}
@@ -388,6 +388,7 @@ static NTSTATUS smb_shutdown_pipe(struct dcerpc_connection *c, NTSTATUS status)
}
talloc_free(smb);
+ c->transport.private_data = NULL;
return status;
}
@@ -398,6 +399,7 @@ static NTSTATUS smb_shutdown_pipe(struct dcerpc_connection *c, NTSTATUS status)
static const char *smb_peer_name(struct dcerpc_connection *c)
{
struct smb_private *smb = (struct smb_private *)c->transport.private_data;
+ if (smb == NULL) return "";
return smb->server_name;
}
@@ -407,6 +409,7 @@ static const char *smb_peer_name(struct dcerpc_connection *c)
static const char *smb_target_hostname(struct dcerpc_connection *c)
{
struct smb_private *smb = talloc_get_type(c->transport.private_data, struct smb_private);
+ if (smb == NULL) return "";
return smb->tree->session->transport->socket->hostname;
}
@@ -417,6 +420,7 @@ static NTSTATUS smb_session_key(struct dcerpc_connection *c, DATA_BLOB *session_
{
struct smb_private *smb = (struct smb_private *)c->transport.private_data;
+ if (smb == NULL) return NT_STATUS_CONNECTION_DISCONNECTED;
if (smb->tree->session->user_session_key.data) {
*session_key = smb->tree->session->user_session_key;
return NT_STATUS_OK;
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index 4524673449..86c91535e7 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -736,7 +736,7 @@ _PUBLIC_ NTSTATUS dcerpc_secondary_context(struct dcerpc_pipe *p,
p2->syntax = table->syntax_id;
- p2->transfer_syntax = ndr_transfer_syntax;
+ p2->transfer_syntax = p->transfer_syntax;
p2->binding = talloc_reference(p2, p->binding);