summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-04-13 20:49:11 +0000
committerJeremy Allison <jra@samba.org>2001-04-13 20:49:11 +0000
commit819482c07137937ee0c063437d2b2eade2895b99 (patch)
tree1f47417e5ff9791f9a5e74050d1faad49ea28f01 /source3/smbd
parent3c2c047e822b6c74ecc176d1623d5292657cde62 (diff)
downloadsamba-819482c07137937ee0c063437d2b2eade2895b99.tar.gz
samba-819482c07137937ee0c063437d2b2eade2895b99.tar.bz2
samba-819482c07137937ee0c063437d2b2eade2895b99.zip
Fixed potential file descriptor leak with MS-Access fix.
Jeremy. (This used to be commit 192887fe72157a141b8df1977085f479e5204782)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/open.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 5f8657262a..007a169f9e 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -60,6 +60,8 @@ static int fd_open(struct connection_struct *conn, char *fname,
int fd_close(struct connection_struct *conn, files_struct *fsp)
{
+ if (fsp->fd == -1)
+ return -1;
return fd_close_posix(conn, fsp);
}
@@ -699,9 +701,15 @@ files_struct *open_file_shared(connection_struct *conn,char *fname, SMB_STRUCT_S
* we can do. We also ensure we're not going to create or tuncate
* the file as we only want an access decision at this stage. JRA.
*/
- open_file(fsp,conn,fname,psbuf,flags|(flags2&~(O_TRUNC|O_CREAT)),mode);
+ fsp_open = open_file(fsp,conn,fname,psbuf,flags|(flags2&~(O_TRUNC|O_CREAT)),mode);
+
+ DEBUG(4,("open_file_shared : share_mode deny - calling open_file with \
+flags=0x%X flags2=0x%X mode=0%o returned %d\n",
+ flags,(flags2&~(O_TRUNC|O_CREAT)),(int)mode,(int)fsp_open ));
unlock_share_entry(conn, dev, inode);
+ if (fsp_open)
+ fd_close(conn, fsp);
file_free(fsp);
return NULL;
}