summaryrefslogtreecommitdiff
path: root/source3/smbd/process.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-08-20 19:28:37 +0000
committerJeremy Allison <jra@samba.org>1998-08-20 19:28:37 +0000
commitdc76502cd8a950f6aff84ce4eedfd9d2b30d3dcc (patch)
tree8d8aead30371fec7fa6b191468098d631a6002af /source3/smbd/process.c
parent852519282d43d7d12c103c01ca979952f041d683 (diff)
downloadsamba-dc76502cd8a950f6aff84ce4eedfd9d2b30d3dcc.tar.gz
samba-dc76502cd8a950f6aff84ce4eedfd9d2b30d3dcc.tar.bz2
samba-dc76502cd8a950f6aff84ce4eedfd9d2b30d3dcc.zip
Turning on blocking locking code. NB. Blocking lock requests that are not
the head of an SMB request (ie. are part of a chain) will not be queued - this will be fixed when we move to the new chain code. In practice, this doesn't seem to cause much of a problem (in my admittedly limited testing) bug a debug level zero message will be placed in the log when this happens to help determine how real the problem is. smbd/locking.c: New debug messages. smbd/blocking.c: New blocking code - handles SMBlock, SMBlockread and SMBlockingX smbd/chgpasswd.c: Fix for master fd leak. smbd/files.c: Tidyup comment. smbd/nttrans.c: Added fnum to debug message. smbd/process.c: Made chain_reply() use construct_reply_common(). Added blocking lock queue processing into idle loop. smbd/reply.c: Added queue pushes for SMBlock, SMBlockread and SMBlockingX. Jeremy. (This used to be commit e1dd03ecda0bc6d7eaa31070c83774bb5679fd1b)
Diffstat (limited to 'source3/smbd/process.c')
-rw-r--r--source3/smbd/process.c72
1 files changed, 31 insertions, 41 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 756e010d9e..5bf8cdb2b1 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -29,7 +29,6 @@ char *InBuffer = NULL;
char *OutBuffer = NULL;
char *last_inbuf = NULL;
-
/*
* Size of data we can send to client. Set
* by the client for all protocols above CORE.
@@ -485,6 +484,29 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize
return(outsize);
}
+/****************************************************************************
+ Helper function for contruct_reply.
+****************************************************************************/
+
+void construct_reply_common(char *inbuf,char *outbuf)
+{
+ bzero(outbuf,smb_size);
+
+ set_message(outbuf,0,0,True);
+ CVAL(outbuf,smb_com) = CVAL(inbuf,smb_com);
+
+ memcpy(outbuf+4,inbuf+4,4);
+ CVAL(outbuf,smb_rcls) = SMB_SUCCESS;
+ CVAL(outbuf,smb_reh) = 0;
+ CVAL(outbuf,smb_flg) = 0x80 | (CVAL(inbuf,smb_flg) & 0x8); /* bit 7 set
+ means a reply */
+ SSVAL(outbuf,smb_flg2,1); /* say we support long filenames */
+ SSVAL(outbuf,smb_err,SMB_SUCCESS);
+ SSVAL(outbuf,smb_tid,SVAL(inbuf,smb_tid));
+ SSVAL(outbuf,smb_pid,SVAL(inbuf,smb_pid));
+ SSVAL(outbuf,smb_uid,SVAL(inbuf,smb_uid));
+ SSVAL(outbuf,smb_mid,SVAL(inbuf,smb_mid));
+}
/****************************************************************************
construct a chained reply and add it to the already made reply
@@ -542,21 +564,7 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize)
CVAL(inbuf2,smb_com) = smb_com2;
/* create the out buffer */
- bzero(outbuf2,smb_size);
- set_message(outbuf2,0,0,True);
- CVAL(outbuf2,smb_com) = CVAL(inbuf2,smb_com);
-
- memcpy(outbuf2+4,inbuf2+4,4);
- CVAL(outbuf2,smb_rcls) = SMB_SUCCESS;
- CVAL(outbuf2,smb_reh) = 0;
- CVAL(outbuf2,smb_flg) = 0x80 | (CVAL(inbuf2,smb_flg) & 0x8); /* bit 7 set
- means a reply */
- SSVAL(outbuf2,smb_flg2,1); /* say we support long filenames */
- SSVAL(outbuf2,smb_err,SMB_SUCCESS);
- SSVAL(outbuf2,smb_tid,SVAL(inbuf2,smb_tid));
- SSVAL(outbuf2,smb_pid,SVAL(inbuf2,smb_pid));
- SSVAL(outbuf2,smb_uid,SVAL(inbuf2,smb_uid));
- SSVAL(outbuf2,smb_mid,SVAL(inbuf2,smb_mid));
+ construct_reply_common(inbuf2, outbuf2);
DEBUG(3,("Chained message\n"));
show_msg(inbuf2);
@@ -582,34 +590,10 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize)
return outsize2;
}
-
-/****************************************************************************
- Helper function for contruct_reply.
-****************************************************************************/
-
-void construct_reply_common(char *inbuf,char *outbuf)
-{
- bzero(outbuf,smb_size);
-
- CVAL(outbuf,smb_com) = CVAL(inbuf,smb_com);
- set_message(outbuf,0,0,True);
-
- memcpy(outbuf+4,inbuf+4,4);
- CVAL(outbuf,smb_rcls) = SMB_SUCCESS;
- CVAL(outbuf,smb_reh) = 0;
- CVAL(outbuf,smb_flg) = 0x80 | (CVAL(inbuf,smb_flg) & 0x8); /* bit 7 set
- means a reply */
- SSVAL(outbuf,smb_flg2,1); /* say we support long filenames */
- SSVAL(outbuf,smb_err,SMB_SUCCESS);
- SSVAL(outbuf,smb_tid,SVAL(inbuf,smb_tid));
- SSVAL(outbuf,smb_pid,SVAL(inbuf,smb_pid));
- SSVAL(outbuf,smb_uid,SVAL(inbuf,smb_uid));
- SSVAL(outbuf,smb_mid,SVAL(inbuf,smb_mid));
-}
-
/****************************************************************************
construct a reply to the incoming packet
****************************************************************************/
+
int construct_reply(char *inbuf,char *outbuf,int size,int bufsize)
{
int type = CVAL(inbuf,smb_com);
@@ -817,6 +801,12 @@ machine %s in domain %s.\n", global_myname, global_myworkgroup ));
}
/*
+ * Check to see if we have any blocking locks
+ * outstanding on the queue.
+ */
+ process_blocking_lock_queue(t);
+
+ /*
* Check to see if we have any change notifies
* outstanding on the queue.
*/