summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-04-07 04:58:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:30 -0500
commit466a825ce7a3c9a40a694608523f47e580c78415 (patch)
tree14af033be6e296ee49904535fdd2b9b2b8eefec2 /source3/rpc_parse
parentdc30062d71ea4b53862c9026dc9f5385c899f449 (diff)
downloadsamba-466a825ce7a3c9a40a694608523f47e580c78415.tar.gz
samba-466a825ce7a3c9a40a694608523f47e580c78415.tar.bz2
samba-466a825ce7a3c9a40a694608523f47e580c78415.zip
r6232: more cleanups; remove BUFFER3; rename BUFFER4 -> RPC_DATA_BLOB; rename REG_CREATE_VALE -> REG_SET_VALUE
(This used to be commit 28d433351cf813c7fb57ebac0e0f4973c85f73e8)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_misc.c93
-rw-r--r--source3/rpc_parse/parse_net.c21
-rw-r--r--source3/rpc_parse/parse_reg.c25
3 files changed, 55 insertions, 84 deletions
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index 858366d4ad..faa00d1862 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -554,105 +554,69 @@ BOOL smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth)
}
/*******************************************************************
- Allocate the BUFFER3 memory.
+ Allocate the RPC_DATA_BLOB memory.
********************************************************************/
-static size_t create_buffer3(BUFFER3 *str, size_t len)
+static size_t create_rpc_blob(RPC_DATA_BLOB *str, size_t len)
{
str->buffer = TALLOC_ZERO(get_talloc_ctx(), len);
if (str->buffer == NULL)
- smb_panic("create_buffer3: talloc fail\n");
+ smb_panic("create_rpc_blob: talloc fail\n");
return len;
}
/*******************************************************************
- Inits a BUFFER3 structure from a uint32
+ Inits a RPC_DATA_BLOB structure from a uint32
********************************************************************/
-void init_buffer3_uint32(BUFFER3 *str, uint32 val)
+void init_rpc_blob_uint32(RPC_DATA_BLOB *str, uint32 val)
{
ZERO_STRUCTP(str);
/* set up string lengths. */
- str->buf_max_len = str->buf_len = create_buffer3(str, sizeof(uint32));
+ str->buf_len = create_rpc_blob(str, sizeof(uint32));
SIVAL(str->buffer, 0, val);
}
/*******************************************************************
- Inits a BUFFER3 structure.
+ Inits a RPC_DATA_BLOB structure.
********************************************************************/
-void init_buffer3_str(BUFFER3 *str, const char *buf, int len)
+void init_rpc_blob_str(RPC_DATA_BLOB *str, const char *buf, int len)
{
ZERO_STRUCTP(str);
/* set up string lengths. */
- str->buf_max_len = str->buf_len = create_buffer3(str, len*2);
- rpcstr_push(str->buffer, buf, str->buf_max_len, STR_TERMINATE);
+ str->buf_len = create_rpc_blob(str, len*2);
+ rpcstr_push(str->buffer, buf, str->buf_len, STR_TERMINATE);
}
/*******************************************************************
- Inits a BUFFER3 structure from a hex string.
+ Inits a RPC_DATA_BLOB structure from a hex string.
********************************************************************/
-void init_buffer3_hex(BUFFER3 *str, const char *buf)
+void init_rpc_blob_hex(RPC_DATA_BLOB *str, const char *buf)
{
ZERO_STRUCTP(str);
- str->buf_max_len = str->buf_len = create_buffer3(str, strlen(buf));
- str->buf_max_len = str->buf_len = strhex_to_str((char *)str->buffer, str->buf_len, buf);
+ str->buf_len = create_rpc_blob(str, strlen(buf));
+ str->buf_len = strhex_to_str((char *)str->buffer, str->buf_len, buf);
}
/*******************************************************************
- Inits a BUFFER3 structure.
+ Inits a RPC_DATA_BLOB structure.
********************************************************************/
-void init_buffer3_bytes(BUFFER3 *str, uint8 *buf, size_t len)
+void init_rpc_blob_bytes(RPC_DATA_BLOB *str, uint8 *buf, size_t len)
{
ZERO_STRUCTP(str);
/* max buffer size (allocated size) */
if (buf != NULL) {
- len = create_buffer3(str, len);
+ len = create_rpc_blob(str, len);
memcpy(str->buffer, buf, len);
}
- str->buf_max_len = len;
- str->buf_len = buf != NULL ? len : 0;
-}
-
-/*******************************************************************
- Reads or writes a BUFFER3 structure.
- the uni_max_len member tells you how large the buffer is.
- the uni_str_len member tells you how much of the buffer is really used.
-********************************************************************/
-
-BOOL smb_io_buffer3(const char *desc, BUFFER3 *buf3, prs_struct *ps, int depth)
-{
- if (buf3 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_buffer3");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("uni_max_len", ps, depth, &buf3->buf_max_len))
- return False;
-
- if (UNMARSHALLING(ps)) {
- buf3->buffer = PRS_ALLOC_MEM(ps, unsigned char, buf3->buf_max_len);
- if (buf3->buffer == NULL)
- return False;
- }
-
- if(!prs_uint8s(True, "buffer ", ps, depth, buf3->buffer, buf3->buf_max_len))
- return False;
-
- if(!prs_uint32("buf_len ", ps, depth, &buf3->buf_len))
- return False;
-
- return True;
+ str->buf_len = len;
}
/*******************************************************************
@@ -1816,23 +1780,30 @@ BOOL smb_io_bufhdr4(const char *desc, BUFHDR4 *hdr, prs_struct *ps, int depth)
}
/*******************************************************************
-reads or writes a BUFFER4 structure.
+reads or writes a RPC_DATA_BLOB structure.
********************************************************************/
-BOOL smb_io_buffer4(const char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth)
+BOOL smb_io_rpc_blob(const char *desc, RPC_DATA_BLOB *blob, prs_struct *ps, int depth)
{
- prs_debug(ps, depth, desc, "smb_io_buffer4");
+ prs_debug(ps, depth, desc, "smb_io_rpc_blob");
depth++;
prs_align(ps);
- prs_uint32("buf_len", ps, depth, &buf4->buf_len);
+ if ( !prs_uint32("buf_len", ps, depth, &blob->buf_len) )
+ return False;
+
+ if ( blob->buf_len == 0 )
+ return True;
+
if (UNMARSHALLING(ps)) {
- buf4->buffer = PRS_ALLOC_MEM(ps, uint8, buf4->buf_len);
- if (!buf4->buffer) {
+ blob->buffer = PRS_ALLOC_MEM(ps, uint8, blob->buf_len);
+ if (!blob->buffer) {
return False;
}
}
- prs_uint8s(True, "buffer", ps, depth, buf4->buffer, buf4->buf_len);
+
+ if ( !prs_uint8s(True, "buffer", ps, depth, blob->buffer, blob->buf_len) )
+ return False;
return True;
}
diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c
index d7bdca4df9..ed95656fda 100644
--- a/source3/rpc_parse/parse_net.c
+++ b/source3/rpc_parse/parse_net.c
@@ -1972,8 +1972,7 @@ static BOOL net_io_sam_domain_info(const char *desc, SAM_DOMAIN_INFO * info,
info->hdr_oem_info.buffer, ps, depth))
return False;
- if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc,
- info->hdr_sec_desc.buffer, ps, depth))
+ if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth))
return False;
if (!smb_io_account_lockout_str("account_lockout", &info->account_lockout,
@@ -2021,8 +2020,7 @@ static BOOL net_io_sam_group_info(const char *desc, SAM_GROUP_INFO * info,
if (!smb_io_unistr2("uni_grp_desc", &info->uni_grp_desc,
info->hdr_grp_desc.buffer, ps, depth))
return False;
- if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc,
- info->hdr_sec_desc.buffer, ps, depth))
+ if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth))
return False;
return True;
@@ -2274,8 +2272,7 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16],
if (!prs_uint32("unknown2", ps, depth, &info->unknown2))
return False;
- if (!smb_io_buffer4("buf_logon_hrs", &info->buf_logon_hrs,
- info->ptr_logon_hrs, ps, depth))
+ if (!smb_io_rpc_blob("buf_logon_hrs", &info->buf_logon_hrs, ps, depth))
return False;
prs_align(ps);
if (!smb_io_unistr2("uni_comment", &info->uni_comment,
@@ -2316,8 +2313,7 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16],
return False;
ps->data_offset = old_offset + len;
}
- if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc,
- info->hdr_sec_desc.buffer, ps, depth))
+ if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth))
return False;
prs_align(ps);
if (!smb_io_unistr2("uni_profile", &info->uni_profile,
@@ -2436,8 +2432,7 @@ static BOOL net_io_sam_alias_info(const char *desc, SAM_ALIAS_INFO * info,
if (!smb_io_unistr2("uni_als_name", &info->uni_als_name,
info->hdr_als_name.buffer, ps, depth))
return False;
- if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc,
- info->hdr_sec_desc.buffer, ps, depth))
+ if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth))
return False;
if (!smb_io_unistr2("uni_als_desc", &info->uni_als_desc,
@@ -2596,8 +2591,7 @@ static BOOL net_io_sam_policy_info(const char *desc, SAM_DELTA_POLICY *info,
if(!smb_io_dom_sid2("domain_sid", &info->domain_sid, ps, depth))
return False;
- if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc,
- info->hdr_sec_desc.buffer, ps, depth))
+ if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth))
return False;
@@ -2831,8 +2825,7 @@ static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info,
if (!smb_io_unistr2("uni_privslist", &info->uni_privslist[i], True, ps, depth))
return False;
- if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc,
- info->hdr_sec_desc.buffer, ps, depth))
+ if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth))
return False;
return True;
diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c
index e76c536cee..a51b4269e3 100644
--- a/source3/rpc_parse/parse_reg.c
+++ b/source3/rpc_parse/parse_reg.c
@@ -639,8 +639,10 @@ BOOL reg_io_q_save_key(const char *desc, REG_Q_SAVE_KEY *q_u, prs_struct *ps, i
if(!prs_unistr4("filename", ps, depth, &q_u->filename))
return False;
+#if 0 /* reg_io_sec_attr() */
if(!prs_uint32("unknown", ps, depth, &q_u->unknown))
return False;
+#endif
return True;
}
@@ -1203,9 +1205,9 @@ BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_u, prs_struct *ps,
makes a structure.
********************************************************************/
-void init_reg_q_create_val(REG_Q_CREATE_VALUE *q_u, POLICY_HND *pol,
+void init_reg_q_set_val(REG_Q_SET_VALUE *q_u, POLICY_HND *pol,
char *val_name, uint32 type,
- BUFFER3 *val)
+ RPC_DATA_BLOB *val)
{
ZERO_STRUCTP(q_u);
@@ -1214,19 +1216,20 @@ void init_reg_q_create_val(REG_Q_CREATE_VALUE *q_u, POLICY_HND *pol,
init_unistr4(&q_u->name, val_name, UNI_STR_TERMINATE);
q_u->type = type;
- q_u->value = val;
+ q_u->value = *val;
+ q_u->size = val->buf_len;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
-BOOL reg_io_q_create_val(const char *desc, REG_Q_CREATE_VALUE *q_u, prs_struct *ps, int depth)
+BOOL reg_io_q_set_val(const char *desc, REG_Q_SET_VALUE *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL)
return False;
- prs_debug(ps, depth, desc, "reg_io_q_create_val");
+ prs_debug(ps, depth, desc, "reg_io_q_set_val");
depth++;
if(!prs_align(ps))
@@ -1242,11 +1245,15 @@ BOOL reg_io_q_create_val(const char *desc, REG_Q_CREATE_VALUE *q_u, prs_struct
if(!prs_uint32("type", ps, depth, &q_u->type))
return False;
- if(!smb_io_buffer3("value", q_u->value, ps, depth))
+
+ if(!smb_io_rpc_blob("value", &q_u->value, ps, depth ))
return False;
if(!prs_align(ps))
return False;
+ if(!prs_uint32("size", ps, depth, &q_u->size))
+ return False;
+
return True;
}
@@ -1254,12 +1261,12 @@ BOOL reg_io_q_create_val(const char *desc, REG_Q_CREATE_VALUE *q_u, prs_struct
reads or writes a structure.
********************************************************************/
-BOOL reg_io_r_create_val(const char *desc, REG_R_CREATE_VALUE *q_u, prs_struct *ps, int depth)
+BOOL reg_io_r_set_val(const char *desc, REG_R_SET_VALUE *q_u, prs_struct *ps, int depth)
{
if ( !q_u )
return False;
- prs_debug(ps, depth, desc, "reg_io_r_create_val");
+ prs_debug(ps, depth, desc, "reg_io_r_set_val");
depth++;
if(!prs_align(ps))
@@ -1451,7 +1458,7 @@ BOOL reg_io_q_open_entry(const char *desc, REG_Q_OPEN_ENTRY *q_u, prs_struct *p
if ( !q_u )
return False;
- prs_debug(ps, depth, desc, "reg_io_q_entry");
+ prs_debug(ps, depth, desc, "reg_io_q_open_entry");
depth++;
if(!prs_align(ps))