svn commit: samba r11364 - in branches/SAMBA_4_0/source/lib/ldb:
common include ldb_tdb
tridge at samba.org
tridge at samba.org
Fri Oct 28 07:05:33 GMT 2005
Author: tridge
Date: 2005-10-28 07:05:32 +0000 (Fri, 28 Oct 2005)
New Revision: 11364
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11364
Log:
added a ldb_attr_dn() function for testing if an attribute name is
"dn" or "distinguishedName". This makes us a bit more consistent
Modified:
branches/SAMBA_4_0/source/lib/ldb/common/ldb_match.c
branches/SAMBA_4_0/source/lib/ldb/common/ldb_utf8.c
branches/SAMBA_4_0/source/lib/ldb/include/ldb.h
branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c
Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_match.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_match.c 2005-10-28 07:00:52 UTC (rev 11363)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_match.c 2005-10-28 07:05:32 UTC (rev 11364)
@@ -87,8 +87,7 @@
struct ldb_parse_tree *tree,
enum ldb_scope scope)
{
-
- if (ldb_attr_cmp(tree->u.present.attr, "distinguishedName") == 0) {
+ if (ldb_attr_dn(tree->u.present.attr) == 0) {
return 1;
}
@@ -151,8 +150,7 @@
struct ldb_dn *valuedn;
int ret;
- if (ldb_attr_cmp(tree->u.equality.attr, "dn") == 0 ||
- ldb_attr_cmp(tree->u.equality.attr, "distinguishedName") == 0) {
+ if (ldb_attr_dn(tree->u.equality.attr) == 0) {
valuedn = ldb_dn_explode_casefold(ldb,
(char *)tree->u.equality.value.data);
if (valuedn == NULL) {
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_utf8.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_utf8.c 2005-10-28 07:00:52 UTC (rev 11363)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_utf8.c 2005-10-28 07:05:32 UTC (rev 11364)
@@ -80,3 +80,15 @@
{
return ldb_caseless_cmp(attr1, attr2);
}
+
+/*
+ we accept either 'dn' or 'distinguishedName' for a distinguishedName
+*/
+int ldb_attr_dn(const char *attr)
+{
+ if (ldb_attr_cmp(attr, "dn") == 0 ||
+ ldb_attr_cmp(attr, "distinguishedName") == 0) {
+ return 0;
+ }
+ return -1;
+}
Modified: branches/SAMBA_4_0/source/lib/ldb/include/ldb.h
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/include/ldb.h 2005-10-28 07:00:52 UTC (rev 11363)
+++ branches/SAMBA_4_0/source/lib/ldb/include/ldb.h 2005-10-28 07:05:32 UTC (rev 11364)
@@ -391,7 +391,8 @@
/* useful functions for ldb_message structure manipulation */
int ldb_dn_cmp(struct ldb_context *ldb, const char *dn1, const char *dn2);
-int ldb_attr_cmp(const char *dn1, const char *dn2);
+int ldb_attr_cmp(const char *attr1, const char *attr2);
+int ldb_attr_dn(const char *attr);
char *ldb_dn_escape_value(void *mem_ctx, struct ldb_val value);
/* create an empty message */
Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c 2005-10-28 07:00:52 UTC (rev 11363)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c 2005-10-28 07:05:32 UTC (rev 11364)
@@ -321,8 +321,7 @@
if (ldb_attr_cmp(tree->u.equality.attr, LTDB_OBJECTCLASS) == 0) {
return ltdb_index_dn_objectclass(module, tree, index_list, list);
}
- if (ldb_attr_cmp(tree->u.equality.attr, "distinguishedName") == 0 ||
- ldb_attr_cmp(tree->u.equality.attr, "dn") == 0) {
+ if (ldb_attr_dn(tree->u.equality.attr) == 0) {
list->dn = talloc_array(list, char *, 1);
if (list->dn == NULL) {
ldb_oom(module->ldb);
More information about the samba-cvs
mailing list