summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-11-09 13:49:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:45:58 -0500
commit549b6dfdba2e130ae3be2610b8caddee614af828 (patch)
treeef037af53ea1458cc7a845bc8ef3305a403b462d /source4
parent5c620048e30e1820d688084a83163f2fe6d1a63a (diff)
downloadsamba-549b6dfdba2e130ae3be2610b8caddee614af828.tar.gz
samba-549b6dfdba2e130ae3be2610b8caddee614af828.tar.bz2
samba-549b6dfdba2e130ae3be2610b8caddee614af828.zip
r11608: switched the kdc to use the generic packet send code
(This used to be commit 2cbcc8a919a5164bd57143ffc778f49011b9eee6)
Diffstat (limited to 'source4')
-rw-r--r--source4/kdc/kdc.c50
1 files changed, 10 insertions, 40 deletions
diff --git a/source4/kdc/kdc.c b/source4/kdc/kdc.c
index 8800891421..1139815ff4 100644
--- a/source4/kdc/kdc.c
+++ b/source4/kdc/kdc.c
@@ -69,9 +69,6 @@ struct kdc_tcp_connection {
struct packet_context *packet;
- /* a queue of outgoing replies that have been deferred */
- struct data_blob_list_item *send_queue;
-
BOOL (*process)(struct kdc_server *kdc,
TALLOC_CTX *mem_ctx,
DATA_BLOB *input,
@@ -232,7 +229,6 @@ static NTSTATUS kdc_tcp_recv(void *private, DATA_BLOB blob)
struct kdc_tcp_connection *kdcconn = talloc_get_type(private, struct kdc_tcp_connection);
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
TALLOC_CTX *tmp_ctx = talloc_new(kdcconn);
- struct data_blob_list_item *rep;
const char *src_addr;
int src_port;
int ret;
@@ -261,23 +257,18 @@ static NTSTATUS kdc_tcp_recv(void *private, DATA_BLOB blob)
}
/* and now encode the reply */
- rep = talloc(kdcconn, struct data_blob_list_item);
- if (!rep) {
- goto nomem;
- }
-
- rep->blob = data_blob_talloc(rep, NULL, reply.length + 4);
- if (!rep->blob.data) {
+ blob = data_blob_talloc(kdcconn, NULL, reply.length + 4);
+ if (!blob.data) {
goto nomem;
}
- RSIVAL(rep->blob.data, 0, reply.length);
- memcpy(rep->blob.data + 4, reply.data, reply.length);
+ RSIVAL(blob.data, 0, reply.length);
+ memcpy(blob.data + 4, reply.data, reply.length);
- if (!kdcconn->send_queue) {
- EVENT_FD_WRITEABLE(kdcconn->conn->event.fde);
+ status = packet_send(kdcconn->packet, blob);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto failed;
}
- DLIST_ADD_END(kdcconn->send_queue, rep, struct data_blob_list_item *);
/* the call isn't needed any more */
talloc_free(tmp_ctx);
@@ -314,30 +305,9 @@ static void kdc_tcp_recv_error(void *private, NTSTATUS status)
*/
static void kdc_tcp_send(struct stream_connection *conn, uint16_t flags)
{
- struct kdc_tcp_connection *kdcconn = talloc_get_type(conn->private, struct kdc_tcp_connection);
- NTSTATUS status;
-
- while (kdcconn->send_queue) {
- struct data_blob_list_item *q = kdcconn->send_queue;
- size_t sendlen;
-
- status = socket_send(conn->socket, &q->blob, &sendlen, 0);
- if (NT_STATUS_IS_ERR(status)) goto failed;
- if (!NT_STATUS_IS_OK(status)) return;
-
- q->blob.length -= sendlen;
- q->blob.data += sendlen;
-
- if (q->blob.length == 0) {
- DLIST_REMOVE(kdcconn->send_queue, q);
- talloc_free(q);
- }
- }
-
- EVENT_FD_NOT_WRITEABLE(conn->event.fde);
- return;
-failed:
- kdc_tcp_terminate_connection(kdcconn, nt_errstr(status));
+ struct kdc_tcp_connection *kdcconn = talloc_get_type(conn->private,
+ struct kdc_tcp_connection);
+ packet_queue_run(kdcconn->packet);
}
/**