return status;
}
+#if 0
static NTSTATUS stat_fsp_or_smb_fname(vfs_handle_struct *handle,
files_struct *fsp,
const struct smb_filename *smb_fname,
return NT_STATUS_OK;
}
+#endif
/*******************************************************************
Pull a DATA_BLOB from an xattr given an fsp.
NTSTATUS get_nt_acl_common(
NTSTATUS (*get_acl_blob_fn)(TALLOC_CTX *ctx,
vfs_handle_struct *handle,
- files_struct *fsp,
const struct smb_filename *smb_fname,
DATA_BLOB *pblob),
vfs_handle_struct *handle,
- files_struct *fsp,
const struct smb_filename *smb_fname_in,
uint32_t security_info,
TALLOC_CTX *mem_ctx,
DATA_BLOB blob = data_blob_null;
NTSTATUS status;
struct security_descriptor *psd = NULL;
- const struct smb_filename *smb_fname = NULL;
bool psd_is_from_fs = false;
struct acl_common_config *config = NULL;
struct acl_common_config,
return NT_STATUS_UNSUCCESSFUL);
- if (fsp && smb_fname_in == NULL) {
- smb_fname = fsp->fsp_name;
- } else {
- smb_fname = smb_fname_in;
- }
-
- DBG_DEBUG("name=%s\n", smb_fname->base_name);
+ DBG_DEBUG("name=%s\n", smb_fname_in->base_name);
- status = get_acl_blob_fn(mem_ctx, handle, fsp, smb_fname, &blob);
+ status = get_acl_blob_fn(mem_ctx, handle, smb_fname_in, &blob);
if (NT_STATUS_IS_OK(status)) {
status = validate_nt_acl_blob(mem_ctx,
handle,
- fsp,
- smb_fname,
+ NULL,
+ smb_fname_in,
&blob,
&psd,
&psd_is_from_fs);
TALLOC_FREE(blob.data);
if (!NT_STATUS_IS_OK(status)) {
DBG_DEBUG("ACL validation for [%s] failed\n",
- smb_fname->base_name);
+ smb_fname_in->base_name);
goto fail;
}
}
if (config->ignore_system_acls) {
SMB_STRUCT_STAT sbuf;
- SMB_STRUCT_STAT *psbuf = &sbuf;
+ int ret;
- status = stat_fsp_or_smb_fname(handle, fsp, smb_fname,
- &sbuf, &psbuf);
- if (!NT_STATUS_IS_OK(status)) {
+ ret = vfs_stat_smb_basename(handle->conn,
+ smb_fname_in,
+ &sbuf);
+ if (ret == -1) {
+ status = map_nt_error_from_unix(errno);
goto fail;
}
status = make_default_filesystem_acl(
mem_ctx,
config->default_acl_style,
- smb_fname->base_name,
- psbuf,
+ smb_fname_in->base_name,
+ &sbuf,
&psd);
if (!NT_STATUS_IS_OK(status)) {
goto fail;
}
} else {
- if (fsp) {
- status = SMB_VFS_NEXT_FGET_NT_ACL(handle,
- fsp,
- security_info,
- mem_ctx,
- &psd);
- } else {
- status = SMB_VFS_NEXT_GET_NT_ACL(handle,
- smb_fname,
- security_info,
- mem_ctx,
- &psd);
- }
+ status = SMB_VFS_NEXT_GET_NT_ACL(handle,
+ smb_fname_in,
+ security_info,
+ mem_ctx,
+ &psd);
if (!NT_STATUS_IS_OK(status)) {
DBG_DEBUG("get_next_acl for file %s "
"returned %s\n",
- smb_fname->base_name,
+ smb_fname_in->base_name,
nt_errstr(status));
goto fail;
}
if (psd_is_from_fs) {
SMB_STRUCT_STAT sbuf;
- SMB_STRUCT_STAT *psbuf = &sbuf;
bool is_directory = false;
+ int ret;
/*
* We're returning the underlying ACL from the
* inheritable ACE entries we have to fake them.
*/
- status = stat_fsp_or_smb_fname(handle, fsp, smb_fname,
- &sbuf, &psbuf);
- if (!NT_STATUS_IS_OK(status)) {
+ ret = vfs_stat_smb_basename(handle->conn,
+ smb_fname_in,
+ &sbuf);
+ if (ret == -1) {
+ status = map_nt_error_from_unix(errno);
goto fail;
}
- is_directory = S_ISDIR(psbuf->st_ex_mode);
+ is_directory = S_ISDIR(sbuf.st_ex_mode);
if (is_directory && !sd_has_inheritable_components(psd, true)) {
status = add_directory_inheritable_components(
handle,
- smb_fname->base_name,
- psbuf,
+ smb_fname_in->base_name,
+ &sbuf,
psd);
if (!NT_STATUS_IS_OK(status)) {
goto fail;
if (DEBUGLEVEL >= 10) {
DBG_DEBUG("returning acl for %s is:\n",
- smb_fname->base_name);
+ smb_fname_in->base_name);
NDR_PRINT_DEBUG(security_descriptor, psd);
}
static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
vfs_handle_struct *handle,
- files_struct *fsp,
const struct smb_filename *smb_fname,
DATA_BLOB *pblob)
{
struct db_context *db = acl_db;
NTSTATUS status = NT_STATUS_OK;
SMB_STRUCT_STAT sbuf;
+ int ret;
ZERO_STRUCT(sbuf);
- if (fsp) {
- status = vfs_stat_fsp(fsp);
- sbuf = fsp->fsp_name->st;
- } else {
- int ret = vfs_stat_smb_basename(handle->conn,
+ ret = vfs_stat_smb_basename(handle->conn,
smb_fname,
&sbuf);
- if (ret == -1) {
- status = map_nt_error_from_unix(errno);
- }
+ if (ret == -1) {
+ status = map_nt_error_from_unix(errno);
}
if (!NT_STATUS_IS_OK(status)) {
pblob->data = data.dptr;
pblob->length = data.dsize;
- DEBUG(10,("get_acl_blob: returned %u bytes from file %s\n",
- (unsigned int)data.dsize, smb_fname->base_name ));
+ DBG_DEBUG("returned %u bytes from file %s\n",
+ (unsigned int)data.dsize, smb_fname->base_name );
if (pblob->length == 0 || pblob->data == NULL) {
return NT_STATUS_NOT_FOUND;
struct security_descriptor **ppdesc)
{
NTSTATUS status;
- status = get_nt_acl_common(get_acl_blob, handle, NULL, smb_fname,
+ status = get_nt_acl_common(get_acl_blob, handle, smb_fname,
security_info, mem_ctx, ppdesc);
return status;
}
static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
vfs_handle_struct *handle,
- files_struct *fsp,
const struct smb_filename *smb_fname,
DATA_BLOB *pblob)
{
val = tmp;
sizeret =
- getxattr_do(handle, fsp, smb_fname, XATTR_NTACL_NAME, val, size);
+ getxattr_do(handle, NULL, smb_fname, XATTR_NTACL_NAME, val, size);
if (sizeret >= 0) {
pblob->data = val;
/* Too small, try again. */
sizeret =
- getxattr_do(handle, fsp, smb_fname, XATTR_NTACL_NAME, NULL, 0);
+ getxattr_do(handle, NULL, smb_fname, XATTR_NTACL_NAME, NULL, 0);
if (sizeret < 0) {
goto err;
}
struct security_descriptor **ppdesc)
{
NTSTATUS status;
- status = get_nt_acl_common(get_acl_blob, handle, NULL, smb_fname,
+ status = get_nt_acl_common(get_acl_blob, handle, smb_fname,
security_info, mem_ctx, ppdesc);
return status;
}