mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
Can't set allocation size on directories, return correct error code on
fail if file exists and target is a directory. gentest. Jeremy. (This used to be commit f4a7ea6dc2b9f379a9c735670a49ac63818754c7)
This commit is contained in:
parent
3c1d00d12a
commit
3fb52e5cc0
@ -1503,6 +1503,7 @@ const struct unix_error_map unix_dos_nt_errmap[] = {
|
||||
{ EMFILE, ERRDOS, ERRnofids, NT_STATUS_TOO_MANY_OPENED_FILES },
|
||||
{ ENOSPC, ERRHRD, ERRdiskfull, NT_STATUS_DISK_FULL },
|
||||
{ ENOMEM, ERRDOS, ERRnomem, NT_STATUS_NO_MEMORY },
|
||||
{ EISDIR, ERRDOS, ERRnoaccess, NT_STATUS_FILE_IS_A_DIRECTORY},
|
||||
#ifdef EDQUOT
|
||||
{ EDQUOT, ERRHRD, ERRdiskfull, NT_STATUS_DISK_FULL },
|
||||
#endif
|
||||
|
@ -895,6 +895,12 @@ create_options = 0x%x root_dir_fid = 0x%x\n", flags, desired_access, file_attrib
|
||||
#endif
|
||||
if (allocation_size && (allocation_size > (SMB_BIG_UINT)file_len)) {
|
||||
fsp->initial_allocation_size = SMB_ROUNDUP(allocation_size,SMB_ROUNDUP_ALLOCATION_SIZE);
|
||||
if (fsp->is_directory) {
|
||||
close_file(fsp,False);
|
||||
END_PROFILE(SMBntcreateX);
|
||||
/* Can't set allocation size on a directory. */
|
||||
return ERROR_NT(NT_STATUS_ACCESS_DENIED);
|
||||
}
|
||||
if (vfs_allocate_file_space(fsp, fsp->initial_allocation_size) == -1) {
|
||||
close_file(fsp,False);
|
||||
END_PROFILE(SMBntcreateX);
|
||||
@ -1404,6 +1410,12 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o
|
||||
#endif
|
||||
if (allocation_size && (allocation_size > file_len)) {
|
||||
fsp->initial_allocation_size = SMB_ROUNDUP(allocation_size,SMB_ROUNDUP_ALLOCATION_SIZE);
|
||||
if (fsp->is_directory) {
|
||||
close_file(fsp,False);
|
||||
END_PROFILE(SMBntcreateX);
|
||||
/* Can't set allocation size on a directory. */
|
||||
return ERROR_NT(NT_STATUS_ACCESS_DENIED);
|
||||
}
|
||||
if (vfs_allocate_file_space(fsp, fsp->initial_allocation_size) == -1) {
|
||||
close_file(fsp,False);
|
||||
return ERROR_NT(NT_STATUS_DISK_FULL);
|
||||
|
@ -866,7 +866,11 @@ files_struct *open_file_shared1(connection_struct *conn,char *fname, SMB_STRUCT_
|
||||
DEBUG(5,("open_file_shared: create new requested for file %s and file already exists.\n",
|
||||
fname ));
|
||||
file_free(fsp);
|
||||
errno = EEXIST;
|
||||
if (S_ISDIR(psbuf->st_mode)) {
|
||||
errno = EISDIR;
|
||||
} else {
|
||||
errno = EEXIST;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user