s3-smbldap: use tevent_context in smbldap.
authorGünther Deschner <gd@samba.org>
Thu, 27 Oct 2011 14:19:07 +0000 (16:19 +0200)
committerGünther Deschner <gd@samba.org>
Fri, 28 Oct 2011 09:35:28 +0000 (11:35 +0200)
Guenther

source3/include/smbldap.h
source3/lib/smbldap.c

index cce3e1eae9ef98ac27c94882158cdab42b203b06..9a81c30cb1b2c200009e9b9be5c58f654f5d4a07 100644 (file)
@@ -131,7 +131,7 @@ extern ATTRIB_MAP_ENTRY trustpw_attr_list[];
    have to worry about LDAP structure types */
 
 NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx,
-                     struct event_context *event_ctx,
+                     struct tevent_context *tevent_ctx,
                       const char *location,
                       struct smbldap_state **smbldap_state);
 
@@ -174,7 +174,7 @@ struct smbldap_state {
        unsigned int num_failures;
 
        time_t last_use; /* monotonic */
-       struct event_context *event_context;
+       struct tevent_context *tevent_context;
        struct timed_event *idle_event;
 
        struct timeval last_rebind; /* monotonic */
@@ -239,7 +239,7 @@ int smbldap_search_suffix (struct smbldap_state *ldap_state,
                           const char *filter, const char **search_attr,
                           LDAPMessage ** result);
 void smbldap_free_struct(struct smbldap_state **ldap_state) ;
-NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct event_context *event_ctx,
+NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct tevent_context *tevent_ctx,
                      const char *location,
                      struct smbldap_state **smbldap_state);
 bool smbldap_has_control(LDAP *ld, const char *control);
index b333f3063d0a73c8c86afeb7cc862c56fecdaf11..bb98d44419f20efbdf5e3e7b1e8501d0d2f5a0c3 100644 (file)
@@ -26,6 +26,7 @@
 #include "smbldap.h"
 #include "secrets.h"
 #include "../libcli/security/security.h"
+#include <tevent.h>
 
 /* Try not to hit the up or down server forever */
 
@@ -1249,7 +1250,7 @@ done:
        return rc;
 }
 
-static void smbldap_idle_fn(struct event_context *event_ctx,
+static void smbldap_idle_fn(struct tevent_context *tevent_ctx,
                            struct timed_event *te,
                            struct timeval now_abs,
                            void *private_data);
@@ -1310,9 +1311,9 @@ static int smbldap_open(struct smbldap_state *ldap_state)
 
        TALLOC_FREE(ldap_state->idle_event);
 
-       if (ldap_state->event_context != NULL) {
-               ldap_state->idle_event = event_add_timed(
-                       ldap_state->event_context, ldap_state,
+       if (ldap_state->tevent_context != NULL) {
+               ldap_state->idle_event = tevent_add_timer(
+                       ldap_state->tevent_context, ldap_state,
                        timeval_current_ofs(SMBLDAP_IDLE_TIME, 0),
                        smbldap_idle_fn, ldap_state);
        }
@@ -1859,7 +1860,7 @@ int smbldap_search_suffix (struct smbldap_state *ldap_state,
                              filter, search_attr, 0, result);
 }
 
-static void smbldap_idle_fn(struct event_context *event_ctx,
+static void smbldap_idle_fn(struct tevent_context *tevent_ctx,
                            struct timed_event *te,
                            struct timeval now_abs,
                            void *private_data)
@@ -1877,8 +1878,8 @@ static void smbldap_idle_fn(struct event_context *event_ctx,
                DEBUG(10,("ldap connection not idle...\n"));
 
                /* this needs to be made monotonic clock aware inside tevent: */
-               state->idle_event = event_add_timed(
-                       event_ctx, state,
+               state->idle_event = tevent_add_timer(
+                       tevent_ctx, state,
                        timeval_add(&now_abs, SMBLDAP_IDLE_TIME, 0),
                        smbldap_idle_fn,
                        private_data);
@@ -1920,7 +1921,7 @@ static int smbldap_state_destructor(struct smbldap_state *state)
  Intitalise the 'general' ldap structures, on which ldap operations may be conducted
  *********************************************************************/
 
-NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct event_context *event_ctx,
+NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct tevent_context *tevent_ctx,
                      const char *location,
                      struct smbldap_state **smbldap_state)
 {
@@ -1936,7 +1937,7 @@ NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct event_context *event_ctx,
                (*smbldap_state)->uri = "ldap://localhost";
        }
 
-       (*smbldap_state)->event_context = event_ctx;
+       (*smbldap_state)->tevent_context = tevent_ctx;
 
        talloc_set_destructor(*smbldap_state, smbldap_state_destructor);
        return NT_STATUS_OK;