r3461: another place where "open" was used as a structure element
[samba.git] / source4 / ntvfs / ipc / vfs_ipc.c
index f4eb007235d8ce6dc6ad0b1d6144d3b8ab2fca0c..a0604a9d083872d25f8bce86419b13c79484c320 100644 (file)
 
 
 #include "includes.h"
+#include "system/filesys.h"
 
 /* this is the private structure used to keep the state of an open
    ipc$ connection. It needs to keep information about all open
    pipes */
 struct ipc_private {
-       void *idtree_fnum;
+       struct idr_context *idtree_fnum;
 
        /* a list of open pipes */
        struct pipe_state {
@@ -176,7 +177,7 @@ static NTSTATUS ipc_open_generic(struct ntvfs_module_context *ntvfs,
 {
        struct pipe_state *p;
        NTSTATUS status;
-       struct dcesrv_ep_description ep_description;
+       struct dcerpc_binding ep_description;
        struct auth_session_info *session_info = NULL;
        struct ipc_private *private = ntvfs->private_data;
        int fnum;
@@ -211,8 +212,8 @@ static NTSTATUS ipc_open_generic(struct ntvfs_module_context *ntvfs,
          will need to do that once the credentials infrastructure is
          finalised for Samba4
        */
-       ep_description.type = ENDPOINT_SMB;
-       ep_description.info.smb_pipe = p->pipe_name;
+       ep_description.transport = NCACN_NP;
+       ep_description.endpoint = p->pipe_name;
 
        /* tell the RPC layer the session_info */
        if (req->session) {
@@ -365,17 +366,23 @@ static NTSTATUS ipc_read(struct ntvfs_module_context *ntvfs,
        }
 
        fnum = rd->readx.in.fnum;
-       data.length = rd->readx.in.maxcnt;
-       data.data = rd->readx.out.data;
 
        p = pipe_state_find(private, fnum);
        if (!p) {
                return NT_STATUS_INVALID_HANDLE;
        }
 
-       status = dcesrv_output_blob(p->dce_conn, &data);
-       if (NT_STATUS_IS_ERR(status)) {
-               return status;
+       data.length = rd->readx.in.maxcnt;
+       data.data = rd->readx.out.data;
+       if (data.length > UINT16_MAX) {
+               data.length = 0;
+       }
+
+       if (data.length != 0) {
+               status = dcesrv_output_blob(p->dce_conn, &data);
+               if (NT_STATUS_IS_ERR(status)) {
+                       return status;
+               }
        }
 
        rd->readx.out.remaining = 0;
@@ -712,7 +719,7 @@ NTSTATUS ntvfs_ipc_init(void)
        ops.chkpath = ipc_chkpath;
        ops.qpathinfo = ipc_qpathinfo;
        ops.setpathinfo = ipc_setpathinfo;
-       ops.open = ipc_open;
+       ops.openfile = ipc_open;
        ops.mkdir = ipc_mkdir;
        ops.rmdir = ipc_rmdir;
        ops.rename = ipc_rename;