]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#8866 slapo-unique to return filter used in diagnostic message
authorMichael Ströder <michael@stroeder.com>
Wed, 20 Jun 2018 12:05:52 +0000 (14:05 +0200)
committerQuanah Gibson-Mount <quanah@openldap.org>
Fri, 26 Oct 2018 01:54:39 +0000 (01:54 +0000)
servers/slapd/overlays/unique.c

index 9e8d3e3a5f718167afd3b57531b833825b86179e..41c698f475c60bc6e25ff5345f31448a7587ef26 100644 (file)
@@ -965,6 +965,8 @@ unique_search(
        slap_callback cb = { NULL, NULL, NULL, NULL }; /* XXX */
        unique_counter uq = { NULL, 0 };
        int rc;
+       char *errmsg;
+       int errmsgsize;
 
        Debug(LDAP_DEBUG_TRACE, "==> unique_search %s\n", key->bv_val, 0, 0);
 
@@ -1009,9 +1011,12 @@ unique_search(
        Debug(LDAP_DEBUG_TRACE, "=> unique_search found %d records\n", uq.count, 0, 0);
 
        if(uq.count) {
+               errmsgsize = sizeof("non-unique attributes found with ") + key->bv_len;
+               errmsg = ch_malloc(errmsgsize);
+               snprintf( errmsg, errmsgsize, "non-unique attributes found with %s", key->bv_val );
                op->o_bd->bd_info = (BackendInfo *) on->on_info;
-               send_ldap_error(op, rs, LDAP_CONSTRAINT_VIOLATION,
-                       "some attributes not unique");
+               send_ldap_error(op, rs, LDAP_CONSTRAINT_VIOLATION, errmsg);
+               ch_free(errmsg);
                return(rs->sr_err);
        }