hyc@OpenLDAP.org wrote:
unique.c 1.24 -> 1.25
Enhanced unique configuration
The unique_modify() change is wrong. Originally noticed
it because gcc -Wformat complained, but there is more.
Two sprintfs without the destination buffer argument, presumably it
should be 'kp'. You initialize kp after a sprintf statement which I
assume uses it. And the statements seem in wrong order. A suggested
patch is appended - though note that I haven't actually looked at the
logic of the function, just a brief glance on what seems to make the
filter creation code look sensible.
--
Regards,
Hallvard
--- servers/slapd/overlays/unique.c~
+++ servers/slapd/overlays/unique.c
@@ -1143,7 +1143,7 @@
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, "(|");
+ if ( uri->filter && uri->filter->bv_len )
+ kp += sprintf(kp, "(&(%s)", uri->filter->bv_val);
for(m = op->orm_modlist; m; m = m->sml_next)
@@ -1157,7 +1157,7 @@
op->o_tmpmemctx );
- kp += sprintf (kp, ")");
if ( uri->filter && uri->filter->bv_len )
kp += sprintf (kp, ")");
+ kp += sprintf (kp, ")");
rc = unique_search ( op,
@@ -1260,7 +1260,7 @@
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, "(|");
+ if ( uri->filter && uri->filter->bv_len )
+ kp += sprintf(kp, "(&(%s)", uri->filter->bv_val);
for ( i=0; newrdn[i]; i++) {
@@ -1274,7 +1274,7 @@
}
- kp += sprintf(kp, ")");
if ( uri->filter && uri->filter->bv_len )
kp += sprintf (kp, ")");
+ kp += sprintf(kp, ")");
rc = unique_search ( op,