summaryrefslogtreecommitdiffstats
path: root/source3/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* messaging3: Avoid self-send complexityVolker Lendecke2014-12-091-110/+3
| | | | | | | | | | | | | | | | | With the notify code I've hit another case where self-sends caused a problem. This time messages were lost because we tried to do multiple dispatch_rec calls from within a single inotify callback. Only the first one was being taken care of, the others did not find receivers. This patch makes self-sends go through the kernel as well, the kernel queues everything nicely for us. With dgram messaging this should be pretty fast. If it turns out to be a performance problem, we can solve it later by doing proper queueing in user space. We need to completely decouple any processing from callbacks. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Add a simple read_data call without NTSTATUSVolker Lendecke2014-12-072-0/+23
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Make write_data take a const void *Volker Lendecke2014-12-072-2/+2
| | | | | | | This aligns it with write(2) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Split out write_data[_iov]Volker Lendecke2014-12-075-81/+143
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Split out iov_buf[len]Volker Lendecke2014-12-075-43/+97
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: read_data->read_data_ntstatusVolker Lendecke2014-12-072-4/+4
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Split out sys_[read|write] & friendsVolker Lendecke2014-12-078-90/+142
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* ctdbd_conn: Accept msgs to all registered srvidsVolker Lendecke2014-12-071-5/+38
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:vfs: add SMB_VFS_READDIR_ATTR()Ralph Boehme2014-12-041-0/+37
| | | | | | | | | | | | SMB_VFS_READDIR_ATTR is a last minute hook to fetch additional metadata for a directory entry when we're already marshalling the SMB reply buffer. This would be used, when there's a need to repurpose some fields in the the reply, like it's done with Apple's SMB2 extension "AAPL". Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* unix_msg: Fix unix_msg_test_drainVolker Lendecke2014-12-041-0/+7
| | | | | | | | | | | | poll_funcs_init_tevent does not register a tevent context by default. This used to be the case in an early development stage, but apparently I haven't tested this for a while :-) 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): Thu Dec 4 18:55:08 CET 2014 on sn-devel-104
* s3:idmap_cache: remove unused idmap_cache_set_sid2[u|g]id()Stefan Metzmacher2014-12-032-74/+0
| | | | | | | | | Change-Id: I40bcfacb812b0dac7917533c9baf82a79f598efd Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Autobuild-User(master): Garming Sam <garming@samba.org> Autobuild-Date(master): Wed Dec 3 06:44:29 CET 2014 on sn-devel-104
* s3-lib: Do not require a password with --use-ccache.Andreas Schneider2014-12-021-1/+2
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=10279 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
* gencache: Request mutexes for gencache_notrans.tdbChristof Schmitt2014-11-261-1/+2
| | | | | | | | | | | The check in tdb_wrap ensures that mutexes are only used on systems that properly support them. 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): Wed Nov 26 19:04:11 CET 2014 on sn-devel-104
* gencache: Convert gencache.tdb to tdb_wrapChristof Schmitt2014-11-261-30/+31
| | | | | | | | This change is not strictly necessary, but for consistency both gencache tdbs are now opened through tdb_wrap. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* gencache: Convert gencache_notrans to use tdb_wrapChristof Schmitt2014-11-261-25/+28
| | | | | | | This allows using on the mutex check in tdb_wrap. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:gencache: don't use transaction non non-persistent gencache_notrans.tdbMichael Adam2014-11-261-8/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gencache_notrans.tdb is a non-persistent cache layer above the persistent gencache.tdb. Despite its name, and despite the nature of non-persistent tdbs, the current stabilization code uses a transaction on gencache_notrans.tdb like this: transaction_start(cache) transaction_start(cache_notrans) traverse(cache_notrans, stabilize_fn) transaction_commit(cache) transaction_commit(cache_notrans) where stabilze_fn does this on a record: 1. store it to or delete it from cache (depending on the timeout) 2. delete it from the cache_notrans This patch changes gencache_notrans.tdb to avoid transactions by using an all-record lock like this: tdb_allrecord_lock(cache_notrans) transaction_start(cache) traverse(cache_notrans, stabilize_fn_mod) transaction_commit(cache) traverse(cache_notrans, wipe_fn) tdb_wipe_all(cache_notrans) tdb_allrecord_unlock(cache_notrans) with stabilize_fn_mod doing only: 1. store the record to or delete it from cache (depending on the timeout) and wipe_fn deleting the records from the gencache_notrans db. This is a step towards making non-persistent-db specific features like mutex locking usable for gencache_notrans.tdb. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
* s3:gencache: simply stabilize() a bit more: remove error from stateMichael Adam2014-11-261-5/+1
| | | | | | | | | | | state.error is set to true if and only if the traverse callback returns error (-1), and hence only if the traverse fails. Hence the the error state is redundant. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
* s3:gencache: fix logic in stabilization when deleting a record from stable cacheMichael Adam2014-11-261-3/+3
| | | | | | | | | | | | | Set state->written = true in the delete case if and only if the record has really been deleted. This does currently not seem to lead to an unneeded write to the DB, since failure to delete the record will cause the traverse and hence the transaction to cancel. But I think this is clearer. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
* lib: Use tdb_parse_record in gencache_setVolker Lendecke2014-11-261-7/+15
| | | | | | | | 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): Wed Nov 26 14:50:38 CET 2014 on sn-devel-104
* lib: Fix header include protection #defineVolker Lendecke2014-11-251-2/+2
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Nov 25 15:38:22 CET 2014 on sn-devel-104
* s3:lib/netapi/examples: fix pointer from integer error in nltest.cStefan Metzmacher2014-11-251-1/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:lib/netapi/tests: fix invalid switch enum level warningStefan Metzmacher2014-11-251-1/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:lib: fix/simplify srprs_hex()Stefan Metzmacher2014-11-251-10/+6
| | | | | | | | | | | | | | | | | | | | | There're a few problems with this function. - it pretends to support values up to UINT64_MAX in it only returns 'unsigned' which support only values up to UINT32_MAX. Currently we only have callers with len=2 and len=8, so it's not a triggered bug. We just allow (len >= 1 && len <= 8) now. - The compiler is not able to inspect the format string to sscanf(). We copy up to 8 bytes into a stack buffer and always pass "%8x" to sscanf. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* messaging3: Fix sending large messages on FreeBSDVolker Lendecke2014-11-241-0/+4
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* unix_msg: Reformat unix_dgram_send a bitVolker Lendecke2014-11-241-1/+3
| | | | | | | This makes the next commit a bit more readable Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* samba: pass down size_t instead of int to add_string_to_array().Günther Deschner2014-11-171-1/+1
| | | | | | | | | | Guenther Signed-off-by: Günther Deschner <gd@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Mon Nov 17 19:53:22 CET 2014 on sn-devel-104
* dbwrap_ctdb: Pass on mutex flags to tdb_openVolker Lendecke2014-11-161-1/+2
| | | | | | | | | | | | | | Without this, ctdb can create a tdb file with mutex activated, but the local tdb_open will not open the tdb due to strict flags checks whether mutexes are possible. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10922 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): Sun Nov 16 12:13:54 CET 2014 on sn-devel-104
* s3:lib: fix const warnings in popt_common.cStefan Metzmacher2014-11-151-3/+6
| | | | | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat Nov 15 01:46:13 CET 2014 on sn-devel-104
* lib: Slightly simplify strupper_mVolker Lendecke2014-11-141-2/+2
| | | | | | | | | | toupper_ascii_fast_table is only referenced here, make it static. 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 Nov 14 00:31:16 CET 2014 on sn-devel-104
* eventlog: Free tos talloced path.David Disseldorp2014-11-101-0/+1
| | | | | | | | | | Non-error code path was missed in the last talloc tos leak fix patch-set. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Mon Nov 10 19:00:01 CET 2014 on sn-devel-104
* Use tevent_req_simple_recv_unix in a few placesVolker Lendecke2014-11-103-17/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:messaging: fix conversion specifierRalph Boehme2014-11-091-2/+3
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3: nmbd: Ensure NetBIOS names are only 15 characters stored.Jeremy Allison2014-11-041-1/+9
| | | | | | | | | | | | This screws up if the name is greater than MAX_NETBIOSNAME_LEN-1 in the unix charset, but less than or equal to MAX_NETBIOSNAME_LEN-1 in the DOS charset, but this is so old we have to live with that. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Tue Nov 4 18:23:11 CET 2014 on sn-devel-104
* serverid: don't leak lock_path onto talloc tosDavid Disseldorp2014-11-031-1/+9
| | | | | | | Also check for allocation failures. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* server_mutex: don't leak lock_path onto talloc tosDavid Disseldorp2014-11-031-1/+6
| | | | | | | Also check for allocation failures. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: don't leak lock_path onto talloc tosDavid Disseldorp2014-11-031-1/+9
| | | | | | | Also check for allocation failures. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* dbwrap_watch: don't leak lock_path onto talloc tosDavid Disseldorp2014-11-031-1/+7
| | | | | | | Also check for allocation failures. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* sharesec: don't leak state_path onto talloc tosDavid Disseldorp2014-11-031-2/+10
| | | | | | | Also check for allocation failures. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* eventlog: don't leak state_path onto talloc tosDavid Disseldorp2014-11-031-3/+7
| | | | | | | Also check for allocation failures. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Change expired password flag indicatorGabriel Buades2014-11-031-1/+1
| | | | | | Signed-off-by: Gabriel Buades <gbuades@soffid.com> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Jim McDonough <jmcd@samba.org>
* ctdb: Rename CTDB_VERSION to CTDB_PROTOCOLAmitay Isaacs2014-10-283-12/+10
| | | | | | | CTDB_VERSION really is the ctdb protocol version. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* build: Remove configure checks for ctdb headersAmitay Isaacs2014-10-282-21/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb: Rename ctdb socket variable from CTDB_PATH to CTDB_SOCKETAmitay Isaacs2014-10-282-3/+3
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* build: Remove checks for ctdb featuresAmitay Isaacs2014-10-283-45/+0
| | | | | | | | Since we are always building with integrated CTDB, there is no need for these checks. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* s3-netapi: add DS_8 and WS flags to libnetapi and nltest.Günther Deschner2014-10-242-1/+6
| | | | | | | Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* messaging3: Fix running down a messaging_contextVolker Lendecke2014-10-241-0/+16
| | | | | | | | | | | | When you do a talloc_free(msg_ctx), existing waiters can't and don't have to clean up behind themselves properly anymore. The msg_ctx the cleanup function refers to is just gone. 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 Oct 24 04:01:32 CEST 2014 on sn-devel-104
* poll_funcs_tevent: Fix a valgrind errorVolker Lendecke2014-10-241-8/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The valgrind error happened in poll_funcs_tevent_handle_destructor in if (handle->ctx->refcount == 0) handle->ctx was already gone at the time this destructor was called. It happened because during messaging_init the messaging_dgm subsystem was free'ed. The unix_msg context and the poll_funcs_tevent_context are children of messaging_dgm_context. How was poll_funcs_tevent_handle_destructor still called? While working on the new notify subsystem I've added some messaging_read_send tevent_reqs, which register themselves with the dgm_context via messaging_dgm_register_tevent_context. They were not gone yet. When later these were also run down due to another talloc_free somewhere else, this destructor referenced dead memory. This code now protects the poll_funcs_tevent_handle against the poll_funcs_tevent_context going away first with the loop for (h = ctx->handles; h != NULL; h = h->next) { h->ctx = NULL; } in poll_funcs_tevent_context_destructor together with if (handle->ctx == NULL) { return 0; } in poll_funcs_tevent_handle_destructor. A side-effect of this code is that messaging_read_send request won't be satisfied anymore after a reinit_after_fork kicked in. But I think this is the right thing anyway: Every process should register its own message handlers explicitly. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:lib/netapi: avoid calling cli_set_username()Stefan Metzmacher2014-10-171-3/+1
| | | | | | Change-Id: I3ab768d2df06749187555a16d7b930f7cc8f8b9f Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:libsmb: Remove unused domain copy stored in cli_stateStefan Metzmacher2014-10-171-1/+0
| | | | | | Change-Id: I7333140906bb3a487205b5760396dcc00a9f49b0 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:libsmb: Remove unused password copy stored in cli_stateAndrew Bartlett2014-10-171-1/+0
| | | | | | Change-Id: Ia6b33a25628ae08be8a8c6baeb71ce390315cb45 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>