summaryrefslogtreecommitdiff
path: root/source3/smbd
Commit message (Collapse)AuthorAgeFilesLines
* lib: Remove unused serverid.tdbVolker Lendecke2017-12-056-67/+0
| | | | | | | | 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 Dec 5 04:58:26 CET 2017 on sn-devel-144
* lib: Use messaging_send_all instead of message_send_allVolker Lendecke2017-12-052-5/+5
| | | | | | | Just a global search&replace Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* messaging: Remove the "n_sent" arg from message_send_allVolker Lendecke2017-12-052-3/+2
| | | | | | | | The only user of this is an informative message in smbcontrol. I don't think that's worth the effort. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* dbwrap_watch: Remove the "prec" parameter from watch_recvVolker Lendecke2017-11-293-5/+3
| | | | | | | | | | | The initial idea was to have some "atomicity" in this API. Every caller interested in a record would have to do something with it once it changes. However, only one caller really used this feature, and that is easily changed to not use it. So remove the complexity. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* smbd: Avoid using dbwrap_watched_watch_recv's prec argumentVolker Lendecke2017-11-291-2/+10
| | | | | | | | | This is the only user of the "prec" argument of dbwrap_watched_watch_recv. The next patch will remove this functionality, as it's easily replaced here. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s4:samba: Allow samba daemon to run in foregroundAndreas Schneider2017-11-281-1/+1
| | | | | | | | | | | | | | We are passing the no_process_group to become_daemon() that setsid() is not called. In case we are double forking, we run in SysV daemon mode, setsid() should be called! See: https://www.freedesktop.org/software/systemd/man/daemon.html BUG: https://bugzilla.samba.org/show_bug.cgi?id=13129 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3: smbd: Chain code can return uninitialized memory when talloc buffer is ↵Jeremy Allison2017-11-211-0/+14
| | | | | | | | | | | | | | | grown. Ensure we zero out unused grown area. CVE-2017-15275 BUG: https://bugzilla.samba.org/show_bug.cgi?id=13077 Signed-off-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Karolin Seeger <kseeger@samba.org> Autobuild-Date(master): Tue Nov 21 19:42:22 CET 2017 on sn-devel-144
* s3: smbd: Fix SMB1 use-after-free crash bug. CVE-2017-14746Jeremy Allison2017-11-212-3/+9
| | | | | | | | | | | When setting up the chain, always use 'next->' variables not the 'req->' one. Bug discovered by 连一汉 <lianyihan@360.cn> BUG: https://bugzilla.samba.org/show_bug.cgi?id=13041 Signed-off-by: Jeremy Allison <jra@samba.org>
* smbd: Avoid an "else"Volker Lendecke2017-11-131-1/+2
| | | | | | | We always return in the if-branch before. The else is redundant Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3: smbd: kernel oplocks. Replace retry_open() with ↵Jeremy Allison2017-11-111-28/+68
| | | | | | | | | | | | | | | | | | | setup_kernel_oplock_poll_open(). If a O_NONBLOCK open fails with EWOULDBLOCK, this code changes smbd to do a retry open every second, until either the timeout or we get a successful open. If we're opening a file that has a kernel lease set by a non-smbd process, this is the best we can do. Prior to this, smbd would block on the second open on such a leased file (not using O_NONBLOCK) which freezes active clients. Regression test to follow. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13121 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* vfs: remove SMB_VFS_INIT_SEARCH_OPUri Simchoni2017-11-111-7/+0
| | | | | | | This VFS is no longer being called, hence removed. Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: remove dptr_init_search_op()Uri Simchoni2017-11-112-9/+0
| | | | | | | This function is now not being used. Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: remove calls to dptr_init_search_op() from TRANS2 search codeUri Simchoni2017-11-111-6/+0
| | | | | | | | | | dptr_init_search_op() invokes VFS operations which are no-op in all in-tree VFS modules. Furthermore, it's not being called by the SMB2 search code, so probably it's not being used by any out-of-tree VFS module either. Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: remove calls to dptr_init_search_op()Uri Simchoni2017-11-111-3/+0
| | | | | | | | | | dptr_init_search_op() invokes a VFS operation which is a no-op in all in-tree VFS modules. Furthermore, dptr_init_search_op() is not being called from SMB2 search code, which hints that no out-of-tree VFS module needs it. Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Revert "s3/smbd: fix deferred open with streams and kernel oplocks"Jeremy Allison2017-11-101-104/+11
| | | | | | | | | | | | | | | | | | | | | | This reverts commit b35a296a27a0807c780f2a9e7af2f2e93feefaa8. This was the cause of BUG: https://bugzilla.samba.org/show_bug.cgi?id=13058 1. client of smbd-1 opens the file and sets the oplock. 2. client of smbd-2 tries to open the file. open() fails(EAGAIN) and open is deferred. 3. client of smbd-1 sends oplock break request to the client. 4. client of smbd-1 closes the file. 5. client of smbd-1 opens the file and sets the oplock. 6. client of smbd-2 calls defer_open_done(), sees that the file lease was not changed and does not reschedule open. and is no longer needed now vfs_streams_xattr.c no longer opens the base file internally. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
* s3/posix_acls: add default ACL style "everyone"Ralph Boehme2017-11-082-2/+58
| | | | | | | | This synthesizes an ACL with a single ACE with full permissions for everyone. Not used for now, this comes later. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3/smbd: make make_default_filesystem_acl publicRalph Boehme2017-11-082-0/+227
| | | | | | | This will be used by another VFS module in a subsequent commit. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3: smbd: Fix delete-on-close after smb2_findRalph Wuerthner2017-11-051-2/+2
| | | | | | | | | | | | | | | | Both dptr_create() and can_delete_directory_fsp() are calling OpenDir_fsp() to get a directory handle. This causes an issue when delete-on-close is set after smb2_find because both directory handle instances share the same underlying file descriptor. In addition the SMB_ASSERT() in destructor smb_Dir_destructor() gets triggered. To avoid this use OpenDir() instead of OpenDir_fsp(). BUG: https://bugzilla.samba.org/show_bug.cgi?id=13118 Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* smbd: Remove an indentation level in smb2_negprotVolker Lendecke2017-10-271-73/+74
| | | | | | | Do an early return. Best viewed with "git show -b" Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3/smbd: update some more DEBUG macros in smbd_smb2_create_sendRalph Boehme2017-10-211-17/+12
| | | | | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Sat Oct 21 18:08:46 CEST 2017 on sn-devel-144
* s3/smbd: use early returns in smbd_smb2_create_sendRalph Boehme2017-10-211-87/+103
| | | | | | | | | | | | | Now that we have the nice smbd_smb2_create_after_exec() and smbd_smb2_create_finish() functions, use early returns for the create replay and durable handle reconnect case. No change in behaviour, best viewed with $ git show -w COMMIT Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: factor out smbd_smb2_create_after_exec from smbd_smb2_create_sendRalph Boehme2017-10-211-167/+190
| | | | | | | No change in behaviour. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: factor out smbd_smb2_create_before_exec from smbd_smb2_create_sendRalph Boehme2017-10-211-297/+313
| | | | | | | | | No change in behaviour, best viewed with: $ git show --diff-algorithm=histogram COMMIT Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: remove all stack variables of smbd_smb2_create_send into ↵Ralph Boehme2017-10-211-120/+131
| | | | | | | | | | | | | | smbd_smb2_create_state This allows factoring out smbd_smb2_create_after|before_exec() in the next steps. Moving all variable in one big fell swoop instead of one per commit, because if I'd miss to adjust a variable access the commit wouldn't compile. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: move create ctx extraction and validation to a helper funcRalph Boehme2017-10-211-109/+118
| | | | | | | No change in behaviour. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: move create contexts into smbd_smb2_create_stateRalph Boehme2017-10-211-86/+89
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: remove unneeded args from smbd_smb2_create_finishRalph Boehme2017-10-211-46/+14
| | | | | | | The previous commits moved all arguments into smbd_smb2_create_state. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: move info into smbd_smb2_create_stateRalph Boehme2017-10-211-9/+9
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: add in_create_disposition to smbd_smb2_create_stateRalph Boehme2017-10-211-5/+8
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: add in_oplock_level to smbd_smb2_create_stateRalph Boehme2017-10-211-6/+8
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: move requested_oplock_level into smbd_smb2_create_stateRalph Boehme2017-10-211-11/+12
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: move replay_operation into smbd_smb2_create_stateRalph Boehme2017-10-211-12/+12
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: move result into smbd_smb2_create_stateRalph Boehme2017-10-211-26/+27
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: leverage early return added in the previous commitRalph Boehme2017-10-211-567/+565
| | | | | | | | | | | | Now that the other cases handled in the if/else blocks do early returns, we can move the logic handling file opens out of the final else block. No change in behaviour, best viewed with $ git show -w COMMIT Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: factor out smbd_smb2_create_finish from smbd_smb2_create_sendRalph Boehme2017-10-211-1/+56
| | | | | | | No change in behaviour. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: modernize a DEBUG statementRalph Boehme2017-10-211-2/+1
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: move some setup code in smbd_smb2_create_send a few lines upRalph Boehme2017-10-211-12/+12
| | | | | | | | This is just one of the last steps before splitting out large code parts into _before() and _after() functions. No change in behaviour. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: add tevent context to smbd_smb2_create_stateRalph Boehme2017-10-211-52/+54
| | | | | | | ...and use it in everywhere in smbd_smb2_create_send(). Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: use struct initializer for smbd_smb2_create_stateRalph Boehme2017-10-211-1/+3
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3/smbd: use correct access in get_file_handle_for_metadataRalph Boehme2017-10-171-1/+1
| | | | | | | | | | | | All we want here is FILE_WRITE_ATTRIBUTES, not FILE_WRITE_DATA. Bug: https://bugzilla.samba.org/show_bug.cgi?id=12995 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Tue Oct 17 11:48:09 CEST 2017 on sn-devel-144
* s3/smbd: fix access checks in set_ea_dos_attribute()Ralph Boehme2017-10-171-2/+14
| | | | | | | | | | | | | | | | | | We wanted to set the DOS attributes and failed with permission denied from the VFS/kernel/filesystem. Next thing we wanna do here is override this if either - "dos filemode = true" is set and the security descriptor gives the user write access or if - the stored security descriptor has FILE_WRITE_ATTRIBUTES The former was working, but the latter was not implemented at all. Bug: https://bugzilla.samba.org/show_bug.cgi?id=12995 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3/smbd: README.Coding fixes in set_ea_dos_attributeRalph Boehme2017-10-171-8/+11
| | | | | | | | | While I'm at it, some README.Coding fixes in set_ea_dos_attribute. Bug: https://bugzilla.samba.org/show_bug.cgi?id=12995 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3/smbd/posix_acls: return correct status in try_chownRalph Boehme2017-10-091-1/+1
| | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=7933 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3: smbd: Currently if getwd() fails after a chdir(), we panic.Jeremy Allison2017-10-091-11/+70
| | | | | | | | | | | | | | Change this to return to the previous $cwd, and return -1 for the chdir(). If the return to the previous $cwd fails, still panic as we can't return an unknown state. Also do early return from failing SMB_VFS_CHDIR, reducing indentation level BUG: https://bugzilla.samba.org/show_bug.cgi?id=13027 Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Ralph Böhme <slow@samba.org>
* s3/smbd: register Time Machine shares with AvahiOmri Mor2017-10-041-1/+96
| | | | | | | | | Adds support for automatically registering the required _adisk._tcp mDNS record based on the setting of "fruit:time machine". Signed-off-by: Omri Mor <omri50@gmail.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* notifyd: Broadcast to all connected nodesAmitay Isaacs2017-09-291-2/+2
| | | | | | | | | | | CTDB_BROADCAST_VNNMAP includes only the nodes with lmaster roles. CTDB_BROADCAST_CONNECTED includes all the running nodes. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Fri Sep 29 08:38:10 CEST 2017 on sn-devel-144
* smbd/aio: Do not go async for SMB2 compound requestsChristof Schmitt2017-09-221-0/+8
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13047 Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Move check for SMB2 compound request to new functionChristof Schmitt2017-09-223-1/+7
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13047 Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* CVE-2017-12163: s3:smbd: Prevent client short SMB1 write from writing server ↵Jeremy Allison2017-09-201-0/+50
| | | | | | | | | | | | memory to file. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13020 Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Karolin Seeger <kseeger@samba.org> Autobuild-Date(master): Wed Sep 20 17:06:23 CEST 2017 on sn-devel-144
* notifyd: Clarify a commentVolker Lendecke2017-09-161-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>