summaryrefslogtreecommitdiffstats
path: root/source/smbd/open.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-01-12 22:17:54 +0000
committerJeremy Allison <jra@samba.org>2006-01-12 22:17:54 +0000
commit43543f32b912b4a393ad7c292d2eae3935b5cbcc (patch)
tree26791cb8610f024c67a930fdf56ef05c15f24920 /source/smbd/open.c
parent0ff3a1ecb2abec6a73252a476a0aa250dcdada02 (diff)
downloadsamba-43543f32b912b4a393ad7c292d2eae3935b5cbcc.tar.gz
samba-43543f32b912b4a393ad7c292d2eae3935b5cbcc.tar.xz
samba-43543f32b912b4a393ad7c292d2eae3935b5cbcc.zip
r12877: Stop passing structs around in smb messages, instead
always linearize into little-endian. Should fix all Solaris issues with this, plus provide a cleaner base moving forward for cluster-aware Samba where smbd's can communicate across different compilers/architectures (eventually these message will have to go cross-machine). Jeremy.
Diffstat (limited to 'source/smbd/open.c')
-rw-r--r--source/smbd/open.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/source/smbd/open.c b/source/smbd/open.c
index e6c749fab9c..0ccac592d61 100644
--- a/source/smbd/open.c
+++ b/source/smbd/open.c
@@ -683,12 +683,17 @@ static BOOL delay_for_oplocks(struct share_mode_lock *lck, files_struct *fsp)
if (delay_it) {
BOOL ret;
+ char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE];
+
DEBUG(10, ("Sending break request to PID %s\n",
procid_str_static(&exclusive->pid)));
exclusive->op_mid = get_current_mid();
+
+ share_mode_entry_to_message(msg, exclusive);
+
become_root();
ret = message_send_pid(exclusive->pid, MSG_SMB_BREAK_REQUEST,
- exclusive, sizeof(*exclusive), True);
+ msg, MSG_SMB_SHARE_MODE_ENTRY_SIZE, True);
unbecome_root();
if (!ret) {
DEBUG(3, ("Could not send oplock break message\n"));
@@ -2055,25 +2060,30 @@ files_struct *open_file_stat(connection_struct *conn, char *fname,
void msg_file_was_renamed(int msg_type, struct process_id src, void *buf, size_t len)
{
files_struct *fsp;
- struct file_renamed_message *frm = (struct file_renamed_message *)buf;
+ char *frm = (char *)buf;
+ SMB_DEV_T dev;
+ SMB_INO_T inode;
const char *sharepath;
const char *newname;
size_t sp_len;
- if (buf == NULL || len < sizeof(*frm)) {
+ if (buf == NULL || len < MSG_FILE_RENAMED_MIN_SIZE + 2) {
DEBUG(0, ("msg_file_was_renamed: Got invalid msg len %d\n", (int)len));
return;
}
- sharepath = &frm->names[0];
+ /* Unpack the message. */
+ dev = DEV_T_VAL(frm,0);
+ inode = INO_T_VAL(frm,8);
+ sharepath = &frm[16];
newname = sharepath + strlen(sharepath) + 1;
sp_len = strlen(sharepath);
DEBUG(10,("msg_file_was_renamed: Got rename message for sharepath %s, new name %s, "
"dev %x, inode %.0f\n",
- sharepath, newname, (unsigned int)frm->dev, (double)frm->inode ));
+ sharepath, newname, (unsigned int)dev, (double)inode ));
- for(fsp = file_find_di_first(frm->dev, frm->inode); fsp; fsp = file_find_di_next(fsp)) {
+ for(fsp = file_find_di_first(dev, inode); fsp; fsp = file_find_di_next(fsp)) {
if (memcmp(fsp->conn->connectpath, sharepath, sp_len) == 0) {
DEBUG(10,("msg_file_was_renamed: renaming file fnum %d from %s -> %s\n",
fsp->fnum, fsp->fsp_name, newname ));