summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-03-09 23:48:58 +0000
committerJeremy Allison <jra@samba.org>2001-03-09 23:48:58 +0000
commit00ab9021b0cc5fe2667d383eb9cc2973072cdaaa (patch)
treed6444c6041525e86a61c0aa70247dc332aeb1a80 /source3/rpc_parse
parent0bfc10011bd5cacecda8b59c36e80f676e5c7fa3 (diff)
downloadsamba-00ab9021b0cc5fe2667d383eb9cc2973072cdaaa.tar.gz
samba-00ab9021b0cc5fe2667d383eb9cc2973072cdaaa.tar.bz2
samba-00ab9021b0cc5fe2667d383eb9cc2973072cdaaa.zip
Serious (and I *mean* serious) attempt to fix little/bigendian RPC issues.
We were reading the endainness in the RPC header and then never propagating it to the internal parse_structs used to parse the data. Also removed the "align" argument to prs_init as it was *always* set to 4, and if needed can be set differently on a case by case basis. Now ready for AS/U testing when Herb gets it set up :-). Jeremy. (This used to be commit 0cd37c831d79a12a10e479bf4fa89ffe64c1292a)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_creds.c4
-rw-r--r--source3/rpc_parse/parse_prs.c14
-rw-r--r--source3/rpc_parse/parse_rpc.c4
-rw-r--r--source3/rpc_parse/parse_spoolss.c14
4 files changed, 23 insertions, 13 deletions
diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c
index 05b33d4da7..7bdbe65880 100644
--- a/source3/rpc_parse/parse_creds.c
+++ b/source3/rpc_parse/parse_creds.c
@@ -597,7 +597,7 @@ BOOL create_ntuser_creds( prs_struct *ps,
usr.ptr_ntc = 0;
}
- prs_init(ps, 1024, 4, NULL, False);
+ prs_init(ps, 1024, NULL, MARSHALL);
ps->data_offset = 4;
return creds_io_cmd("creds", &cmd, ps, 0);
@@ -623,7 +623,7 @@ BOOL create_user_creds( prs_struct *ps,
cmd.ptr_creds = usr != NULL ? 1 : 0;
cmd.cred = usr;
- prs_init(ps, 1024, 4, NULL, False);
+ prs_init(ps, 1024, NULL, MARSHALL);
ps->data_offset = 4;
return creds_io_cmd("creds", &cmd, ps, 0);
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index 1ec3f72d4c..84ccbd5db6 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -67,12 +67,12 @@ void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name)
/*******************************************************************
Initialise a parse structure - malloc the data if requested.
********************************************************************/
-BOOL prs_init(prs_struct *ps, uint32 size, uint8 align, TALLOC_CTX *ctx, BOOL io)
+BOOL prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, BOOL io)
{
ZERO_STRUCTP(ps);
ps->io = io;
- ps->bigendian_data = False;
- ps->align = align;
+ ps->bigendian_data = RPC_LITTLE_ENDIAN;
+ ps->align = RPC_PARSE_ALIGN;
ps->is_dynamic = False;
ps->data_offset = 0;
ps->buffer_size = 0;
@@ -387,12 +387,12 @@ BOOL prs_append_data(prs_struct *dst, char *src, uint32 len)
}
/*******************************************************************
- Set the data as big-endian (external interface).
+ Set the data as X-endian (external interface).
********************************************************************/
-void prs_set_bigendian_data(prs_struct *ps)
+void prs_set_endian_data(prs_struct *ps, BOOL endian)
{
- ps->bigendian_data = True;
+ ps->bigendian_data = endian;
}
/*******************************************************************
@@ -1010,7 +1010,7 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *me
if (!dbuf.dptr) return -1;
ZERO_STRUCTP(ps);
- prs_init(ps, 0, 4, mem_ctx, UNMARSHALL);
+ prs_init(ps, 0, mem_ctx, UNMARSHALL);
prs_give_memory(ps, dbuf.dptr, dbuf.dsize, True);
return 0;
diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c
index c40de10445..9fe893d4be 100644
--- a/source3/rpc_parse/parse_rpc.c
+++ b/source3/rpc_parse/parse_rpc.c
@@ -203,7 +203,7 @@ BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth)
if (ps->io && rpc->pack_type[0] == 0) {
DEBUG(10,("smb_io_rpc_hdr: PDU data format is big-endian. Setting flag.\n"));
- prs_set_bigendian_data(ps);
+ prs_set_endian_data(ps, RPC_BIG_ENDIAN);
}
if(!prs_uint16("frag_len ", ps, depth, &rpc->frag_len))
@@ -239,7 +239,7 @@ static BOOL smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int dep
if(!prs_uint8s (False, "data ", ps, depth, ifc->uuid.remaining, sizeof(ifc->uuid.remaining)))
return False;
- if(!prs_uint32 ( "version", ps, depth, &(ifc->version)))
+ if(!prs_uint32 ( "version", ps, depth, &ifc->version))
return False;
return True;
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index 3774a91100..0073f22cab 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -2515,7 +2515,12 @@ static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUF
buffer->string_at_end=0;
if (buffer->ptr==0) {
- if (!prs_init(&buffer->prs, 0, 4, prs_get_mem_context(ps), UNMARSHALL))
+ /*
+ * JRA. I'm not sure if the data in here is in big-endian format if
+ * the client is big-endian. Leave as default (little endian) for now.
+ */
+
+ if (!prs_init(&buffer->prs, 0, prs_get_mem_context(ps), UNMARSHALL))
return False;
return True;
}
@@ -2523,7 +2528,12 @@ static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUF
if (!prs_uint32("size", ps, depth, &buffer->size))
return False;
- if (!prs_init(&buffer->prs, buffer->size, 4, prs_get_mem_context(ps), UNMARSHALL))
+ /*
+ * JRA. I'm not sure if the data in here is in big-endian format if
+ * the client is big-endian. Leave as default (little endian) for now.
+ */
+
+ if (!prs_init(&buffer->prs, buffer->size, prs_get_mem_context(ps), UNMARSHALL))
return False;
if (!prs_append_some_prs_data(&buffer->prs, ps, prs_offset(ps), buffer->size))