mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
first round of SHADOW flags/isupdate test unification
This commit is contained in:
parent
b703cfb008
commit
c0c24cfec5
@ -298,7 +298,7 @@ retry: /* transaction retry */
|
||||
* no parent!
|
||||
* if not attempting to add entry at suffix or with parent ""
|
||||
*/
|
||||
if ((( !be_isroot( op ) && !be_isupdate(op) && !syncrepl_isupdate(op))
|
||||
if ((( !be_isroot( op ) && !be_shadow_update(op) )
|
||||
|| pdn.bv_len > 0 ) && !is_entry_glue( op->oq_add.rs_e ))
|
||||
{
|
||||
#ifdef NEW_LOGGING
|
||||
|
@ -246,7 +246,7 @@ retry: /* transaction retry */
|
||||
/* no parent, must be root to delete */
|
||||
if( ! be_isroot( op ) ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv )
|
||||
|| be_isupdate( op ) || syncrepl_isupdate( op ) ) {
|
||||
|| be_shadow_update( op ) ) {
|
||||
p = (Entry *)&slap_entry_root;
|
||||
|
||||
/* check parent for "children" acl */
|
||||
|
@ -396,7 +396,7 @@ retry: /* transaction retry */
|
||||
isroot = be_isroot( op );
|
||||
if ( ! isroot ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv )
|
||||
|| be_isupdate( op ) || syncrepl_isupdate( op ) ) {
|
||||
|| be_shadow_update( op ) ) {
|
||||
|
||||
p = (Entry *)&slap_entry_root;
|
||||
|
||||
|
@ -90,7 +90,7 @@ ldap_back_add(
|
||||
dc.ctx = "addAttrDN";
|
||||
#endif
|
||||
|
||||
isupdate = be_isupdate( op ) || syncrepl_isupdate( op );
|
||||
isupdate = be_shadow_update( op );
|
||||
for (i=0, a=op->oq_add.rs_e->e_attrs; a; a=a->a_next) {
|
||||
if ( !isupdate && a->a_desc->ad_type->sat_no_user_mod ) {
|
||||
continue;
|
||||
|
@ -91,7 +91,7 @@ ldap_back_modify(
|
||||
dc.ctx = "modifyAttrDN";
|
||||
#endif
|
||||
|
||||
isupdate = be_isupdate( op ) || syncrepl_isupdate( op );
|
||||
isupdate = be_shadow_update( op );
|
||||
for (i=0, ml=op->oq_modify.rs_modlist; ml; ml=ml->sml_next) {
|
||||
int is_oc = 0;
|
||||
|
||||
|
@ -247,7 +247,7 @@ ldbm_back_add(
|
||||
} else {
|
||||
assert( pdn.bv_val == NULL || *pdn.bv_val == '\0' );
|
||||
|
||||
if (( !be_isroot(op) && !be_isupdate(op) && !syncrepl_isupdate(op))
|
||||
if (( !be_isroot(op) && !be_shadow_update(op) )
|
||||
&& !is_entry_glue( op->oq_add.rs_e ))
|
||||
{
|
||||
ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
|
||||
|
@ -196,7 +196,7 @@ ldbm_back_delete(
|
||||
/* no parent, must be root to delete */
|
||||
if( ! be_isroot( op ) ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv )
|
||||
|| be_isupdate( op ) || syncrepl_isupdate( op ) ) {
|
||||
|| be_shadow_update( op ) ) {
|
||||
p = (Entry *)&slap_entry_root;
|
||||
|
||||
rc = access_allowed( op, p,
|
||||
|
@ -249,7 +249,7 @@ ldbm_back_modrdn(
|
||||
isroot = be_isroot( op );
|
||||
if ( ! isroot ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv )
|
||||
|| be_isupdate( op ) || syncrepl_isupdate( op ) ) {
|
||||
|| be_shadow_update( op ) ) {
|
||||
int can_access;
|
||||
p = (Entry *)&slap_entry_root;
|
||||
|
||||
@ -424,7 +424,7 @@ ldbm_back_modrdn(
|
||||
|
||||
if ( ! isroot ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv )
|
||||
|| be_isupdate( op ) || syncrepl_isupdate( op )) {
|
||||
|| be_shadow_update( op ) ) {
|
||||
int can_access;
|
||||
np = (Entry *)&slap_entry_root;
|
||||
|
||||
|
@ -728,9 +728,25 @@ be_isroot_dn( Backend *be, struct berval *ndn )
|
||||
}
|
||||
|
||||
int
|
||||
be_isupdate( Operation *op )
|
||||
be_sync_update( Operation *op )
|
||||
{
|
||||
return ( be_isupdate_dn( op->o_bd, &op->o_ndn ));
|
||||
return ( SLAP_SYNC_SHADOW( op->o_bd ) && syncrepl_isupdate( op ) );
|
||||
}
|
||||
|
||||
int
|
||||
be_slurp_update( Operation *op )
|
||||
{
|
||||
return ( SLAP_SLURP_SHADOW( op->o_bd ) && be_isupdate_dn( op->o_bd, &op->o_ndn ));
|
||||
}
|
||||
|
||||
int
|
||||
be_shadow_update( Operation *op )
|
||||
{
|
||||
#if 0
|
||||
return ( be_sync_update( op ) || be_slurp_update( op ) );
|
||||
#endif
|
||||
/* NOTE: this is slightly more efficient */
|
||||
return ( SLAP_SHADOW( op->o_bd ) && ( syncrepl_isupdate( op ) || be_isupdate_dn( op->o_bd, &op->o_ndn ) ) );
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -100,7 +100,7 @@ rwm_add( Operation *op, SlapReply *rs )
|
||||
}
|
||||
|
||||
/* Count number of attributes in entry */
|
||||
isupdate = be_isupdate( op ) || syncrepl_isupdate( op );
|
||||
isupdate = be_shadow_update( op );
|
||||
for ( i = 0, ap = &op->oq_add.rs_e->e_attrs; *ap; ) {
|
||||
struct berval mapped;
|
||||
Attribute *a;
|
||||
|
@ -225,7 +225,10 @@ LDAP_SLAPD_F (int) be_issuffix LDAP_P(( Backend *be,
|
||||
LDAP_SLAPD_F (int) be_isroot LDAP_P(( Operation *op ));
|
||||
LDAP_SLAPD_F (int) be_isroot_dn LDAP_P(( Backend *be, struct berval *ndn ));
|
||||
LDAP_SLAPD_F (int) be_isroot_pw LDAP_P(( Operation *op ));
|
||||
LDAP_SLAPD_F (int) be_isupdate LDAP_P(( Operation *op ));
|
||||
LDAP_SLAPD_F (int) be_sync_update LDAP_P(( Operation *op ));
|
||||
LDAP_SLAPD_F (int) be_slurp_update LDAP_P(( Operation *op ));
|
||||
#define be_isupdate( op ) be_slurp_update( (op) )
|
||||
LDAP_SLAPD_F (int) be_shadow_update LDAP_P(( Operation *op ));
|
||||
LDAP_SLAPD_F (int) be_isupdate_dn LDAP_P(( Backend *be, struct berval *ndn ));
|
||||
LDAP_SLAPD_F (struct berval *) be_root_dn LDAP_P(( Backend *be ));
|
||||
LDAP_SLAPD_F (int) be_entry_get_rw LDAP_P(( struct slap_op *o,
|
||||
|
@ -1450,9 +1450,9 @@ struct slap_backend_db {
|
||||
#define SLAP_DBFLAG_NOLASTMOD 0x0001U
|
||||
#define SLAP_DBFLAG_NO_SCHEMA_CHECK 0x0002U
|
||||
#define SLAP_DBFLAG_GLUE_INSTANCE 0x0010U /* a glue backend */
|
||||
#define SLAP_DBFLAG_GLUE_SUBORDINATE 0x0020U /* child of a glue hierarchy */
|
||||
#define SLAP_DBFLAG_GLUE_SUBORDINATE 0x0020U /* child of a glue hierarchy */
|
||||
#define SLAP_DBFLAG_GLUE_LINKED 0x0040U /* child is connected to parent */
|
||||
#define SLAP_DBFLAG_SHADOW 0x8000U /* a shadow */
|
||||
#define SLAP_DBFLAG_SHADOW 0x8000U /* a shadow */
|
||||
#define SLAP_DBFLAG_SYNC_SHADOW 0x1000U /* a sync shadow */
|
||||
#define SLAP_DBFLAG_SLURP_SHADOW 0x2000U /* a slurp shadow */
|
||||
slap_mask_t be_flags;
|
||||
@ -1468,6 +1468,8 @@ struct slap_backend_db {
|
||||
#define SLAP_GLUE_LINKED(be) \
|
||||
(SLAP_DBFLAGS(be) & SLAP_DBFLAG_GLUE_LINKED)
|
||||
#define SLAP_SHADOW(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_SHADOW)
|
||||
#define SLAP_SYNC_SHADOW(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_SYNC_SHADOW)
|
||||
#define SLAP_SLURP_SHADOW(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_SLURP_SHADOW)
|
||||
|
||||
slap_mask_t be_restrictops; /* restriction operations */
|
||||
#define SLAP_RESTRICT_OP_ADD 0x0001U
|
||||
|
Loading…
Reference in New Issue
Block a user