]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
3 years agosmbstatus: add server_id to byte-range locks
Jule Anger [Mon, 2 May 2022 08:57:28 +0000 (10:57 +0200)] 
smbstatus: add server_id to byte-range locks

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add a basic byte-range locks dictionary
Jule Anger [Thu, 31 Mar 2022 08:30:30 +0000 (10:30 +0200)] 
smbstatus: add a basic byte-range locks dictionary

Adds an empty json dictionary under the key "byte_range_locks"
and adds foreach locked file a dictionary with information
(path and filename) to the byte-range locks dictionary.

Only print to stdout, if json_output is not set.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add service path to byte-range locks
Jule Anger [Mon, 25 Apr 2022 10:15:57 +0000 (12:15 +0200)] 
smbstatus: add service path to byte-range locks

The service/share path was added in 39ddd0a520bc and removed in
3a7d372e2eb5.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add machine readable time info to locked files
Jule Anger [Mon, 9 May 2022 08:00:22 +0000 (10:00 +0200)] 
smbstatus: add machine readable time info to locked files

Time has the format "2022-03-31T12:23:30+0200".

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add general caching information about open files to json output
Jule Anger [Mon, 1 Aug 2022 10:02:15 +0000 (12:02 +0200)] 
smbstatus: add general caching information about open files to json output

Adds a dictionary named "caching" to a opens dictionary.
Represents both oplock and leases caching. The dictionary contains a
boolean for each type (READE, WRITE and HANDLE), the hex value and a string
representation.
If no oplocks are used, the dictionary is left empty.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add sharemode information about open files to json output
Jule Anger [Mon, 1 Aug 2022 10:01:41 +0000 (12:01 +0200)] 
smbstatus: add sharemode information about open files to json output

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add server_id to open files dictionary
Jule Anger [Mon, 2 May 2022 08:56:27 +0000 (10:56 +0200)] 
smbstatus: add server_id to open files dictionary

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add lease information about open files to json output
Jule Anger [Wed, 30 Mar 2022 15:05:02 +0000 (17:05 +0200)] 
smbstatus: add lease information about open files to json output

Adds a dictionary named "lease" to a opens dictionary.
If leases are used, the dictionary contains a boolean for each type
(READE, WRITE and HANDLE or UNKNOWN) and a string representation of
the lease. Otherwise the dict is left empty.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add oplock information about open files to json output
Jule Anger [Wed, 30 Mar 2022 13:40:56 +0000 (15:40 +0200)] 
smbstatus: add oplock information about open files to json output

Adds a dictionary named "oplock" to a opens dictionary.
Contains a string representation and booleans for each oplock type
(EXCLUSIVE, BATCH, LEVEL_II, LEASE).

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add access mode information about open files to json output
Jule Anger [Wed, 30 Mar 2022 13:39:42 +0000 (15:39 +0200)] 
smbstatus: add access mode information about open files to json output

Adds a dictionary named "access_mask" to a open dictionary.
Contains the hex value of the mask, a text representation and booleans
for each attribute.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add opens to files in json output
Jule Anger [Wed, 30 Mar 2022 13:36:13 +0000 (15:36 +0200)] 
smbstatus: add opens to files in json output

At the moment, there is only information about the open files.
Adds a list of its opens for each file. An open is represented as
a dictionary. Contains only the basic information (pid, uid and
time) about the open.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add file_id information about open files to json output
Jule Anger [Wed, 30 Mar 2022 13:14:13 +0000 (15:14 +0200)] 
smbstatus: add file_id information about open files to json output

Adds a dictionary with file_id information (devid, inode and extid) for
each locked file.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add a basic dictionary with open files
Jule Anger [Wed, 30 Mar 2022 13:11:11 +0000 (15:11 +0200)] 
smbstatus: add a basic dictionary with open files

Adds an empty json dictionary under the key "open_files" and adds foreach
locked file a dictionary with information (path, filename and pending
deletes) to the locked files dictionary. Uses path and filename as key.

