summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-05-18 05:47:33 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:52:36 -0500
commitfe0b8a5df42109dee44743e29c2e6e42565ff5c5 (patch)
treea31ca0593272d069d63ad842580ba5a0a8027df0
parenta777eb0cfa5b135acc0bb5fd6396362b72c2315b (diff)
downloadsamba-fe0b8a5df42109dee44743e29c2e6e42565ff5c5.tar.gz
samba-fe0b8a5df42109dee44743e29c2e6e42565ff5c5.tar.bz2
samba-fe0b8a5df42109dee44743e29c2e6e42565ff5c5.zip
r22987: Clarify how the events are handled in the kerberos code, and
standardise with the rest of the code. Andrew Bartlett (This used to be commit 3aa9d70723d4377d29e33281b640499193b06c69)
-rw-r--r--source4/auth/kerberos/krb5_init_context.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/source4/auth/kerberos/krb5_init_context.c b/source4/auth/kerberos/krb5_init_context.c
index 9eccd459fa..ba1455c227 100644
--- a/source4/auth/kerberos/krb5_init_context.c
+++ b/source4/auth/kerberos/krb5_init_context.c
@@ -176,21 +176,27 @@ static void smb_krb5_socket_handler(struct event_context *ev, struct fd_event *f
struct smb_krb5_socket *smb_krb5 = talloc_get_type(private, struct smb_krb5_socket);
switch (smb_krb5->hi->proto) {
case KRB5_KRBHST_UDP:
- if (flags & EVENT_FD_WRITE) {
- smb_krb5_socket_send(smb_krb5);
- }
if (flags & EVENT_FD_READ) {
smb_krb5_socket_recv(smb_krb5);
+ return;
}
- break;
+ if (flags & EVENT_FD_WRITE) {
+ smb_krb5_socket_send(smb_krb5);
+ return;
+ }
+ /* not reached */
+ return;
case KRB5_KRBHST_TCP:
if (flags & EVENT_FD_READ) {
packet_recv(smb_krb5->packet);
+ return;
}
if (flags & EVENT_FD_WRITE) {
packet_queue_run(smb_krb5->packet);
+ return;
}
- break;
+ /* not reached */
+ return;
case KRB5_KRBHST_HTTP:
/* can't happen */
break;
@@ -277,9 +283,14 @@ krb5_error_code smb_krb5_send_and_recv_func(krb5_context context,
}
talloc_free(remote_addr);
+ /* Setup the FDE, start listening for read events
+ * from the start (otherwise we may miss a socket
+ * drop) and mark as AUTOCLOSE along with the fde */
+
+ /* Ths is equivilant to EVENT_FD_READABLE(smb_krb5->fde) */
smb_krb5->fde = event_add_fd(ev, smb_krb5->sock,
socket_get_fd(smb_krb5->sock),
- EVENT_FD_AUTOCLOSE,
+ EVENT_FD_READ|EVENT_FD_AUTOCLOSE,
smb_krb5_socket_handler, smb_krb5);
/* its now the job of the event layer to close the socket */
socket_set_flags(smb_krb5->sock, SOCKET_FLAG_NOCLOSE);
@@ -316,7 +327,6 @@ krb5_error_code smb_krb5_send_and_recv_func(krb5_context context,
RSIVAL(smb_krb5->request.data, 0, send_blob.length);
memcpy(smb_krb5->request.data+4, send_blob.data, send_blob.length);
packet_send(smb_krb5->packet, smb_krb5->request);
- EVENT_FD_READABLE(smb_krb5->fde);
break;
case KRB5_KRBHST_HTTP:
talloc_free(smb_krb5);