1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

93 Commits

Author SHA1 Message Date
Stefan Metzmacher
c378835cb6 tsocket: fill in sa.sa_len if the system supports it
metze
2010-11-05 08:45:14 +00:00
Jelmer Vernooij
3deece5591 s4: Remove the old perl/m4/make/mk-based build system.
The new waf-based build system now has all the same functionality, and
the old build system has been broken for quite some time.

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sun Oct 31 02:01:44 UTC 2010 on sn-devel-104
2010-10-31 02:01:44 +00:00
Stefan Metzmacher
79c6572256 tsocket: let tstream_inet_tcp_connect_recv() optionally return the used local address
tstream_inet_tcp_connect_send() usually only gets no local port number
and it may use the wildcard address '0.0.0.0' or '::'.

tstream_inet_tcp_connect_recv() provides the used local address and port
which are used on the wire.

metze
2010-10-23 08:49:30 +02:00
Stefan Metzmacher
d2c653629c tsocket: ask the kernel for the specific local address after a tcp connect
metze
2010-10-23 08:49:29 +02:00
Stefan Metzmacher
4423aa59ab tsocket: make sure we delete the fd event before calling close()
We got random double free errors, when getting events from
epoll_wait() and try to dereference the private talloc pointer
attached to it.

Before doing the close() in the tstream_disconnect_send() function
we need to delete the fd event.

commit 38f505530b only fixed it for
tdgram sockets.

metze
2010-10-04 14:05:15 +00:00
Stefan Metzmacher
38f505530b tsocket: make sure we delete the fd event before calling close()
We got random double free errors, when getting events from
epoll_wait() and try to dereference the private talloc pointer
attached to it.

Before doing the close() in the tstream_disconnect_send() function
we need to delete the fd event.

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Tue Sep 28 01:02:55 UTC 2010 on sn-devel-104
2010-09-28 01:02:55 +00:00
Andrew Tridgell
0212800de8 tsocket: we return -1 on error, not fd
the code used this pattent:

 if (fd < 0) {
   ...various cleanups...
   return fd;
 } 

it is much clearer to do this:

 if (fd < 0) {
   ...various cleanups...
   return -1;
 } 

as otherwise when reading the code you think this function may return
a fd.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-09-15 15:39:36 +10:00
Stefan Metzmacher
8494d09b89 Revert "lib/tsocket: sa_socklen is a macro on irix, so better use sasocklen"
This reverts commit 3d4fb698660381e650d7caeb5b7cff12847c0fb8.

This was wrong... The problem was in the caller, sa_len is a macro on irix

metze
2010-08-28 08:28:01 +02:00
Stefan Metzmacher
44b2a7941c lib/tsocket: sa_socklen is a macro on irix, so better use sasocklen
metze
2010-08-27 13:00:26 +02:00
Volker Lendecke
f94039a8ea s3: Fix a typo 2010-08-15 09:45:30 +02:00
Volker Lendecke
77a3858f2f tsocket: Fix some unreachable code 2010-07-11 18:14:33 +02:00
Volker Lendecke
4b64555d75 tsocket: Fix some type-punned warnings 2010-06-21 15:03:59 +02:00
Simo Sorce
ae02691200 tsocket: Improve the language in some parts of the guide. 2010-05-19 17:04:45 -04:00
Andreas Schneider
04327e2809 tsocket: Added the warning again to tsocket_address_bsd_sockaddr. 2010-05-05 09:25:21 +02:00
Andreas Schneider
fcb53828df tsocket: Fixed the documentation of tsocket_address_bsd_sockaddr. 2010-05-03 15:55:34 +02:00
Stefan Metzmacher
2436ec2928 lib/tsocket: add tsocket_address_is_unix() function
metze
2010-04-27 13:00:24 +02:00
Stefan Metzmacher
e1596bbf27 lib/tsocket: add tsocket_address_is_inet() function
metze
2010-04-27 13:00:24 +02:00
Stefan Metzmacher
b29f3f497b Revert "tsocket: not all systems have IPV6_V6ONLY"
This reverts commit 63fc397808.

We now don't support IPv6 when IPV6_V6ONLY isn't available,
as we rely on the behavior.

metze
2010-04-24 20:30:25 +02:00
Stefan Metzmacher
33bb334e80 s4-waf: inline LIBREPLACE_NETWORK into 'replace'
metze
2010-04-12 09:13:43 +02:00
Andrew Bartlett
f1aa4c34bf tsocket_bsd: Always use a real length for the sa_socklen, and keep it around
The previous code assumed the OS would happily accept sizeof(struct
sockaddr_storage).  It seems some versions of Solaris do not like
this.

Andrew Bartlett
2010-04-08 08:34:40 +02:00
Andrew Tridgell
b690fedef5 s4-waf: removed the AUTOGENERATED markers
we won't be using the mk -> wscript generator again
2010-04-06 20:27:16 +10:00
Andrew Tridgell
f9eae32f4b s4-waf: mark the wscript files as python so vim/emacs knows how to highlight them 2010-04-06 20:27:11 +10:00
Andrew Tridgell
845e0cbe6f build: commit all the waf build files in the tree 2010-04-06 20:26:48 +10:00
Andrew Tridgell
63fc397808 tsocket: not all systems have IPV6_V6ONLY 2010-03-26 16:50:48 +11:00
Andreas Schneider
1983256c70 tsocket: Improve the tsocket_address_bsd_sockaddr documentation.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-02-26 08:57:30 +01:00
Brad Hards
319d3bf9d9 Spelling fixes for tsocket API documentation.
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22 21:45:33 +01:00
Stefan Metzmacher
c42d9c4ec4 tsocket/bsd: fix comment in tdgram_bsd_recvfrom_handler()
metze
2010-02-18 09:38:00 +01:00
Jeremy Allison
936828de71 Fix commit d07cd37b99
Which was:

    tsocket/bsd: fix bug #7115 FreeBSD includes the UDP header in FIONREAD

