This also fixes a bug introduced by
cea8e57eac2ed7b90a5c5d207bf392ff0546398e
where inherit_access_posix_acl() used the smb_fname->base_name instead of
inherit_from_dir in synthetic_smb_fname() to get an struct smb_filename of the
parent directory.
Nobody complained so far, fix it silently.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
/* Inherit the ACL if required */
if (lp_inherit_permissions(SNUM(conn))) {
inherit_access_posix_acl(conn,
- parent_dir->base_name,
+ parent_dir,
smb_fname,
unx_mode);
need_re_stat = true;
}
if (lp_inherit_permissions(SNUM(conn))) {
- inherit_access_posix_acl(conn, parent_dir,
+ inherit_access_posix_acl(conn, parent_dir_fname,
smb_dname, mode);
need_re_stat = true;
}
****************************************************************************/
int inherit_access_posix_acl(connection_struct *conn,
- const char *inherit_from_dir,
+ struct smb_filename *inherit_from_dir,
const struct smb_filename *smb_fname,
mode_t mode)
{
- struct smb_filename *inherit_from_fname =
- synthetic_smb_fname(talloc_tos(),
- smb_fname->base_name,
- NULL,
- NULL,
- smb_fname->flags);
- if (inherit_from_fname == NULL) {
- return-1;
- }
-
- if (directory_has_default_posix_acl(conn, inherit_from_fname))
+ if (directory_has_default_posix_acl(conn, inherit_from_dir))
return 0;
- return copy_access_posix_acl(conn, inherit_from_fname, smb_fname, mode);
+ return copy_access_posix_acl(conn, inherit_from_dir, smb_fname, mode);
}
/****************************************************************************
const struct smb_filename *smb_fname,
mode_t *mode);
int inherit_access_posix_acl(connection_struct *conn,
- const char *inherit_from_dir,
+ struct smb_filename *inherit_from_dir,
const struct smb_filename *smb_fname,
mode_t mode);
NTSTATUS set_unix_posix_default_acl(connection_struct *conn,
return NT_STATUS_NO_MEMORY;
}
inherit_access_posix_acl(conn,
- parent_fname->base_name,
+ parent_fname,
smb_fname,
unixmode);
TALLOC_FREE(parent_fname);