return -1;
}
-bool have_file_open_below(connection_struct *conn,
- const struct smb_filename *name)
+bool have_file_open_below(struct files_struct *fsp)
{
struct have_file_open_below_state state = {
.found_one = false,
};
int ret;
- if (!VALID_STAT(name->st)) {
+ if (!lp_strict_rename(SNUM(fsp->conn))) {
+ if (file_find_subpath(fsp)) {
+ return true;
+ }
return false;
}
- if (!S_ISDIR(name->st.st_ex_mode)) {
+
+ if (!VALID_STAT(fsp->fsp_name->st)) {
+ return false;
+ }
+ if (!S_ISDIR(fsp->fsp_name->st.st_ex_mode)) {
return false;
}
- ret = opens_below_forall_read(conn, name, have_file_open_below_fn, &state);
+ ret = opens_below_forall_read(fsp->conn,
+ fsp->fsp_name,
+ have_file_open_below_fn,
+ &state);
if (ret == -1) {
return false;
}
return status;
}
- if (lp_strict_rename(SNUM(conn)) &&
- have_file_open_below(fsp->conn, fsp->fsp_name))
- {
+ if (have_file_open_below(fsp)) {
return NT_STATUS_ACCESS_DENIED;
}
void dptr_RewindDir(struct dptr_struct *dptr);
void dptr_set_priv(struct dptr_struct *dptr);
const char *dptr_wcard(struct smbd_server_connection *sconn, int key);
-bool have_file_open_below(connection_struct *conn,
- const struct smb_filename *name);
+bool have_file_open_below(struct files_struct *fsp);
bool opens_below_forall(struct connection_struct *conn,
const struct smb_filename *dir_name,
int (*fn)(struct share_mode_data *data,
/* If no pathnames are open below this
directory, allow the rename. */
- 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.
- */
+ if (have_file_open_below(fsp)) {
return NT_STATUS_ACCESS_DENIED;
}
return NT_STATUS_OK;