This is a multi-part message in MIME format.
--------------030107090007020809070602
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
On 31.01.2015. 14:09, hyc@symas.com wrote:
A real fix would involve modifying the persistent search to include reqControls
in its attribute list and activating Relax Rules on the consumer only if it had
been active on the provider when the modification occurred.
Right. This is also important for a few other controls. E.g. LDAP
Transactions.
Attached is a patch implementing the outlined approach. Notes:
- I've invented the attribute name for the CHANGELOG format, for symmetry.
- I've structured the check so it shouldn't be difficult to handle other
controls. Other approaches are certainly possible.
- The patch has been generated against OPENLDAP_REL_ENG_2_4, not HEAD.
If an IPR statement is needed, I'm including it here.
The attached patch file is derived from OpenLDAP Software. All of the
modifications to OpenLDAP Software represented in the following patch were
developed by Ivan Nejgebauer ian@uns.ac.rs. I have not assigned rights
and/or interest in this work to any party.
I, Ivan Nejgebauer, hereby place the following modifications to OpenLDAP
Software (and only these modifications) into the public domain. Hence, these
modifications may be freely used and/or redistributed for any purpose with or
without attribution and/or other notice.
--
Ivan Nejgebauer +381 21 485 2025
Glavni sistem inženjer ian@uns.ac.rs
CIT-UNS/ARMUNS
http://www.uns.ac.rs
Univerzitet u Novom Sadu $ Dr Zorana Đinđića 1 $ 21000 Novi Sad $ Srbija
--------------030107090007020809070602
Content-Type: text/x-patch;
name="0001-Add-relax-control-handling-for-delta-syncrepl.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="0001-Add-relax-control-handling-for-delta-syncrepl.patch"
>From 52e08a1c2c63d527b8e2b65d3a63d9a12e2b6edc Mon Sep 17 00:00:00 2001
From: Ivan Nejgebauer
ian@uns.ac.rs
Date: Tue, 3 Feb 2015 13:35:38 +0100
Subject: [PATCH] Add relax control handling for delta-syncrepl
---
servers/slapd/syncrepl.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c
index 4e42a47..93b2723 100644
--- a/servers/slapd/syncrepl.c
+++ b/servers/slapd/syncrepl.c
@@ -165,6 +165,7 @@ typedef struct logschema {
struct berval ls_newRdn;
struct berval ls_delRdn;
struct berval ls_newSup;
+ struct berval ls_controls;
} logschema;
static logschema changelog_sc = {
@@ -173,7 +174,8 @@ static logschema changelog_sc = {
BER_BVC("changes"),
BER_BVC("newRDN"),
BER_BVC("deleteOldRDN"),
- BER_BVC("newSuperior")
+ BER_BVC("newSuperior"),
+ BER_BVC("controls"),
};
static logschema accesslog_sc = {
@@ -182,7 +184,8 @@ static logschema accesslog_sc = {
BER_BVC("reqMod"),
BER_BVC("reqNewRDN"),
BER_BVC("reqDeleteOldRDN"),
- BER_BVC("reqNewSuperior")
+ BER_BVC("reqNewSuperior"),
+ BER_BVC("reqControls")
};
static const char *
@@ -398,7 +401,7 @@ ldap_sync_search(
int rc;
int rhint;
char *base;
- char **attrs, *lattrs[8];
+ char **attrs, *lattrs[9];
char *filter;
int attrsonly;
int scope;
@@ -427,8 +430,9 @@ ldap_sync_search(
lattrs[3] = ls->ls_newRdn.bv_val;
lattrs[4] = ls->ls_delRdn.bv_val;
lattrs[5] = ls->ls_newSup.bv_val;
- lattrs[6] = slap_schema.si_ad_entryCSN->ad_cname.bv_val;
- lattrs[7] = NULL;
+ lattrs[6] = ls->ls_controls.bv_val;
+ lattrs[7] = slap_schema.si_ad_entryCSN->ad_cname.bv_val;
+ lattrs[8] = NULL;
rhint = 0;
base = si->si_logbase.bv_val;
@@ -2291,6 +2295,20 @@ syncrepl_message_to_op(
}
} else if ( !ber_bvstrcasecmp( &bv, &ls->ls_newSup ) ) {
sup = bvals[0];
+ } else if ( !ber_bvstrcasecmp( &bv, &ls->ls_controls ) ) {
+ int i;
+ struct berval rel_ctrl_bv;
+
+ (void)ber_str2bv( "{" LDAP_CONTROL_RELAX, 0, 0, &rel_ctrl_bv );
+ for ( i = 0; bvals[i].bv_val; i++ ) {
+ struct berval cbv, tmp;
+
+ ber_bvchr_post( &cbv, &bvals[i], '}' );
+ ber_bvchr_post( &tmp, &cbv, '{' );
+ ber_bvchr_pre( &cbv, &tmp, '}' );
+ if ( !ber_bvcmp( &cbv, &rel_ctrl_bv ) )
+ op->o_relax = SLAP_CONTROL_CRITICAL;
+ }
} else if ( !ber_bvstrcasecmp( &bv,
&slap_schema.si_ad_entryCSN->ad_cname ) )
{
--
1.8.1.2
--------------030107090007020809070602--