Commit e2b5b211 authored by Bastiaan Bakker's avatar Bastiaan Bakker
Browse files

Added connection initialisation and destruction notification. Now backends can...

Added connection initialisation and destruction notification. Now backends can register functions in backend_info.bi_connection_init and backend_info.bi_connection_destroy that will be called when a connection is initialized or destroyed.
parent 4dfba748
......@@ -66,6 +66,9 @@ bdb2_back_initialize(
bi->bi_acl_group = bdb2_back_group;
#endif
bi->bi_connection_init = 0;
bi->bi_connection_destroy = 0;
ret = bdb2i_back_init_private( bi );
Debug( LDAP_DEBUG_TRACE, "bdb2_back_initialize: done (%d).\n", ret, 0, 0 );
......
......@@ -60,6 +60,9 @@ ldap_back_initialize(
bi->bi_acl_group = 0;
#endif
bi->bi_connection_init = 0;
bi->bi_connection_destroy = 0;
return 0;
}
......
......@@ -41,6 +41,9 @@ ldbm_back_initialize(
bi->bi_acl_group = ldbm_back_group;
#endif
bi->bi_connection_init = 0;
bi->bi_connection_destroy = 0;
return 0;
}
......
......@@ -39,5 +39,8 @@ passwd_back_initialize(
bi->bi_acl_group = 0;
#endif
bi->bi_connection_init = 0;
bi->bi_connection_destroy = 0;
return 0;
}
......@@ -80,6 +80,9 @@ perl_back_initialize(
bi->bi_acl_group = 0;
#endif
bi->bi_connection_init = 0;
bi->bi_connection_destroy = 0;
return 0;
}
......
......@@ -39,6 +39,9 @@ shell_back_initialize(
bi->bi_acl_group = 0;
#endif
bi->bi_connection_init = 0;
bi->bi_connection_destroy = 0;
return 0;
}
......
/* tcl_init.c - tcl backend initialization
*
* $Id: tcl_init.c,v 1.5 1999/02/20 07:53:48 hallvard Exp $
* $Id: tcl_init.c,v 1.6 1999/03/03 16:02:10 hallvard Exp $
*
* Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
*
......@@ -63,6 +63,9 @@ tcl_back_initialize (
bi->bi_acl_group = 0;
#endif
bi->bi_connection_init = 0;
bi->bi_connection_destroy = 0;
return 0;
}
......
......@@ -518,6 +518,38 @@ backend_unbind(
return 0;
}
int
backend_connection_init(
Connection *conn
)
{
int i;
for ( i = 0; i < nbackends; i++ ) {
if ( backends[i].be_connection_init ) {
(*backends[i].be_connection_init)( &backends[i], conn);
}
}
return 0;
}
int
backend_connection_destroy(
Connection *conn
)
{
int i;
for ( i = 0; i < nbackends; i++ ) {
if ( backends[i].be_connection_destroy ) {
(*backends[i].be_connection_destroy)( &backends[i], conn);
}
}
return 0;
}
#ifdef SLAPD_ACLGROUPS
int
backend_group(
......
......@@ -374,6 +374,8 @@ long connection_init(
ldap_pvt_thread_mutex_unlock( &c->c_mutex );
ldap_pvt_thread_mutex_unlock( &connections_mutex );
backend_connection_init(c);
return id;
}
......@@ -388,6 +390,8 @@ connection_destroy( Connection *c )
assert( c->c_conn_state != SLAP_C_INVALID );
assert( c->c_ops == NULL );
backend_connection_destroy(c);
#ifdef LDAP_COMPAT30
c->c_version = 0;
#endif
......
......@@ -89,6 +89,9 @@ int be_entry_release_rw LDAP_P(( Backend *be, Entry *e, int rw ));
extern int backend_unbind LDAP_P((Connection *conn, Operation *op));
extern int backend_connection_init LDAP_P((Connection *conn));
extern int backend_connection_destroy LDAP_P((Connection *conn));
extern int backend_group LDAP_P((Backend *be,
Entry *target,
char *gr_ndn, char *op_ndn,
......
......@@ -341,6 +341,10 @@ struct backend_db {
#define be_release bd_info->bi_entry_release_rw
#define be_group bd_info->bi_acl_group
#define be_connection_init bd_info->bi_connection_init
#define be_connection_destroy bd_info->bi_connection_destroy
/* these should be renamed from be_ to bd_ */
char **be_suffix; /* the DN suffixes of data in this backend */
char **be_nsuffix; /* the normalized DN suffixes in this backend */
......@@ -461,6 +465,12 @@ struct backend_info {
char *objectclassValue, char *groupattrName ));
#endif
int (*bi_connection_init) LDAP_P((BackendDB *bd,
struct slap_conn *c));
int (*bi_connection_destroy) LDAP_P((BackendDB *bd,
struct slap_conn *c));
unsigned int bi_nDB; /* number of databases of this type */
void *bi_private; /* anything the backend type needs */
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment