/* Don't reset pattr to zero as we may already have filename-based attributes we
need to preserve. */
- sizeret = SMB_VFS_GETXATTR(conn, smb_fname->base_name,
+ sizeret = SMB_VFS_GETXATTR(conn, smb_fname,
SAMBA_XATTR_DOS_ATTRIB, attrstr,
sizeof(attrstr));
if (sizeret == -1) {
return NT_STATUS_NOT_IMPLEMENTED;
}
+ /*
+ * Don't store FILE_ATTRIBUTE_OFFLINE, it's dealt with in
+ * vfs_default via DMAPI if that is enabled.
+ */
+ dosmode &= ~FILE_ATTRIBUTE_OFFLINE;
+
ZERO_STRUCT(dosattrib);
ZERO_STRUCT(blob);
return NT_STATUS_INVALID_PARAMETER;
}
- if (SMB_VFS_SETXATTR(conn, smb_fname->base_name,
+ if (SMB_VFS_SETXATTR(conn, smb_fname,
SAMBA_XATTR_DOS_ATTRIB, blob.data, blob.length,
0) == -1) {
NTSTATUS status = NT_STATUS_OK;
uint32_t dos_mode(connection_struct *conn, struct smb_filename *smb_fname)
{
uint32_t result = 0;
- bool offline;
NTSTATUS status = NT_STATUS_OK;
DEBUG(8,("dos_mode: %s\n", smb_fname_str_dbg(smb_fname)));
result |= dos_mode_from_sbuf(conn, smb_fname);
}
- offline = SMB_VFS_IS_OFFLINE(conn, smb_fname, &smb_fname->st);
- if (S_ISREG(smb_fname->st.st_ex_mode) && offline) {
- result |= FILE_ATTRIBUTE_OFFLINE;
- }
-
if (conn->fs_capabilities & FILE_FILE_COMPRESSION) {
bool compressed = false;
status = dos_mode_check_compressed(conn, smb_fname,
result |= dos_mode_from_name(conn, smb_fname, result);
- if (result == 0) {
+ if (S_ISDIR(smb_fname->st.st_ex_mode)) {
+ result |= FILE_ATTRIBUTE_DIRECTORY;
+ } else if (result == 0) {
result = FILE_ATTRIBUTE_NORMAL;
}
mode_t tmp;
mode_t unixmode;
int ret = -1, lret = -1;
- uint32_t old_mode;
- struct timespec new_create_timespec;
files_struct *fsp = NULL;
bool need_close = false;
NTSTATUS status;
return -1;
}
- /* We only allow READONLY|HIDDEN|SYSTEM|DIRECTORY|ARCHIVE here. */
- dosmode &= (SAMBA_ATTRIBUTES_MASK | FILE_ATTRIBUTE_OFFLINE);
+ dosmode &= SAMBA_ATTRIBUTES_MASK;
DEBUG(10,("file_set_dosmode: setting dos mode 0x%x on file %s\n",
dosmode, smb_fname_str_dbg(smb_fname)));
unixmode = smb_fname->st.st_ex_mode;
- get_acl_group_bits(conn, smb_fname->base_name,
- &smb_fname->st.st_ex_mode);
+ get_acl_group_bits(conn, smb_fname,
+ &smb_fname->st.st_ex_mode);
if (S_ISDIR(smb_fname->st.st_ex_mode))
dosmode |= FILE_ATTRIBUTE_DIRECTORY;
else
dosmode &= ~FILE_ATTRIBUTE_DIRECTORY;
- new_create_timespec = smb_fname->st.st_ex_btime;
-
- old_mode = dos_mode(conn, smb_fname);
-
- if ((dosmode & FILE_ATTRIBUTE_OFFLINE) &&
- !(old_mode & FILE_ATTRIBUTE_OFFLINE)) {
- lret = SMB_VFS_SET_OFFLINE(conn, smb_fname);
- if (lret == -1) {
- if (errno == ENOTSUP) {
- DEBUG(10, ("Setting FILE_ATTRIBUTE_OFFLINE for "
- "%s/%s is not supported.\n",
- parent_dir,
- smb_fname_str_dbg(smb_fname)));
- } else {
- DEBUG(0, ("An error occurred while setting "
- "FILE_ATTRIBUTE_OFFLINE for "
- "%s/%s: %s", parent_dir,
- smb_fname_str_dbg(smb_fname),
- strerror(errno)));
- }
- }
- }
-
- dosmode &= ~FILE_ATTRIBUTE_OFFLINE;
- old_mode &= ~FILE_ATTRIBUTE_OFFLINE;
-
- smb_fname->st.st_ex_btime = new_create_timespec;
-
/* Store the DOS attributes in an EA by preference. */
status = SMB_VFS_SET_DOS_ATTRIBUTES(conn, smb_fname, dosmode);
if (NT_STATUS_IS_OK(status)) {