summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-07-11 14:26:23 +0200
committerStefan Metzmacher <metze@samba.org>2011-07-11 16:39:15 +0200
commit893d137f3f426e7b91542cc50b6c1ef8d69643f0 (patch)
treeaedaab08428ecfe16089cdb5b56b3cb8af8fb1b0 /source3/libsmb
parenta2300094db04048766ca3f136eff2090065c6652 (diff)
downloadsamba-893d137f3f426e7b91542cc50b6c1ef8d69643f0.tar.gz
samba-893d137f3f426e7b91542cc50b6c1ef8d69643f0.tar.bz2
samba-893d137f3f426e7b91542cc50b6c1ef8d69643f0.zip
s3:libsmb: also remember the local socket address after connect
metze
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/cliconnect.c8
1 files changed, 8 insertions, 0 deletions
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);