diff options
author | Luke Leighton <lkcl@samba.org> | 1998-11-12 16:03:35 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1998-11-12 16:03:35 +0000 |
commit | 1ab463a79575316612097445ea40b9dd7bcb84bd (patch) | |
tree | 089522c8e7365ea67d4db5ee28573e3c9391fe6e /source3 | |
parent | fe7090cfb052729b75873c13c75578323aff2a5d (diff) | |
download | samba-1ab463a79575316612097445ea40b9dd7bcb84bd.tar.gz samba-1ab463a79575316612097445ea40b9dd7bcb84bd.tar.bz2 samba-1ab463a79575316612097445ea40b9dd7bcb84bd.zip |
security descriptors and registry.
(This used to be commit 9814ac8a65f4d8333527976f1d227e8cd3c2c8ce)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/rpc_reg.h | 2 | ||||
-rw-r--r-- | source3/rpc_parse/parse_misc.c | 37 | ||||
-rw-r--r-- | source3/rpc_parse/parse_prs.c | 4 | ||||
-rw-r--r-- | source3/rpc_parse/parse_reg.c | 62 |
4 files changed, 102 insertions, 3 deletions
diff --git a/source3/include/rpc_reg.h b/source3/include/rpc_reg.h index 59f3fb6f05..163dfd67fe 100644 --- a/source3/include/rpc_reg.h +++ b/source3/include/rpc_reg.h @@ -108,7 +108,7 @@ typedef struct q_reg_set_key_sec_info uint32 ptr; /* pointer */ BUFHDR hdr_sec; /* header for security data */ - SEC_DESC_BUF *data; /* security data */ + SEC_DESC_BUF data; /* security data */ } REG_Q_SET_KEY_SEC; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index b21057033f..9d5620bbf0 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -297,6 +297,43 @@ void make_buf_hdr(BUFHDR *hdr, int max_len, int len) } /******************************************************************* + prs_uint16 wrapper. call this and it sets up a pointer to where the + uint16 should be stored, or gets the size if reading + ********************************************************************/ +void smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset) +{ + (*offset) = ps->offset; + if (ps->io) + { + /* reading. */ + smb_io_hdrbuf(desc, hdr, ps, depth); + } + else + { + ps->offset += sizeof(uint32) * 2; + } +} + +/******************************************************************* + smb_io_hdrbuf wrapper. call this and it retrospectively stores the size. + 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) +{ + 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); + ps->offset = ptr_hdrbuf; + smb_io_hdrbuf(desc, hdr, ps, depth); + ps->offset = old_offset; + } +} +/******************************************************************* reads or writes a BUFHDR structure. ********************************************************************/ void smb_io_hdrbuf(char *desc, BUFHDR *hdr, prs_struct *ps, int depth) diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index cc068778ac..8df7d06a39 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -305,7 +305,7 @@ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, ui ********************************************************************/ BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset) { - (*offset) = ps->io; + (*offset) = ps->offset; if (ps->io) { /* reading. */ @@ -348,7 +348,7 @@ BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, ********************************************************************/ BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset) { - (*offset) = ps->io; + (*offset) = ps->offset; if (ps->io) { /* reading. */ diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 57de5f8968..7e9b12b4ec 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -544,6 +544,68 @@ void reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) /******************************************************************* makes a structure. ********************************************************************/ +void make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, + uint32 buf_len, SEC_DESC *sec_desc) +{ + if (q_i == NULL) return; + + memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); + + q_i->unknown = 0x7; + + q_i->ptr = 1; + make_buf_hdr(&(q_i->hdr_sec), buf_len, buf_len); + make_sec_desc_buf(&(q_i->data), buf_len, sec_desc); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_set_key_sec"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_q->pol), ps, depth); + + prs_uint32("unknown", ps, depth, &(r_q->unknown)); + prs_uint32("ptr ", ps, depth, &(r_q->ptr )); + + if (r_q->ptr != 0) + { + 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); + prs_align(ps); + smb_io_hdrbuf_post("hdr_sec", &(r_q->hdr_sec), ps, depth, hdr_offset, old_offset); + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_get_key_sec"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_q->status)); +} + + +/******************************************************************* +makes a structure. +********************************************************************/ void make_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, uint32 buf_len, SEC_DESC_BUF *sec_buf) { |