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

130459 Commits

Author SHA1 Message Date
Jule Anger
f604e4d4cd smbstatus: add frame files for json specific methods
Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2022-08-08 12:56:28 +00:00
Jule Anger
b35f13a3d0 smbstatus: use new enum crypto_degree
Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2022-08-08 12:56:28 +00:00
Jule Anger
92be53754b smbstatus: add enum to handle partial encryption and signing
Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2022-08-08 12:56:28 +00:00
Jule Anger
cb8a0d9aec smbstatus: move the output of the content to their own methods
Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2022-08-08 12:56:28 +00:00
Jule Anger
e514bdbc1c smbstatus: move the output of the title lines to their own methods
Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2022-08-08 12:56:28 +00:00
Jule Anger
d9c1ff4c2f smbstatus: pass the traverse_state to the traverse methods
The state cannot be used as a context, so a NULL context tmp_ctx must be created.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2022-08-08 12:56:28 +00:00
Jule Anger
caae58fad8 smbstatus: add struct traverse_state
Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2022-08-08 12:56:28 +00:00
Jule Anger
04f1d339c6 smbstatus: use variables in print_share_mode instead of printing directly
Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2022-08-08 12:56:28 +00:00
Jule Anger
4f21c6fdf9 smbstatus: print errors to stderr instead of stdout
Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2022-08-08 12:56:28 +00:00
Jule Anger
4ef2d36615 audit_logging: add method to replace the object for a given key with a new object
Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2022-08-08 12:56:28 +00:00
Jule Anger
6412c39bbf smbstatus: delete wrong EXCLUSIVE+BATCH oplock
It is not possible to have an EXCLUSIVE+BATCH oplock, because a BATCH
oplock includes an EXCLUSIVE oplock. Therefore, an EXCLUSIVE+BATCH-Oplock
and a BATCH-Oplock are the same thing.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2022-08-08 12:56:28 +00:00
Jeremy Allison
82d931d23d s3: smbd: Oops. DBG_ERR messages I used to debug parse_dfs_path(), should have been DBG_DEBUG.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Aug  8 09:07:24 UTC 2022 on sn-devel-184
2022-08-08 09:07:24 +00:00
listout
fb937ddc83 lib/util/access: source3/auth/user_util: Check for INNETGR
Checking for presence of both netgroup and innetgr. INNETGR is not
defined on libc's such as musl so not checking results in a build error.

Signed-off-by: listout <brahmajit.xyz@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Aug  8 07:28:31 UTC 2022 on sn-devel-184
2022-08-08 07:28:31 +00:00
listout
e13875601f nsswitch/wins: Define NETDB_* for other libc's
Define NETDB_SUCCESS and NETDB_INTERNAL if they are not defined. On
libc's such as musl NETDB_INTERNAL and NETDB_SUCCESS are not defined.

Signed-off-by: listout <brahmajit.xyz@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-08 06:33:38 +00:00
Volker Lendecke
7cd8715676 vfs: Add struct vfs_open_how.resolve
This prepares the later introduction of VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS,
which will be used to make use of RESOLVE_NO_SYMLINKS on linux with openat2().

Right now all terminal VFS objects reject any resolve bits with ENOSYS.
So we only prepare the vfs layer for now without any real change.
But this will make backports to 4.17 much easier.

Pair-programmed-with: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
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): Sat Aug  6 02:39:11 UTC 2022 on sn-devel-184
2022-08-06 02:39:11 +00:00
Volker Lendecke
8693a0416b smbd: Hand vfs_open_how to openat_pathref_fullname
Pair-programmed-with: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-08-06 01:43:50 +00:00
Volker Lendecke
c3c5e6c3dd smbd: Pass vfs_open_how through fd_openat
Pair-programmed-with: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-08-06 01:43:50 +00:00
Volker Lendecke
ccc26364a9 smbd: Pass vfs_open_how through non_widelink_open
process_symlink_open goes with it

Pair-programmed-with: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-08-06 01:43:50 +00:00
Volker Lendecke
5fc016f268 vfs: change openat propotype to match linux openat2
The Linux prototype for openat2 looks like this:

       long openat2(int dirfd, const char *pathname,
                   struct open_how *how, size_t size);

where "struct open_how" is defined in "linux/openat2.h". It is
designed to be extensible with further flags.

The "size" parameter is required because there is no type checking
between userland and kernelspace, so the way for Linux to find which
version of open_how is being passed in is looking at the size:
"open_how" is expected to only every grow with additional fields,
should a change be necessary in the future.

Samba does not have this problem, we can typecheck the struct and
pointers, we expect all VFS modules to be compiled against the current
vfs.h.

For now this adds no functionality, but it will make further patches
much smaller.

