]> git.sur5r.net Git - openldap/commitdiff
Fix prev commit, filter construction with URI filters
authorHoward Chu <hyc@openldap.org>
Tue, 10 Apr 2007 02:38:54 +0000 (02:38 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 10 Apr 2007 02:38:54 +0000 (02:38 +0000)
servers/slapd/overlays/unique.c

index dd7c00514349f63439dfb32df4aa421ce6d92a80..5075d20db73a12ddc0f71999bdb835e4164d0114 100644 (file)
@@ -1139,12 +1139,12 @@ unique_modify(
                        if ( !ks ) continue;
 
                        if ( uri->filter && uri->filter->bv_len )
-                               ks += uri->filter->bv_len;
-                       key = op->o_tmpalloc(ks, op->o_tmpmemctx);
+                               ks += uri->filter->bv_len + STRLENOF ("(&)");
+                       kp = key = op->o_tmpalloc(ks, op->o_tmpmemctx);
 
                        if ( uri->filter && uri->filter->bv_len )
-                               kp += sprintf ("(&(%s)", uri->filter->bv_val);
-                       kp = key + sprintf(key, "(|");
+                               kp += sprintf (kp, "(&%s", uri->filter->bv_val);
+                       kp += sprintf(kp, "(|");
 
                        for(m = op->orm_modlist; m; m = m->sml_next)
                                if ( (m->sml_op & LDAP_MOD_OP)
@@ -1256,12 +1256,12 @@ unique_modrdn(
                        if ( !ks ) continue;
 
                        if ( uri->filter && uri->filter->bv_len )
-                               ks += uri->filter->bv_len;
-                       key = op->o_tmpalloc(ks, op->o_tmpmemctx);
+                               ks += uri->filter->bv_len + STRLENOF ("(&)");
+                       kp = key = op->o_tmpalloc(ks, op->o_tmpmemctx);
 
                        if ( uri->filter && uri->filter->bv_len )
-                               kp += sprintf ("(&(%s)", uri->filter->bv_val);
-                       kp = key + sprintf(key, "(|");
+                               kp += sprintf (kp, "(&%s", uri->filter->bv_val);
+                       kp += sprintf(kp, "(|");
 
                        for ( i=0; newrdn[i]; i++) {
                                bv[0] = newrdn[i]->la_value;