mirror of
https://github.com/samba-team/samba.git
synced 2025-03-01 04:58:35 +03:00
vfs_acl_common: rename psd to psd_blob in get_nt_acl_internal()
This makes it explicit where the SD is originating from. No change in behaviour. This just paves the way for a later change that will simplify the whole logic and talloc hierarchy, therefor this also strictly renames the occurences after the out label. Logically, behind the out label, we're dealing with a variable that points to what we're going to return, so the name psd_blob is misleading, but I'm desperately trying to avoid logic changes in this commit and therefor I'm just strictly renaming. Bug: https://bugzilla.samba.org/show_bug.cgi?id=12177 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (backported from commit 2367eea928593f12f8914f7e7ba613b1b15516de)
This commit is contained in:
parent
2a8582638e
commit
9c29eb4972
@ -488,7 +488,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
|
||||
uint8_t sys_acl_hash[XATTR_SD_HASH_SIZE];
|
||||
uint8_t hash_tmp[XATTR_SD_HASH_SIZE];
|
||||
uint8_t sys_acl_hash_tmp[XATTR_SD_HASH_SIZE];
|
||||
struct security_descriptor *psd = NULL;
|
||||
struct security_descriptor *psd_blob = NULL;
|
||||
struct security_descriptor *pdesc_next = NULL;
|
||||
bool ignore_file_system_acl = lp_parm_bool(SNUM(handle->conn),
|
||||
ACL_MODULE_NAME,
|
||||
@ -506,25 +506,25 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(10, ("get_nt_acl_internal: get_acl_blob returned %s\n",
|
||||
nt_errstr(status)));
|
||||
psd = NULL;
|
||||
psd_blob = NULL;
|
||||
goto out;
|
||||
} else {
|
||||
status = parse_acl_blob(&blob, mem_ctx, &psd,
|
||||
status = parse_acl_blob(&blob, mem_ctx, &psd_blob,
|
||||
&hash_type, &xattr_version, &hash[0], &sys_acl_hash[0]);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(10, ("parse_acl_blob returned %s\n",
|
||||
nt_errstr(status)));
|
||||
psd = NULL;
|
||||
psd_blob = NULL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
/* Ensure we don't leak psd if we don't choose it.
|
||||
/* Ensure we don't leak psd_blob if we don't choose it.
|
||||
*
|
||||
* We don't allocate it onto frame as it is preferred not to
|
||||
* steal from a talloc pool.
|
||||
*/
|
||||
talloc_steal(frame, psd);
|
||||
talloc_steal(frame, psd_blob);
|
||||
|
||||
/* determine which type of xattr we got */
|
||||
switch (xattr_version) {
|
||||
@ -547,8 +547,8 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
|
||||
"mismatch (%u) for file %s\n",
|
||||
(unsigned int)hash_type,
|
||||
name));
|
||||
TALLOC_FREE(psd);
|
||||
psd = NULL;
|
||||
TALLOC_FREE(psd_blob);
|
||||
psd_blob = NULL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -558,8 +558,8 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
|
||||
"(%u) unexpected for file %s\n",
|
||||
(unsigned int)hash_type,
|
||||
name));
|
||||
TALLOC_FREE(psd);
|
||||
psd = NULL;
|
||||
TALLOC_FREE(psd_blob);
|
||||
psd_blob = NULL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -642,8 +642,8 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
|
||||
|
||||
status = hash_sd_sha256(pdesc_next, hash_tmp);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
TALLOC_FREE(psd);
|
||||
psd = pdesc_next;
|
||||
TALLOC_FREE(psd_blob);
|
||||
psd_blob = pdesc_next;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -667,12 +667,12 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
|
||||
NDR_PRINT_DEBUG(security_descriptor, pdesc_next);
|
||||
}
|
||||
|
||||
TALLOC_FREE(psd);
|
||||
psd = pdesc_next;
|
||||
TALLOC_FREE(psd_blob);
|
||||
psd_blob = pdesc_next;
|
||||
}
|
||||
out:
|
||||
|
||||
if (psd == NULL) {
|
||||
if (psd_blob == NULL) {
|
||||
/* Get the full underlying sd, as we failed to get the
|
||||
* blob for the hash, or the revision/hash type wasn't
|
||||
* known */
|
||||
@ -705,10 +705,10 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
|
||||
* steal from a talloc pool.
|
||||
*/
|
||||
talloc_steal(frame, pdesc_next);
|
||||
psd = pdesc_next;
|
||||
psd_blob = pdesc_next;
|
||||
}
|
||||
|
||||
if (psd != pdesc_next) {
|
||||
if (psd_blob != pdesc_next) {
|
||||
/* We're returning the blob, throw
|
||||
* away the filesystem SD. */
|
||||
TALLOC_FREE(pdesc_next);
|
||||
@ -761,20 +761,20 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
|
||||
status = make_default_filesystem_acl(mem_ctx,
|
||||
name,
|
||||
psbuf,
|
||||
&psd);
|
||||
&psd_blob);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
TALLOC_FREE(frame);
|
||||
return status;
|
||||
}
|
||||
} else {
|
||||
if (is_directory &&
|
||||
!sd_has_inheritable_components(psd,
|
||||
!sd_has_inheritable_components(psd_blob,
|
||||
true)) {
|
||||
status = add_directory_inheritable_components(
|
||||
handle,
|
||||
name,
|
||||
psbuf,
|
||||
psd);
|
||||
psd_blob);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
TALLOC_FREE(frame);
|
||||
return status;
|
||||
@ -784,35 +784,35 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
|
||||
the ~SEC_DESC_DACL_PROTECTED bit, as ACLs
|
||||
can't be inherited in this way under POSIX.
|
||||
Remove it for Windows-style ACLs. */
|
||||
psd->type &= ~SEC_DESC_DACL_PROTECTED;
|
||||
psd_blob->type &= ~SEC_DESC_DACL_PROTECTED;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(security_info & SECINFO_OWNER)) {
|
||||
psd->owner_sid = NULL;
|
||||
psd_blob->owner_sid = NULL;
|
||||
}
|
||||
if (!(security_info & SECINFO_GROUP)) {
|
||||
psd->group_sid = NULL;
|
||||
psd_blob->group_sid = NULL;
|
||||
}
|
||||
if (!(security_info & SECINFO_DACL)) {
|
||||
psd->type &= ~SEC_DESC_DACL_PRESENT;
|
||||
psd->dacl = NULL;
|
||||
psd_blob->type &= ~SEC_DESC_DACL_PRESENT;
|
||||
psd_blob->dacl = NULL;
|
||||
}
|
||||
if (!(security_info & SECINFO_SACL)) {
|
||||
psd->type &= ~SEC_DESC_SACL_PRESENT;
|
||||
psd->sacl = NULL;
|
||||
psd_blob->type &= ~SEC_DESC_SACL_PRESENT;
|
||||
psd_blob->sacl = NULL;
|
||||
}
|
||||
|
||||
TALLOC_FREE(blob.data);
|
||||
|
||||
if (DEBUGLEVEL >= 10) {
|
||||
DEBUG(10,("get_nt_acl_internal: returning acl for %s is:\n",
|
||||
name ));
|
||||
NDR_PRINT_DEBUG(security_descriptor, psd);
|
||||
name));
|
||||
NDR_PRINT_DEBUG(security_descriptor, psd_blob);
|
||||
}
|
||||
|
||||
/* The VFS API is that the ACL is expected to be on mem_ctx */
|
||||
*ppdesc = talloc_move(mem_ctx, &psd);
|
||||
*ppdesc = talloc_move(mem_ctx, &psd_blob);
|
||||
|
||||
TALLOC_FREE(frame);
|
||||
return NT_STATUS_OK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user