summaryrefslogtreecommitdiff
path: root/source3/libsmb/clientgen.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-08-03 17:21:34 +0000
committerLuke Leighton <lkcl@samba.org>1999-08-03 17:21:34 +0000
commit80d714e75b48b6ed75de48ea0ca878736eb9b259 (patch)
tree0b83298b98d6cc2c39d9dafe3316d16f36e14685 /source3/libsmb/clientgen.c
parent2c146b78f761924d0013a9917562f7bbbfee3ec6 (diff)
downloadsamba-80d714e75b48b6ed75de48ea0ca878736eb9b259.tar.gz
samba-80d714e75b48b6ed75de48ea0ca878736eb9b259.tar.bz2
samba-80d714e75b48b6ed75de48ea0ca878736eb9b259.zip
close socket issues:
- ssl close from cli_reestablish_connection() not called. - ntlmv2 fall-back to ntlmv1 failed. (This used to be commit fdc275353de85fde0c348320e4d64ba66365b73b)
Diffstat (limited to 'source3/libsmb/clientgen.c')
-rw-r--r--source3/libsmb/clientgen.c44
1 files changed, 33 insertions, 11 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index beb73e736b..765160ffe4 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -2556,6 +2556,24 @@ struct cli_state *cli_initialise(struct cli_state *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
****************************************************************************/
void cli_shutdown(struct cli_state *cli)
@@ -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));
}
@@ -2703,14 +2714,18 @@ BOOL cli_reestablish_connection(struct cli_state *cli)
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,