ira/third_party.git
8 years agoAllow NULL queue to writev_send v3-4-test
Volker Lendecke [Sun, 10 May 2009 08:49:18 +0000 (10:49 +0200)]
Allow NULL queue to writev_send

Fix bug #8086 - null pointer reference crashes winbind.

8 years agoFix denial of service - memory corruption.
Jeremy Allison [Sun, 27 Feb 2011 17:16:20 +0000 (18:16 +0100)]
Fix denial of service - memory corruption.

CVE-2011-0719

Fix bug #7949 (DoS in Winbind and smbd with many file descriptors open).

All current released versions of Samba are vulnerable to
a denial of service caused by memory corruption. Range
checks on file descriptors being used in the FD_SET macro
were not present allowing stack corruption. This can cause
the Samba code to crash or to loop attempting to select
on a bad file descriptor set.

A connection to a file share, or a local account is needed
to exploit this problem, either authenticated or unauthenticated
(guest connection).

Currently we do not believe this flaw is exploitable
beyond a crash or causing the code to loop, but on the
advice of our security reviewers we are releasing fixes
in case an exploit is discovered at a later date.
(cherry picked from commit 43babef991feedbe2acb77d27254d302ab107fa8)

9 years agolib/util: move TIME_T_MIN/MAX defines into header file (cherry picked from commit...
Björn Jacke [Wed, 6 Jan 2010 23:40:09 +0000 (00:40 +0100)]
lib/util: move TIME_T_MIN/MAX defines into header file (cherry picked from commit 571ee54b791b93ad46e09ed563ef4a5582dcf0c8)

9 years agos3: signals are processed twice in child.
Bo Yang [Tue, 9 Feb 2010 09:02:20 +0000 (17:02 +0800)]
s3: signals are processed twice in child.

Signed-off-by: Bo Yang <boyang@samba.org>
(cherry picked from commit 8c8bb51de1ac2baa46ac0736fae12c034288e5d4)

Fix bug #7206 (duplicate signal handler, signals are processed twice in child
process).

9 years agoutil: added binsearch.h for binary array searches
Andrew Tridgell [Thu, 10 Dec 2009 03:35:24 +0000 (14:35 +1100)]
util: added binsearch.h for binary array searches

This was moved from the schema_query code. It will now be used in more
than one place, so best to make it a library macro. I think there are
quite a few places that could benefit from this.
(cherry picked from commit 71943e8858943718affb6a3c0ded2127f07057f0)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 448b8f35d7a7cff73d35304673302178f593c9d0)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
9 years agoFix bug 6861 - rfc1738_unescape converts '+' characters to spaces. Stop rfc1738_unesc...
Jeremy Allison [Fri, 30 Oct 2009 21:16:03 +0000 (14:16 -0700)]
Fix bug 6861 - rfc1738_unescape converts '+' characters to spaces. Stop rfc1738_unescape() from mangling '+' characters to spaces. Noticed by Andrew Bartlett. Jeremy.

9 years agos3: Fix Bug #6869: Various annoying build warnings.
Günther Deschner [Wed, 4 Nov 2009 14:58:08 +0000 (15:58 +0100)]
s3: Fix Bug #6869: Various annoying build warnings.

Guenther

9 years agoFix bug 6796 - Deleting an event context on shutdown can cause smbd to crash.
Jeremy Allison [Fri, 9 Oct 2009 19:50:26 +0000 (12:50 -0700)]
Fix bug 6796 - Deleting an event context on shutdown can cause smbd to crash.

Sync's tevent signal code with 3.5.x tree.
Protects against ev pointer being NULL.

Jeremy

9 years agotevent: make sure we don't set errno within the signal handler function.
Stefan Metzmacher [Mon, 21 Sep 2009 01:16:18 +0000 (03:16 +0200)]
tevent: make sure we don't set errno within the signal handler function.

metze
(cherry picked from commit d13dfbeb6c6ab5b20277439da5b95f1a7f2850eb)

9 years agoFixing timeval calculation
Simo Sorce [Fri, 25 Sep 2009 14:59:04 +0000 (10:59 -0400)]
Fixing timeval calculation

The code was always doubling microseconds when attempting to round up.

Fix bug #6764.

9 years agotevent: change version to 0.9.8 after some critical bugs have been fixed
Stefan Metzmacher [Fri, 4 Sep 2009 10:56:39 +0000 (12:56 +0200)]
tevent: change version to 0.9.8 after some critical bugs have been fixed

metze
(cherry picked from commit 1bb68402a2e37f39118eaaaa039ac69e03ba66f2)

