summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-09-20 22:23:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:00:54 -0500
commit4db7642caa99c1b054322a8971c4b673556487ce (patch)
tree4ca6f040d613bc8127f43cd30a2bc12d3192471b /source3/rpc_parse
parent3ef4b8cf2f4a52c08b71fa8cac1ce4e8409c160b (diff)
downloadsamba-4db7642caa99c1b054322a8971c4b673556487ce.tar.gz
samba-4db7642caa99c1b054322a8971c4b673556487ce.tar.bz2
samba-4db7642caa99c1b054322a8971c4b673556487ce.zip
r18745: Use the Samba4 data structures for security descriptors and security descriptor
buffers. Make security access masks simply a uint32 rather than a structure with a uint32 in it. (This used to be commit b41c52b9db5fc4a553b20a7a5a051a4afced9366)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_reg.c8
-rw-r--r--source3/rpc_parse/parse_sec.c91
-rw-r--r--source3/rpc_parse/parse_spoolss.c12
3 files changed, 56 insertions, 55 deletions
diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c
index 06a2b19095..f529ad1425 100644
--- a/source3/rpc_parse/parse_reg.c
+++ b/source3/rpc_parse/parse_reg.c
@@ -141,9 +141,9 @@ static BOOL reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec,
}
if(!smb_io_hdrbuf_post("hdr_sec", hdr_sec, ps, depth,
- hdr_offset, data->max_len, data->len))
+ hdr_offset, data->sd_size, data->sd_size))
return False;
- if(!prs_set_offset(ps, old_offset + data->len +
+ if(!prs_set_offset(ps, old_offset + data->sd_size +
sizeof(uint32) * ((ptr3 != NULL) ? 5 : 3)))
return False;
@@ -181,7 +181,7 @@ void init_reg_q_create_key_ex(REG_Q_CREATE_KEY_EX *q_c, POLICY_HND *hnd,
q_c->data = sec_buf;
q_c->ptr2 = 1;
- init_buf_hdr(&q_c->hdr_sec, sec_buf->len, sec_buf->len);
+ init_buf_hdr(&q_c->hdr_sec, sec_buf->sd_size, sec_buf->sd_size);
q_c->ptr3 = 1;
q_c->disposition = TALLOC_P( get_talloc_ctx(), uint32 );
if (!q_c->disposition) {
@@ -704,7 +704,7 @@ void init_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_u, POLICY_HND *pol,
q_u->sec_info = sec_info;
q_u->ptr = 1;
- init_buf_hdr(&q_u->hdr_sec, sec_desc_buf->len, sec_desc_buf->len);
+ init_buf_hdr(&q_u->hdr_sec, sec_desc_buf->sd_size, sec_desc_buf->sd_size);
q_u->data = sec_desc_buf;
}
diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c
index 6a752688a0..32a8a8cd32 100644
--- a/source3/rpc_parse/parse_sec.c
+++ b/source3/rpc_parse/parse_sec.c
@@ -39,7 +39,7 @@ BOOL sec_io_access(const char *desc, SEC_ACCESS *t, prs_struct *ps, int depth)
prs_debug(ps, depth, desc, "sec_io_access");
depth++;
- if(!prs_uint32("mask", ps, depth, &t->mask))
+ if(!prs_uint32("mask", ps, depth, t))
return False;
return True;
@@ -62,7 +62,7 @@ BOOL sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth)
old_offset = prs_offset(ps);
- if(!prs_uint8("type ", ps, depth, &psa->type))
+ if(!prs_uint8("type ", ps, depth, (uint8*)&psa->type))
return False;
if(!prs_uint8("flags", ps, depth, &psa->flags))
@@ -71,7 +71,7 @@ BOOL sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth)
if(!prs_uint16_pre("size ", ps, depth, &psa->size, &offset_ace_size))
return False;
- if(!sec_io_access("info ", &psa->info, ps, depth))
+ if(!prs_uint32("access_mask", ps, depth, &psa->access_mask))
return False;
/* check whether object access is present */
@@ -79,15 +79,15 @@ BOOL sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth)
if (!smb_io_dom_sid("trustee ", &psa->trustee , ps, depth))
return False;
} else {
- if (!prs_uint32("obj_flags", ps, depth, &psa->obj_flags))
+ if (!prs_uint32("obj_flags", ps, depth, &psa->object.object.flags))
return False;
- if (psa->obj_flags & SEC_ACE_OBJECT_PRESENT)
- if (!smb_io_uuid("obj_guid", &psa->obj_guid, ps,depth))
+ if (psa->object.object.flags & SEC_ACE_OBJECT_PRESENT)
+ if (!smb_io_uuid("obj_guid", &psa->object.object.type.type, ps,depth))
return False;
- if (psa->obj_flags & SEC_ACE_OBJECT_INHERITED_PRESENT)
- if (!smb_io_uuid("inh_guid", &psa->inh_guid, ps,depth))
+ if (psa->object.object.flags & SEC_ACE_OBJECT_INHERITED_PRESENT)
+ if (!smb_io_uuid("inh_guid", &psa->object.object.inherited_type.inherited_type, ps,depth))
return False;
if(!smb_io_dom_sid("trustee ", &psa->trustee , ps, depth))
@@ -155,7 +155,7 @@ BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth)
old_offset = prs_offset(ps);
- if(!prs_uint16("revision", ps, depth, &psa->revision))
+ if(!prs_uint16("revision", ps, depth, (uint16 *)&psa->revision))
return False;
if(!prs_uint16_pre("size ", ps, depth, &psa->size, &offset_acl_size))
@@ -170,14 +170,14 @@ BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth)
* between a non-present DACL (allow all access) and a DACL with no ACE's
* (allow no access).
*/
- if((psa->ace = PRS_ALLOC_MEM(ps, SEC_ACE, psa->num_aces+1)) == NULL)
+ if((psa->aces = PRS_ALLOC_MEM(ps, SEC_ACE, psa->num_aces+1)) == NULL)
return False;
}
for (i = 0; i < psa->num_aces; i++) {
fstring tmp;
slprintf(tmp, sizeof(tmp)-1, "ace_list[%02d]: ", i);
- if(!sec_io_ace(tmp, &psa->ace[i], ps, depth))
+ if(!sec_io_ace(tmp, &psa->aces[i], ps, depth))
return False;
}
@@ -211,6 +211,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
uint32 old_offset;
uint32 max_offset = 0; /* after we're done, move offset to end */
uint32 tmp_offset = 0;
+ uint32 off_sacl, off_dacl, off_owner_sid, off_grp_sid;
SEC_DESC *psd;
@@ -236,7 +237,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
/* start of security descriptor stored for back-calc offset purposes */
old_offset = prs_offset(ps);
- if(!prs_uint16("revision ", ps, depth, &psd->revision))
+ if(!prs_uint16("revision ", ps, depth, (uint16*)&psd->revision))
return False;
if(!prs_uint16("type ", ps, depth, &psd->type))
@@ -250,52 +251,52 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
*/
if (psd->sacl != NULL) {
- psd->off_sacl = offset;
+ off_sacl = offset;
offset += psd->sacl->size;
} else {
- psd->off_sacl = 0;
+ off_sacl = 0;
}
if (psd->dacl != NULL) {
- psd->off_dacl = offset;
+ off_dacl = offset;
offset += psd->dacl->size;
} else {
- psd->off_dacl = 0;
+ off_dacl = 0;
}
if (psd->owner_sid != NULL) {
- psd->off_owner_sid = offset;
+ off_owner_sid = offset;
offset += sid_size(psd->owner_sid);
} else {
- psd->off_owner_sid = 0;
+ off_owner_sid = 0;
}
- if (psd->grp_sid != NULL) {
- psd->off_grp_sid = offset;
- offset += sid_size(psd->grp_sid);
+ if (psd->group_sid != NULL) {
+ off_grp_sid = offset;
+ offset += sid_size(psd->group_sid);
} else {
- psd->off_grp_sid = 0;
+ off_grp_sid = 0;
}
}
- if(!prs_uint32("off_owner_sid", ps, depth, &psd->off_owner_sid))
+ if(!prs_uint32("off_owner_sid", ps, depth, &off_owner_sid))
return False;
- if(!prs_uint32("off_grp_sid ", ps, depth, &psd->off_grp_sid))
+ if(!prs_uint32("off_grp_sid ", ps, depth, &off_grp_sid))
return False;
- if(!prs_uint32("off_sacl ", ps, depth, &psd->off_sacl))
+ if(!prs_uint32("off_sacl ", ps, depth, &off_sacl))
return False;
- if(!prs_uint32("off_dacl ", ps, depth, &psd->off_dacl))
+ if(!prs_uint32("off_dacl ", ps, depth, &off_dacl))
return False;
max_offset = MAX(max_offset, prs_offset(ps));
- if (psd->off_owner_sid != 0) {
+ if (off_owner_sid != 0) {
tmp_offset = prs_offset(ps);
- if(!prs_set_offset(ps, old_offset + psd->off_owner_sid))
+ if(!prs_set_offset(ps, old_offset + off_owner_sid))
return False;
if (UNMARSHALLING(ps)) {
@@ -313,19 +314,19 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
return False;
}
- if (psd->off_grp_sid != 0) {
+ if (psd->group_sid != 0) {
tmp_offset = prs_offset(ps);
- if(!prs_set_offset(ps, old_offset + psd->off_grp_sid))
+ if(!prs_set_offset(ps, old_offset + off_grp_sid))
return False;
if (UNMARSHALLING(ps)) {
/* reading */
- if((psd->grp_sid = PRS_ALLOC_MEM(ps,DOM_SID,1)) == NULL)
+ if((psd->group_sid = PRS_ALLOC_MEM(ps,DOM_SID,1)) == NULL)
return False;
}
- if(!smb_io_dom_sid("grp_sid", psd->grp_sid, ps, depth))
+ if(!smb_io_dom_sid("grp_sid", psd->group_sid, ps, depth))
return False;
max_offset = MAX(max_offset, prs_offset(ps));
@@ -334,9 +335,9 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
return False;
}
- if ((psd->type & SEC_DESC_SACL_PRESENT) && psd->off_sacl) {
+ if ((psd->type & SEC_DESC_SACL_PRESENT) && off_sacl) {
tmp_offset = prs_offset(ps);
- if(!prs_set_offset(ps, old_offset + psd->off_sacl))
+ if(!prs_set_offset(ps, old_offset + off_sacl))
return False;
if(!sec_io_acl("sacl", &psd->sacl, ps, depth))
return False;
@@ -345,9 +346,9 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
return False;
}
- if ((psd->type & SEC_DESC_DACL_PRESENT) && psd->off_dacl != 0) {
+ if ((psd->type & SEC_DESC_DACL_PRESENT) && off_dacl != 0) {
tmp_offset = prs_offset(ps);
- if(!prs_set_offset(ps, old_offset + psd->off_dacl))
+ if(!prs_set_offset(ps, old_offset + off_dacl))
return False;
if(!sec_io_acl("dacl", &psd->dacl, ps, depth))
return False;
@@ -372,7 +373,9 @@ BOOL sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int
uint32 off_max_len;
uint32 old_offset;
uint32 size;
+ uint32 len;
SEC_DESC_BUF *psdb;
+ uint32 ptr;
if (ppsdb == NULL)
return False;
@@ -391,20 +394,22 @@ BOOL sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int
if(!prs_align(ps))
return False;
- if(!prs_uint32_pre("max_len", ps, depth, &psdb->max_len, &off_max_len))
+ if(!prs_uint32_pre("max_len", ps, depth, &psdb->sd_size, &off_max_len))
return False;
- if(!prs_uint32 ("ptr ", ps, depth, &psdb->ptr))
+ ptr = 1;
+ if(!prs_uint32 ("ptr ", ps, depth, &ptr))
return False;
- if(!prs_uint32_pre("len ", ps, depth, &psdb->len, &off_len))
+ len = sec_desc_size(psdb->sd);
+ if(!prs_uint32_pre("len ", ps, depth, &len, &off_len))
return False;
old_offset = prs_offset(ps);
/* reading, length is non-zero; writing, descriptor is non-NULL */
- if ((UNMARSHALLING(ps) && psdb->len != 0) || (MARSHALLING(ps) && psdb->sec != NULL)) {
- if(!sec_io_desc("sec ", &psdb->sec, ps, depth))
+ if ((UNMARSHALLING(ps) && psdb->sd_size != 0) || (MARSHALLING(ps) && psdb->sd != NULL)) {
+ if(!sec_io_desc("sec ", &psdb->sd, ps, depth))
return False;
}
@@ -412,10 +417,10 @@ BOOL sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int
return False;
size = prs_offset(ps) - old_offset;
- if(!prs_uint32_post("max_len", ps, depth, &psdb->max_len, off_max_len, size == 0 ? psdb->max_len : size))
+ if(!prs_uint32_post("max_len", ps, depth, &psdb->sd_size, off_max_len, size == 0 ? psdb->sd_size : size))
return False;
- if(!prs_uint32_post("len ", ps, depth, &psdb->len, off_len, size))
+ if(!prs_uint32_post("len ", ps, depth, &len, off_len, size))
return False;
return True;
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index ec64e10a59..e878744a1b 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -3775,10 +3775,8 @@ BOOL make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u,
q_u->secdesc_ctr = SMB_MALLOC_P(SEC_DESC_BUF);
if (!q_u->secdesc_ctr)
return False;
- q_u->secdesc_ctr->ptr = (secdesc != NULL) ? 1: 0;
- q_u->secdesc_ctr->max_len = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0;
- q_u->secdesc_ctr->len = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0;
- q_u->secdesc_ctr->sec = secdesc;
+ q_u->secdesc_ctr->sd = secdesc;
+ q_u->secdesc_ctr->sd_size = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0;
q_u->devmode_ctr.devmode_ptr = (devmode != NULL) ? 1 : 0;
q_u->devmode_ctr.size = (devmode != NULL) ? sizeof(DEVICEMODE) + (3*sizeof(uint32)) : 0;
@@ -3799,10 +3797,8 @@ BOOL make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u,
q_u->secdesc_ctr = SMB_MALLOC_P(SEC_DESC_BUF);
if (!q_u->secdesc_ctr)
return False;
- q_u->secdesc_ctr->ptr = (secdesc != NULL) ? 1: 0;
- q_u->secdesc_ctr->max_len = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0;
- q_u->secdesc_ctr->len = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0;
- q_u->secdesc_ctr->sec = secdesc;
+ q_u->secdesc_ctr->sd_size = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0;
+ q_u->secdesc_ctr->sd = secdesc;
break;
case 7: