summaryrefslogtreecommitdiffstats
path: root/source3/lib/util_sock.c
Commit message (Collapse)AuthorAgeFilesLines
* lib: Split out write_data[_iov]Volker Lendecke2014-12-071-81/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Split out iov_buf[len]Volker Lendecke2014-12-071-43/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: read_data->read_data_ntstatusVolker Lendecke2014-12-071-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Split out sys_[read|write] & friendsVolker Lendecke2014-12-071-0/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Avoid a talloc in write_data_iovVolker Lendecke2014-09-171-9/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: move memcache.[ch] to the toplevel 'samba-util' libraryStefan Metzmacher2014-07-181-1/+1
| | | | | | | | | | This is generic enough that it could be used in all code. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Fri Jul 18 15:43:33 CEST 2014 on sn-devel-104
* lib: Add iov_bufVolker Lendecke2014-04-231-0/+25
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Introduce iov_buflenVolker Lendecke2014-04-231-5/+23
| | | | | | | .. with overflow protection Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:lib: avoid talloc_zero_array() in poll_one_fd()Stefan Metzmacher2013-12-141-14/+5
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* lib: Remove unused "get_peer_name"Volker Lendecke2013-08-121-79/+0
| | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib: Remove unused "client_name"Volker Lendecke2013-08-121-5/+0
| | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* Re-add umask(0) code removed by commit 3a7c2777ee0de37d758fe81d67d6836a8354825eJeremy Allison2013-06-181-2/+7
| | | | | | | | | | | | | | | | Without the umask code the pipe permissions are affected by the umask of the calling process. As only smbd currently sets its umask to zero (nmbd and winbindd should do the same) this causes the winbindd pipe to be unavailable to the nss library code unless winbindd is run from an init process that explicitly sets umask to zero. When testing from the command line this can be hard to track down :-). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ira Cooper <ira@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Jun 18 04:31:27 CEST 2013 on sn-devel-104
* lib: Add before/after hooks to async_connectVolker Lendecke2013-05-171-2/+2
| | | | | | | This will facilitiate [un]become_root for smbd to connect safely to ctdbd. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Christian Ambach <ambi@samba.org>
* s3:lib: s/struct event_context/struct tevent_contextStefan Metzmacher2013-02-191-5/+5
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:lib: make use of samba_tevent_context_init()Stefan Metzmacher2013-02-191-1/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3-lib: Use new strict directory create function in create_pipe_sock().Andreas Schneider2013-01-091-44/+6
| | | | | | | Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed Jan 9 10:55:23 CET 2013 on sn-devel-104
* s3: Fix Coverity ID 741407 -- resource leakVolker Lendecke2012-11-261-0/+1
| | | | | | | Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Mon Nov 26 19:20:05 CET 2012 on sn-devel-104
* util_sock: Avoid sys_connect.Jelmer Vernooij2012-03-241-7/+13
|
* lib/util: Remove sys_poll as it is no longer neededAndrew Bartlett2012-02-161-2/+2
| | | | | | | | | | | sys_poll() is only needed if the signal pipe is set up and used, but as no signal handler ever writes to the pipe, this can all be removed. signal based events are now handled via tevent. Andrew Bartlett Signed-off-by: Jeremy Allison <jra@samba.org>
* Rename obscure defined constants.Christopher R. Hertel (crh)2012-02-161-2/+3
| | | | | | | | | | | | | | | Replaced the undescriptive SMB_PORT1 and SMB_PORT2 defined constants with the slightly more descriptive names NBT_SMB_PORT and TCP_SMB_PORT. Also replaced several hard-coded references to the well-known port numbers (139 and 445, respectively) as appropriate. Small changes to clarify some comments regarding the two transport types. Signed-off-by: Simo Sorce <idra@samba.org> Autobuild-User: Simo Sorce <idra@samba.org> Autobuild-Date: Thu Feb 16 08:29:41 CET 2012 on sn-devel-104
* s3-lib: If we create a pipe socket, don't start to listen.Andreas Schneider2011-08-291-6/+0
| | | | | | | | | The create_pipe_sock() function should only create the socket as the name states and not start to listen on it too. We should start to listen on in the individual places as we need different backlog values. Autobuild-User: Andreas Schneider <asn@cryptomilk.org> Autobuild-Date: Mon Aug 29 13:21:43 CEST 2011 on sn-devel-104
* s3:lib: s/SMBkeepalive/NBSSkeepaliveStefan Metzmacher2011-07-121-2/+2
| | | | metze
* s3:libsmb: remove unused enum smb_read_errors infrastructureStefan Metzmacher2011-07-081-20/+0
| | | | metze
* s3: Follow the TALLOC_FREE convention in source3Volker Lendecke2011-07-061-1/+1
| | | | | Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Wed Jul 6 11:01:05 CEST 2011 on sn-devel-104
* s3: Fix Coverity ID 2586 -- NO_EFFECTVolker Lendecke2011-07-061-1/+1
| | | | | | | tsocket_address_bsd_sockaddr returns ssize_t, and on some systems socklen_t is unsigned. So (len < 0) could never have turned true. Volker
* s3-util: Add a get_remote_hostname() function.Andreas Schneider2011-07-041-0/+108
| | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org>
* s3-param Remove special case for global_myname(), rename to lp_netbios_name()Andrew Bartlett2011-06-091-1/+1
| | | | | | | | There is no reason this can't be a normal constant string in the loadparm system, now that we have lp_set_cmdline() to handle overrides correctly. Andrew Bartlett
* s3-talloc Change TALLOC_MEMDUP() to talloc_memdup()Andrew Bartlett2011-06-091-1/+1
| | | | | Using the standard macro makes it easier to move code into common, as TALLOC_MEMDUP isn't standard talloc.
* s3-talloc Change TALLOC_ZERO_ARRAY() to talloc_zero_array()Andrew Bartlett2011-06-091-1/+1
| | | | | Using the standard macro makes it easier to move code into common, as TALLOC_ZERO_ARRAY isn't standard talloc.
* lib/util/time.c: timeval_current_ofs_usecRusty Russell2011-06-011-7/+7
| | | | | | | | | | | | | | | Several places want "microseconds from current time", and several were simply handing "usecs" values which could be over a million. Using a helper to do this is safer and more readable. I didn't replace any obviously correct callers (ie. constants). I also renamed wait_nsec in source3/lib/util_sock.c; it's actually microseconds not nanoseconds (introduced with this code in Volker's 19b783cc Async wrapper for open_socket_out_send/recv). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* is_my_ipaddr() should recognise loopback addresses as ours.Jeremy Allison2011-05-171-5/+5
| | | | | Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Tue May 17 20:05:42 CEST 2011 on sn-devel-104
* s3-lib Use common lib/socket code for get_interfaces() et alAndrew Bartlett2011-05-081-1/+1
|
* Improve debug messages when creating socket directoriesAndrew Bartlett2011-05-081-5/+12
| | | | | | This makes clear what the permissions error and directory name actually is Andrew Bartlett
* More const fixes for compiler warnings from the waf build.Jeremy Allison2011-05-051-2/+2
|
* lib/util Move set_socket_options() into common code.Andrew Bartlett2011-05-031-160/+0
|
* lib/util Move more network utility functions from source3 into lib/utilAndrew Bartlett2011-05-031-156/+0
| | | | | | This will help with the merge of the interfaces layer. Andrew Bartlett
* s3-tevent: only include ../lib/util/tevent wrappers where needed.Günther Deschner2011-04-291-0/+2
| | | | | | | Guenther Autobuild-User: Günther Deschner <gd@samba.org> Autobuild-Date: Fri Apr 29 14:00:30 CEST 2011 on sn-devel-104
* s3:lib/util_sock: listen on IPv6 addresses with IPV6_ONLY (bug #7383)Stefan Metzmacher2011-04-251-0/+26
| | | | | | | | | | | | | | | | | | This avoids getting IPv4 addresses as mapped IPv6 addresses (e.g. ::ffff:192.168.0.1). Before the bahavior was inconsistent between operating system and distributions. Some system have IPV6_ONLY as default. Now we consistently get AF_INET for IPv4 addresses and AF_INET6 for IPv6 addresses. It also makes it possible to listen only on IPv6 now as "::" doesn't imply "0.0.0.0" anymore. Which also avoids confusing log messages that we were not able to bind to "0.0.0.0". metze
* s3-util_sock: very brief documentation for open_socket_out().Günther Deschner2011-04-131-0/+10
| | | | | | | The most important bit is to document that timeout is in MILLIseconds, not seconds. Guenther
* s3-includes: only include system/filesys.h when needed.Günther Deschner2011-03-301-0/+1
| | | | Guenther
* Fix is_myname_or_ipaddr() to be robust against strange DNS setups.Jeremy Allison2011-03-241-30/+56
| | | | | | | | | | | | | If IPv6 DNS names are turned on, but Samba isn't configured to listen on an IPv6 interface, then is_myname_or_ipaddr() can return false on a valid DNS name that it should detect is our own. If the IPv6 addr is returned by preference, then looking at the first addr only causes is_myname_or_ipaddr() to fail. We need to look at all the addresses returned by the DNS lookup and check all of them against our interface list. This is an order N^2 lookup, but there shouldn't be enough addresses to make this a practical problem. Jeremy.
* s3-lib Remove the clobber_region() code.Andrew Bartlett2011-03-231-4/+0
| | | | | | | | | | | | | | | | | | This code wrote to the full buffer in fstrcpy(), pstrcpy() and other fixed-length string manipulation functions. The hope of this code was to find out at run time if we were mixing up pstring and fstring etc, and to record where this came from. It has a runtime performance impact (particularly if compiled with --enable-developer). It is being removed because of the complexity it adds, and the distinct lack of bugs that this complexity has been credited in finding. The macro-based compile-time checking of string sizes remains. Andrew Bartlett
* s3-interfaces: only include interfaces.h where needed.Günther Deschner2011-03-161-0/+1
| | | | Guenther
* s3: Eliminate sys_select_intr from read_fd_with_timeoutVolker Lendecke2011-02-281-12/+7
|
* s3: Add poll_intr_one_fdVolker Lendecke2011-02-281-0/+17
|
* s3: Add poll_one_fd()Volker Lendecke2011-02-281-0/+27
|
* s3: Make is_zero_addr take a sockaddr_storageVolker Lendecke2011-02-271-1/+1
| | | | | | | All callers had to cast this anyway Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Sun Feb 27 11:02:53 CET 2011 on sn-devel-104
* s3: Fix some nonempty blank lines and some typosVolker Lendecke2011-02-091-1/+1
| | | | | Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Wed Feb 9 00:01:45 CET 2011 on sn-devel-104
* s3: Remove unused open_any_socket_outVolker Lendecke2010-12-221-165/+0
| | | | | Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Wed Dec 22 17:27:29 CET 2010 on sn-devel-104
* s3: Fix some typosVolker Lendecke2010-12-191-1/+1
|