summaryrefslogtreecommitdiffstats
path: root/source3/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* gencache: don't leak cache_path onto talloc tosDavid Disseldorp2014-10-061-0/+11
| | | | | | | | Also check for allocation failures. Reported-by: Franz Pförtsch <franz.pfoertsch@brose.com> Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3: lib, s3: modules: Fix compilation on Solaris.Jeremy Allison2014-10-061-9/+10
| | | | | | | | | | | | | | | | Based on work from YOUZHONG YANG <youzhong@gmail.com>. Code needs fixing when HAVE_STRUCT_MSGHDR_MSG_CONTROL is not defined. Also Solaris doesn't have msg_flags field (which we set to zero anyway, so if we initialize the entire struct to zero, we never need to refer to it). https://bugzilla.samba.org/show_bug.cgi?id=10849 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): Mon Oct 6 12:33:36 CEST 2014 on sn-devel-104
* s3: lib: Signal handling - ensure smbrun and change password code save and ↵Jeremy Allison2014-09-301-8/+10
| | | | | | | | | | | restore existing SIGCHLD handlers. Bug #10831 - SIGCLD Signal handler not correctly reinstalled on old library code use - smbrun etc. https://bugzilla.samba.org/show_bug.cgi?id=10831 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* s3:unix_msg: document closing of fds in the receive handlerMichael Adam2014-09-301-0/+7
| | | | | | | Pair-Programmed-With: Volker Lendecke <vl@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org>
* s3:unix_msg: close the fds in unix_dgram_recv_handler() after the callback ↵Michael Adam2014-09-301-0/+6
| | | | | | | | | | | has run If the caller wants to use passed fds, he should copy them away and set them to -1. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:messaging: upon receiving fds, dup them so the caller can safely close them.Michael Adam2014-09-301-0/+5
| | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:messaging: allow the messaging receive callback to change the fdsMichael Adam2014-09-303-4/+4
| | | | | | | | | | This allows the callback to consume the fds and e.g. set them to -1 so that the caller can then treat (close) only those fds that have not been consumed. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:unix_msg: don't fill cmsg buffer in unix_dgram_send_job()Michael Adam2014-09-301-66/+61
| | | | | | | | | | | | | | | | Do this in queue_msg, instead. This renders unix_dgram_send_job() as simple as it was before we introduced fd-passing -- as it is intended. This also changes struct unix_dgram_msg to not contain the fd-array, but the correspondingly filled msghdr and cmsg buf. Pair-Programmed-With: Volker Lendecke <vl@samba.org> Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:unix_msg: add close_fd_array_cmsg()Michael Adam2014-09-301-0/+13
| | | | | | | | Variant of close_fd_array() operating on fd_array inside msghdr. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:unix_msg: factor extract_fd_array_from_msghdr() out of ↵Michael Adam2014-09-301-19/+27
| | | | | | | | | | unix_dgram_recv_handler() For re-use. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:unix_msg: simplify queue_msg() by moving space calculations up.Michael Adam2014-09-301-19/+17
| | | | | | | | | | | | This allows for early direct return instead of the goto invalid, since the fds_copy array is filled later. Pair-Programmed-With: Volker Lendecke <vl@samba.org> Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:unix_msg: use an iov in unix_dgram_msg/queue_msg instead of buffer and lengthMichael Adam2014-09-301-10/+12
| | | | | | | | | | | | This is equivalent, reads more easily and makes extraction more obvious. Pair-Programmed-With: Volker Lendecke <vl@samba.org> Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:unix_msg: rename a variable buflen->data_len in queue_msg()Michael Adam2014-09-301-6/+6
| | | | | | | | | Pair-Programmed-With: Volker Lendecke <vl@samba.org> Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:unix_msg: use a buffer pointer instead of array indexes for the iov bufferMichael Adam2014-09-301-4/+7
| | | | | | | | | | | This is more obvious to read and a preparation for following commits. Pair-Programmed-With: Volker Lendecke <vl@samba.org> Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:unix_msg: remember errno in unix_dgram_send_job in case of send error.Michael Adam2014-09-301-0/+4
| | | | | | | | | Pair-Programmed-With: Volker Lendecke <vl@samba.org> Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:unix_msg: don't close the fd-array at the end of unix_dgram_send_job()Michael Adam2014-09-301-2/+0
| | | | | | | | | | | | These pthread-pool-jobs should be minimal and ideally only do one syscall. The closing of the fds is done in unix_dgram_job_finished(). Pair-Programmed-With: Volker Lendecke <vl@samba.org> Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:unix_msg: add "close_fds" exit point to unix_msg_recv()Michael Adam2014-09-301-10/+10
| | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:messaging: msg_type int->uint32_t in struct messaging_hdrMichael Adam2014-09-301-1/+1
| | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:messaging: fix uninitialized data introduced by paddingMichael Adam2014-09-301-0/+1
| | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3: Move init_lsa_ref_domain_list to libChristof Schmitt2014-09-291-0/+67
| | | | | | | This will be used in the next patch in winbind. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:unix_msg: fix a tab<->space mixup in unix_msg_recv()Michael Adam2014-09-271-1/+1
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3: tldap_util: Ensure all asn1_XX returns are checked.Jeremy Allison2014-09-261-20/+23
| | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
* s3: tldap: Ensure all asn1_XX returns are checked.Jeremy Allison2014-09-261-143/+172
| | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
* s3:messaging: add fds-array to messaging_send_iov()Michael Adam2014-09-241-3/+16
| | | | | | Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org>
* s3:messaging: add fds-array to message-backend send functionMichael Adam2014-09-244-4/+14
| | | | | | Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org>
* s3:messaging: make it possible to receive a fd array from another processStefan Metzmacher2014-09-244-13/+83
| | | | | | | | | In order to receive the fd array the caller needs to use messaging_filtered_read_send/recv(). For all higher level methods we silently close/ignore the fd array. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:unix_msg: add fds-array to unix_msg_send() for fd passingMichael Adam2014-09-245-14/+39
| | | | | | Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org>
* s3:unix_msg: pass the fd array to the unix_msg recv_callback functionStefan Metzmacher2014-09-245-5/+23
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:unix_msg: add fds-array to unix_dgram_send() for fd-passingMichael Adam2014-09-241-12/+161
| | | | | | Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org>
* s3:unix_msg: pass the fd array to the unix_dgram recv_callback functionStefan Metzmacher2014-09-241-7/+13
| | | | | | | | For now unix_msg_recv() will just close the fds, but they will be passed to the unix_msg recv_callback in the next commits. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:unix_msg: read fds from recvmsg in unix_dgram_recv_handler()Michael Adam2014-09-241-3/+52
| | | | | | | | | For now we directly close the fds, the next commits will pass them to the recv_callback function. Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org>
* s3:unix_msg: add close_fd_array()Stefan Metzmacher2014-09-241-0/+14
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:unix_msg: use sendmsg() in unix_dgram_send_job()Stefan Metzmacher2014-09-241-3/+11
| | | | | | | This prepares fd-passing. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:messaging: use struct initializers for 'struct messaging_rec'Stefan Metzmacher2014-09-242-12/+15
| | | | | | | | This makes sure new struct members will always be initialized, without explicitly finding all users. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3: reset tracepoint handler in reinit_after fork.Michael Adam2014-09-211-2/+5
| | | | | | | | | | This for instance fixes panics in the scavenger process due to talloc stackframes not freed in order. Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* lib: Add EMSGSIZE to map_nt_error_from_unixVolker Lendecke2014-09-181-0/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb_conn: Fix a small memory leak when releasing an IPVolker Lendecke2014-09-181-1/+2
| | | | | | | | We're exiting anyway, but when in the future we have multichannel this might actually be a small leak. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* lib: Move tdb lock timeout fns to source3Volker Lendecke2014-09-181-0/+78
| | | | | | | | This is not the nicest code and needs to be replaced. Remove it from common. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* Remove a few #ifdef EWOULDBLOCkVolker Lendecke2014-09-184-50/+4
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* lib: Avoid a talloc in write_data_iovVolker Lendecke2014-09-171-9/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3: utils: Don't directly manipulate errno inside strupper_m().Jeremy Allison2014-09-161-5/+1
| | | | | | | | | | | | | | Let the internal character conversion routines set it. Caller code paths don't depend on this (checked by David Disseldorp ddiss@suse.de). Bug 10775 - smbd crashes when accessing garbage filenames https://bugzilla.samba.org/show_bug.cgi?id=10775 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
* messaging_dgm: Don't expose the messaging_dgm_contextVolker Lendecke2014-09-143-37/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now we can only support one messaging_dgm_context per process anyway, the code has checks for this. I would like to keep it that way, in the future we will have multiple messaging_context's or imessaging_context's filtering based upon the dst server_id. Why this change? messaging_dgm's lockfile contains the serverid->unique_id. When designing messaging_dgm, I had in mind to remove the serverid.tdb and replace it with the dgm lockfiles for server lookup and enumeration. I have a WIP-patchset that gets rid of almost all users of serverid.tdb. The problem is serverid_exists. Here we don't have a messaging_context available, and it would be pretty intrusive to make it so. This problem has plagued us since ctdb was developed, see for example the comment /* * This is a Samba3 hack/optimization. Routines like process_exists need to * talk to ctdbd, and they don't get handed a messaging context. */ in messaging_ctdb.c. This patchset removes this problem in a radical way: Treat the messaging_dgm context as one globally available structure and be done with it. The ctdb socket could go the same way in the future. 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 Sep 14 16:29:30 CEST 2014 on sn-devel-104
* messaging_dgm: Avoid a tallocVolker Lendecke2014-09-141-10/+10
| | | | | | | Not really required, but it removes a NULL check Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* messaging_dgm: Avoid a tallocVolker Lendecke2014-09-141-7/+8
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* messaging_dgm: messaging_dgm_lockfile_remove does not use tmp_ctx anymoreVolker Lendecke2014-09-141-3/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* messaging_dgm: messaging_dgm_lockfile_create does not use tmp_ctx anymoreVolker Lendecke2014-09-141-3/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* messaging_dgm: Avoid talloc_tos()Volker Lendecke2014-09-141-56/+55
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* messaging_dgm: ReformattingVolker Lendecke2014-09-141-2/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* messaging_dgm: Remove an unnecessary castVolker Lendecke2014-09-141-2/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* messaging3: Avoid messaging_is_self_sendVolker Lendecke2014-08-231-9/+6
| | | | | | | | | | | This was a bad API, and it was used in a buggy way: In messaging_dispatch_rec we always did the defer, we referenced the destination pid, not the source. In messaging_send_iov this is the right thing to do to reference the destination, but when we have arrived in messaging_dispatch_rec we should compare source and destination. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>