summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-07-12 21:09:24 +0000
committerJeremy Allison <jra@samba.org>2002-07-12 21:09:24 +0000
commite40abc248f6456a7dba3a4c4c4274c0e7b77020f (patch)
treeb3083bd7125a52cf903998b5dbefe9f9e183c611 /source3/rpc_parse
parent8ba2c4e55d783587a5a6064dc2d48e4deff16fd3 (diff)
downloadsamba-e40abc248f6456a7dba3a4c4c4274c0e7b77020f.tar.gz
samba-e40abc248f6456a7dba3a4c4c4274c0e7b77020f.tar.bz2
samba-e40abc248f6456a7dba3a4c4c4274c0e7b77020f.zip
The changes in make_sec_desc to make us match W2K broke the marshalling/unmarshalling of
security descriptors. We need to calculate the maximum offset and set the offset back after reading/writing every field in the SEC_DESC. This was *nasty* to find.... Jeremy. (This used to be commit 175d43980e57c25582d8ab859f5730283e82f3b2)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_sec.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c
index 8ae8264d6d..56eaf4c5b5 100644
--- a/source3/rpc_parse/parse_sec.c
+++ b/source3/rpc_parse/parse_sec.c
@@ -782,64 +782,69 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
if (psd->off_owner_sid != 0) {
+ tmp_offset = ps->data_offset;
+ if(!prs_set_offset(ps, old_offset + psd->off_owner_sid))
+ return False;
+
if (UNMARSHALLING(ps)) {
- if(!prs_set_offset(ps, old_offset + psd->off_owner_sid))
- return False;
/* reading */
if((psd->owner_sid = (DOM_SID *)prs_alloc_mem(ps,sizeof(*psd->owner_sid))) == NULL)
return False;
}
- tmp_offset = ps->data_offset;
- ps->data_offset = psd->off_owner_sid;
-
if(!smb_io_dom_sid("owner_sid ", psd->owner_sid , ps, depth))
return False;
- ps->data_offset = tmp_offset;
- }
+ max_offset = MAX(max_offset, prs_offset(ps));
- max_offset = MAX(max_offset, prs_offset(ps));
+ if (!prs_set_offset(ps,tmp_offset))
+ return False;
+ }
if (psd->off_grp_sid != 0) {
+ tmp_offset = ps->data_offset;
+ if(!prs_set_offset(ps, old_offset + psd->off_grp_sid))
+ return False;
+
if (UNMARSHALLING(ps)) {
/* reading */
- if(!prs_set_offset(ps, old_offset + psd->off_grp_sid))
- return False;
if((psd->grp_sid = (DOM_SID *)prs_alloc_mem(ps,sizeof(*psd->grp_sid))) == NULL)
return False;
}
- tmp_offset = ps->data_offset;
- ps->data_offset = psd->off_grp_sid;
-
if(!smb_io_dom_sid("grp_sid", psd->grp_sid, ps, depth))
return False;
- ps->data_offset = tmp_offset;
- }
+ max_offset = MAX(max_offset, prs_offset(ps));
- max_offset = MAX(max_offset, prs_offset(ps));
+ if (!prs_set_offset(ps,tmp_offset))
+ return False;
+ }
if ((psd->type & SEC_DESC_SACL_PRESENT) && psd->off_sacl) {
+ tmp_offset = ps->data_offset;
if(!prs_set_offset(ps, old_offset + psd->off_sacl))
return False;
if(!sec_io_acl("sacl", &psd->sacl, ps, depth))
return False;
+ max_offset = MAX(max_offset, prs_offset(ps));
+ if (!prs_set_offset(ps,tmp_offset))
+ return False;
}
- max_offset = MAX(max_offset, prs_offset(ps));
if ((psd->type & SEC_DESC_DACL_PRESENT) && psd->off_dacl != 0) {
+ tmp_offset = ps->data_offset;
if(!prs_set_offset(ps, old_offset + psd->off_dacl))
return False;
if(!sec_io_acl("dacl", &psd->dacl, ps, depth))
return False;
+ max_offset = MAX(max_offset, prs_offset(ps));
+ if (!prs_set_offset(ps,tmp_offset))
+ return False;
}
- max_offset = MAX(max_offset, prs_offset(ps));
-
if(!prs_set_offset(ps, max_offset))
return False;
return True;