+ oldbv = bv_undefined;
+ newbv = bv_F;
+
+
+ } else if ( strncmp( ptr, bv_oc.bv_val, bv_oc.bv_len ) == 0 )
+ {
+ char *end;
+
+ /* if undef or invalid filter is not allowed,
+ * don't rewrite filter */
+ if ( LDAP_BACK_NOUNDEFFILTER( li ) ) {
+err_oc:;
+ if ( filter->bv_val != op->ors_filterstr.bv_val ) {
+ op->o_tmpfree( filter->bv_val, op->o_tmpmemctx );
+ }
+ BER_BVZERO( filter );
+ gotit = -1;
+ goto done;
+ }
+
+ oldbv.bv_val = ptr;
+ end = strchr( oldbv.bv_val, ')' );
+ if ( end == NULL ) {
+ goto err_oc;
+ }
+ end++;
+ oldbv.bv_len = end - oldbv.bv_val;
+
+ newbv.bv_len = oldbv.bv_len - 1;
+ newbv.bv_val = op->o_tmpalloc( newbv.bv_len + 1, op->o_tmpmemctx );
+ newbv.bv_val[0] = '(';
+ AC_MEMCPY( &newbv.bv_val[1], &oldbv.bv_val[2], newbv.bv_len );
+ free_newbv = 1;