r16100: Patch from Michael Wood <mwood@icts.uct.ac.za>: s/then/than/ for correct...
[kai/samba.git] / source / lib / ldb / common / ldb_dn.c
index bcd5a067a6366ef600d4239b97f6c9adcc855802..a659f676c6dca231d8c5411b41f7e51c112f2fb3 100644 (file)
@@ -478,23 +478,25 @@ failed:
        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;
@@ -522,6 +524,11 @@ int ldb_dn_compare_base(struct ldb_context *ldb,
        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)
@@ -581,7 +588,7 @@ struct ldb_dn *ldb_dn_casefold(struct ldb_context *ldb, const struct ldb_dn *edn
                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);
@@ -665,7 +672,7 @@ static struct ldb_dn_component ldb_dn_copy_component(void *mem_ctx, struct ldb_d
 
 /* 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)
 {