diff options
author | Richard Sharpe <sharpe@samba.org> | 2003-04-25 06:43:28 +0000 |
---|---|---|
committer | Richard Sharpe <sharpe@samba.org> | 2003-04-25 06:43:28 +0000 |
commit | 7aa665f2b29ecb4bcd9367a71eeca4944d3a8faf (patch) | |
tree | 7c6d04f6ca97665c2c39b5fd74f9817fe6d56a9a | |
parent | 7aa3d6c2ad2ce7ba5dd76ccd03fdf90da672ed93 (diff) | |
download | samba-7aa665f2b29ecb4bcd9367a71eeca4944d3a8faf.tar.gz samba-7aa665f2b29ecb4bcd9367a71eeca4944d3a8faf.tar.bz2 samba-7aa665f2b29ecb4bcd9367a71eeca4944d3a8faf.zip |
More code to store ACEs and SIDs. I have almost enough to start testing
the writing of a registry tree, since I can store the header, and the first
key (NK_REC) and the SD associated with that key, the SK_REC.
(This used to be commit abced0ed9eec7b8467065892c56cef9b86cff947)
-rw-r--r-- | source3/utils/editreg.c | 84 |
1 files changed, 80 insertions, 4 deletions
diff --git a/source3/utils/editreg.c b/source3/utils/editreg.c index 273707114f..a367c92d32 100644 --- a/source3/utils/editreg.c +++ b/source3/utils/editreg.c @@ -2653,17 +2653,93 @@ unsigned int sec_desc_size(SEC_DESC *sd) return size; } -int nt_store_SID(REGF *regf, DOM_SID *sid, char *locn) +/* + * Store a SID at the location provided + */ + +int nt_store_SID(REGF *regf, DOM_SID *sid, unsigned char *locn) { + int i; + unsigned char *p = locn; - return 0; + if (!regf || !sid || !locn) return 0; + + *p = sid->ver; p++; + *p = sid->auths; p++; + + for (i=0; i < 6; i++) { + *p = sid->auth[i]; p++; + } + + for (i=0; i < sid->auths; i++) { + SIVAL(p, sid->sub_auths[i]); p+=4; + } + + return p - locn; } -int nt_store_acl(REGF *regf, ACL *acl, char *locn) +int nt_store_ace(REGF *regf, ACE *ace, unsigned char *locn) { + int size = 0; + REG_ACE *reg_ace = (REG_ACE *)locn; + unsigned char *p; - return 0; + if (!regf || !ace || !locn) return 0; + + reg_ace->type = ace->type; + reg_ace->flags = ace->flags; + + /* Deal with the length when we have stored the SID */ + + p = (unsigned char *)®_ace->perms; + + SIVAL(p, ace->perms); p += 4; + + size = nt_store_SID(regf, ace->trustee, p); + + size += 8; /* Size of the fixed header */ + + p = (unsigned char *)®_ace->length; + + SSVAL(p, size); + + return size; +} + +/* + * Store an ACL at the location provided + */ + +int nt_store_acl(REGF *regf, ACL *acl, unsigned char *locn) +{ + int size = 0, i; + unsigned char *p = locn, *s; + + if (!regf || !acl || !locn) return 0; + + /* + * Now store the header and then the ACEs ... + */ + + SSVAL(p, acl->rev); + + p += 2; s = p; /* Save this for the size field */ + + p += 2; + + SIVAL(p, acl->num_aces); + + p += 4; + + for (i = 0; i < acl->num_aces; i++) { + size = nt_store_ace(regf, acl->aces[i], p); + p += size; + } + + size = s - locn; + SSVAL(s, size); + return size; } /* |