1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00
Commit Graph

9554 Commits

Author SHA1 Message Date
Douglas Bagnall
f3b65ff4e5 s3/smbd/py: avoid null deref with bad python arguments
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-07-22 22:20:26 +00:00
Samuel Cabrero
ee6fb27c59 s3:rpc_server: Call epmapper RPC shutdown function from server exit routines
Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-07-22 16:49:16 +00:00
Samuel Cabrero
63a39ef605 s3:rpc_server: Call fsrvp RPC shutdown function from server exit routines
Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-07-22 16:49:16 +00:00
Samuel Cabrero
d1d37a0a6e s3:rpc_server: Return NTSTATUS in rpc_ep_setup and setup functions
Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-07-22 16:49:14 +00:00
Jeremy Allison
09ddad6c14 s3: smbd: Remove ifdef'ed out dptr_close_oldest().
No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jul 10 00:28:51 UTC 2019 on sn-devel-184
2019-07-10 00:28:51 +00:00
Jeremy Allison
6134922f7b s3: smbd: Remove the 'close oldest' logic in SMB1 trans2 search processing.
Will be removed in next commit.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-07-09 23:12:17 +00:00
Jeremy Allison
1376dc3b84 s3: smbd: Remove the 'close oldest' logic in SMB1search processing.
Expect the client to manage their handles properly.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-07-09 23:12:17 +00:00
Jeremy Allison
ff8c8b34b9 s3: smbd: Remove now unused parameter 'forclose' to dptr_get().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-07-09 23:12:17 +00:00
Jeremy Allison
e21b75168d s3: smbd: globals - remove dirhandles_open from internal search struct.
It wasn't used for SMB2 anyway, and isn't useful for anything.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-07-09 23:12:17 +00:00
Jeremy Allison
d9d00ad068 s3: smbd: We no longer need to keep a count of dirhandles open.
It's not per-connection struct anyway, so doesn't
help for anything.

Remove now unused variable struct smbd_server_connection *sconn
otherwise we get compile errors.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-07-09 23:12:16 +00:00
Jeremy Allison
288d71678b s3: smbd: Remove unused dptr_idleoldest() and dptr_idle() functions.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-07-09 23:12:16 +00:00
Jeremy Allison
7b6129d14e s3: smbd: Remove SMB1 idle unused directory handles code.
This is only needed for broken SMB1 DOS clients, and
we're a long way from needing this anymore.

ifdef out dptr_idleoldest() and dptr_idle()
functions as otherwise we get "unused function"
compile errors. Remove in next commit.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-07-09 23:12:16 +00:00
Jeremy Allison
7b98319f30 s3: smbd: Remove MAX_OPEN_DIRECTORIES check in dptr_create().
This is a bug in that it's artificially limiting the number
of open directories an SMB2 client can have. If this code
was needed it should by SMB1 specific.

However we should allow the clients to decide for themselves
how many directory handles they need, not limit to MAX_OPEN_DIRECTORIES.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-07-09 23:12:16 +00:00
Jeremy Allison
a43e677134 s3: smbd: Remove now unused dptr_idlecnum().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-07-09 23:12:16 +00:00
Jeremy Allison
609c9a58ce s3: smbd: Don't idle SMB1 directory scans after DPTR_IDLE_TIMEOUT.
Only broken SMB1 clients leave directory scans hanging
and we shouldn't support that.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-07-09 23:12:16 +00:00
Jeremy Allison
461001cbc1 s3: smbd: Don't idle connections with active SMB1 directory scans.
When all scans are via file handles this code can
be removed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-07-09 23:12:16 +00:00
Jeremy Allison
abc58a4a12 s3: smbd: Add dptr_activecnum(), not yet used.
Will be used to help remove the SMB1 idle directory
code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-07-09 23:12:16 +00:00
Volker Lendecke
32766db210 smbd: Move fcb_or_dos_open() out of open_file_ntcreate()
This is SMB1-only and pre-ntcreate with only 3 callers that look at
NTCREATEX_OPTIONS_PRIVATE_DENY_[DOS|FCB]. It is a bit less efficient
if it kicks in (we have to recreate the fsp), but SMB1 is less and
less popular, and this particular share mode combination from the
open&x family of calls might not be worth optimizing for.

