summaryrefslogtreecommitdiffstats
path: root/source3/smbd/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/process.c')
-rw-r--r--source3/smbd/process.c65
1 files changed, 30 insertions, 35 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 007621f6bb2..43d3c6c5314 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -42,8 +42,8 @@ extern int last_message;
extern int global_oplock_break;
extern userdom_struct current_user_info;
extern int smb_read_error;
-extern VOLATILE sig_atomic_t reload_after_sighup;
-extern VOLATILE sig_atomic_t got_sig_term;
+SIG_ATOMIC_T reload_after_sighup;
+SIG_ATOMIC_T got_sig_term;
extern BOOL global_machine_password_needs_changing;
extern fstring global_myworkgroup;
extern pstring global_myname;
@@ -109,10 +109,12 @@ BOOL push_oplock_pending_smb_message(char *buf, int msg_len)
oplock messages, change notify events etc.
****************************************************************************/
-static void async_processing(fd_set *fds, char *buffer, int buffer_len)
+static void async_processing(char *buffer, int buffer_len)
{
+ DEBUG(10,("async_processing: Doing async processing.\n"));
+
/* check for oplock messages (both UDP and kernel) */
- if (receive_local_message(fds, buffer, buffer_len, 0)) {
+ if (receive_local_message(buffer, buffer_len, 1)) {
process_local_message(buffer, buffer_len);
}
@@ -193,6 +195,27 @@ static BOOL receive_message_or_smb(char *buffer, int buffer_len, int timeout)
*/
FD_ZERO(&fds);
+
+ /*
+ * Ensure we process oplock break messages by preference.
+ * We have to do this before the select, after the select
+ * and if the select returns EINTR. This is due to the fact
+ * that the selects called from async_processing can eat an EINTR
+ * caused by a signal (we can't take the break message there).
+ * This is hideously complex - *MUST* be simplified for 3.0 ! JRA.
+ */
+
+ if (oplock_message_waiting(&fds)) {
+ DEBUG(10,("receive_message_or_smb: oplock_message is waiting.\n"));
+ async_processing(buffer, buffer_len);
+ /*
+ * After async processing we must go and do the select again, as
+ * the state of the flag in fds for the server file descriptor is
+ * indeterminate - we may have done I/O on it in the oplock processing. JRA.
+ */
+ goto again;
+ }
+
FD_SET(smbd_server_fd(),&fds);
maxfd = setup_oplock_select_set(&fds);
@@ -206,7 +229,7 @@ static BOOL receive_message_or_smb(char *buffer, int buffer_len, int timeout)
is the best we can do until the oplock code knows more about
signals */
if (selrtn == -1 && errno == EINTR) {
- async_processing(&fds, buffer, buffer_len);
+ async_processing(buffer, buffer_len);
/*
* After async processing we must go and do the select again, as
* the state of the flag in fds for the server file descriptor is
@@ -235,7 +258,7 @@ static BOOL receive_message_or_smb(char *buffer, int buffer_len, int timeout)
*/
if (oplock_message_waiting(&fds)) {
- async_processing(&fds, buffer, buffer_len);
+ async_processing(buffer, buffer_len);
/*
* After async processing we must go and do the select again, as
* the state of the flag in fds for the server file descriptor is
@@ -275,7 +298,6 @@ BOOL receive_next_smb(char *inbuf, int bufsize, int timeout)
void respond_to_all_remaining_local_messages(void)
{
char buffer[1024];
- fd_set fds;
/*
* Assert we have no exclusive open oplocks.
@@ -288,23 +310,12 @@ void respond_to_all_remaining_local_messages(void)
}
/*
- * Setup the select read fd set.
- */
-
- FD_ZERO(&fds);
- if(!setup_oplock_select_set(&fds))
- return;
-
- /*
* Keep doing receive_local_message with a 1 ms timeout until
* we have no more messages.
*/
- while(receive_local_message(&fds, buffer, sizeof(buffer), 1)) {
+ while(receive_local_message(buffer, sizeof(buffer), 1)) {
/* Deal with oplock break requests from other smbd's. */
process_local_message(buffer, sizeof(buffer));
-
- FD_ZERO(&fds);
- (void)setup_oplock_select_set(&fds);
}
return;
@@ -829,10 +840,6 @@ set. Ignoring max smbd restriction.\n"));
****************************************************************************/
void process_smb(char *inbuf, char *outbuf)
{
-#ifdef WITH_SSL
- extern BOOL sslEnabled; /* don't use function for performance reasons */
- static int sslConnected = 0;
-#endif /* WITH_SSL */
static int trans_num;
int msg_type = CVAL(inbuf,0);
int32 len = smb_len(inbuf);
@@ -860,18 +867,6 @@ void process_smb(char *inbuf, char *outbuf)
DEBUG( 6, ( "got message type 0x%x of len 0x%x\n", msg_type, len ) );
DEBUG( 3, ( "Transaction %d of length %d\n", trans_num, nread ) );
-#ifdef WITH_SSL
- if(sslEnabled && !sslConnected){
- sslConnected = sslutil_negotiate_ssl(smbd_server_fd(), msg_type);
- if(sslConnected < 0){ /* an error occured */
- exit_server("SSL negotiation failed");
- }else if(sslConnected){
- trans_num++;
- return;
- }
- }
-#endif /* WITH_SSL */
-
if (msg_type == 0)
show_msg(inbuf);
else if(msg_type == SMBkeepalive)