summaryrefslogtreecommitdiff
path: root/source4/lib/socket/socket_unix.c
AgeCommit message (Collapse)AuthorFilesLines
2013-03-04s4-lib/socket: Return the original EMSGSIZE when sendto() and setsockopt() ↵Andrew Bartlett1-1/+1
both fail This ensures that should we be unable to increase the socket size, we return an error that the application layer above might expect and be able to make as reasonable response to (such as switching to a stream-based transport). This fixes up c692bb02b039ae8fef6ba968fd13b36ad7d62a72. As suggested by metze in https://bugzilla.samba.org/show_bug.cgi?id=9697#c4 Andrew Bartlett Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-02Handle EMSGSIZE on UNIX domain sockets.Landon Fuller1-9/+26
On some systems (eg, FreeBSD) the default SO_SNDBUF for UNIX domain sockets is to small, and EMSGSIZE is returned. Other systems provide a larger default send buffer, but there is still no guarantee that the buffer will be sized appropriately. This patch modifies the sendto() path to attempt to resize the SO_SNDBUF dynamically upon an EMSGSIZE failure, and then retry the send. This fixes local DCE/RPC errors on FreeBSD, eg: https://lists.samba.org/archive/samba-technical/2013-January/089881.html Signed-Off-By: Landon Fuller <landonf@bikemonkey.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Sat Mar 2 23:34:03 CET 2013 on sn-devel-104
2012-12-12s4-socket: Make sure unix socket addresses are null terminated.Andreas Schneider1-5/+5
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
2011-12-17s3: Fix the clustering buildVolker Lendecke1-2/+2
ctdb_private.h already defines set_close_on_exec. Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Sat Dec 17 18:41:39 CET 2011 on sn-devel-104
2011-12-15s4-socket: use set_close_on_exec()Andrew Tridgell1-0/+4
this prevents a fd leak to child processes
2011-06-20libcli/util Rename common map_nt_error_from_unix to avoid duplicate symbolAndrew Bartlett1-8/+8
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-03-19source4/lib: Fix prototypes for all functions.Jelmer Vernooij1-0/+1
2008-02-20Make more module init functions public, since they are compiled with ↵Jelmer Vernooij1-1/+1
-fvisibility=hidden. Not doing this causes failures on Mac OS X. (This used to be commit da1a9438bd89569077ef1eaa9dc977b5f9d62836)
2007-10-10r25522: Convert to standard bool types.Jelmer Vernooij1-3/+3
(This used to be commit 5e814287ba475e12f8cc934fdd09b199dcdfdb86)
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-10r15356: Remove unused 'flags' argument from socket_send() and friends.Andrew Bartlett1-19/+7
This is in preperation for making TLS a socket library. Andrew Bartlett (This used to be commit a312812b92f5ac7e6bd2c4af725dbbbc900d4452)
2007-10-10r14307: fixed dereference of my_address->addr when NULLAndrew Tridgell1-2/+3
(This used to be commit e017246f1052f3344b90500e04c73277923baa20)
2007-10-10r12804: This patch reworks the Samba4 sockets layer to use a socket_addressAndrew Bartlett1-51/+124
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-10r9704: r9684@blu: tridge | 2005-08-27 19:38:31 +1000Andrew Tridgell1-0/+2
don't try to call the name resolver on non-ipv4 names! (This used to be commit 4bb3d36fe6705bc625fe4122500f681ab7f2dc53)
2007-10-10r8044: give a better error codeStefan Metzmacher1-3/+3
metze (This used to be commit fdbf822f1c90cba110d91720ea586ceef9de38b2)
2007-10-10r7227: added a socket_pending() call to abstract away the FIONREAD ioctl. ItAndrew Tridgell1-0/+11
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-10r7205: added support for sendto() on unix domain socketsAndrew Tridgell1-0/+32
(This used to be commit 35ef6e3b153f527f79539b2d99c5ff1cd034ba4b)
2007-10-10r6562: added support for datagram unix domain sockets in the socket libraryAndrew Tridgell1-8/+24
(This used to be commit 23b2046dcb5c4593cba6964f400a2e5246fb35f7)
2007-10-10r6070: Fix typo's and fallback to "" as default user name if noJelmer Vernooij1-1/+0
other username could be guessed. (This used to be commit 7fe77cd65901776b5a78e8398547f364379259d3)
2007-10-10r5304: removed lib/socket/socket.h from includes.hAndrew Tridgell1-0/+2
(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-10r5037: got rid of all of the TALLOC_DEPRECATED stuff. My apologies for theAndrew Tridgell1-1/+1
large commit. I thought this was worthwhile to get done for consistency. (This used to be commit ec32b22ed5ec224f6324f5e069d15e92e38e15c0)
2007-10-10r4831: added udp support to our generic sockets library.Andrew Tridgell1-4/+5
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-10/+29
connect(). This required a small API change (the addition of a socket_connect_complete() method) (This used to be commit b787dd166f5cca82b3710802eefb41e0a8851fc3)
2007-10-10r3586: Fix some of the issues with the module init functions.Jelmer Vernooij1-5/+0
Both subsystems and modules can now have init functions, which can be specified in .mk files (INIT_FUNCTION = ...) The build system will define : - SUBSYSTEM_init_static_modules that calls the init functions of all statically compiled modules. Failing to load will generate an error which is not fatal - BINARY_init_subsystems that calls the init functions (if defined) for the subsystems the binary depends on This removes the hack with the "static bool Initialised = " and the "lazy_init" functions (This used to be commit 7a8244761bfdfdfb48f8264d76951ebdfbf7bd8a)
2007-10-10r3482: fixed a warning and an error from the IRIX 6.4 buildAndrew Tridgell1-0/+1
(This used to be commit 8ec3cf8b2ba149b7d6a15689e9b77685c6da3179)
2007-10-10r3450: portability fixesAndrew Tridgell1-20/+20
- 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-10r3314: added a option "socket:testnonblock" to the generic socket code. IfAndrew Tridgell1-4/+3
you set this option (either on the command line using --option or in smb.conf) then every socket recv or send will return short by random amounts. This allows you to test that the non-blocking socket logic in your code works correctly. I also removed the flags argument to socket_accept(), and instead made the new socket inherit the flags of the old socket, which makes more sense to me. (This used to be commit 406d356e698da01c84e8aa5b7894752b4403f63c)
2007-10-10r3313: in socket_accept() make the new socket non-blocking unless ↵Andrew Tridgell1-0/+8
SOCKET_FLAG_BLOCK is set. (This used to be commit a2d92aa431e0e9752387eebe741d9e6f376f74d7)
2007-10-10r3304: changed the API to lib/socket/ a little.Andrew Tridgell1-18/+7
The main change is to make socket_recv() take a pre-allocated buffer, rather than allocating one itself. This allows non-blocking users of this API to avoid a memcpy(). As a result our messaging code is now about 10% faster, and the ncacn_ip_tcp and ncalrpc code is also faster. The second change was to remove the unused mem_ctx argument from socket_send(). Having it there implied that memory could be allocated, which meant the caller had to worry about freeing that memory (if for example it is sending in a tight loop using the same memory context). Removing that unused argument keeps life simpler for users. (This used to be commit a16e4756cd68ca8aab4ffc59d4d9db0b6e44dbd1)
2007-10-10r3279: Removed MSG_DONTWAIT flags as many platform don't have it.Andrew Tridgell1-9/+0
If a socket is non-blocking then adding MSG_DONTWAIT is pointless (it does nothing), so all we lose is the ability to set non-blocking on a packet-by-packet basis, which is not a very useful thing to have anyway if the socket is blocking then the code already adds MSG_WAITALL, so MSG_DONTWAIT is also not needed in that case. (This used to be commit b8a2afae67691a609b4a7a577fee3f9518adc9d2)
2007-10-10r3278: - rewrote the client side rpc connection code to use lib/socket/Andrew Tridgell1-25/+1
rather than doing everything itself. This greatly simplifies the code, although I really don't like the socket_recv() interface (it always allocates memory for you, which means an extra memcpy in this code) - fixed several bugs in the socket_ipv4.c code, in particular client side code used a non-blocking connect but didn't handle EINPROGRESS, so it had no chance of working. Also fixed the error codes, using map_nt_error_from_unix() - cleaned up and expanded map_nt_error_from_unix() - changed interpret_addr2() to not take a mem_ctx. It makes absolutely no sense to allocate a fixed size 4 byte structure like this. Dozens of places in the code were also using interpret_addr2() incorrectly (precisely because the allocation made no sense) (This used to be commit 7f2c771b0e0e98c5c9e5cf662592d64d34ff1205)
2007-10-10r3184: don't setup socket options on unix domain sockets (our smb.conf ↵Andrew Tridgell1-1/+0
socket options are really meant for tcp) (This used to be commit 238febb0088f85933c869052f4f83ff31f164df1)
2007-10-10r3183: moved the unlink of the messaging unixdom socket to the messaging ↵Andrew Tridgell1-9/+0
destructor (This used to be commit ab222b236a091d31b1f5f2cba150a11585ab5836)
2007-10-10r3169: unlink() is called on the listening unix socket every time a child ↵Jelmer Vernooij1-0/+4
process exits. Commenting it out until we have a clean way of doing this. (This used to be commit fa0760dd5fa361be3b72dc4adc8b736e8a862606)
2007-10-10r3020: better error handling in socket_unixAndrew Tridgell1-50/+43
(This used to be commit 64514ff5b7734667a1364de925114091fe208b3a)
2007-10-10r3016: - converted the events code to tallocAndrew Tridgell1-0/+10
- added the new messaging system, based on unix domain sockets. It gets over 10k messages/second on my laptop without any socket cacheing, which is better than I expected. - added a LOCAL-MESSAGING torture test (This used to be commit 3af06478da7ab34a272226d8d9ac87e0a4940cfb)
2007-10-10r3013: added support for unix domain sockets in the generic socket library. IAndrew Tridgell1-0/+319
will shortly be using this for a rewrite of the intra-smbd messaging library, which is needed to get lock timeouts working properly (and share modes, oplocks etc) (This used to be commit 6f4926d846965a901e40d24546eab356c4a537c7)