mirror of
https://github.com/samba-team/samba.git
synced 2025-01-28 17:47:29 +03:00
close socket issues:
- ssl close from cli_reestablish_connection() not called. - ntlmv2 fall-back to ntlmv1 failed. (This used to be commit fdc275353de85fde0c348320e4d64ba66365b73b)
This commit is contained in:
parent
2c146b78f7
commit
80d714e75b
@ -689,6 +689,7 @@ BOOL cli_session_request(struct cli_state *cli,
|
||||
struct nmb_name *calling, struct nmb_name *called);
|
||||
BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip);
|
||||
struct cli_state *cli_initialise(struct cli_state *cli);
|
||||
void cli_close_socket(struct cli_state *cli);
|
||||
void cli_shutdown(struct cli_state *cli);
|
||||
int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num);
|
||||
void cli_sockopt(struct cli_state *cli, char *options);
|
||||
|
@ -2555,6 +2555,24 @@ struct cli_state *cli_initialise(struct cli_state *cli)
|
||||
return cli;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
close the socket descriptor
|
||||
****************************************************************************/
|
||||
void cli_close_socket(struct cli_state *cli)
|
||||
{
|
||||
#ifdef WITH_SSL
|
||||
if (cli->fd != -1)
|
||||
{
|
||||
sslutil_disconnect(cli->fd);
|
||||
}
|
||||
#endif /* WITH_SSL */
|
||||
if (cli->fd != -1)
|
||||
{
|
||||
close(cli->fd);
|
||||
}
|
||||
cli->fd = -1;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
shutdown a client structure
|
||||
****************************************************************************/
|
||||
@ -2569,14 +2587,7 @@ void cli_shutdown(struct cli_state *cli)
|
||||
{
|
||||
free(cli->inbuf);
|
||||
}
|
||||
#ifdef WITH_SSL
|
||||
if (cli->fd != -1)
|
||||
sslutil_disconnect(cli->fd);
|
||||
#endif /* WITH_SSL */
|
||||
if (cli->fd != -1)
|
||||
{
|
||||
close(cli->fd);
|
||||
}
|
||||
cli_close_socket(cli);
|
||||
memset(cli, 0, sizeof(*cli));
|
||||
}
|
||||
|
||||
@ -2702,15 +2713,19 @@ BOOL cli_reestablish_connection(struct cli_state *cli)
|
||||
/* copy the parameters necessary to re-establish the connection */
|
||||
|
||||
if (cli->cnum != 0)
|
||||
{
|
||||
do_tcon = True;
|
||||
}
|
||||
|
||||
if (do_tcon)
|
||||
{
|
||||
fstrcpy(share, cli->share);
|
||||
fstrcpy(dev , cli->dev);
|
||||
do_tcon = True;
|
||||
}
|
||||
|
||||
memcpy(&called , &(cli->called ), sizeof(called ));
|
||||
memcpy(&calling, &(cli->calling), sizeof(calling));
|
||||
fstrcpy(dest_host, cli->full_dest_host_name);
|
||||
fstrcpy(dest_host, cli->desthost);
|
||||
|
||||
DEBUG(5,("cli_reestablish_connection: %s connecting to %s (ip %s) - %s [%s]\n",
|
||||
nmb_namestr(&calling), nmb_namestr(&called),
|
||||
@ -2728,7 +2743,7 @@ BOOL cli_reestablish_connection(struct cli_state *cli)
|
||||
{
|
||||
if (dup2(cli->fd, oldfd) == oldfd)
|
||||
{
|
||||
close(cli->fd);
|
||||
cli_close_socket(cli);
|
||||
}
|
||||
}
|
||||
return True;
|
||||
@ -2873,6 +2888,13 @@ BOOL cli_establish_connection(struct cli_state *cli,
|
||||
{
|
||||
DEBUG(10,("NTLMv2 failed. Using NTLMv1\n"));
|
||||
cli->use_ntlmv2 = False;
|
||||
if (do_tcon)
|
||||
{
|
||||
fstrcpy(cli->share, service);
|
||||
fstrcpy(cli->dev, service_type);
|
||||
}
|
||||
fstrcpy(cli->desthost, dest_host);
|
||||
cli_close_socket(cli);
|
||||
return cli_establish_connection(cli,
|
||||
dest_host, dest_ip,
|
||||
calling, called,
|
||||
|
Loading…
x
Reference in New Issue
Block a user