diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 1 | ||||
-rw-r--r-- | source3/rpc_parse/parse_prs.c | 124 |
2 files changed, 0 insertions, 125 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index a74373f498..ee6f4469a9 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5051,7 +5051,6 @@ bool prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *st bool prs_uint8s(bool charmode, const char *name, prs_struct *ps, int depth, uint8 *data8s, int len); bool prs_uint16s(bool charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len); bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, int depth, uint32 *data32s, int len); -bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str); bool prs_init_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx); bool prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx); diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index c460f1fbca..ec5bc9cf6a 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -886,130 +886,6 @@ bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, int depth, uin } /******************************************************************* - Stream a unicode null-terminated string. As the string is already - in little-endian format then do it as a stream of bytes. - ********************************************************************/ - -bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) -{ - unsigned int len = 0; - unsigned char *p = (unsigned char *)str->buffer; - uint8 *start; - char *q; - uint32 max_len; - uint16* ptr; - - if (MARSHALLING(ps)) { - - for(len = 0; str->buffer[len] != 0; len++) - ; - - q = prs_mem_get(ps, (len+1)*2); - if (q == NULL) - return False; - - start = (uint8*)q; - - for(len = 0; str->buffer[len] != 0; len++) { - if(ps->bigendian_data) { - /* swap bytes - p is little endian, q is big endian. */ - q[0] = (char)p[1]; - q[1] = (char)p[0]; - p += 2; - q += 2; - } - else - { - q[0] = (char)p[0]; - q[1] = (char)p[1]; - p += 2; - q += 2; - } - } - - /* - * even if the string is 'empty' (only an \0 char) - * at this point the leading \0 hasn't been parsed. - * so parse it now - */ - - q[0] = 0; - q[1] = 0; - q += 2; - - len++; - - DEBUGADD(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name)); - print_asc(5, (unsigned char*)start, 2*len); - DEBUGADD(5, ("\n")); - } - else { /* unmarshalling */ - - uint32 alloc_len = 0; - q = ps->data_p + prs_offset(ps); - - /* - * Work out how much space we need and talloc it. - */ - max_len = (ps->buffer_size - ps->data_offset)/sizeof(uint16); - - /* the test of the value of *ptr helps to catch the circumstance - where we have an emtpty (non-existent) string in the buffer */ - for ( ptr = (uint16 *)q; *ptr++ && (alloc_len <= max_len); alloc_len++) - /* do nothing */ - ; - - if (alloc_len < max_len) - alloc_len += 1; - - /* should we allocate anything at all? */ - str->buffer = PRS_ALLOC_MEM(ps,uint16,alloc_len); - if ((str->buffer == NULL) && (alloc_len > 0)) - return False; - - p = (unsigned char *)str->buffer; - - len = 0; - /* the (len < alloc_len) test is to prevent us from overwriting - memory that is not ours...if we get that far, we have a non-null - terminated string in the buffer and have messed up somewhere */ - while ((len < alloc_len) && (*(uint16 *)q != 0)) { - if(ps->bigendian_data) - { - /* swap bytes - q is big endian, p is little endian. */ - p[0] = (unsigned char)q[1]; - p[1] = (unsigned char)q[0]; - p += 2; - q += 2; - } else { - - p[0] = (unsigned char)q[0]; - p[1] = (unsigned char)q[1]; - p += 2; - q += 2; - } - - len++; - } - if (len < alloc_len) { - /* NULL terminate the UNISTR */ - str->buffer[len++] = '\0'; - } - - DEBUGADD(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name)); - print_asc(5, (unsigned char*)str->buffer, 2*len); - DEBUGADD(5, ("\n")); - } - - /* set the offset in the prs_struct; 'len' points to the - terminiating NULL in the UNISTR so we need to go one more - uint16 */ - ps->data_offset += (len)*2; - - return True; -} - -/******************************************************************* creates a new prs_struct containing a DATA_BLOB ********************************************************************/ bool prs_init_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) |