diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/modules/vfs_acl_common.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c index 4e3aa72d37..e1555c7d9e 100644 --- a/source3/modules/vfs_acl_common.c +++ b/source3/modules/vfs_acl_common.c @@ -49,11 +49,28 @@ static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle, Hash a security descriptor. *******************************************************************/ +static NTSTATUS hash_blob_sha256(DATA_BLOB blob, + uint8_t *hash) +{ + SHA256_CTX tctx; + + memset(hash, '\0', XATTR_SD_HASH_SIZE); + + samba_SHA256_Init(&tctx); + samba_SHA256_Update(&tctx, blob.data, blob.length); + samba_SHA256_Final(hash, &tctx); + + return NT_STATUS_OK; +} + +/******************************************************************* + Hash a security descriptor. +*******************************************************************/ + static NTSTATUS hash_sd_sha256(struct security_descriptor *psd, uint8_t *hash) { DATA_BLOB blob; - SHA256_CTX tctx; NTSTATUS status; memset(hash, '\0', XATTR_SD_HASH_SIZE); @@ -61,12 +78,7 @@ static NTSTATUS hash_sd_sha256(struct security_descriptor *psd, if (!NT_STATUS_IS_OK(status)) { return status; } - - samba_SHA256_Init(&tctx); - samba_SHA256_Update(&tctx, blob.data, blob.length); - samba_SHA256_Final(hash, &tctx); - - return NT_STATUS_OK; + return hash_blob_sha256(blob, hash); } /******************************************************************* |