summaryrefslogtreecommitdiffstats
path: root/source3/smbd
Commit message (Collapse)AuthorAgeFilesLines
* s3:smbd: fix missing space in debug message in initial_break_processing()Michael Adam2013-02-281-1/+1
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3-smbd: Don't leak subcntarr array.Andreas Schneider2013-02-221-1/+1
| | | | Reviewed-by: Alexander Bokovoy <ab@samba.org>
* s3:smbd: s/event_add_fd/tevent_add_fd and s/EVENT_FD_/TEVENT_FD_Stefan Metzmacher2013-02-193-5/+5
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:smbd: s/struct fd_event/struct tevent_fdStefan Metzmacher2013-02-194-7/+7
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:smbd: s/EVENT_FD/TEVENT_FDStefan Metzmacher2013-02-191-4/+4
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:smbd: s/struct timed_event/struct tevent_timerStefan Metzmacher2013-02-198-14/+14
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:smbd: s/struct event_context/struct tevent_contextStefan Metzmacher2013-02-1911-17/+17
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:smbd: preserve file type mode bits in file_set_dosmode()Michael Adam2013-02-191-0/+3
| | | | | | | | | | | | | When translating between dos modes and unix modes, these bits were dropped from the stat->st_ex_mode field. Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Tue Feb 19 15:45:31 CET 2013 on sn-devel-104
* s3:smbXsrv_open: add smbXsrv_open_global_traverse()Gregor Beck2013-02-192-0/+77
| | | | | | Signed-off-by: Gregor Beck <gbeck@sernet.de> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:smbXsrv_tcon: pass record in smbXsrv_tcon_global_traverse()Gregor Beck2013-02-191-0/+1
| | | | | | Signed-off-by: Gregor Beck <gbeck@sernet.de> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:smbXsrv_session: pass record in smbXsrv_session_global_traverse()Gregor Beck2013-02-191-0/+1
| | | | | | Signed-off-by: Gregor Beck <gbeck@sernet.de> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:smbd:smb2: fix segfault (access after free) in durable disconnect codeMichael Adam2013-02-192-0/+2
| | | | | | | | | | Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Tue Feb 19 11:12:01 CET 2013 on sn-devel-104
* s3:smbd: add debugging to close code (regarding disconnect of a durable)Michael Adam2013-02-181-0/+14
| | | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Mon Feb 18 17:42:45 CET 2013 on sn-devel-104
* s3:smbd: use smbXsrv_open_close() instead of smbXsrv_open_update()Stefan Metzmacher2013-02-181-1/+11
| | | | | | | | This makes sure we store the correct disconnect_time for disconnected durable handles. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* Fix bug 9519 - Samba returns unexpected error on SMB posix open.Jeremy Allison2013-02-121-2/+9
| | | | | | | | | | | Explicitly ignore bare O_EXCL flags instead of returning INVALID_PARAMETER. That's what the Linux kernel does. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Jeff Layton <jlayton@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Feb 12 22:59:21 CET 2013 on sn-devel-104
* s3: Make SMB2_GETINFO multi-volume aware.Ira Cooper2013-02-083-9/+20
| | | | | | | | | | | | Not all shares are a single volume. Some actually expose multiple volumes under a single share. In these cases showing the amount of space free as the space free at the base of the directory heirarchy is wrong. Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Feb 8 21:44:37 CET 2013 on sn-devel-104
* smbd: Fix a typoVolker Lendecke2013-01-301-1/+1
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Christian Ambach <ambi@samba.org> Autobuild-User(master): Christian Ambach <ambi@samba.org> Autobuild-Date(master): Wed Jan 30 18:21:19 CET 2013 on sn-devel-104
* Fix bug #9571 - Unlink after open causes smbd to panic.Pavel Shilovsky2013-01-281-3/+3
| | | | | | | | | s3:smbd: fix wrong lock order in posix unlink Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* Fix bug #9588 - ACLs are not inherited to directories for DFS shares.Jeremy Allison2013-01-281-0/+13
| | | | | | | | | | | | | | | We can return with NT_STATUS_OK in an error code path. This has a really strange effect in that it prevents the ACL editor in Windows XP from recursively changing ACE entries on sub-directories after a change in a DFS-root share (we end up returning a path that looks like: \\IPV4\share1\xptest/testdir with a mixture of Windows and POSIX pathname separators). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Mon Jan 28 13:48:13 CET 2013 on sn-devel-104
* Fix bug #9587 - archive flag is always set on directories.Jeremy Allison2013-01-251-1/+2
| | | | | | | | | | | | Creating a directory to a Samba share sets the attributes to 'D' only (correct) - only when creating a new file should the 'A' attribute be set. However, doing a rename of that directory sets the 'A' attribute in error. This should only be done on a file rename. smbclient regression test to follow. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
* Fix bug #9572 - File corruption during SMB1 read by Mac OSX 10.8.2 clients.Jeremy Allison2013-01-241-2/+30
| | | | | | | | | | | | | | | | Accept a large read if we told the client we have UNIX extensions and the client sent a non-zero upper 16-bit size. Do the non-zero upper 16-bit size check first to save a function call in what is a hot path. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Jan 24 21:01:51 CET 2013 on sn-devel-104
* Revert "s3:smbd: SMB ReadX with size > 0xffff should only possible for samba ↵Jeremy Allison2013-01-241-10/+1
| | | | | | | | | | | | | clients." Part of fix for bug #9572 - File corruption during SMB1 read by Mac OSX 10.8.2 clients This reverts commit f8c26c16b82989e002b839fc9eba6386fc036f6a. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Fix a NULL vs false return errorVolker Lendecke2013-01-231-1/+1
| | | | Reviewed-by: Stefan Metzmacher <metze@samba.org>
* Fix warnings with mismatched sizes in arguments to DEBUG statements.Jeremy Allison2013-01-191-8/+8
| | | | | | | | | | This can cause compile errors on 32-bit systems. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Sat Jan 19 12:14:13 CET 2013 on sn-devel-104
* Remove locking across the lifetime of the copychunk call.Jeremy Allison2013-01-181-116/+1
| | | | | | | | | | Previous commit handles this around each read/write call. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Fri Jan 18 01:47:01 CET 2013 on sn-devel-104
* Add additional copychunk checks.Jeremy Allison2013-01-181-0/+22
| | | | | | | For printer, ipc$ connections, and directory handles. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
* Move handle checking code to copychunk_check_handles().Jeremy Allison2013-01-181-21/+37
| | | | | | | | Planning to add extra checks to ensure we don't attempt copychunk on printer or IPC$ handles. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
* smb2_ioctl: copychunk request max output validationDavid Disseldorp2013-01-171-0/+12
| | | | | | | | | | Check that the copychunk ioctl request maximum output specified by the client is large enough to hold copychunk response data. Reviewed by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Jan 17 00:59:44 CET 2013 on sn-devel-104
* smb2_ioctl: track copychunk response output stateDavid Disseldorp2013-01-161-16/+38
| | | | | | Treat the response data independent to the status. Reviewed by: Jeremy Allison <jra@samba.org>
* smb2_ioctl: copychunk CHECK_READ and CHECK_WRITEDavid Disseldorp2013-01-161-0/+25
| | | | | | | | | | | [MS-SMB2] 3.3.5.15.6 Handling a Server-Side Data Copy Request, specifies that the copychunk destination file handle be granted FILE_WRITE_DATA and FILE_READ_DATA access. FILE_READ_DATA access must also be granted on the copychunk source file, which may be done implicitly with execute permission. Reviewed by: Jeremy Allison <jra@samba.org>
* smb2_ioctl: only pass through to VFS on a valid fspDavid Disseldorp2013-01-161-13/+17
| | | | | | A null fsp is dereferenced on VFS call. Reviewed by: Jeremy Allison <jra@samba.org>
* smb2_ioctl: perform locking around copychunk requestsDavid Disseldorp2013-01-161-17/+137
| | | | | | | | | | For each chunk in a copychunk request, take a read and write lock on the source and destination files respectively. Also change the resume key format to use a combination of the persistent and volatile handles. Thanks to Metze for his help on this. Reviewed by: Jeremy Allison <jra@samba.org>
* smbd: split out file_fsp_get from file_fsp_smb2David Disseldorp2013-01-162-10/+27
| | | | | | | Obtain the files_struct from smb2req, persistent_id and volatile_id. Reviewed by: Jeremy Allison <jra@samba.org>
* smb2_ioctl: remove ioctl error response assumptionsDavid Disseldorp2013-01-161-17/+57
| | | | | | | | | | | | MS-SMB2 3.3.4.4 documents cases where a ntstatus indicating an error should not be considered a failure. In such a case the output data buffer should be sent to the client rather than an error response packet. Add a new fsctl copy_chunk test to confirm field limits are sent back in response to an oversize chunk request. Reviewed by: Jeremy Allison <jra@samba.org>
* smb2_ioctl: add support for FSCTL_SRV_COPYCHUNKDavid Disseldorp2013-01-161-4/+231
| | | | | | | | | | | | | SMB2 clients can issue FSCTL_SRV_COPYCHUNK requests in order to copy data between files on the server side only, rather than reading data then writing back from the client. FSCTL_SRV_COPYCHUNK is used by default for Explorer SMB2 file copies on Windows Server 2012. 2.2.32.1 SRV_COPYCHUNK_RESPONSE in [MS-SMB2] describes the requirement for the server to provide maximum copychunk request size limits in ioctl responses carrying STATUS_INVALID_PARAMETER. Reviewed by: Jeremy Allison <jra@samba.org>
* s3-vfs: add copy_chunk vfs hooksDavid Disseldorp2013-01-161-2/+24
| | | | | | | | | | | | | | | | | | copy_chunk copies n bytes from a source file at a specific offset to a destination file at a given offset. This interface will be used in handling smb2 FSCTL_SRV_COPYCHUNK ioctl requests. Use a pread/pwrite loop in vfs_default, so that requests referring to the same src and dest file are possible. Provide send and receive hooks for copy chunk VFS interface, allowing asynchronous behaviour. Check whether the request source offset + length exceeds the current size. Return STATUS_INVALID_VIEW_SIZE under such a condition, matching Windows server behaviour. Reviewed by: Jeremy Allison <jra@samba.org>
* smb2_ioctl: add FSCTL_SRV_REQUEST_RESUME_KEY supportDavid Disseldorp2013-01-161-2/+47
| | | | | | | | | Use existing ioctl IDL infrastructure for marshalling. Support for this ioctl is a prerequisite for FSCTL_SRV_COPYCHUNK handling. The client-opaque resume key is constructed using the server side dev/inode file identifier. Reviewed by: Jeremy Allison <jra@samba.org>
* smb2_ioctl: split ioctl handler code on device typeDavid Disseldorp2013-01-166-355/+676
| | | | | | | Add per device type ioctl handler source files for FSCTL_DFS, FSCTL_FILESYSTEM, FSCTL_NAMED_PIPE and FSCTL_NETWORK_FILESYSTEM. Reviewed by: Jeremy Allison <jra@samba.org>
* smb2_ioctl: split ioctl handlers into separate funtionsDavid Disseldorp2013-01-161-154/+173
| | | | Reviewed by: Jeremy Allison <jra@samba.org>
* Use the new directory_create_or_exist_strict() function.Andreas Schneider2013-01-091-1/+1
| | | | Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:smb2_negprot: set the 'remote_proto' valueStefan Metzmacher2013-01-091-0/+8
| | | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* Fixup the change_to_user_by_session() case as called from ↵Jeremy Allison2013-01-091-0/+22
| | | | | | | | | | | | | become_user_by_session() Use inside source3/printing/nt_printing.c:get_correct_cversion(). Allow check_user_ok() to be called with vuid==UID_FIELD_INVALID. All this should do is throw away one entry in the vuid cache. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* smbd: Remove some ()Volker Lendecke2013-01-091-3/+3
| | | | | | Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* smbd: Simplify an if-expressionVolker Lendecke2013-01-091-10/+7
| | | | | | Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* smbd: Fix a typoVolker Lendecke2013-01-091-1/+1
| | | | | | Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* Move create_share_access_mask() from smbd/service.c to smbd/uid.c.Jeremy Allison2013-01-093-41/+38
| | | | | | | | Make it static. Only called from uid.c now. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* Fix bug #9518 - conn->share_access appears not be be reset between users.Jeremy Allison2013-01-091-20/+8
| | | | | | | | | Ensure make_connection_snum() uses the same logic as check_user_ok() to decide if a user can access a share. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* Factor code out of check_user_ok() into a call to check_user_share_access().Jeremy Allison2013-01-091-34/+7
| | | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* Initialize stack variables. Prelude to factoring out calls to ↵Jeremy Allison2013-01-091-2/+2
| | | | | | | | check_user_share_access(). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* Add check_user_share_access() which factors out the share security and ↵Jeremy Allison2013-01-092-0/+60
| | | | | | | | | | | read_only flag setting code. Allows this to be called from both make_connection_snum() as well as check_user_ok(). Gives a consistent share security check function. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>