mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
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 b41b374b55
)
This commit is contained in:
parent
c5b99e3c69
commit
804cf59a48
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -391,7 +391,8 @@ struct ldb_dn_component *ldb_dn_get_rdn(void *mem_ctx, const struct ldb_dn *dn);
|
||||
|
||||
/* 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 */
|
||||
|
@ -321,8 +321,7 @@ static int ltdb_index_dn_leaf(struct ldb_module *module,
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user