This adds smb1_utils.[ch] as a kitchen sink for functions that can go
away once we drop SMB1.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-07-08 16:22:37 +00:00
Volker Lendecke
b16f7113eb smbd: Slightly simplify open_mode_check()
If there are no share modes, we'll just not enter the loop.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-07-08 16:22:37 +00:00
Volker Lendecke
aab429c1d9 smbd: Slightly simplify fsp_lease_update()
We have already dereferenced fsp->lease

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-07-08 16:22:37 +00:00
Volker Lendecke
cb2e6226fe smbd: Simplify smbd_smb2_setinfo_send()
Avoid an "else" branch

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-07-08 16:22:37 +00:00
Volker Lendecke
81011f5ea1 smbd: Make get_relative_fid_filename() static to open.c
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-07-08 16:22:37 +00:00
Jeremy Allison
4a9d46dafb s3: smbd: SMB1 add range checks to reply_fclose().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Jul  4 15:40:31 UTC 2019 on sn-devel-184
2019-07-04 15:40:31 +00:00
Jeremy Allison
522fe23612 s3: smbd: SMB1 add range checks to reply_search().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-07-04 14:03:29 +00:00
Volker Lendecke
8bae5d82e2 smbd: Don't store num_read_oplocks in brlock.tdb
This removes a kludgy implementation that worked around a locking
hierarchy problem: Setting a byte range lock had to contend the level2
oplocks, which are stored in locking.tdb/leases.tdb. We could not
access locking.tdb in the brlock.tdb code, as brlock.tdb might have
been locked first without locking.tdb, violating the locking hierarchy
locking.tdb->brlock.tdb. Now that that problem is gone (see the commit
wrapping do_lock() in share_mode_do_locked()), we can remove this
kludge.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-07-04 14:03:29 +00:00
Volker Lendecke
2d7efba0d9 smbd: Use share_mode's flags in contend_level2_oplocks
Here we traverse the oplocks and leases when breaking read leases. We
find out here whether any of those are still left.

As it's the receivers of the messages that downgrade the database
entries, we might do that more than once. Possible future
optimization?

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-07-04 14:03:29 +00:00
Volker Lendecke
ffd098d8bb smbd: Set SHARE_MODE_HAS_READ_LEASE when granting a read lease
Lazy update of the flag: Whenever we add a read lease, we have to set
the flag. Nobody except contend_level2_oplocks_begin will remove that
flag again, as this would mean a full lease traverse when removing
one. And contend_level2_oplocks_begin traverses the leases anyway

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-07-04 14:03:29 +00:00
Volker Lendecke
9b017ab046 smbd: Simplify filename_convert_internal()
Use a direct struct assignment

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 Jul  2 18:17:39 UTC 2019 on sn-devel-184
2019-07-02 18:17:39 +00:00
Volker Lendecke
ce3666fb83 smbd: Remove unused "msg_ctx" from smbd_smb1_do_locks_send()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-02 17:01:28 +00:00
Volker Lendecke
f952967e58 smbd: Remove unused "msg_ctx" from smbd_do_locks_try()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-02 17:01:28 +00:00
Volker Lendecke
45d2720a87 smbd: Remove unused "msg_ctx" from locking_close_file()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-02 17:01:28 +00:00
Volker Lendecke
0658626776 smbd: Remove unused "msg_ctx" from do_unlock()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-02 17:01:28 +00:00
Volker Lendecke
4d75c0aa53 smbd: Remove unused "msg_ctx" from do_lock()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-02 17:01:27 +00:00
Volker Lendecke
5a012a0fdf smbd: do_lock() never sees blocking locks anymore
This is now all handled in protocol-specific layers

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-02 17:01:27 +00:00
Volker Lendecke
b70d855e1a smbd: Make do_lock() return NTSTATUS
This routine did a NO-GO: It returned something on talloc_tos(), for
later consumption by push_blocking_lock_request. This is now gone, no
caller uses the "struct byte_range_lock" returned anymore.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-02 17:01:27 +00:00
Ralph Boehme
076f26dd5c vfs_fruit: move zero file-id to vfs_fruit
Now that this stuff goes through the VFS, let's do it right. :)

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:24 +00:00
Ralph Boehme
36d100e4b8 s3:smbd: set file_id in fetch_dos_mode_done()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:24 +00:00
Ralph Boehme
df5752ec90 s3:vfs: move get_fs_file_id to vfs_default
This makes get_fs_file_id() the default implementation of
SMB_VFS_FS_FILE_ID(). No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:24 +00:00
Ralph Boehme
71996fef09 s3:vfs: add SMB_VFS_FS_FILE_ID()
Not yet used, that comes next.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:24 +00:00
Ralph Boehme
d2bac65e2e s3:smbd: rename get_FileIndex() to get_fs_file_id()
Also rename all variable used to store the result of the renamed
get_fs_file_id() in the callers.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:24 +00:00
Ralph Boehme
e6cdd4862f s3:smbd: return inode number, not FileIndex for UNIX query info level
get_FileIndex() returns a stable and unique numerical identifier when "store dos
attributes" is enabled. It is NOT the same as a file's inode number which used
as the key for locking.tdb.

