]> git.sur5r.net Git - openldap/commitdiff
Added connection initialisation and destruction notification. Now backends can regist...
authorBastiaan Bakker <bastiaan@openldap.org>
Wed, 23 Jun 1999 12:31:35 +0000 (12:31 +0000)
committerBastiaan Bakker <bastiaan@openldap.org>
Wed, 23 Jun 1999 12:31:35 +0000 (12:31 +0000)
servers/slapd/back-bdb2/init.c
servers/slapd/back-ldap/init.c
servers/slapd/back-ldbm/init.c
servers/slapd/back-passwd/init.c
servers/slapd/back-perl/init.c
servers/slapd/back-shell/init.c
servers/slapd/back-tcl/tcl_init.c
servers/slapd/backend.c
servers/slapd/connection.c
servers/slapd/proto-slap.h
servers/slapd/slap.h

index 396812ecda07c9a0af95161e60b79ebe21733b76..6fc605014e178a1d1d6d6fc89b3bda66d20a7688 100644 (file)
@@ -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 );
index 0665262b757aab3975851298fc27b9c82f5288f0..e625d50e687420912bf857df0e111231b6b8dd1c 100644 (file)
@@ -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;
 }
 
index 34bceb7967a1dfade18a5ee929b31166a27a464a..67f40f83a581b4cf49d7933cb0d9d15399c68da1 100644 (file)
@@ -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;
 }
 
index ec01e90289743c63d9570835e59ff5417d0cfda9..b0605f5513f355530210bba69b0307b89a22d1b3 100644 (file)
@@ -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;
 }
index 59fecd7d6ded0563f2677186f0153cd076fcf83c..4717b6f199fcabcb80a45b91b185079b6278e9c1 100644 (file)
@@ -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;
 }
                
index 261c79521097d02c90c89e4008d1c77562addf07..b73c96648fff45980dae6e90f5f6742d2906e43d 100644 (file)
@@ -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;
 }
 
index 925ce14f417250001be3fb27a04ac1ec880b935f..4af70c4e28576a75237b97f6e75360559a91549b 100644 (file)
@@ -1,6 +1,6 @@
 /* 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;
 }
 
index 716fac39fcb8e61989e7c0ca2f395e95052e0436..eb0e3a31942b9e06296647f33b20e7f0958c0154 100644 (file)
@@ -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(
index 3cc267347f9295a07c9567bd4cb596555f7016dc..213f3f45d277a583f90880dc9ca4bb7210d52e44 100644 (file)
@@ -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
index 58e92c964ab0db4ba5474c9153fee75a4d8297fc..0d461d63b5df9b9ecb6932dec4ad29b69ac7746f 100644 (file)
@@ -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,
index cd89c3687fa47396ecdd300347ce15b8dac74c80..99e9747df5f2c43bdc2f719d27be4c15cbb33d94 100644 (file)
@@ -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 */
 };