diff options
Diffstat (limited to 'source3/rpc_parse/parse_misc.c')
-rw-r--r-- | source3/rpc_parse/parse_misc.c | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 2f2c68648a..fe65aaf4d4 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -777,16 +777,37 @@ BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf) /******************************************************************* creates a STRING2 structure. ********************************************************************/ -BOOL make_string2(STRING2 *str, char *buf, int len) +BOOL make_string2(STRING2 *str, const char *buf, int len) { - /* set up string lengths. */ - str->str_max_len = len; - str->undoc = 0; - str->str_str_len = len; + /* set up string lengths. */ + str->str_max_len = len; + str->undoc = 0; + str->str_str_len = len; + + /* store the string */ + if(len != 0) + { + memcpy(str->buffer, buf, len); + } - /* store the string */ - if(len != 0) - memcpy(str->buffer, buf, len); + return True; +} + +/******************************************************************* +creates a STRING2 structure: sets up the buffer, too +********************************************************************/ +BOOL make_buf_string2(STRING2 *str, uint32 *ptr, const char *buf) +{ + if (buf != NULL) + { + *ptr = 1; + make_string2(str, buf, strlen(buf)+1); + } + else + { + *ptr = 0; + make_string2(str, "", 0); + } return True; } |