summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/client.h1
-rw-r--r--source3/libsmb/cliconnect.c8
2 files changed, 9 insertions, 0 deletions
diff --git a/source3/include/client.h b/source3/include/client.h
index 4fb785e9d6..b01136be37 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -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;
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index c5432973d3..515bc3ff07 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -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);