summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* tevent: version 0.9.25tevent-0.9.25Stefan Metzmacher2015-06-122-1/+89
| | | | | | | | | | | | | * Fix compile error in Solaris ports backend. * Fix access after free in tevent_common_check_signal(). bug #11308 * Improve pytevent bindings. * Testsuite fixes. * Improve the documentation of the tevent_add_fd() assumtions. It must be talloc_free'ed before closing the fd! See bug #11141 and bug #11316. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* pytevent: add a TeventTimer_Object_ref helper structure to make the code clearerStefan Metzmacher2015-06-121-9/+13
| | | | | | | | This gives talloc_set_destructor to verify the type, which removes a compiler warning. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* pytevent: remove const warnings using discard_const_p()Stefan Metzmacher2015-06-121-13/+23
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* pytevent: remove dead code TEVENT_DEPRECATED is never definedStefan Metzmacher2015-06-121-48/+0
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* talloc:guide: fix documented signature of talloc_unlink().Michael Adam2015-06-121-1/+1
| | | | | | | The second argument is void *, not const void *. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* talloc:manpage: fix documented signature of talloc_unlink().Michael Adam2015-06-121-1/+1
| | | | | | | The second argument is void *, not const void *. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* talloc: sync the talloc_reference() description between talloc_guide and manpageStefan Metzmacher2015-06-121-3/+3
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-vacuum: revert "Do not delete VACUUM MIGRATED records immediately"Michael Adam2015-06-121-5/+0
| | | | | | | | | | This reverts commit 257311e337065f089df688cbf261d2577949203d. That commit was due to a misunderstanding, and it does not fix what it was supposed to fix. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-ib: make sure the tevent_fd is removed before the fd is closedStefan Metzmacher2015-06-121-11/+10
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* libcli/smb: make sure we remove the writev_send() request when a request is ↵Stefan Metzmacher2015-06-121-0/+14
| | | | | | | | | | | | destroyed This way smbXcli_conn_disconnect() removes all tevent_fd structures attached to the sock_fd before closing it. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* libcli/smb: add smb1 requests to the pending array before writev_send()Stefan Metzmacher2015-06-121-12/+6
| | | | | | | | | | This way we have a change to destroy the pending writev_send request before closing the socket in smbXcli_conn_disconnect(). BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* libcli/smb: make sure the writev_send of smbXcli_conn_samba_suicide() is ↵Stefan Metzmacher2015-06-121-0/+53
| | | | | | | | | removed before closing the socket BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* libcli/smb: remove unused split of read_fd and write_fdStefan Metzmacher2015-06-121-26/+12
| | | | | | | | | | The tevent epoll backend supports separate read and write tevent_fd structure on a single fd, so there's no need for a dup() anymore. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* libcli/smb: close the socket fd at the end of smbXcli_conn_disconnect()Stefan Metzmacher2015-06-121-6/+9
| | | | | | | | | | We need to cancel all pending requests before closing the socket fds, otherwise we cause problem with the interaction with the epoll event backend. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* libcli/smb: use tevent_req_received(req) in read_smb_recv()Stefan Metzmacher2015-06-121-0/+2
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* lib/async_req: remove the tevent_fd as early as possible via a ↵Stefan Metzmacher2015-06-121-9/+21
| | | | | | | | | wait_for_read_cleanup() hook BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* lib/async_req: remove the tevent_fd as early as possible via a ↵Stefan Metzmacher2015-06-121-4/+20
| | | | | | | | | read_packet_cleanup() hook BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* lib/async_req: use tevent_req_nomem/tevent_req_post in read_packet_send()Stefan Metzmacher2015-06-121-7/+4
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* lib/async_req: s/result/req/ in read_packet_send()Stefan Metzmacher2015-06-121-6/+6
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* lib/async_req: remove the tevent_fd as early as possible via a ↵Stefan Metzmacher2015-06-121-14/+27
| | | | | | | | | writev_cleanup() hook BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* lib/async_req: simplify async_connect_* using a _cleanup() hookStefan Metzmacher2015-06-121-35/+33
| | | | | | | | | | This makes sure we remove the tevent_fd as soon as possible and always reset the old_sockflags. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* lib/async_req: s/result/req/ in async_connect_send()Stefan Metzmacher2015-06-121-9/+8
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* lib/async_req: remove unused sendto_{send,recv} and recvfrom_{send,recv}Stefan Metzmacher2015-06-122-190/+0
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:libsmb: convert nb_trans_send/recv internals to tdgramStefan Metzmacher2015-06-121-36/+66
| | | | | | | | | | This simplifies/fixes the cleanup, because we need to remove any tevent_fd object before closing the socket fd. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:libsmb: convert nb_packet_reader to tstream_* functionsStefan Metzmacher2015-06-121-38/+34
| | | | | | | | | | By using the tstream abstraction we don't need to take care error handling regarding dangling tevent_fd structures. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:libsmb: convert nb_packet_client to tstream_* functionsStefan Metzmacher2015-06-122-52/+68
| | | | | | | | | | By using the tstream abstraction we don't need to take care error handling regarding dangling tevent_fd structures. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:libsmb: let nb_packet_server_destructor() explicitly destroy the tevent_fdStefan Metzmacher2015-06-121-4/+9
| | | | | | | | | The need to destroy the tevent_fd before closing the socket fd. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:libsmb: remove pending requests as early as possible via a ↵Stefan Metzmacher2015-06-121-2/+31
| | | | | | | | | | | | smbsock_any_connect_cleanup() hook Once we got an error or a valid connection we should destroy all other connection attempts as early as possible. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:libsmb: remove subreqs as early as possible via a ↵Stefan Metzmacher2015-06-121-6/+26
| | | | | | | | | | | | smbsock_connect_cleanup() hook open_socket_out_send() or nb_connect_send() likely use socket fds and tevent_fd objects. We should clean them up as early as possible. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:libsmb: remove the cli_session_request as early as possible via a ↵Stefan Metzmacher2015-06-121-6/+30
| | | | | | | | | | | | nb_connect_cleanup() hook cli_session_request_send() is likely to use tevent_fd objects on the given socket fd, so we need to destroy the request before closing the socket fd. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:lib/addrchange: make use of tdgram_* in addrchange_*()Stefan Metzmacher2015-06-121-36/+55
| | | | | | | | | | | This makes the cleanup handling easier to get right, as we need to make sure any tevent_fd is removed before closing a socket fd. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:lib/addrchange: look at the correct nl_pid in addrchange_done()Stefan Metzmacher2015-06-121-4/+4
| | | | | | | | | | | state->fromaddr is the address we got from recvfrom_send/recv. state->addr is completely untouched after tevent_req_create(). BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:lib/background: make sure we destroy a pending read_packet_send() before ↵Stefan Metzmacher2015-06-121-0/+8
| | | | | | | | | closing the pipe fd BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:wscript: move lib/util_tsock.c from 'TLDAP' to 'samba3util'Stefan Metzmacher2015-06-121-3/+4
| | | | | | | | | | tstream_read_packet_send/recv() is a generic helper function... BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s4:libcli/raw: make sure smbcli_transport_connect_send/recv correctly ↵Stefan Metzmacher2015-06-121-17/+42
| | | | | | | | | | | | | | cleanup on error We need to make sure that we remove any pending writev_send or read_smb_send request before closing the socket fd. As a side effect we always close the socket fd if we don't return success for any any reason. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/tsocket: add tdgram_inet_udp_broadcast_socket()Stefan Metzmacher2015-06-122-0/+59
| | | | | | | | | | | This is similar to tdgram_inet_udp_socket(), but it allows the use of ipv4 broadcast traffic. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/tsocket: add tdgram_bsd_existing_socket() helper functionStefan Metzmacher2015-06-122-0/+66
| | | | | | | | | | | | This is similar to tstream_bsd_existing_socket(). Both help to migrate strange code path to using the tstream or tdgram abstractions. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tevent.h: propose tstream_ versions of read_packet_send/recv and ↵Stefan Metzmacher2015-06-121-2/+2
| | | | | | | | | | | | | | writev_send/recv The functions operating on the raw file descriptor are for advanced callers, which take extra care and avoid the problems of https://bugzilla.samba.org/show_bug.cgi?id=11141. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tevent/testsuite: make sure we cleanup tevent_fd structures in the correct orderStefan Metzmacher2015-06-121-2/+2
| | | | | | | | | | | | First we need to remove the tevent_fd structures without tevent_fd_set_auto_close(). Closing the fd needs to be the last thing... BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* ctdb-locking: move all auto_mark logic into process_callbacks()Stefan Metzmacher2015-06-121-10/+2
| | | | | | | | | | | | | The caller should not dereference lock_ctx after invoking process_callbacks(), it might be destroyed already. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11293 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Fri Jun 12 15:28:57 CEST 2015 on sn-devel-104
* ctdb-locking: make process_callbacks() more robustStefan Metzmacher2015-06-121-3/+8
| | | | | | | | | | We should not dereference lock_ctx after invoking the callback in the auto_mark == false case. The callback could have destroyed it. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11293 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-locking: Add a comment to explain auto_mark usageAmitay Isaacs2015-06-121-0/+4
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=11293 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* ctdb-locking: Avoid resetting talloc destructorAmitay Isaacs2015-06-121-2/+4
| | | | | | | | | | | | Let ctdb_lock_request_destructor() take care of the proper cleanup. If the request if freed from the callback function, then the lock context should not be freed. Setting request->lctx to NULL takes care of that in the destructor. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11293 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* ctdb-locking: Avoid memory leak in the failure caseAmitay Isaacs2015-06-121-0/+1
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=11293 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* ctdb-locking: Set destructor when lock_context is createdAmitay Isaacs2015-06-121-4/+1
| | | | | | | | | | | | | | There is already code in the destructor to correctly remove it from the pending or the active queue. This also ensures that when lock context is in pending queue and if the lock request gets freed, the lock context is correctly removed from the pending queue. Thanks to Stefan Metzmacher for noticing this and suggesting the fix. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11293 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* ctdb-locking: Set the lock_ctx->request to NULL when request is freedStefan Metzmacher2015-06-121-0/+6
| | | | | | | | | | | | | | | The code was added to ctdb_lock_context_destructor() to ensure that the if a lock_ctx gets freed first, the lock_request does not have a dangling pointer. However, the reverse is also true. When a lock_request is freed, then lock_ctx should not have a dangling pointer. In commit 374cbc7b0ff68e04ee4e395935509c7df817b3c0, the code for second condition was dropped causing a regression. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11293 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-locking: Avoid memory corruption in ctdb_lock_context_destructorStefan Metzmacher2015-06-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the lock request is freed from within the callback, then setting lock_ctx->request to NULL in ctdb_lock_context_destructor will end up corrupting memory. In this case, lock_ctx->request could be reallocated and pointing to something else. This may cause unexpected abort trying to dereference a NULL pointer. So, set lock_ctx->request to NULL before processing callbacks. This avoids the following valgrind problem. ==3636== Invalid write of size 8 ==3636== at 0x151F3D: ctdb_lock_context_destructor (ctdb_lock.c:276) ==3636== by 0x58B3618: _talloc_free_internal (talloc.c:993) ==3636== by 0x58AD692: _talloc_free_children_internal (talloc.c:1472) ==3636== by 0x58AD692: _talloc_free_internal (talloc.c:1019) ==3636== by 0x58AD692: _talloc_free (talloc.c:1594) ==3636== by 0x15292E: ctdb_lock_handler (ctdb_lock.c:471) ==3636== by 0x56A535A: epoll_event_loop (tevent_epoll.c:728) ==3636== by 0x56A535A: epoll_event_loop_once (tevent_epoll.c:926) ==3636== by 0x56A3826: std_event_loop_once (tevent_standard.c:114) ==3636== by 0x569FFFC: _tevent_loop_once (tevent.c:533) ==3636== by 0x56A019A: tevent_common_loop_wait (tevent.c:637) ==3636== by 0x56A37C6: std_event_loop_wait (tevent_standard.c:140) ==3636== by 0x11E03A: ctdb_start_daemon (ctdb_daemon.c:1320) ==3636== by 0x118557: main (ctdbd.c:321) ==3636== Address 0x9c5b660 is 96 bytes inside a block of size 120 free'd ==3636== at 0x4C29D17: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==3636== by 0x58B32D3: _talloc_free_internal (talloc.c:1063) ==3636== by 0x58B3232: _talloc_free_children_internal (talloc.c:1472) ==3636== by 0x58B3232: _talloc_free_internal (talloc.c:1019) ==3636== by 0x58B3232: _talloc_free_children_internal (talloc.c:1472) ==3636== by 0x58B3232: _talloc_free_internal (talloc.c:1019) ==3636== by 0x58AD692: _talloc_free_children_internal (talloc.c:1472) ==3636== by 0x58AD692: _talloc_free_internal (talloc.c:1019) ==3636== by 0x58AD692: _talloc_free (talloc.c:1594) ==3636== by 0x11EC30: daemon_incoming_packet (ctdb_daemon.c:844) ==3636== by 0x136F4A: lock_fetch_callback (ctdb_ltdb_server.c:268) ==3636== by 0x152489: process_callbacks (ctdb_lock.c:353) ==3636== by 0x152489: ctdb_lock_handler (ctdb_lock.c:468) ==3636== by 0x56A535A: epoll_event_loop (tevent_epoll.c:728) ==3636== by 0x56A535A: epoll_event_loop_once (tevent_epoll.c:926) ==3636== by 0x56A3826: std_event_loop_once (tevent_standard.c:114) ==3636== by 0x569FFFC: _tevent_loop_once (tevent.c:533) ==3636== by 0x56A019A: tevent_common_loop_wait (tevent.c:637) ==3636== by 0x56A37C6: std_event_loop_wait (tevent_standard.c:140) ==3636== by 0x11E03A: ctdb_start_daemon (ctdb_daemon.c:1320) ==3636== by 0x118557: main (ctdbd.c:321) BUG: https://bugzilla.samba.org/show_bug.cgi?id=11293 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* docs: Add missing SRVSVC entries in rpcclient manpageChristof Schmitt2015-06-121-4/+12
| | | | | | | | 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): Fri Jun 12 12:39:08 CEST 2015 on sn-devel-104
* rpcclient: Add netsharesetdfsflags commandChristof Schmitt2015-06-121-0/+56
| | | | | | | | This allows setting the DFS flags through a NetShareSetInfo with info level 1005. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* rpcclient: Add info level 1005 for netsharegetinfoChristof Schmitt2015-06-121-1/+13
| | | | | | | | | This allows querying the DFS flags and the csc policy. Also update the usage info that ths share name is not optional and print the supported info levels. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>