From 4e3c30bbf0ca1a2b5739d342b560e3c2f5d08303 Mon Sep 17 00:00:00 2001 From: Jong Hyuk Choi Date: Tue, 24 Feb 2004 01:55:59 +0000 Subject: [PATCH] misc addition to the previous glueing commit --- servers/slapd/back-bdb/modify.c | 14 ++++++++++++-- servers/slapd/syncrepl.c | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index 07764d0bf4..bc3e7ab48c 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -23,6 +23,11 @@ #include "back-bdb.h" #include "external.h" +static struct berval scbva[] = { + BER_BVC("glue"), + BER_BVNULL +}; + int bdb_modify_internal( Operation *op, DB_TXN *tid, @@ -56,13 +61,18 @@ int bdb_modify_internal( e->e_attrs = attrs_dup( e->e_attrs ); for ( ml = modlist; ml != NULL; ml = ml->sml_next ) { + int match; mod = &ml->sml_mod; switch( mod->sm_op ) { case LDAP_MOD_ADD: case LDAP_MOD_REPLACE: if ( mod->sm_desc == slap_schema.si_ad_structuralObjectClass ) { - /* sc modify is internally allowed only to make an entry a glue */ - glue_attr_delete = 1; + value_match( &match, slap_schema.si_ad_structuralObjectClass, + slap_schema.si_ad_structuralObjectClass->ad_type->sat_equality, + SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX, + &mod->sm_values[0], &scbva[0], text ); + if ( !match ) + glue_attr_delete = 1; } } if ( glue_attr_delete ) diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index dd7a5d49a8..9a53d86c49 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -1032,6 +1032,11 @@ done: return rc; } +static struct berval uuidbva[] = { + BER_BVNULL, + BER_BVNULL +}; + int syncrepl_entry( syncinfo_t* si, @@ -1185,10 +1190,26 @@ syncrepl_entry( if ( rc != LDAP_SUCCESS ) { if ( rc == LDAP_ALREADY_EXISTS ) { + Modifications *mod; + Modifications *modtail; + + for ( mod = modlist; mod != NULL; mod = mod->sml_next ) { + modtail = mod; + } + + mod = (Modifications *)ch_calloc(1, sizeof(Modifications)); + ber_dupbv( &uuidbva[0], syncUUID ); + mod->sml_op = LDAP_MOD_REPLACE; + mod->sml_desc = slap_schema.si_ad_entryUUID; + mod->sml_type = mod->sml_desc->ad_cname; + mod->sml_bvalues = uuidbva; + modtail->sml_next = mod; + op->o_tag = LDAP_REQ_MODIFY; op->orm_modlist = modlist; op->o_req_dn = e->e_name; op->o_req_ndn = e->e_nname; + rc = be->be_modify( op, &rs ); if ( rc != LDAP_SUCCESS ) { #ifdef NEW_LOGGING -- 2.39.5