Only print to stdout, if json_output is not set.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add encryption and signing to sessions
Jule Anger [Mon, 9 May 2022 10:26:30 +0000 (12:26 +0200)] 
smbstatus: add encryption and signing to sessions

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add server_id to sessions
Jule Anger [Mon, 2 May 2022 08:57:56 +0000 (10:57 +0200)] 
smbstatus: add server_id to sessions

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add a sessions dictionary
Jule Anger [Thu, 24 Mar 2022 13:09:35 +0000 (14:09 +0100)] 
smbstatus: add a sessions dictionary

Adds an empty json dictionary under the key "sessions" and adds foreach
session a dictionary with information to the session dictionary. Uses the
session_id as key.
uid_str and gid_str are needed because both receive their own JSON field.

Only print to stdout, if json_output is not set.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add encryption and signing to connections
Jule Anger [Mon, 9 May 2022 08:11:38 +0000 (10:11 +0200)] 
smbstatus: add encryption and signing to connections

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add machine readable time to connections
Jule Anger [Mon, 9 May 2022 07:59:32 +0000 (09:59 +0200)] 
smbstatus: add machine readable time to connections

Time has the format "2022-03-31T12:23:30+0200".

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agoconn_tdb: change type of connections_data.start to NTTIME
Jule Anger [Mon, 18 Jul 2022 09:33:12 +0000 (11:33 +0200)] 
conn_tdb: change type of connections_data.start to NTTIME

connections_data.start previously had the type time_t, but time_t
only had a precision for seconds. NTTIME has a higer precision,
which is useful for debugging.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add session_id to connections dictionary
Jule Anger [Thu, 7 Jul 2022 08:09:05 +0000 (10:09 +0200)] 
smbstatus: add session_id to connections dictionary

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agoconn_tdb: add sess_id to struct connections_data
Jule Anger [Thu, 7 Jul 2022 08:08:36 +0000 (10:08 +0200)] 
conn_tdb: add sess_id to struct connections_data

Save the session global id as sess_id in the connections_data struct.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add server_id to connections
Jule Anger [Mon, 2 May 2022 08:55:52 +0000 (10:55 +0200)] 
smbstatus: add server_id to connections

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add a connections dictionary
Jule Anger [Thu, 31 Mar 2022 08:20:20 +0000 (10:20 +0200)] 
smbstatus: add a connections dictionary

Adds an empty json dictionary under the key "tcons" and adds foreach
connection a dictionary with information to the shares dictionary.

Only print to stdout, if json_output is not set.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add general information to the json output
Jule Anger [Thu, 31 Mar 2022 09:04:52 +0000 (11:04 +0200)] 
smbstatus: add general information to the json output

Adds timestamp, samba version and path to smb.conf to a given json
object.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add method add_section_to_json
Jule Anger [Thu, 31 Mar 2022 08:17:47 +0000 (10:17 +0200)] 
smbstatus: add method add_section_to_json

