summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_lsa.c74
-rw-r--r--source3/rpc_parse/parse_misc.c41
2 files changed, 103 insertions, 12 deletions
diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c
index 7c9f74da37..ac0242b113 100644
--- a/source3/rpc_parse/parse_lsa.c
+++ b/source3/rpc_parse/parse_lsa.c
@@ -1519,6 +1519,9 @@ BOOL lsa_io_r_priv_get_dispname(const char *desc, LSA_R_PRIV_GET_DISPNAME *r_q,
return True;
}
+/*
+ initialise a LSA_Q_ENUM_ACCOUNTS structure
+*/
void init_lsa_q_enum_accounts(LSA_Q_ENUM_ACCOUNTS *trn, POLICY_HND *hnd, uint32 enum_context, uint32 pref_max_length)
{
memcpy(&trn->pol, hnd, sizeof(trn->pol));
@@ -1549,6 +1552,7 @@ BOOL lsa_io_q_enum_accounts(const char *desc, LSA_Q_ENUM_ACCOUNTS *q_q, prs_stru
return True;
}
+
/*******************************************************************
Inits an LSA_R_ENUM_PRIVS structure.
********************************************************************/
@@ -2249,8 +2253,7 @@ void init_q_enum_acct_rights(LSA_Q_ENUM_ACCT_RIGHTS *q_q,
DEBUG(5, ("init_q_enum_acct_rights\n"));
q_q->pol = *hnd;
- q_q->count = count;
- q_q->sid = *sid;
+ init_dom_sid2(&q_q->sid, sid);
}
/*******************************************************************
@@ -2258,6 +2261,7 @@ reads or writes a LSA_Q_ENUM_ACCT_RIGHTS structure.
********************************************************************/
BOOL lsa_io_q_enum_acct_rights(const char *desc, LSA_Q_ENUM_ACCT_RIGHTS *q_q, prs_struct *ps, int depth)
{
+
if (q_q == NULL)
return False;
@@ -2267,10 +2271,7 @@ BOOL lsa_io_q_enum_acct_rights(const char *desc, LSA_Q_ENUM_ACCT_RIGHTS *q_q, pr
if (!smb_io_pol_hnd("", &q_q->pol, ps, depth))
return False;
- if(!prs_uint32("count ", ps, depth, &q_q->count))
- return False;
-
- if(!smb_io_dom_sid("sid", &q_q->sid, ps, depth))
+ if(!smb_io_dom_sid2("sid", &q_q->sid, ps, depth))
return False;
return True;
@@ -2288,9 +2289,68 @@ BOOL lsa_io_r_enum_acct_rights(const char *desc, LSA_R_ENUM_ACCT_RIGHTS *r_c, pr
if(!prs_uint32("count ", ps, depth, &r_c->count))
return False;
- if(!smb_io_unistr_array("rights", &r_c->rights, ps, depth))
+ if(!smb_io_unistr2_array("rights", &r_c->rights, ps, depth))
+ return False;
+
+ if(!prs_align(ps))
+ return False;
+
+ if(!prs_ntstatus("status", ps, depth, &r_c->status))
return False;
+ return True;
+}
+
+
+/*******************************************************************
+ Inits an LSA_Q_ADD_ACCT_RIGHTS structure.
+********************************************************************/
+void init_q_add_acct_rights(LSA_Q_ADD_ACCT_RIGHTS *q_q,
+ POLICY_HND *hnd,
+ DOM_SID *sid,
+ uint32 count,
+ const char **rights)
+{
+ DEBUG(5, ("init_q_add_acct_rights\n"));
+
+ q_q->pol = *hnd;
+ init_dom_sid2(&q_q->sid, sid);
+ init_unistr2_array(&q_q->rights, count, rights);
+ q_q->count = 5;
+}
+
+
+/*******************************************************************
+reads or writes a LSA_Q_ADD_ACCT_RIGHTS structure.
+********************************************************************/
+BOOL lsa_io_q_add_acct_rights(const char *desc, LSA_Q_ADD_ACCT_RIGHTS *q_q, prs_struct *ps, int depth)
+{
+ prs_debug(ps, depth, desc, "lsa_io_q_add_acct_rights");
+ depth++;
+
+ if (!smb_io_pol_hnd("", &q_q->pol, ps, depth))
+ return False;
+
+ if(!smb_io_dom_sid2("sid", &q_q->sid, ps, depth))
+ return False;
+
+ if(!prs_uint32("count", ps, depth, &q_q->rights.count))
+ return False;
+
+ if(!smb_io_unistr2_array("rights", &q_q->rights, ps, depth))
+ return False;
+
+ return True;
+}
+
+/*******************************************************************
+reads or writes a LSA_R_ENUM_ACCT_RIGHTS structure.
+********************************************************************/
+BOOL lsa_io_r_add_acct_rights(const char *desc, LSA_R_ADD_ACCT_RIGHTS *r_c, prs_struct *ps, int depth)
+{
+ prs_debug(ps, depth, desc, "lsa_io_r_add_acct_rights");
+ depth++;
+
if(!prs_ntstatus("status", ps, depth, &r_c->status))
return False;
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index 9d3bd6f28a..43d26a691d 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -216,6 +216,7 @@ BOOL smb_io_dom_sid(const char *desc, DOM_SID *sid, prs_struct *ps, int depth)
if(!prs_uint8 ("sid_rev_num", ps, depth, &sid->sid_rev_num))
return False;
+
if(!prs_uint8 ("num_auths ", ps, depth, &sid->num_auths))
return False;
@@ -1043,17 +1044,45 @@ BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *
}
+/*
+ initialise a UNISTR_ARRAY from a char**
+*/
+BOOL init_unistr2_array(UNISTR2_ARRAY *array,
+ uint32 count, const char **strings)
+{
+ int i;
+
+ array->count = count;
+ array->ref_id = count?1:0;
+ if (array->count == 0) {
+ return True;
+ }
+
+ array->strings = (UNISTR2_ARRAY_EL *)talloc_zero(get_talloc_ctx(), count * sizeof(UNISTR2_ARRAY_EL));
+ if (!array->strings) {
+ return False;
+ }
+
+ for (i=0;i<count;i++) {
+ init_unistr2(&array->strings[i].string, strings[i], strlen(strings[i]));
+ array->strings[i].size = array->strings[i].string.uni_max_len*2;
+ array->strings[i].length = array->strings[i].size;
+ array->strings[i].ref_id = 1;
+ }
+
+ return True;
+}
+
/*******************************************************************
- Reads or writes a UNISTR_ARRAY structure.
+ Reads or writes a UNISTR2_ARRAY structure.
********************************************************************/
-BOOL smb_io_unistr_array(const char *desc, UNISTR_ARRAY *array, prs_struct *ps, int depth)
+BOOL smb_io_unistr2_array(const char *desc, UNISTR2_ARRAY *array, prs_struct *ps, int depth)
{
int i;
+ prs_debug(ps, depth, desc, "smb_io_unistr2_array");
depth++;
- array->count = 0;
-
if(!prs_uint32("ref_id", ps, depth, &array->ref_id))
return False;
@@ -1068,7 +1097,9 @@ BOOL smb_io_unistr_array(const char *desc, UNISTR_ARRAY *array, prs_struct *ps,
return True;
}
- array->strings = talloc_zero(get_talloc_ctx(), array->count * sizeof(array->strings[0]));
+ if (UNMARSHALLING(ps)) {
+ array->strings = talloc_zero(get_talloc_ctx(), array->count * sizeof(array->strings[0]));
+ }
if (! array->strings) {
return False;
}