Fix #338: Incorrect port 0 for IPv6 socket on Windows
commitd535273ba904624a8df8c3f8537f86b240e560be
authorStefan Becker <chemobejk@gmail.com>
Sat, 10 Feb 2018 12:53:25 +0000 (10 14:53 +0200)
committerStefan Becker <chemobejk@gmail.com>
Sun, 18 Feb 2018 15:57:54 +0000 (18 17:57 +0200)
treeaf150156b21b450641c84af611bb73f38188be2f
parent985c72e7f22b810147a505e6d962cbe7376c2cac
Fix #338: Incorrect port 0 for IPv6 socket on Windows

On Windows calling purple_network_get_port_from_fd() on an IPv6 socket
always generates the following error message

   network: getsockname: Windows socket error #10014

and then returns the default port 0. This incorrect port then leads to
a 504 error from the SIP server.

Searching for the error message leads to the following SO question

   https://stackoverflow.com/questions/861154/winsock-error-code-10014

which points to the root cause: getsockname() doesn't like the address
buffer to be on the stack.

- purple: write a replacement transport_port_from_fd()
- purple: update sipe_backend_transport_ip_address()

In both functions we now use g_new(struct sockaddr_storage, 1) which
should ensure proper alignment of the buffer.

(cherry picked from commit f49fd3d403bb97233e379e0080f6e8ad933b1604)
src/purple/purple-transport.c