summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-09-09 19:27:00 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-09-09 19:27:00 +0200
commitc82f268a1c1c5eff1cbdb410da3c717464bdbdd7 (patch)
tree00f3aaee7050f96229d3a74b052ca1edf7e5e2b9 /source3/lib/util.c
parent372ecdfde372a8bdd666cdf009262776eddd28d4 (diff)
parent7965249bd613eb41eeca24ba8271189e2f90257c (diff)
downloadsamba-c82f268a1c1c5eff1cbdb410da3c717464bdbdd7.tar.gz
samba-c82f268a1c1c5eff1cbdb410da3c717464bdbdd7.tar.bz2
samba-c82f268a1c1c5eff1cbdb410da3c717464bdbdd7.zip
Merge branch 'v3-devel' of ssh://git.samba.org/data/git/samba into v3-devel
(This used to be commit c3d1b0097590566417bda3fa33a64e994c9c7526)
Diffstat (limited to 'source3/lib/util.c')
-rw-r--r--source3/lib/util.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 201d87aeb5..ec43ea7037 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -2990,6 +2990,32 @@ void *talloc_check_name_abort(const void *ptr, const char *name)
return NULL;
}
+/**********************************************************************
+ Append a DATA_BLOB to a talloc'ed object
+***********************************************************************/
+
+void *talloc_append_blob(TALLOC_CTX *mem_ctx, void *buf, DATA_BLOB blob)
+{
+ size_t old_size = 0;
+ char *result;
+
+ if (blob.length == 0) {
+ return buf;
+ }
+
+ if (buf != NULL) {
+ old_size = talloc_get_size(buf);
+ }
+
+ result = (char *)TALLOC_REALLOC(mem_ctx, buf, old_size + blob.length);
+ if (result == NULL) {
+ return NULL;
+ }
+
+ memcpy(result + old_size, blob.data, blob.length);
+ return result;
+}
+
uint32 map_share_mode_to_deny_mode(uint32 share_access, uint32 private_options)
{
switch (share_access & ~FILE_SHARE_DELETE) {