summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-04-27 18:46:10 +0000
committerJeremy Allison <jra@samba.org>2000-04-27 18:46:10 +0000
commite3987ff7a638f9ea8b6794f1ed0df530d8488033 (patch)
tree699420ad5d125a75131eb8b02329770172ec7948 /source3/smbd
parent3d9141d4156a3207af03d4137acd4b1cde46cfae (diff)
downloadsamba-e3987ff7a638f9ea8b6794f1ed0df530d8488033.tar.gz
samba-e3987ff7a638f9ea8b6794f1ed0df530d8488033.tar.bz2
samba-e3987ff7a638f9ea8b6794f1ed0df530d8488033.zip
Fixed crash bugs Andrew pointed out with LOCK4 smbtorture
test. Was miscounting posix locks, plus was not taking into account the case where other_fsp == fsp in the 'move locks' case. DOH ! This code will be re-written anyway :-). Jeremy. (This used to be commit 5278ec016cb24d8263fe6e7c1d389f466270ef24)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/open.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 44bb6ebaf7..c7ca8256d2 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -57,12 +57,16 @@ static BOOL fd_close_posix_locks(files_struct *fsp)
{
files_struct *other_fsp;
- DEBUG(10,("fd_close_posix_locks: file %s: fsp->num_posix_pending_closes = %u.\n", fsp->fsp_name,
- (unsigned int)fsp->num_posix_pending_closes ));
+ DEBUG(10,("fd_close_posix_locks: file %s: fsp->num_posix_pending_closes = %u \
+fsp->posix_pending_close_fds = %lx.\n", fsp->fsp_name,
+ (unsigned int)fsp->num_posix_pending_closes, (unsigned long)fsp->posix_pending_close_fds ));
for(other_fsp = file_find_di_first(fsp->dev, fsp->inode); other_fsp;
other_fsp = file_find_di_next(other_fsp)) {
+ if(other_fsp == fsp)
+ continue;
+
if ((other_fsp->fd != -1) && other_fsp->num_posix_locks) {
/*
@@ -74,8 +78,8 @@ static BOOL fd_close_posix_locks(files_struct *fsp)
unsigned int extra_fds = fsp->num_posix_pending_closes + 1;
DEBUG(10,("fd_close_posix_locks: file %s: Transferring to \
-file %s, other_fsp->num_posix_pending_closes = %u.\n",
- fsp->fsp_name, other_fsp->fsp_name, (unsigned int)other_fsp->num_posix_pending_closes ));
+file %s, extra_fds = %u, other_fsp->num_posix_pending_closes = %u.\n",
+ fsp->fsp_name, other_fsp->fsp_name, extra_fds, (unsigned int)other_fsp->num_posix_pending_closes ));
other_fsp->posix_pending_close_fds = (int *)Realloc(other_fsp->posix_pending_close_fds,
(other_fsp->num_posix_pending_closes +