summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-07-08 17:03:54 -0400
committerNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-07-08 17:03:54 -0400
commit2df2c77cf46d86a0324f23d21e707ac0dfba888d (patch)
tree1de364b992d2def615bcaced2223e4433ea06e78 /src
parent840ac9466dc183eab88f45a32271c5d254793f56 (diff)
downloadslapi-nis-2df2c77cf46d86a0324f23d21e707ac0dfba888d.tar.gz
slapi-nis-2df2c77cf46d86a0324f23d21e707ac0dfba888d.tar.xz
slapi-nis-2df2c77cf46d86a0324f23d21e707ac0dfba888d.zip
- don't pass a const string to str2entry
- perform the scope test for sets using a correctly-initialized container SDN
Diffstat (limited to 'src')
-rw-r--r--src/back-shr.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/back-shr.c b/src/back-shr.c
index 14d3d23..f8c7331 100644
--- a/src/back-shr.c
+++ b/src/back-shr.c
@@ -252,6 +252,7 @@ backend_shr_entry_matches(Slapi_PBlock *pb, Slapi_Entry *e,
{
Slapi_DN *entry_sdn, *containing_sdn;
Slapi_Filter *filter;
+ char *filterstr;
bool_t ret;
/* First, just do the scope test. The item should be a somewhere
@@ -260,7 +261,7 @@ backend_shr_entry_matches(Slapi_PBlock *pb, Slapi_Entry *e,
if (entry_sdn == NULL) {
return FALSE;
} else {
- containing_sdn = slapi_sdn_new_ndn_byval(containing_ndn);
+ containing_sdn = slapi_sdn_new_dn_byval(containing_ndn);
if (containing_sdn == NULL) {
slapi_sdn_free(&entry_sdn);
return FALSE;
@@ -277,12 +278,19 @@ backend_shr_entry_matches(Slapi_PBlock *pb, Slapi_Entry *e,
/* If it's actually in our configuration tree, check if it's a valid
* entry. */
if (ret) {
- filter = slapi_str2filter((char *) check_filter);
- if (filter != NULL) {
- if (slapi_vattr_filter_test(pb, e, filter, 0) != 0) {
- ret = FALSE;
+ /* N.B.: slapi_str2filter isn't kidding -- it really wants a
+ * writable string. */
+ filterstr = strdup(check_filter);
+ if (filterstr != NULL) {
+ filter = slapi_str2filter(filterstr);
+ if (filter != NULL) {
+ if (slapi_vattr_filter_test(pb, e,
+ filter, 0) != 0) {
+ ret = FALSE;
+ }
+ slapi_filter_free(filter, 1);
}
- slapi_filter_free(filter, 1);
+ free(filterstr);
}
}
return ret;