From 6abd9e42ffbda78a3bc28984b220e7bd726a324b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 19 Jun 2009 14:00:31 +0200 Subject: Add tldap_entry_has_attrvalue --- source3/include/tldap_util.h | 4 ++++ source3/lib/tldap_util.c | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/source3/include/tldap_util.h b/source3/include/tldap_util.h index 8869d1e9de..00916f51f3 100644 --- a/source3/include/tldap_util.h +++ b/source3/include/tldap_util.h @@ -61,4 +61,8 @@ int tldap_fetch_rootdse_recv(struct tevent_req *req); int tldap_fetch_rootdse(struct tldap_context *ld); struct tldap_message *tldap_rootdse(struct tldap_context *ld); +bool tldap_entry_has_attrvalue(struct tldap_message *msg, + const char *attribute, + const DATA_BLOB blob); + #endif diff --git a/source3/lib/tldap_util.c b/source3/lib/tldap_util.c index 3698264bd6..e217cccd0b 100644 --- a/source3/lib/tldap_util.c +++ b/source3/lib/tldap_util.c @@ -509,3 +509,21 @@ struct tldap_message *tldap_rootdse(struct tldap_context *ld) return talloc_get_type(tldap_context_getattr(ld, "tldap:rootdse"), struct tldap_message); } + +bool tldap_entry_has_attrvalue(struct tldap_message *msg, + const char *attribute, + const DATA_BLOB blob) +{ + int i, num_values; + DATA_BLOB *values; + + if (!tldap_entry_values(msg, attribute, &num_values, &values)) { + return false; + } + for (i=0; i