9 years agoAnother part of the fix for bug 6651 - smbd SIGSEGV when breaking oplocks. SA_INFO_QU...
Jeremy Allison [Thu, 3 Sep 2009 14:38:21 +0000 (07:38 -0700)]
Another part of the fix for bug 6651 - smbd SIGSEGV when breaking oplocks. SA_INFO_QUEUE_COUNT *MUST* be a power of 2, in order for the ring buffer wrap to work correctly at the 32 bit boundary. Thanks to Petr Vandrovec <petr@vandrovec.name> for this. (cherry picked from commit c97698e762b1ea8d7133f04ae822225676a6f135)

9 years agotevent: Fix a segfault upon the first signal
Volker Lendecke [Sat, 29 Aug 2009 07:41:32 +0000 (09:41 +0200)]
tevent: Fix a segfault upon the first signal

When the first signal arrives, tevent_common_signal_handler() crashed: "ev" is
initialized to NULL, so the first "write(ev->pipe_fds[1], &c, 1);" dereferences
NULL.

Rusty, Tridge, please check. Also, can you tell me a bit more about the
environment you tested this in? I'd be curious to see where this survived.

Thanks,

Volker
(cherry picked from commit 23abcd2318c69753aa2a144e1dc0f9cf9efdb705)

9 years agolib/tevent: close pipe_fds on event_context destruction
Rusty Russell [Fri, 28 Aug 2009 02:41:23 +0000 (12:11 +0930)]
lib/tevent: close pipe_fds on event_context destruction

The "hack_fds" were never closed before; now they're inside event_context
they should be closed when that is destroyed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from commit 76d91156c82e20bbd68c752376cb814d71759033)

9 years agolib/tevent: handle tevent_common_add_signal on different event contexts.
Rusty Russell [Fri, 28 Aug 2009 02:38:47 +0000 (12:08 +0930)]
lib/tevent: handle tevent_common_add_signal on different event contexts.

I don't know if this is a problem in real life.

The code assumes there's only one tevent_context; all signals will notify
the first event context.  That's counter-intuitive if you ever use more
than one, and there's nothing else in this code which prevents it AFAICT.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from commit be4ac227842530d484659f2db683453366326d8b)

9 years agolib/tevent: fix race with signals and tevent_common_add_signal
Rusty Russell [Fri, 28 Aug 2009 02:34:22 +0000 (12:04 +0930)]
lib/tevent: fix race with signals and tevent_common_add_signal

We carefully preserve the old signal handler, but we replace it before
we've set up everything; in particular, if we fail setting up the
pipe_hack we could write a NUL char to stdout (fd 0), instead of
calling the old signal handler.

Replace the signal handler as the very last thing we do.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from commit 6abb637e3e0d23635fdbbb91c163731b325d696d)

9 years agolib/tevent: remove spectacularly complicated manual subtraction
Rusty Russell [Wed, 26 Aug 2009 08:00:32 +0000 (17:30 +0930)]
lib/tevent: remove spectacularly complicated manual subtraction

To be completely honest, I don't quite know whether to laugh or cry at
this one:

1 + (0xFFFFFFFF & ~(s.seen - s.count))
== 1 + (~(s.seen - s.count)) # s.seen, s.count are uint32_t
== s.count - s.seen # -A == ~A + 1

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from commit 4279879c9847ca069527e11ca934b8906009cad8)

9 years agotevent: avoid using reserved c++ word.
Günther Deschner [Mon, 24 Aug 2009 12:27:13 +0000 (14:27 +0200)]
tevent: avoid using reserved c++ word.

Guenther
(cherry picked from commit 965a079535bd11a7870d45991a0d0628d6579b3b)

9 years agoFix for bug 6651 - smbd SIGSEGV when breaking oplocks. Based on a patch submitted...
Jeremy Allison [Fri, 21 Aug 2009 22:07:25 +0000 (15:07 -0700)]
Fix for bug 6651 - smbd SIGSEGV when breaking oplocks. Based on a patch submitted by Petr Vandrovec <petr@vandrovec.name>. Multiple pending signals with siginfo_t's weren't being handled correctly leading to smbd abort with kernel oplock signals. Jeremy (cherry picked from commit ba52f18bfecfd7b0ba22c4ad9e9b5bfd18f34c93)

9 years agotevent: fix a comment
Michael Adam [Tue, 18 Aug 2009 09:53:42 +0000 (11:53 +0200)]
tevent: fix a comment

Michael
(cherry picked from commit 5270efab1a8dd06158aa45467958939b677e4b7b)

9 years agotevent: change version to 0.9.7 after adding tevent_req_cancel infrastructure
Stefan Metzmacher [Sat, 15 Aug 2009 08:44:50 +0000 (10:44 +0200)]
tevent: change version to 0.9.7 after adding tevent_req_cancel infrastructure

metze
(cherry picked from commit 97a1ed53ca4255ac7fc5643292019ad30c276de5)

