summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* s3: VFS: Add SMB_VFS_MKDIRAT().Jeremy Allison2019-09-118-0/+91
| | | | | | | | | | Currently identical to SMB_VFS_MKDIR(). Next, add to all VFS modules that implement mkdir and eventually remove mkdir. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: pysmbd: Ensure conn->cwd_fsp member of created connections is initialized.Jeremy Allison2019-09-111-0/+26
| | | | | | | | | | | | | | | | | This is needed to correctly call the XXXAT() vfs calls. We should probably just use create_conn_struct_tos_cwd() here and pass $cwd instead of using create_conn_struct_tos() and passing "/" as the share root. We wouldn't change the current working directory and the created share root would be set to $cwd but I'm not sure what effects this may have on users of pysmbd in case any of them pass paths above the $cwd to these functions. Less changes to just call vfs_ChDir(conn, &cwd) which doesn't change the current directory and leaves the share root as "/". Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: torture: vfstest: Change from create_conn_struct_tos() -> ↵Jeremy Allison2019-09-111-3/+10
| | | | | | | | | | | create_conn_struct_tos_cwd(). This does a vfs_ChDir() to the share root (not changing the directory) which correctly sets up the conn->cwd_fsp member so any XXXAT() calls correctly work inside vfstest. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: smbd: profile: Remove syscall_symlink entry now syscall is no longer used.Jeremy Allison2019-09-111-1/+0
| | | | | | | Missed as part of the previous replacement of symlink -> symlinkat. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3:smbd: skip write-time fetching for directories.Ralph Boehme2019-09-112-2/+4
| | | | | | | | | | The whole logic only applies to files. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Sep 11 00:33:26 UTC 2019 on sn-devel-184
* smbd: Do boolean short-circuitingVolker Lendecke2019-09-101-7/+5
| | | | | | | | | &= does bitwise AND, and does not do boolean short-circuiting if the variable is already 0. As has_other_nonposix_opens() might have its cost, this speeds up closing a handle. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Use dbwrap_do_locked() in fd_close_posix()Volker Lendecke2019-09-101-70/+21
| | | | | | | We don't need to make a copy of the fd array Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Use dbwrap_do_locked() in add_fd_to_close_entry()Volker Lendecke2019-09-101-28/+30
| | | | | | | | Less explicit talloc. Right now dbwrap_rbt behind the scenes does a dbwrap_fetch_locked(), but that will eventually change. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* dbwrap: Initialize state in dbwrap_delete()Volker Lendecke2019-09-101-1/+1
| | | | | | | | Probably not required, but looks safer and gives static checkers less reason to complain about potentially uninitialized variable reads Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Remove an obsolete commentVolker Lendecke2019-09-101-4/+0
| | | | | | | At least as of 2ac9d0afa66 ctdb does not care about db prios anymore Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Fix DBG typo in find_delete_on_close_token()Volker Lendecke2019-09-101-4/+3
| | | | | | | | The routine isn't called find__delete_on_close_token. Also avoid casts. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Use file_id_str_buf() in close_remove_share_mode()Volker Lendecke2019-09-101-2/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Use file_id_str_buf() in setup_poll_open()Volker Lendecke2019-09-101-2/+2
| | | | | | | While there, remove a pointless empty line Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Use file_id_str_buf() in defer_open()Volker Lendecke2019-09-101-1/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbstatus: Use file_id_str_buf() in print_brl()Volker Lendecke2019-09-101-1/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Use file_id_str_buf() in set_sticky_write_time()Volker Lendecke2019-09-101-2/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Use file_id_str_buf() in share_mode_str()Volker Lendecke2019-09-101-1/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Use file_id_str_buf() in brl_cleanup_disconnected()Volker Lendecke2019-09-101-23/+24
| | | | | | | Also avoid some casts and use DBG_ instead of DEBUG() Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Use file_id_str_buf() in brl_get_locks()Volker Lendecke2019-09-101-3/+4
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* vfs: Use file_id_str_buf() in xattr_tdb_setattr()Volker Lendecke2019-09-101-2/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* vfs: Use file_id_str_buf() in xattr_tdb_getattr()Volker Lendecke2019-09-101-2/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Use file_id_str_buf() in file_id_string()Volker Lendecke2019-09-101-4/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Add file_id_str_buf()Volker Lendecke2019-09-102-0/+18
| | | | | | | file_id_string() without talloc Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Properly #ifdef __LIB_FILE_ID_H__Volker Lendecke2019-09-101-0/+5
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* vfs: restore stat fields in vfs_stat_fsp()Ralph Boehme2019-09-103-1/+4
| | | | | | | | | | | | | | | | | | This ensures we preserve btime, itime and File-ID. As the Durable Handles code calls vfs_stat_fsp() in the DH disconnect function, previously the btime was lost and NOT stored in the cookie. With this change the cookie will store the correct btime (and iflags), which requires us to call dos_mode() in the reconnect function to ensure we pass vfs_default_durable_reconnect_check_stat(). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121 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): Tue Sep 10 20:22:21 UTC 2019 on sn-devel-184
* s3:vfs: streamline vfs_stat_fsp()Ralph Boehme2019-09-101-6/+4
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3: replace fsp_stat() with vfs_stat_fsp()Ralph Boehme2019-09-104-31/+23
| | | | | | | | | Both functions do the same, they differ just in the type of the returned result. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:lib: add update_stat_ex_from_saved_stat()Ralph Boehme2019-09-102-0/+22
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* vfs_catia: stat info may have been updated, make sure to return changesRalph Boehme2019-09-101-0/+4
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:smbd: ensure to update the File-ID in struct smb_filenameRalph Boehme2019-09-101-0/+17
| | | | | | | | | | | | | | Initialize the File-ID in fsp->fsp_name->st, any subsequent metadata fetch on this file-handle needs this, eg QFID SMB2 Create-Context or GETINFO SMB requests. It would be nice if SMB_VFS_SET_DOS_ATTRIBUTE() would do this, unfortunately it gets a const struct smb_filename. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:lib: round itime to NTTIME resolution in make_file_id_from_itime()Ralph Boehme2019-09-101-0/+2
| | | | | | | | | | | | | | | | | | The rounding is needed because when a file is created via eg an SMB2 CREATE request, we need to calculate the correct File-ID for the QFID Create-Context or for a subsequent GETINFO SMB request on the same file-handle. Any later metadata request that received the File-ID will do so by going through dos_mode() -> ... -> parse_dos_attribute_blob(), where the File-ID will be calculated from the on-disk itime which has NTTIME resolution. As long as that is the only available itime backend, I'm rounding itime inside make_file_id_from_itime(), not in the callers. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* lib: add round_timespec_to_nttime()Ralph Boehme2019-09-102-0/+10
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s4:torture: add a file-id related testRalph Boehme2019-09-105-0/+217
| | | | | | | | | | Note I'm using the share vfs_fruit_xattr because I need a share with both a streams and a acl_* VFS object. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s4:torture/smb2: try to fix a RESOURCE_LEAK in smb2.samba3misc.localposixlock1Stefan Metzmacher2019-09-101-3/+4
| | | | | | | | | | | CID 1453656: (RESOURCE_LEAK) Handle variable "fd" going out of scope leaks the handle. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Sep 10 18:56:45 UTC 2019 on sn-devel-184
* lib/torture: protect torture_assert[_goto]() with a do { } while(0) blockStefan Metzmacher2019-09-101-4/+6
| | | | | | | | | | This hopefully fixes a lot of coverity defects like: Control flow issues (DEADCODE) Execution cannot reach this statement: ";". Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s4:torture: always add ';' after torture_assert()Stefan Metzmacher2019-09-103-4/+4
| | | | | | | The next commit will require this. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Create SECURITY.mdAndrew Bartlett2019-09-091-0/+15
| | | | | | | | | | | | | This file location is shown under "Security -> Policy" on GitHub and helps ensure people with a need to report a security issue find us the right way. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Mon Sep 9 21:13:35 UTC 2019 on sn-devel-184
* s3:selftest: add delay_inject:brl_lock_windows testingStefan Metzmacher2019-09-092-0/+16
| | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Mon Sep 9 15:42:45 UTC 2019 on sn-devel-184
* vfs_delay_inject: add support for brl_[un]lock_windows()Stefan Metzmacher2019-09-091-0/+117
| | | | | | | | | | | This demonstrates the two ways to handle the retry: - smb layer retry => plock->context.smblctx = UINT64_MAX - vfs backend retry => plock->context.smblctx = 0 BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:locking: add brl_req_guid() and brl_req_mem_ctx() helper functionsStefan Metzmacher2019-09-0911-5/+106
| | | | | | | | | | This allows the vfs backend to detect a retry and keep state between the retries. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:smb2_lock: handle NT_STATUS_RETRY from the VFS backendStefan Metzmacher2019-09-091-0/+80
| | | | | | | | | | This allows the VFS backends to implement async byte range locking. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:blocking: handle NT_STATUS_RETRY from the VFS backendStefan Metzmacher2019-09-091-0/+84
| | | | | | | | | | This allows the VFS backends to implement async byte range locking. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:blocking: make use of smbd_smb1_do_locks_try() in smbd_smb1_do_locks_send()Stefan Metzmacher2019-09-091-86/+4
| | | | | | | | | | We only need the logic to call smbd_smb1_do_locks_check() and a possible retry once in smbd_smb1_do_locks_try(). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:blocking: call smbd_smb1_do_locks_setup_timeout() also in ↵Stefan Metzmacher2019-09-091-0/+5
| | | | | | | | | | | | | | smbd_smb1_do_locks_try() This is a noop if smbd_smb1_do_locks_setup_timeout() was called before. But it allows us to use smbd_smb1_do_locks_try() in smbd_smb1_do_locks_send() in a following commit. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:blocking: fix the fsp->blocked_smb1_lock_reqs handlingStefan Metzmacher2019-09-092-13/+125
| | | | | | | | | | | | | | A new request is first checks against all pending requests before checking the already granted locks. Before we retried the lock array of another request (the first in the list), but then finished current request, which is wrong. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:blocking: do the timeout calculation before calling ↵Stefan Metzmacher2019-09-091-16/+16
| | | | | | | | | | | dbwrap_watched_watch_send() This makes the next commits easier to understand. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:blocking: split out smbd_smb1_do_locks_setup_timeout()Stefan Metzmacher2019-09-091-35/+63
| | | | | | | | | | | | This function can be called multiple times, but only the first time will setup the endtime. And the endtime is relative to the request time and not the current time. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:blocking: use timeval_expired(&state->endtime) to stop processingStefan Metzmacher2019-09-091-8/+17
| | | | | | | | | | | This is less racy than timeval_elapsed() > 0 as the current time is already expired and timeout = 0 will always work correct. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s4:torture/raw: add multilock6 testStefan Metzmacher2019-09-093-0/+265
| | | | | | | | | | | This is similar to multilock3, but uses a read-only (LOCKING_ANDX_SHARED_LOCK) locks for the 2nd lock request. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s4:torture/raw: add multilock5 testStefan Metzmacher2019-09-092-0/+270
| | | | | | | | | | | This is similar to multilock3, but uses a read-only (LOCKING_ANDX_SHARED_LOCK) locks for the first lock request. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>