summaryrefslogtreecommitdiff
path: root/source4/librpc/rpc/dcerpc_util.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-12-14 01:09:10 +0000
committerAndrew Tridgell <tridge@samba.org>2003-12-14 01:09:10 +0000
commit8f6b3eb1a9c1e996330b0edfb312b2345e292819 (patch)
tree856a96d82ec0e5d6bb226e36e290f12fc907aa27 /source4/librpc/rpc/dcerpc_util.c
parent346a4af6f09679b92b5cd1b1fb5539e9a902c884 (diff)
downloadsamba-8f6b3eb1a9c1e996330b0edfb312b2345e292819.tar.gz
samba-8f6b3eb1a9c1e996330b0edfb312b2345e292819.tar.bz2
samba-8f6b3eb1a9c1e996330b0edfb312b2345e292819.zip
fixed a bug handling multiple PDUs being read from a socket at one
time in the rpc server. started on the framework for the dcerpc authentication server code (This used to be commit 74041b6a0a60d792e1b220496d66ec27b9ee6c25)
Diffstat (limited to 'source4/librpc/rpc/dcerpc_util.c')
-rw-r--r--source4/librpc/rpc/dcerpc_util.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index de46f532c6..335761e10f 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -201,3 +201,43 @@ const struct dcerpc_interface_table *idl_iface_by_name(const char *name)
}
return NULL;
}
+
+
+
+/*
+ push a dcerpc_packet into a blob, potentially with auth info
+*/
+NTSTATUS dcerpc_push_auth(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
+ struct dcerpc_packet *pkt,
+ struct dcerpc_auth *auth_info)
+{
+ NTSTATUS status;
+ struct ndr_push *ndr;
+
+ ndr = ndr_push_init_ctx(mem_ctx);
+ if (!ndr) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ if (auth_info) {
+ pkt->auth_length = auth_info->credentials.length;
+ } else {
+ pkt->auth_length = 0;
+ }
+
+ status = ndr_push_dcerpc_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ if (auth_info) {
+ status = ndr_push_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, auth_info);
+ }
+
+ *blob = ndr_push_blob(ndr);
+
+ /* fill in the frag length */
+ SSVAL(blob->data, DCERPC_FRAG_LEN_OFFSET, blob->length);
+
+ return NT_STATUS_OK;
+}