summaryrefslogtreecommitdiffstats
path: root/source3/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* dbwrap_ctdb: avoid smbd/ctdb deadlocks: check whether we can work locally in ↵Michael Adam2014-03-031-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | db_ctdb_parse_record() If the same process tries to re-lock the same record it has already locked, don't go to the ctdbd again. There are situations where we already have a lock on a record and then do a dbwrap_parse_record() on that record, for instance in locking code: do_lock() -> grabs lock on brl record with brl_get_locks() -> calls brl_lock() -> calls brl_lock_posix or _windows_default() -> calls contend_level2_oplocks_begin() -> calls brl_locks_get_read_only() -> calls dbwrap_parse_record on the same brl record as above In the local (tdb) case, this is not a problem, because identical fcntl locks in the same process don't contend each other, but calling out to ctdb for this lets smbd and ctdb deadlock. db_ctdb_fetch_lock() already correclty checks first whether we can simply try to lock locally. But db_ctdb_parse_record() failed to do so for empty records, i.e. records that only consist of the ctdb record header. (These can be deleted records but can also be freshly created and still empty records.) This patch lets db_ctdb_parse_record() not skip local access for empty records, hence fixing the deadlock. PLAN: In the long run, it would be better to solve this generically on the dbwrap_layer, i.e. root the notion of an already locked record there, and skip any call to the db (tdb or ctdb backend) if we have it. This would also solve the problem for all calls like fetch_locked, parse_record and possibly others. But this is the urgent fix for now. Pair-Programmed-With: Volker Lendecke <vl@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Tested-by: Björn Baumbach <bb@sernet.de>
* dbwrap: Slightly simplify dbwrap_watch_record_storedVolker Lendecke2014-02-251-5/+2
| | | | | | | | | | | We have messaging_send_buf, so there's no point to use an explicit DATA_BLOB here. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Feb 25 23:27:21 CET 2014 on sn-devel-104
* s3:lib/ctdbd_conn: let release_ip_handler return boolStefan Metzmacher2014-02-211-6/+30
| | | | | | | | If it returns true the passed ip address matched and we let a nested ctdb operation fail with NT_STATUS_ADDRESS_CLOSED. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* lib: Fix a typoVolker Lendecke2014-02-201-2/+2
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Kai Blin <kai@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Feb 20 22:58:59 CET 2014 on sn-devel-104
* messaging: Fix a memleak on error in messaging_tdb_initVolker Lendecke2014-02-201-0/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Kai Blin <kai@samba.org>
* lib: Avoid a strlen call in xx_path()Volker Lendecke2014-02-201-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Kai Blin <kai@samba.org>
* messaging: Enforce just one messaging contextVolker Lendecke2014-02-191-0/+20
| | | | | | | | | | The current messaging implementation is based on a tdb indexed by server_id. If we have more than one messaging context in a process, messages might not arrive at the right context and be dropped, depending on which signal handler is triggered first. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* auth: Make new_server_id_task() static to auth_samba4Volker Lendecke2014-02-121-42/+0
| | | | | | | | This is not used in other parts of source3, so this patch improves modularity and isolation of features. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* cmdline: Remove dynconfig hooks in command line processingAndrew Bartlett2014-02-121-145/+0
| | | | | | | | | | | | | | | | | | | | | | This removes the ability to set paths like the sbindir, bindir, and changes the tool for setting lockdir statedir etc to be via --option="lock dir=/var/lock". These were originally added by commit 90a6873b0570f2691ba8d8fd11154c856bdd4415 by James Peach <jpeach@samba.org> The important use case, qemu, does not use these options, but specifies these directories via an smb.conf. They are being removed to remove a layer from the loadparm system, now that options can be specified from the command line. It will also make it easier to generate the affected parameters from the XML documentation if this layer of indirection is removed. Andrew Bartlett Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Wed Feb 12 16:42:14 CET 2014 on sn-devel-104
* lib/param: Remove special handling for 'state dir' and 'cache dir'Andrew Bartlett2014-02-121-2/+2
| | | | | | | | | | | | | | | The build system gives these two parameters different defaults (compared with lock dir) in both the --enable-fhs and default mode, so the logic to use lock dir no longer applies unless the build has been very specially constructed. Therefore, remove the special case handling and make these normal parameters again. Reviewed-by: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* param: rename lp function and variable from "nis_home_map" to "nis_homedir"Garming Sam2014-02-081-2/+2
| | | | | | | | | | Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat Feb 8 03:31:34 CET 2014 on sn-devel-104
* param: rename lp function and variable from "usernamelevel" to "username_level"Garming Sam2014-02-071-3/+3
| | | | | | Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* param: rename lp function and variable from "cli_maxprotocol" to ↵Garming Sam2014-02-071-1/+1
| | | | | | | | "client_max_protocol" Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* param: rename lp function and variable from "nis_home_map_name" to "homedir_map"Garming Sam2014-02-071-2/+2
| | | | | | Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* param: rename lp function and variable from "serverstring" to "server_string"Garming Sam2014-02-071-2/+2
| | | | | | Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* param: rename lp function and variable from 'lockdir' to 'lock_directory'Garming Sam2014-02-071-1/+1
| | | | | | Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* dbwrap: use DBWRAP_LOCK_ORDER_VALID() in db_open()Michael Adam2014-02-071-9/+1
| | | | | | | | | | instead of the hand written test. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Fri Feb 7 18:05:51 CET 2014 on sn-devel-104
* dbwrap: add dbwrap_flags argument to dbwrap_local_open()Michael Adam2014-02-071-1/+1
| | | | | | | | To be consistent with db_open() and prepare for future possible extensions. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap_open: add 'dbwrap_optimize_readonly:* = yes' optionStefan Metzmacher2014-02-071-0/+25
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* dbwrap_ctdb: implement DBWRAP_FLAG_OPTIMIZE_READONLY_ACCESSStefan Metzmacher2014-02-071-0/+21
| | | | | | | | | | For non-persistent databases we try to use CTDB_CONTROL_SET_DB_READONLY in order to make use of readonly records. Pair-Programmed-With: Michael Adam <obnox@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org>
* dbwrap: add a dbwrap_flags argument to db_open_ctdb()Michael Adam2014-02-073-4/+7
| | | | | | | | This is in preparation of directly supporting ctdb read only record copies when opening a ctdb database from samba. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: add a dbwrap_flags argument to db_open()Michael Adam2014-02-076-6/+11
| | | | | | | | | | This is in preparation to support handing flags to backends, in particular activating read only record support for ctdb databases. For a start, this does nothing but adding the parameter, and all databases use DBWRAP_FLAG_NONE. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3-lib: Add winbind_lookup_usersids().Andreas Schneider2014-02-052-0/+38
| | | | | | | Pair-Programmed-With: Guenther Deschner <gd@samba.org> Signed-off-by: Guenther Deschner <gd@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pthreadpool: Fix a comment, "quit"->"shutdown"Volker Lendecke2014-01-281-2/+2
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Tue Jan 28 19:06:40 CET 2014 on sn-devel-104
* smbd: Fix format errors on FreeBSD10Volker Lendecke2014-01-241-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* messaging3: Remove unused messaging_tdb_eventVolker Lendecke2014-01-211-10/+0
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Jan 21 10:07:21 CET 2014 on sn-devel-104
* messaging3: remove msg_channelVolker Lendecke2014-01-212-382/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* dbwrap_watch: Use messaging_read_send/recvVolker Lendecke2014-01-211-13/+7
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* messaging3: Add messaging_read_send/recvVolker Lendecke2014-01-212-1/+126
| | | | | | | | | | | | | | | | | | | This is made to replace the msg_channel abstraction. msg_channel was created to not miss any messages. For this, some complex queueing was installed. This complexity has caused quite a few problems in the past (see bug 10284 for example). messaging_read_send/recv is able to achieve the same goal with a lot less complexity. The messaging_read_send atomically installs the reader into the messaging_context, we will not miss any messages while this installed. messaging_send_recv will deinstall that listener, but in the callback function you can directly call messaging_read_send again without going through the tevent_loop_once. As long as this is always made sure, no messages will be lost. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:lib/tldap: make use of tevent_req_set_cleanup_fn()Stefan Metzmacher2014-01-171-7/+13
| | | | | | | | | | This is more better than a custom tevent_req destructor. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Fri Jan 17 14:34:06 CET 2014 on sn-devel-104
* s3:lib/tldap: make use of tevent_req_defer_callback()Stefan Metzmacher2014-01-171-0/+2
| | | | | | | | | | In tldap_msg_received() we call tevent_req_error() for more than one request, if we do that we need to use tevent_req_defer_callback() otherwise we're likely to crash, as a triggered callback may invalidate our state. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:lib/fncall: make use of tevent_req_set_cleanup_fn()Stefan Metzmacher2014-01-171-7/+16
| | | | | | | This is more better than a custom tevent_req destructor. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:dbwrap: Use milliseconds for "Held tdb lock" messageChristof Schmitt2014-01-161-5/+6
| | | | | | | | | | | This is consistent with the parameter using milliseconds and the other warnings in the same file also using milliseconds. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Jan 16 11:19:39 CET 2014 on sn-devel-104
* s3:dbwrap: Store warning thresholds in db_ctdb_ctxChristof Schmitt2014-01-161-4/+18
| | | | | | | | | Avoid the parameter lookup for the warning thresholds in the hot code path by reading them in db_open_ctdb and storing them in the db_ctdb_ctx. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:dbwrap include the hashchain in the logsChristian Ambach2014-01-161-3/+12
| | | | | | Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:dbwrap report time for chainlock and CTDB migrateChristian Ambach2014-01-161-2/+15
| | | | | | Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* dbwrap_ctdb: Instrument chainunlock timingVolker Lendecke2014-01-161-2/+26
| | | | | | | | | | | | We need an indication whether we run into the fcntl thundering herd. fcntl unlock should be blindingly fast in the normal case. If it takes longer than 5 milliseconds, warn. The timeout can be adapted by setting ctdb:unlock_warn_threshold = <number-of-milliseconds> Reviewed-by: Christof Schmitt <cs@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org>
* ctdb_conn: Log long fetch_lock callsVolker Lendecke2014-01-161-4/+22
| | | | | | | | | | | | | | | | | With this patch, the number of fetch_lock attempts before dbwrap_ctdb logs that it took x attempts to get a record is configurable with net conf setparm global ctdb:migrate_attempts 10 This patch also adds net conf setparm global ctdb:migrate_duration 5000 to trigger the same log message if it took longer than x milliseconds to retrieve a record. Reviewed-by: Christof Schmitt <cs@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org>
* messaging: Fix a memleak (master only..)Volker Lendecke2014-01-101-7/+9
| | | | | | | | | | Immediate tevents don't free themselves as timed events do :-) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Jan 10 01:20:04 CET 2014 on sn-devel-104
* messaging: Use talloc_pooled_objectVolker Lendecke2014-01-091-6/+3
| | | | | | | ... not as a speed improvement, it saves the second NULL check Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* messaging: Move the self-send logic out of messaging_tdbVolker Lendecke2014-01-092-54/+52
| | | | | | | This is not specific to tdb Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* messaging: Fix a memleak with clusteringVolker Lendecke2014-01-091-0/+3
| | | | | | | We have to properly throw away unexpected messages that came in via ctdb Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3: Add DAC_OVERRIDE capability supportAbhidnya Joshi2013-12-161-0/+4
| | | | | Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
* gencache: Fix a type-punned warningVolker Lendecke2013-12-161-1/+5
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Mon Dec 16 17:11:13 CET 2013 on sn-devel-104
* s3:lib: avoid talloc_zero_array() in poll_one_fd()Stefan Metzmacher2013-12-141-14/+5
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3: use directory_create_or_exist_strict() to create corepathGregor Beck2013-12-111-16/+17
| | | | | | | | | This simplifies the code and even works in testenv where the chown call fails. Signed-off-by: Gregor Beck <gbeck@sernet.de> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3-lib: Fix %G substitution for domain users in smbdAndreas Schneider2013-12-101-1/+11
| | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=10286 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Christian Ambach <ambi@samba.org> Autobuild-User(master): Christian Ambach <ambi@samba.org> Autobuild-Date(master): Tue Dec 10 16:39:43 CET 2013 on sn-devel-104
* s3:lib/asys modify included headersChristian Ambach2013-12-101-4/+2
| | | | | | | use the headers from libreplace, not the system ones Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* CVE-2013-4408:s3:Ensure LookupRids() replies arrays are range checked.Jeremy Allison2013-12-092-0/+32
| | | | | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=10185 Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Karolin Seeger <kseeger@samba.org> Autobuild-Date(master): Mon Dec 9 09:00:41 CET 2013 on sn-devel-104
* CVE-2013-4408:s3:Ensure LookupNames replies arrays are range checked.Jeremy Allison2013-12-093-1/+145
| | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=10185 Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Jeremy Allison <jra@samba.org>