Pair-programmed-with: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-08-06 01:43:50 +00:00
Stefan Metzmacher
5aaf38949a vfs_glusterfs: add missing END_PROFILE(syscall_openat) to vfs_gluster_openat()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-08-06 01:43:50 +00:00
Douglas Bagnall
0fdd7e16a1 samba-tool gpo: clean up tmpdir after create
'fetch' and 'backup' might also leave files in /tmp, but in those cases
we want the files.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15006

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: David Mulder <dmulder@suse.com>

Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Sat Aug  6 01:42:09 UTC 2022 on sn-devel-184
2022-08-06 01:42:09 +00:00
Douglas Bagnall
5750d7a1d0 samba-tool: allow testparm to dump global section only
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15070

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: David Mulder <dmulder@suse.com>
2022-08-06 00:45:35 +00:00
Douglas Bagnall
1c6e59a7df pyparam: expose lpcfg_dump_globals()
This is needed by samba-tool testparm, in the next commit.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15070

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: David Mulder <dmulder@suse.com>
2022-08-06 00:45:35 +00:00
Douglas Bagnall
e0d96197fd pytest/netcmd: test samba-tool testparm global section
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: David Mulder <dmulder@suse.com>
2022-08-06 00:45:35 +00:00
Jeremy Allison
5075df4575 s3: smbd: Remove ugly SMB1-specific hack to filename_convert_dirfsp()
This was added due to the error code check in test_symlink_traversal_smb1_posix.sh.
After careful consideration I've realized the error code expected here
is incorrect, and not providing any security benefit.

We already check that trying to fetch a file/traverse through a
symlink that points outside of a share returns NT_STATUS_OBJECT_PATH_NOT_FOUND,
and this is enforced in the symlink checks already inside filename_convert_dirfsp().

If a symlink points to a directory within the share for which
the user has no permissions (as is tested here), then there's no
benefit in mapping the error code from NT_STATUS_ACCESS_DENIED
to NT_STATUS_OBJECT_PATH_NOT_FOUND, as we are not providing any
extra information about the filesystem state the user cannot already
obtain by normal SMB1+POSIX calls.

Change the error code expected in this single test from NT_STATUS_OBJECT_PATH_NOT_FOUND
to NT_STATUS_ACCESS_DENIED.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Aug  5 10:24:23 UTC 2022 on sn-devel-184
2022-08-05 10:24:22 +00:00
Jeremy Allison
5c9404f753 s3: smbd: Remove the ucf_flags parameter from extract_snapshot_token().
Now we always call check_path_syntaxXXX(), even on DFS names
we no longer need this. It was a BAD change, and I should feel BAD :-).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-05 09:24:30 +00:00
Jeremy Allison
d21cf6bbb1 s3: smbd: Cleanup - integer align. consumedcnt should be a size_t.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-05 09:24:30 +00:00
Jeremy Allison
7ef1412f85 s3: smbd: Minor cleanup in parse_dfs_path().
allow_wcards parameter is not used or looked at.

Remove it.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-05 09:24:30 +00:00
Jeremy Allison
e5a49c310d s3: smbd: Remove 'bool posix_path' from struct dfs_path.
Nothing now sets or looks at it.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-05 09:24:30 +00:00
Jeremy Allison
f24ef117cf s3: smbd: Change srvstr_get_path_internal() to always call check_path_syntaxXXX(), even on DFS pathnames.
The original design decision to just copy a DFS path and let
parse_dfs_path() take care of it was a horrible mistake.

Fix srvstr_get_path_internal() to always return a
/server/share/path (i.e. a path separated with '/', not '\').

This is a more complex change than I like to allow
DFS path procesing in srvstr_get_path_internal() but
needed as clients (including Samba smbclient) have a
rather "fuzzy" idea of what constitutes a valid DFS path.
If we detect the DFS path isn't valid here we have to
fall back to treating it as a local path.

I also need to modify the DFS parsing in
filename_convert_smb1_search_path() to cope with only '/'
separators.

This also means parse_dfs_path() needs changing to
cope.

The changes here are best reviewed by just applying
the fix and looking at the modified functions:

srvstr_get_path_internal()
parse_dfs_path()

For parse_dfs_path() it's mostly removing bad code
and makes parse_dfs_path() much easier to read.

These changes will enable me to remove some ugly mistakes made
adding ucf_flags to extract_snapshot_token(), as
we can now always assume canonicalized paths.

This is a little messy, but has to be done in
one chunk as the change to srvstr_get_path_internal()
depends on the change to parse_dfs_path().

Thanks to Volker for the insight that made this
cleanup possible.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-05 09:24:30 +00:00
Volker Lendecke
972dd999b8 smbd: Fix a "set but not used" warning
This is copy&paste from reply_negprot() where this variable was used
to set the remote architecture. This isn't used anymore in the
stripped down smb2 version of this.

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): Thu Aug  4 21:46:23 UTC 2022 on sn-devel-184
2022-08-04 21:46:23 +00:00
Volker Lendecke
99020ffef2 smbd: Security fix for systems without O_PATH
Further up we add O_PATH manually. Initial development versions of
this code did set the is_pathref, but then I found this potential
problem. I forgot to remove this incarnation of is_pathref=true, doing
it now.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-08-04 20:44:32 +00:00
Volker Lendecke
c89ae5f0f6 lib: Align an integer type
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-08-04 20:44:32 +00:00
Volker Lendecke
0b58dc38bb smbd: Fix the build on FreeBSD
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-08-04 20:44:32 +00:00
Jeremy Allison
46418dddda s3: smbd: Convert driver_unix_convert() to use filename_convert_dirfsp().
There is now only one user left of unix_convert(), inside
the MSDFS code. I have plans to get rid of this soon.

