diff options
author | Luke Leighton <lkcl@samba.org> | 1999-11-06 20:36:07 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-11-06 20:36:07 +0000 |
commit | 4dbd1c135ca286f59a5f692abd51a0c78f4cb6a0 (patch) | |
tree | 1827e581147bf7cbde9ded3ba1dc01861d49de43 /source3/rpc_parse | |
parent | 0f18ca772da544a93799ca130a8f23529aad98f6 (diff) | |
download | samba-4dbd1c135ca286f59a5f692abd51a0c78f4cb6a0.tar.gz samba-4dbd1c135ca286f59a5f692abd51a0c78f4cb6a0.tar.bz2 samba-4dbd1c135ca286f59a5f692abd51a0c78f4cb6a0.zip |
fixed string function for reading in printer_info_N.
(This used to be commit 0249ae50ad8135cf3fd11a3b85f771f2347fcb29)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r-- | source3/rpc_parse/parse_spoolss.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 59fbd6ac23..c7d3d894d1 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -956,19 +956,36 @@ static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int static BOOL smb_io_relstr(char *desc, prs_struct *ps, int depth, UNISTR *buffer, uint32 *start_offset, uint32 *end_offset) { - uint32 struct_offset; - uint32 relative_offset; - - struct_offset=ps->offset; - *end_offset-= 2*(str_len_uni(buffer)+1); - ps->offset=*end_offset; - spoolss_smb_io_unistr(desc, buffer, ps, depth); + if (!ps->io) + { + uint32 struct_offset = ps->offset; + uint32 relative_offset; + + /* writing */ + *end_offset -= 2*(str_len_uni(buffer)+1); + ps->offset=*end_offset; + spoolss_smb_io_unistr(desc, buffer, ps, depth); - ps->offset=struct_offset; - relative_offset=*end_offset-*start_offset; + ps->offset=struct_offset; + relative_offset=*end_offset-*start_offset; - prs_uint32("offset", ps, depth, &(relative_offset)); + prs_uint32("offset", ps, depth, &(relative_offset)); + } + else + { + uint32 old_offset; + uint32 relative_offset; + + prs_uint32("offset", ps, depth, &(relative_offset)); + + old_offset = ps->offset; + ps->offset = (*start_offset) + relative_offset; + spoolss_smb_io_unistr(desc, buffer, ps, depth); + + *end_offset = ps->offset; + ps->offset = old_offset; + } return True; } |