1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-03 13:47:25 +03:00

s3: smbd: Make dptr_close() safe to call with an fsp handle stored in dptr->dir_hnd.

SMB1 doesn't currently do this, but subsequent changes will add handle based
calls to SMB1 so dptr_close() has to be able to cleanly remove any back pointers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Jeremy Allison 2019-07-17 12:57:00 -07:00 committed by Ralph Boehme
parent 2ba48f76ec
commit 5a038f5114

View File

@ -229,6 +229,8 @@ done:
void dptr_close(struct smbd_server_connection *sconn, int *key)
{
struct dptr_struct *dptr;
files_struct *fsp = NULL;
struct smb_Dir *dir_hnd = NULL;
SMB_ASSERT(!sconn->using_smb2);
@ -242,8 +244,19 @@ void dptr_close(struct smbd_server_connection *sconn, int *key)
return;
}
dir_hnd = dptr->dir_hnd;
if (dir_hnd != NULL && dir_hnd->fsp != NULL) {
SMB_ASSERT(dir_hnd->fsp->dptr->dir_hnd == dir_hnd);
fsp = dir_hnd->fsp;
}
dptr_close_internal(dptr);
if (fsp != NULL) {
fsp->dptr = NULL;
}
*key = INVALID_DPTR_KEY;
}