summaryrefslogtreecommitdiffstats
path: root/source3/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* lib: Add unix_msgVolker Lendecke2014-04-236-0/+1357
| | | | | | | | | | | | | | | | | | This is a messaging layer based on unix domain datagram sockets. Sending to an idle socket is just one single nonblocking sendmsg call. If the recv queue is full, we start a background thread to do a blocking call. The source4 based imessaging uses a polling fallback. In a situation where thousands of senders beat one single blocked socket, this will generate load on the system due to the constant polling. This does not happen with a threaded blocking send call. The threaded approach has another advantage: We save become_root() calls on the retries. The access checks are done when the blocking socket is connected, the threaded blocking send call does not check permissions anymore. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Add poll_funcsVolker Lendecke2014-04-234-0/+306
| | | | | | | | | This is an abstraction for a tevent loop. It will be used in low-level messaging with the goal to make low-leve our low-level messaging routines usable also for other projects which are not based on tevent. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3-lib: Add root_mode() which can deal with uid_wrapper.Andreas Schneider2014-04-171-0/+20
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* lib-util: rename memdup to smb_memdup and fix all callersBjörn Baumbach2014-04-162-3/+3
| | | | | Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Volker Lendecke <vl@samba.org>
* Typo: Specifing -> specifying.Jelmer Vernooij2014-04-131-1/+1
| | | | | | | Signed-Off-By: Jelmer Vernooij <jelmer@samba.org> Change-Id: I80286441b32cd0b8384610b5b6db7790b8a22d48 Reviewed-on: https://gerrit.samba.org/221 Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:lib: use stack buffers in drain_socket() and default_sys_recvfile()Stefan Metzmacher2014-04-111-16/+2
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3-lib/util: fix logic inside set_namearray loops.Jeremy Allison2014-04-091-10/+16
| | | | | | | | | | | | | Additional fix for bug #10544 - s3-lib/util: set_namearray reads across end of namelist string. Not strictly needed as the initial fix addresses the problem, but corrects the internal logic inside the loops. https://bugzilla.samba.org/show_bug.cgi?id=10544 Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Michael Adam <obnox@samba.org>
* s3-lib/util: fix read across end of namelist stringBjörn Baumbach2014-04-081-2/+5
| | | | | | | | | | | | If the namelist is not terminated with a '/', we try to read the next character after the string termination '\0'. Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Apr 8 21:44:16 CEST 2014 on sn-devel-104
* s3: smbd/nmbd/winbindd - fix append on trailing slash on system paths.Jeremy Allison2014-04-051-1/+1
| | | | | | | | | | | | | | | | | | The xx_path() function incorrectly uses talloc_asprintf_append() instead of talloc_asprintf() on a path that may have been modified by the trim_string() call previously. talloc_asprintf_append() always sticks the new text at the *end* of the allocated buffer, not at the end of the string. Fix bug #10538 - Daemons crashing when lock/state/cache directory parameter has a trailing slash https://bugzilla.samba.org/show_bug.cgi?id=10538 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Sat Apr 5 13:40:30 CEST 2014 on sn-devel-104
* s3: messages: Implement cleanup of dead records.Jeremy Allison2014-04-032-0/+55
| | | | | | | | | | | | When a smbd process dies, pending messages.tdb records for this process might not get cleaned up. Implement a cleanup for dead records that is triggered after a smbd dies uncleanly; the records for that PID are deleted. Based on a patchset from Christof Schmitt <cs@samba.org>. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
* s3:lib/netapi/examples: remove unused variablesStefan Metzmacher2014-04-024-30/+0
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:lib/netapi/examples: fix const warnings in netlogon_control2.cStefan Metzmacher2014-04-021-2/+2
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:lib/netapi/examples: fix invalid pointer value warnings in ↵Stefan Metzmacher2014-04-021-5/+6
| | | | | | | getjoininformation.c Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:lib/netapi: fix some incompatible pointer type warnings in ↵Stefan Metzmacher2014-04-021-3/+5
| | | | | | | NetGetJoinableOUs_l() Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:lib/smbconf: fix const warnings in testsuite.cStefan Metzmacher2014-04-021-4/+6
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:lib: fix a const warning in client_match()Stefan Metzmacher2014-04-021-1/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* tdb_wrap: Remove tdb_wrap_open_ againVolker Lendecke2014-03-314-18/+18
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* mutex: Avoid passing lp_ctx to tdb_wrap_open in grab_named_mutexVolker Lendecke2014-03-311-5/+11
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* dbwrap: Avoid passing lp_ctx to tdb_wrap_open in db_open_ctdbVolker Lendecke2014-03-311-2/+7
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* serverid: Avoid passing lp_ctx to tdb_wrap_open in serverid_parent_initVolker Lendecke2014-03-311-3/+9
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* messaging: Avoid passing lp_ctx to tdb_wrap_open in messaging_tdb_parent_initVolker Lendecke2014-03-311-3/+7
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* messaging: Avoid passing lp_ctx to tdb_wrap_open in messaging_tdb_initVolker Lendecke2014-03-311-3/+9
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* asys: Allow multiple results to be receivedVolker Lendecke2014-03-273-35/+54
| | | | | | | | | | | This makes use of C99 dynamic arrays. In this performance-sensitive code, I would like to avoid malloc/free, and I think 15 years after the standard we might be able to use this feature. Alternatively, we could use the "results" memory area and store the jobids in the upper range, playing some cast-tricks. Should work as well. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* pthreadpool: Allow multiple jobs to be receivedVolker Lendecke2014-03-276-31/+43
| | | | | | | This can avoid syscalls when multiple jobs are finished simultaneously Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* pthreadpool: Avoid a malloc/free per jobVolker Lendecke2014-03-271-54/+91
| | | | | | | | | | | pthreadpool_add_job is in our hottest code path for r/w intensive workloads, so we should avoid anything CPU-intensive. pthreadpool used to malloc each job and free it in the worker thread. This patch adds a FIFO queue for jobs that helper threads copy from, avoiding constant malloc/free. This cuts user space CPU in the local-bench-pthreadpool benchmark by roughly 10% on my system. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:build: remove global CLUSTER_SUPPORT defineStefan Metzmacher2014-03-245-20/+3
| | | | | | | | | | All ctdb specific code is isolated in samba-cluster-support.so now. 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): Mon Mar 24 19:08:44 CET 2014 on sn-devel-104
* s3:wscript: only build ctdb_dummy.c if we have no cluster supportStefan Metzmacher2014-03-245-20/+0
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:serverid: use ctdb_serverids_exist_supported() runtime checkStefan Metzmacher2014-03-241-5/+9
| | | | | | | | This is better than a compile time check for HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:ctdb_conn: only use ctdb_protocol.h or ctdb_private.h in ctdb_conn.cStefan Metzmacher2014-03-242-16/+9
| | | | | | | We don't need them in ctdb_conn.h. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:lib: add cluster_support_[available|features]()Stefan Metzmacher2014-03-242-0/+111
| | | | | | | This allows runtime selection of libsamba-cluster-support.so Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:param: move lp_ctdbd_socket() to ctdbd_conn.cStefan Metzmacher2014-03-243-3/+18
| | | | | | | This allows us to use CTDB_PATH only in ctdbd_conn.c Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:lib: move all ctdb related dummy functions to ctdb_dummy.cStefan Metzmacher2014-03-245-114/+179
| | | | | | | This gets all dummy functions for the build without CLUSTER_SUPPORT. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:ctdbd_conn: always provide ctdb_serverids_exist()Stefan Metzmacher2014-03-241-4/+4
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:ctdbd_conn: add ctdb_serverids_exist_supported()Stefan Metzmacher2014-03-241-0/+9
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* gencache: Add gencache values to memcacheVolker Lendecke2014-03-111-0/+37
| | | | | | | | | | | | gencache_parse calling tdb shows up in profiles when we do a lot of open/close traffic with large ACLs. For every file we convert unix ids to sids, and in the domain member case this goes through gencache. 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): Tue Mar 11 19:56:47 CET 2014 on sn-devel-104
* build: Do not rely on sys.platform for ACL tests, combine UnixWare and ↵Andrew Bartlett2014-03-081-2/+2
| | | | | | | | | | | | | | | Solaris ACL tests This avoids issues with whatever sys.platform may return, fixes the order of arguments to the CHECK_FUNCS_IN call, and only runs after Linux-style POSIX ACL detection fails. Andrew Bartlett Change-Id: I930dff1e03c1cd1ceb8f3a35823ceb805694b66a Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org> Tested-by: Thomas Schulz <schulz@adi.com>
* pthreadpool: Add test for fork crashVolker Lendecke2014-03-031-0/+48
| | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Kamen Mazdrashki <kamenim@samba.org> Reviewed-by: Simo Sorce <simo@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* pthreadpool: Fix pthreadpools with forkVolker Lendecke2014-03-031-15/+6
| | | | | | | | | | | | The current could would crash if a pthreadpool was created, deleted and the process then fork()s. "pthreadpools" is NULL in this case, but the pthread_atfork handlers are in place. This fixes walking the pthreadpools list in reverse. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Kamen Mazdrashki <kamenim@samba.org> Reviewed-by: Simo Sorce <simo@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* 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>