summaryrefslogtreecommitdiff
path: root/source3/lib
Commit message (Collapse)AuthorAgeFilesLines
* source3: remove sock_execGary Lockyer2017-11-201-118/+0
| | | | | | | | | | | | | | | | | | | | | | | | Remove the sock_exec code which is no longer needed and additionally has been used by exploit code. This was originally test support code, the tests relying on the sock_exec code have been removed. Past exploits have used sock_exec as a proxy for system() matching a talloc destructor prototype. See for example: Exploit for Samba vulnerabilty (CVE-2015-0240) at https://gist.github.com/worawit/051e881fc94fe4a49295 and the Red Hat post at https://access.redhat.com/blogs/766093/posts/1976553 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Mon Nov 20 07:20:13 CET 2017 on sn-devel-144
* lib: Remove fncall.cVolker Lendecke2017-10-211-332/+0
| | | | | | | | | | | | | | This was meant as a nice wrapper around pthreadpool_add_job. pthreadpool_tevent_job_send does the same thing. The getaddrinfo_send/recv was the only example and can easily be re-added on top of pthreadpool_tevent_job_send. 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): Sat Oct 21 00:04:59 CEST 2017 on sn-devel-144
* lib: Remove unused getaddinfo_send/recvVolker Lendecke2017-10-201-82/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Simplify cleanupdb a bitVolker Lendecke2017-10-201-21/+14
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3: VFS: Protect errno if sys_getwd() fails across free() call.Jeremy Allison2017-10-041-0/+4
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13069 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: VFS: Ensure sys_getwd() doesn't leak memory on error on really old systems.Jeremy Allison2017-10-041-1/+6
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13069 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Remove talloc_dictVolker Lendecke2017-09-301-177/+0
| | | | | | | | Looked like a good idea at its time, but its only user did not need it anyway Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Use CTDB_CONTROL_CHECK_PID_SRVIDVolker Lendecke2017-09-261-3/+18
| | | | | | | | | | | | Also check the unique ID for remote server ids, just like we do for local server ids Bug: https://bugzilla.samba.org/show_bug.cgi?id=13042 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Sep 26 13:47:31 CEST 2017 on sn-devel-144
* lib: Add "unique_id" to ctdbd_process_existsVolker Lendecke2017-09-263-3/+5
| | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=13042 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* CVE-2017-12150: s3:lib: get_cmdline_auth_info_signing_state smb_encrypt ↵Stefan Metzmacher2017-09-201-0/+3
| | | | | | | | | | | | SMB_SIGNING_REQUIRED This is an addition to the fixes for CVE-2015-5296. It applies to smb2mount -e, smbcacls -e and smbcquotas -e. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12997 Signed-off-by: Stefan Metzmacher <metze@samba.org>
* CVE-2017-12150: s3:popt_common: don't turn a guessed username into a ↵Stefan Metzmacher2017-09-202-6/+30
| | | | | | | | specified one BUG: https://bugzilla.samba.org/show_bug.cgi?id=12997 Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3: Avoid netlogon_creds_cli.h in includes.hVolker Lendecke2017-09-161-0/+1
| | | | | | | There's no point recompiling all of source3 if netlogon_creds_cli.h is changed Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3-lib: Fix error mapping for EROFSSachin Prabhu via samba-technical2017-09-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | EROFS is incorrectly mapped to NT_STATUS_ACCESS_DENIED. This should instead be mapped to NT_STATUS_MEDIA_WRITE_PROTECTED. This change has already been done for the client in unix_nt_errmap in libcli/util/errmap_unix.c commit 9d055846f225 ("r3278: - rewrote the client side rpc...)") SMB1 specs for SMB_COM_DELETE also specifies this mapping for EROFS https://msdn.microsoft.com/en-us/library/ee441772.aspx RH bz: 1171705 This problem was reported by Red Hat glusterfs QE who encountered different errors when performing the same operation on a fuse mount and on a cifs mount of the same underlying gluster filesystem. Signed-off-by: Sachin Prabhu <sprabhu@redhat.com> Reviewed-by: Gunther Deschner <gdeschne@redhat.com> Reported-by: Surabhi Bhalothia <sbhaloth@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* messaging: Avoid a socket leak after forkVolker Lendecke2017-09-051-1/+2
| | | | | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=13006 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 Sep 5 19:12:34 CEST 2017 on sn-devel-144
* configure: Centralize check for posix_fallocateVolker Lendecke2017-08-241-1/+1
| | | | | | | | | | | | | This checks for posix_fallocate unless we are sitting on an ancient glibc. With this we don't need HAVE_BROKEN_POSIX_FALLOCATE anymore, HAVE_POSIX_FALLOCATE will only be defined if we have a valid [g]libc. ./configure tested on Debian, FreeBSD (which does have posix_fallocate) and OpenBSD (which does not have posix_fallocate). Also tested with changing the not have an old-enough glibc around. All did the right thing. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* gencache: Simplify gencache_stabilizeVolker Lendecke2017-08-171-45/+10
| | | | | | | | | | | The only record that must remain in gencache_notrans.tdb is the last_stabilize marker. Use tdb_wipe_all and store the marker under the allrecord lock. 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): Thu Aug 17 15:49:00 CEST 2017 on sn-devel-144
* gencache: Remove tdb_check from gencache_init()Volker Lendecke2017-08-171-23/+0
| | | | | | | | | This was legacy from times when we had just one non-transactioned gencache.tdb. With the split into transactioned gencache.tdb and fast, non-transactioned, mutexed clear-if-first gencache_notrans.tdb this has become unnecessary. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* s3: messaging: Add background job send failure messageAnoop C S2017-08-161-0/+1
| | | | | | | | | Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Wed Aug 16 16:26:12 CEST 2017 on sn-devel-144
* s3: clients: Use netlogon_creds_cli_close_global_db() in all normal exit paths.Jeremy Allison2017-07-261-0/+2
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* messaging: Remove messages_ctdbd.cVolker Lendecke2017-07-253-439/+0
| | | | | | | Replaced by messages_ctdb.[ch] Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* ctdb_conn: Use messaging_ctdb_connectionVolker Lendecke2017-07-254-16/+16
| | | | | | | Replace messaging_ctdbd_connection Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* messaging: Use messaging_ctdb_ref()Volker Lendecke2017-07-251-50/+33
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* messages_ctdb: Add messaging_ctdb_connectionVolker Lendecke2017-07-252-0/+10
| | | | | | | | | | | | | This will be the replacement for messaging_ctdbd_connection(). This does not default to initializing messaging but panics. We just don't have correct default arguments for messaging_init. Implicit multiple messaging and event contexts is a bug also. It *might* be that some tools fail due to this, but this needs fixing in different ways. See the previous commit for smbpasswd. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* dbwrap_ctdb: Use messaging_ctdbd_connectionVolker Lendecke2017-07-254-21/+23
| | | | | | | | | | | With messages_ctdb, the global ctdb connection will change after fork. Don't store the wrong parent connection across a fork. The alternative would be to do a reinit on all dbwrap_ctdb databases, but that seems overkill given that we only have one "standard" ctdb connection anyway. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* messaging: Add messages_ctdb_refVolker Lendecke2017-07-253-0/+193
| | | | | | | Modeled after messages_dgm_ref Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* messaging: Add messaging_ctdb_init/destroyVolker Lendecke2017-07-253-0/+315
| | | | | | | | | | | | | This models connecting to ctdb after the dgm code. The main point is that we should never open more than more ctdb socket for messaging. With more than one socket, we might end up with our pid registered with ctdb on more than one socket. This could lead to memory overconsumption in ctdb. ctdbd will eventually throw away messages, but they will take up space unnecessarily. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* dbwrap: Avoid dbwrap_merge_dbufs in db_ctdb_storevVolker Lendecke2017-07-251-12/+5
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* messages_ctdb: Handle async msgs for nested event contextsVolker Lendecke2017-07-254-55/+62
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* messaging: Add messaging_ctdbd_register_tevent_contextVolker Lendecke2017-07-254-16/+135
| | | | | | | We need to listen for the ctdb socket in nested event contexts Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* ctdbd_conn: Pass "ev" through ctdbd_socket_readableVolker Lendecke2017-07-252-3/+4
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* ctdbd_conn: Pass "ev" through ctdb_handle_messageVolker Lendecke2017-07-251-3/+4
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* ctdbd_conn: Pass "ev" through ctdbd_msg_call_backVolker Lendecke2017-07-251-4/+5
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* ctdbd_conn: Pass "ev" through ctdb connection callbacksVolker Lendecke2017-07-253-6/+13
| | | | | | | | | This prepares the same logic we've implemented in messages_dgm for clustering that is used in 6d3c064f1a5: We need to reply for messages from ctdb in nested event contexts properly. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* messaging: Broadcast messages to all event contextsVolker Lendecke2017-07-251-38/+127
| | | | | | | | | | We must give all event contexts that might be interested the chance to pick up the message. If we send a message to ourselves via messaging_send_iov_from, nested event contexts need to get a chance to see the message. Before this patch only the main event context in msg_ctx got it. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* messaging: Keep an array of event contexts registeredVolker Lendecke2017-07-251-0/+96
| | | | | | | | | | This is done with an explicit reference-counting and without talloc destructors. The code is isolated enough for now that explicit refcount management seems simpler. This might change in the future, but for now keep it simple. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* messaging: Factor out messaging_dispatch_waitersVolker Lendecke2017-07-251-23/+33
| | | | | | | | No real code change: This makes dispatching to non-classic receives available for other callers. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: remove unused functions g_lock_get() and g_lock_get_talloc()Volker Lendecke2017-07-251-76/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: Use parse_record in g_lock_dumpVolker Lendecke2017-07-251-24/+64
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: remove unused functions g_lock_put() and g_lock_record_store()Volker Lendecke2017-07-251-80/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: Use dbwrap_do_locked in g_lock_write_dataVolker Lendecke2017-07-251-34/+62
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: Use dbwrap_do_locked in g_lock_lock_retryVolker Lendecke2017-07-251-28/+25
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: Use dbwrap_do_locked for g_lock_lockVolker Lendecke2017-07-251-21/+43
| | | | | | | Don't talloc the record Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: Avoid talloc in g_lock_trylockVolker Lendecke2017-07-251-39/+28
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: Initialize variablesVolker Lendecke2017-07-251-2/+2
| | | | | | | gcc -O3 complains, but I think this is a false positive Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: Implement g_lock_unlock without tallocVolker Lendecke2017-07-251-45/+50
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: add "struct g_lock" without tallocVolker Lendecke2017-07-251-0/+89
| | | | | | | Enable handing the g_lock.tdb content without having to talloc Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: simplify g_lock_trylockVolker Lendecke2017-07-251-15/+18
| | | | | | | The now mandatory talloc_realloc_array will go away soon Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: Walk locks only once in g_lock_trylockVolker Lendecke2017-07-251-10/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* dbwrap_watch: Implement do_lockedVolker Lendecke2017-07-251-12/+155
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* dbwrap_watch: Introduce dbwrap_watch_recVolker Lendecke2017-07-251-195/+130
| | | | | | | | | | The idea is to leave the "watchers" array unparsed until it's needed. This avoids a few talloc calls and unnecessary parsing. Also, it deletes quite a few lines of code and .text bytes. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>