9 years agotevent: add tevent_req_cancel() infrastructure
Stefan Metzmacher [Sat, 15 Aug 2009 07:46:23 +0000 (09:46 +0200)]
tevent: add tevent_req_cancel() infrastructure

This offers a generic way for callers to cancel an
async request.

metze
(cherry picked from commit 45e4be0d96abdc729252df1e97bb9a56302e5a4a)

9 years agotevent: add some more doxygen comments for tevent_req functions
Stefan Metzmacher [Sat, 15 Aug 2009 07:45:39 +0000 (09:45 +0200)]
tevent: add some more doxygen comments for tevent_req functions

metze
(cherry picked from commit 95c3d3b5d8fdc05f20c826a48312f1230f036029)

9 years agotevent: try to fix the build on QNX qnx18 6.4.1 it doesn't have SA_RESTART defined
Stefan Metzmacher [Thu, 16 Jul 2009 07:06:42 +0000 (09:06 +0200)]
tevent: try to fix the build on QNX qnx18 6.4.1 it doesn't have SA_RESTART defined

metze
(cherry picked from commit 39684d2cbe1c8c69dc9ca5c6e05861e24091bb83)

9 years agoChange to talloc_zero_size instead of extra memset. Jeremy. (cherry picked from commi...
Jeremy Allison [Tue, 14 Jul 2009 23:54:01 +0000 (16:54 -0700)]
Change to talloc_zero_size instead of extra memset. Jeremy. (cherry picked from commit 5927ca7067a0ead65c00042a62545b0d940f2b2a)

9 years agoWhen tallocing a memory block for the state in a tevent_req struct, ensure it's zeroe...
Jeremy Allison [Tue, 14 Jul 2009 23:42:21 +0000 (16:42 -0700)]
When tallocing a memory block for the state in a tevent_req struct, ensure it's zeroed out. Vl & Metze please check. Jeremy. (cherry picked from commit 7be1d727a31b34debbcf8faa1e0bea911112d145)

9 years agoSort the signature files (cherry picked from commit 7119241c0d12768b31ebdb489aa0bbba6...
Stefan Metzmacher [Fri, 4 Sep 2009 11:13:53 +0000 (13:13 +0200)]
Sort the signature files (cherry picked from commit 7119241c0d12768b31ebdb489aa0bbba6ca21e40)

9 years agoExpose functions need by backend writers
Simo Sorce [Fri, 19 Jun 2009 00:06:00 +0000 (20:06 -0400)]
Expose functions need by backend writers

move publicly needed structures and functions in the public header.
Stop installing internal headers.
Update the signature and exports files with the new exposed
function.
(cherry picked from commit 30b2014a01b31d66dd76e0562c5d769dfacf167b)

9 years agoRevert "For tevent to install tevent_util.h"
Simo Sorce [Thu, 18 Jun 2009 11:56:51 +0000 (07:56 -0400)]
Revert "For tevent to install tevent_util.h"

This reverts commit b112cc5503350b248949bdbcce8072f5523ce877.

tevent_util.h is a private header. Must not be installed.
(cherry picked from commit c92505817d6453c100ed52c9c3ab289f5589ce25)

9 years agoFor tevent to install tevent_util.h
Eric Sandall [Fri, 12 Jun 2009 11:24:30 +0000 (13:24 +0200)]
For tevent to install tevent_util.h

Patch for bug #6270

This patch is for the future when samba4 builds using external libraries. With
this patch, tevent now installs tevent_util.h which is required by samba4.
(cherry picked from commit b112cc5503350b248949bdbcce8072f5523ce877)

9 years agoAdd exports file and abi checker for tevent
Simo Sorce [Sun, 7 Jun 2009 18:10:15 +0000 (14:10 -0400)]
Add exports file and abi checker for tevent

This is a first attempt at exporting symbols only for public functions
We also provide a rudimentary ABI checker that tries to check that
function signatures are not changed by mistake.
Given our use of macros this is not an API checker.
It's all based on tevent.h contents and the gcc -aux-info option
(cherry picked from commit efccef09aec93180a06955b5e03f1ceb99dc39e8)

9 years agoIncrease tevent version for tevent_req_notify_callback() (cherry picked from commit...
Stefan Metzmacher [Fri, 4 Sep 2009 11:12:42 +0000 (13:12 +0200)]
Increase tevent version for tevent_req_notify_callback() (cherry picked from commit d0aedeb46e5d2da582b5c030114186f8d755b528)

9 years agoAdd tevent_req_notify_callback
Volker Lendecke [Thu, 4 Jun 2009 15:26:23 +0000 (17:26 +0200)]
Add tevent_req_notify_callback

This is necessary for requests that have multiple results. Examples would be
SMBEcho and ldap_search.
(cherry picked from commit c6f39b46a7b0505331612a1bee15a82f97009f0d)

9 years agotevent/python: Makefile was still trying to build some non AC_SUBST python targets
Jelmer Vernooij [Tue, 19 May 2009 21:31:34 +0000 (23:31 +0200)]
tevent/python: Makefile was still trying to build some non AC_SUBST python targets

Signed-Off-By: Jelmer Vernooij <jelmer@samba.org>(cherry picked from commit cf9636ea99bb5063a8c7d771c1e29f684b4b753a)
9 years agotevent: Define TALLOC_FREE() if it's not defined yet, to allow building with released...
Jelmer Vernooij [Sat, 16 May 2009 18:31:59 +0000 (20:31 +0200)]
tevent: Define TALLOC_FREE() if it's not defined yet, to allow building with released versions of talloc. (cherry picked from commit 72b744f38ebb9f9576c05c7bb0a00de26697ec8f)

9 years agotevent: Remove python module.
Stefan Metzmacher [Fri, 4 Sep 2009 11:10:56 +0000 (13:10 +0200)]
tevent: Remove python module.

This module didn't have any functionality that we actually used yet, and
it was quite small.

Tevent is quite low level and perhaps doesn't make much sense to expose
directly as a Python module. It was also causing build problems when used with a
system-tevent. We can always back later if necessary.
(cherry picked from commit 5065cf70f8bf41193d6d33413f2285f62bba0502)

9 years agotevent: Install tevent_internal.h in the standalone build.
Jelmer Vernooij [Sat, 16 May 2009 02:14:21 +0000 (04:14 +0200)]
tevent: Install tevent_internal.h in the standalone build.

This is not ideal, but at least it fixes the build of samba-gtk for now.
I've also added a warning about API guarantees at the top of the header.
(cherry picked from commit 857c3f8322005efd460c2f516a9486a2de059e9f)

9 years agoUpdate copies of config.guess and config.sub. (cherry picked from commit 6230eb94af23...
Jelmer Vernooij [Sat, 16 May 2009 02:03:12 +0000 (04:03 +0200)]
Update copies of config.guess and config.sub. (cherry picked from commit 6230eb94af2305f479db3b76479a0dc841c3d1d5)

9 years agotevent: Don't install headers, since we don't install a shared lib either (from Samba...
Jelmer Vernooij [Fri, 15 May 2009 23:54:10 +0000 (01:54 +0200)]
tevent: Don't install headers, since we don't install a shared lib either (from Samba). (cherry picked from commit 06864b4469f5f3d77637f8e6c97ec0558289cd29)

9 years agotevent: fix typo async_req_done() => tevent_req_done()
Stefan Metzmacher [Fri, 1 May 2009 15:45:39 +0000 (17:45 +0200)]
tevent: fix typo async_req_done() => tevent_req_done()

metze
(cherry picked from commit 6f7cd213dd38e770224cf131054862b76069aed8)

9 years agotevent: fix the nesting logic
Stefan Metzmacher [Thu, 19 Mar 2009 13:31:43 +0000 (14:31 +0100)]
tevent: fix the nesting logic

Only tevent_loop_once and tevent_loop_until() should care
about the nesting level.

This fixes the samba3 printing code where we use tevent_loop_wait()
and don't allow nested events.

We still call the nesting hook for all levels, we need to decide
if we really want this...

metze
(cherry picked from commit 36e7045340bbc7d6567008bdd87c4cdf717835bd)

9 years agofixed a logic bug in the tevent nesting code
Andrew Tridgell [Thu, 19 Mar 2009 00:21:36 +0000 (11:21 +1100)]
fixed a logic bug in the tevent nesting code

The event nesting code never triggered as nesting.level was never
greater than 1. The main event loop needs to increase the nesting
level by 1.

I also added a paranoia check to the nesting setup call. The API as
currently written cannot support multiple nesting hooks, so we need to
abort if multiple hooks are tried.
(cherry picked from commit 13b6663e23a424473d14324ac229a21e1e90580a)

9 years agolibreplace: undef AI_ADDRCONFIG on QNX 6.3.0 (fix bug #6630)
Matt Kraai [Wed, 12 Aug 2009 06:49:24 +0000 (08:49 +0200)]
libreplace: undef AI_ADDRCONFIG on QNX 6.3.0 (fix bug #6630)

Some of the functions in source3/lib/util_sock.c use AI_ADDRCONFIG.  On QNX
6.3.0, this macro is defined but, if it's used, getaddrinfo will fail.  This
prevents smbd from opening any sockets.

If I undefine AI_ADDRCONFIG on such systems and allow
lib/replace/system/network.h to define it to be 0, this works around the issue.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 91d13b68be55728a85b3832e2da9267dbf4f2464)

Fixes bug #6630.

9 years agotdb: Reimplementation of Metze's "lib/tdb: if we know pwrite and pread are thread...
Rusty Russell [Thu, 30 Jul 2009 02:22:08 +0000 (11:52 +0930)]
tdb: Reimplementation of Metze's "lib/tdb: if we know pwrite and pread are thread/fork safe tdb_reopen_all() should be a noop".

This version just wraps the reopen code, so we still re-grab the lock and do
the normal sanity checks.

The reason we do this at all is to avoid global fd limits, see:
http://forums.fedoraforum.org/showthread.php?t=210393

Note also that this whole reopen concept is fundamentally racy: if the parent
goes away before the child calls tdb_reopen_all, the database can be left
without an active lock and another TDB_CLEAR_IF_FIRST opener will clear it.
A fork_with_tdbs() wrapper could use a pipe to solve this, but it's hardly
elegant (what if there are other independent things which have similar needs?).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 3b2f074bda8734a0b30a3e31117c0217d890809c)

Addresses bug #6601.

9 years agotdb: Revert "lib/tdb: if we know pwrite and pread are thread/fork safe tdb_reopen_all...
Rusty Russell [Thu, 30 Jul 2009 02:21:28 +0000 (11:51 +0930)]
tdb: Revert "lib/tdb: if we know pwrite and pread are thread/fork safe tdb_reopen_all() should be a noop"

This reverts commit e17df483fbedb81aededdef5fbb6ae1d034bc2dd.

tdb_reopen_all also restores the active lock, required for TDB_CLEAR_IF_FIRST.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit fa91bc67199f0d45a0e570b43aeafd816a5491bf)

9 years agolib/util: fix order of includes in tevent_ntstatus.c
Michael Adam [Wed, 1 Jul 2009 08:51:17 +0000 (10:51 +0200)]
lib/util: fix order of includes in tevent_ntstatus.c

replace.h needs to be included first.

Michael
(cherry picked from commit 8d982d91f231abbf003473d09433fca2cfa240ac)

Signed-off-by: Michael Adam <obnox@samba.org>
This addresses bug #6521.

9 years agolib/util: fix building tevent_ntstatus without config.h
Michael Adam [Mon, 29 Jun 2009 13:39:46 +0000 (15:39 +0200)]
lib/util: fix building tevent_ntstatus without config.h

(when called from places with "#define NO_CONFIG_H" set, such as configure)

This fixes bug #6521.

 Michael
(cherry picked from commit e4e855563bcbeb7be54de57d8c1d41d35ddc5e7a)

10 years agonss_wrapper: fix nss_wrapper build for solaris.
Günther Deschner [Thu, 28 May 2009 09:51:46 +0000 (11:51 +0200)]
nss_wrapper: fix nss_wrapper build for solaris.

Guenther
(cherry picked from commit 136b2a3eb21eda28e7a18547751ee20f097e7492)

10 years agonss_wrapper: remove re-structuring leftovers (unused variables).
Günther Deschner [Thu, 28 May 2009 08:53:53 +0000 (10:53 +0200)]
nss_wrapper: remove re-structuring leftovers (unused variables).

Guenther
(cherry picked from commit 37e4c92b383397a2c77db7e5d8adf2fa4a24d398)

10 years agonss_wrapper: support member add and delete for groups in nss_wrapper.pl.
Günther Deschner [Thu, 28 May 2009 08:39:37 +0000 (10:39 +0200)]
nss_wrapper: support member add and delete for groups in nss_wrapper.pl.

Guenther
(cherry picked from commit ebf8df35c9583619a012e85964f2ad5187a199fe)

10 years agonss_wrapper: split out passwd and group paths in nss_wrapper.pl.
Günther Deschner [Wed, 27 May 2009 20:35:14 +0000 (22:35 +0200)]
nss_wrapper: split out passwd and group paths in nss_wrapper.pl.

Guenther
(cherry picked from commit 7bb9e08d7e75be88a9788563f053794554f680a8)

10 years agonss_wrapper: restructure nwrap calls.
Günther Deschner [Wed, 27 May 2009 16:38:10 +0000 (18:38 +0200)]
nss_wrapper: restructure nwrap calls.

Guenther
(cherry picked from commit ec9a0917055d731aa95e2fea2045445f9945b74d)

10 years agoDetect tight loop in tdb_find()
Jim McDonough [Thu, 21 May 2009 20:26:26 +0000 (16:26 -0400)]
Detect tight loop in tdb_find()

10 years agonsswrapper: implement group_del() in nss_wrapper.pl.
Günther Deschner [Wed, 20 May 2009 00:10:12 +0000 (02:10 +0200)]
nsswrapper: implement group_del() in nss_wrapper.pl.

Guenther
(cherry picked from commit 3bd360c73de77559593e11301d247fd53c4ce128)

10 years agonsswrapper: implement group_add() in nss_wrapper.pl.
Günther Deschner [Wed, 20 May 2009 00:06:22 +0000 (02:06 +0200)]
nsswrapper: implement group_add() in nss_wrapper.pl.

Guenther
(cherry picked from commit b3cc01fd68e30ebd616897982e0d8befd2a2a7e0)

10 years agoEnsure documentation matches the tdb_util function usage.
Jeremy Allison [Tue, 12 May 2009 00:29:16 +0000 (17:29 -0700)]
Ensure documentation matches the tdb_util function usage.
Jeremy.

10 years agopm_process():raise level of debug message
Michael Adam [Tue, 28 Apr 2009 10:18:23 +0000 (12:18 +0200)]
pm_process():raise level of debug message

Michael
(cherry picked from commit 664da577f931dfd47573d3d77a95afb573fba855)

10 years agosocket_wrapper: fix the build on systems without ipv6 support
Stefan Metzmacher [Tue, 14 Apr 2009 10:45:48 +0000 (12:45 +0200)]
socket_wrapper: fix the build on systems without ipv6 support

metze
(cherry picked from commit 74707e8e8e1be2cbaa71fb0442957be2e663cbde)

10 years agosocket_wrapper: fix crash bug in swrap_readv/writev
Stefan Metzmacher [Wed, 8 Apr 2009 17:08:34 +0000 (19:08 +0200)]
socket_wrapper: fix crash bug in swrap_readv/writev

metze
(cherry picked from commit f20f5ae8e6b9ca5c90441a3083f6904168388fdf)

10 years agos3/popt.h: Fix typo.
Karolin Seeger [Tue, 7 Apr 2009 18:01:27 +0000 (20:01 +0200)]
s3/popt.h: Fix typo.

Karolin
(cherry picked from commit 8da2fa36b4f4241d7d4cdbe254a2374dd373fe40)

10 years agoUse recv instead of read in read_packet_handler
Volker Lendecke [Sun, 5 Apr 2009 11:26:42 +0000 (13:26 +0200)]
Use recv instead of read in read_packet_handler

This way the socket wrapper pcap file also sees the replies :-)

10 years agolibreplace: use libreplace_SAVE_CPPFLAGS instead of SAVE_CPPFLAGS
Michael Adam [Mon, 23 Mar 2009 16:36:46 +0000 (17:36 +0100)]
libreplace: use libreplace_SAVE_CPPFLAGS instead of SAVE_CPPFLAGS

This fixes Samba3's double listing of -I options in CFLAGS,
since samba3's configure wraps the call to AC_LIBREPLACE_NETWORK_CHECKS
into a SAVE_CPPFLAGS="${CPPFLAGS}" .. CPPFLAGS="${SAVE_CPPFLAGS}"
sequence... :-)

Michael
(cherry picked from commit 33d9f46674a270a0715213c17581deef192826e1)

10 years agotalloc_array_length: talloc_get_size deals fine with NULL
Volker Lendecke [Sun, 22 Mar 2009 21:07:58 +0000 (22:07 +0100)]
talloc_array_length: talloc_get_size deals fine with NULL

10 years agotevent: change version to 0.9.5 after the ABI has changed
Stefan Metzmacher [Tue, 17 Mar 2009 19:18:01 +0000 (20:18 +0100)]
tevent: change version to 0.9.5 after the ABI has changed

metze
(cherry picked from commit 7d07266ca26f7069269601043b713a91f1a4693c)

10 years agotevent: store the location where a request was finished
Stefan Metzmacher [Tue, 17 Mar 2009 19:13:34 +0000 (20:13 +0100)]
tevent: store the location where a request was finished

This is very useful to find bugs.
You can use 'p *req' in gdb to show where
tevent_req_done(), tevent_req_error() or tevent_req_nomem()
was called.

metze
(cherry picked from commit 9eaf53d98eced9ea70f411b9936b475c42e4d490)

10 years agotevent: use an immediate event as trigger for tevent_queue
Stefan Metzmacher [Tue, 17 Mar 2009 09:42:55 +0000 (10:42 +0100)]
tevent: use an immediate event as trigger for tevent_queue

metze
(cherry picked from commit 3a831e46204979550dc6ee7652cea6b8296f10c1)

10 years agotevent: use an immediate event fot tevent_req_post()
Stefan Metzmacher [Tue, 17 Mar 2009 09:18:34 +0000 (10:18 +0100)]
tevent: use an immediate event fot tevent_req_post()

Now tevent_req_post() never fails

metze
(cherry picked from commit 4bdf299385220988a4fe16f82aab528283204c7f)

10 years agotevent: use TALLOC_FREE() in tevent_req.c
Stefan Metzmacher [Tue, 17 Mar 2009 09:17:50 +0000 (10:17 +0100)]
tevent: use TALLOC_FREE() in tevent_req.c

metze
(cherry picked from commit a78cd2a24b818bc7d843a8e56ffaafc9f6578662)

10 years agotevent: add support for immediate events
Stefan Metzmacher [Fri, 13 Mar 2009 14:47:33 +0000 (15:47 +0100)]
tevent: add support for immediate events

They're like directly triggered timed events,
but you can preallocated them and scheduling them
will not fail.

metze
(cherry picked from commit 66886f8966dff8a980a5b9d2daa3fbb20fe5ca8e)

10 years agotevent: add tevent_common_loop_wait() helper function and use it
Stefan Metzmacher [Mon, 16 Mar 2009 13:15:07 +0000 (14:15 +0100)]
tevent: add tevent_common_loop_wait() helper function and use it

tevent_loop_wait should do the same for all backends.
It should loop as long as we have pending events.

metze
(cherry picked from commit 940e61846e97ba62153d5b977b0823f196607743)

10 years agotevent: check signal events first in event_loop_once
Stefan Metzmacher [Mon, 16 Mar 2009 11:45:48 +0000 (12:45 +0100)]
tevent: check signal events first in event_loop_once

We also check for signal events directly before and after
the select/epoll calls.

metze
(cherry picked from commit 0139befb915006d6ec9fec2734057c5c50b3c383)

10 years agotevent: let tevent_loop_once() just run one fd event
Stefan Metzmacher [Mon, 16 Mar 2009 11:34:23 +0000 (12:34 +0100)]
tevent: let tevent_loop_once() just run one fd event

This makes the logic much simpler for the callers,
and matches the samba3 behavior.

If needed we can add performance tunning for tevent_loop_wait()
later.

metze
(cherry picked from commit 3af7db3dce0e5529114f6969e9905c6d4c65dfe8)

10 years agotevent: change version to 0.9.4 as the ABI has changed
Stefan Metzmacher [Fri, 13 Mar 2009 14:49:35 +0000 (15:49 +0100)]
tevent: change version to 0.9.4 as the ABI has changed

metze
(cherry picked from commit 868f3f5f32eccdf68590cdfc5c42e1af970410d7)

10 years agobuild: fix detection of netinet/ip.h on FreeBSD
Timur [Tue, 17 Mar 2009 21:46:53 +0000 (22:46 +0100)]
build: fix detection of netinet/ip.h on FreeBSD

Signed-off-by: Michael Adam <obnox@samba.org>
(cherry picked from commit a3d04991ef409591a7c8b9fbb01e024bd5aaa041)

10 years agobuild: format the header check for netinet/ip.h more nicely
Timur [Tue, 17 Mar 2009 21:45:28 +0000 (22:45 +0100)]
build: format the header check for netinet/ip.h more nicely

Signed-off-by: Michael Adam <obnox@samba.org>
(cherry picked from commit e8aa7169a6672bd32af6c5580f6e8ec7e99511bc)

10 years agoRemove some transitional code in writev_send
Volker Lendecke [Tue, 17 Mar 2009 08:38:14 +0000 (09:38 +0100)]
Remove some transitional code in writev_send

10 years agoRemove some unused code from async_req.[ch]
Volker Lendecke [Mon, 16 Mar 2009 19:17:45 +0000 (20:17 +0100)]
Remove some unused code from async_req.[ch]

10 years agotalloc: change version to 1.3.0
Stefan Metzmacher [Mon, 16 Mar 2009 09:19:09 +0000 (10:19 +0100)]
talloc: change version to 1.3.0

metze
(cherry picked from commit 752cf03bf7854a4b32b0e1fedc1cb4ecd4474765)

10 years agotalloc: add useful talloc_array_length() macro
Stefan Metzmacher [Mon, 16 Mar 2009 09:16:40 +0000 (10:16 +0100)]
talloc: add useful talloc_array_length() macro

metze
(cherry picked from commit 6d4a13241a096d30d37d69a8f7b888a395716316)

10 years agotalloc: add TALLOC_FREE()
Stefan Metzmacher [Mon, 16 Mar 2009 09:13:58 +0000 (10:13 +0100)]
talloc: add TALLOC_FREE()

metze

10 years agolib/replace: use AC_TRY_LINK() to verify that getifaddrs() and freeifaddrs() are...
Stefan Metzmacher [Fri, 13 Mar 2009 09:20:29 +0000 (10:20 +0100)]
lib/replace: use AC_TRY_LINK() to verify that getifaddrs() and freeifaddrs() are available

metze
(cherry picked from commit 099d6f05cdb0800114d026786920a17ef649699f)

10 years agotevent: Fix might be unitialized warning
Tim Prouty [Thu, 12 Mar 2009 17:44:36 +0000 (10:44 -0700)]
tevent: Fix might be unitialized warning

10 years agotevent: add tevent_loop_until()
Stefan Metzmacher [Thu, 12 Mar 2009 09:35:23 +0000 (10:35 +0100)]
tevent: add tevent_loop_until()

This is only a hack for samba4 and should not be used
in new code.

metze

10 years agotevent: add tevent_loop_set_nesting_hook()
Stefan Metzmacher [Thu, 12 Mar 2009 09:23:30 +0000 (10:23 +0100)]
tevent: add tevent_loop_set_nesting_hook()

This is an ugly hack to let the s4 server work arround
some bugs related to nested events and uid changing.

metze

10 years agotevent: don't allow nested tevent_loop_once() anymore
Stefan Metzmacher [Thu, 12 Mar 2009 08:51:33 +0000 (09:51 +0100)]
tevent: don't allow nested tevent_loop_once() anymore

Incompatible caller should use tevent_loop_allow_nesting()
function.

metze

10 years agotevent: pass __location__ to tevent_loop_once/wait()
Stefan Metzmacher [Thu, 12 Mar 2009 08:33:26 +0000 (09:33 +0100)]
tevent: pass __location__ to tevent_loop_once/wait()

metze

10 years agotevent: add tevent_set_abort_fn()
Stefan Metzmacher [Thu, 12 Mar 2009 08:22:41 +0000 (09:22 +0100)]
tevent: add tevent_set_abort_fn()

metze

10 years agotevent: add tevent_signal_support()
Stefan Metzmacher [Thu, 12 Mar 2009 07:48:59 +0000 (08:48 +0100)]
tevent: add tevent_signal_support()

Not every tevent backend supports signal events.

metze

10 years agotalloc: add talloc_set_abort_fn()
Stefan Metzmacher [Thu, 12 Mar 2009 07:19:50 +0000 (08:19 +0100)]
talloc: add talloc_set_abort_fn()

metze

10 years agoasync_sock: fix truncating of the temporary iovec in writev_send/recv()
Stefan Metzmacher [Wed, 11 Mar 2009 13:28:35 +0000 (14:28 +0100)]
async_sock: fix truncating of the temporary iovec in writev_send/recv()

Volker: please check!

metze

10 years agolib/replace: make sure we include <sys/uio.h> before socket_wrapper.h
Stefan Metzmacher [Wed, 11 Mar 2009 07:05:11 +0000 (08:05 +0100)]
lib/replace: make sure we include <sys/uio.h> before socket_wrapper.h

This should fix the build on some hosts.

metze

10 years agotevent: add tevent_req_callback_data_void() macro
Stefan Metzmacher [Tue, 10 Mar 2009 13:02:30 +0000 (14:02 +0100)]
tevent: add tevent_req_callback_data_void() macro

Callers can use it instead of tevent_req_callback_data()
if they use a non talloc private pointer.

metze

10 years agotevent: add tevent_req_received() function
Stefan Metzmacher [Tue, 10 Mar 2009 12:54:57 +0000 (13:54 +0100)]
tevent: add tevent_req_received() function

This function can be called as last action of a _recv()
function, it destroys the data attached to the tevent_req.

metze

10 years agosocket_wrapper: wrap readv() and writev()
Stefan Metzmacher [Mon, 9 Mar 2009 16:48:08 +0000 (17:48 +0100)]
socket_wrapper: wrap readv() and writev()

metze

10 years agoFix prototype mismatch.
Jelmer Vernooij [Mon, 9 Mar 2009 20:49:44 +0000 (21:49 +0100)]
Fix prototype mismatch.

10 years agoMerge branch 'master' of ssh://git.samba.org/data/git/samba
Jelmer Vernooij [Mon, 9 Mar 2009 20:42:13 +0000 (21:42 +0100)]
Merge branch 'master' of ssh://git.samba.org/data/git/samba

10 years agosocket_wrapper: try to make ipv6 support more portable
Stefan Metzmacher [Mon, 9 Mar 2009 08:24:45 +0000 (09:24 +0100)]
socket_wrapper: try to make ipv6 support more portable

The internal structure of in6_addr isn't always the same.

metze

10 years agosocket_wrapper: downgrade ipv6 sockets to ipv4 is in connect() if the dest is ipv4
Stefan Metzmacher [Sun, 8 Mar 2009 16:20:18 +0000 (17:20 +0100)]
socket_wrapper: downgrade ipv6 sockets to ipv4 is in connect() if the dest is ipv4

We only do this if the socket isn't explicit bound yet.

metze

10 years agosocket_wrapper: correctly handle connected dgram sockets
Stefan Metzmacher [Sun, 8 Mar 2009 16:19:50 +0000 (17:19 +0100)]
socket_wrapper: correctly handle connected dgram sockets

metze

10 years agosocket_wrapper: make it possible to bind to '::'
Stefan Metzmacher [Tue, 3 Mar 2009 18:40:57 +0000 (19:40 +0100)]
socket_wrapper: make it possible to bind to '::'

metze