From 8a300c9248cc956d2aaed59e89efc2535a9f60f5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 30 Jun 2005 17:10:03 +0000 Subject: r8021: we only need to return STATUS_BUFFER_OVERFLOW for the ipc_trans replies and not for the ipc_read() replies as here the client explicit says how much data it wants the write_fn() in dcesrv_output() now returns NTSTATUS and the ipc specific implementations are moved to the ntvfs_ipc module metze (This used to be commit fe483dcd874b7243d61e9623840c672b4ea06b2c) --- source4/ntvfs/ipc/vfs_ipc.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/ipc/vfs_ipc.c b/source4/ntvfs/ipc/vfs_ipc.c index 68c59b7502..2c148fbd0c 100644 --- a/source4/ntvfs/ipc/vfs_ipc.c +++ b/source4/ntvfs/ipc/vfs_ipc.c @@ -350,6 +350,18 @@ static NTSTATUS ipc_copy(struct ntvfs_module_context *ntvfs, return NT_STATUS_ACCESS_DENIED; } +static NTSTATUS ipc_readx_dcesrv_output(void *private_data, DATA_BLOB *out, size_t *nwritten) +{ + DATA_BLOB *blob = private_data; + + if (out->length < blob->length) { + blob->length = out->length; + } + memcpy(blob->data, out->data, blob->length); + *nwritten = blob->length; + return NT_STATUS_OK; +} + /* read from a file */ @@ -380,7 +392,7 @@ static NTSTATUS ipc_read(struct ntvfs_module_context *ntvfs, } if (data.length != 0) { - status = dcesrv_output_blob(p->dce_conn, &data); + status = dcesrv_output(p->dce_conn, &data, ipc_readx_dcesrv_output); if (NT_STATUS_IS_ERR(status)) { return status; } @@ -604,6 +616,22 @@ static NTSTATUS ipc_search_close(struct ntvfs_module_context *ntvfs, return NT_STATUS_ACCESS_DENIED; } +static NTSTATUS ipc_trans_dcesrv_output(void *private_data, DATA_BLOB *out, size_t *nwritten) +{ + NTSTATUS status = NT_STATUS_OK; + DATA_BLOB *blob = private_data; + + if (out->length > blob->length) { + status = STATUS_BUFFER_OVERFLOW; + } + + if (out->length < blob->length) { + blob->length = out->length; + } + memcpy(blob->data, out->data, blob->length); + *nwritten = blob->length; + return status; +} /* SMBtrans - handle a DCERPC command */ static NTSTATUS ipc_dcerpc_cmd(struct ntvfs_module_context *ntvfs, @@ -638,7 +666,7 @@ static NTSTATUS ipc_dcerpc_cmd(struct ntvfs_module_context *ntvfs, async calls. Again, we only expect NT_STATUS_OK. If the call fails then the error is encoded at the dcerpc level */ - status = dcesrv_output_blob(p->dce_conn, &trans->out.data); + status = dcesrv_output(p->dce_conn, &trans->out.data, ipc_trans_dcesrv_output); if (NT_STATUS_IS_ERR(status)) { return status; } -- cgit