summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-06-19 14:00:31 +0200
committerVolker Lendecke <vl@samba.org>2009-06-20 18:54:06 +0200
commit6abd9e42ffbda78a3bc28984b220e7bd726a324b (patch)
tree85c159dd9999469f239ac5ab9b43d8940a824b16 /source3
parentd45cf0146b62bf196ff207cd1ec52bbc39ef67ca (diff)
downloadsamba-6abd9e42ffbda78a3bc28984b220e7bd726a324b.tar.gz
samba-6abd9e42ffbda78a3bc28984b220e7bd726a324b.tar.bz2
samba-6abd9e42ffbda78a3bc28984b220e7bd726a324b.zip
Add tldap_entry_has_attrvalue
Diffstat (limited to 'source3')
-rw-r--r--source3/include/tldap_util.h4
-rw-r--r--source3/lib/tldap_util.c18
2 files changed, 22 insertions, 0 deletions
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<num_values; i++) {
+ if (data_blob_cmp(&values[i], &blob) == 0) {
+ return true;
+ }
+ }
+ return false;
+}