summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-05-13 21:08:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:06:00 -0500
commitaa7a02d45fefad3640f273b1d3bfe535a1e6b88c (patch)
tree548f2e54edc24c21984c11deed35813b015a3809 /source4/lib/ldb
parent3064782735e927de63cdfa34a19c95a9d099a82a (diff)
downloadsamba-aa7a02d45fefad3640f273b1d3bfe535a1e6b88c.tar.gz
samba-aa7a02d45fefad3640f273b1d3bfe535a1e6b88c.tar.bz2
samba-aa7a02d45fefad3640f273b1d3bfe535a1e6b88c.zip
r15582: Commit some forgotten stuff that have been setting on my private tree fro long
(This used to be commit 7c050b541e98cd442a0c9ed0ddadb3e573cd1304)
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/common/ldb_msg.c17
-rw-r--r--source4/lib/ldb/include/ldb.h8
2 files changed, 23 insertions, 2 deletions
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index f76d7e8dd9..b09f2ce6ed 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -724,3 +724,20 @@ void ldb_dump_results(struct ldb_context *ldb, struct ldb_result *result, FILE *
}
}
+int ldb_msg_check_string_attribute(const struct ldb_message *msg, const char *name, const char *value)
+{
+ struct ldb_message_element *el;
+ struct ldb_val val;
+
+ el = ldb_msg_find_element(msg, name);
+ if (el == NULL)
+ return 0;
+
+ val.data = discard_const(value);
+ val.length = strlen(value) + 1;
+
+ if (ldb_msg_find_val(el, &val))
+ return 1;
+
+ return 0;
+}
diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h
index af3aed24c6..866b062d06 100644
--- a/source4/lib/ldb/include/ldb.h
+++ b/source4/lib/ldb/include/ldb.h
@@ -625,11 +625,11 @@ struct ldb_search {
};
struct ldb_add {
- const struct ldb_message *message;
+ struct ldb_message *message;
};
struct ldb_modify {
- const struct ldb_message *message;
+ struct ldb_message *message;
};
struct ldb_delete {
@@ -1178,6 +1178,10 @@ struct ldb_message *ldb_msg_diff(struct ldb_context *ldb,
struct ldb_message *msg1,
struct ldb_message *msg2);
+int ldb_msg_check_string_attribute(const struct ldb_message *msg,
+ const char *name,
+ const char *value);
+
/**
Integrity check an ldb_message