diff options
| author | Nalin Dahyabhai <nalin@redhat.com> | 2010-11-22 14:46:54 -0500 |
|---|---|---|
| committer | Nalin Dahyabhai <nalin@redhat.com> | 2010-11-22 14:46:54 -0500 |
| commit | e5d73bacd1db958ffe62f8d3a09d085929d0cbdc (patch) | |
| tree | 2c2aaacd1b7acc498dcb7dd0af9d54433c1ccc4b /src/format.c | |
| parent | 321b42f6a03724c6ba00d00be7c70960ab446606 (diff) | |
- teach wrap_search_internal_get_entry to take an optional filter
- where we were applying a filter test after retrieving an entry, just
let the retrieval function do it
Diffstat (limited to 'src/format.c')
| -rw-r--r-- | src/format.c | 98 |
1 files changed, 4 insertions, 94 deletions
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, |
