svn commit: samba r16086 - in
branches/SAMBA_4_0/source/lib/ldb/common: .
abartlet at samba.org
abartlet at samba.org
Thu Jun 8 01:00:47 GMT 2006
Author: abartlet
Date: 2006-06-08 01:00:46 +0000 (Thu, 08 Jun 2006)
New Revision: 16086
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16086
Log:
Ensure we can never dereference NULL pointers, and that describe what
these two DN comparison functions do.
Andrew Bartlett
Modified:
branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c
Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c 2006-06-08 00:58:57 UTC (rev 16085)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c 2006-06-08 01:00:46 UTC (rev 16086)
@@ -478,23 +478,25 @@
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 @@
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)
More information about the samba-cvs
mailing list