From 6b13328dbf1b82b23993c1828c08fbd3757cb39c Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 20 Jul 2009 09:25:51 -0400 Subject: Rework the engine that deals with openldap libraries The way openldap libraries work, require to have a single engine per connection as all replies are read at the same time. So we need to always read anything that comes in from the wire and then loop to dispatch results to the requests that are waiting. --- server/providers/ldap/sdap.h | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'server/providers/ldap/sdap.h') diff --git a/server/providers/ldap/sdap.h b/server/providers/ldap/sdap.h index 85b175155..8466473e3 100644 --- a/server/providers/ldap/sdap.h +++ b/server/providers/ldap/sdap.h @@ -23,10 +23,32 @@ #include "db/sysdb.h" #include +struct sdap_msg { + LDAPMessage *msg; +}; + +typedef void (sdap_op_callback_t)(void *, int, struct sdap_msg *); + +struct sdap_handle; + +struct sdap_op { + struct sdap_op *prev, *next; + struct sdap_handle *sh; + + int msgid; + bool done; + + sdap_op_callback_t *callback; + void *data; +}; + struct sdap_handle { LDAP *ldap; bool connected; - int fd; + + struct tevent_fd *fde; + + struct sdap_op *ops; }; enum sdap_result { @@ -39,10 +61,6 @@ enum sdap_result { SDAP_AUTH_FAILED }; -struct sdap_msg { - LDAPMessage *msg; -}; - #define SDAP_URI 0 #define SDAP_DEFAULT_BIND_DN 1 #define SDAP_DEFAULT_AUTHTOK_TYPE 2 -- cgit