mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-04 06:01:23 -05:00
updatedn fix for syncrepl
This commit is contained in:
parent
df4db9beb1
commit
1c1b2bb6ee
16 changed files with 43 additions and 22 deletions
|
|
@ -253,8 +253,6 @@ do_add( Operation *op, SlapReply *rs )
|
|||
int repl_user = be_isupdate( op );
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
if ( !SLAP_SHADOW(op->o_bd) || repl_user )
|
||||
#else
|
||||
if ( LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo ))
|
||||
#endif
|
||||
{
|
||||
int update = op->o_bd->be_update_ndn.bv_len;
|
||||
|
|
|
|||
|
|
@ -298,8 +298,8 @@ retry: /* transaction retry */
|
|||
* no parent!
|
||||
* if not attempting to add entry at suffix or with parent ""
|
||||
*/
|
||||
if ((( !be_isroot( op ) && !be_isupdate(op)) || pdn.bv_len > 0 )
|
||||
&& !is_entry_glue( op->oq_add.rs_e ))
|
||||
if ((( !be_isroot( op ) && !be_isupdate(op) && !syncrepl_isupdate(op))
|
||||
|| pdn.bv_len > 0 ) && !is_entry_glue( op->oq_add.rs_e ))
|
||||
{
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( OPERATION, DETAIL1, "bdb_add: %s denied\n",
|
||||
|
|
|
|||
|
|
@ -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 ) ) {
|
||||
|| be_isupdate( op ) || syncrepl_isupdate( 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 ) ) {
|
||||
|| be_isupdate( op ) || syncrepl_isupdate( op ) ) {
|
||||
|
||||
p = (Entry *)&slap_entry_root;
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ ldap_back_add(
|
|||
dc.ctx = "addAttrDN";
|
||||
#endif
|
||||
|
||||
isupdate = be_isupdate( op );
|
||||
isupdate = be_isupdate( op ) || syncrepl_isupdate( 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 );
|
||||
isupdate = be_isupdate( op ) || syncrepl_isupdate( op );
|
||||
for (i=0, ml=op->oq_modify.rs_modlist; ml; ml=ml->sml_next) {
|
||||
int is_oc = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -247,8 +247,8 @@ ldbm_back_add(
|
|||
} else {
|
||||
assert( pdn.bv_val == NULL || *pdn.bv_val == '\0' );
|
||||
|
||||
if (( !be_isroot( op ) && !be_isupdate( op )) &&
|
||||
!is_entry_glue( op->oq_add.rs_e ))
|
||||
if (( !be_isroot(op) && !be_isupdate(op) && !syncrepl_isupdate(op))
|
||||
&& !is_entry_glue( op->oq_add.rs_e ))
|
||||
{
|
||||
ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
|
||||
|
||||
|
|
|
|||
|
|
@ -195,7 +195,8 @@ ldbm_back_delete(
|
|||
} else {
|
||||
/* 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 ) ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv )
|
||||
|| be_isupdate( op ) || syncrepl_isupdate( op ) ) {
|
||||
p = (Entry *)&slap_entry_root;
|
||||
|
||||
rc = access_allowed( op, p,
|
||||
|
|
|
|||
|
|
@ -248,7 +248,8 @@ ldbm_back_modrdn(
|
|||
/* no parent, must be root to modify rdn */
|
||||
isroot = be_isroot( op );
|
||||
if ( ! isroot ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv ) || be_isupdate( op ) ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv )
|
||||
|| be_isupdate( op ) || syncrepl_isupdate( op ) ) {
|
||||
int can_access;
|
||||
p = (Entry *)&slap_entry_root;
|
||||
|
||||
|
|
@ -422,7 +423,8 @@ ldbm_back_modrdn(
|
|||
}
|
||||
|
||||
if ( ! isroot ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv ) || be_isupdate( op ) ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv )
|
||||
|| be_isupdate( op ) || syncrepl_isupdate( op )) {
|
||||
int can_access;
|
||||
np = (Entry *)&slap_entry_root;
|
||||
|
||||
|
|
|
|||
|
|
@ -730,7 +730,7 @@ be_isroot_dn( Backend *be, struct berval *ndn )
|
|||
int
|
||||
be_isupdate( Operation *op )
|
||||
{
|
||||
return be_isupdate_dn( op->o_bd, &op->o_ndn );
|
||||
return ( be_isupdate_dn( op->o_bd, &op->o_ndn ));
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -208,8 +208,6 @@ do_delete(
|
|||
int repl_user = be_isupdate( op );
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
if ( !SLAP_SHADOW(op->o_bd) || repl_user )
|
||||
#else
|
||||
if ( LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo ))
|
||||
#endif
|
||||
{
|
||||
slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
|
||||
|
|
|
|||
|
|
@ -468,8 +468,6 @@ do_modify(
|
|||
*/
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
if ( !SLAP_SHADOW(op->o_bd) || repl_user )
|
||||
#else
|
||||
if ( LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo ))
|
||||
#endif
|
||||
{
|
||||
int update = op->o_bd->be_update_ndn.bv_len;
|
||||
|
|
|
|||
|
|
@ -365,8 +365,6 @@ do_modrdn(
|
|||
int repl_user = be_isupdate( op );
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
if ( !SLAP_SHADOW(op->o_bd) || repl_user )
|
||||
#else
|
||||
if ( LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo ))
|
||||
#endif
|
||||
{
|
||||
slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ rwm_add( Operation *op, SlapReply *rs )
|
|||
}
|
||||
|
||||
/* Count number of attributes in entry */
|
||||
isupdate = be_isupdate( op );
|
||||
isupdate = be_isupdate( op ) || syncrepl_isupdate( op );
|
||||
for ( i = 0, ap = &op->oq_add.rs_e->e_attrs; *ap; ) {
|
||||
struct berval mapped;
|
||||
Attribute *a;
|
||||
|
|
|
|||
|
|
@ -1136,6 +1136,8 @@ LDAP_SLAPD_F (Entry*) slap_create_syncrepl_entry LDAP_P((
|
|||
struct berval *, struct berval * ));
|
||||
LDAP_SLAPD_F (struct berval *) slap_uuidstr_from_normalized LDAP_P((
|
||||
struct berval *, struct berval *, void * ));
|
||||
LDAP_SLAPD_F (int) syncrepl_isupdate LDAP_P(( Operation * ));
|
||||
LDAP_SLAPD_F (int) syncrepl_isupdate_dn LDAP_P(( Backend *, struct berval * ));
|
||||
|
||||
/* syntax.c */
|
||||
LDAP_SLAPD_F (Syntax *) syn_find LDAP_P((
|
||||
|
|
|
|||
|
|
@ -1788,6 +1788,31 @@ done :
|
|||
return;
|
||||
}
|
||||
|
||||
int
|
||||
syncrepl_isupdate( Operation *op )
|
||||
{
|
||||
return ( syncrepl_isupdate_dn( op->o_bd, &op->o_ndn ));
|
||||
}
|
||||
|
||||
int
|
||||
syncrepl_isupdate_dn(
|
||||
Backend* be,
|
||||
struct berval* ndn
|
||||
)
|
||||
{
|
||||
syncinfo_t* si;
|
||||
int ret = 0;
|
||||
|
||||
if ( !LDAP_STAILQ_EMPTY( &be->be_syncinfo )) {
|
||||
LDAP_STAILQ_FOREACH( si, &be->be_syncinfo, si_next ) {
|
||||
if ( ret = dn_match( &si->si_updatedn, ndn )) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
dn_callback(
|
||||
Operation* op,
|
||||
|
|
@ -1991,4 +2016,3 @@ avl_ber_bvfree( void *bv )
|
|||
}
|
||||
ch_free ( (char *) bv );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue