mirror of
https://github.com/samba-team/samba.git
synced 2025-02-25 17:57:42 +03:00
Fixed crash bug which was assuming that fd_ptr was always non-null
(which is not the case with open directories). Jeremy. (This used to be commit c154b1601f5891d664fc538ec8874fa8ef2061e6)
This commit is contained in:
parent
8b1e3580bd
commit
bb9622bfa6
@ -263,6 +263,7 @@ files_struct *file_find_dit(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval
|
|||||||
|
|
||||||
for (fsp=Files;fsp;fsp=fsp->next,count++) {
|
for (fsp=Files;fsp;fsp=fsp->next,count++) {
|
||||||
if (fsp->open &&
|
if (fsp->open &&
|
||||||
|
fsp->fd_ptr != NULL &&
|
||||||
fsp->fd_ptr->dev == dev &&
|
fsp->fd_ptr->dev == dev &&
|
||||||
fsp->fd_ptr->inode == inode &&
|
fsp->fd_ptr->inode == inode &&
|
||||||
(tval ? (fsp->open_time.tv_sec == tval->tv_sec) : True ) &&
|
(tval ? (fsp->open_time.tv_sec == tval->tv_sec) : True ) &&
|
||||||
@ -287,6 +288,7 @@ files_struct *file_find_di_first(SMB_DEV_T dev, SMB_INO_T inode)
|
|||||||
|
|
||||||
for (fsp=Files;fsp;fsp=fsp->next) {
|
for (fsp=Files;fsp;fsp=fsp->next) {
|
||||||
if (fsp->open &&
|
if (fsp->open &&
|
||||||
|
fsp->fd_ptr != NULL &&
|
||||||
fsp->fd_ptr->dev == dev &&
|
fsp->fd_ptr->dev == dev &&
|
||||||
fsp->fd_ptr->inode == inode )
|
fsp->fd_ptr->inode == inode )
|
||||||
return fsp;
|
return fsp;
|
||||||
@ -305,6 +307,7 @@ files_struct *file_find_di_next(files_struct *start_fsp)
|
|||||||
|
|
||||||
for (fsp = start_fsp->next;fsp;fsp=fsp->next) {
|
for (fsp = start_fsp->next;fsp;fsp=fsp->next) {
|
||||||
if (fsp->open &&
|
if (fsp->open &&
|
||||||
|
fsp->fd_ptr != NULL &&
|
||||||
fsp->fd_ptr->dev == start_fsp->fd_ptr->dev &&
|
fsp->fd_ptr->dev == start_fsp->fd_ptr->dev &&
|
||||||
fsp->fd_ptr->inode == start_fsp->fd_ptr->inode )
|
fsp->fd_ptr->inode == start_fsp->fd_ptr->inode )
|
||||||
return fsp;
|
return fsp;
|
||||||
@ -337,7 +340,7 @@ void file_sync_all(connection_struct *conn)
|
|||||||
|
|
||||||
for (fsp=Files;fsp;fsp=next) {
|
for (fsp=Files;fsp;fsp=next) {
|
||||||
next=fsp->next;
|
next=fsp->next;
|
||||||
if (fsp->open && conn == fsp->conn) {
|
if (fsp->open && (conn == fsp->conn) && (fsp->fd_ptr != NULL)) {
|
||||||
sync_file(conn,fsp);
|
sync_file(conn,fsp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,7 +374,7 @@ void file_free(files_struct *fsp)
|
|||||||
|
|
||||||
string_free(&fsp->fsp_name);
|
string_free(&fsp->fsp_name);
|
||||||
|
|
||||||
if (fsp->fd_ptr && fsp->fd_ptr->ref_count == 0) {
|
if ((fsp->fd_ptr != NULL) && fsp->fd_ptr->ref_count == 0) {
|
||||||
fd_ptr_free(fsp->fd_ptr);
|
fd_ptr_free(fsp->fd_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1008,7 +1008,7 @@ BOOL attempt_close_oplocked_file(files_struct *fsp)
|
|||||||
|
|
||||||
DEBUG(5,("attempt_close_oplocked_file: checking file %s.\n", fsp->fsp_name));
|
DEBUG(5,("attempt_close_oplocked_file: checking file %s.\n", fsp->fsp_name));
|
||||||
|
|
||||||
if (fsp->open && fsp->granted_oplock && !fsp->sent_oplock_break) {
|
if (fsp->open && fsp->granted_oplock && !fsp->sent_oplock_break && (fsp->fd_ptr != NULL)) {
|
||||||
|
|
||||||
/* Try and break the oplock. */
|
/* Try and break the oplock. */
|
||||||
file_fd_struct *fd_ptr = fsp->fd_ptr;
|
file_fd_struct *fd_ptr = fsp->fd_ptr;
|
||||||
|
@ -1775,6 +1775,9 @@ dev = %x, inode = %.0f\n", iterate_fsp->fnum, (unsigned int)dev, (double)inode))
|
|||||||
|
|
||||||
unlock_share_entry(fsp->conn, dev, inode, token);
|
unlock_share_entry(fsp->conn, dev, inode, token);
|
||||||
|
|
||||||
|
DEBUG(10, ("call_trans2setfilepathinfo: %s delete on close flag for fnum = %d, file %s\n",
|
||||||
|
delete_on_close ? "Added" : "Removed", fsp->fnum, fsp->fsp_name ));
|
||||||
|
|
||||||
} /* end if(delete_on_close && !GET_DELETE_ON_CLOSE_FLAG(fsp->share_mode)) */
|
} /* end if(delete_on_close && !GET_DELETE_ON_CLOSE_FLAG(fsp->share_mode)) */
|
||||||
} /* end if lp_share_modes() */
|
} /* end if lp_share_modes() */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user