svn commit: samba r13832 - in branches/tmp/samba4-named-pipes: build/smb_build ntvfs/ipc rpc_server torture torture/ipc

jelmer at samba.org jelmer at samba.org
Sat Mar 4 12:32:40 GMT 2006


Author: jelmer
Date: 2006-03-04 12:32:39 +0000 (Sat, 04 Mar 2006)
New Revision: 13832

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=13832

Log:
Fix the build

Added:
   branches/tmp/samba4-named-pipes/rpc_server/dcerpc_np.c
Modified:
   branches/tmp/samba4-named-pipes/build/smb_build/header.pm
   branches/tmp/samba4-named-pipes/ntvfs/ipc/vfs_ipc.c
   branches/tmp/samba4-named-pipes/torture/config.mk
   branches/tmp/samba4-named-pipes/torture/ipc/
   branches/tmp/samba4-named-pipes/torture/torture.c


Changeset:
Modified: branches/tmp/samba4-named-pipes/build/smb_build/header.pm
===================================================================
--- branches/tmp/samba4-named-pipes/build/smb_build/header.pm	2006-03-04 06:56:45 UTC (rev 13831)
+++ branches/tmp/samba4-named-pipes/build/smb_build/header.pm	2006-03-04 12:32:39 UTC (rev 13832)
@@ -28,7 +28,6 @@
 
 	foreach my $key (values %{$depend}) {
 		my $DEFINE = ();
-		next if ($key->{TYPE} ne "LIBRARY" and $key->{TYPE} ne "SUBSYSTEM");
 		next unless defined($key->{INIT_FUNCTIONS});
 
 		$DEFINE->{COMMENT} = "$key->{TYPE} $key->{NAME} INIT";

Modified: branches/tmp/samba4-named-pipes/ntvfs/ipc/vfs_ipc.c
===================================================================
--- branches/tmp/samba4-named-pipes/ntvfs/ipc/vfs_ipc.c	2006-03-04 06:56:45 UTC (rev 13831)
+++ branches/tmp/samba4-named-pipes/ntvfs/ipc/vfs_ipc.c	2006-03-04 12:32:39 UTC (rev 13832)
@@ -32,7 +32,7 @@
 #include "ntvfs/ipc/ipc.h"
 #include "ntvfs/ntvfs.h"
 #include "rpc_server/dcerpc_server.h"
-#include "smb_build.h"
+#include "build.h"
 
 #define IPC_BASE_FNUM 0x400
 

Added: branches/tmp/samba4-named-pipes/rpc_server/dcerpc_np.c
===================================================================
--- branches/tmp/samba4-named-pipes/rpc_server/dcerpc_np.c	2006-03-04 06:56:45 UTC (rev 13831)
+++ branches/tmp/samba4-named-pipes/rpc_server/dcerpc_np.c	2006-03-04 12:32:39 UTC (rev 13832)
@@ -0,0 +1,167 @@
+/* 
+   Unix SMB/CIFS implementation.
+   DCE/RPC over named pipes support (glue between dcerpc and smb servers)
+
+   Copyright (C) Jelmer Vernooij 2005
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+#include "lib/socket/socket.h"
+#include "lib/events/events.h"
+#include "rpc_server/dcerpc_server.h"
+#include "ntvfs/ipc/ipc.h"
+
+static NTSTATUS dcesrv_pipe_open (void *context_data, const char *path, struct auth_session_info *session_info, struct stream_connection *srv_conn, TALLOC_CTX *mem_ctx, void **private_data)
+{
+	NTSTATUS status;
+	struct dcerpc_binding *ep_description;
+	struct dcesrv_connection *dce_conn;
+
+	ep_description = talloc(mem_ctx, struct dcerpc_binding);
+	NT_STATUS_HAVE_NO_MEMORY(ep_description);
+
+	/*
+	  we're all set, now ask the dcerpc server subsystem to open the 
+	  endpoint. At this stage the pipe isn't bound, so we don't
+	  know what interface the user actually wants, just that they want
+	  one of the interfaces attached to this pipe endpoint.
+	*/
+	ep_description->transport = NCACN_NP;
+	ep_description->endpoint = talloc_reference(ep_description, path);
+
+	/* The session info is refcount-increased in the 
+	 * dcesrv_endpoint_search_connect() function
+	 */
+	status = dcesrv_endpoint_search_connect(context_data,
+						mem_ctx,
+						ep_description, 
+						session_info,
+						srv_conn,
+						&dce_conn);
+	talloc_free(ep_description);
+
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
+
+	*private_data = dce_conn;
+
+	return NT_STATUS_OK;
+}
+
+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;
+}
+
+
+static NTSTATUS dcesrv_pipe_trans(void *private_data, DATA_BLOB *in, DATA_BLOB *out)
+{
+	struct dcesrv_connection *dce_conn = private_data;
+	NTSTATUS status;
+
+	/* pass the data to the dcerpc server. Note that we don't
+	   expect this to fail, and things like NDR faults are not
+	   reported at this stage. Those sorts of errors happen in the
+	   dcesrv_output stage */
+	status = dcesrv_input(dce_conn, in);
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
+
+	/*
+	  now ask the dcerpc system for some output. This doesn't yet handle
+	  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(dce_conn, out, ipc_trans_dcesrv_output);
+	if (NT_STATUS_IS_ERR(status)) {
+		return status;
+	}
+
+	return status;
+}
+
+static NTSTATUS dcesrv_pipe_write(void *private_data, DATA_BLOB *out)
+{
+	struct dcesrv_connection *dce_conn = private_data;
+	NTSTATUS status;
+	
+	status = dcesrv_input(dce_conn, out);
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
+	return status;
+}
+
+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;
+}
+
+		
+static NTSTATUS dcesrv_pipe_read(void *private_data, DATA_BLOB *in)
+{
+	struct dcesrv_connection *dce_conn = private_data;
+	NTSTATUS status;
+	
+	status = dcesrv_output(dce_conn, in, ipc_readx_dcesrv_output);
+	if (NT_STATUS_IS_ERR(status)) {
+		return status;
+	}
+
+	return status;
+}
+
+const struct named_pipe_ops dce_pipe_ops = {
+	.open = dcesrv_pipe_open,
+	.write = dcesrv_pipe_write,
+	.read = dcesrv_pipe_read,
+	.trans = dcesrv_pipe_trans
+};
+
+/* Add named pipe endpoint */
+NTSTATUS dcesrv_add_ep_np(struct dcesrv_context *dce_ctx, struct dcesrv_endpoint *e, struct event_context *event_ctx, const struct model_ops *model_ops)
+{
+	NTSTATUS status;
+
+	status = named_pipe_listen(e->ep_description->endpoint, &dce_pipe_ops, dce_ctx);
+	if (NT_STATUS_IS_ERR(status)) {
+		return status;
+	}
+
+	return NT_STATUS_OK;
+}


Property changes on: branches/tmp/samba4-named-pipes/rpc_server/dcerpc_np.c
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: branches/tmp/samba4-named-pipes/torture/config.mk
===================================================================
--- branches/tmp/samba4-named-pipes/torture/config.mk	2006-03-04 06:56:45 UTC (rev 13831)
+++ branches/tmp/samba4-named-pipes/torture/config.mk	2006-03-04 12:32:39 UTC (rev 13832)
@@ -131,6 +131,7 @@
 #################################
 # Start SUBSYSTEM TORTURE_IPC
 [SUBSYSTEM::TORTURE_IPC]
+PRIVATE_PROTO_HEADER = ipc/proto.h
 OBJ_FILES = \
 		ipc/rap.o \
 		ipc/np_echo.o 


Property changes on: branches/tmp/samba4-named-pipes/torture/ipc
___________________________________________________________________
Name: svn:ignore
   + proto.h


Modified: branches/tmp/samba4-named-pipes/torture/torture.c
===================================================================
--- branches/tmp/samba4-named-pipes/torture/torture.c	2006-03-04 06:56:45 UTC (rev 13831)
+++ branches/tmp/samba4-named-pipes/torture/torture.c	2006-03-04 12:32:39 UTC (rev 13832)
@@ -32,7 +32,7 @@
 #include "torture/raw/proto.h"
 #include "torture/smb2/proto.h"
 #include "torture/rpc/proto.h"
-#include "torture/rap/proto.h"
+#include "torture/ipc/proto.h"
 #include "torture/auth/proto.h"
 #include "torture/local/proto.h"
 #include "torture/nbench/proto.h"



More information about the samba-cvs mailing list