mirror of
https://github.com/samba-team/samba.git
synced 2025-09-07 21:44:22 +03:00
CVE-2017-2619: s3: smbd: OpenDir_fsp() use early returns.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12496 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org>
This commit is contained in:
committed by
Karolin Seeger
parent
05a9898dda
commit
86f15237a1
@@ -1761,7 +1761,17 @@ static struct smb_Dir *OpenDir_fsp(TALLOC_CTX *mem_ctx, connection_struct *conn,
|
||||
struct smbd_server_connection *sconn = conn->sconn;
|
||||
|
||||
if (!dirp) {
|
||||
return NULL;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!fsp->is_directory) {
|
||||
errno = EBADF;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (fsp->fh->fd == -1) {
|
||||
errno = EBADF;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
dirp->conn = conn;
|
||||
@@ -1778,7 +1788,6 @@ static struct smb_Dir *OpenDir_fsp(TALLOC_CTX *mem_ctx, connection_struct *conn,
|
||||
}
|
||||
talloc_set_destructor(dirp, smb_Dir_destructor);
|
||||
|
||||
if (fsp->is_directory && fsp->fh->fd != -1) {
|
||||
dirp->dir = SMB_VFS_FDOPENDIR(fsp, mask, attr);
|
||||
if (dirp->dir != NULL) {
|
||||
dirp->fsp = fsp;
|
||||
@@ -1791,7 +1800,6 @@ static struct smb_Dir *OpenDir_fsp(TALLOC_CTX *mem_ctx, connection_struct *conn,
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dirp->dir == NULL) {
|
||||
/* FDOPENDIR didn't work. Use OPENDIR instead. */
|
||||
|
Reference in New Issue
Block a user