|
|
94cced |
From 59198a21f15d310ad693f8b8cbd0df9595234ef5 Mon Sep 17 00:00:00 2001
|
|
|
eeac78 |
From: Alexander Bokovoy <abokovoy@redhat.com>
|
|
|
eeac78 |
Date: Tue, 14 Oct 2014 17:25:46 +0300
|
|
|
94cced |
Subject: [PATCH] Use slapi_entry_find_attr instead of slapi_entry_attr_exists
|
|
|
eeac78 |
|
|
|
eeac78 |
To keep slapi-nis code portable to older versions of 389-ds-base,
|
|
|
eeac78 |
avoid using slapi_entry_attr_exists() as it was only introduced in
|
|
|
eeac78 |
389-ds-base 1.3.3.0.
|
|
|
eeac78 |
---
|
|
|
94cced |
src/back-sch-idview.c | 3 ++-
|
|
|
94cced |
src/back-sch.c | 7 ++++++-
|
|
|
94cced |
2 files changed, 8 insertions(+), 2 deletions(-)
|
|
|
eeac78 |
|
|
|
94cced |
diff --git a/src/back-sch-idview.c b/src/back-sch-idview.c
|
|
|
94cced |
index f1150cd..93fbab5 100644
|
|
|
94cced |
--- a/src/back-sch-idview.c
|
|
|
94cced |
+++ b/src/back-sch-idview.c
|
|
|
94cced |
@@ -157,6 +157,7 @@ idview_process_overrides(struct backend_search_cbdata *cbdata,
|
|
|
94cced |
/* 2. If there is indeed an override, replace attribute values except for the ones that should be ignored */
|
|
|
94cced |
if (override_entry != NULL) {
|
|
|
94cced |
Slapi_Attr *override_attr = NULL;
|
|
|
94cced |
+ Slapi_Attr *sattr = NULL;
|
|
|
94cced |
|
|
|
94cced |
result = slapi_entry_first_attr(override_entry, &override_attr);
|
|
|
94cced |
while (result == 0) {
|
|
|
94cced |
@@ -173,7 +174,7 @@ idview_process_overrides(struct backend_search_cbdata *cbdata,
|
|
|
94cced |
if (filterout_attrs[i] == NULL) {
|
|
|
94cced |
/* Replace the attribute's value with the override or
|
|
|
94cced |
* add an override value if the attribute didn't exist */
|
|
|
94cced |
- result = slapi_entry_attr_exists(entry, override_type);
|
|
|
94cced |
+ result = slapi_entry_attr_find(entry, override_type, &sattr);
|
|
|
94cced |
if (result == 1) {
|
|
|
94cced |
result = slapi_entry_attr_delete(entry, override_type);
|
|
|
94cced |
}
|
|
|
eeac78 |
diff --git a/src/back-sch.c b/src/back-sch.c
|
|
|
94cced |
index 2388d2f..d0ed323 100644
|
|
|
eeac78 |
--- a/src/back-sch.c
|
|
|
eeac78 |
+++ b/src/back-sch.c
|
|
|
eeac78 |
@@ -997,9 +997,11 @@ backend_search_entry_cb(const char *domain, const char *map, bool_t secure,
|
|
|
eeac78 |
{
|
|
|
eeac78 |
Slapi_DN *sdn;
|
|
|
eeac78 |
Slapi_Entry *entry;
|
|
|
eeac78 |
+ Slapi_Attr *attr = NULL;
|
|
|
eeac78 |
struct backend_search_cbdata *cbdata;
|
|
|
eeac78 |
struct backend_entry_data *entry_data;
|
|
|
eeac78 |
int result;
|
|
|
eeac78 |
+ bool_t is_attr_exists = FALSE;
|
|
|
eeac78 |
|
|
|
eeac78 |
cbdata = cb_data;
|
|
|
eeac78 |
entry_data = backend_data;
|
|
|
eeac78 |
@@ -1042,7 +1044,10 @@ backend_search_entry_cb(const char *domain, const char *map, bool_t secure,
|
|
|
eeac78 |
idview_process_overrides(cbdata, key, map, domain, entry);
|
|
|
eeac78 |
}
|
|
|
eeac78 |
|
|
|
eeac78 |
- if (slapi_entry_attr_exists(entry, IPA_IDVIEWS_ATTR_ANCHORUUID) == 1) {
|
|
|
eeac78 |
+ /* slapi_entry_attr_exists() was introduced only in https://fedorahosted.org/389/ticket/47710 */
|
|
|
eeac78 |
+ is_attr_exists = slapi_entry_attr_find(entry, IPA_IDVIEWS_ATTR_ANCHORUUID, &attr) == 0;
|
|
|
eeac78 |
+
|
|
|
eeac78 |
+ if (is_attr_exists == TRUE) {
|
|
|
eeac78 |
slapi_entry_attr_delete(entry, IPA_IDVIEWS_ATTR_ANCHORUUID);
|
|
|
eeac78 |
slapi_entry_delete_string(entry, "objectClass", "ipaOverrideTarget");
|
|
|
eeac78 |
}
|
|
|
eeac78 |
--
|
|
|
eeac78 |
2.1.0
|
|
|
eeac78 |
|