mirror of
https://github.com/samba-team/samba.git
synced 2025-02-28 01:58:17 +03:00
s3:winbindd: Fix double close(fd)
Reported by Red Hat internal coverity BUG: https://bugzilla.samba.org/show_bug.cgi?id=15433 Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org> Autobuild-Date(master): Tue Jul 25 12:08:49 UTC 2023 on atb-devel-224
This commit is contained in:
parent
61c951e063
commit
dd998cc163
@ -708,6 +708,7 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain,
|
||||
* connect to a foreign domain
|
||||
* without a direct outbound trust.
|
||||
*/
|
||||
close(sockfd);
|
||||
return NT_STATUS_NO_TRUST_LSA_SECRET;
|
||||
}
|
||||
|
||||
@ -761,6 +762,13 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain,
|
||||
goto done;
|
||||
}
|
||||
|
||||
/*
|
||||
* cm_prepare_connection() is responsible that sockfd does not leak.
|
||||
* Once cli_state_create() returns with success, the
|
||||
* smbXcli_conn_destructor() makes sure that close(sockfd) is finally
|
||||
* called. Till that, close(sockfd) must be called on every unsuccessful
|
||||
* return.
|
||||
*/
|
||||
*cli = cli_state_create(NULL, sockfd, controller,
|
||||
smb_sign_client_connections, flags);
|
||||
if (*cli == NULL) {
|
||||
@ -1749,8 +1757,6 @@ static NTSTATUS cm_open_connection(struct winbindd_domain *domain,
|
||||
if (NT_STATUS_IS_OK(result)) {
|
||||
break;
|
||||
}
|
||||
close(fd);
|
||||
fd = -1;
|
||||
if (!retry) {
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user