]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/frontend.c
Merge remote branch 'origin/mdb.master'
[openldap] / servers / slapd / frontend.c
index 1ae0233f2d732ed5c107a5d93b08d65a020c643b..964df2e599be56f9eb8a45d1914ee43d1ab82e4b 100644 (file)
@@ -1,7 +1,8 @@
 /* frontend.c - routines for dealing with frontend */
+/* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2012 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -43,50 +44,46 @@ static BackendDB    slap_frontendDB;
 BackendDB      *frontendDB;
 
 static int
-fe_aux_operational(
+fe_entry_get_rw(
        Operation *op,
-       SlapReply *rs )
+       struct berval *ndn,
+       ObjectClass *oc,
+       AttributeDescription *at,
+       int rw,
+       Entry **e )
 {
-       Attribute       **ap;
-       int             rc = 0;
-       BackendDB       *be_orig;
-
-       for ( ap = &rs->sr_operational_attrs; *ap; ap = &(*ap)->a_next )
-               /* just count them */ ;
-
-       /*
-        * If operational attributes (allegedly) are required, 
-        * and the backend supports specific operational attributes, 
-        * add them to the attribute list
-        */
-       if ( SLAP_OPATTRS( rs->sr_attr_flags ) || ( rs->sr_attrs &&
-               ad_inlist( slap_schema.si_ad_entryDN, rs->sr_attrs ) ) )
-       {
-               *ap = slap_operational_entryDN( rs->sr_entry );
-               ap = &(*ap)->a_next;
+       BackendDB       *bd;
+       int             rc = LDAP_NO_SUCH_OBJECT;
+
+       bd = op->o_bd;
+       op->o_bd = select_backend( ndn, 0 );
+       if ( op->o_bd != NULL ) {
+               if ( op->o_bd->be_fetch ) {
+                       rc = op->o_bd->be_fetch( op, ndn, oc, at, rw, e );
+               }
        }
+       op->o_bd = bd;
 
-       if ( SLAP_OPATTRS( rs->sr_attr_flags ) || ( rs->sr_attrs &&
-               ad_inlist( slap_schema.si_ad_subschemaSubentry, rs->sr_attrs ) ) )
-       {
-               *ap = slap_operational_subschemaSubentry( op->o_bd );
-               ap = &(*ap)->a_next;
-       }
+       return rc;
+}
 
-       if ( op->o_bd != NULL )
-       {
-               /* Let the overlays have a chance at this */
-               be_orig = op->o_bd;
-               if ( SLAP_ISOVERLAY( be_orig ) )
-                       op->o_bd = select_backend( be_orig->be_nsuffix, 0, 0 );
-
-               if ( ( SLAP_OPATTRS( rs->sr_attr_flags ) || rs->sr_attrs ) &&
-                       op->o_bd && op->o_bd->be_operational != NULL )
-               {
-                       rc = op->o_bd->be_operational( op, rs );
+static int
+fe_entry_release_rw(
+       Operation *op,
+       Entry *e,
+       int rw )
+{
+       BackendDB       *bd;
+       int             rc = LDAP_NO_SUCH_OBJECT;
+
+       bd = op->o_bd;
+       op->o_bd = select_backend( &e->e_nname, 0 );
+       if ( op->o_bd != NULL ) {
+               if ( op->o_bd->be_release ) {
+                       rc = op->o_bd->be_release( op, e, rw );
                }
-               op->o_bd = be_orig;
        }
+       op->o_bd = bd;
 
        return rc;
 }
@@ -96,6 +93,7 @@ frontend_init( void )
 {
        /* data */
        frontendDB = &slap_frontendDB;
+       frontendDB->bd_self = frontendDB;
 
        /* ACLs */
        frontendDB->be_dfltaccess = ACL_READ;
@@ -110,11 +108,7 @@ 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
+       ldap_pvt_thread_mutex_init( &frontendDB->be_pcl_mutex );
 
        /* suffix */
        frontendDB->be_suffix = ch_calloc( 2, sizeof( struct berval ) );
@@ -133,7 +127,7 @@ frontend_init( void )
        frontendDB->bd_info->bi_type = "frontend";
 
        /* known controls */
-       if ( slap_known_controls ) {
+       {
                int     i;
 
                frontendDB->bd_info->bi_controls = slap_known_controls;
@@ -164,6 +158,11 @@ frontend_init( void )
        frontendDB->bd_info->bi_op_search = fe_op_search;
        frontendDB->bd_info->bi_extended = fe_extended;
        frontendDB->bd_info->bi_operational = fe_aux_operational;
+       frontendDB->bd_info->bi_entry_get_rw = fe_entry_get_rw;
+       frontendDB->bd_info->bi_entry_release_rw = fe_entry_release_rw;
+       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;
 
 #if 0
        /* FIXME: is this too early? */