mirror of
https://github.com/samba-team/samba.git
synced 2025-02-05 21:57:51 +03:00
r21644: Allow mkdir on platforms with no O_DIRECTORY.
Add proper debug to all possible setfilepathinfo functions. Jeremy.
This commit is contained in:
parent
334b34f131
commit
3c47a5ef25
@ -1822,7 +1822,7 @@ static uint32 open_flags_to_wire(int flags)
|
||||
Open a file - POSIX semantics. Returns fnum. Doesn't request oplock.
|
||||
****************************************************************************/
|
||||
|
||||
int cli_posix_open(struct cli_state *cli, const char *fname, int flags, mode_t mode)
|
||||
static int cli_posix_open_internal(struct cli_state *cli, const char *fname, int flags, mode_t mode, BOOL is_dir)
|
||||
{
|
||||
unsigned int data_len = 0;
|
||||
unsigned int param_len = 0;
|
||||
@ -1832,6 +1832,7 @@ int cli_posix_open(struct cli_state *cli, const char *fname, int flags, mode_t m
|
||||
char *rparam=NULL, *rdata=NULL;
|
||||
char *p;
|
||||
int fnum = -1;
|
||||
uint32 wire_flags = open_flags_to_wire(flags);
|
||||
|
||||
memset(param, 0, sizeof(param));
|
||||
SSVAL(param,0, SMB_POSIX_PATH_OPEN);
|
||||
@ -1840,11 +1841,14 @@ int cli_posix_open(struct cli_state *cli, const char *fname, int flags, mode_t m
|
||||
p += clistr_push(cli, p, fname, sizeof(param)-6, STR_TERMINATE);
|
||||
param_len = PTR_DIFF(p, param);
|
||||
|
||||
/* Convert flags to wire_open_mode. */
|
||||
if (is_dir) {
|
||||
wire_flags &= ~(SMB_O_RDONLY|SMB_O_RDWR|SMB_O_WRONLY);
|
||||
wire_flags |= SMB_O_DIRECTORY;
|
||||
}
|
||||
|
||||
p = data;
|
||||
SIVAL(p,0,0); /* No oplock. */
|
||||
SIVAL(p,4,open_flags_to_wire(flags));
|
||||
SIVAL(p,4,wire_flags);
|
||||
SIVAL(p,8,unix_perms_to_wire(mode));
|
||||
SSVAL(p,12,SMB_NO_INFO_LEVEL_RETURNED); /* No info level returned. */
|
||||
|
||||
@ -1874,18 +1878,22 @@ int cli_posix_open(struct cli_state *cli, const char *fname, int flags, mode_t m
|
||||
return fnum;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
open - POSIX semantics.
|
||||
****************************************************************************/
|
||||
|
||||
int cli_posix_open(struct cli_state *cli, const char *fname, int flags, mode_t mode)
|
||||
{
|
||||
return cli_posix_open_internal(cli, fname, flags, mode, False);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
mkdir - POSIX semantics.
|
||||
****************************************************************************/
|
||||
|
||||
int cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode)
|
||||
{
|
||||
#if defined(O_DIRECTORY)
|
||||
return (cli_posix_open(cli, fname, O_CREAT|O_DIRECTORY, mode) == -1) ? -1 : 0;
|
||||
#else
|
||||
cli_set_nt_error(cli, NT_STATUS_NOT_IMPLEMENTED);
|
||||
return -1;
|
||||
#endif
|
||||
return (cli_posix_open_internal(cli, fname, O_CREAT, mode, True) == -1) ? -1 : 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -4305,6 +4305,11 @@ static NTSTATUS smb_set_posix_acl(connection_struct *conn,
|
||||
return NT_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
DEBUG(10,("smb_set_posix_acl: file %s num_file_acls = %u, num_def_acls = %u\n",
|
||||
fname ? fname : fsp->fsp_name,
|
||||
(unsigned int)num_file_acls,
|
||||
(unsigned int)num_def_acls));
|
||||
|
||||
if (valid_file_acls && !set_unix_posix_acl(conn, fsp, fname, num_file_acls,
|
||||
pdata + SMB_POSIX_ACL_HEADER_SIZE)) {
|
||||
return map_nt_error_from_unix(errno);
|
||||
@ -4386,6 +4391,14 @@ static NTSTATUS smb_set_posix_lock(connection_struct *conn,
|
||||
count = (SMB_BIG_UINT)IVAL(pdata,POSIX_LOCK_LEN_OFFSET);
|
||||
#endif /* HAVE_LONGLONG */
|
||||
|
||||
DEBUG(10,("smb_set_posix_lock: file %s, lock_type = %u,"
|
||||
"lock_pid = %u, count = %.0f, offset = %.0f\n",
|
||||
fsp->fsp_name,
|
||||
(unsigned int)lock_type,
|
||||
(unsigned int)lock_pid,
|
||||
(double)count,
|
||||
(double)offset ));
|
||||
|
||||
if (lock_type == UNLOCK_LOCK) {
|
||||
status = do_unlock(fsp,
|
||||
lock_pid,
|
||||
@ -4450,6 +4463,9 @@ static NTSTATUS smb_set_info_standard(connection_struct *conn,
|
||||
/* write time */
|
||||
tvs.modtime = srv_make_unix_date2(pdata+l1_fdateLastWrite);
|
||||
|
||||
DEBUG(10,("smb_set_info_standard: file %s\n",
|
||||
fname ? fname : fsp->fsp_name ));
|
||||
|
||||
return smb_set_file_time(conn,
|
||||
fsp,
|
||||
fname,
|
||||
@ -4507,6 +4523,9 @@ static NTSTATUS smb_set_file_basic_info(connection_struct *conn,
|
||||
tvs.modtime = null_mtime(write_time) ? changed_time : write_time;
|
||||
}
|
||||
|
||||
DEBUG(10,("smb_set_file_basic_info: file %s\n",
|
||||
fname ? fname : fsp->fsp_name ));
|
||||
|
||||
return smb_set_file_time(conn,
|
||||
fsp,
|
||||
fname,
|
||||
@ -4910,6 +4929,9 @@ static NTSTATUS smb_posix_mkdir(connection_struct *conn,
|
||||
|
||||
mod_unixmode = (uint32)unixmode | FILE_FLAG_POSIX_SEMANTICS;
|
||||
|
||||
DEBUG(10,("smb_posix_mkdir: file %s, mode 0%o\n",
|
||||
fname, (unsigned int)unixmode ));
|
||||
|
||||
status = open_directory(conn,
|
||||
fname,
|
||||
psbuf,
|
||||
@ -5056,6 +5078,11 @@ static NTSTATUS smb_posix_open(connection_struct *conn,
|
||||
mod_unixmode |= FILE_FLAG_NO_BUFFERING;
|
||||
}
|
||||
|
||||
DEBUG(10,("smb_posix_open: file %s, smb_posix_flags = %u, mode 0%o\n",
|
||||
fname,
|
||||
(unsigned int)wire_open_mode,
|
||||
(unsigned int)unixmode ));
|
||||
|
||||
status = open_file_ntcreate(conn,
|
||||
fname,
|
||||
psbuf,
|
||||
@ -5150,6 +5177,10 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
|
||||
return NT_STATUS_NOT_A_DIRECTORY;
|
||||
}
|
||||
|
||||
DEBUG(10,("smb_posix_unlink: %s %s\n",
|
||||
(flags == SMB_POSIX_UNLINK_DIRECTORY_TARGET) ? "directory" : "file",
|
||||
fname));
|
||||
|
||||
if (VALID_STAT_OF_DIR(*psbuf)) {
|
||||
status = open_directory(conn,
|
||||
fname,
|
||||
|
Loading…
x
Reference in New Issue
Block a user