X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Ffrontend.c;h=aa421db3e28ec6be28d71cb1ddf466c929d76d2d;hb=7a66c847833406d261660e8520cae41922d12292;hp=f9cfe6f466137c0110dc178e324dc7c27704b8ae;hpb=d0b804c439774fb0e59b666ebffe7271d4f5ae85;p=openldap diff --git a/servers/slapd/frontend.c b/servers/slapd/frontend.c index f9cfe6f466..aa421db3e2 100644 --- a/servers/slapd/frontend.c +++ b/servers/slapd/frontend.c @@ -1,7 +1,8 @@ /* frontend.c - routines for dealing with frontend */ +/* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2005 The OpenLDAP Foundation. + * Copyright 1998-2011 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,19 +39,61 @@ #include "ldap_rq.h" -#ifdef LDAP_SLAPI -#include "slapi/slapi.h" -#endif - static BackendInfo slap_frontendInfo; static BackendDB slap_frontendDB; BackendDB *frontendDB; +static int +fe_entry_get_rw( + Operation *op, + struct berval *ndn, + ObjectClass *oc, + AttributeDescription *at, + int rw, + Entry **e ) +{ + 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; + + return rc; +} + +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 = bd; + + return rc; +} + int frontend_init( void ) { /* data */ frontendDB = &slap_frontendDB; + frontendDB->bd_self = frontendDB; /* ACLs */ frontendDB->be_dfltaccess = ACL_READ; @@ -65,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 ) ); @@ -82,11 +121,13 @@ frontend_init( void ) /* info */ frontendDB->bd_info = &slap_frontendInfo; + SLAP_BFLAGS(frontendDB) |= SLAP_BFLAG_FRONTEND; + /* name */ frontendDB->bd_info->bi_type = "frontend"; /* known controls */ - if ( slap_known_controls ) { + { int i; frontendDB->bd_info->bi_controls = slap_known_controls; @@ -116,6 +157,12 @@ 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; + 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? */