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

3429 Commits

Author SHA1 Message Date
Stefan Metzmacher
e5ae80378a tevent: add a debug message in tevent_common_loop_timer_delay()
We should debug a message before and after running the handler.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:46 -08:00
Stefan Metzmacher
3ed0f7d992 tevent: add test_event_fd2()
This test fills the socket kernel buffers
and verifies that we don't report TEVENT_FD_WRITE
if the buffer is full.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:42 -08:00
Stefan Metzmacher
cf3ee4eb53 tevent: add test_event_fd1()
This test verifies that TEVENT_FD_* flags are handled correctly.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:38 -08:00
Stefan Metzmacher
2c9d84b226 tevent: use better names for the subtests
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:35 -08:00
Jeremy Allison
04b1fa4112 tevent: Regression test to ensure that a tevent backend can cope with separate read/write events on a single fd.
This tests the multiplex fd changes to the epoll backend to
ensure they work correctly.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 12:01:31 -08:00
Stefan Metzmacher
23640472bc tevent: use DEBUG_ERROR for the fallback message in epoll_panic()
A Samba autobuild passed without a fallback, so this is
really an error.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:26 -08:00
Jeremy Allison
4fcc94d852 tevent: If epoll_ctl(..EPOLL_CTL_ADD,..) failes with EEXIST, merge the two fde's into one epoll event.
Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 12:01:24 -08:00
Stefan Metzmacher
16a072ec1c tevent: preferr the write handler if there're two possible handlers registered with epoll
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:21 -08:00
Stefan Metzmacher
fa4f1713f9 tevent: In epoll_event_loop() ensure we trigger the right handler for a multiplexed fde event.
Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 12:01:19 -08:00
Jeremy Allison
4057ef2e11 tevent: Add utility function epoll_handle_hup_or_err()
We'll use this to handle the EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR
and EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR flags with multiplexed
events in the event loop.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 12:01:17 -08:00
Stefan Metzmacher
8b1a43ece8 tevent: handle EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX in epoll_update_event()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:13 -08:00
Stefan Metzmacher
a347d55f50 tevent: handle multiplexed fde's in epoll_event_fd_destructor()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:09 -08:00
Stefan Metzmacher
6703c5b49f tevent: Fix epoll_mod_event() to cope with modifying a multiplexed fde event.
Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 12:01:07 -08:00
Jeremy Allison
15ca40fb7a tevent: Fix up epoll_del_event to cope with deleting a multiplexed fde event.
Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 12:01:05 -08:00
Stefan Metzmacher
809593e7f5 tevent: handle multiplexed fde's in epoll_add_event()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:02 -08:00
Jeremy Allison
e4b496cc09 tevent: Start to fix the epoll backend to support 2 fd events on the same fd correctly.
Add a utility function epoll_add_multiplex_fd() and
a new flag EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX.

This will be called by epoll_add_event() to merge two
fde events with the same file descriptor.

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 12:00:59 -08:00
Stefan Metzmacher
7ef688c1dd tevent: ignore EBADF from epoll_ctl() and disable the event
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:56 -08:00
Stefan Metzmacher
2721f0dc5b tevent: unify handling of HAS_EVENT and REPORT_ERROR in epoll_{add,mod,del}_event()
epoll_{add,mod,del}_event() are only called via epoll_update_event()
and epoll_update_event() should not remove REPORT_ERROR itself.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:52 -08:00
Stefan Metzmacher
ec9615c4fc tevent: always go through epoll_update_event()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:49 -08:00
Stefan Metzmacher
07e0427115 tevent: s/epoll_change_event/epoll_update_event
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:45 -08:00
Stefan Metzmacher
056dcc7a8a tevent: the content of event is ignored by EPOLL_CTL_DEL
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:41 -08:00
Stefan Metzmacher
2b3b06b9b4 tevent: call epoll_panic() if EPOLL_CTL_DEL failed
Only ENOENT is ignored as it is no error.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:37 -08:00
Stefan Metzmacher
31db8a08be tevent: use helper variables to hold the epoll_ctl() result
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:32 -08:00
Stefan Metzmacher
b2114eb3b0 tevent: remove unused if (epoll_ev->epoll_fd == -1) return; checks
We'll never leave epoll_check_reopen() with epoll_fd == -1.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:29 -08:00
Stefan Metzmacher
5b9218a3c2 tevent: add std_event_loop_wait()
We also need to fallback in tevent_loop_wait()
otherwise we might miss events in the poll->fresh list.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:24 -08:00
Stefan Metzmacher
3fc93164fb tevent: don't call TALLOC_FREE(ev->additional_data) in std_fallback_to_poll()
The epoll backend has done the cleanup already.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:20 -08:00
Stefan Metzmacher
73dabddbdc tevent: avoid any operation on epoll_ev after a epoll_panic()
This calls TALLOC_FREE(ev->additional_data), which is epoll_ev
within epoll_panic() before calling the fallback handler.

In order to notice that a epoll_panic() happened, a caller can
register a pointer to a bool variable under epoll_ev->panic_state.

As epoll_check_reopen() can fail due to a epoll_panic(),
we need to force the replay flag if we have called any event handler.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:15 -08:00
Stefan Metzmacher
2b05c96217 tevent: add epoll_{create,ctl}_panic_fallback() for testing
This makes sure we only do random panics if a fallback handler
is registered.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:11 -08:00
Stefan Metzmacher
8764ec80bb tevent: use DLIST_DEMOTE() before calling on fde handler after select() and poll()
This makes sure we don't preferr events which are at the beginning
of the list.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:06 -08:00
Stefan Metzmacher
b31767bf27 tevent: debug a FATAL message on EBADF from the select backend
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:03 -08:00
Jeremy Allison
5ca6914884 tevent: Fix multiple handler on the same fd bug in the tevent select backend.
When we're deciding what handlers to call in the select backend,
we didn't take into account the fact that the same fd may have
been added into the read FD_SET and the write FD_SET but with
different handlers.

