summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-01-25 14:01:52 -0800
committerJeremy Allison <jra@samba.org>2011-01-25 14:01:52 -0800
commitb97f1ce68a512cb0da71ee1de9ddaa49dd466068 (patch)
tree4e3964b42e078b5d631502c06062c8788b0f093e /source3/smbd
parent76418e23bcde1eba4dfefbc10c51c083567a52e6 (diff)
downloadsamba-b97f1ce68a512cb0da71ee1de9ddaa49dd466068.tar.gz
samba-b97f1ce68a512cb0da71ee1de9ddaa49dd466068.tar.bz2
samba-b97f1ce68a512cb0da71ee1de9ddaa49dd466068.zip
Add name_hash into the share mode entry struct (as yet only use for renames to identify a specific path).
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/oplock.c2
-rw-r--r--source3/smbd/reply.c9
2 files changed, 10 insertions, 1 deletions
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 6f4d5780f3..e92fbd43af 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -873,6 +873,7 @@ void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e)
SIVAL(msg,OP_BREAK_MSG_FILE_ID_OFFSET,e->share_file_id);
SIVAL(msg,OP_BREAK_MSG_UID_OFFSET,e->uid);
SSVAL(msg,OP_BREAK_MSG_FLAGS_OFFSET,e->flags);
+ SIVAL(msg,OP_BREAK_MSG_NAME_HASH_OFFSET,e->name_hash);
#ifdef CLUSTER_SUPPORT
SIVAL(msg,OP_BREAK_MSG_VNN_OFFSET,e->pid.vnn);
#endif
@@ -896,6 +897,7 @@ void message_to_share_mode_entry(struct share_mode_entry *e, char *msg)
e->share_file_id = (unsigned long)IVAL(msg,OP_BREAK_MSG_FILE_ID_OFFSET);
e->uid = (uint32)IVAL(msg,OP_BREAK_MSG_UID_OFFSET);
e->flags = (uint16)SVAL(msg,OP_BREAK_MSG_FLAGS_OFFSET);
+ e->name_hash = IVAL(msg,OP_BREAK_MSG_NAME_HASH_OFFSET);
#ifdef CLUSTER_SUPPORT
e->pid.vnn = IVAL(msg,OP_BREAK_MSG_VNN_OFFSET);
#endif
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 0c3b8980b2..92be257029 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -5804,11 +5804,13 @@ static bool resolve_wildcards(TALLOC_CTX *ctx,
static void rename_open_files(connection_struct *conn,
struct share_mode_lock *lck,
+ uint32_t orig_name_hash,
const struct smb_filename *smb_fname_dst)
{
files_struct *fsp;
bool did_rename = False;
NTSTATUS status;
+ uint32_t new_name_hash;
for(fsp = file_find_di_first(conn->sconn, lck->id); fsp;
fsp = file_find_di_next(fsp)) {
@@ -5819,6 +5821,9 @@ static void rename_open_files(connection_struct *conn,
if (!strequal(fsp->conn->connectpath, conn->connectpath)) {
continue;
}
+ if (fsp->name_hash != orig_name_hash) {
+ continue;
+ }
DEBUG(10, ("rename_open_files: renaming file fnum %d "
"(file_id %s) from %s -> %s\n", fsp->fnum,
file_id_string_tos(&fsp->file_id), fsp_str_dbg(fsp),
@@ -5827,6 +5832,7 @@ static void rename_open_files(connection_struct *conn,
status = fsp_set_smb_fname(fsp, smb_fname_dst);
if (NT_STATUS_IS_OK(status)) {
did_rename = True;
+ new_name_hash = fsp->name_hash;
}
}
@@ -5838,6 +5844,7 @@ static void rename_open_files(connection_struct *conn,
/* Send messages to all smbd's (not ourself) that the name has changed. */
rename_share_filename(conn->sconn->msg_ctx, lck, conn->connectpath,
+ orig_name_hash, new_name_hash,
smb_fname_dst);
}
@@ -6147,7 +6154,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
notify_rename(conn, fsp->is_directory, fsp->fsp_name,
smb_fname_dst);
- rename_open_files(conn, lck, smb_fname_dst);
+ rename_open_files(conn, lck, fsp->name_hash, smb_fname_dst);
/*
* A rename acts as a new file create w.r.t. allowing an initial delete