diff options
author | Jeremy Allison <jra@samba.org> | 2003-11-07 18:32:23 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2003-11-07 18:32:23 +0000 |
commit | 5cfe36d09d1de8c6a82152d4941c1563111f4364 (patch) | |
tree | 4ee8326d7baedb4ea74e3f5c43c35b81856a4119 /source3/rpc_parse/parse_misc.c | |
parent | 1f62f2d057a52214633510bd37e6eef947fa0548 (diff) | |
download | samba-5cfe36d09d1de8c6a82152d4941c1563111f4364.tar.gz samba-5cfe36d09d1de8c6a82152d4941c1563111f4364.tar.bz2 samba-5cfe36d09d1de8c6a82152d4941c1563111f4364.zip |
Handle munged dial string. Patch from Aur?lien Degr?mont <adegremont@idealx.com>with memory leak fixes by me.
Jeremy.
(This used to be commit e591854eda8568ed1a4ad6b9de64e523c02b4392)
Diffstat (limited to 'source3/rpc_parse/parse_misc.c')
-rw-r--r-- | source3/rpc_parse/parse_misc.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index e182535532..86ea83d7aa 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1001,6 +1001,27 @@ void init_unistr2_from_unistr(UNISTR2 *to, const UNISTR *from) } /******************************************************************* + Inits a UNISTR2 structure from a DATA_BLOB. + The length of the data_blob must count the bytes of the buffer. + Copies the blob data. +********************************************************************/ + +void init_unistr2_from_datablob(UNISTR2 *str, DATA_BLOB *blob) +{ + /* Allocs the unistring */ + init_unistr2(str, NULL, UNI_FLAGS_NONE); + + /* Sets the values */ + str->uni_str_len = blob->length / sizeof(uint16); + str->uni_max_len = str->uni_str_len; + str->offset = 0; + str->buffer = (uint16 *) memdup(blob->data, blob->length); + if (!str->buffer) { + smb_panic("init_unistr2_from_datablob: malloc fail\n"); + } +} + +/******************************************************************* Reads or writes a UNISTR2 structure. XXXX NOTE: UNISTR2 structures need NOT be null-terminated. the uni_str_len member tells you how long the string is; |