summaryrefslogtreecommitdiff
path: root/socket/socks5.c
Commit message (Collapse)AuthorAgeFilesLines
* socket: Assert trying to use free'd socketOlivier Crête2016-06-021-6/+4
| | | | | Cleanly returnign makes no sense and may hide worse problems.
* socket: refactor nice_socket_is_base_of()Jakub Adam2016-04-041-5/+6
| | | | | | | | | | | | | | • rename to nice_socket_is_based_on() and swap the order of arguments accordingly; the implementation doesn't have to use the confusing 'return other->is_base_of()' pattern anymore • fix potential NULL dereferences The argument order in agent_recv_message_unlocked() was already wrongly swapped in 1732c7d6 and thus this commit isn't changing it back because that order has become the correct one. Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> Differential Revision: https://phabricator.freedesktop.org/D866
* socket: add nice_socket_is_base_of()Jakub Adam2015-09-111-0/+10
| | | | | | | | This will be used in the next commit. Maniphest Tasks: T114 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> Differential Revision: https://phabricator.freedesktop.org/D240
* socket: Return early from socket functions if the socket is closedPhilip Withnall2014-09-021-0/+9
| | | | | | | | Explicitly check whether the socket is closed (universally represented as sock->priv == NULL) before doing anything else in the socket methods. This should safely return from unusual situations where the socket has been closed and part-destroyed but still ends up having send() or recv() called on it.
* socket: Fix return values of socket_send_messages in socks5.cPhilip Withnall2014-09-021-2/+1
| | | | | The return value is the number of messages sent, or -1 on error — not a boolean.
* Add a nice_socket_can_send and nice_socket_set_writable_callback APIsYouness Alaoui2014-05-171-0/+21
|
* Factor out the add_to_be_sent into a helper API for socketsYouness Alaoui2014-05-151-68/+5
| | | | | | The add_to_be_sent was duplicated in http/socks5/pseudossl/tcp-bsd and had some small differences. It's better to factor it out so bug fixes get applied to all of them and code is cleaner.
* Add a nice_socket_send_reliable API for internal use.Youness Alaoui2014-05-151-4/+30
| | | | | | | | | | | | | | One issue with tcp-bsd is that it will queue messages when the tcp socket is not writable, but it will also drop messages when the queue is full. If we want to do proper reliable ice-tcp, we need to make sure that messages don't get dropped, also, this would affect http/socks5/pseudossl if their messages get dropped. For ice-tcp, when the socket is not writable we want to return 0, not queue the message. The change here is to allow connchecks and other important protocol messages to be sent as 'reliable' on tcp transports by queuing them and in the various socket layers and to never drop them, but all user messages will be dropped. if the tcp socket is not writable.
* Fix return value of send_messages in socks5Youness Alaoui2014-05-151-2/+2
|
* Allow tcp-bsd to act as reliable or non reliable transport and fix ↵Youness Alaoui2014-05-151-1/+3
| | | | is_reliable on other sockets
* Add a socket type for socket layerYouness Alaoui2014-05-151-0/+1
|
* Remove the "length" parameter from NiceOutputMessageOlivier Crête2014-01-311-4/+5
| | | | It was used correctly only half the time anyway
* Remove the "to" parameter from NiceOutputMessageOlivier Crête2014-01-311-11/+12
| | | | | We never send multiple messages to separate targets in practice, so this will simplify the code
* socket: Add vectored I/O support for sending on socketsPhilip Withnall2014-01-311-27/+47
| | | | | | | | | | | | | | | | | Replace the send() API with a send_messages() API, which supports sending multiple messages, each with multiple buffers rather than a single monolithic buffer. This doesn’t break API, as the socket API is not exposed outside libnice. It does introduce a new struct: NiceOutputMessage, which is analogous to struct mmsghdr and NiceInputMessage. This includes updates to the test-bsd test to cover the changed API. The existing nice_socket_send() API has been retained as a thin wrapper around nice_socket_send_messages(), for convenience only. It’s hoped that internal usage of this API will decline to the point where it can be removed.
* socket: Add vectored I/O support for receiving on socketsPhilip Withnall2014-01-311-29/+59
| | | | | | | | | | | | Replace the recv() API with a recv_messages() API, which supports receiving multiple messages, each with multiple buffers rather than a single monolithic buffer. This doesn’t break API, as the socket API is not exposed outside libnice. It does introduce a new struct: NiceInputMessage, which is analogous to struct mmsghdr. This includes updates to the test-bsd test to cover the changed API.
* socket: Add missing switch casesPhilip Withnall2014-01-311-0/+1
| | | | | | | | This appeases GCC’s -Wswitch-enum warning, and makes it more obvious that those enum cases have been explicitly considered, rather than just forgotten about. This introduces no functional changes.
* Fix strict aliasing of sockaddr structuresPhilip Withnall2013-12-181-8/+13
| | | | | | | | | | | | Casting from one struct sockaddr type to another breaks C’s strict aliasing rules (variables of different types cannot alias). Fix this cleanly by using unions of struct sockaddrs to convert between the types (i.e. type-punning). I wish sockaddr didn’t have to be this painful. See: http://gcc.gnu.org/onlinedocs/gcc-4.4.1/gcc/Optimize-Options.html#Type_002dpunning
* Fix variable shadowingPhilip Withnall2013-12-181-2/+2
|
* Return real origin when using a proxy (fixes detecting TURN sockets)Youness Alaoui2012-02-131-6/+9
| | | | | | If using a proxy, the 'from' of all packets were of the proxy server instead of the turn server, causing the check for turn to fail. Thanks to Madaro Livio.
* Check for username/password lenght of socks5 proxy to avoid a buffer overflowYouness Alaoui2010-05-191-0/+8
|
* do not call memcpy if there is no copying to be done.. avoid a warning with ↵Youness Alaoui2009-11-131-2/+4
| | | | coverity
* remove useless agent in socks5 proxy, fix copyright and return FALSE in ↵Youness Alaoui2008-12-171-10/+7
| | | | send, if we're in an error
* Add support for SOCKS5 proxy serversYouness Alaoui2008-12-101-0/+427