From 9c2a04b460f1972c258bb0d1fc124338e1d922a1 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Thu, 31 Oct 2013 08:01:17 +0100 Subject: ldb: Add SAMBA_LDAP_MATCH_ALWAYS_TRUE --- lib/ldb/common/ldb_match.c | 13 ++++++++++++- lib/ldb/include/ldb_module.h | 3 +++ source4/setup/schema_samba4.ldif | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/ldb/common/ldb_match.c b/lib/ldb/common/ldb_match.c index 7918aec65f..3087d34c46 100644 --- a/lib/ldb/common/ldb_match.c +++ b/lib/ldb/common/ldb_match.c @@ -395,6 +395,16 @@ static int ldb_comparator_false(const char *oid, const struct ldb_val *v1, const return LDB_SUCCESS; } +/* + always return true +*/ +static int ldb_comparator_true(const char *oid, const struct ldb_val *v1, const struct ldb_val *v2, + bool *matched) +{ + *matched = true; + return LDB_SUCCESS; +} + /* extended match, handles things like bitops @@ -411,7 +421,8 @@ static int ldb_match_extended(struct ldb_context *ldb, } rules[] = { { LDB_OID_COMPARATOR_AND, ldb_comparator_bitmask}, { LDB_OID_COMPARATOR_OR, ldb_comparator_bitmask}, - { SAMBA_LDAP_MATCH_ALWAYS_FALSE, ldb_comparator_false} + { SAMBA_LDAP_MATCH_ALWAYS_FALSE, ldb_comparator_false}, + { SAMBA_LDAP_MATCH_ALWAYS_TRUE, ldb_comparator_true} }; int (*comp)(const char *,const struct ldb_val *, const struct ldb_val *, bool *) = NULL; struct ldb_message_element *el; diff --git a/lib/ldb/include/ldb_module.h b/lib/ldb/include/ldb_module.h index be50c09210..20c2a0f316 100644 --- a/lib/ldb/include/ldb_module.h +++ b/lib/ldb/include/ldb_module.h @@ -55,6 +55,9 @@ struct ldb_module; /* an extended match rule that always fails to match */ #define SAMBA_LDAP_MATCH_ALWAYS_FALSE "1.3.6.1.4.1.7165.4.5.1" +/* an extended match rule that always matches */ +#define SAMBA_LDAP_MATCH_ALWAYS_TRUE "1.3.6.1.4.1.7165.4.5.2" + /* The const char * const * pointer to a list of secret (password) * attributes, not to be printed in trace messages */ #define LDB_SECRET_ATTRIBUTE_LIST_OPAQUE "LDB_SECRET_ATTRIBUTE_LIST" diff --git a/source4/setup/schema_samba4.ldif b/source4/setup/schema_samba4.ldif index 94aedb099d..69c5cbbe58 100644 --- a/source4/setup/schema_samba4.ldif +++ b/source4/setup/schema_samba4.ldif @@ -211,6 +211,7 @@ ############ # ldap extended matches #Allocated: SAMBA_LDAP_MATCH_ALWAYS_FALSE 1.3.6.1.4.1.7165.4.5.1 +#Allocated: SAMBA_LDAP_MATCH_ALWAYS_TRUE 1.3.6.1.4.1.7165.4.5.2 #Allocated: (middleName) attributeID: 1.3.6.1.4.1.7165.4.255.1 -- cgit