+ if ( ri && ri->ri_attrs ) {
+ int is_in = ad_inlist( ml->sml_desc, ri->ri_attrs );
+
+ /* skip if:
+ * 1) the attribute is not in the list,
+ * and it's not an exclusion list
+ * 2) the attribute is in the list
+ * and it's an exclusion list,
+ * and either the objectClass attribute
+ * has already been dealt with or
+ * this is not the objectClass attr
+ */
+ if ( ( !is_in && !ri->ri_exclude )
+ || ( ( is_in && ri->ri_exclude )
+ && ( !ocs || ml->sml_desc != slap_schema.si_ad_objectClass ) ) )
+ {
+ continue;
+ }
+
+ /* If this is objectClass, see if the value is included
+ * in any subset, otherwise drop it.
+ */
+ if ( ocs && ml->sml_desc == slap_schema.si_ad_objectClass
+ && ml->sml_values )
+ {
+ int i, first = 1;
+
+ if ( ocs == -1 ) ocs = 0;
+
+ for ( i=0; ml->sml_values[i].bv_val; i++ ) {
+ int match = 0;
+ for ( an = ri->ri_attrs; an->an_name.bv_val; an++ ) {
+ if ( an->an_oc ) {
+ struct berval bv = an->an_name;
+
+ ocs = 1;
+ match |= an->an_oc_exclude;
+
+ switch ( bv.bv_val[ 0 ] ) {
+ case '@':
+ case '+':
+ case '!':
+ bv.bv_val++;
+ bv.bv_len--;
+ break;
+ }
+
+ if ( ml->sml_values[i].bv_len == bv.bv_len
+ && !strcasecmp(ml->sml_values[i].bv_val,
+ bv.bv_val ) )
+ {
+ match = !an->an_oc_exclude;
+ break;
+ }
+ }
+ }
+ /* Objectclasses need no special treatment, drop into
+ * regular processing
+ */
+ if ( !ocs ) break;
+
+ match ^= ri->ri_exclude;
+ /* Found a match, log it */
+ if ( match ) {
+ if ( dohdr ) {
+ rephdr( ri, op, fp, now );
+ fprintf( fp, "changetype: modify\n" );
+ dohdr = 0;
+ }
+ if ( first ) {
+ fprintf( fp, "%s: %s\n", did, type );
+ first = 0;
+ }
+ vals[0] = ml->sml_values[i];
+ print_vals( fp, &ml->sml_desc->ad_cname, vals );
+ ocs = 2;
+ }