summaryrefslogtreecommitdiff
path: root/source4/wrepl_server/wrepl_server.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-10-14 12:44:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:41:30 -0500
commitd49e67f06f55054f23dbef609b4debb11c157ffa (patch)
treea52ff716f74cd2c2f3efd73e88f9d6465156e1f7 /source4/wrepl_server/wrepl_server.c
parentee49ed7a204753e0755f79304a2d4ac32f6e8fdf (diff)
downloadsamba-d49e67f06f55054f23dbef609b4debb11c157ffa.tar.gz
samba-d49e67f06f55054f23dbef609b4debb11c157ffa.tar.bz2
samba-d49e67f06f55054f23dbef609b4debb11c157ffa.zip
r11014: r10139@SERNOX: metze | 2005-09-10 10:32:36 +0200
- w2k just ignores invalid packets, so we do now - w2k only checks the assoc_ctx when the opcode has the sepcific obcode bit's set - terminate the connection, when getting a WREPL_STOP_ASSOCIATION packet - some more special error handling proper torture test for all this cases are following later metze (This used to be commit 42b69461aad3942dde361d61b950445dd39882aa)
Diffstat (limited to 'source4/wrepl_server/wrepl_server.c')
-rw-r--r--source4/wrepl_server/wrepl_server.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/source4/wrepl_server/wrepl_server.c b/source4/wrepl_server/wrepl_server.c
index 50be38e8d6..63fb6cd902 100644
--- a/source4/wrepl_server/wrepl_server.c
+++ b/source4/wrepl_server/wrepl_server.c
@@ -57,6 +57,8 @@ static void wreplsrv_accept(struct stream_connection *conn)
return;
}
+ /* TODO: find out if it's a partner */
+
conn->private = wreplconn;
irpc_add_name(conn->msg_ctx, "wreplsrv_connection");
@@ -130,7 +132,7 @@ static void wreplsrv_recv(struct stream_connection *conn, uint16_t flags)
packet_in_blob.data = wreplconn->partial.data + 4;
packet_in_blob.length = wreplconn->partial.length - 4;
- call = talloc(wreplconn, struct wreplsrv_in_call);
+ call = talloc_zero(wreplconn, struct wreplsrv_in_call);
if (!call) {
status = NT_STATUS_NO_MEMORY;
goto failed;
@@ -165,7 +167,13 @@ static void wreplsrv_recv(struct stream_connection *conn, uint16_t flags)
wreplconn->processing = True;
status = wreplsrv_in_call(call);
wreplconn->processing = False;
- if (!NT_STATUS_IS_OK(status)) goto failed;
+ if (NT_STATUS_IS_ERR(status)) goto failed;
+ if (!NT_STATUS_IS_OK(status)) {
+ /* w2k just ignores invalid packets, so we do */
+ DEBUG(10,("Received WINS-Replication packet was invalid, we just ignore it\n"));
+ talloc_free(call);
+ return;
+ }
/* and now encode the reply */
packet_out_wrap.packet = call->rep_packet;
@@ -194,7 +202,11 @@ static void wreplsrv_recv(struct stream_connection *conn, uint16_t flags)
}
DLIST_ADD_END(wreplconn->send_queue, rep, struct data_blob_list_item *);
- EVENT_FD_READABLE(conn->event.fde);
+ if (wreplconn->terminate) {
+ EVENT_FD_NOT_READABLE(conn->event.fde);
+ } else {
+ EVENT_FD_READABLE(conn->event.fde);
+ }
return;
failed:
@@ -226,6 +238,11 @@ static void wreplsrv_send(struct stream_connection *conn, uint16_t flags)
}
}
+ if (wreplconn->terminate) {
+ wreplsrv_terminate_connection(wreplconn, "connection terminated after all pending packets are send");
+ return;
+ }
+
EVENT_FD_NOT_WRITEABLE(conn->event.fde);
return;