summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-06-08 20:36:49 +0200
committerVolker Lendecke <vl@samba.org>2009-06-08 21:14:10 +0200
commit9b42c5ca79b925fa01f9bd9e89de2c1061cf72ba (patch)
tree3fdf4d74aea33538fa507dcab8cd1529700a0938
parentaf82489b41c8fa621dc4c8abe5bfdf107b6bec43 (diff)
downloadsamba-9b42c5ca79b925fa01f9bd9e89de2c1061cf72ba.tar.gz
samba-9b42c5ca79b925fa01f9bd9e89de2c1061cf72ba.tar.bz2
samba-9b42c5ca79b925fa01f9bd9e89de2c1061cf72ba.zip
Add tlda_add_mod_str
-rw-r--r--source3/include/tldap_util.h2
-rw-r--r--source3/lib/tldap_util.c17
2 files changed, 19 insertions, 0 deletions
diff --git a/source3/include/tldap_util.h b/source3/include/tldap_util.h
index 1c993769d7..06b1036474 100644
--- a/source3/include/tldap_util.h
+++ b/source3/include/tldap_util.h
@@ -34,6 +34,8 @@ bool tldap_pull_binsid(struct tldap_message *msg, const char *attribute,
bool tldap_add_mod_blobs(TALLOC_CTX *mem_ctx, struct tldap_mod **pmods,
int mod_op, const char *attrib,
int num_values, DATA_BLOB *values);
+bool tldap_add_mod_str(TALLOC_CTX *mem_ctx, struct tldap_mod **pmods,
+ int mod_op, const char *attrib, const char *str);
bool tldap_make_mod_blob(struct tldap_message *existing, TALLOC_CTX *mem_ctx,
int *pnum_mods, struct tldap_mod **pmods,
const char *attrib, DATA_BLOB newval);
diff --git a/source3/lib/tldap_util.c b/source3/lib/tldap_util.c
index 1b0c3446ee..7c579162a5 100644
--- a/source3/lib/tldap_util.c
+++ b/source3/lib/tldap_util.c
@@ -172,6 +172,23 @@ bool tldap_add_mod_blobs(TALLOC_CTX *mem_ctx, struct tldap_mod **pmods,
return true;
}
+bool tldap_add_mod_str(TALLOC_CTX *mem_ctx, struct tldap_mod **pmods,
+ int mod_op, const char *attrib, const char *str)
+{
+ DATA_BLOB utf8;
+ bool ret;
+
+ if (!convert_string_talloc(talloc_tos(), CH_UNIX, CH_UTF8, str,
+ strlen(str), &utf8.data, &utf8.length,
+ false)) {
+ return false;
+ }
+
+ ret = tldap_add_mod_blobs(mem_ctx, pmods, mod_op, attrib, 1, &utf8);
+ TALLOC_FREE(utf8.data);
+ return ret;
+}
+
static bool tldap_make_mod_blob_int(struct tldap_message *existing,
TALLOC_CTX *mem_ctx,
int *pnum_mods, struct tldap_mod **pmods,