From 0d91334fe799f6b50a8265f9dc097411c3a29e18 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 11 Mar 2007 16:49:16 +0000 Subject: r21784: Replace smb_register_idle_event() with event_add_timed(). This fixes winbind who did not run the idle events to drop ldap connections. Volker (This used to be commit af3308ce5a21220ff4c510de356dbaa6cf9ff997) --- source3/passdb/pdb_interface.c | 22 ++++++++++++++++++++-- source3/passdb/pdb_ldap.c | 3 ++- 2 files changed, 22 insertions(+), 3 deletions(-) (limited to 'source3/passdb') diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index ce8b46eb0f..976dfc1d08 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -94,6 +94,23 @@ struct pdb_init_function_entry *pdb_find_backend_entry(const char *name) return NULL; } +/* + * The event context for the passdb backend. I know this is a bad hack and yet + * another static variable, but our pdb API is a global thing per + * definition. The first use for this is the LDAP idle function, more might be + * added later. + * + * I don't feel too bad about this static variable, it replaces the + * smb_idle_event_list that used to exist in lib/module.c. -- VL + */ + +static struct event_context *pdb_event_ctx; + +struct event_context *pdb_get_event_context(void) +{ + return pdb_event_ctx; +} + /****************************************************************** Make a pdb_methods from scratch *******************************************************************/ @@ -1116,8 +1133,9 @@ BOOL pdb_new_rid(uint32 *rid) If uninitialised, context will auto-init on first use. ***************************************************************/ -BOOL initialize_password_db(BOOL reload) -{ +BOOL initialize_password_db(BOOL reload, struct event_context *event_ctx) +{ + pdb_event_ctx = event_ctx; return (pdb_get_methods_reload(reload) != NULL); } diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index c4c53c3066..7765eb3c20 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -5539,7 +5539,8 @@ static NTSTATUS pdb_init_ldapsam_common(struct pdb_methods **pdb_method, const c return NT_STATUS_NO_MEMORY; } - nt_status = smbldap_init(*pdb_method, location, &ldap_state->smbldap_state); + nt_status = smbldap_init(*pdb_method, pdb_get_event_context(), + location, &ldap_state->smbldap_state); if ( !NT_STATUS_IS_OK(nt_status) ) { return nt_status; -- cgit