summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* tevent: remove unused if (epoll_ev->epoll_fd == -1) return; checksStefan Metzmacher2013-03-011-9/+0
| | | | | | | 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>
* tevent: add std_event_loop_wait()Stefan Metzmacher2013-03-011-0/+17
| | | | | | | | 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>
* tevent: don't call TALLOC_FREE(ev->additional_data) in std_fallback_to_poll()Stefan Metzmacher2013-03-011-1/+0
| | | | | | | The epoll backend has done the cleanup already. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tevent: avoid any operation on epoll_ev after a epoll_panic()Stefan Metzmacher2013-03-011-11/+74
| | | | | | | | | | | | | | 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>
* tevent: add epoll_{create,ctl}_panic_fallback() for testingStefan Metzmacher2013-03-011-5/+49
| | | | | | | | 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>
* tevent: use DLIST_DEMOTE() before calling on fde handler after select() and ↵Stefan Metzmacher2013-03-012-0/+2
| | | | | | | | | | 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>
* tevent: debug a FATAL message on EBADF from the select backendStefan Metzmacher2013-03-011-0/+4
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tevent: Fix multiple handler on the same fd bug in the tevent select backend.Jeremy Allison2013-03-011-2/+6
| | | | | | | | | | | | | 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>
* tevent: revalidate fde->flags after poll()Stefan Metzmacher2013-03-011-0/+6
| | | | | | | | 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>
* tevent: ignore POLLNVAL from poll() and disable the eventStefan Metzmacher2013-03-011-1/+44
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tevent: traverse the ev->fd_event list instead of the poll_ev->fds arrayStefan Metzmacher2013-03-011-26/+5
| | | | | | | | | | | | | | | | | | | | | | | 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>
* tevent: maintain a list of disabled events in the poll backendStefan Metzmacher2013-03-011-7/+48
| | | | | | | | | 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>
* tevent: merge poll_fresh_fde_destructor() into poll_event_fd_destructor()Stefan Metzmacher2013-03-011-18/+6
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tevent: use tevent_poll_event_add_fd_internal() in poll_event_add_fd()Stefan Metzmacher2013-03-011-2/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tevent: make sure we cleanup the array passed to poll() after deleting an eventStefan Metzmacher2013-03-011-0/+30
| | | | | | | | | | | | | | | | | | | | | | | 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>
* tevent: don't skip a fd event if the previous one was deleted during poll()Stefan Metzmacher2013-03-011-2/+9
| | | | | | | | | | | | | | 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>
* tevent: remember the errno from select(), poll() and epoll_wait()Stefan Metzmacher2013-03-013-5/+11
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tevent: add trace points BEFORE_LOOP_ONCE and AFTER_LOOP_ONCEMichael Adam2013-03-013-0/+18
| | | | | | | | | | 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>
* tevent: fix compiler warning in tevent_context_init_byname()Stefan Metzmacher2013-03-011-1/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tevent: fix some compiler warnings in testsuite.cStefan Metzmacher2013-03-011-1/+15
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tevent: fix a comment typo in tevent_epoll.cMichael Adam2013-03-011-1/+1
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tevent: fix --disable-python cause configure fails (bug #8718)Galen.Liu2013-03-011-1/+1
| | | | | | | | 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>
* tevent: define TEVENT_NUM_SIGNALS based on configure checksStefan Metzmacher2013-03-013-2/+46
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/replace: add AC_CHECK_VALUEOF() macroStefan Metzmacher2013-03-011-0/+15
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Fix bug # 9666 - Broken filtering of link-local addresses.Timur Bakeyev2013-02-281-13/+15
| | | | | | | | | | | 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
* lib/util: add samba_tevent_set_debug()Stefan Metzmacher2013-02-282-1/+14
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* lib/util: allow samba_tevent_debug() to take a name as contextStefan Metzmacher2013-02-281-5/+16
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* lib-util: Don't leak file descriptor on error.Andreas Schneider2013-02-221-0/+1
| | | | Reviewed-by: Alexander Bokovoy <ab@samba.org>
* build: use -fstack-protector if availableBjörn Jacke2013-02-221-0/+3
| | | | | | | | 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
* Revert "wafbuild: use -Wstack-protector if available"Björn Jacke2013-02-221-3/+0
| | | | | | | This reverts commit e6643fbf48afccd0acedb65fbe24d3ce84d44c40. Signed-off-by: Bjoern Jacke <bj@sernet.de> Reviewed-by: Matthieu Patou <mat@samba.org>
* ldb: Add missing dependency on replace for ldbAndrew Bartlett2013-02-221-1/+1
| | | | | | | | This brings in rep_timegm() on Solaris for example. Andrew Bartlett Reviewed-by: Stefan Metzmacher <metze@samba.org>
* build: Remove unused includes.h reference to avoid build-time talloc depAndrew Bartlett2013-02-221-1/+0
| | | | | | | | | | | | 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>
* ntdb: switch between secrets.tdb and secrets.ntdb depending on 'use ntdb'Rusty Russell2013-02-201-0/+5
| | | | | | | | | | | 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
* param: 'use ntdb' flag (off by default).Rusty Russell2013-02-202-0/+10
| | | | | | | | 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>
* tdb_wrap: prevent tdbs called ".ntdb" or without extensions.Rusty Russell2013-02-201-0/+8
| | | | | | | | | 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>
* dbwrap_local_open: never open the .tdb if there is an .ntdbRusty Russell2013-02-201-0/+5
| | | | | | | | | 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>
* dbwrap_local_open: open NTDB if extension is .ntdbRusty Russell2013-02-201-5/+157
| | | | | | | | | | | | | | | | | | | | | | 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>
* dbwrap: dbwrap_ntdb.cRusty Russell2013-02-203-10/+734
| | | | | | | | | 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>
* ntdb: fix database corruption when transaction doesn't change anything.Rusty Russell2013-02-203-15/+91
| | | | | | | | | | | | | | | | | | | | 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>
* lib/util: add samba_tevent_context_init()Stefan Metzmacher2013-02-193-2/+76
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* tdb: Slightly simplify transaction_writeVolker Lendecke2013-02-191-8/+2
| | | | | | | | | | | | 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
* tdb: Make tdb_release_transaction_locks use tdb_allrecord_unlockVolker Lendecke2013-02-191-1/+1
| | | | | | | | 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>
* tdb: Don't segfault if tdb_open_ex for check failedVolker Lendecke2013-02-191-0/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tdb: Factor out the retry loop from tdb_allrecord_upgradeVolker Lendecke2013-02-191-20/+39
| | | | | | | | | 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>
* tdb: Simplify fcntl_lock() a bitVolker Lendecke2013-02-191-4/+4
| | | | | | | | 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>
* tdb: Use tdb_null in freelistcheckVolker Lendecke2013-02-191-3/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tdb: Enhance lock tracking a bitVolker Lendecke2013-02-191-0/+11
| | | | | | | | | | | | | | | 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>
* lib/util/time: strip a potential trailing newline in the asctime case.Michael Adam2013-02-191-0/+9
| | | | | | | | | 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>
* lib/util_tdb: factor out tdb_data_talloc_copy()Gregor Beck2013-02-192-0/+16
| | | | | | Signed-off-by: Gregor Beck <gbeck@sernet.de> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* fault.c: Fix typo in comment.Karolin Seeger2013-02-181-1/+1
| | | | | | redundent -> redundant Signed-off-by: Karolin Seeger <kseeger@samba.org>