summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-10-28 07:05:32 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:45:26 -0500
commit804cf59a489dd41a83fda56acfec4e9f561b1245 (patch)
tree108d4ccecf33e1c284c80bf304906f9b5d288359 /source4/lib/ldb/common
parentc5b99e3c696939f432b865e938caf31439385edf (diff)
downloadsamba-804cf59a489dd41a83fda56acfec4e9f561b1245.tar.gz
samba-804cf59a489dd41a83fda56acfec4e9f561b1245.tar.bz2
samba-804cf59a489dd41a83fda56acfec4e9f561b1245.zip
r11364: added a ldb_attr_dn() function for testing if an attribute name is
"dn" or "distinguishedName". This makes us a bit more consistent (This used to be commit b41b374b55f9a056c47ffa2ff88aa5272dbc42fc)
Diffstat (limited to 'source4/lib/ldb/common')
-rw-r--r--source4/lib/ldb/common/ldb_match.c6
-rw-r--r--source4/lib/ldb/common/ldb_utf8.c12
2 files changed, 14 insertions, 4 deletions
diff --git a/source4/lib/ldb/common/ldb_match.c b/source4/lib/ldb/common/ldb_match.c
index 7573cfc808..84f051f497 100644
--- a/source4/lib/ldb/common/ldb_match.c
+++ b/source4/lib/ldb/common/ldb_match.c
@@ -87,8 +87,7 @@ static int ldb_match_present(struct ldb_context *ldb,
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 @@ static int ldb_match_equality(struct ldb_context *ldb,
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) {
diff --git a/source4/lib/ldb/common/ldb_utf8.c b/source4/lib/ldb/common/ldb_utf8.c
index 61334bce09..a0aad12658 100644
--- a/source4/lib/ldb/common/ldb_utf8.c
+++ b/source4/lib/ldb/common/ldb_utf8.c
@@ -80,3 +80,15 @@ int ldb_attr_cmp(const char *attr1, const char *attr2)
{
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;
+}