From: Howard Chu Date: Fri, 15 Feb 2002 15:21:13 +0000 (+0000) Subject: Add basic objectClass filtering to filtered replicas X-Git-Tag: OPENLDAP_REL_ENG_2_1_BP~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a0bfd8b0587502e96b056683bc12b58275c32d25;p=openldap Add basic objectClass filtering to filtered replicas --- diff --git a/servers/slapd/repl.c b/servers/slapd/repl.c index 46123fdc05..0db52e1f79 100644 --- a/servers/slapd/repl.c +++ b/servers/slapd/repl.c @@ -295,8 +295,37 @@ replog1( fprintf( fp, "changetype: add\n" ); a = first ? first : e->e_attrs; for ( ; a != NULL; a=a->a_next ) { - if ( ri && ri->ri_attrs && !ad_inlist( a->a_desc, ri->ri_attrs ) ) { - continue; + if ( ri && ri->ri_attrs ) { + if ( !ad_inlist( a->a_desc, ri->ri_attrs ) ) { + continue; + } + /* If the list includes objectClass names, + * only include those classes in the + * objectClass attribute + */ + if ( a->a_desc == slap_schema.si_ad_objectClass ) { + int ocs = 0; + AttributeName *an; + struct berval vals[2]; + vals[1].bv_val = NULL; + vals[1].bv_len = 0; + for ( an = ri->ri_attrs; an->an_name.bv_val; an++ ) { + if ( an->an_oc ) { + int i; + for ( i=0; a->a_vals[i].bv_val; i++ ) { + if ( a->a_vals[i].bv_len == an->an_name.bv_len + && !strcasecmp(a->a_vals[i].bv_val, + an->an_name.bv_val ) ) { + ocs = 1; + vals[0] = an->an_name; + print_vals( fp, &a->a_desc->ad_cname, vals ); + break; + } + } + } + } + if ( ocs ) continue; + } } print_vals( fp, &a->a_desc->ad_cname, a->a_vals ); }