mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
Removed the "reestablish" code. Tridge - scream if this was needed....
Jeremy.
(This used to be commit e6afe40f85
)
This commit is contained in:
parent
4e71905d85
commit
742dc2313c
@ -1018,57 +1018,6 @@ BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip)
|
||||
return True;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
re-establishes a connection
|
||||
****************************************************************************/
|
||||
BOOL cli_reestablish_connection(struct cli_state *cli)
|
||||
{
|
||||
struct nmb_name calling;
|
||||
struct nmb_name called;
|
||||
fstring dest_host;
|
||||
fstring share;
|
||||
fstring dev;
|
||||
BOOL do_tcon = False;
|
||||
int oldfd = cli->fd;
|
||||
|
||||
if (!cli->initialised || cli->fd == -1)
|
||||
{
|
||||
DEBUG(3,("cli_reestablish_connection: not connected\n"));
|
||||
return False;
|
||||
}
|
||||
|
||||
/* copy the parameters necessary to re-establish the connection */
|
||||
|
||||
if (cli->cnum != 0)
|
||||
{
|
||||
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);
|
||||
|
||||
DEBUG(5,("cli_reestablish_connection: %s connecting to %s (ip %s) - %s [%s]\n",
|
||||
nmb_namestr(&calling), nmb_namestr(&called),
|
||||
inet_ntoa(cli->dest_ip),
|
||||
cli->user_name, cli->domain));
|
||||
|
||||
cli->fd = -1;
|
||||
|
||||
if (cli_establish_connection(cli,
|
||||
dest_host, &cli->dest_ip,
|
||||
&calling, &called,
|
||||
share, dev, False, do_tcon)) {
|
||||
if ((cli->fd != oldfd) && (oldfd != -1)) {
|
||||
close( oldfd );
|
||||
}
|
||||
return True;
|
||||
}
|
||||
return False;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
establishes a connection right up to doing tconX, reading in a password.
|
||||
****************************************************************************/
|
||||
|
@ -62,26 +62,19 @@ BOOL cli_receive_smb(struct cli_state *cli)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
send an smb to a fd and re-establish if necessary
|
||||
send an smb to a fd.
|
||||
****************************************************************************/
|
||||
|
||||
BOOL cli_send_smb(struct cli_state *cli)
|
||||
{
|
||||
size_t len;
|
||||
size_t nwritten=0;
|
||||
ssize_t ret;
|
||||
BOOL reestablished=False;
|
||||
|
||||
len = smb_len(cli->outbuf) + 4;
|
||||
|
||||
while (nwritten < len) {
|
||||
ret = write_socket(cli->fd,cli->outbuf+nwritten,len - nwritten);
|
||||
if (ret <= 0 && errno == EPIPE && !reestablished) {
|
||||
if (cli_reestablish_connection(cli)) {
|
||||
reestablished = True;
|
||||
nwritten=0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (ret <= 0) {
|
||||
DEBUG(0,("Error writing %d bytes to client. %d\n",
|
||||
(int)len,(int)ret));
|
||||
|
Loading…
Reference in New Issue
Block a user