return NULL;
}
-/* compare DNs using casefolding compare functions */
+/* Determine if dn is below base, in the ldap tree. Used for
+ * evaluating a subtree search.
+ * 0 if they match, otherwise non-zero
+ */
int ldb_dn_compare_base(struct ldb_context *ldb,
- const struct ldb_dn *base,
- const struct ldb_dn *dn)
+ const struct ldb_dn *base,
+ const struct ldb_dn *dn)
{
int ret;
int n0, n1;
+ if (base == NULL || base->comp_num == 0) return 0;
+ if (dn == NULL || dn->comp_num == 0) return -1;
+
if (base->comp_num > dn->comp_num) {
return (dn->comp_num - base->comp_num);
}
- if (base == NULL || base->comp_num == 0) return 0;
- if (dn == NULL || dn->comp_num == 0) return -1;
- if (base->comp_num > dn->comp_num) return -1;
-
/* if the number of components doesn't match they differ */
n0 = base->comp_num - 1;
n1 = dn->comp_num - 1;
return 0;
}
+/* compare DNs using casefolding compare functions.
+
+ If they match, then return 0
+ */
+
int ldb_dn_compare(struct ldb_context *ldb,
const struct ldb_dn *edn0,
const struct ldb_dn *edn1)
struct ldb_dn_component dc;
const struct ldb_attrib_handler *h;
- dc.name = ldb_casefold(ldb, cedn, edn->components[i].name);
+ dc.name = ldb_attr_casefold(cedn, edn->components[i].name);
LDB_DN_NULL_FAILED(dc.name);
h = ldb_attrib_handler(ldb, dc.name);
/* copy specified number of elements of a dn into a new one
element are copied from top level up to the unique rdn
- num_el may be greater then dn->comp_num (see ldb_dn_make_child)
+ num_el may be greater than dn->comp_num (see ldb_dn_make_child)
*/
struct ldb_dn *ldb_dn_copy_partial(void *mem_ctx, const struct ldb_dn *dn, int num_el)
{