summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-04-27 22:23:04 +0000
committerJeremy Allison <jra@samba.org>2000-04-27 22:23:04 +0000
commit36db78fedad935aaa689d52d7f58e075f1f71812 (patch)
tree24811c595378d882fd0737203667cfe468d199c5 /source3/smbd
parent3d3c50326ba7f32ebb2fc683a3410dc0d1f18cdc (diff)
downloadsamba-36db78fedad935aaa689d52d7f58e075f1f71812.tar.gz
samba-36db78fedad935aaa689d52d7f58e075f1f71812.tar.bz2
samba-36db78fedad935aaa689d52d7f58e075f1f71812.zip
Fixed subtle unlocking bug when a file is closed. We need to store the
smbpid used when a file was opened in the files_struct. Else we use the wrong global_smbpid when we are closing the file and trying to remove the brl locks - this causes the brl locks to be left when the file is closed as the samba_context check fails. Jeremy. (This used to be commit 2746e5602e493e5b022764b4b839eb4d2f14363b)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/open.c4
-rw-r--r--source3/smbd/process.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 737b9b5ef3..92bba76619 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -26,6 +26,7 @@ extern int DEBUGLEVEL;
extern pstring sesssetup_user;
extern uint16 global_oplock_port;
extern BOOL global_client_failed_oplock_break;
+extern int global_smbpid;
/****************************************************************************
fd support routines - attempt to do a dos_open.
@@ -164,6 +165,7 @@ static BOOL open_file(files_struct *fsp,connection_struct *conn,
fsp->dev = sbuf.st_dev;
GetTimeOfDay(&fsp->open_time);
fsp->vuid = current_user.vuid;
+ fsp->smbpid = global_smbpid;
fsp->size = 0;
fsp->pos = -1;
fsp->can_lock = True;
@@ -797,6 +799,7 @@ files_struct *open_file_stat(connection_struct *conn,
fsp->mode = 0;
GetTimeOfDay(&fsp->open_time);
fsp->vuid = current_user.vuid;
+ fsp->smbpid = global_smbpid;
fsp->size = 0;
fsp->pos = -1;
fsp->can_lock = False;
@@ -920,6 +923,7 @@ files_struct *open_directory(connection_struct *conn,
fsp->mode = 0;
GetTimeOfDay(&fsp->open_time);
fsp->vuid = current_user.vuid;
+ fsp->smbpid = global_smbpid;
fsp->size = 0;
fsp->pos = -1;
fsp->can_lock = True;
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index f378550282..77e6fc2aa7 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -28,6 +28,7 @@ struct timeval smb_last_time;
static char *InBuffer = NULL;
char *OutBuffer = NULL;
char *last_inbuf = NULL;
+int global_smbpid;
/*
* Size of data we can send to client. Set
@@ -418,7 +419,6 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize
static int num_smb_messages =
sizeof(smb_messages) / sizeof(struct smb_message_struct);
int match;
- extern int global_smbpid;
if (pid == (pid_t)-1)
pid = getpid();