We must match on both the file descriptor and the flags requested
before calling the handler.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 11:59:59 -08:00
Stefan Metzmacher
b53c704a34 tevent: revalidate fde->flags after poll()
This is important to avoid races between threads if the poll_mt
backend is used.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:54 -08:00
Stefan Metzmacher
6952d761d2 tevent: ignore POLLNVAL from poll() and disable the event
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:51 -08:00
Stefan Metzmacher
de0204ccae tevent: traverse the ev->fd_event list instead of the poll_ev->fds array
That has the same complexity but simplifies the code.

It also seems to fix a real problem, which was found
by the following test failure in Samba's autobuild,
while removing the epoll support from the "standard" backend.

    [402/1555 in 19m8s] samba3.raw.composite(plugin_s4_dc)
    smbtorture 4.1.0pre1-DEVELOPERBUILD
    Using seed 1361531675
    Testing savefile
    Testing parallel fetchfile with 10 ops
    waiting for completion
    maximum runtime exceeded for smbtorture - terminating
    UNEXPECTED(error): samba3.raw.composite.fetchfile (subunit.RemotedTestCase)(plugin_s4_dc)
    REASON: _StringException: _StringException: was started but never finished!
    UNEXPECTED(error): samba3.raw.composite.fetchfile(plugin_s4_dc) (subunit.RemotedTestCase)
    REASON: was started but never finished!

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:46 -08:00
Stefan Metzmacher
f45abeae40 tevent: maintain a list of disabled events in the poll backend
We need to avoid passing pollfd.events == 0, to poll(),
as it will report POLLERR and POLLHUP events, but our caller
does not expect the event handler to be called.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:42 -08:00
Stefan Metzmacher
ef8130fdbf tevent: merge poll_fresh_fde_destructor() into poll_event_fd_destructor()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:39 -08:00
Stefan Metzmacher
f75fd905f7 tevent: use tevent_poll_event_add_fd_internal() in poll_event_add_fd()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:33 -08:00
Stefan Metzmacher
8e3ef659f8 tevent: make sure we cleanup the array passed to poll() after deleting an event
If we don't cleanup the array passed to poll after an
event was deleted, we may pass a bad file descriptor to poll().

This was found by the following test failure in Samba's
autobuild, while removing the epoll support from
the "standard" backend.

    [48/1555 in 4m37s] samba3.smbtorture_s3.plain(s3dc).LOCK4
    UNEXPECTED(failure): samba3.smbtorture_s3.plain(s3dc).LOCK4.smbtorture(s3dc)
    REASON: _StringException: _StringException: using seed 1361530718
    host=127.0.0.2 share=tmp user=metze myname=sn-devel-104
    Running LOCK4
    starting locktest4
    Failed to create file: NT_STATUS_INVALID_HANDLE
    finished locktest4
    TEST LOCK4 FAILED!
    LOCK4 took 190.492 secs

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:28 -08:00
Stefan Metzmacher
d5b341d873 tevent: don't skip a fd event if the previous one was deleted during poll()
In a threaded environment it can happen that an tevent_fd is talloc_free'ed
while the main thread sleeps in the poll() syscall.

In such a case poll_event_fd_destructor() would set poll_ev->fdes[i] = NULL.

