summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorRichard Sharpe <sharpe@samba.org>2003-04-25 03:59:05 +0000
committerRichard Sharpe <sharpe@samba.org>2003-04-25 03:59:05 +0000
commit803f2570325df38220cfc6b54dabaa2758b4fe75 (patch)
tree09846a779f57f31f6315af709db05c032b40c30e /source3/utils
parent91f650fb5b5da01ead960c1709f7545cf6a3feb4 (diff)
downloadsamba-803f2570325df38220cfc6b54dabaa2758b4fe75.tar.gz
samba-803f2570325df38220cfc6b54dabaa2758b4fe75.tar.bz2
samba-803f2570325df38220cfc6b54dabaa2758b4fe75.zip
Keep coding this boring stuff to lay out security descriptors ...
(This used to be commit 6cf0ee44caa182057eed09e7f646ef20eb059b17)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/editreg.c79
1 files changed, 77 insertions, 2 deletions
diff --git a/source3/utils/editreg.c b/source3/utils/editreg.c
index 222be2da05..273707114f 100644
--- a/source3/utils/editreg.c
+++ b/source3/utils/editreg.c
@@ -2653,13 +2653,85 @@ unsigned int sec_desc_size(SEC_DESC *sd)
return size;
}
+int nt_store_SID(REGF *regf, DOM_SID *sid, char *locn)
+{
+
+ return 0;
+
+}
+
+int nt_store_acl(REGF *regf, ACL *acl, char *locn)
+{
+
+ return 0;
+}
+
/*
* Flatten and store the Sec Desc
+ * Windows lays out the DACL first, but since there is no SACL, it might be
+ * that first, then the owner, then the group SID. So, we do it that way
+ * too.
*/
unsigned int nt_store_sec_desc(REGF *regf, SEC_DESC *sd, char *locn)
{
+ REG_SEC_DESC *rsd = (REG_SEC_DESC *)locn;
+ unsigned int size = 0, off = 0;
- return 0;
+ if (!regf || !sd || !locn) return 0;
+
+ /*
+ * Now, fill in the first two fields, then lay out the various fields
+ * as needed
+ */
+
+ rsd->rev = 0x01;
+ /* Self relative, DACL pres, owner and group not defaulted */
+ rsd->type = 0x8004;
+
+ off = 4 * sizeof(DWORD) + 4;
+
+ if (sd->sacl){
+ size = nt_store_acl(regf, sd->sacl, (char *)(locn + off));
+ rsd->sacl_off = off;
+ }
+ else
+ rsd->sacl_off = 0;
+
+ off += size;
+
+ if (sd->dacl) {
+ rsd->dacl_off = off;
+ size = nt_store_acl(regf, sd->dacl, (char *)(locn + off));
+ }
+ else {
+ rsd->dacl_off = 0;
+ }
+
+ off += size;
+
+ /* Now the owner and group SIDs */
+
+ if (sd->owner) {
+ rsd->owner_off = off;
+ size = nt_store_SID(regf, sd->owner, (char *)(locn + off));
+ }
+ else {
+ rsd->owner_off = 0;
+ }
+
+ off += size;
+
+ if (sd->group) {
+ rsd->group_off = off;
+ size = nt_store_SID(regf, sd->group, (char *)(locn + off));
+ }
+ else {
+ rsd->group_off = 0;
+ }
+
+ off += size;
+
+ return size;
}
/*
@@ -2706,7 +2778,10 @@ unsigned int nt_store_security(REGF *regf, KEY_SEC_DESC *sec)
/* Now, lay out the sec_desc */
- return 0;
+ if (!nt_store_sec_desc(regf, sec->sec_desc, (char *)&sk_hdr->sec_desc))
+ return 0;
+
+ return sk_off;
}