summaryrefslogtreecommitdiffstats
path: root/source/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-07-28 22:42:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:38:24 -0500
commit4ace291278d9a44f5c577bdd3b282c1231e543df (patch)
treede2d270421bc224cf74758e82740770584733b57 /source/smbd
parentf462daf02c12cfba634f92e681eb23a09e7d0acf (diff)
downloadsamba-4ace291278d9a44f5c577bdd3b282c1231e543df.tar.gz
samba-4ace291278d9a44f5c577bdd3b282c1231e543df.tar.xz
samba-4ace291278d9a44f5c577bdd3b282c1231e543df.zip
r17293: After the results from the cluster tests in Germany,
fix the messaging code to call the efficient calls : save_re_uid() set_effective_uid(0); messaging_op restore_re_uid(); instead of using heavyweight become_root()/unbecome_root() pairs around all messaging code. Fixup the messaging code to ensure sec_init() is called (only once) so that non-root processes still work when sending messages. This is a lighter weight solution to become_root()/unbecome_root() (which swaps all the supplemental groups) and should be more efficient. I will migrate all server code over to using this (a similar technique should be used in the passdb backend where needed). Jeremy.
Diffstat (limited to 'source/smbd')
-rw-r--r--source/smbd/blocking.c3
-rw-r--r--source/smbd/close.c2
-rw-r--r--source/smbd/open.c2
-rw-r--r--source/smbd/oplock.c11
4 files changed, 0 insertions, 18 deletions
diff --git a/source/smbd/blocking.c b/source/smbd/blocking.c
index a0b93f50320..ed57c9f6216 100644
--- a/source/smbd/blocking.c
+++ b/source/smbd/blocking.c
@@ -837,9 +837,6 @@ BOOL blocking_lock_cancel(files_struct *fsp,
memcpy(msg, &blr, sizeof(blr));
memcpy(&msg[sizeof(blr)], &err, sizeof(NTSTATUS));
- /* Don't need to be root here as we're only ever
- sending to ourselves. */
-
message_send_pid(pid_to_procid(sys_getpid()),
MSG_SMB_BLOCKING_LOCK_CANCEL,
&msg, sizeof(msg), True);
diff --git a/source/smbd/close.c b/source/smbd/close.c
index 08e4a24a562..a3ddcae11d0 100644
--- a/source/smbd/close.c
+++ b/source/smbd/close.c
@@ -134,10 +134,8 @@ static void notify_deferred_opens(struct share_mode_lock *lck)
share_mode_entry_to_message(msg, e);
- become_root();
message_send_pid(e->pid, MSG_SMB_OPEN_RETRY,
msg, MSG_SMB_SHARE_MODE_ENTRY_SIZE, True);
- unbecome_root();
}
}
}
diff --git a/source/smbd/open.c b/source/smbd/open.c
index ef59da64473..5c10c590549 100644
--- a/source/smbd/open.c
+++ b/source/smbd/open.c
@@ -713,10 +713,8 @@ static BOOL delay_for_oplocks(struct share_mode_lock *lck,
SSVAL(msg,6,exclusive->op_type | FORCE_OPLOCK_BREAK_TO_NONE);
}
- become_root();
ret = message_send_pid(exclusive->pid, MSG_SMB_BREAK_REQUEST,
msg, MSG_SMB_SHARE_MODE_ENTRY_SIZE, True);
- unbecome_root();
if (!ret) {
DEBUG(3, ("Could not send oplock break message\n"));
}
diff --git a/source/smbd/oplock.c b/source/smbd/oplock.c
index 99ce79296fd..d9850ee051c 100644
--- a/source/smbd/oplock.c
+++ b/source/smbd/oplock.c
@@ -504,13 +504,10 @@ static void process_oplock_break_message(int msg_type, struct process_id src,
* get to process this message, we have closed the file. Reply
* with 'ok, oplock broken' */
DEBUG(3, ("Did not find fsp\n"));
- become_root();
/* We just send the same message back. */
message_send_pid(src, MSG_SMB_BREAK_RESPONSE,
buf, MSG_SMB_SHARE_MODE_ENTRY_SIZE, True);
-
- unbecome_root();
return;
}
@@ -529,13 +526,9 @@ static void process_oplock_break_message(int msg_type, struct process_id src,
DEBUG(3, ("Already downgraded oplock on 0x%x/%.0f: %s\n",
(unsigned int)fsp->dev, (double)fsp->inode,
fsp->fsp_name));
- become_root();
-
/* We just send the same message back. */
message_send_pid(src, MSG_SMB_BREAK_RESPONSE,
buf, MSG_SMB_SHARE_MODE_ENTRY_SIZE, True);
-
- unbecome_root();
return;
}
@@ -656,7 +649,6 @@ void reply_to_oplock_break_requests(files_struct *fsp)
{
int i;
- become_root();
for (i=0; i<fsp->num_pending_break_messages; i++) {
struct share_mode_entry *e = &fsp->pending_break_messages[i];
char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE];
@@ -666,7 +658,6 @@ void reply_to_oplock_break_requests(files_struct *fsp)
message_send_pid(e->pid, MSG_SMB_BREAK_RESPONSE,
msg, MSG_SMB_SHARE_MODE_ENTRY_SIZE, True);
}
- unbecome_root();
SAFE_FREE(fsp->pending_break_messages);
fsp->num_pending_break_messages = 0;
@@ -801,10 +792,8 @@ void release_level_2_oplocks_on_change(files_struct *fsp)
share_mode_entry_to_message(msg, share_entry);
- become_root();
message_send_pid(share_entry->pid, MSG_SMB_ASYNC_LEVEL2_BREAK,
msg, MSG_SMB_SHARE_MODE_ENTRY_SIZE, True);
- unbecome_root();
}
/* We let the message receivers handle removing the oplock state