summaryrefslogtreecommitdiff
path: root/source4/lib/socket/socket.c
AgeCommit message (Collapse)AuthorFilesLines
2011-06-20libcli/util Rename common map_nt_error_from_unix to avoid duplicate symbolAndrew Bartlett1-1/+1
The two error tables need to be combined, but for now seperate the names. (As the common parts of the tree now use the _common function, errmap_unix.c must be included in the s3 autoconf build). Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Mon Jun 20 08:12:03 CEST 2011 on sn-devel-104
2011-06-06s4-ipv6: fill in family when initialising from sockaddrAndrew Tridgell1-1/+13
Autobuild-User: Andrew Tridgell <tridge@samba.org> Autobuild-Date: Mon Jun 6 05:35:36 CEST 2011 on sn-devel-104
2011-06-06s4-ipv6: fix the address family for IPv6 string addressesAndrew Tridgell1-0/+5
2011-06-06s4-ipv6: added socket_address_from_sockaddr_storage()Andrew Tridgell1-0/+44
this converts a struct sockaddr_storage to a struct socket_address
2011-05-03lib/util Move set_socket_options() into common code.Andrew Bartlett1-160/+0
2011-05-03s4-lib/socket Merge updated set_socket_options from Samba3 -> Samba4Andrew Bartlett1-34/+90
2010-03-11s4:lib/socket Add function to set a port on the socket addressAndrew Bartlett1-0/+12
2009-12-24s4:lib/socket: add socket_get_{remote|local}_addr() to get a tsocket_address ↵Stefan Metzmacher1-0/+30
instead of a socket_address metze
2009-12-24s4:lib/socket: add helpers functions to convert between socket_address and ↵Stefan Metzmacher1-0/+42
tsocket_address metze
2009-02-13s4:lib/socket: add socket_address_copy()Stefan Metzmacher1-0/+33
metze
2009-01-03s4:socket: use a socket_wrapper aware function to auto close the fd event ↵Stefan Metzmacher1-0/+9
for sockets metze
2008-11-02Use environment variable rather than loadparm parameter when testingJelmer Vernooij1-1/+1
nonblocking sockets.
2008-11-02Fix the build.Jelmer Vernooij1-3/+1
2008-11-02Use a separate global for nonblocking socket testing rather than ↵Jelmer Vernooij1-1/+3
global_loadparm.
2008-10-12Fix warning, prototype.Jelmer Vernooij1-1/+1
2007-10-10r25522: Convert to standard bool types.Jelmer Vernooij1-3/+3
(This used to be commit 5e814287ba475e12f8cc934fdd09b199dcdfdb86)
2007-10-10r25430: Add the loadparm context to all parametric options.Jelmer Vernooij1-1/+1
(This used to be commit fd697d77c9fe67a00939a1f04b35c451316fff58)
2007-10-10r25035: Fix some more warnings, use service pointer rather than service ↵Jelmer Vernooij1-1/+1
number in more places. (This used to be commit df9cebcb97e20564359097148665bd519f31bc6f)
2007-10-10r25027: Fix more warnings.Jelmer Vernooij1-1/+1
(This used to be commit 5085c53fcfade614e83d21fc2c1a5bc43bb2a729)
2007-10-10r25026: Move param/param.h out of includes.hJelmer Vernooij1-0/+1
(This used to be commit abe8349f9b4387961ff3665d8c589d61cd2edf31)
2007-10-10r24992: Remove some uses of lp_*().Jelmer Vernooij1-4/+0
(This used to be commit a5a1a5540510cdb1bfbb3e89b84f4ba5b2812c55)
2007-10-10r23792: convert Samba4 to GPLv3Andrew Tridgell1-3/+2
There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa)
2007-10-10r23701: when we create a new socket with socket_accept(), clear any flags thatAndrew Tridgell1-0/+1
were set in the old one. Otherwise SOCKET_FLAG_NOCLOSE causes a major fd leak (This used to be commit 4e31eda055781a710d285c509d0c51b42e351431)
2007-10-10r22960: added a SOCKET_FLAG_NOCLOSE to allow us to tell the socket layer thatAndrew Tridgell1-1/+9
we will handle the close of the socket (This used to be commit d57aaf5ba60464e5e782353a0879a84f8c70dd32)
2007-10-10r22602: s/HAVE_SOCKET_IPV6/HAVE_IPV6/ to match the define used by Heimdal.Jelmer Vernooij1-1/+1
(This used to be commit 5ff665b6531fdb4c7e56c49b7f923546d93b384c)
2007-10-10r17197: This patch moves the encryption of bulk data on SASL negotiated securityAndrew Bartlett1-13/+12
contexts from the application layer into the socket layer. This improves a number of correctness aspects, as we now allow LDAP packets to cross multiple SASL packets. It should also make it much easier to write async LDAP tests from windows clients, as they use SASL by default. It is also vital to allowing OpenLDAP clients to use GSSAPI against Samba4, as it negotiates a rather small SASL buffer size. This patch mirrors the earlier work done to move TLS into the socket layer. Unusual in this pstch is the extra read callback argument I take. As SASL is a layer on top of a socket, it is entirely possible for the SASL layer to drain a socket dry, but for the caller not to have read all the decrypted data. This would leave the system without an event to restart the read (as the socket is dry). As such, I re-invoke the read handler from a timed callback, which should trigger on the next running of the event loop. I believe that the TLS code does require a similar callback. In trying to understand why this is required, imagine a SASL-encrypted LDAP packet in the following formation: +-----------------+---------------------+ | SASL Packet #1 | SASL Packet #2 | ----------------------------------------+ | LDAP Packet #1 | LDAP Packet #2 | ----------------------------------------+ In the old code, this was illegal, but it is perfectly standard SASL-encrypted LDAP. Without the callback, we would read and process the first LDAP packet, and the SASL code would have read the second SASL packet (to decrypt enough data for the LDAP packet), and no data would remain on the socket. Without data on the socket, read events stop. That is why I add timed events, until the SASL buffer is drained. Another approach would be to add a hack to the event system, to have it pretend there remained data to read off the network (but that is ugly). In improving the code, to handle more real-world cases, I've been able to remove almost all the special-cases in the testnonblock code. The only special case is that we must use a deterministic partial packet when calling send, rather than a random length. (1 + n/2). This is needed because of the way the SASL and TLS code works, and the 'resend on failure' requirements. Andrew Bartlett (This used to be commit 5d7c9c12cb2b39673172a357092b80cd814850b0)
2007-10-10r17168: Now that TLS (and soon SASL) is below the socket layer, we need toAndrew Bartlett1-11/+23
make the testnonblock skip some things. The socket *under* the tls socket is still tested. Andrew Bartlett (This used to be commit 9c33c6a20a77e3f15eac3d62488117517afad940)
2007-10-10r15854: more talloc_set_destructor() typesafe fixesAndrew Tridgell1-2/+1
(This used to be commit 61c6100617589ac6df4f527877241464cacbf8b3)
2007-10-10r15400: Move the TLS code behind the socket interface.Andrew Bartlett1-3/+3
This reduces caller complexity, because the TLS code is now called just like any other socket. (A new socket context is returned by the tls_init_server and tls_init_client routines). When TLS is not available, the original socket is returned. Andrew Bartlett (This used to be commit 09b2f30dfa7a640f5187b4933204e9680be61497)
2007-10-10r15356: Remove unused 'flags' argument from socket_send() and friends.Andrew Bartlett1-10/+10
This is in preperation for making TLS a socket library. Andrew Bartlett (This used to be commit a312812b92f5ac7e6bd2c4af725dbbbc900d4452)
2007-10-10r15349: Integrate set_socket_options() into the socket libraryJelmer Vernooij1-0/+108
(This used to be commit 598ea173cd718dad0df24505796ca50cb728a2e9)
2007-10-10r13956: make more functions publicStefan Metzmacher1-39/+39
metze (This used to be commit d099282d4956e7dc1134abf0632b01c40160e114)
2007-10-10r12804: This patch reworks the Samba4 sockets layer to use a socket_addressAndrew Bartlett1-34/+69
structure that is more generic than just 'IP/port'. It now passes make test, and has been reviewed and updated by metze. (Thankyou *very* much). This passes 'make test' as well as kerberos use (not currently in the testsuite). The original purpose of this patch was to have Samba able to pass a socket address stucture from the BSD layer into the kerberos routines and back again. It also removes nbt_peer_addr, which was being used for a similar purpose. It is a large change, but worthwhile I feel. Andrew Bartlett (This used to be commit 88198c4881d8620a37086f80e4da5a5b71c5bbb2)
2007-10-10r9705: r9685@blu: tridge | 2005-08-27 19:43:44 +1000Andrew Tridgell1-0/+1
set the backend_name on socket_accept() too (This used to be commit 10ac2732881ac73dd9cb8162beb1efd741bfe3d2)
2007-10-10r8408: its quite common in our code to free up a connection when we get anAndrew Tridgell1-0/+27
error, but sometimes a socket option may then happen on the NULL socket. This has been handled by the individual libraries up to now, but its cleaner to centralise it here (This used to be commit d9864e1f9aac1fb19f054c2da996a5099e90941e)
2007-10-10r7626: a new ldap client library. Main features are:Andrew Tridgell1-4/+1
- hooked into events system, so requests can be truly async and won't interfere with other processing happening at the same time - uses NTSTATUS codes for errors (previously errors were mostly ignored). In a similar fashion to the DOS error handling, I have reserved a range of the NTSTATUS code 32 bit space for LDAP error codes, so a function can return a LDAP error code in a NTSTATUS - much cleaner packet handling (This used to be commit 2e3c660b2fc20e046d82bf1cc296422b6e7dfad0)
2007-10-10r7476: ensure dgram sockets are created non-blocking. As they usually skipAndrew Tridgell1-0/+6
the connect() stage, we were missing this (This used to be commit f5102b886c10fead0f6bcdc4460584ae53912ebc)
2007-10-10r7227: added a socket_pending() call to abstract away the FIONREAD ioctl. ItAndrew Tridgell1-0/+16
will be interesting to see if this causes any portability problems, as it is a less commonly used call. (This used to be commit f6993db31d93059c70b44a23005ba444e205870f)
2007-10-10r6795: Make some functions static and remove some unused ones.Jelmer Vernooij1-6/+0
(This used to be commit 46509eb89980bfe6dabd71264d570ea356ee5a22)
2007-10-10r6562: added support for datagram unix domain sockets in the socket libraryAndrew Tridgell1-1/+2
(This used to be commit 23b2046dcb5c4593cba6964f400a2e5246fb35f7)
2007-10-10r5304: removed lib/socket/socket.h from includes.hAndrew Tridgell1-0/+5
(This used to be commit b902ea546d2d1327b23f40ddaeeaa8e7e3662454)
2007-10-10r5298: - got rid of pstring.h from includes.h. This at least makes it a bitAndrew Tridgell1-0/+1
less likely that anyone will use pstring for new code - got rid of winbind_client.h from includes.h. This one triggered a huge change, as winbind_client.h was including system/filesys.h and defining the old uint32 and uint16 types, as well as its own pstring and fstring. (This used to be commit 9db6c79e902ec538108d6b7d3324039aabe1704f)
2007-10-10r4831: added udp support to our generic sockets library.Andrew Tridgell1-22/+47
I decided to incorporate the udp support into the socket_ipv4.c backend (and later in socket_ipv6.c) rather than doing a separate backend, as so much of the code is shareable. Basically this adds a socket_sendto() and a socket_recvfrom() call and not much all. For udp servers, I decided to keep the call as socket_listen(), even though dgram servers don't actually call listen(). This keeps the API consistent. I also added a simple local sockets testsuite in smbtorture, LOCAL-SOCKET (This used to be commit 9f12a45a05c5c447fb4ec18c8dd28f70e90e32a5)
2007-10-10r4753: added the ability for the generic socket library to handle asyncAndrew Tridgell1-0/+8
connect(). This required a small API change (the addition of a socket_connect_complete() method) (This used to be commit b787dd166f5cca82b3710802eefb41e0a8851fc3)
2007-10-10r4686: cerate a function to create a socket by specifying an socket_ops structStefan Metzmacher1-8/+16
metze (This used to be commit 894f402b01c8d4e0bef9c29697b8d13e5b9ea150)
2007-10-10r3450: portability fixesAndrew Tridgell1-29/+29
- fix rep_inet_ntoa() for IRIX - lib/signal.c needs system/wait.h - some systems define a macro "accept", which breaks the lib/socket/ structures. use fn_ as a prefix for the structure elements to avoid the problem (This used to be commit ced1a0fcdc8d8e47755ce4391c19f8b12862eb60)
2007-10-10r3356: in the standard process model we need to make sure we close allAndrew Tridgell1-0/+22
listening sockets after the fork to prevent the child still listening on incoming requests. I have also added an optimisation where we use dup()/close() to lower the file descriptor number of the new socket to the lowest possible after closing our listening sockets. This keeps the max fd num passed to select() low, which makes a difference to the speed of select(). (This used to be commit f2a9bbc317ba86ebe87c3ca27a3a0192de91014d)
2007-10-10r3334: Allow disabling IPv6 support using socket:noipv6Jelmer Vernooij1-0/+4
(This used to be commit 9c13f42c1fd489a6a663f614a41c59730c18a054)
2007-10-10r3333: added configure tests for ipv6 supportAndrew Tridgell1-0/+2
(This used to be commit 9794570c6d0646cc34147bf8128802b181f658f0)
2007-10-10r3329: Add support for IPv6Jelmer Vernooij1-0/+4
(This used to be commit d8298901243ca4ce2ec420fa523c8e1407e72513)