diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-12-16 09:02:58 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-12-16 09:02:58 +0000 |
commit | 24c22aef90d8534ee2d016b37b2b302f1367d106 (patch) | |
tree | cecb9192f1a83f7232041cda58e83e1d94ac57b5 /source4/ntvfs/ipc | |
parent | 1413faae582949e7d12174df7102723eea914464 (diff) | |
download | samba-24c22aef90d8534ee2d016b37b2b302f1367d106.tar.gz samba-24c22aef90d8534ee2d016b37b2b302f1367d106.tar.bz2 samba-24c22aef90d8534ee2d016b37b2b302f1367d106.zip |
a fairly large commit!
This adds support for bigendian rpc in the client. I have installed
SUN pcnetlink locally and am using it to test the samba4 rpc
code. This allows us to easily find places where we have stuffed up
the types (such as 2 uint16 versus a uint32), as testing both
big-endian and little-endian easily shows which is correct. I have now
used this to fix several bugs like that in the samba4 IDL.
In order to make this work I also had to redefine a GUID as a true
structure, not a blob. From the pcnetlink wire it is clear that it is
indeed defined as a structure (the byte order changes). This required
changing lots of Samba code to use a GUID as a structure.
I also had to fix the if_version code in dcerpc syntax IDs, as it
turns out they are a single uint32 not two uint16s.
The big-endian support is a bit ugly at the moment, and breaks the
layering in some places. More work is needed, especially on the server
side.
(This used to be commit bb1af644a5a7b188290ce36232f255da0e5d66d2)
Diffstat (limited to 'source4/ntvfs/ipc')
-rw-r--r-- | source4/ntvfs/ipc/vfs_ipc.c | 86 |
1 files changed, 76 insertions, 10 deletions
diff --git a/source4/ntvfs/ipc/vfs_ipc.c b/source4/ntvfs/ipc/vfs_ipc.c index a3b3ab19b7..96f28895c9 100644 --- a/source4/ntvfs/ipc/vfs_ipc.c +++ b/source4/ntvfs/ipc/vfs_ipc.c @@ -181,10 +181,13 @@ static NTSTATUS ipc_setpathinfo(struct request_context *req, union smb_setfilein return NT_STATUS_ACCESS_DENIED; } + + /* - open a file - used for MSRPC pipes + open a file backend - used for MSRPC pipes */ -static NTSTATUS ipc_open(struct request_context *req, union smb_open *oi) +static NTSTATUS ipc_open_generic(struct request_context *req, const char *fname, + struct pipe_state **ps) { struct pipe_state *p; TALLOC_CTX *mem_ctx; @@ -192,12 +195,7 @@ static NTSTATUS ipc_open(struct request_context *req, union smb_open *oi) struct dcesrv_endpoint endpoint; struct ipc_private *private = req->conn->ntvfs_private; - /* for now only handle NTcreateX style opens */ - if (oi->generic.level != RAW_OPEN_NTCREATEX) { - return NT_STATUS_ACCESS_DENIED; - } - - mem_ctx = talloc_init("ipc_open '%s'", oi->ntcreatex.in.fname); + mem_ctx = talloc_init("ipc_open '%s'", fname); if (!mem_ctx) { return NT_STATUS_NO_MEMORY; } @@ -209,7 +207,7 @@ static NTSTATUS ipc_open(struct request_context *req, union smb_open *oi) } p->mem_ctx = mem_ctx; - p->pipe_name = talloc_strdup(mem_ctx, oi->ntcreatex.in.fname); + p->pipe_name = talloc_strdup(mem_ctx, fname); if (!p->pipe_name) { talloc_destroy(mem_ctx); return NT_STATUS_NO_MEMORY; @@ -250,11 +248,79 @@ static NTSTATUS ipc_open(struct request_context *req, union smb_open *oi) DLIST_ADD(private->pipe_list, p); + *ps = p; + + return NT_STATUS_OK; +} + +/* + open a file with ntcreatex - used for MSRPC pipes +*/ +static NTSTATUS ipc_open_ntcreatex(struct request_context *req, union smb_open *oi) +{ + struct pipe_state *p; + NTSTATUS status; + + status = ipc_open_generic(req, oi->ntcreatex.in.fname, &p); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + ZERO_STRUCT(oi->ntcreatex.out); oi->ntcreatex.out.fnum = p->fnum; oi->ntcreatex.out.ipc_state = p->ipc_state; - return NT_STATUS_OK; + return status; +} + +/* + open a file with openx - used for MSRPC pipes +*/ +static NTSTATUS ipc_open_openx(struct request_context *req, union smb_open *oi) +{ + struct pipe_state *p; + NTSTATUS status; + const char *fname = oi->openx.in.fname; + + if (strncasecmp(fname, "PIPE\\", 5) != 0) { + return NT_STATUS_OBJECT_NAME_NOT_FOUND; + } + + fname += 4; + + status = ipc_open_generic(req, fname, &p); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + ZERO_STRUCT(oi->openx.out); + oi->openx.out.fnum = p->fnum; + oi->openx.out.ftype = 2; + oi->openx.out.devstate = p->ipc_state; + + return status; +} + +/* + open a file - used for MSRPC pipes +*/ +static NTSTATUS ipc_open(struct request_context *req, union smb_open *oi) +{ + NTSTATUS status; + + switch (oi->generic.level) { + case RAW_OPEN_NTCREATEX: + status = ipc_open_ntcreatex(req, oi); + break; + case RAW_OPEN_OPENX: + status = ipc_open_openx(req, oi); + break; + default: + status = NT_STATUS_NOT_SUPPORTED; + break; + } + + return status; } /* |