We then skip the removed event, but before we also skipped the one
that was located at the end of the array. We moved it to possition
'i', but the next loop uses 'i=i+1'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:24 -08:00
Stefan Metzmacher
f86df3e364 tevent: remember the errno from select(), poll() and epoll_wait()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:20 -08:00
Michael Adam
883d20a9bf tevent: add trace points BEFORE_LOOP_ONCE and AFTER_LOOP_ONCE
The define TEVENT_HAS_LOOP_ONCE_TRACE_POINTS can be used to
detect the new feature, without writing configure tests.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 11:59:17 -08:00
Stefan Metzmacher
5f284bec47 tevent: fix compiler warning in tevent_context_init_byname()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:13 -08:00
Stefan Metzmacher
dea5115a3d tevent: fix some compiler warnings in testsuite.c
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:09 -08:00
Michael Adam
5c31b152d2 tevent: fix a comment typo in tevent_epoll.c
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 11:59:05 -08:00
Galen.Liu
4a7142ec04 tevent: fix --disable-python cause configure fails (bug #8718)
When we disable python, it will cause build fail!
so, the patch will fix it.

Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:58:53 -08:00
Stefan Metzmacher
d5f9257108 tevent: define TEVENT_NUM_SIGNALS based on configure checks
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:58:49 -08:00
Stefan Metzmacher
602cd7f6c6 lib/replace: add AC_CHECK_VALUEOF() macro
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:58:43 -08:00
Timur Bakeyev
8ac431a22e Fix bug # 9666 - Broken filtering of link-local addresses.
This patch should address the problem with Link Local addresses
on FreeBSD and Linux.

Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <rsharpe@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Feb 28 20:56:57 CET 2013 on sn-devel-104
2013-02-28 20:56:57 +01:00
Stefan Metzmacher
6b948cf54b lib/util: add samba_tevent_set_debug()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-02-28 12:11:48 +01:00
Stefan Metzmacher
6205262d38 lib/util: allow samba_tevent_debug() to take a name as context
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-02-28 12:10:05 +01:00
Andreas Schneider
3ca727b2f9 lib-util: Don't leak file descriptor on error.
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2013-02-22 16:36:14 +01:00
Björn Jacke
240a55249d build: use -fstack-protector if available
Signed-off-by: Bjoern Jacke <bj@sernet.de>
Reviewed-by: Matthieu Patou <mat@samba.org>

Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Fri Feb 22 15:38:21 CET 2013 on sn-devel-104
2013-02-22 15:38:21 +01:00
Björn Jacke
d537d64ab8 Revert "wafbuild: use -Wstack-protector if available"
This reverts commit e6643fbf48.

Signed-off-by: Bjoern Jacke <bj@sernet.de>
Reviewed-by: Matthieu Patou <mat@samba.org>
2013-02-22 12:15:13 +01:00
Andrew Bartlett
c89df54423 ldb: Add missing dependency on replace for ldb
This brings in rep_timegm() on Solaris for example.

Andrew Bartlett

Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-22 08:47:23 +01:00
Andrew Bartlett
f2c7f2c93d build: Remove unused includes.h reference to avoid build-time talloc dep
talloc is not a dependency of this library, but is required by includes.h.

By not including includes.h, we avoid needing to add an otherwise false talloc dep.

(this comes up if talloc.h is not installed as a system package).

Andrew Bartlett

Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-22 08:44:58 +01:00
Rusty Russell
2f4b21bb57 ntdb: switch between secrets.tdb and secrets.ntdb depending on 'use ntdb'
Since we open with dbwrap, it auto-converts old tdbs (which it will
rename to secrets.tdb.bak once it's done).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date(master): Wed Feb 20 07:09:19 CET 2013 on sn-devel-104
2013-02-20 07:09:19 +01:00
Rusty Russell
3c9c3029f2 param: 'use ntdb' flag (off by default).
For simplicity, we use this in the caller to choose between filenames.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-02-20 05:31:20 +01:00
Rusty Russell
e201033e84 tdb_wrap: prevent tdbs called ".ntdb" or without extensions.
This is another belt-and-braces check in case someone decides to turn
on the fancy new .ntdb extension, and we haven't converted it to ntdb.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-02-20 05:31:19 +01:00
Rusty Russell
53aac0bc93 dbwrap_local_open: never open the .tdb if there is an .ntdb
This provides an extra safety check that everyone is using one or the
other: you can't create a tdb file if there's an ntdb file.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-02-20 05:31:19 +01:00
Rusty Russell
f3c0d1d7fe dbwrap_local_open: open NTDB if extension is .ntdb
This switches dbwrap_local_open() based on the extension of the
database name, so it handles both TDB and NTDB files.

Moreover, if asked to open a .ntdb, and there's no ntdb file but
there's a .tdb file, it converts that then moves it to .tdb.bak before
opening, and turn the .tdb file into a dangling symlink to make sure
it's never accidentally re-created or used:

	$ ls -l secrets.tdb 
	lrwxrwxrwx 1 rusty rusty 23 Feb 11 11:31 secrets.tdb -> This is now in an NTDB

This provides transparent upgrade if people decide to use NTDB on a
database.  Downgrade would be manual, eg:

	ntdbdump foo.ntdb | tdbrestore foo.tdb && mv foo.ntdb foo.ntdb.bak

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-02-20 05:31:19 +01:00
Rusty Russell
63a6381a26 dbwrap: dbwrap_ntdb.c
This is a dbwrap backend for ntdb.  It's a fairly straight conversion from
the tdb version.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-02-20 05:31:19 +01:00
Rusty Russell
3d82f786ec ntdb: fix database corruption when transaction doesn't change anything.
ntdb's transaction code has an optimization which tdb's doesnt: it
only writes the parts of blocks whose contents have changed.  This
means we can actually have a transaction which turns out to need no
recovery region.

This breaks the recovery setup logic, which sets the current recovery
size to 0 if there's no recovery area, and assumes that we'll always
create a new recovery area since the recovery will always need > 0
bytes.

In fact, if we really haven't changed anything, we can skip the
transaction commit altogether: since this happens at least once with
Samba, it's worth doing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-02-20 05:31:19 +01:00
Stefan Metzmacher
f7aa60175a lib/util: add samba_tevent_context_init()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-02-19 23:47:43 +01:00
Volker Lendecke
a7fdd4f7c2 tdb: Slightly simplify transaction_write
realloc(NULL, ...) is equivalent to malloc. We are already using this
realloc property for tdb->lockrecs. It should not make any difference
in speed, it just makes for a little simpler code.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Feb 19 17:30:13 CET 2013 on sn-devel-104
2013-02-19 17:30:13 +01:00
Volker Lendecke
fcb345f5d6 tdb: Make tdb_release_transaction_locks use tdb_allrecord_unlock
The transaction code uses tdb_alrecord_lock/upgrade, so it should also
use the tdb_allrecord_unlock function just for symmetry reasons

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-19 15:46:45 +01:00
Volker Lendecke
5929e38b6c tdb: Don't segfault if tdb_open_ex for check failed
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-19 15:46:45 +01:00
Volker Lendecke
3534e4e8d5 tdb: Factor out the retry loop from tdb_allrecord_upgrade
For the mutex code we will have to lock the hashchain and the record
lock area independently. So we will have to call the loop twice. And,
it's a small refactoring for the better anyway I think.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-19 15:46:45 +01:00
Volker Lendecke
1f93f08364 tdb: Simplify fcntl_lock() a bit
All arguments but the cmd are the same. To me this looks a bit better
and saves some bytes in the object code.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-19 15:46:45 +01:00
Volker Lendecke
542400a966 tdb: Use tdb_null in freelistcheck
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-19 15:46:45 +01:00
Volker Lendecke
68559b787e tdb: Enhance lock tracking a bit
lock-tracking.c mirrors the in-kernel fcntl structures to detect
unexpected use of fcntl calls. During my mutex work I changed our fcntl
use so that we unlock the allrecord_lock in two pieces: The range covering
the hash locks and the range covering the data area for the individual
traverse record locks. Splitting locks is not covered by lock-tracking.c.

This patch extends lock-tracking.c with this little piece. It's still
far from complete to track the full range of fcntl semantics. It is not
strictly needed right now, but it does not hurt either.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-19 15:46:45 +01:00
Michael Adam
762dd3cf29 lib/util/time: strip a potential trailing newline in the asctime case.
If strftime() is not available, asctime() is used, and this usually
appends a newline character to the result. This is not desired for
timestamp().

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-19 13:58:08 +01:00
Gregor Beck
d8dd0ecc48 lib/util_tdb: factor out tdb_data_talloc_copy()
Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-19 12:10:24 +01:00
Karolin Seeger
2ed035b5a0 fault.c: Fix typo in comment.
redundent -> redundant

Signed-off-by: Karolin Seeger <kseeger@samba.org>
2013-02-18 22:07:39 +11:00
Volker Lendecke
05235d5b44 tdb: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Simo Sorce <idra@samba.org>
Autobuild-Date(master): Sat Feb 16 17:13:32 CET 2013 on sn-devel-104
2013-02-16 17:13:32 +01:00
Jeremy Allison
daada84920 tevent: Remove the previous "standard" tevent backend implementation.
This was a horrible hybrid of duplicated epoll and select()
code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Feb 14 22:40:30 CET 2013 on sn-devel-104
2013-02-14 22:40:30 +01:00
Jeremy Allison
16f57076b1 tevent: Add in the new implementation of "standard" tevent backend.
Falls back cleanly from epoll -> poll, or uses poll if
epoll not available.

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Jeremy Allison
203f85c25e tevent: Add a private function tevent_poll_event_add_fd_internal().
Not yet used, but will be called by the "standard"
fallback from epoll -> poll backends.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Stefan Metzmacher
5fe459f5d7 tevent: make use of tevent_find_ops_byname() in tevent_context_init_byname()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Stefan Metzmacher
b5556a79e3 tevent: make sure tevent_backend_init() only runs once
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Jeremy Allison
aceeb585cb tevent: Add a utility function tevent_find_ops_byname().
Returns an event ops struct given a string name. Not
yet used, but will be part of the new "standard" fallback
code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Jeremy Allison
1ee428d5ca tevent: Add in the same tevent_re_initialise() fix Metze put in the tevent_poll backend.
We might be called during tevent_re_initialise()
which means we need to free our old additional_data.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Jeremy Allison
06fb88b449 tevent: Add in some test code to allow the panic fallback path to be tested.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Jeremy Allison
6f9819229b tevent: Plumb in the panic fallback code into the epoll_panic() runtime call.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Jeremy Allison
04ba47e491 tevent: Add an internal function tevent_epoll_set_panic_fallback().
Can be set externally, allows us to fallback if epoll
fails at runtime.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Stefan Metzmacher
e4ef2ecf02 tevent: pass 'bool replay' to epoll_panic()
A fallback panic handler will need to know if
there was an error while waiting for events
(replay=true) or if the error happened on modify
(replay=false).

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Jeremy Allison
129da06d2d tevent: Ensure we return after every call to epoll_panic().
Currently we can't return from this, but the new fallback
code will change this.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Jeremy Allison
c36f8c1400 tevent: Preparing to fix "standard" backend fallback. Initialize standard after epoll.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Volker Lendecke
c03d5c5740 dbwrap: Prevent transactions on non-persistent dbs
dbwrap_ctdb does not allow this anyway. This patch will avoid suprises
when going non-clustered to clustered. Not everybody is developing
against a clustered environment :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-08 12:58:57 +01:00
Matthieu Patou
554ba5ebbf ldb: Add more data test data for one level test cases
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Feb  8 06:46:40 CET 2013 on sn-devel-104
2013-02-08 06:46:40 +01:00
Matthieu Patou
9206eaaf5d ldb: Add tests for the python api
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-02-08 15:06:42 +11:00
Matthieu Patou
13b4815945 ldb: Add more tests related to onelevel search
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-02-08 15:06:39 +11:00
Matthieu Patou
057896a090 ldb: use strncmp instead of strcmp when comparing the val part
val part of a DN's component is DATA_BLOB and nothing insure that it
will be finished by a '\0'

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-02-08 15:06:37 +11:00
Matthieu Patou
87cbd9414b ldb: make test output more readable
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-02-08 15:06:36 +11:00
Matthieu Patou
75f422fe1d ldb-tdb: Document ltdb_index_add1 for more clarity
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-02-08 15:06:34 +11:00
Matthieu Patou
1e4e51f4c9 ldb-tdb: Fix a wrong parameter in ltdb_store
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-02-08 15:06:33 +11:00
Matthieu Patou
2470b0fe5f ldb_tdb: raise level of full index scan message so that it starts to be really visible
We don't want to have to set log level to 4 or 5 AND set the environment
variable to be able to see those log messages

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-02-08 15:06:31 +11:00
Michael Adam
085b9767a6 s3:param: remove unused function lp_idmap_backend()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Christian Ambach <ambi@samba.org>
2013-02-05 17:36:33 +01:00
Volker Lendecke
72cd5d5ff6 tdb: Remove "header" from tdb_context
header.hash_size was the only thing we ever referenced outside of
tdb_open_ex and its direct callees. So this shrinks the tdb_context by
164 bytes.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Feb  5 13:18:28 CET 2013 on sn-devel-104
2013-02-05 13:18:28 +01:00
Volker Lendecke
71247ec4bd tdb: Pass argument "header" to check_header_hash
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-05 08:55:09 +01:00
Volker Lendecke
1436107b07 tdb: Pass argument "header" to tdb_new_database
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-05 08:54:28 +01:00
Stefan Metzmacher
29aeaab1d9 lib/dbwrap: talloc_strdup() name in db_open_file()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-02-04 17:14:22 +01:00
Stefan Metzmacher
65f2bba559 lib/util: improve check_password_quality() to handle utf8
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-02-04 17:14:22 +01:00
Stefan Metzmacher
570a4b3e22 tevent_poll: add poll_event_loop_wait()
We can't use tevent_common_loop_wait() because new fd events
will be added to the poll_ev->fresh list instead of
ev->fd_events.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Feb  3 06:40:09 CET 2013 on sn-devel-104
2013-02-03 06:40:09 +01:00
Stefan Metzmacher
e79ad7cff1 tevent_poll: fix the usage of tevent_re_initialise()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-02-02 19:54:05 -08:00
Stefan Metzmacher
dd9f0c9b6d tevent_poll: call tevent_common_fd_destructor() from poll_fresh_fde_destructor()
We need to trigger the fde->close_fn().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-02-02 19:53:47 -08:00
Volker Lendecke
1cfc76f72a tevent_poll: Avoid a crash in poll_event_set_fd_flags
The event context might have been freed before the fde

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-02-02 19:53:30 -08:00
Volker Lendecke
611fcca641 tevent_poll: Avoid a crash in poll_fresh_fde_destructor
The event context might have been freed before the fde

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-02-02 19:53:12 -08:00
Volker Lendecke
0cf62a92f2 tevent_poll: NULL out fde->event_ctx for "fresh" poll fdes
This is done in tevent_common_context_destructor for the non-fresh
fdes already

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-02-02 19:52:57 -08:00
Volker Lendecke
3ce58cbcf3 tevent_poll: Use the poll_event_context_destructor always
This is in preparation for the next patch to NULL out the event_ctx
pointers in the poll_ev->fresh list

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-02-02 19:52:40 -08:00
Volker Lendecke
e3309852f7 tevent_poll: Re-order routines
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-02-02 19:52:21 -08:00
Volker Lendecke
d944e2cae1 tevent_poll: Fix a crash in the poll backend
If tevent_add_fd is immediately followed by tevent_fd_set_flags, the poll
backend crashes. This was introduced when the poll backend was prepared
for the multi-threaded python extension.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-02-02 19:52:09 -08:00
Volker Lendecke
dc929ca57f tevent: Fix a comment typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>

Autobuild-User(master): Richard Sharpe <sharpe@samba.org>
Autobuild-Date(master): Thu Jan 31 17:52:39 CET 2013 on sn-devel-104
2013-01-31 17:52:39 +01:00
Andrew Bartlett
1d1ea72574 ldb: Ensure to decrement the transaction_active whenever we delete a transaction
This is in the error path for prepare_commit, which rarely fails, but
when it does we need to ensure that when a new transaction is opened,
that it really starts a new transaction.

We bump the version to recognise critical fix for the AD DC

Without this fix, a single invalid inbound replicated link disables
all subsequent replication as we operate without a transaction (which
is refused by ldb_tdb).

Andrew Bartlett

Reviewed-by: Matthieu Patou <mat@matws.net>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-01-26 13:42:46 +01:00
Stefan Metzmacher
1ea6fabcde ldb: fix a warning by converting from TDB_DATA to struct ldb_val
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-01-26 13:41:39 +01:00
Karolin Seeger
875a1721ae docs: ldbsearch.1.xml: Correct meta data.
Signed-off-by: Karolin Seeger <kseeger@samba.org>

Karolin

Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jan 24 16:09:37 CET 2013 on sn-devel-104
2013-01-24 16:09:35 +01:00
Karolin Seeger
99e2a63a0c docs: ldbrename.1.xml: Correct meta data.
Signed-off-by: Karolin Seeger <kseeger@samba.org>

Karolin

Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-01-24 14:29:32 +01:00
Karolin Seeger
25cc400c64 docs: ldbmodify.1.xml: Correct meta data.
Signed-off-by: Karolin Seeger <kseeger@samba.org>

Karolin

Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-01-24 14:29:23 +01:00
Karolin Seeger
f585052d88 docs: ldbedit.1.xml: Correct meta data.
Signed-off-by: Karolin Seeger <kseeger@samba.org>

Karolin

Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-01-24 14:29:01 +01:00
Karolin Seeger
918057bd11 docs: ldbdel.1.xml: Correct meta data.
Signed-off-by: Karolin Seeger <kseeger@samba.org>

Karolin

Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-01-24 14:28:47 +01:00
Karolin Seeger
1d4346d4b7 docs: ldbadd.1.xml: Correct meta data.
Signed-off-by: Karolin Seeger <kseeger@samba.org>

Karolin

Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-01-24 14:28:25 +01:00
Karolin Seeger
7d56b94011 docs: ldb.3.xml: Correct meta data.
Signed-off-by: Karolin Seeger <kseeger@samba.org>

Karolin

Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-01-24 14:27:44 +01:00
Jeremy Allison
80a6fe8427 Remove some unused variables.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-01-19 10:32:30 +01:00
Andrew Bartlett
dda48146a2 heimdal_build: Try again to sort out the strerror_r mess
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-01-19 10:32:17 +01:00
Volker Lendecke
7a21f605c1 tevent: Fix a comment
liboop.org is now in a language I don't understand. But it does definitely not
contain a library.

Reviewed by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jan 18 00:05:37 CET 2013 on sn-devel-104
2013-01-18 00:05:37 +01:00
Michael Adam
11850e4605 dbwrap: add dbwrap_is_persistent()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2013-01-15 14:49:20 +01:00
Björn Baumbach
41955b711f build(waf)-libreplace: remove redundant check for flistea function
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2013-01-15 14:49:19 +01:00
Jeremy Allison
8f8ca589d2 tevent: Fix bug 9550 - sigprocmask does not work on FreeBSD to stop further signals in a signal handler
Mask off signals the correct way from the signal handler.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jan 15 12:13:43 CET 2013 on sn-devel-104
2013-01-15 12:13:43 +01:00
Jeremy Allison
0258138e20 lib/replace: Include sys/ucontext.h if available.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-01-15 08:28:45 +01:00
Jeremy Allison
fe6e323add lib/replace: Add ucontext configure autoconf checks.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-01-15 08:28:45 +01:00
Jeremy Allison
7fe400de4c lib/replace: Add ucontext configure waf checks.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-01-15 08:28:45 +01:00
Jeremy Allison
e54252ceec lib/replace: Add missing check for sys/wait.h
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-01-15 08:28:45 +01:00
Volker Lendecke
e0bfb59803 Fix bug 9548: Correctly detect O_DIRECT
Reviewed by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jan 14 21:16:23 CET 2013 on sn-devel-104
2013-01-14 21:16:23 +01:00
Stephen Gallagher
813bd0353f ldb: Move doxygen comments for ldb_connect to the right place
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Jan 14 16:21:02 CET 2013 on sn-devel-104
2013-01-14 16:21:02 +01:00
Andreas Schneider
6039388fc1 util: Add a strict directory_create_or_exist function.
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-01-09 09:11:20 +01:00
Jesper Larsen
411440d2d9 replace: Fix compilation of rep_mkstemp
Commit 1fbc185 removed the variable 'p'.
Use the equivalent variable 'template' instead.

Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jan  9 07:18:33 CET 2013 on sn-devel-104
2013-01-09 07:18:33 +01:00
Volker Lendecke
f2d67af7bc tdb: Fix undefined prototype warnings
These functions are deliberately left without prototypes according to
3fdeaa399, but without prototypes we get warnings.

Reviewed-by: Rusty Russell <rusty@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Jan  7 11:20:19 CET 2013 on sn-devel-104
2013-01-07 11:20:19 +01:00
Volker Lendecke
1beb4bc9d1 tdb: Fix \n in error messages
Reviewed-by: Rusty Russell <rusty@samba.org>
2013-01-07 09:32:22 +01:00
Jelmer Vernooij
bcacd8fc80 subunit: Update to latest upstream version.
Autobuild-User(master): Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date(master): Thu Dec 27 21:08:32 CET 2012 on sn-devel-104
2012-12-27 21:08:32 +01:00
Jelmer Vernooij
983a3ea437 testtools: Update to latest upstream version. 2012-12-27 19:23:03 +01:00
Stefan Metzmacher
24957527e0 lib/param: use the correct path names again
This fixes a regression which was introduced by commit
5b1d95046c.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Dec 27 19:19:55 CET 2012 on sn-devel-104
2012-12-27 19:19:55 +01:00
Andreas Schneider
568bade612 krb5_wrap: Remove dead code in smb_krb5_renew_ticket().
Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
2012-12-21 13:56:00 +01:00
Andreas Schneider
5b1d95046c param: Correctly create directory and create common function.
Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
2012-12-21 13:56:00 +01:00
Volker Lendecke
a444bb95a2 tdb: Add a comment explaining the "check"
I had to ask git blame to find why we have to do it here...

Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Dec 21 13:54:39 CET 2012 on sn-devel-104
2012-12-21 13:54:39 +01:00
Volker Lendecke
3109b541c9 tdb: Make tdb_new_database() follow a more conventional style
We usually "goto fail" on every error and then in normal flow set the
return variable to success. This patch removes a comment which from my
point of view is now obsolete. It violates the {} rule from README.Coding
here in favor of the style used in this function.

Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2012-12-21 11:57:01 +01:00
Volker Lendecke
d972e6fa74 tdb: Fix a typo
Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2012-12-21 11:56:47 +01:00
Volker Lendecke
c04de8f3a4 tdb: Fix a typo
Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2012-12-21 11:56:38 +01:00
Volker Lendecke
24755d75b0 tdb: Use tdb_lock_covered_by_allrecord_lock in tdb_unlock
Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2012-12-21 11:56:20 +01:00
Volker Lendecke
f8dafe5685 tdb: Factor out tdb_lock_covered_by_allrecord_lock from tdb_lock_list
Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2012-12-21 11:56:09 +01:00
Volker Lendecke
26b8545df4 tdb: Simplify logic in tdb_lock_list slightly
Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2012-12-21 11:55:55 +01:00
Volker Lendecke
0f4e7a1401 tdb: Slightly simplify tdb_lock_list
Avoid an else {} branch when we can do an early return

Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2012-12-21 11:55:15 +01:00
Volker Lendecke
116ec13bb0 tdb: Fix blank line endings
Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2012-12-21 11:54:53 +01:00
Volker Lendecke
7237fdd4dd tdb: Fix a comment
Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2012-12-21 11:54:47 +01:00
Volker Lendecke
d2b852d79b tdb: Fix a typo
Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2012-12-21 11:54:40 +01:00
Volker Lendecke
2c3fd8a13e tdb: Fix a missing CONVERT
methods->tdb_write expects data in on-disk format. For reading that
record, methods->tdb_read() has taken care of the on-disk to in-memory
representation according to the DOCONV() flag passed down. tdb_rec_write()
is a wrapper around methods->tdb_write just doing the CONVERT() on the
way to disk.

Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2012-12-21 11:54:33 +01:00
Jelmer Vernooij
d4c3f54bbf tdr: Strip trailing whitespace. 2012-12-15 16:04:26 +01:00
Andreas Schneider
bdc2f4bd91 util: Remove unused fde_stdin in samba_runcmd.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
2012-12-12 23:14:44 +01:00
Andreas Schneider
c9053796b3 tdb: Improve the documentation of tdb_reopen() and tdb_close().
Reviewed-by: Simo Sorce <idra@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Dec 12 14:58:50 CET 2012 on sn-devel-104
2012-12-12 14:58:50 +01:00
Andreas Schneider
7f08365a28 tdb: Fix possible crash bugs in the python tdb code.
You can't call tdb_error() for tdb_reopen() or tdb_close(), both return
the error code of close(2) and not a TDB_ERROR!

Reviewed-by: Simo Sorce <idra@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2012-12-12 13:15:00 +01:00
Andreas Schneider
ac434c4223 util: Don't use the pid ret value uninitialized.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2012-12-12 09:42:33 +01:00
Tsukasa Hamano
16d725b4f5 Fix bug #9471 - SEGV when using second vfs module.
Don't use default_classname_table when we obviously shoud be using
classname_table.

Reviewed by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Fri Dec  7 17:51:50 CET 2012 on sn-devel-104
2012-12-07 17:51:50 +01:00
Karolin Seeger
4af921fe88 lib/talloc: Move manpage to man/.
Trying to be more consistent.

Karolin

Reviewed-by: Andreas Schneider <asn@samba.org>
2012-12-03 14:35:11 +01:00
Karolin Seeger
ede2aaef28 lib/tdb: Rename manpages/ to man/.
Trying to be more consistent.

Karolin

Reviewed-by: Andreas Schneider <asn@samba.org>
2012-12-03 14:35:11 +01:00
Andreas Schneider
5323508773 replace: Remove deprecated getpass() support.
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2012-12-03 14:35:10 +01:00
Andreas Schneider
27a1327b49 util: Add a UNIX platform independent samba_getpass().
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2012-12-03 14:35:08 +01:00
Michael Adam
8f3f38ece4 ldb: fix a typo in the comment for ldb_req_is_untrusted()
Signed-off-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Nov 30 15:44:46 CET 2012 on sn-devel-104
2012-11-30 15:44:46 +01:00
Volker Lendecke
e271db4fd8 dbwrap: Remove an unnecessary if-statement
TALLOC_FREE can live with a NULL pointer

Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 18:27:38 +01:00
Volker Lendecke
c7af12dd30 dbwrap: No need to NULL out a talloc_zero'ed structure element
Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 18:27:37 +01:00
Volker Lendecke
a02251333f dbwrap: Use talloc_zero in db_open_rbt
Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 18:27:37 +01:00
Volker Lendecke
0c0815cfe3 dbwrap: Use talloc_zero in db_open_cache
Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 18:27:36 +01:00
Volker Lendecke
8300791a67 dbwrap: Use dbwrap_parse_record in dbwrap_fetch_uint32_bystring
Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 17:24:35 +01:00
Karolin Seeger
68c6dcb094 docs: man tdbtool: Add missing meta data.
This avoids warnings during the waf build and removes "FIXME" entries from the
manpage.

Karolin

Reviewed-by: Andreas Schneider <asn@samba.org>
2012-11-29 13:41:49 +01:00
Karolin Seeger
174ab3542d docs: man talloc: Add missing meta data.
This avoids warnings during the waf build and removes "FIXME" entries from the
manpage.

Karolin

Reviewed-by: Andreas Schneider <asn@samba.org>
2012-11-29 13:41:43 +01:00
Karolin Seeger
0162dd55d3 docs: man ldbsearch: Add missing meta data.
This avoids warnings during the waf build and removes "FIXME" entries from the
manpage.

Karolin

Reviewed-by: Andreas Schneider <asn@samba.org>
2012-11-29 13:41:39 +01:00
Karolin Seeger
787a58b4a7 docs: man ldbrename: Add missing meta data.
This avoids warnings during the waf build and removes "FIXME" entries from the
manpage.

Karolin

Reviewed-by: Andreas Schneider <asn@samba.org>
2012-11-29 13:41:36 +01:00
Karolin Seeger
1404a24d3e docs: man ldbmodify: Add missing meta data.
This avoids warnings during the waf build and removes "FIXME" entries from the
manpage.

Karolin

Reviewed-by: Andreas Schneider <asn@samba.org>
2012-11-29 13:41:32 +01:00
Karolin Seeger
0b900da6ac docs: man ldbedit: Add missing meta data.
This avoids warnings during the waf build and removes "FIXME" entries from the
manpage.

Karolin

Reviewed-by: Andreas Schneider <asn@samba.org>
2012-11-29 13:41:26 +01:00
Karolin Seeger
1d5ef8931c docs: man ldbdel: Add missing meta data.
This avoids warnings during the waf build and removes "FIXME" entries from the
manpage.

Karolin

Reviewed-by: Andreas Schneider <asn@samba.org>
2012-11-29 13:41:23 +01:00
Karolin Seeger
08e63057de docs: man ldbadd: Add missing meta data.
This avoids warnings during the waf build and removes "FIXME" entries from the
manpage.

Karolin

Reviewed-by: Andreas Schneider <asn@samba.org>
2012-11-29 13:41:19 +01:00
Karolin Seeger
ac4881bd01 docs: man ldb.3: Add missing meta data.
This avoids warnings during the waf build and removes "FIXME" entries from the
manpage.

Karolin

Reviewed-by: Andreas Schneider <asn@samba.org>
2012-11-29 13:40:58 +01:00
Andrew Bartlett
c704f0daa5 lib/replace: Do not use STRERROR_R_PROTO_COMPATIBLE as only roken.h sets this
Currently, we put strerror_r into libreplace even on systems with strerror_r.

Andrew Bartlett

Reviewed-by: Andreas Schneider <asn@samba.org>
2012-11-22 10:21:16 +01:00
Stefan Metzmacher
a15da36258 lib/replace: replace all *printf function if we replace snprintf (bug #9390)
This fixes segfaults in log level = 10 on Solaris.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Björn Jacke <bj@sernet.de>

Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Wed Nov 14 19:41:14 CET 2012 on sn-devel-104
2012-11-14 19:41:14 +01:00
Jelmer Vernooij
a53caea7a2 subunit: Update to latest upstream version.
Autobuild-User(master): Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date(master): Wed Nov 14 12:11:58 CET 2012 on sn-devel-104
2012-11-14 12:11:57 +01:00
Jelmer Vernooij
7b654a8c18 testtools: Update to latest version. 2012-11-14 09:46:53 +01:00
Andrew Bartlett
d6c7e9b1ed smbd: Remove NT4 compatability handling in posix -> NT ACL conversion
NT4 is long dead, and we should not change which ACL we return based
on what we think the client is.  The reason we should not do this, is
that if we are using vfs_acl_xattr then the hash will break if we do.
Additionally, it would require that the python VFS interface set the
global remote_arch to fake up being a modern client.

This instead seems cleaner and removes untested code (the tests are
updated to then handle the results of the modern codepath).

The supporting 'acl compatability' parameter is also removed.

Andrew Bartlett

Reviewed by: Jeremy Allison <jra@samba.org>
2012-11-13 22:48:19 +01:00
Stefan Metzmacher
6f47497610 lib/ldb: add missing newline in the output of ldb_ldif_write_trace()
Signed-off-by: Stefan Metzmacher <metze@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Nov 13 13:53:31 CET 2012 on sn-devel-104
2012-11-13 13:53:31 +01:00
Stefan Metzmacher
1ecc76b248 lib/addns: remove compiler warnings
Signed-off-by: Stefan Metzmacher <metze@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2012-11-13 22:14:14 +11:00
Stefan Metzmacher
eecc1d2942 lib/addns: don't depend on the order in resp->answers[]
Signed-off-by: Stefan Metzmacher <metze@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2012-11-13 22:14:13 +11:00
Stefan Metzmacher
b59c5db5f7 lib/addns: remove pointless check for resp->num_additionals != 1
We never use resp->additionals, so there's no reason to check.

This fixes dns updates against BIND9 (used in a Samba4 domain).

Signed-off-by: Stefan Metzmacher <metze@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2012-11-13 22:14:13 +11:00
Volker Lendecke
647a0fb098 lib/util: Simplify bitmap.c a bit
This avoids the double-talloc for bitmaps

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-07 15:32:24 +01:00
Volker Lendecke
7f4d55d1b8 lib/util: Make "struct bitmap" abstract
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-07 15:32:24 +01:00
Stefan Metzmacher
719595b6f7 lib/tsocket: optimize syscalls in tstream_readv_pdu_send()
Once we've got the first part of a pdu we try to optimize
readv calls for the rest of the pdu.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-11-05 17:13:40 +01:00
Stefan Metzmacher
e42889f83f lib/tsocket: disable the syscall optimization for recvfrom/readv by default
We only do the optimization on recvfrom/readv if the caller asked for it.

This is needed because in most cases we preferr to flush send
buffers before receiving incoming requests.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-11-05 17:13:39 +01:00
Stefan Metzmacher
24f3f87706 lib/krb5_wrap: request enc_types in the correct order (bug #9272)
aes256-cts-hmac-sha1-96 and aes128-cts-hmac-sha1-96
should have a higher priority than arcfour-hmac-md5,
otherwise the KDC still gives us arcfour-hmac-md5 session keys.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-01 16:24:28 +01:00
Andrew Tridgell
30ffdda45b ldb: fixed callers for ldb_pack_data() and ldb_unpack_data()
with ltdb_pack_data() and ltdb_unpack_data() now moved into common, we
need to increase the minor version and fixup callers of the API

Note that this relies on struct ldb_val being the same shape as
TDB_DATA, in much the same way as we rely on ldb_val and DATA_BLOB
being the same shape.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2012-11-01 15:40:41 +11:00
Andrew Tridgell
fc47b0d03c ldb: move ldb_pack.c into common
this code should not be tied to the ldb_tdb backend, both because it
could be used for any record oriented backend, and because it should
be exposed for use by diagnosis/repair tools such as the recently
added ldbdump tool

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2012-11-01 15:40:40 +11:00
Björn Jacke
ffb608b54d util: remove accidently committed hunk
Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Wed Oct 31 19:25:30 CET 2012 on sn-devel-104
2012-10-31 19:25:30 +01:00
Andrew Bartlett
a71ad96bd0 ldb: Add ldbdump, based on tdbdump
This uses a tdb_traverse or (more usefully) the tdb_rescue API, like tdbdump.

The difference here is that it uses ldb helper functions to further
eliminate faulty records, which avoids creating duplicates in the output.

(The duplicates come from parts of records that are left in blank space
in the db, which tdb_rescue finds, but which are not actually a full
record).

Andrew Bartlett

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Oct 30 23:56:11 CET 2012 on sn-devel-104
2012-10-30 23:56:11 +01:00
Andrew Bartlett
4b2f3c6dec ldb: Remove no-longer-existing ltdb_unpack_data_free from ldb_tdb.h 2012-10-31 08:13:56 +11:00
Andrew Bartlett
cc6d0decc7 ldb: Change ltdb_unpack_data to take an ldb_context
It always de-references the module to find the ldb anyway.

Andrew Bartlett
2012-10-31 08:13:56 +11:00
Björn Jacke
e6643fbf48 wafbuild: use -Wstack-protector if available
Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Tue Oct 30 15:04:30 CET 2012 on sn-devel-104
2012-10-30 15:04:30 +01:00