diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-08-05 17:49:35 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:38:33 -0500 |
commit | ac9628de48069be57a5159a6fe0cb0fdb7b33c5d (patch) | |
tree | e9c0d8bf9d3a262d94852f43c34c189dc61411b5 /source3/tdb | |
parent | ab75c563704fa86c409072bf1b0938e005aff5ca (diff) | |
download | samba-ac9628de48069be57a5159a6fe0cb0fdb7b33c5d.tar.gz samba-ac9628de48069be57a5159a6fe0cb0fdb7b33c5d.tar.bz2 samba-ac9628de48069be57a5159a6fe0cb0fdb7b33c5d.zip |
r17425: Add the multi-key wrapper. If it's necessary to add general blobs as keys,
this can trivially be added later.
Volker
(This used to be commit 6915adb9780052952e4a1d9e1c3e6cac06f48463)
Diffstat (limited to 'source3/tdb')
-rw-r--r-- | source3/tdb/tdbutil.c | 12 | ||||
-rw-r--r-- | source3/tdb/tdbutil.h | 2 |
2 files changed, 6 insertions, 8 deletions
diff --git a/source3/tdb/tdbutil.c b/source3/tdb/tdbutil.c index b946f856aa..21d593a26a 100644 --- a/source3/tdb/tdbutil.c +++ b/source3/tdb/tdbutil.c @@ -505,9 +505,10 @@ size_t tdb_pack(char *buf, int bufsize, const char *fmt, ...) return result; } -BOOL tdb_pack_append(TALLOC_CTX *mem_ctx, uint8 **buf, size_t *len, +BOOL tdb_pack_append(void *_mem_ctx, char **buf, size_t *len, const char *fmt, ...) { + TALLOC_CTX *mem_ctx = (void *)_mem_ctx; va_list ap; size_t len1, len2; @@ -515,13 +516,8 @@ BOOL tdb_pack_append(TALLOC_CTX *mem_ctx, uint8 **buf, size_t *len, len1 = tdb_pack_va(NULL, 0, fmt, ap); va_end(ap); - if (mem_ctx != NULL) { - *buf = TALLOC_REALLOC_ARRAY(mem_ctx, *buf, uint8, - (*len) + len1); - } else { - *buf = SMB_REALLOC_ARRAY(*buf, uint8, (*len) + len1); - } - + *buf = TALLOC_REALLOC_ARRAY(mem_ctx, *buf, char, + (*len) + len1); if (*buf == NULL) { return False; } diff --git a/source3/tdb/tdbutil.h b/source3/tdb/tdbutil.h index 44351619f4..60107adacb 100644 --- a/source3/tdb/tdbutil.h +++ b/source3/tdb/tdbutil.h @@ -54,6 +54,8 @@ struct tdb_context *tdb_open_log(const char *name, int hash_size, int tdb_flags, int open_flags, mode_t mode); int tdb_unpack(char *buf, int bufsize, const char *fmt, ...); size_t tdb_pack(char *buf, int bufsize, const char *fmt, ...); +BOOL tdb_pack_append(void *_mem_ctx, char **buf, size_t *len, + const char *fmt, ...); TDB_DATA make_tdb_data(const char *dptr, size_t dsize); TDB_DATA string_tdb_data(const char *string); int tdb_trans_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, |