For POSIX clients we should return the inode numbers in the POSIX query info
level and the FileIndex in the corresponding SMB protocol fields (eg SMB2 QFID
create context).

This fix lets test "smbtorture_s3.plain.CLEANUP3" test work with get_FileIndex()
returning something different then the file's inode number.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:24 +00:00
Ralph Boehme
ebe7b8c58c s3:smbd: use xattr_DosInfo4 in set_ea_dos_attribute()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:24 +00:00
Ralph Boehme
d54424a758 s3:smbd: parse xattr_DosInfo4 in parse_dos_attribute_blob()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:24 +00:00
Ralph Boehme
c03094cc1f s3:smbd: mark itime non-calculated if we created a file or dir
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:24 +00:00
Ralph Boehme
d18bdc1c43 s3: convert struct stat_ex st_ex_calculated_birthtime bool to flags
Subsequent commits will add more flags, this paves the way.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:23 +00:00
Ralph Boehme
a5f4e33f87 s3: remove unused st_ex_mask from struct stat_ex
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:23 +00:00
Jeremy Allison
cd66614a4e s3: smbd: Make open_directory() always open a fd.
As we never use kernel oplocks on directory handles,
there is no reason not to always open file descriptors (no
more "stat" opens on directories).

Preparing to have SMB1search use real directory
opens.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-06-30 11:32:17 +00:00
Shyamsunder Rathi
6e5bff80a0 s3:notifyd: Handle sigup in notifyd to reparse smb.conf
At present, SIGHUP is blocked on notifyd. So, if parent smbd
is started with "log level" 10 in smb.conf, and later changed
to 0, the SIGHUP will not change the log level to 0 in notify
smbd process and it will keep printing verbose logs in the
corresponding log files.

Proposed fix is to write a SIGHUP handler for notifyd and set
it to reload services.

Reviewed-by: Hemanth Thummala <hemanth.thummala@nutanix.com>
Signed-off-by: Shyamsunder Rathi <shyam.rathi@nutanix.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by:Volker Lendecke <vl@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jun 27 17:57:12 UTC 2019 on sn-devel-184
2019-06-27 17:57:12 +00:00
Andrew Bartlett
8f4c30f785 lib/crypto: move gnutls error wrapper to own subsystem
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-06-27 12:54:22 +00:00
Jeremy Allison
61777349f1 s3: smbd: We also need to open a real directory fd when modifying security.
Makes the logic identical to file open.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-26 18:14:23 +00:00