diff options
author | Luke Leighton <lkcl@samba.org> | 1998-11-12 19:21:20 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1998-11-12 19:21:20 +0000 |
commit | 597c5a6caa871b724ee1337f14467950b0707b34 (patch) | |
tree | 5e32ee8e5887ad0a650721b592b8364d2b1bd98c /source3/rpc_parse | |
parent | 7e71258563a8d34eb1fa1a67e27d7339510bffc9 (diff) | |
download | samba-597c5a6caa871b724ee1337f14467950b0707b34.tar.gz samba-597c5a6caa871b724ee1337f14467950b0707b34.tar.bz2 samba-597c5a6caa871b724ee1337f14467950b0707b34.zip |
jean-f. sent me some S-1-3-0,1,2,3 SIDs and names. S-1-3 doesn't exist.
security descriptor testing. hey wow, you can get a SD then send it back!
(This used to be commit 7466c3113ef8f8a89b8496efadfeb611c9f3e069)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r-- | source3/rpc_parse/parse_misc.c | 5 | ||||
-rw-r--r-- | source3/rpc_parse/parse_prs.c | 8 | ||||
-rw-r--r-- | source3/rpc_parse/parse_reg.c | 19 | ||||
-rw-r--r-- | source3/rpc_parse/parse_sec.c | 30 |
4 files changed, 38 insertions, 24 deletions
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 9d5620bbf0..4c387e0628 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -319,15 +319,14 @@ void smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ void smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, - uint32 ptr_hdrbuf, uint32 start_offset) + uint32 ptr_hdrbuf, uint32 max_len, uint32 len) { if (!ps->io) { /* storing: go back and do a retrospective job. i hate this */ - int data_size = ps->offset - start_offset; uint32 old_offset = ps->offset; - make_buf_hdr(hdr, data_size, data_size); + make_buf_hdr(hdr, max_len, len); ps->offset = ptr_hdrbuf; smb_io_hdrbuf(desc, hdr, ps, depth); ps->offset = old_offset; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 8df7d06a39..75432627ab 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -366,22 +366,16 @@ BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint3 does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ BOOL prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32, - uint32 ptr_uint32, uint32 start_offset) + uint32 ptr_uint32, uint32 data_size) { if (!ps->io) { /* storing: go back and do a retrospective job. i hate this */ - uint32 data_size = ps->offset - start_offset; uint32 old_offset = ps->offset; - ps->offset = ptr_uint32; prs_uint32(name, ps, depth, &data_size); ps->offset = old_offset; } - else - { - ps->offset = start_offset + (*data32); - } return True; } diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 7e9b12b4ec..f22bf10ff8 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -551,7 +551,7 @@ void make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); - q_i->unknown = 0x7; + q_i->unknown = 0x4; q_i->ptr = 1; make_buf_hdr(&(q_i->hdr_sec), buf_len, buf_len); @@ -582,8 +582,10 @@ void reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, i smb_io_hdrbuf_pre("hdr_sec", &(r_q->hdr_sec), ps, depth, &hdr_offset); old_offset = ps->offset; sec_io_desc_buf("data ", &(r_q->data ), ps, depth); + smb_io_hdrbuf_post("hdr_sec", &(r_q->hdr_sec), ps, depth, hdr_offset, + r_q->data.max_len, r_q->data.len); + ps->offset = old_offset + r_q->data.len + sizeof(uint32) * 3; prs_align(ps); - smb_io_hdrbuf_post("hdr_sec", &(r_q->hdr_sec), ps, depth, hdr_offset, old_offset); } } @@ -594,7 +596,7 @@ void reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, in { if (r_q == NULL) return; - prs_debug(ps, depth, desc, "reg_io_r_get_key_sec"); + prs_debug(ps, depth, desc, "reg_io_r_set_key_sec"); depth++; prs_align(ps); @@ -644,9 +646,14 @@ void reg_io_q_get_key_sec(char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, i if (r_q->ptr != 0) { - smb_io_hdrbuf ("hdr_sec", &(r_q->hdr_sec), ps, depth); - sec_io_desc_buf("data ", r_q->data , ps, depth); - + uint32 hdr_offset; + uint32 old_offset; + smb_io_hdrbuf_pre("hdr_sec", &(r_q->hdr_sec), ps, depth, &hdr_offset); + old_offset = ps->offset; + sec_io_desc_buf("data ", r_q->data , ps, depth); + smb_io_hdrbuf_post("hdr_sec", &(r_q->hdr_sec), ps, depth, hdr_offset, + r_q->data->max_len, r_q->data->len); + ps->offset = old_offset + r_q->data->len + sizeof(uint32) * 3; prs_align(ps); } } diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index e94a2a32dd..7ef6914108 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -137,36 +137,46 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) if (IS_BITS_SET_ALL(t->type, SEC_DESC_DACL_PRESENT)) { - prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , old_offset); + prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , ps->offset - old_offset); + ps->offset = old_offset + t->off_dacl; sec_io_acl ("dacl" , &t->dacl , ps, depth); prs_align(ps); } else { - prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , old_offset); + prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , 0); } if (IS_BITS_SET_ALL(t->type, SEC_DESC_SACL_PRESENT)) { - prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , old_offset); + prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , ps->offset - old_offset); + ps->offset = old_offset + t->off_sacl; sec_io_acl ("sacl" , &t->sacl , ps, depth); prs_align(ps); } else { - prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , ps->offset); + prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , 0); } - prs_uint32_post("off_owner_sid", ps, depth, &(t->off_owner_sid), off_owner_sid, old_offset); + prs_uint32_post("off_owner_sid", ps, depth, &(t->off_owner_sid), off_owner_sid, ps->offset - old_offset); if (t->off_owner_sid != 0) { + if (ps->io) + { + ps->offset = old_offset + t->off_owner_sid; + } smb_io_dom_sid("owner_sid ", &t->owner_sid , ps, depth); prs_align(ps); } - prs_uint32_post("off_grp_sid ", ps, depth, &(t->off_grp_sid ), off_grp_sid , old_offset); + prs_uint32_post("off_grp_sid ", ps, depth, &(t->off_grp_sid ), off_grp_sid , ps->offset - old_offset); if (t->off_grp_sid != 0) { + if (ps->io) + { + ps->offset = old_offset + t->off_grp_sid; + } smb_io_dom_sid("grp_sid", &t->grp_sid, ps, depth); prs_align(ps); } @@ -193,7 +203,9 @@ reads or writes a SEC_DESC_BUF structure. void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) { uint32 off_len; + uint32 off_max_len; uint32 old_offset; + uint32 size; if (sec == NULL) return; @@ -202,7 +214,7 @@ void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) prs_align(ps); - prs_uint32 ("max_len", ps, depth, &(sec->max_len)); + prs_uint32_pre("max_len", ps, depth, &(sec->max_len), &off_max_len); prs_uint32 ("undoc ", ps, depth, &(sec->undoc )); prs_uint32_pre("len ", ps, depth, &(sec->len ), &off_len); @@ -214,6 +226,8 @@ void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) sec_io_desc("sec ", sec->sec, ps, depth); } - prs_uint32_post("len ", ps, depth, &(sec->len ), off_len , old_offset); + size = ps->offset - old_offset; + prs_uint32_post("max_len", ps, depth, &(sec->max_len), off_max_len, size == 0 ? sec->max_len : size); + prs_uint32_post("len ", ps, depth, &(sec->len ), off_len , size); } |