]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/frontend.c
ITS#4613 fix
[openldap] / servers / slapd / frontend.c
index 8999baa6895f9fc566af949ae720a3faa389a6ff..a7796565bfd3ae623ff290215508c7c13eaa8d06 100644 (file)
@@ -1,7 +1,7 @@
 /* frontend.c - routines for dealing with frontend */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2004 The OpenLDAP Foundation.
+ * Copyright 1998-2006 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 
 #include "ldap_rq.h"
 
-#ifdef LDAP_SLAPI
-#include "slapi/slapi.h"
-#endif
-
-BackendInfo    slap_frontendInfo;
-BackendDB      slap_frontendDB;
+static BackendInfo     slap_frontendInfo;
+static BackendDB       slap_frontendDB;
 BackendDB      *frontendDB;
 
 int
@@ -65,6 +61,12 @@ frontend_init( void )
        frontendDB->be_def_limit.lms_s_pr_hide = 0;                     /* don't hide number of entries left */
        frontendDB->be_def_limit.lms_s_pr_total = 0;                    /* number of total entries returned by pagedResults equal to hard limit */
 
+#if 0
+       /* FIXME: do we need this? */
+       frontendDB->be_pcl_mutexp = &frontendDB->be_pcl_mutex;
+       ldap_pvt_thread_mutex_init( frontendDB->be_pcl_mutexp );
+#endif
+
        /* suffix */
        frontendDB->be_suffix = ch_calloc( 2, sizeof( struct berval ) );
        ber_str2bv( "", 0, 1, &frontendDB->be_suffix[0] );
@@ -76,13 +78,34 @@ frontend_init( void )
        /* info */
        frontendDB->bd_info = &slap_frontendInfo;
 
+       SLAP_BFLAGS(frontendDB) |= SLAP_BFLAG_FRONTEND;
+
        /* name */
        frontendDB->bd_info->bi_type = "frontend";
 
        /* known controls */
-       frontendDB->bd_info->bi_controls = SLAPD_GLOBAL(known_controls);
+       if ( slap_known_controls ) {
+               int     i;
+
+               frontendDB->bd_info->bi_controls = slap_known_controls;
+
+               for ( i = 0; slap_known_controls[ i ]; i++ ) {
+                       int     cid;
+
+                       if ( slap_find_control_id( slap_known_controls[ i ], &cid )
+                                       == LDAP_CONTROL_NOT_FOUND )
+                       {
+                               assert( 0 );
+                               return -1;
+                       }
+
+                       frontendDB->bd_info->bi_ctrls[ cid ] = 1;
+                       frontendDB->be_ctrls[ cid ] = 1;
+               }
+       }
 
        /* calls */
+       frontendDB->bd_info->bi_op_abandon = fe_op_abandon;
        frontendDB->bd_info->bi_op_add = fe_op_add;
        frontendDB->bd_info->bi_op_bind = fe_op_bind;
        frontendDB->bd_info->bi_op_compare = fe_op_compare;
@@ -91,6 +114,21 @@ frontend_init( void )
        frontendDB->bd_info->bi_op_modrdn = fe_op_modrdn;
        frontendDB->bd_info->bi_op_search = fe_op_search;
        frontendDB->bd_info->bi_extended = fe_extended;
+       frontendDB->bd_info->bi_operational = fe_aux_operational;
+#if 0
+       frontendDB->bd_info->bi_entry_get_rw = fe_entry_get_rw;
+       frontendDB->bd_info->bi_entry_release_rw = fe_entry_release_rw;
+#endif
+#ifdef SLAP_OVERLAY_ACCESS
+       frontendDB->bd_info->bi_access_allowed = fe_access_allowed;
+       frontendDB->bd_info->bi_acl_group = fe_acl_group;
+       frontendDB->bd_info->bi_acl_attribute = fe_acl_attribute;
+#endif /* SLAP_OVERLAY_ACCESS */
+
+#if 0
+       /* FIXME: is this too early? */
+       return backend_startup_one( frontendDB );
+#endif
 
        return 0;
 }