1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-01 04:58:35 +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>
(cherry picked from commit 16f202871ca850bec87e0ec243644b2c20266c44)
This commit is contained in:
Jeremy Allison 2015-11-24 08:43:14 -08:00 committed by Karolin Seeger
parent 7444aafd01
commit 932e8ccf06
3 changed files with 14 additions and 2 deletions

View File

@ -1965,7 +1965,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

@ -229,6 +229,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;