1
0
forked from pool/openldap2

Accepting request 644952 from network:ldap

OBS-URL: https://build.opensuse.org/request/show/644952
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/openldap2?expand=0&rev=138
This commit is contained in:
Dominique Leuenberger 2018-11-08 08:39:55 +00:00 committed by Git OBS Bridge
commit 21fa9202d0
2 changed files with 44 additions and 12 deletions

View File

@ -1,15 +1,15 @@
From 41458072b9aae81ebd7a45837c6ce376709fe907 Mon Sep 17 00:00:00 2001 From 348588561c694784a8106871b0d5fe578007ea4e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Str=C3=B6der?= <michael@stroeder.com> From: =?UTF-8?q?Michael=20Str=C3=B6der?= <michael@stroeder.com>
Date: Wed, 20 Jun 2018 14:05:52 +0200 Date: Fri, 26 Oct 2018 16:40:23 +0200
Subject: [PATCH] ITS#8866 slapo-unique to return filter used in diagnostic Subject: [PATCH] ITS#8866 slapo-unique to return filter used in diagnostic
message message
--- ---
servers/slapd/overlays/unique.c | 9 +++++++-- servers/slapd/overlays/unique.c | 27 +++++++++++++++++----------
1 file changed, 7 insertions(+), 2 deletions(-) 1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/servers/slapd/overlays/unique.c b/servers/slapd/overlays/unique.c diff --git a/servers/slapd/overlays/unique.c b/servers/slapd/overlays/unique.c
index 9e8d3e3a5..41c698f47 100644 index ed62d03b8..a7723cf5d 100644
--- a/servers/slapd/overlays/unique.c --- a/servers/slapd/overlays/unique.c
+++ b/servers/slapd/overlays/unique.c +++ b/servers/slapd/overlays/unique.c
@@ -965,6 +965,8 @@ unique_search( @@ -965,6 +965,8 @@ unique_search(
@ -21,21 +21,46 @@ index 9e8d3e3a5..41c698f47 100644
Debug(LDAP_DEBUG_TRACE, "==> unique_search %s\n", key->bv_val, 0, 0); Debug(LDAP_DEBUG_TRACE, "==> unique_search %s\n", key->bv_val, 0, 0);
@@ -1009,9 +1011,12 @@ unique_search( @@ -998,24 +1000,29 @@ unique_search(
Debug(LDAP_DEBUG_TRACE, "=> unique_search found %d records\n", uq.count, 0, 0); nop->o_bd = on->on_info->oi_origdb;
rc = nop->o_bd->be_search(nop, &nrs);
filter_free_x(nop, nop->ors_filter, 1);
- op->o_tmpfree( key->bv_val, op->o_tmpmemctx );
if(uq.count) { if(rc != LDAP_SUCCESS && rc != LDAP_NO_SUCH_OBJECT) {
op->o_bd->bd_info = (BackendInfo *) on->on_info;
send_ldap_error(op, rs, rc, "unique_search failed");
- return(rs->sr_err);
- }
-
- Debug(LDAP_DEBUG_TRACE, "=> unique_search found %d records\n", uq.count, 0, 0);
+ rc = rs->sr_err;
+ } else if(uq.count) {
+ 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; + errmsgsize = sizeof("non-unique attributes found with ") + key->bv_len;
+ errmsg = ch_malloc(errmsgsize); + errmsg = op->o_tmpalloc(errmsgsize, op->o_tmpmemctx);
+ snprintf( errmsg, errmsgsize, "non-unique attributes found with %s", key->bv_val ); + snprintf( errmsg, errmsgsize, "non-unique attributes found with %s", key->bv_val );
op->o_bd->bd_info = (BackendInfo *) on->on_info; op->o_bd->bd_info = (BackendInfo *) on->on_info;
- send_ldap_error(op, rs, LDAP_CONSTRAINT_VIOLATION, - send_ldap_error(op, rs, LDAP_CONSTRAINT_VIOLATION,
- "some attributes not unique"); - "some attributes not unique");
- return(rs->sr_err);
+ send_ldap_error(op, rs, LDAP_CONSTRAINT_VIOLATION, errmsg); + send_ldap_error(op, rs, LDAP_CONSTRAINT_VIOLATION, errmsg);
+ ch_free(errmsg); + op->o_tmpfree(errmsg, op->o_tmpmemctx);
return(rs->sr_err); + rc = rs->sr_err;
+ } else {
+ Debug(LDAP_DEBUG_TRACE, "=> unique_search found no records\n", 0, 0, 0);
+ rc = SLAP_CB_CONTINUE;
} }
- return(SLAP_CB_CONTINUE);
+ op->o_tmpfree( key->bv_val, op->o_tmpmemctx );
+
+ return(rc);
}
static int
-- --
2.17.1 2.19.1

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Oct 26 14:58:41 UTC 2018 - Michael Ströder <michael@stroeder.com>
- Fixed broken memory handling in
0001-ITS-8866-slapo-unique-to-return-filter-used-in-diagn.patch
affecting error response of slapo-unique
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Aug 17 07:46:47 UTC 2018 - ckowalczyk@suse.com Fri Aug 17 07:46:47 UTC 2018 - ckowalczyk@suse.com