Metze, this has to have been wrong - you are throwing away the talloc_realloc
pointer returned. Also no error checking. Please review.

Thank goodness for gcc warnings :-).

Jeremy.
2010-02-17 09:24:34 -08:00
Stefan Metzmacher
d07cd37b99 tsocket/bsd: fix bug #7115 FreeBSD includes the UDP header in FIONREAD
metze
2010-02-17 14:46:39 +01:00
Stefan Metzmacher
1ffcb991a9 tsocket/bsd: set IPV6_V6ONLY on AF_INET6 sockets
Some system already have this as default. It's easier
to behave the same way on all systems and handle ipv6
and ipv4 sockets separate.

metze
2010-02-17 14:46:39 +01:00
Stefan Metzmacher
8a0949dfc8 tsocket/bsd: fix bug #7140 autodetect ipv4 and ipv6 based on the remote address if the local address is any
metze
2010-02-17 14:46:08 +01:00
Stefan Metzmacher
6637b2f4b0 tsocket/bsd: fix bug #7140 use calculated sa_socklen for bind() in tstream_bsd_connect_send()
This is needed because, we can't use sizeof(sockaddr_storage) for AF_UNIX
sockets. Also some platforms require exact values for AF_INET and AF_INET6.

metze
2010-02-17 14:45:34 +01:00
Stefan Metzmacher
135543b4c3 tsocket/bsd: fix do_bind logic for AF_INET
We want the explicit bind() when we don't use the any address.

metze
2010-02-17 14:13:57 +01:00
Kai Blin
88099bcc93 tsocket: Fix the description of tstream_writev_queue_send/recv 2010-01-28 11:16:24 +01:00
Kai Blin
9184f524f0 tsocket: Fix description for tstream_readv_pdu_queue_send/recv 2010-01-28 11:11:33 +01:00
Andreas Schneider
04f3f27f7e tsocket: Added doxygen config file.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-01-11 11:23:04 +01:00
Andreas Schneider
574f77f89e tsocket: Added complete doxygen documentation.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-01-11 11:22:59 +01:00
Stefan Metzmacher
17c804a675 tsocket: only copy the specific part of sockaddr*
This makes sure we fill the unspefic bytes with 0
and have zero termination for sockaddr_un.

metze
2009-12-24 17:38:29 +01:00
Stefan Metzmacher
4784c8c3be tsocket: allow AF_UNIX sockaddrs smaller than sizeof(sockaddr_un)
This is needed as getpeername() truncates the length to 2 if the
peer socket has no name.

metze
2009-12-24 17:38:04 +01:00
Andreas Schneider
a5bdab8b32 tsocket: Fixed tsocket_guide.txt asciidoc syntax. 2009-12-15 23:34:23 +01:00
Andreas Schneider
e33ae22b87 tsocket: Fixed documentation for tsocket_address_bsd_sockaddr(). 2009-12-15 23:34:22 +01:00
Andreas Schneider
ab04dd3be7 tsocket: Fixed typo in LGPL header. 2009-12-15 23:34:22 +01:00
Stefan Metzmacher
edbf2caa6f tsocket: add tsocket_address_bsd_sockaddr() and tsocket_address_bsd_from_sockaddr()
metze
2009-12-15 23:34:22 +01:00
Stefan Metzmacher
97a32035be tsocket: rewrite tsocket_guide.txt to reflect the current APIs
metze
2009-11-03 18:26:30 +01:00
Stefan Metzmacher
eb39f66940 tsocket_bsd: return -1 and set errno to ENAMETOOLONG if the unix path is too long
metze
2009-11-03 18:24:44 +01:00
Stefan Metzmacher
9b5d1e9e35 tsocket: remove prototype of non-existing tsocket_address_inet_set_broadcast()
metze
2009-11-03 18:14:23 +01:00
Stefan Metzmacher
1f12dc4409 tsocket: rename sa_len => sa_socklen, because sa_len is a macro on some platforms
metze
2009-07-16 08:21:08 +02:00
Stefan Metzmacher
857ed9ca5a tsocket/bsd: also ask for TEVENT_FD_READ when we want to write into a stream socket
Otherwise we would not notice a broken connection.

metze
2009-06-29 16:03:57 +02:00
Stefan Metzmacher
b1d5e515b2 tsocket/bsd: more correctly check if the cached tevent_fd is still valid
I some cases the pointer value of tevent_context is the same again,
if we do something like:

	ev1 = tevent_context_init();
	...
	fde = tevent_add_fd(ev1, fd, TEVENT_FD_READ...);
	...
	talloc_free(ev1);
	...
	ev2 = tevent_context_init();

	if (ev1 == ev2) {
		/* this can happen! */
	}

	if (tevent_fd_get_flags(fde) == 0) {
		/* this is always true */
	}

But the "talloc_free(ev1)" will set fde->event_ctx to NULL
and tevent_fd_get_flags() will always return 0.

metze
2009-06-29 16:03:57 +02:00
Volker Lendecke
c687eb15d9 Properly free a downlevel readv request. Metze, please check 2009-06-27 23:17:49 +02:00