The method adds an empty json object (value) under a given section name
(key) to a given json object.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add json items to traverse_struct
Jule Anger [Thu, 24 Mar 2022 14:46:35 +0000 (15:46 +0100)] 
smbstatus: add json items to traverse_struct

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add frame files for json specific methods
Jule Anger [Thu, 24 Mar 2022 13:38:46 +0000 (14:38 +0100)] 
smbstatus: add frame files for json specific methods

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: use new enum crypto_degree
Jule Anger [Mon, 11 Jul 2022 09:05:12 +0000 (11:05 +0200)] 
smbstatus: use new enum crypto_degree

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add enum to handle partial encryption and signing
Jule Anger [Mon, 11 Jul 2022 08:40:16 +0000 (10:40 +0200)] 
smbstatus: add enum to handle partial encryption and signing

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: move the output of the content to their own methods
Jule Anger [Thu, 24 Mar 2022 10:36:56 +0000 (11:36 +0100)] 
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>
3 years agosmbstatus: move the output of the title lines to their own methods
Jule Anger [Thu, 24 Mar 2022 15:34:10 +0000 (16:34 +0100)] 
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>
3 years agosmbstatus: pass the traverse_state to the traverse methods
Jule Anger [Thu, 24 Mar 2022 15:27:10 +0000 (16:27 +0100)] 
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>
3 years agosmbstatus: add struct traverse_state
Jule Anger [Wed, 23 Mar 2022 14:17:48 +0000 (15:17 +0100)] 
smbstatus: add struct traverse_state

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: use variables in print_share_mode instead of printing directly
Jule Anger [Wed, 23 Mar 2022 08:13:58 +0000 (09:13 +0100)] 
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>
3 years agosmbstatus: print errors to stderr instead of stdout
Jule Anger [Wed, 23 Mar 2022 07:58:54 +0000 (08:58 +0100)] 
smbstatus: print errors to stderr instead of stdout

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agoaudit_logging: add method to replace the object for a given key with a new object
Jule Anger [Tue, 22 Mar 2022 15:06:37 +0000 (16:06 +0100)] 
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>
3 years agosmbstatus: delete wrong EXCLUSIVE+BATCH oplock
Jule Anger [Mon, 9 May 2022 10:09:18 +0000 (12:09 +0200)] 
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>
3 years agos3: smbd: Oops. DBG_ERR messages I used to debug parse_dfs_path(), should have been...
Jeremy Allison [Fri, 5 Aug 2022 18:06:13 +0000 (11:06 -0700)] 
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

3 years agolib/util/access: source3/auth/user_util: Check for INNETGR
listout [Thu, 14 Jul 2022 13:21:09 +0000 (18:51 +0530)] 
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

3 years agonsswitch/wins: Define NETDB_* for other libc's
listout [Thu, 14 Jul 2022 13:15:17 +0000 (18:45 +0530)] 
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>
3 years agovfs: Add struct vfs_open_how.resolve
Volker Lendecke [Fri, 3 Jun 2022 14:45:41 +0000 (16:45 +0200)] 
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

3 years agosmbd: Hand vfs_open_how to openat_pathref_fullname
Volker Lendecke [Fri, 17 Jun 2022 08:54:14 +0000 (10:54 +0200)] 
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>
3 years agosmbd: Pass vfs_open_how through fd_openat
Volker Lendecke [Fri, 17 Jun 2022 08:39:20 +0000 (10:39 +0200)] 
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>
3 years agosmbd: Pass vfs_open_how through non_widelink_open
Volker Lendecke [Thu, 16 Jun 2022 15:09:55 +0000 (17:09 +0200)] 
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>
3 years agovfs: change openat propotype to match linux openat2
Volker Lendecke [Fri, 3 Jun 2022 13:53:29 +0000 (15:53 +0200)] 
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>
3 years agovfs_glusterfs: add missing END_PROFILE(syscall_openat) to vfs_gluster_openat()
Stefan Metzmacher [Fri, 5 Aug 2022 11:17:50 +0000 (11:17 +0000)] 
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>
3 years agosamba-tool gpo: clean up tmpdir after create
Douglas Bagnall [Thu, 24 Mar 2022 05:39:55 +0000 (18:39 +1300)] 
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

3 years agosamba-tool: allow testparm to dump global section only
Douglas Bagnall [Thu, 4 Aug 2022 03:44:45 +0000 (15:44 +1200)] 
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>
3 years agopyparam: expose lpcfg_dump_globals()
Douglas Bagnall [Thu, 4 Aug 2022 03:41:25 +0000 (15:41 +1200)] 
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>
3 years agopytest/netcmd: test samba-tool testparm global section
Douglas Bagnall [Thu, 4 Aug 2022 22:48:06 +0000 (10:48 +1200)] 
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>
3 years agos3: smbd: Remove ugly SMB1-specific hack to filename_convert_dirfsp()
Jeremy Allison [Thu, 4 Aug 2022 18:32:05 +0000 (11:32 -0700)] 
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

