summaryrefslogtreecommitdiff
path: root/source4/wrepl_server/wrepl_in_connection.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-10-14 14:02:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:44:43 -0500
commitcffd522b5c806508dfacfb10234e4c0a115c0a98 (patch)
treeec5271d813d2cb547757732815a434ba27a89582 /source4/wrepl_server/wrepl_in_connection.c
parentd1e6c228692ff8b06d6eecd6be22fe0727e170ac (diff)
downloadsamba-cffd522b5c806508dfacfb10234e4c0a115c0a98.tar.gz
samba-cffd522b5c806508dfacfb10234e4c0a115c0a98.tar.bz2
samba-cffd522b5c806508dfacfb10234e4c0a115c0a98.zip
r11052: bring samba4 uptodate with the samba4-winsrepl branch,
before the bad merge metze (This used to be commit 471c0ca4abb17fb5f73c0efed195c67628c1c06e)
Diffstat (limited to 'source4/wrepl_server/wrepl_in_connection.c')
-rw-r--r--source4/wrepl_server/wrepl_in_connection.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/source4/wrepl_server/wrepl_in_connection.c b/source4/wrepl_server/wrepl_in_connection.c
index ed9c9998d7..5ba36a5051 100644
--- a/source4/wrepl_server/wrepl_in_connection.c
+++ b/source4/wrepl_server/wrepl_in_connection.c
@@ -32,7 +32,7 @@
#include "nbt_server/wins/winsdb.h"
#include "ldb/include/ldb.h"
-static void wreplsrv_terminate_in_connection(struct wreplsrv_in_connection *wreplconn, const char *reason)
+void wreplsrv_terminate_in_connection(struct wreplsrv_in_connection *wreplconn, const char *reason)
{
stream_terminate_connection(wreplconn->conn, reason);
}
@@ -267,6 +267,48 @@ static const struct stream_server_ops wreplsrv_stream_ops = {
};
/*
+ 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)