1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-08 13:49:29 +03:00

security descriptors and registry.

This commit is contained in:
Luke Leighton
-
parent fb6a79ea3a
commit 9814ac8a65
4 changed files with 102 additions and 3 deletions

View File

@ -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;

View File

@ -296,6 +296,43 @@ void make_buf_hdr(BUFHDR *hdr, int max_len, int len)
hdr->buf_len = 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.
********************************************************************/

View File

@ -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. */

View File

@ -541,6 +541,68 @@ void reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth)
prs_uint32("status", ps, depth, &(r_u->status));
}
/*******************************************************************
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.
********************************************************************/