3 years agos3: smbd: Remove the ucf_flags parameter from extract_snapshot_token().
Jeremy Allison [Thu, 4 Aug 2022 17:02:15 +0000 (10:02 -0700)] 
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>
3 years agos3: smbd: Cleanup - integer align. consumedcnt should be a size_t.
Jeremy Allison [Thu, 4 Aug 2022 20:23:28 +0000 (13:23 -0700)] 
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>
3 years agos3: smbd: Minor cleanup in parse_dfs_path().
Jeremy Allison [Thu, 4 Aug 2022 20:08:51 +0000 (13:08 -0700)] 
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>
3 years agos3: smbd: Remove 'bool posix_path' from struct dfs_path.
Jeremy Allison [Fri, 5 Aug 2022 02:09:39 +0000 (19:09 -0700)] 
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>
3 years agos3: smbd: Change srvstr_get_path_internal() to always call check_path_syntaxXXX(...
Jeremy Allison [Thu, 4 Aug 2022 16:52:17 +0000 (09:52 -0700)] 
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>
3 years agosmbd: Fix a "set but not used" warning
Volker Lendecke [Tue, 2 Aug 2022 11:08:43 +0000 (13:08 +0200)] 
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

3 years agosmbd: Security fix for systems without O_PATH
Volker Lendecke [Thu, 4 Aug 2022 14:44:44 +0000 (16:44 +0200)] 
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>
3 years agolib: Align an integer type
Volker Lendecke [Wed, 3 Aug 2022 09:05:33 +0000 (11:05 +0200)] 
lib: Align an integer type

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Fix the build on FreeBSD
Volker Lendecke [Fri, 22 Jul 2022 17:17:29 +0000 (19:17 +0200)] 
smbd: Fix the build on FreeBSD

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3: smbd: Convert driver_unix_convert() to use filename_convert_dirfsp().
Jeremy Allison [Tue, 2 Aug 2022 21:06:44 +0000 (14:06 -0700)] 
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

3 years agos3: smbd: Add dirfsp return parameter to driver_unix_convert().
Jeremy Allison [Tue, 2 Aug 2022 21:01:59 +0000 (14:01 -0700)] 
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>
3 years agos3: smbd: In filename_convert_dirfsp_nosymlink() only use synthetic_smb_fname_split...
Jeremy Allison [Wed, 3 Aug 2022 01:13:52 +0000 (18:13 -0700)] 
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>
3 years agos3: smbd: Remove filename_convert().
Jeremy Allison [Wed, 3 Aug 2022 17:04:37 +0000 (10:04 -0700)] 
s3: smbd: Remove filename_convert().

                            (\  _  /)
                            ( \ O / )
                             (// \\)
                                X
                               / \
                              /___\
                       _____/      \\_____
                      |         +         ||
                      |                   ||
                      |  filename_convert ||
                      |                   ||
                      |                   ||
                      |                   ||
                      |                   ||
                      |  _     ___   _    ||
                      | | \     |   | \   ||
                      | |  |    |   |  |  ||
                      | |_/     |   |_/   ||
                      | | \     |   |     ||
                      | |  \    |   |     ||
                      | |   \. _|_. | .   ||
                      |                   ||
              *     * | *   **    * **    |**     **
               \)),.,\(/.,(//,,..,,\||(,,.,\\,.((//

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: smbd: Convert filename_convert_smb1_search_path() to use filename_convert_dirfsp().
Jeremy Allison [Wed, 3 Aug 2022 17:02:42 +0000 (10:02 -0700)] 
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>
3 years agos3: smbd: Add returned dirfsp pointer to filename_convert_smb1_search_path().
Jeremy Allison [Wed, 3 Aug 2022 16:58:54 +0000 (09:58 -0700)] 
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>
3 years agos3: smbd: We now know get_original_lcomp() never has to deal with an MSDFS pathname.
Jeremy Allison [Wed, 3 Aug 2022 18:45:39 +0000 (11:45 -0700)] 
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>
3 years agos3: smbd: In filename_convert_smb1_search_path(), after we have called dfs_redirect...
Jeremy Allison [Wed, 3 Aug 2022 18:42:17 +0000 (11:42 -0700)] 
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>
3 years agos3: smbd: Remove TWRP handing inside get_original_lcomp().
Jeremy Allison [Tue, 2 Aug 2022 21:24:46 +0000 (14:24 -0700)] 
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>
3 years agos3: smbd: In reply_ntrename(), move the call to get_original_lcomp(..newname..) after...
Jeremy Allison [Tue, 2 Aug 2022 21:16:15 +0000 (14:16 -0700)] 
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>
3 years agos3: smbd: Remove code for unused strip_gmt_from_raw_dfs().
Jeremy Allison [Wed, 3 Aug 2022 16:50:57 +0000 (09:50 -0700)] 
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>
3 years agos3: smbd: Change filename_convert_smb1_search_path() to use extract_snapshot_token().
Jeremy Allison [Wed, 3 Aug 2022 16:50:02 +0000 (09:50 -0700)] 
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>
3 years agos3: smbd: Remove const from name_in parameter to filename_convert_smb1_search_path().
Jeremy Allison [Wed, 3 Aug 2022 16:27:37 +0000 (09:27 -0700)] 
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>
3 years agos3: smbd: Remove separate talloc_stackframe() from filename_convert_smb1_search_path().
Jeremy Allison [Wed, 3 Aug 2022 16:33:48 +0000 (09:33 -0700)] 
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>
3 years agos3: smbd: Allow extract_snapshot_token() to cope with MSDFS paths.
Jeremy Allison [Wed, 3 Aug 2022 16:20:36 +0000 (09:20 -0700)] 
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>
3 years agos3: smbd: Add ucf_flags parameter to extract_snapshot_token().
Jeremy Allison [Wed, 3 Aug 2022 16:08:48 +0000 (09:08 -0700)] 
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>
3 years agotestprogs: Reformat test_ktpass.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_ktpass.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_ktpass.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Aug  4 13:49:54 UTC 2022 on sn-devel-184

3 years agotestprogs: Reformat test_kpasswd_mit.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_kpasswd_mit.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_kpasswd_mit.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_kpasswd_heimdal.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_kpasswd_heimdal.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_kpasswd_heimdal.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_kinit_trusts_mit.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_kinit_trusts_mit.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_kinit_trusts_mit.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_kinit_trusts_heimdal.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_kinit_trusts_heimdal.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_kinit_trusts_heimdal.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_kinit_mit.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_kinit_mit.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_kinit_mit.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_kinit_heimdal.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_kinit_heimdal.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_kinit_heimdal.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_export_keytab_mit.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)] 
testprogs: Reformat test_export_keytab_mit.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_export_keytab_mit.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_export_keytab_heimdal.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)] 
testprogs: Reformat test_export_keytab_heimdal.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_export_keytab_heimdal.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_client_kerberos.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)] 
testprogs: Reformat test_client_kerberos.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_client_kerberos.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_client_etypes.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)] 
testprogs: Reformat test_client_etypes.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_client_etypes.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_chgdcpass.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)] 
testprogs: Reformat test_chgdcpass.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_chgdcpass.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat subunit.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)] 
testprogs: Reformat subunit.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/subunit.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat schemaupgrade.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)] 
testprogs: Reformat schemaupgrade.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/schemaupgrade.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat runtime-links.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)] 
testprogs: Reformat runtime-links.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/runtime-links.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat renamedc.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)] 
testprogs: Reformat renamedc.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/renamedc.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat nsstest.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)] 
testprogs: Reformat nsstest.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/nsstest.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat ldapcmp_restoredc.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)] 
testprogs: Reformat ldapcmp_restoredc.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/ldapcmp_restoredc.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat join_ldapcmp.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)] 
testprogs: Reformat join_ldapcmp.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/join_ldapcmp.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat functionalprep.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)] 
testprogs: Reformat functionalprep.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/functionalprep.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat dom_parse.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)] 
testprogs: Reformat dom_parse.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/dom_parse.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat dfree.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)] 
testprogs: Reformat dfree.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/dfree.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat demote-saveddb.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)] 
testprogs: Reformat demote-saveddb.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/demote-saveddb.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat dbcheck.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)] 
testprogs: Reformat dbcheck.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/dbcheck.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org>
Autobuild-Date(master): Thu Aug  4 10:11:30 UTC 2022 on sn-devel-184