svn commit: samba r10771 - in branches/tmp/samba4-winsrepl/source/wrepl_server: .

metze at samba.org metze at samba.org
Thu Oct 6 15:04:48 GMT 2005


Author: metze
Date: 2005-10-06 15:04:48 +0000 (Thu, 06 Oct 2005)
New Revision: 10771

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

Log:
add a function to create a wreplsrv_in_connection from a client connection

metze
Modified:
   branches/tmp/samba4-winsrepl/source/wrepl_server/wrepl_in_connection.c


Changeset:
Modified: branches/tmp/samba4-winsrepl/source/wrepl_server/wrepl_in_connection.c
===================================================================
--- branches/tmp/samba4-winsrepl/source/wrepl_server/wrepl_in_connection.c	2005-10-06 14:56:01 UTC (rev 10770)
+++ branches/tmp/samba4-winsrepl/source/wrepl_server/wrepl_in_connection.c	2005-10-06 15:04:48 UTC (rev 10771)
@@ -267,6 +267,48 @@
 };
 
 /*
+  called when we get a new connection
+*/
+NTSTATUS wreplsrv_in_connection_merge(struct wreplsrv_partner *partner,
+				      struct socket_context *sock,
+				      struct wreplsrv_in_connection **_wrepl_in)
+{
+	struct wreplsrv_service *service = partner->service;
+	struct wreplsrv_in_connection *wrepl_in;
+	const struct model_ops *model_ops;
+	struct stream_connection *conn;
+	NTSTATUS status;
+
+	/* within the wrepl task we want to be a single process, so
+	   ask for the single process model ops and pass these to the
+	   stream_setup_socket() call. */
+	model_ops = process_model_byname("single");
+	if (!model_ops) {
+		DEBUG(0,("Can't find 'single' process model_ops"));
+		return NT_STATUS_INTERNAL_ERROR;
+	}
+
+	wrepl_in = talloc_zero(partner, struct wreplsrv_in_connection);
+	NT_STATUS_HAVE_NO_MEMORY(wrepl_in);
+
+	wrepl_in->service	= service;
+	wrepl_in->partner	= partner;
+	wrepl_in->our_ip	= socket_get_my_addr(sock, wrepl_in);
+	NT_STATUS_HAVE_NO_MEMORY(wrepl_in->our_ip);
+
+	status = stream_new_connection_merge(service->task->event_ctx, model_ops,
+					     sock, &wreplsrv_stream_ops, service->task->msg_ctx,
+					     wrepl_in, &conn);
+	NT_STATUS_NOT_OK_RETURN(status);
+
+	wrepl_in->conn		= conn;
+	talloc_steal(conn, wrepl_in);
+
+	*_wrepl_in = wrepl_in;
+	return NT_STATUS_OK;
+}
+
+/*
   startup the wrepl port 42 server sockets
 */
 NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service)



More information about the samba-cvs mailing list