1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s3:vfs: Change get_acl_blob() to take a const smb_filename * parameter from const char *.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
This commit is contained in:
Jeremy Allison 2016-03-11 15:50:57 -08:00 committed by Uri Simchoni
parent 13dae2b46e
commit 6b877102db
3 changed files with 31 additions and 29 deletions

View File

@ -33,7 +33,7 @@ static NTSTATUS create_acl_blob(const struct security_descriptor *psd,
static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
vfs_handle_struct *handle,
files_struct *fsp,
const char *name,
const struct smb_filename *smb_fname,
DATA_BLOB *pblob);
static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle,
@ -366,7 +366,7 @@ static NTSTATUS add_directory_inheritable_components(vfs_handle_struct *handle,
static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
files_struct *fsp,
const struct smb_filename *smb_fname,
const struct smb_filename *smb_fname_in,
uint32_t security_info,
TALLOC_CTX *mem_ctx,
struct security_descriptor **ppdesc)
@ -381,22 +381,22 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
uint8_t sys_acl_hash_tmp[XATTR_SD_HASH_SIZE];
struct security_descriptor *psd = NULL;
struct security_descriptor *pdesc_next = NULL;
const char *name = NULL;
const struct smb_filename *smb_fname = NULL;
bool ignore_file_system_acl = lp_parm_bool(SNUM(handle->conn),
ACL_MODULE_NAME,
"ignore system acls",
false);
TALLOC_CTX *frame = talloc_stackframe();
if (fsp && smb_fname == NULL) {
name = fsp->fsp_name->base_name;
if (fsp && smb_fname_in == NULL) {
smb_fname = fsp->fsp_name;
} else {
name = smb_fname->base_name;
smb_fname = smb_fname_in;
}
DEBUG(10, ("get_nt_acl_internal: name=%s\n", name));
DEBUG(10, ("get_nt_acl_internal: name=%s\n", smb_fname->base_name));
status = get_acl_blob(frame, handle, fsp, name, &blob);
status = get_acl_blob(frame, handle, fsp, smb_fname, &blob);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("get_nt_acl_internal: get_acl_blob returned %s\n",
nt_errstr(status)));
@ -440,7 +440,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
DEBUG(10, ("get_nt_acl_internal: ACL blob revision "
"mismatch (%u) for file %s\n",
(unsigned int)hash_type,
name));
smb_fname->base_name));
TALLOC_FREE(psd);
psd = NULL;
goto out;
@ -451,7 +451,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
DEBUG(10, ("get_nt_acl_internal: ACL blob hash type "
"(%u) unexpected for file %s\n",
(unsigned int)hash_type,
name));
smb_fname->base_name));
TALLOC_FREE(psd);
psd = NULL;
goto out;
@ -474,10 +474,10 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
} else {
/* Get the full underlying sd, then hash. */
ret = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle,
name,
frame,
&sys_acl_blob_description,
&sys_acl_blob);
smb_fname->base_name,
frame,
&sys_acl_blob_description,
&sys_acl_blob);
}
/* If we fail to get the ACL blob (for some reason) then this
@ -494,7 +494,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
/* Hash matches, return blob sd. */
DEBUG(10, ("get_nt_acl_internal: blob hash "
"matches for file %s\n",
name ));
smb_fname->base_name ));
goto out;
}
}
@ -521,7 +521,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("get_nt_acl_internal: get_next_acl for file %s "
"returned %s\n",
name,
smb_fname->base_name,
nt_errstr(status)));
TALLOC_FREE(frame);
return status;
@ -545,7 +545,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
/* Hash matches, return blob sd. */
DEBUG(10, ("get_nt_acl_internal: blob hash "
"matches for file %s\n",
name ));
smb_fname->base_name ));
goto out;
}
@ -553,11 +553,11 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
DEBUG(10, ("get_nt_acl_internal: blob hash "
"does not match for file %s - returning "
"file system SD mapping.\n",
name ));
smb_fname->base_name ));
if (DEBUGLEVEL >= 10) {
DEBUG(10,("get_nt_acl_internal: acl for blob hash for %s is:\n",
name ));
smb_fname->base_name ));
NDR_PRINT_DEBUG(security_descriptor, pdesc_next);
}
@ -587,7 +587,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("get_nt_acl_internal: get_next_acl for file %s "
"returned %s\n",
name,
smb_fname->base_name,
nt_errstr(status)));
TALLOC_FREE(frame);
return status;
@ -641,7 +641,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
* is fully plumbed through the VFS.
*/
int ret = vfs_stat_smb_basename(handle->conn,
name,
smb_fname->base_name,
&sbuf);
if (ret == -1) {
TALLOC_FREE(frame);
@ -653,7 +653,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
if (ignore_file_system_acl) {
TALLOC_FREE(pdesc_next);
status = make_default_filesystem_acl(mem_ctx,
name,
smb_fname->base_name,
psbuf,
&psd);
if (!NT_STATUS_IS_OK(status)) {
@ -666,7 +666,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
true)) {
status = add_directory_inheritable_components(
handle,
name,
smb_fname->base_name,
psbuf,
psd);
if (!NT_STATUS_IS_OK(status)) {
@ -701,7 +701,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
if (DEBUGLEVEL >= 10) {
DEBUG(10,("get_nt_acl_internal: returning acl for %s is:\n",
name ));
smb_fname->base_name ));
NDR_PRINT_DEBUG(security_descriptor, psd);
}

View File

@ -143,7 +143,7 @@ static NTSTATUS acl_tdb_delete(vfs_handle_struct *handle,
static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
vfs_handle_struct *handle,
files_struct *fsp,
const char *name,
const struct smb_filename *smb_fname,
DATA_BLOB *pblob)
{
uint8_t id_buf[16];
@ -159,7 +159,9 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
status = vfs_stat_fsp(fsp);
sbuf = fsp->fsp_name->st;
} else {
int ret = vfs_stat_smb_basename(handle->conn, name, &sbuf);
int ret = vfs_stat_smb_basename(handle->conn,
smb_fname->base_name,
&sbuf);
if (ret == -1) {
status = map_nt_error_from_unix(errno);
}
@ -186,7 +188,7 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
pblob->length = data.dsize;
DEBUG(10,("get_acl_blob: returned %u bytes from file %s\n",
(unsigned int)data.dsize, name ));
(unsigned int)data.dsize, smb_fname->base_name ));
if (pblob->length == 0 || pblob->data == NULL) {
return NT_STATUS_NOT_FOUND;

View File

@ -40,7 +40,7 @@
static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
vfs_handle_struct *handle,
files_struct *fsp,
const char *name,
const struct smb_filename *smb_fname,
DATA_BLOB *pblob)
{
size_t size = 1024;
@ -64,7 +64,7 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
if (fsp && fsp->fh->fd != -1) {
sizeret = SMB_VFS_FGETXATTR(fsp, XATTR_NTACL_NAME, val, size);
} else {
sizeret = SMB_VFS_GETXATTR(handle->conn, name,
sizeret = SMB_VFS_GETXATTR(handle->conn, smb_fname->base_name,
XATTR_NTACL_NAME, val, size);
}
if (sizeret == -1) {