summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/back-nis.c2
-rw-r--r--src/back-shr.c6
-rw-r--r--src/format.c98
-rw-r--r--src/wrap.c20
-rw-r--r--src/wrap.h4
5 files changed, 21 insertions, 109 deletions
diff --git a/src/back-nis.c b/src/back-nis.c
index 591ca0b..5a00ebd 100644
--- a/src/back-nis.c
+++ b/src/back-nis.c
@@ -726,7 +726,7 @@ backend_update_params(struct plugin_state *state)
state->plugin_base ? "\"" : "");
return;
}
- wrap_search_internal_get_entry(our_dn, NULL, &our_entry,
+ wrap_search_internal_get_entry(our_dn, NULL, NULL, &our_entry,
state->plugin_identity);
slapi_sdn_free(&our_dn);
our_dn = NULL;
diff --git a/src/back-shr.c b/src/back-shr.c
index 6a54789..25bb14c 100644
--- a/src/back-shr.c
+++ b/src/back-shr.c
@@ -86,7 +86,7 @@ backend_shr_read_server_name(struct plugin_state *state, char **master)
return -1;
}
config = NULL;
- wrap_search_internal_get_entry(config_dn, attrs, &config,
+ wrap_search_internal_get_entry(config_dn, NULL, attrs, &config,
state->plugin_identity);
if (config == NULL) {
slapi_log_error(SLAPI_LOG_PLUGIN,
@@ -255,7 +255,7 @@ backend_shr_set_config_entry_set_one_dn(struct plugin_state *state,
return;
} else {
entry = NULL;
- wrap_search_internal_get_entry(sdn, NULL, &entry,
+ wrap_search_internal_get_entry(sdn, NULL, NULL, &entry,
state->plugin_identity);
if (entry == NULL) {
slapi_log_error(SLAPI_LOG_PLUGIN,
@@ -1138,6 +1138,7 @@ backend_shr_update_references_cb(const char *group, const char *set,
* attribute in the entry. */
values = NULL;
wrap_search_internal_get_entry(these_entries[k],
+ NULL,
these_attrs,
&this_entry,
state->plugin_identity);
@@ -1200,6 +1201,7 @@ backend_shr_update_references_cb(const char *group, const char *set,
* attribute in the entry. */
values = NULL;
wrap_search_internal_get_entry(these_entries[k],
+ NULL,
next_attrs,
&this_entry,
state->plugin_identity);
diff --git a/src/format.c b/src/format.c
index 6285f5b..4e0b2c9 100644
--- a/src/format.c
+++ b/src/format.c
@@ -392,71 +392,6 @@ format_add_ref_attr_list(struct format_ref_attr_list ***list,
return ret;
}
-/* Maintain an entry list. The list takes ownership of entries which are
- * added to it. */
-struct entry_list {
- Slapi_Entry *entry;
- struct entry_list *next;
-};
-static struct entry_list *
-format_entry_list_remove_one(struct entry_list *list)
-{
- struct entry_list *next;
- if (list == NULL) {
- next = NULL;
- } else {
- next = list->next;
- slapi_entry_free(list->entry);
- free(list);
- }
- return next;
-}
-static struct entry_list *
-format_add_entry_list(struct entry_list *list, Slapi_Entry *entry)
-{
- struct entry_list *next, *tail;
- next = malloc(sizeof(*next));
- if (next == NULL) {
- return list;
- } else {
- next->entry = entry;
- next->next = NULL;
- if (list == NULL) {
- return next;
- } else {
- for (tail = list;
- tail->next != NULL;
- tail = tail->next) {
- continue;
- }
- tail->next = next;
- return list;
- }
- }
-}
-static struct entry_list *
-format_add_entry_list_dn(struct entry_list *list,
- const char *dn, char **attributes,
- void *plugin_identity)
-{
- Slapi_Entry *entry;
- Slapi_DN *sdn;
- sdn = slapi_sdn_new_dn_byval(dn);
- if (sdn != NULL) {
- entry = NULL;
- wrap_search_internal_get_entry(sdn, attributes, &entry,
- plugin_identity);
- slapi_sdn_free(&sdn);
- if (entry != NULL) {
- return format_add_entry_list(list, entry);
- } else {
- return list;
- }
- } else {
- return NULL;
- }
-}
-
/* Maintain an attribute list, which is really just a string list. Entries
* named by an attribute in the list carry "interesting" information. */
char **
@@ -1008,7 +943,7 @@ format_deref(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,
continue;
}
ref = NULL;
- wrap_search_internal_get_entry(refdn, attrs, &ref,
+ wrap_search_internal_get_entry(refdn, NULL, attrs, &ref,
state->plugin_identity);
if (ref == NULL) {
slapi_log_error(SLAPI_LOG_PLUGIN,
@@ -1120,7 +1055,9 @@ format_deref_rx(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,
slapi_dn_parent(dn));
/* Pull up the named entry. */
entry = NULL;
- wrap_search_internal_get_entry(these[j], attrs, &entry,
+ wrap_search_internal_get_entry(these[j],
+ list->links[i].filter_str,
+ attrs, &entry,
state->plugin_identity);
if (entry == NULL) {
slapi_log_error(SLAPI_LOG_PLUGIN,
@@ -1136,33 +1073,6 @@ format_deref_rx(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,
"\"%s\" (%d)\n", fname,
slapi_sdn_get_dn(these[j]), i);
}
- /* If we were given filters, test this entry against
- * the right filter. */
- if (list->links[i].filter != NULL) {
- if (slapi_filter_test(pb, entry,
- list->links[i].filter,
- 0) != 0) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- state->plugin_desc->spd_id,
- "%s: entry \"%s\" does "
- "not match filter "
- "\"%s\"\n",
- fname,
- slapi_entry_get_dn(entry),
- filters[i]);
- slapi_entry_free(entry);
- continue;
- } else {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- state->plugin_desc->spd_id,
- "%s: entry \"%s\" "
- "matches filter "
- "\"%s\"\n",
- fname,
- slapi_entry_get_dn(entry),
- filters[i]);
- }
- }
/* Pull up the value set. */
if (slapi_vattr_values_get(entry, attrs[0], &values,
&disposition,
diff --git a/src/wrap.c b/src/wrap.c
index c6062f8..a7a64ff 100644
--- a/src/wrap.c
+++ b/src/wrap.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Red Hat, Inc.
+ * Copyright 2008,2010 Red Hat, Inc.
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -233,7 +233,6 @@ wrap_rwlock_unlock(struct wrapped_rwlock *rwlock)
#endif
}
-#ifndef HAVE_SLAPI_SEARCH_INTERNAL_GET_ENTRY
static int
wrap_search_internal_get_entry_cb(Slapi_Entry *e, void *cb)
{
@@ -244,32 +243,33 @@ wrap_search_internal_get_entry_cb(Slapi_Entry *e, void *cb)
*ret = slapi_entry_dup(e);
return 0;
}
-#endif
int
-wrap_search_internal_get_entry(Slapi_DN *dn, char **attrs,
+wrap_search_internal_get_entry(Slapi_DN *dn, char *filter, char **attrs,
Slapi_Entry **ret_entry, void *caller_id)
{
-#ifdef HAVE_SLAPI_SEARCH_INTERNAL_GET_ENTRY
- return slapi_search_internal_get_entry(dn, attrs, ret_entry, caller_id);
-#else
Slapi_PBlock *pb;
int ret;
+#ifdef HAVE_SLAPI_SEARCH_INTERNAL_GET_ENTRY
+ if (filter == NULL) {
+ return slapi_search_internal_get_entry(dn, attrs,
+ ret_entry, caller_id);
+ }
+#endif
*ret_entry = NULL;
pb = slapi_pblock_new();
if (pb == NULL) {
return -1;
}
slapi_search_internal_set_pb(pb, slapi_sdn_get_dn(dn), LDAP_SCOPE_BASE,
- "(objectClass=*)", attrs, FALSE,
- NULL, NULL, caller_id, 0);
+ filter ? filter : "(objectClass=*)", attrs,
+ FALSE, NULL, NULL, caller_id, 0);
ret = slapi_search_internal_callback_pb(pb, ret_entry,
NULL,
wrap_search_internal_get_entry_cb,
NULL);
slapi_pblock_destroy(pb);
return ret;
-#endif
}
static __thread int call_level = 0;
diff --git a/src/wrap.h b/src/wrap.h
index 211a22e..2d25a02 100644
--- a/src/wrap.h
+++ b/src/wrap.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Red Hat, Inc.
+ * Copyright 2008,2010 Red Hat, Inc.
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ void wrap_rwlock_rdlock(struct wrapped_rwlock *rwlock);
void wrap_rwlock_wrlock(struct wrapped_rwlock *rwlock);
void wrap_rwlock_unlock(struct wrapped_rwlock *rwlock);
-int wrap_search_internal_get_entry(Slapi_DN *dn, char **attrs,
+int wrap_search_internal_get_entry(Slapi_DN *dn, char *filter, char **attrs,
Slapi_Entry **ret_entry, void *caller_id);
int wrap_get_call_level(void);
int wrap_inc_call_level(void);