]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/backend.c
- setup framework for monitoring of back-bdb/back-hdb stuff in their
[openldap] / servers / slapd / backend.c
index 43d4ca4fbdb1307cc644120e6072db7b020cec42..2e6d1fb1ee0b7b43d10fdd3e4a7a2394f0cde6f5 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2006 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -248,6 +248,8 @@ int backend_startup(Backend *be)
                                return rc;
                        }
                }
+               /* append global access controls */
+               acl_append( &be->be_acl, frontendDB->be_acl, -1 );
 
                return backend_startup_one( be );
        }
@@ -592,7 +594,7 @@ select_backend(
        Backend         *be, *b2 = NULL;
 
        LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
-               if ( be->be_nsuffix == NULL ) {
+               if ( be->be_nsuffix == NULL || SLAP_DBHIDDEN( be )) {
                        continue;
                }
 
@@ -687,7 +689,10 @@ be_slurp_update( Operation *op )
 int
 be_shadow_update( Operation *op )
 {
-       return ( SLAP_SYNC_SHADOW( op->o_bd ) ||
+       /* This assumes that all internal ops (connid == -1) on a syncrepl
+        * database are syncrepl operations.
+        */
+       return (( SLAP_SYNC_SHADOW( op->o_bd ) && op->o_connid == -1 ) ||
                ( SLAP_SHADOW( op->o_bd ) && be_isupdate_dn( op->o_bd, &op->o_ndn ) ) );
 }
 
@@ -818,10 +823,14 @@ backend_check_controls(
                                /* unrecognized control */ 
                                if ( (*ctrls)->ldctl_iscritical ) {
                                        /* should not be reachable */ 
-                                       Debug( LDAP_DEBUG_ANY,
-                                               "backend_check_controls: unrecognized control: %s\n",
+                                       Debug( LDAP_DEBUG_ANY, "backend_check_controls: "
+                                               "unrecognized critical control: %s\n",
                                                (*ctrls)->ldctl_oid, 0, 0 );
                                        assert( 0 );
+                               } else {
+                                       Debug( LDAP_DEBUG_TRACE, "backend_check_controls: "
+                                               "unrecognized non-critical control: %s\n",
+                                               (*ctrls)->ldctl_oid, 0, 0 );
                                }
                                break;
 
@@ -860,10 +869,9 @@ backend_check_controls(
                }
        }
 
-       /* temporarily removed */
-#if 0
+#if 0 /* temporarily removed */
        /* check should be generalized */
-       if( get_manageDIT(op) && !be_isroot(op)) {
+       if( get_relax(op) && !be_isroot(op)) {
                rs->sr_text = "requires manager authorization";
                rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
        }
@@ -1416,13 +1424,8 @@ backend_group(
 
        be_orig = op->o_bd;
        op->o_bd = frontendDB;
-#ifdef SLAP_OVERLAY_ACCESS
        rc = frontendDB->be_group( op, target, gr_ndn,
                op_ndn, group_oc, group_at );
-#else /* ! SLAP_OVERLAY_ACCESS */
-       rc = fe_acl_group( op, target, gr_ndn,
-               op_ndn, group_oc, group_at );
-#endif /* ! SLAP_OVERLAY_ACCESS */
        op->o_bd = be_orig;
 
        return rc;
@@ -1457,6 +1460,19 @@ fe_acl_attribute(
        } 
 
        if ( e ) {
+               if ( entry_at == slap_schema.si_ad_entry || entry_at == slap_schema.si_ad_children ) {
+                       assert( vals == NULL );
+
+                       rc = LDAP_SUCCESS;
+                       if ( op->o_conn && access > ACL_NONE &&
+                               access_allowed( op, e, entry_at, NULL,
+                                               access, &acl_state ) == 0 )
+                       {
+                               rc = LDAP_INSUFFICIENT_ACCESS;
+                       }
+                       goto freeit;
+               }
+
                a = attr_find( e->e_attrs, entry_at );
                if ( a == NULL ) {
                        SlapReply       rs = { 0 };
@@ -1556,13 +1572,8 @@ backend_attribute(
 
        be_orig = op->o_bd;
        op->o_bd = frontendDB;
-#ifdef SLAP_OVERLAY_ACCESS
        rc = frontendDB->be_attribute( op, target, edn,
                entry_at, vals, access );
-#else /* !SLAP_OVERLAY_ACCESS */
-       rc = fe_acl_attribute( op, target, edn,
-               entry_at, vals, access );
-#endif /* !SLAP_OVERLAY_ACCESS */
        op->o_bd = be_orig;
 
        return rc;
@@ -1692,15 +1703,17 @@ fe_aux_operational(
         * 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 ) ) )
+       if ( !( rs->sr_flags & REP_NO_ENTRYDN )
+               && ( 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;
        }
 
-       if ( SLAP_OPATTRS( rs->sr_attr_flags ) || ( rs->sr_attrs &&
-               ad_inlist( slap_schema.si_ad_subschemaSubentry, rs->sr_attrs ) ) )
+       if ( !( rs->sr_flags & REP_NO_SUBSCHEMA)
+               && ( 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;