summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-08-17 08:31:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:15:39 -0500
commit7de75a991bda653497a0989de93608310b55894a (patch)
treea672da526817cded9f620511ca02d92f34f3a3ad /source4/lib/ldb/common
parent9f7da6fea0bc9a330f8620d100e27d4eabbae253 (diff)
downloadsamba-7de75a991bda653497a0989de93608310b55894a.tar.gz
samba-7de75a991bda653497a0989de93608310b55894a.tar.bz2
samba-7de75a991bda653497a0989de93608310b55894a.zip
r17580: Add a new tools to convert back from AD-like schema to OpenLDAP.
Add attribute syntax mapping to the existing OpenLDAP -> AD tool. Andrew Bartlett (This used to be commit ba1c652bae700a82acde166e70035d61c320e233)
Diffstat (limited to 'source4/lib/ldb/common')
-rw-r--r--source4/lib/ldb/common/ldb_msg.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index 2cbfc2467a..d40dcde010 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -366,6 +366,23 @@ double ldb_msg_find_attr_as_double(const struct ldb_message *msg,
return strtod((const char *)v->data, NULL);
}
+int ldb_msg_find_attr_as_bool(const struct ldb_message *msg,
+ const char *attr_name,
+ int default_value)
+{
+ const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
+ if (!v || !v->data) {
+ return default_value;
+ }
+ if (strcasecmp(v->data, "FALSE") == 0) {
+ return 0;
+ }
+ if (strcasecmp(v->data, "TRUE") == 0) {
+ return 1;
+ }
+ return default_value;
+}
+
const char *ldb_msg_find_attr_as_string(const struct ldb_message *msg,
const char *attr_name,
const char *default_value)