struct security_descriptor_hash_v4 sd_hs4;
enum ndr_err_code ndr_err;
TALLOC_CTX *ctx = talloc_tos();
- NTTIME nttime_now;
- struct timeval now = timeval_current();
- nttime_now = timeval_to_nttime(&now);
ZERO_STRUCT(xacl);
ZERO_STRUCT(sd_hs4);
xacl.info.sd_hs4->hash_type = hash_type;
memcpy(&xacl.info.sd_hs4->hash[0], hash, XATTR_SD_HASH_SIZE);
xacl.info.sd_hs4->description = description;
- xacl.info.sd_hs4->time = nttime_now;
memcpy(&xacl.info.sd_hs4->sys_acl_hash[0], sys_acl_hash, XATTR_SD_HASH_SIZE);
ndr_err = ndr_push_struct_blob(
} else {
/*
* make_sec_acl() at the bottom of this function
- * dupliates new_ace_list
+ * duplicates new_ace_list
*/
new_ace_list = talloc_zero_array(talloc_tos(),
struct security_ace,
* and psd_from_fs set to false.
*
* Returning the underlying filesystem ACL in case no. 2 is really just an
- * optimisation, because some validations have to fetch the filesytem ACL as
+ * optimisation, because some validations have to fetch the filesystem ACL as
* part of the validation, so we already have it available and callers might
* need it as well.
**/
static NTSTATUS validate_nt_acl_blob(TALLOC_CTX *mem_ctx,
vfs_handle_struct *handle,
struct files_struct *fsp,
- struct files_struct *dirfsp,
const struct smb_filename *smb_fname,
const DATA_BLOB *blob,
struct security_descriptor **ppsd,
switch (xattr_version) {
case 1:
case 2:
- /* These xattr types are unilatteral, they do not
+ /* These xattr types are unilateral, they do not
* require confirmation of the hash. In particular,
* the NTVFS file server uses version 1, but
* 'samba-tool ntacl' can set these as well */
status = validate_nt_acl_blob(mem_ctx,
handle,
fsp,
- NULL,
smb_fname,
&blob,
&psd,
/* We got access denied here. If we're already root,
or we didn't need to do a chown, or the fsp isn't
open with WRITE_OWNER access, just return. */
- if (get_current_uid(handle->conn) == 0 || chown_needed == false ||
- !(fsp->access_mask & SEC_STD_WRITE_OWNER)) {
+ if (get_current_uid(handle->conn) == 0 || !chown_needed) {
return NT_STATUS_ACCESS_DENIED;
}
+ status = check_any_access_fsp(fsp, SEC_STD_WRITE_OWNER);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
/*
* Only allow take-ownership, not give-ownership. That's the way Windows
}
/* We store hashes of both the sys ACL blob and the NT
- * security desciptor mapped from that ACL so as to improve
- * our chances against some inadvertant change breaking the
+ * security descriptor mapped from that ACL so as to improve
+ * our chances against some inadvertent change breaking the
* hash used */
status = create_sys_acl_blob(psd, &blob, XATTR_SD_HASH_TYPE_SHA256, hash,
sys_acl_description, sys_acl_hash);