1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

Stat opens can have fsp->fd == -1 and will have a share entry. Ensure

that file_find_dif will find them. Fixes a core dump in smbd/open.c.
Jeremy.
This commit is contained in:
Jeremy Allison 0001-01-01 00:00:00 +00:00
parent 84a7714eba
commit 0e2165630d

View File

@ -231,13 +231,21 @@ files_struct *file_find_dif(SMB_DEV_T dev, SMB_INO_T inode, unsigned long file_i
files_struct *fsp;
for (fsp=Files;fsp;fsp=fsp->next,count++) {
if (fsp->fd != -1 &&
fsp->dev == dev &&
/* We can have a fsp->fd == -1 here as it could be a stat open. */
if (fsp->dev == dev &&
fsp->inode == inode &&
fsp->file_id == file_id ) {
if (count > 10) {
DLIST_PROMOTE(Files, fsp);
}
/* Paranoia check. */
if (fsp->fd == -1 && fsp->oplock_type != NO_OPLOCK) {
DEBUG(0,("file_find_dif: file %s dev = %x, inode = %.0f, file_id = %u \
oplock_type = %u is a stat open with oplock type !\n", fsp->fsp_name, (unsigned int)fsp->dev,
(double)fsp->inode, (unsigned int)fsp->file_id,
(unsigned int)fsp->oplock_type ));
smb_panic("file_find_dif\n");
}
return fsp;
}
}