.base_name = smb_fname_dst->base_name,
.stream_name = smb_fname_dst->stream_name,
};
- DATA_BLOB blob;
- enum ndr_err_code ndr_err;
uint32_t i;
struct server_id self_pid = messaging_server_id(msg_ctx);
bool ok;
}
d->modified = True;
- ndr_err = ndr_push_struct_blob(
- &blob,
- talloc_tos(),
- &msg,
- (ndr_push_flags_fn_t)ndr_push_file_rename_message);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- DBG_DEBUG("ndr_push_file_rename_message failed: %s\n",
- ndr_errstr(ndr_err));
- return false;
- }
- if (DEBUGLVL(10)) {
- NDR_PRINT_DEBUG(file_rename_message, &msg);
- }
-
/* Send the messages. */
for (i=0; i<d->num_share_modes; i++) {
struct share_mode_entry *se = &d->share_modes[i];
- struct server_id_buf tmp;
+ DATA_BLOB blob;
+ enum ndr_err_code ndr_err;
if (!is_valid_share_mode_entry(se)) {
continue;
continue;
}
- DBG_DEBUG("sending rename message to %s\n",
- server_id_str_buf(se->pid, &tmp));
+ msg.share_file_id = se->share_file_id;
+
+ ndr_err = ndr_push_struct_blob(
+ &blob,
+ talloc_tos(),
+ &msg,
+ (ndr_push_flags_fn_t)ndr_push_file_rename_message);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ DBG_DEBUG("ndr_push_file_rename_message failed: %s\n",
+ ndr_errstr(ndr_err));
+ return false;
+ }
+ if (DEBUGLEVEL >= 10) {
+ struct server_id_buf tmp;
+ DBG_DEBUG("sending rename message to %s\n",
+ server_id_str_buf(se->pid, &tmp));
+ NDR_PRINT_DEBUG(file_rename_message, &msg);
+ }
messaging_send(msg_ctx, se->pid, MSG_SMB_FILE_RENAME, &blob);
- }
- TALLOC_FREE(blob.data);
+ TALLOC_FREE(blob.data);
+ }
ok = share_mode_forall_leases(lck, rename_lease_fn, NULL);
if (!ok) {
enum ndr_err_code ndr_err;
files_struct *fsp;
struct smb_filename *smb_fname = NULL;
- NTSTATUS status;
struct smbd_server_connection *sconn =
talloc_get_type_abort(private_data,
struct smbd_server_connection);
ndr_errstr(ndr_err));
goto out;
}
- if (DEBUGLVL(10)) {
+ if (DEBUGLEVEL >= 10) {
struct server_id_buf buf;
DBG_DEBUG("Got rename message from %s\n",
server_id_str_buf(src, &buf));
goto out;
}
- for(fsp = file_find_di_first(sconn, msg->id); fsp;
- fsp = file_find_di_next(fsp)) {
-
- if (strcmp(fsp->conn->connectpath, msg->servicepath) == 0) {
+ fsp = file_find_dif(sconn, msg->id, msg->share_file_id);
+ if (fsp == NULL) {
+ DBG_DEBUG("fsp not found\n");
+ goto out;
+ }
- DEBUG(10,("msg_file_was_renamed: renaming file %s from %s -> %s\n",
- fsp_fnum_dbg(fsp), fsp_str_dbg(fsp),
- smb_fname_str_dbg(smb_fname)));
- status = fsp_set_smb_fname(fsp, smb_fname);
- if (!NT_STATUS_IS_OK(status)) {
- goto out;
- }
- } else {
- /* TODO. JRA. */
- /* Now we have the complete path we can work out if this is
- actually within this share and adjust newname accordingly. */
- DEBUG(10,("msg_file_was_renamed: share mismatch (sharepath %s "
- "not sharepath %s) "
- "%s from %s -> %s\n",
- fsp->conn->connectpath,
- msg->servicepath,
- fsp_fnum_dbg(fsp),
- fsp_str_dbg(fsp),
- smb_fname_str_dbg(smb_fname)));
- }
- }
+ if (strcmp(fsp->conn->connectpath, msg->servicepath) == 0) {
+ NTSTATUS status;
+ DBG_DEBUG("renaming file %s from %s -> %s\n",
+ fsp_fnum_dbg(fsp),
+ fsp_str_dbg(fsp),
+ smb_fname_str_dbg(smb_fname));
+ status = fsp_set_smb_fname(fsp, smb_fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_DEBUG("fsp_set_smb_fname failed: %s\n",
+ nt_errstr(status));
+ }
+ } else {
+ /* TODO. JRA. */
+ /*
+ * Now we have the complete path we can work out if
+ * this is actually within this share and adjust
+ * newname accordingly.
+ */
+ DBG_DEBUG("share mismatch (sharepath %s not sharepath %s) "
+ "%s from %s -> %s\n",
+ fsp->conn->connectpath,
+ msg->servicepath,
+ fsp_fnum_dbg(fsp),
+ fsp_str_dbg(fsp),
+ smb_fname_str_dbg(smb_fname));
+ }
out:
TALLOC_FREE(msg);
}