Signed-off-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 Aug  4 18:10:43 UTC 2022 on sn-devel-184
2022-08-04 18:10:43 +00:00
Jeremy Allison
f42b5be412 s3: smbd: Add dirfsp return parameter to driver_unix_convert().
Not yet used, but (dirfsp=NULL) value passed to functions
called after driver_unix_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
87835c69cc s3: smbd: In filename_convert_dirfsp_nosymlink() only use synthetic_smb_fname_split() for fake_files, not printer shares too.
Printer shares can have real filenames.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
ffc19ac985 s3: smbd: Remove filename_convert().
(\  _  /)
                            ( \ O / )
                             (// \\)
                                X
                               / \
                              /___\
                       _____/      \\_____
                      |         +         ||
                      |                   ||
                      |  filename_convert ||
                      |                   ||
                      |                   ||
                      |                   ||
                      |                   ||
                      |  _     ___   _    ||
                      | | \     |   | \   ||
                      | |  |    |   |  |  ||
                      | |_/     |   |_/   ||
                      | | \     |   |     ||
                      | |  \    |   |     ||
                      | |   \. _|_. | .   ||
                      |                   ||
              *     * | *   **    * **    |**     **
               \)),.,\(/.,(//,,..,,\||(,,.,\\,.((//

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
6848358363 s3: smbd: Convert filename_convert_smb1_search_path() to use filename_convert_dirfsp().
There are now no more users of filename_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
7bd5c05fbd s3: smbd: Add returned dirfsp pointer to filename_convert_smb1_search_path().
Preparation for convertion of the last filename_convert() -> filename_convert_dirfsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
5a923ae36a s3: smbd: We now know get_original_lcomp() never has to deal with an MSDFS pathname.
Remove the call to dfs_redirect() within it.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
4112bab9ae s3: smbd: In filename_convert_smb1_search_path(), after we have called dfs_redirect(), the path separator is always '/'.
This will allow us to remove the call to dfs_redirect() from get_original_lcomp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
2d9938dac3 s3: smbd: Remove TWRP handing inside get_original_lcomp().
Now we know all @GMT paths are removed before get_original_lcomp()
is called, we can eliminate this code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
acff075a72 s3: smbd: In reply_ntrename(), move the call to get_original_lcomp(..newname..) after the call to extract_snapshot_token(..newname..).
This was the last case where the snapshot TWRP token could be
passed into get_original_lcomp(). get_original_lcomp() can now
be changed to ignore TWRP tokens.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
5eed3f48b6 s3: smbd: Remove code for unused strip_gmt_from_raw_dfs().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
df5455c438 s3: smbd: Change filename_convert_smb1_search_path() to use extract_snapshot_token().
strip_gmt_from_raw_dfs() is now no longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
2ad3e63fe0 s3: smbd: Remove const from name_in parameter to filename_convert_smb1_search_path().
We're going to need to convert in place if it's an MSDFS path
with an SMB1 @GMT token.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
74715a7505 s3: smbd: Remove separate talloc_stackframe() from filename_convert_smb1_search_path().
We're soon going to change this to return dirfsp and use convert_filename_dirfsp()
so we need to return values on the passed in talloc ctx.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
7a823d44d2 s3: smbd: Allow extract_snapshot_token() to cope with MSDFS paths.
"raw" MSDFS paths are passed here as \server\share\path.

find_snapshot_token() only looks for a '/' as a separator
in SMB1 shapshot paths.

Allow extract_snapshot_token() to cope with SMB1 MSDFS paths by
converting in place, looking for the @GMT token with a '/'
separator via find_snapshot_token(), and then converting back.

Note, this a temporary measure until we handle DFS paths better
and will be removed in the next patchset.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
8b9fdc8ab1 s3: smbd: Add ucf_flags parameter to extract_snapshot_token().
Will be needed to cope with MSDFS paths which can be passed in
to this function.

Note, this a temporary measure until we handle DFS paths better
and will be removed in the next patchset.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00