summaryrefslogtreecommitdiff
path: root/source3/smbd/server.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1997-11-29 02:40:31 +0000
committerAndrew Tridgell <tridge@samba.org>1997-11-29 02:40:31 +0000
commitcf9d07cc7d41627a59ea3bec5ba2b9eebb894ab5 (patch)
tree84f271f49fb416ba4c4272d3218895d8706f30af /source3/smbd/server.c
parent7c025b60ac6a5247ef88ee1d8c6064346c98b5a3 (diff)
downloadsamba-cf9d07cc7d41627a59ea3bec5ba2b9eebb894ab5.tar.gz
samba-cf9d07cc7d41627a59ea3bec5ba2b9eebb894ab5.tar.bz2
samba-cf9d07cc7d41627a59ea3bec5ba2b9eebb894ab5.zip
added a sent_oplock_break element to Files[] as a paranoia check so we
can't sent a oplock break twice on the same file. changed some debug levels in the oplock code to level 0 so we can track down a bug zero the returned Files[] entry in find_free_file() don't try to overcome client bugs in the handling of non-encrypted passwords if in server level security mode added paranoid null termination of password buffers slight change to my ajt_panic() routine (This used to be commit e360c79c9cec681c4609783019749773d3e79386)
Diffstat (limited to 'source3/smbd/server.c')
-rw-r--r--source3/smbd/server.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 536e89bf18..77c8fc319f 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1935,6 +1935,7 @@ dev = %x, inode = %x\n", old_shares[i].op_type, fname, dev, inode));
!IS_VETO_OPLOCK_PATH(cnum,fname))
{
fs_p->granted_oplock = True;
+ fs_p->sent_oplock_break = False;
global_oplocks_open++;
port = oplock_port;
@@ -2807,7 +2808,7 @@ global_oplocks_open = %d\n", timestring(), dev, inode, global_oplocks_open));
if(fsp == NULL)
{
/* The file could have been closed in the meantime - return success. */
- DEBUG(3,("%s oplock_break: cannot find open file with dev = %x, inode = %x (fnum = %d) \
+ DEBUG(0,("%s oplock_break: cannot find open file with dev = %x, inode = %x (fnum = %d) \
allowing break to succeed.\n", timestring(), dev, inode, fnum));
return True;
}
@@ -2823,11 +2824,19 @@ allowing break to succeed.\n", timestring(), dev, inode, fnum));
if(!fsp->granted_oplock)
{
- DEBUG(3,("%s oplock_break: file %s (fnum = %d, dev = %x, inode = %x) has no oplock. \
-Allowing break to succeed regardless.\n", timestring(), fsp->name, fnum, dev, inode));
+ DEBUG(0,("%s oplock_break: file %s (fnum = %d, dev = %x, inode = %x) has no oplock. Allowing break to succeed regardless.\n", timestring(), fsp->name, fnum, dev, inode));
return True;
}
+ /* mark the oplock break as sent - we don't want to send twice! */
+ if (fsp->sent_oplock_break)
+ {
+ DEBUG(0,("%s ERROR: oplock_break already sent for file %s (fnum = %d, dev = %x, inode = %x)\n", timestring(), fsp->name, fnum, dev, inode));
+ return True;
+ }
+
+ fsp->sent_oplock_break = True;
+
/* Now comes the horrid part. We must send an oplock break to the client,
and then process incoming messages until we get a close or oplock release.
*/
@@ -2923,7 +2932,7 @@ inode = %x).\n", timestring(), fsp->name, fnum, dev, inode));
from the sharemode. */
/* Paranoia.... */
fsp->granted_oplock = False;
- global_oplocks_open--;
+ global_oplocks_open--;
}
/* Santity check - remove this later. JRA */
@@ -3599,8 +3608,11 @@ int find_free_file(void )
/* we start at 1 here for an obscure reason I can't now remember,
but I think is important :-) */
for (i=1;i<MAX_OPEN_FILES;i++)
- if (!Files[i].open)
- return(i);
+ if (!Files[i].open) {
+ /* paranoia */
+ memset(&Files[i], 0, sizeof(Files[i]));
+ return(i);
+ }
DEBUG(1,("ERROR! Out of file structures - perhaps increase MAX_OPEN_FILES?\n"));
return(-1);
}