Commit 02d1a40d authored by Ondřej Kuzník's avatar Ondřej Kuzník Committed by Quanah Gibson-Mount
Browse files

ITS#6545 Update accesslog format and syncrepl consumer

Make two successive modifications of the same attribute separate. This
lets the consumer interpret the log entry the same way as the server
that produced it.

Still depends on the log entry attributes being read in the same order
as they were written.
parent 556a832c
......@@ -1586,7 +1586,7 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
case LOG_EN_MODRDN:
case LOG_EN_MODIFY:
/* count all the mods */
/* count all the mods + attributes (ITS#6545) */
i = 0;
for ( m = op->orm_modlist; m; m = m->sml_next ) {
if ( m->sml_values ) {
......@@ -1596,6 +1596,9 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
{
i++;
}
if ( m->sml_next && m->sml_desc == m->sml_next->sml_desc ) {
i++;
}
}
vals = ch_malloc( (i+1) * sizeof( struct berval ));
i = 0;
......@@ -1666,6 +1669,12 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
*ptr = '\0';
i++;
}
/* ITS#6545: when the same attribute is edited multiple times,
* record the transition */
if ( m->sml_next && m->sml_desc == m->sml_next->sml_desc ) {
ber_str2bv( ":", STRLENOF(":"), 1, &vals[i] );
i++;
}
}
if ( i > 0 ) {
......
......@@ -1761,6 +1761,11 @@ syncrepl_accesslog_mods(
if ( !colon ) {
/* Invalid */
continue;
} else if ( colon == bv.bv_val ) {
/* ITS#6545: An empty attribute signals that a new mod
* is about to start */
mod = NULL;
continue;
}
bv.bv_len = colon - bv.bv_val;
......
......@@ -308,6 +308,9 @@ cn: Rosco P. Coltrane
dn: cn=Mark Elliot,ou=Alumni Association,ou=People,dc=example,dc=com
changetype: modify
replace: drink
drink: Red Wine
-
replace: drink
dn: cn=All Staff,ou=Groups,dc=example,dc=com
changetype: modrdn
......
......@@ -473,6 +473,23 @@ if test $RC != 0 ; then
exit $RC
fi
$LDAPMODIFY -D "$MANAGERDN" -H $URI1 -w $PASSWD \
>> $TESTOUT 2>&1 << EOF
dn: $THEDN
changetype: modify
replace: sn
sn: Replaced later
-
replace: sn
sn: Surname
EOF
RC=$?
if test $RC != 0 ; then
echo "ldapmodify failed for server 1 database ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Restoring replication between server 1 and 2..."
n=1
while [ $n -le $MMR ]; do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment