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 = {
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 */
/* 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;