- e = change;
- fprintf( fp, "changetype: add\n" );
- pthread_mutex_lock( &entry2str_mutex );
- tmp = entry2str( e, &len, 0 );
- while ( (tmp = strchr( tmp, '\n' )) != NULL ) {
- tmp++;
- if ( ! isspace( *tmp ) )
- break;
+ for ( a = op->ora_e->e_attrs ; a != NULL; a=a->a_next ) {
+ if ( ri && ri->ri_attrs ) {
+ int is_in = ad_inlist( a->a_desc, ri->ri_attrs );
+ if ( ( !is_in && !ri->ri_exclude ) || ( is_in && ri->ri_exclude ) ) {
+ continue;
+ }
+
+ /* If the list includes objectClass names,
+ * only include those classes in the
+ * objectClass attribute
+ */
+ if ( ocs && a->a_desc == slap_schema.si_ad_objectClass ) {
+ int i;
+
+ if ( ocs == -1 ) ocs = 0;
+
+ for ( i=0; a->a_vals[i].bv_val; i++ ) {
+ int match = 0;
+ for ( an = ri->ri_attrs; an->an_name.bv_val; an++ ) {
+ if ( an->an_oc ) {
+ ocs = 1;
+ match |= an->an_oc_exclude;
+ if ( a->a_vals[i].bv_len == an->an_name.bv_len
+ && !strcasecmp(a->a_vals[i].bv_val,
+ an->an_name.bv_val ) ) {
+ match = !an->an_oc_exclude;
+ break;
+ }
+ }
+ }
+ if ( !ocs ) break;
+
+ match ^= ri->ri_exclude;
+ if ( match ) {
+ if ( dohdr ) {
+ rephdr( ri, op, fp, now );
+ fprintf( fp, "changetype: add\n" );
+ dohdr = 0;
+ }
+ vals[0] = an->an_name;
+ print_vals( fp, &a->a_desc->ad_cname, vals );
+ }
+ }
+ if ( ocs ) continue;
+ }
+ }
+ if ( dohdr ) {
+ rephdr( ri, op, fp, now );
+ fprintf( fp, "changetype: add\n" );
+ dohdr = 0;
+ }
+ print_vals( fp, &a->a_desc->ad_cname, a->a_vals );