1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

s3: smbd: Change semantics of strict rename to search the file open db.

Without strict rename just look in local process. POSIX renames are
already dealt with above.

Documentation change to follow.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11065

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Jeremy Allison 2015-11-24 08:43:14 -08:00
parent 1582006112
commit 16f202871c
3 changed files with 14 additions and 2 deletions

View File

@ -1963,7 +1963,7 @@ static int have_file_open_below_fn(struct file_id fid,
return 1;
}
static bool have_file_open_below(connection_struct *conn,
bool have_file_open_below(connection_struct *conn,
const struct smb_filename *name)
{
struct have_file_open_below_state state = {

View File

@ -232,6 +232,8 @@ long TellDir(struct smb_Dir *dirp);
bool SearchDir(struct smb_Dir *dirp, const char *name, long *poffset);
NTSTATUS can_delete_directory(struct connection_struct *conn,
const char *dirname);
bool have_file_open_below(connection_struct *conn,
const struct smb_filename *name);
/* The following definitions come from smbd/dmapi.c */

View File

@ -2676,7 +2676,17 @@ static NTSTATUS can_rename(connection_struct *conn, files_struct *fsp,
/* If no pathnames are open below this
directory, allow the rename. */
if (file_find_subpath(fsp)) {
if (lp_strict_rename(SNUM(conn))) {
/*
* Strict rename, check open file db.
*/
if (have_file_open_below(fsp->conn, fsp->fsp_name)) {
return NT_STATUS_ACCESS_DENIED;
}
} else if (file_find_subpath(fsp)) {
/*
* No strict rename, just look in local process.
*/
return NT_STATUS_ACCESS_DENIED;
}
return NT_STATUS_OK;