summaryrefslogtreecommitdiffstats
path: root/src/wrap.c
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@redhat.com>2010-11-22 14:46:54 -0500
committerNalin Dahyabhai <nalin@redhat.com>2010-11-22 14:46:54 -0500
commite5d73bacd1db958ffe62f8d3a09d085929d0cbdc (patch)
tree2c2aaacd1b7acc498dcb7dd0af9d54433c1ccc4b /src/wrap.c
parent321b42f6a03724c6ba00d00be7c70960ab446606 (diff)
downloadslapi-nis-e5d73bacd1db958ffe62f8d3a09d085929d0cbdc.tar.gz
slapi-nis-e5d73bacd1db958ffe62f8d3a09d085929d0cbdc.tar.xz
slapi-nis-e5d73bacd1db958ffe62f8d3a09d085929d0cbdc.zip
- 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/wrap.c')
-rw-r--r--src/wrap.c20
1 files changed, 10 insertions, 10 deletions
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;