summaryrefslogtreecommitdiff
path: root/source4/kdc
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-10-17 01:01:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:44:50 -0500
commita8e69328bf90eabca3808a3fe48ffe9245b0eb80 (patch)
tree6f7d67bc676b02058ba3def30e57ffc55043284b /source4/kdc
parentf598135c6b3dabd1435ea7eed5d8ab69dac97407 (diff)
downloadsamba-a8e69328bf90eabca3808a3fe48ffe9245b0eb80.tar.gz
samba-a8e69328bf90eabca3808a3fe48ffe9245b0eb80.tar.bz2
samba-a8e69328bf90eabca3808a3fe48ffe9245b0eb80.zip
r11106: Make the KDC handler plugable, as I want to drop kpasswdd into exactly
the same spot (it has identical TCP sementics). Andrew Bartlett (This used to be commit 84d6118e8762608af0945279d80ad0f898e693d9)
Diffstat (limited to 'source4/kdc')
-rw-r--r--source4/kdc/kdc.c50
1 files changed, 34 insertions, 16 deletions
diff --git a/source4/kdc/kdc.c b/source4/kdc/kdc.c
index 9c27db6dc1..158aa85f49 100644
--- a/source4/kdc/kdc.c
+++ b/source4/kdc/kdc.c
@@ -57,6 +57,14 @@ struct kdc_socket {
/* a queue of outgoing replies that have been deferred */
struct kdc_reply *send_queue;
+
+ int (*process)(krb5_context context,
+ krb5_kdc_configuration *config,
+ unsigned char *buf,
+ size_t len,
+ krb5_data *reply,
+ const char *from,
+ struct sockaddr *addr);
};
/*
state of an open tcp connection
@@ -79,6 +87,14 @@ struct kdc_tcp_connection {
/* a queue of outgoing replies that have been deferred */
struct data_blob_list_item *send_queue;
+
+ int (*process)(krb5_context context,
+ krb5_kdc_configuration *config,
+ unsigned char *buf,
+ size_t len,
+ krb5_data *reply,
+ const char *from,
+ struct sockaddr *addr);
};
/*
@@ -160,12 +176,12 @@ static void kdc_recv_handler(struct kdc_socket *kdc_socket)
src_sock_addr.sin_family = PF_INET;
/* Call krb5 */
- ret = krb5_kdc_process_krb5_request(kdc_socket->kdc->smb_krb5_context->krb5_context,
- kdc_socket->kdc->config,
- blob.data, blob.length,
- &reply,
- src_addr,
- (struct sockaddr *)&src_sock_addr);
+ ret = kdc_socket->process(kdc_socket->kdc->smb_krb5_context->krb5_context,
+ kdc_socket->kdc->config,
+ blob.data, blob.length,
+ &reply,
+ src_addr,
+ (struct sockaddr *)&src_sock_addr);
if (ret == -1) {
talloc_free(tmp_ctx);
return;
@@ -227,13 +243,14 @@ static void kdc_tcp_accept(struct stream_connection *conn)
stream_terminate_connection(conn, "kdc_tcp_accept: out of memory");
return;
}
- kdcconn->conn = conn;
- kdcconn->kdc = kdc;
- conn->private = kdcconn;
+ kdcconn->conn = conn;
+ kdcconn->kdc = kdc;
+ kdcconn->process = krb5_kdc_process_krb5_request;
+ conn->private = kdcconn;
}
/*
- receive some data on a winbind connection
+ receive some data on a KDC connection
*/
static void kdc_tcp_recv(struct stream_connection *conn, uint16_t flags)
{
@@ -322,12 +339,12 @@ static void kdc_tcp_recv(struct stream_connection *conn, uint16_t flags)
/* Call krb5 */
kdcconn->processing = True;
- ret = krb5_kdc_process_krb5_request(kdcconn->kdc->smb_krb5_context->krb5_context,
- kdcconn->kdc->config,
- kdcconn->partial.data + 4, kdcconn->partial.length - 4,
- &reply,
- src_addr,
- (struct sockaddr *)&src_sock_addr);
+ ret = kdcconn->process(kdcconn->kdc->smb_krb5_context->krb5_context,
+ kdcconn->kdc->config,
+ kdcconn->partial.data + 4, kdcconn->partial.length - 4,
+ &reply,
+ src_addr,
+ (struct sockaddr *)&src_sock_addr);
kdcconn->processing = False;
if (ret == -1) {
status = NT_STATUS_INTERNAL_ERROR;
@@ -426,6 +443,7 @@ static NTSTATUS kdc_add_socket(struct kdc_server *kdc, const char *address)
kdc_socket->kdc = kdc;
kdc_socket->send_queue = NULL;
+ kdc_socket->process = krb5_kdc_process_krb5_request;
talloc_steal(kdc_socket, kdc_socket->sock);