1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3:libsmb: also remember the local socket address after connect

metze
This commit is contained in:
Stefan Metzmacher 2011-07-11 14:26:23 +02:00
parent a2300094db
commit 893d137f3f
2 changed files with 9 additions and 0 deletions

View File

@ -82,6 +82,7 @@ struct cli_state {
char *share;
char *dev;
struct nmb_name called;
struct sockaddr_storage src_ss;
struct nmb_name calling;
struct sockaddr_storage dest_ss;

View File

@ -2886,6 +2886,14 @@ NTSTATUS cli_connect_nb(const char *host, struct sockaddr_storage *pss,
cli->fd = fd;
cli->port = port;
length = sizeof(cli->src_ss);
ret = getsockname(fd, (struct sockaddr *)(void *)&cli->src_ss,
&length);
if (ret == -1) {
status = map_nt_error_from_unix(errno);
cli_shutdown(cli);
goto fail;
}
length = sizeof(cli->dest_ss);
ret = getpeername(fd, (struct sockaddr *)(void *)&cli->dest_ss,
&length);