summaryrefslogtreecommitdiff
path: root/source3/rpc_parse/parse_prs.c
diff options
context:
space:
mode:
authorJean-François Micouleau <jfm@samba.org>2000-03-06 11:13:40 +0000
committerJean-François Micouleau <jfm@samba.org>2000-03-06 11:13:40 +0000
commit78d7ba5ca021518ec5c088eb492b36710e556c31 (patch)
tree6e1181444ca5220bb185861bb8f68376d30670a9 /source3/rpc_parse/parse_prs.c
parent5eae8c7b0225aa4f4818edc1becbf399bb4cd42e (diff)
downloadsamba-78d7ba5ca021518ec5c088eb492b36710e556c31.tar.gz
samba-78d7ba5ca021518ec5c088eb492b36710e556c31.tar.bz2
samba-78d7ba5ca021518ec5c088eb492b36710e556c31.zip
changed prs_unistr to parse empty and non-empty strings the same way.
fixed typo in SPOOLSS_SYNT some cleanup of unused functions wrote make_spoolss_enumprinter and make_spoolss_openprinterex for rpcclient as I'm trying to keep in sync the parsing code between HEAD and TNG. Will commit changes to TNG after lunch. J.F. (This used to be commit 025cdb345f6de287a41d4449b2662dbc5e762bf2)
Diffstat (limited to 'source3/rpc_parse/parse_prs.c')
-rw-r--r--source3/rpc_parse/parse_prs.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index 5d0ea832c8..64c1590b7d 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -365,7 +365,7 @@ char *prs_mem_get(prs_struct *ps, uint32 extra_size)
Change the struct type.
********************************************************************/
-BOOL prs_switch_type(prs_struct *ps, BOOL io)
+void prs_switch_type(prs_struct *ps, BOOL io)
{
if ((ps->io ^ io) == True)
ps->io=io;
@@ -573,22 +573,22 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str)
unsigned char *p = (unsigned char *)str->buffer;
uint8 *start;
char *q;
+ char zero=0;
for(len = 0; len < (sizeof(str->buffer) / sizeof(str->buffer[0])) &&
str->buffer[len] != 0; len++)
;
- q = prs_mem_get(ps, len*2);
+ q = prs_mem_get(ps, (len+1)*2);
if (q == NULL)
return False;
start = (uint8*)q;
- len = 0;
- do
- {
+ for(len = 0; len < (sizeof(str->buffer) / sizeof(str->buffer[0])) &&
+ str->buffer[len] != 0; len++) {
if(ps->bigendian_data) {
- RW_SVAL(ps->io, ps->bigendian_data, q, *p, 0)
+ RW_SVAL(ps->io, ps->bigendian_data, q, *p, 0);
p += 2;
q += 2;
} else {
@@ -599,10 +599,21 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str)
p++;
q++;
}
- len++;
- } while ((len < (sizeof(str->buffer) / sizeof(str->buffer[0]))) &&
- (str->buffer[len] != 0));
+ }
+
+ /*
+ * even if the string is 'empty' (only an \0 char)
+ * at this point the leading \0 hasn't been parsed.
+ * so parse it now
+ */
+
+ RW_CVAL(ps->io, q, zero, 0);
+ q++;
+ RW_CVAL(ps->io, q, zero, 0);
+ q++;
+ len++;
+
ps->data_offset += len*2;
dump_data(5+depth, (char *)start, len * 2);