summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-11-13 01:38:41 +0000
committerLuke Leighton <lkcl@samba.org>1998-11-13 01:38:41 +0000
commitcb265dbb8b73a177d9e7fd52e53f1eba487b94d4 (patch)
treec717f798f4d099f95afd8d52deb5bfa5f44044b6 /source3/rpc_parse
parent31c4953088c20de1eb292f47c87c70e38ca574ea (diff)
downloadsamba-cb265dbb8b73a177d9e7fd52e53f1eba487b94d4.tar.gz
samba-cb265dbb8b73a177d9e7fd52e53f1eba487b94d4.tar.bz2
samba-cb265dbb8b73a177d9e7fd52e53f1eba487b94d4.zip
security descriptors
(This used to be commit 9412edfd4c11a26e4ef290839375e3959cf70a7e)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_reg.c99
-rw-r--r--source3/rpc_parse/parse_sec.c41
2 files changed, 78 insertions, 62 deletions
diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c
index 103e6b0f85..ff57535caf 100644
--- a/source3/rpc_parse/parse_reg.c
+++ b/source3/rpc_parse/parse_reg.c
@@ -118,6 +118,32 @@ void reg_io_r_flush_key(char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, int d
prs_uint32("status", ps, depth, &(r_r->status));
}
+/*******************************************************************
+reads or writes SEC_DESC_BUF and SEC_DATA structures.
+********************************************************************/
+static void reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, SEC_DESC_BUF *data, prs_struct *ps, int depth)
+{
+ if (ptr != 0)
+ {
+ uint32 hdr_offset;
+ uint32 old_offset;
+ smb_io_hdrbuf_pre("hdr_sec", hdr_sec, ps, depth, &hdr_offset);
+ old_offset = ps->offset;
+ if (ptr3 != NULL)
+ {
+ prs_uint32("ptr3", ps, depth, ptr3);
+ }
+ if (ptr3 == NULL || *ptr3 != 0)
+ {
+ sec_io_desc_buf("data ", data , ps, depth);
+ }
+ smb_io_hdrbuf_post("hdr_sec", hdr_sec, ps, depth, hdr_offset,
+ data->max_len, data->len);
+ ps->offset = old_offset + data->len + sizeof(uint32) * ((ptr3 != NULL) ? 5 : 3);
+ prs_align(ps);
+ }
+}
+
/*******************************************************************
@@ -125,20 +151,13 @@ creates a structure.
********************************************************************/
void make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd,
char *name, char *class,
- SEC_ACCESS *sam_access)
+ SEC_ACCESS *sam_access,
+ SEC_DESC_BUF *sec_buf,
+ int sec_len, SEC_DESC *sec)
{
int len_name = name != NULL ? strlen(name ) + 1: 0;
int len_class = class != NULL ? strlen(class) + 1: 0;
- static unsigned char data[] =
- {
- 0x01, 0x00, 0x00, 0x80,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00
- };
-
ZERO_STRUCTP(q_c);
memcpy(&(q_c->pnt_pol), hnd, sizeof(q_c->pnt_pol));
@@ -153,17 +172,13 @@ void make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd,
memcpy(&(q_c->sam_access), sam_access, sizeof(q_c->sam_access));
q_c->ptr1 = 1;
- q_c->unknown_0 = 0x0000000C;
+ q_c->sec_info = DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;
+ q_c->data = sec_buf;
q_c->ptr2 = 1;
- q_c->sec_len1 = 0x14;
- q_c->sec_len2 = 0x14;
- q_c->sec_len3 = 0x0;
- q_c->sec_len4 = 0x14;
- q_c->sec_len5 = 0x0;
- q_c->sec_len6 = 0x14;
-
- memcpy(&q_c->buf_unk, data, sizeof(q_c->buf_unk));
+ make_buf_hdr(&(q_c->hdr_sec), sec_len, sec_len);
+ q_c->ptr3 = 1;
+ make_sec_desc_buf(q_c->data, sec_len, sec);
q_c->unknown_2 = 0x00000000;
}
@@ -194,27 +209,15 @@ void reg_io_q_create_key(char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int
sec_io_access("sam_access", &r_q->sam_access, ps, depth);
prs_uint32("ptr1", ps, depth, &(r_q->ptr1));
- if (r_q->ptr2 != 0)
+ if (r_q->ptr1 != 0)
{
- prs_uint32("unknown_0", ps, depth, &(r_q->unknown_0));
+ prs_uint32("sec_info", ps, depth, &(r_q->sec_info));
}
prs_uint32("ptr2", ps, depth, &(r_q->ptr2));
- if (r_q->ptr2)
- {
- prs_uint32("sec_len1", ps, depth, &(r_q->sec_len1));
- prs_uint32("sec_len2", ps, depth, &(r_q->sec_len2));
- prs_uint32("sec_len3", ps, depth, &(r_q->sec_len3));
- prs_uint32("sec_len4", ps, depth, &(r_q->sec_len4));
- prs_uint32("sec_len5", ps, depth, &(r_q->sec_len5));
- prs_uint32("sec_len6", ps, depth, &(r_q->sec_len6));
- prs_uint8s(False, "buf_unk", ps, depth, r_q->buf_unk, sizeof(r_q->buf_unk));
- prs_align(ps);
-
- prs_uint32("unknown_2", ps, depth, &(r_q->unknown_2));
- }
+ reg_io_hdrbuf_sec(r_q->ptr2, &r_q->ptr3, &r_q->hdr_sec, r_q->data, ps, depth);
- prs_align(ps);
+ prs_uint32("unknown_2", ps, depth, &(r_q->unknown_2));
}
@@ -575,18 +578,7 @@ void reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, i
prs_uint32("sec_info", ps, depth, &(r_q->sec_info));
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);
- 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);
- }
+ reg_io_hdrbuf_sec(r_q->ptr, NULL, &r_q->hdr_sec, r_q->data, ps, depth);
}
/*******************************************************************
@@ -646,18 +638,7 @@ void reg_io_q_get_key_sec(char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, i
prs_uint32("sec_info", ps, depth, &(r_q->sec_info));
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);
- 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);
- }
+ reg_io_hdrbuf_sec(r_q->ptr, NULL, &r_q->hdr_sec, r_q->data, ps, depth);
}
#if 0
diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c
index b3c75fb0dc..0b0c08fe13 100644
--- a/source3/rpc_parse/parse_sec.c
+++ b/source3/rpc_parse/parse_sec.c
@@ -194,33 +194,49 @@ int make_sec_desc(SEC_DESC *t, uint16 revision, uint16 type,
t->owner_sid = owner_sid;
t->grp_sid = grp_sid;
- offset = 0x14;
+ offset = 0x0;
if (dacl != NULL)
{
+ if (offset == 0)
+ {
+ offset = 0x14;
+ }
t->off_dacl = offset;
offset += dacl->size;
}
if (sacl != NULL)
{
+ if (offset == 0)
+ {
+ offset = 0x14;
+ }
t->off_dacl = offset;
offset += dacl->size;
}
if (owner_sid != NULL)
{
+ if (offset == 0)
+ {
+ offset = 0x14;
+ }
t->off_owner_sid = offset;
offset += sid_size(owner_sid);
}
if (grp_sid != NULL)
{
+ if (offset == 0)
+ {
+ offset = 0x14;
+ }
t->off_grp_sid = offset;
offset += sid_size(grp_sid);
}
- return offset;
+ return (offset == 0) ? 0x14 : offset;
}
@@ -256,10 +272,12 @@ reads or writes a structure.
********************************************************************/
static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
{
+#if 0
uint32 off_owner_sid;
uint32 off_grp_sid ;
uint32 off_sacl ;
uint32 off_dacl ;
+#endif
uint32 old_offset;
uint32 max_offset = 0; /* after we're done, move offset to end */
@@ -276,16 +294,23 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
prs_uint16("revision ", ps, depth, &(t->revision ));
prs_uint16("type ", ps, depth, &(t->type ));
+ prs_uint32("off_owner_sid", ps, depth, &(t->off_owner_sid));
+ prs_uint32("off_grp_sid ", ps, depth, &(t->off_grp_sid ));
+ prs_uint32("off_sacl ", ps, depth, &(t->off_sacl ));
+ prs_uint32("off_dacl ", ps, depth, &(t->off_dacl ));
+#if 0
prs_uint32_pre("off_owner_sid", ps, depth, &(t->off_owner_sid), &off_owner_sid);
prs_uint32_pre("off_grp_sid ", ps, depth, &(t->off_grp_sid ), &off_grp_sid );
prs_uint32_pre("off_sacl ", ps, depth, &(t->off_sacl ), &off_sacl );
prs_uint32_pre("off_dacl ", ps, depth, &(t->off_dacl ), &off_dacl );
-
+#endif
max_offset = MAX(max_offset, ps->offset);
if (IS_BITS_SET_ALL(t->type, SEC_DESC_DACL_PRESENT))
{
+#if 0
prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , ps->offset - old_offset);
+#endif
ps->offset = old_offset + t->off_dacl;
if (ps->io)
{
@@ -304,16 +329,20 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
sec_io_acl ("dacl" , t->dacl , ps, depth);
prs_align(ps);
}
+#if 0
else
{
prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , 0);
}
+#endif
max_offset = MAX(max_offset, ps->offset);
if (IS_BITS_SET_ALL(t->type, SEC_DESC_SACL_PRESENT))
{
+#if 0
prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , ps->offset - old_offset);
+#endif
ps->offset = old_offset + t->off_sacl;
if (ps->io)
{
@@ -332,14 +361,18 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
sec_io_acl ("sacl" , t->sacl , ps, depth);
prs_align(ps);
}
+#if 0
else
{
prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , 0);
}
+#endif
max_offset = MAX(max_offset, ps->offset);
+#if 0
prs_uint32_post("off_owner_sid", ps, depth, &(t->off_owner_sid), off_owner_sid, ps->offset - old_offset);
+#endif
if (t->off_owner_sid != 0)
{
if (ps->io)
@@ -366,7 +399,9 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
max_offset = MAX(max_offset, ps->offset);
+#if 0
prs_uint32_post("off_grp_sid ", ps, depth, &(t->off_grp_sid ), off_grp_sid , ps->offset - old_offset);
+#endif
if (t->off_grp_sid != 0)
{
if (ps->io)