gd/samba-autobuild/.git
2 years agoconfigure: Check for __atomic_add_fetch() and __atomic_load()
Volker Lendecke [Mon, 13 Dec 2021 16:40:52 +0000 (17:40 +0100)]
configure: Check for __atomic_add_fetch() and __atomic_load()

To be used in the tdb_seqnum code soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolib/util: Add signal.h include
Bernd Kuhls [Sun, 12 Dec 2021 09:27:42 +0000 (10:27 +0100)]
lib/util: Add signal.h include

Fixes build error with samba-4.15.3 and uClibc:

../../source3/printing/samba-bgqd.c: In function ‘main’:
../../source3/printing/samba-bgqd.c:340:21: error: ‘SIGPIPE’ undeclared (first use in this function); did you mean ‘EPIPE’?
../../source3/printing/samba-bgqd.c:384:14: error: ‘SIGTERM’ undeclared (first use in this function)

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Dec 13 16:22:28 UTC 2021 on sn-devel-184

2 years agos3: smbtorture3: Fix POSIX-BLOCKING-LOCK to actually negotiate SMB1+POSIX before...
Jeremy Allison [Thu, 18 Nov 2021 20:16:44 +0000 (12:16 -0800)]
s3: smbtorture3: Fix POSIX-BLOCKING-LOCK to actually negotiate SMB1+POSIX before using POSIX calls.

This must be done before doing POSIX calls on a connection.

Remove the final entry in knownfail.d/posix_infolevel_fails

    samba3.smbtorture_s3.plain.POSIX-BLOCKING-LOCK.smbtorture\(nt4_dc_smb1\)

And remove the file knownfail.d/posix_infolevel_fails itself.

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): Sat Dec 11 12:03:36 UTC 2021 on sn-devel-184

2 years agos3: tests: Fix the samba3.blackbox.acl_xattr test to actually negotiate SMB1+POSIX...
Jeremy Allison [Fri, 19 Nov 2021 08:05:35 +0000 (00:05 -0800)]
s3: tests: Fix the samba3.blackbox.acl_xattr test to actually negotiate SMB1+POSIX before using POSIX calls.

Remove the following entries in knownfail.d/posix_infolevel_fails.

    samba3.blackbox.acl_xattr.NT1.nt_affects_posix.*
    samba3.blackbox.acl_xattr.NT1.nt_affects_chown.*
    samba3.blackbox.acl_xattr.NT1.nt_affects_chgrp.*

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: tests: Fix the samba3.blackbox.inherit_owner test to actually negotiate SMB1...
Jeremy Allison [Fri, 19 Nov 2021 20:12:36 +0000 (12:12 -0800)]
s3: tests: Fix the samba3.blackbox.inherit_owner test to actually negotiate SMB1+POSIX before using POSIX calls.

Remove the following entry in knownfail.d/posix_infolevel_fails.

samba3.blackbox.inherit_owner.*.NT1.*verify.*unix\ owner.*

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos4: torture: Fix unix.info2 test to actually negotiate SMB1+POSIX before using POSIX...
Jeremy Allison [Fri, 19 Nov 2021 20:15:06 +0000 (12:15 -0800)]
s4: torture: Fix unix.info2 test to actually negotiate SMB1+POSIX before using POSIX calls.

Cope with the minor difference in wildcard search return when
we're actually using SMB1+POSIX on the server (SMB1+POSIX treats
all directory search paths as wildcards).

Remove the following entries in knownfail.d/posix_infolevel_fails.

samba3.unix.info2.info2\(nt4_dc_smb1\)
        samba3.unix.info2.info2\(ad_dc_smb1\)

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos4: torture: Fix raw.search:test_one_file() by using the SMB1+POSIX connection for...
Jeremy Allison [Fri, 19 Nov 2021 22:51:39 +0000 (14:51 -0800)]
s4: torture: Fix raw.search:test_one_file() by using the SMB1+POSIX connection for POSIX info levels.

Remove the following entry in knownfail.d/posix_infolevel_fails.

^samba3.raw.search.one\ file\ search.*

from knownfail.d/posix_infolevel_fails

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos4: torture: raw.search: Add setup_smb1_posix(). Call it on the second connection...
Jeremy Allison [Fri, 19 Nov 2021 22:48:20 +0000 (14:48 -0800)]
s4: torture: raw.search: Add setup_smb1_posix(). Call it on the second connection in test_one_file().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos4: torture: In raw.search:test_one_file() add a second connection.
Jeremy Allison [Fri, 19 Nov 2021 22:44:05 +0000 (14:44 -0800)]
s4: torture: In raw.search:test_one_file() add a second connection.

Change from torture_suite_add_1smb_test() to torture_suite_add_2smb_test().

Not yet used. We will need this to do SMB1+POSIX search calls on
a connection on which we have negotiated SMB1+POSIX.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbclient: Give a message if we try and use any POSIX command without negotiating...
Jeremy Allison [Sun, 21 Nov 2021 04:17:11 +0000 (20:17 -0800)]
s3: smbclient: Give a message if we try and use any POSIX command without negotiating POSIX first.

Ensure we only use a POSIX command if POSIX is set up.
Issue the message: Command "posix" must be issued before the "XXXX" command can be used.
After the parameter parsing has been done.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Tighten up info level checks for SMB1+POSIX to make sure POSIX was negotiat...
Jeremy Allison [Thu, 18 Nov 2021 19:48:42 +0000 (11:48 -0800)]
s3: smbd: Tighten up info level checks for SMB1+POSIX to make sure POSIX was negotiated first.

Add knownfail file

knownfail.d/posix_infolevel_fails

for tests that don't currently negotiate
SMB1+POSIX before using SMB1+POSIX calls.

These are:

samba3.smbtorture_s3.plain.POSIX-BLOCKING-LOCK.smbtorture\(nt4_dc_smb1\)
samba3.blackbox.acl_xattr.NT1.nt_affects_posix.*
samba3.blackbox.acl_xattr.NT1.nt_affects_chown.*
samba3.blackbox.acl_xattr.NT1.nt_affects_chgrp.*
samba3.blackbox.inherit_owner.*.NT1.*verify.*unix\ owner.*
samba3.unix.info2.info2\(nt4_dc_smb1\)
samba3.unix.info2.info2\(ad_dc_smb1\)
samba3.raw.search.one\ file\ search.*

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos4: torture: In raw.search:test_one_file() remove the leading '\\' in the test filenames.
Jeremy Allison [Fri, 19 Nov 2021 22:18:47 +0000 (14:18 -0800)]
s4: torture: In raw.search:test_one_file() remove the leading '\\' in the test filenames.

We'll soon be using this under SMB1+POSIX and neither Windows or POSIX
need a leading '\\' (and SMB1+POSIX sees the '\\' as part of the name).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos4: torture: Fix raw.search:test_one_file() to use torture_result() instead of printf.
Jeremy Allison [Fri, 19 Nov 2021 20:54:47 +0000 (12:54 -0800)]
s4: torture: Fix raw.search:test_one_file() to use torture_result() instead of printf.

I think this test pre-dates torture_result.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Remove 'struct uc_state' name_has_wildcard element.
Jeremy Allison [Fri, 3 Dec 2021 21:06:27 +0000 (13:06 -0800)]
s3: smbd: Remove 'struct uc_state' name_has_wildcard element.

It is never set or looked at.

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): Sat Dec 11 08:07:14 UTC 2021 on sn-devel-184

2 years agos3: smbd: In unix_convert_step_stat() remove use of state->name_was_wildcard.
Jeremy Allison [Fri, 3 Dec 2021 21:05:55 +0000 (13:05 -0800)]
s3: smbd: In unix_convert_step_stat() remove use of state->name_was_wildcard.

It can never be true.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: In unix_convert_step() remove all use of 'state->name_was_wildcard'
Jeremy Allison [Fri, 3 Dec 2021 21:03:47 +0000 (13:03 -0800)]
s3: smbd: In unix_convert_step() remove all use of 'state->name_was_wildcard'

We know it is never true.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: In unix_convert() remove the now unneeded block indentation.
Jeremy Allison [Fri, 3 Dec 2021 20:59:50 +0000 (12:59 -0800)]
s3: smbd: In unix_convert() remove the now unneeded block indentation.

We removed the 'if (state->name_has_wildcard) {' clause, so
the block no longer needs indenting.

Best seen with git show -b.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: In unix_convert(), remove all references to state->name_has_wildcard.
Jeremy Allison [Fri, 3 Dec 2021 20:55:41 +0000 (12:55 -0800)]
s3: smbd: In unix_convert(), remove all references to state->name_has_wildcard.

It is never set.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Inside unix_convert(), never set state->name_is_wildcard.
Jeremy Allison [Fri, 3 Dec 2021 20:53:36 +0000 (12:53 -0800)]
s3: smbd: Inside unix_convert(), never set state->name_is_wildcard.

We error out immediately if it's set anyway.
Preparing to remove 'state->name_is_wildcard' structure element.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: UCF_ALWAYS_ALLOW_WCARD_LCOMP 0x00000002 is no longer used.
Jeremy Allison [Fri, 3 Dec 2021 20:40:43 +0000 (12:40 -0800)]
s3: smbd: UCF_ALWAYS_ALLOW_WCARD_LCOMP 0x00000002 is no longer used.

Hurrah !

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: We no longer need determine_path_error().
Jeremy Allison [Fri, 3 Dec 2021 20:37:15 +0000 (12:37 -0800)]
s3: smbd: We no longer need determine_path_error().

Now we don't have to consider wildcards just
return NT_STATUS_OBJECT_PATH_NOT_FOUND for
the cases we used to call it.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Inside 'struct uc_state', remove allow_wcard_last_component.
Jeremy Allison [Fri, 3 Dec 2021 19:33:42 +0000 (11:33 -0800)]
s3: smbd: Inside 'struct uc_state', remove allow_wcard_last_component.

This is never allowed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: filename_convert() no longer deals with wildcards.
Jeremy Allison [Fri, 3 Dec 2021 19:30:42 +0000 (11:30 -0800)]
s3: smbd: filename_convert() no longer deals with wildcards.

These are already errored out with NT_STATUS_OBJECT_NAME_INVALID
in the unix_convert() code.

Remove the check.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: parse_dfs_path() can ignore wildcards.
Jeremy Allison [Fri, 3 Dec 2021 19:48:23 +0000 (11:48 -0800)]
s3: smbd: parse_dfs_path() can ignore wildcards.

If one is passed to filename_convert(), it will error out there
with NT_STATUS_OBJECT_NAME_INVALID.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Remove 'bool search_wcard_flag' from parse_dfs_path().
Jeremy Allison [Fri, 3 Dec 2021 19:42:23 +0000 (11:42 -0800)]
s3: smbd: Remove 'bool search_wcard_flag' from parse_dfs_path().

Never set.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: dfs_path_lookup() no longer deals with wildcards.
Jeremy Allison [Fri, 3 Dec 2021 19:31:40 +0000 (11:31 -0800)]
s3: smbd: dfs_path_lookup() no longer deals with wildcards.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Fix call_trans2findfirst() to use filename_convert_smb1_search_path().
Jeremy Allison [Fri, 3 Dec 2021 19:28:40 +0000 (11:28 -0800)]
s3: smbd: Fix call_trans2findfirst() to use filename_convert_smb1_search_path().

filename_convert() no longer has to handle wildcards.
UCF_ALWAYS_ALLOW_WCARD_LCOMP is now unused.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Convert reply_search() to use filename_convert_smb1_search_path().
Jeremy Allison [Fri, 3 Dec 2021 19:22:03 +0000 (11:22 -0800)]
s3: smbd: Convert reply_search() to use filename_convert_smb1_search_path().

Cleans up this code path nicely !

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Add filename_convert_smb1_search_path() - deals with SMB1 search pathnames.
Jeremy Allison [Fri, 3 Dec 2021 18:35:09 +0000 (10:35 -0800)]
s3: smbd: Add filename_convert_smb1_search_path() - deals with SMB1 search pathnames.

SMB1search and trans2 findfirst are unique in that
they are the only passed in pathnames that can contain
a terminal wildcard component.

Deal with these two special cases with this new function
that strips off the terminal wildcard and returns as
the mask, and pass the non-wildcard parent directory
component through the standard filename_convert().

Uses new helper function strip_gmt_from_raw_dfs().

When SMB1search and trans2 findfirst have been
converted to use this function, we can strip all
wildcard handling out of filename_convert() as
we now know it will only ever be given valid
pathnames.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Allow dfs_redirect() to return a TWRP token it got from a parsed pathname.
Jeremy Allison [Sat, 4 Dec 2021 00:14:08 +0000 (16:14 -0800)]
s3: smbd: Allow dfs_redirect() to return a TWRP token it got from a parsed pathname.

This one is subtle. If an SMB1 request has both a DFS path and a @GMT token,
the unix_convert() inside the DFS path processing will remove the @GMT
token, not allowing the subsequent unix_convert() inside filename_convert()
to see it. By returning it from dfs_redirect() we can ensure it's correctly
added to the smb_filename returned from filename_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: In dfs_path_lookup(). If we have a DFS path including a @GMT-token, don...
Jeremy Allison [Sat, 4 Dec 2021 00:00:26 +0000 (16:00 -0800)]
s3: smbd: In dfs_path_lookup(). If we have a DFS path including a @GMT-token, don't throw away the twrp value when parsing the path.

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: filename_convert() is now a one-to-one wrapper around filename_convert_inte...
Jeremy Allison [Fri, 3 Dec 2021 18:19:38 +0000 (10:19 -0800)]
s3: smbd: filename_convert() is now a one-to-one wrapper around filename_convert_internal().

Remove filename_convert() and rename filename_convert_internal() -> filename_convert().
Move the old DEBUG(..) statements to DBG_XXX() so they don't print the wrong name.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Remove now unused check_reduced_name_with_privilege().
Jeremy Allison [Fri, 3 Dec 2021 18:14:03 +0000 (10:14 -0800)]
s3: smbd: Remove now unused check_reduced_name_with_privilege().

We now only have one function that does this check (check_reduced_name()),
used everywhere.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Remove unused check_name_with_privilege().
Jeremy Allison [Fri, 3 Dec 2021 18:13:13 +0000 (10:13 -0800)]
s3: smbd: Remove unused check_name_with_privilege().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: In filename_convert_internal(), remove call to check_name_with_privilege().
Jeremy Allison [Fri, 3 Dec 2021 18:10:45 +0000 (10:10 -0800)]
s3: smbd: In filename_convert_internal(), remove call to check_name_with_privilege().

We now always pass NULL as struct smb_request *smbreq,
so this code path can never be taken.

Comment out check_name_with_privilege() as it's now
no longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Remove filename_convert_with_privilege(). No longer used.
Jeremy Allison [Fri, 3 Dec 2021 01:55:26 +0000 (17:55 -0800)]
s3: smbd: Remove filename_convert_with_privilege(). No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: In call_trans2findfirst() we don't need filename_convert_with_privilege...
Jeremy Allison [Fri, 3 Dec 2021 01:51:42 +0000 (17:51 -0800)]
s3: smbd: In call_trans2findfirst() we don't need filename_convert_with_privilege() anymore.

It was extra-paranoid code now not needed as the new VFS
version of filename_convert() does the same job.

There are now no remaining callers of filename_convert_with_privilege().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Remove split_fname_dir_mask().
Jeremy Allison [Fri, 10 Dec 2021 00:51:45 +0000 (16:51 -0800)]
s3: smbd: Remove split_fname_dir_mask().

No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: In rename_internals(), remove the name spliting and re-combining code.
Jeremy Allison [Fri, 10 Dec 2021 00:49:46 +0000 (16:49 -0800)]
s3: smbd: In rename_internals(), remove the name spliting and re-combining code.

filename_convert() handles mangled names just fine, so we don't
need to split the last component and check for mangle.

Now we don't take wildcard names this is not needed. This was the
last caller of split_fname_dir_mask(), so ifdef it out.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: check_name() is now static to filename.c
Jeremy Allison [Fri, 10 Dec 2021 00:47:13 +0000 (16:47 -0800)]
s3: smbd: check_name() is now static to filename.c

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: In rename_internals_fsp(), remove unneeded call to check_name().
Jeremy Allison [Fri, 10 Dec 2021 00:45:13 +0000 (16:45 -0800)]
s3: smbd: In rename_internals_fsp(), remove unneeded call to check_name().

All callers have gone through filename_convert(), which has
already called check_name() on the destination.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Handling SMB_FILE_RENAME_INFORMATION, the destination name is a single...
Jeremy Allison [Fri, 10 Dec 2021 00:35:17 +0000 (16:35 -0800)]
s3: smbd: Handling SMB_FILE_RENAME_INFORMATION, the destination name is a single component.

No errors should be allowed from filename_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Remove the old unlink_internals() implementation.
Jeremy Allison [Fri, 10 Dec 2021 00:16:52 +0000 (16:16 -0800)]
s3: smbd: Remove the old unlink_internals() implementation.

No longer used. filename_convert() already handles mangled
names just fine, so we don't need this logic.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Comment out the old unlink_internals(). Rename do_unlink() -> unlink_intern...
Jeremy Allison [Fri, 10 Dec 2021 00:14:40 +0000 (16:14 -0800)]
s3: smbd: Comment out the old unlink_internals(). Rename do_unlink() -> unlink_internals().

One parameter needs changing position. The logic inside unlink_internals()
is no longer needed if it doesn't accept wildcards. filename_convert()
already handles mangled names just fine, so we don't need this logic.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Move to modern debug calls inside do_unlink().
Jeremy Allison [Fri, 10 Dec 2021 00:11:20 +0000 (16:11 -0800)]
s3: smbd: Move to modern debug calls inside do_unlink().

We will be changing its name next.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Move setting of dirtype if FILE_ATTRIBUTE_NORMAL to do_unlink().
Jeremy Allison [Fri, 10 Dec 2021 00:08:07 +0000 (16:08 -0800)]
s3: smbd: Move setting of dirtype if FILE_ATTRIBUTE_NORMAL to do_unlink().

Now we don't use wildcards when calling in unlink_internals()
the logic inside it serves no purpose and can be replaced with
a direct call to do_unlink() (which we will rename to unlink_internals()).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3:torture: Initialize pointer with NULL
Andreas Schneider [Fri, 10 Dec 2021 16:24:43 +0000 (17:24 +0100)]
s3:torture: Initialize pointer with NULL

source3/torture/torture.c:4309:17: error: ‘pname’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 4309 |                 printf("qfilename gave different name? [%s] [%s]\n",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4310 |                        fname, pname);
      |                        ~~~~~~~~~~~~~

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Dec 11 00:25:46 UTC 2021 on sn-devel-184

2 years agoWHATSNEW. Added section about samba-dcerpcd.
Jeremy Allison [Thu, 30 Sep 2021 23:05:49 +0000 (16:05 -0700)]
WHATSNEW. Added section about samba-dcerpcd.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Dec 10 14:52:54 UTC 2021 on sn-devel-184

2 years agodcesrv_core: Remove unused dcesrv_reinit_context()
Volker Lendecke [Mon, 27 Sep 2021 11:13:11 +0000 (13:13 +0200)]
dcesrv_core: Remove unused dcesrv_reinit_context()

This was only used in the prefork source3 rpc servers

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3:rpc_server: Delete unused code and doc references
Volker Lendecke [Tue, 8 Jun 2021 07:10:05 +0000 (09:10 +0200)]
s3:rpc_server: Delete unused code and doc references

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoprinting: Remove "start_daemons" from printing_subsystem_init()
Volker Lendecke [Sun, 28 Nov 2021 19:29:26 +0000 (20:29 +0100)]
printing: Remove "start_daemons" from printing_subsystem_init()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3:rpc_server: Activate samba-dcerpcd
Volker Lendecke [Fri, 18 Jun 2021 17:11:19 +0000 (19:11 +0200)]
s3:rpc_server: Activate samba-dcerpcd

This is the big switch to use samba-dcerpcd for the RPC services in
source3/. It is a pretty big and unordered patch, but I don't see a
good way to split this up into more manageable pieces without
sacrificing bisectability even more. Probably I could cut out a few
small ones, but a major architechtural switch like this will always be
messy.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3:rpc_server: Add samba-dcerpcd helper programs
Volker Lendecke [Wed, 7 Apr 2021 07:13:25 +0000 (07:13 +0000)]
s3:rpc_server: Add samba-dcerpcd helper programs

These are rpcd_* binaries.

rpcd_classic collects everything that's not specific

Changes the epmapper to read the epmdb.tdb, which will make the
epmapper tests non-bisectable until the switch is done.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3:winbind: Close internal RPC pipes after 5 idle seconds
Volker Lendecke [Sat, 19 Jun 2021 15:06:59 +0000 (17:06 +0200)]
s3:winbind: Close internal RPC pipes after 5 idle seconds

Even internal pipes have a small cost, external ones will block a
process from exiting soon.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3:rpc_server: Make npa_state_init() public
Volker Lendecke [Fri, 18 Jun 2021 17:56:48 +0000 (19:56 +0200)]
s3:rpc_server: Make npa_state_init() public

Will be used later in client tools.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agounittest: Remove test_sambafs_srv_pipe
Volker Lendecke [Thu, 17 Jun 2021 06:31:32 +0000 (08:31 +0200)]
unittest: Remove test_sambafs_srv_pipe

is_known_pipename() will be removed soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3:printing: Move pcap_cache_loaded() to load.c
Volker Lendecke [Wed, 16 Jun 2021 06:31:56 +0000 (08:31 +0200)]
s3:printing: Move pcap_cache_loaded() to load.c

A future patch will remove the PRINTING dependency from smbd, but in
delete_and_reload_printers() we still reference it.

Maybe at some later stage we can remove reload_printers() overall, we
don't really need to load the full printer list into every smbd. All
we need is to load them on-demand for explicit listing functions, but
there we can throw them away again. And when someone connects to the
printer, we can also load them on demand.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agosmbcontrol: Add rpc-dump-status
Volker Lendecke [Sun, 28 Feb 2021 21:03:01 +0000 (22:03 +0100)]
smbcontrol: Add rpc-dump-status

Get status information out of samba-dcerpcd and its RPC helpers.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3:rpc_client: Add rpc_pipe_open_local_np()
Volker Lendecke [Wed, 7 Apr 2021 07:19:27 +0000 (07:19 +0000)]
s3:rpc_client: Add rpc_pipe_open_local_np()

Helper routine to connect to bind to a locally started rpcd_* process's
rpc interface.

Based upon local_np_connect() to start samba-dcerpcd on demand if it's
not there, designed to replace our internal RPC interfaces where the
RPC server runs in the same process. This will be called from winbindd_cm.c
and source3/rpc_server/rpc_ncacn_np.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3:rpc_server: Implement the rpcd_* helper-end of the samba-dcerpc protocol
Volker Lendecke [Wed, 7 Apr 2021 07:00:23 +0000 (07:00 +0000)]
s3:rpc_server: Implement the rpcd_* helper-end of the samba-dcerpc protocol

This is the generic code that becomes the
template that all rpcd_* instances that
serve DCERPC can use to provide services to samba-dcerpcd.

The external entry point is:
rpc_worker_main() which takes an argc/argv list
and two functions:

get_interfaces() - List all interfaces that this server provides
get_servers() - Provide the RPC server implementations

Each rpcd_* service needs only to provide
the implementations of get_interfaces() and get_servers()
and call rpc_worker_main() from their main() function
to provide services that can be connected to from samba-dcerpcd.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3:rpc_client: Add local_np_connect()
Volker Lendecke [Wed, 7 Apr 2021 07:07:50 +0000 (07:07 +0000)]
s3:rpc_client: Add local_np_connect()

This will be used for internal pipe connects. It starts samba_dcerpc
on demand if it's not there yet, so long as smb.conf [global]
has "rpc start on demand helpers = true" (the default setting).

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3:rpc_server: Add samba-dcerpcd
Volker Lendecke [Wed, 9 Jun 2021 06:37:06 +0000 (08:37 +0200)]
s3:rpc_server: Add samba-dcerpcd

Central dispatcher for incoming RPC requests, supported by helpers
that implement RPC services.

Upon startup, it asks all helpers which interfaces and endpoints to
listen on so it doesn't interfere with the samba binary when we're
configured as an Active Directory Domain Controller, then samba-dcerpcd
opens the relevant sockets. Once clients connect, start required helpers
and tell them to shut down once idle for a while.

Can be started as a full standalone daemon without smbd involved or as
a helper daemon started on demand by smbd or winbind or other local
processes trying to connect to a named pipe based RPC service.

NB. To start as a standalone daemon the smb.conf [global] option
"rpc start on demand helpers = false" must be set.
By default "rpc start on demand helpers = true"
in order to allow upgrades without needing an smb.conf change.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agodocs-xml: Add "rpc start on demand helpers", true by default.
Jeremy Allison [Mon, 4 Oct 2021 21:39:03 +0000 (14:39 -0700)]
docs-xml: Add "rpc start on demand helpers", true by default.

If "true" allow smbd and winbindd to spawn samba-dcerpcd
as a named pipe helper. Allows upgrade without any change
to smb.conf. If samba-dcerpcd is run as a daemon this
must be set to "false".

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoidl: Define messages sent between samba-dcerpcd and rpcd's
Volker Lendecke [Wed, 9 Jun 2021 06:27:36 +0000 (08:27 +0200)]
idl: Define messages sent between samba-dcerpcd and rpcd's

MSG_RPC_DUMP_STATUS will be like pool-usage carrying a file descriptor to
report status to, the other two are described in rpc_host.idl.

NOALIGN on rpc_worker_status: This makes it easier to count bytes to
push into a static buffer.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agodcesrv_core: Add dcesrv_loop_next_packet()
Volker Lendecke [Thu, 21 Jan 2021 14:28:31 +0000 (15:28 +0100)]
dcesrv_core: Add dcesrv_loop_next_packet()

This is used by the helpers of samba-dcerpcd: When accepting a DCERPC
client, normally the server engine would read the initial bind
packet. In case of samba-dcerpcd the bind packet will already be read
from the socket, so we need to inject it into the rpc server engine
externally.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agobackupkey.idl: Don't listen on \\pipe\ntsvcs
Volker Lendecke [Thu, 4 Mar 2021 17:53:37 +0000 (18:53 +0100)]
backupkey.idl: Don't listen on \\pipe\ntsvcs

[MS-BKRP] says it SHOULD listen here. In the ad dc, this conflicts
with smbd's srv_ntsvcs_nt.c listening also on nt ntsvcs unix domain
socket. Because "samba" starts smbd after itself, smbd takes over the
socket anyway, backupkey can't have been reached over this transport.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agodcesrv_core: Add dcesrv_context_set_callbacks()
Volker Lendecke [Tue, 2 Feb 2021 14:10:38 +0000 (15:10 +0100)]
dcesrv_core: Add dcesrv_context_set_callbacks()

We'll need to set custom callbacks on source3's global_dcesrv_ctx,
which right now is deeply embedded. Once we have everything more
nicely layered, this can go again.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3:rpc_client: Bump debug level for ncalrpc connect error
Volker Lendecke [Thu, 8 Jul 2021 07:48:07 +0000 (09:48 +0200)]
s3:rpc_client: Bump debug level for ncalrpc connect error

This does not have to go to syslog by default always, it might be just
a daemon not listening.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3:rpc_server: Remove direct registry access from svcctl_init_winreg
Volker Lendecke [Sun, 13 Jun 2021 05:48:01 +0000 (07:48 +0200)]
s3:rpc_server: Remove direct registry access from svcctl_init_winreg

Once we do registry access via a pipe into a different process, a
registry client won't be able to directly do registry transactions
anymore. In this case, I argue that doing this in a transactioned way
is overkill anyway. svcctl_init_winreg() just sets up some registry
keys, and if that leaves behind some stale entries if it fails
somewhere in the middle, it does not really matter because the only
one looking at these registry keys is the svcctl service, and that
only starts up if the init function was successfully run.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3:services: Disable rcinit-based service control code
Volker Lendecke [Mon, 14 Jun 2021 05:54:55 +0000 (07:54 +0200)]
s3:services: Disable rcinit-based service control code

This is a become_root user callout that I have never seen in use in
more than 20 years of Samba. Why disable now? In the next commit I
need to make a change to initializing the registry values for
services, the svcctl service won't be able to do registry transactions
anymore. I'm not sure that going without transactions is 100% safe in
all failure cases, so I decided to propose disabling the problematic
code that might lead to security issues.

One fix might be to add a lot more validation code to
_svcctl_OpenServiceW() to see whether the registry values underlying
the service are sane.

Yes, this is technical debt, but I would question that starting unix
daemons via DCERPC used at all out there.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agotest: Prime the kpasswd server
Volker Lendecke [Wed, 1 Sep 2021 10:04:43 +0000 (12:04 +0200)]
test: Prime the kpasswd server

I was getting this failure:

[102(815)/143 at 10m59s] samba4.blackbox.net_ads_dns(ad_member:local)(ad_member:local)
UNEXPECTED(failure): samba4.blackbox.net_ads_dns(ad_member:local).Adding an unprivileged user(ad_member:local)
REASON: Exception: Exception: Could not add user unprivuser. Error setting password Incorrect net address

My preliminary analysis shows that the KRB5KRB_AP_ERR_BADADDR error
message is triggered by the libkrb5 client code. I have not yet shown
this to happen with pure libkrb5, but my theory is the following:

k5_privsafe_check_addrs() fails under the following circumstances: The
kpasswd server is contacted on IPv4 and is slow to reply. After
waiting a bit, libkrb5 also tries to contact kpasswd on
IPv6. kpasswd_sendto_msg_callback() for the IPv6 request changes the
authentication context's local_addr to IPv6. Then the IPv4 request is
replied to, and then k5_privsafe_check_addrs() bails on the address
family in ac->local_addr (IPv6) vs the one received and via the IPv4
connection.

libkrb5's src/lib/krb5/os/changepw.c has this comment:

    /*
     * TBD:  Does this tamper w/ the auth context in such a way
     * to break us?  Yes - provide 1 per conn-state / host...
     */

I think we're hit by this.

This patch hacks around the situation by priming the kpasswd server
without error checking. If the initial v4 request is quick enough
because the kpasswd server is already started up properly, everything
works flawlessly.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agorpc_server: Check info5->transport
Volker Lendecke [Sun, 28 Nov 2021 15:19:56 +0000 (16:19 +0100)]
rpc_server: Check info5->transport

Eventually, this new mechanism might replace the ncalrpc_as_system mechanism: I
think with this we're much more flexible and even more secure: We rely on the
direct permissions on "np/" and don't have to pretend that the local client
came from a file on /root. We are more flexible because with this mechanism we
can easily fake arbitrary tokens and play with session keys.

However, this would require that the source4 librpc code needs to learn about
this mechanism, which I was not able to complete.

The source3 rpc_server side of this will go away soon, so for now only
allow NCACN_NP there. The check in source4 will stay with us for a
while, so allow NCACN_NP and NCALRPC to be set remotely here. With
NCACN_NP (the case for a client to connect on a named pipe), protect
against accidentially connecting as system.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agolibrpc: Get transport out of tstream_npa_accept_existing_recv()
Volker Lendecke [Sun, 28 Nov 2021 07:48:58 +0000 (08:48 +0100)]
librpc: Get transport out of tstream_npa_accept_existing_recv()

To be used by the RPC servers in the next commit

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoauth: Fix a typo in auth/gensec/ncalrpc.c
Volker Lendecke [Sat, 27 Nov 2021 15:42:00 +0000 (16:42 +0100)]
auth: Fix a typo in auth/gensec/ncalrpc.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agolibrpc: Add named_pipe_auth_req_info5->transport
Volker Lendecke [Sat, 27 Nov 2021 15:38:38 +0000 (16:38 +0100)]
librpc: Add named_pipe_auth_req_info5->transport

This will serve as a check to make sure that in particular a SAMR
client is really root. This is for example used in get_user_info_18()
handing out a machine password.

The unix domain sockets for NCACN_NP can only be contacted by root,
the "np\" subdirectory for those sockets is root/root 0700.

Connecting to such a socket is done in two situations: First, local
real root processes connecting and smbd on behalf of SMB clients
connecting to \\pipe\name, smbd does become_root() there. Via the
named_pipe_auth_req_info4 smbd hands over the SMB session information
that the RPC server blindly trusts. The session information (i.e. the
NT token) is heavily influenced by external sources like the KDC. It
is highly unlikely that we get a system token via SMB, but who knows,
this is information not fully controlled by smbd.

This is where this additional field in named_pipe_auth_req_info5 makes
a difference: This field is set to NCACN_NP by smbd's code, not
directly controlled by the clients. Other clients directly connecting
to a socket in "np\" is root anyway (only smbd can do become_root())
and can set this field to NCALRPC.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agonamed_pipe_auth.idl: Add "need_idle_server"
Volker Lendecke [Wed, 9 Jun 2021 04:09:37 +0000 (06:09 +0200)]
named_pipe_auth.idl: Add "need_idle_server"

Once RPC services are done by individual processes, we need to avoid
recursion between processes:

Any RPC server process will be able to serve multiple client requests
simultaneously, but each request is served in a single-threaded
blocking manner.

For example the netlogon RPC service needs to ask samr for
something. The netlogon->samr connection will initially be handled by
a central dispatcher assigning clients to processes. This dispatcher
needs to know that this connection can't end up in the same process
that originated the request.

With this flag an RPC client can request a samr server process that
exclusively serves its own requests and that will not serve anybody
else while serving netlogon.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agonamed_pipe_auth: Bump info4 to info5
Volker Lendecke [Fri, 12 Nov 2021 18:24:33 +0000 (19:24 +0100)]
named_pipe_auth: Bump info4 to info5

We'll add a field soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoUpdate WHATSNEW.txt with removal of wildcard copy, rename and unlink.
Jeremy Allison [Tue, 7 Dec 2021 18:25:38 +0000 (10:25 -0800)]
Update WHATSNEW.txt with removal of wildcard copy, rename and unlink.

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 Dec  9 18:57:15 UTC 2021 on sn-devel-184

2 years agos3: smbd: Remove 'const char *src_original_lcomp' from reply_mv().
Jeremy Allison [Thu, 2 Dec 2021 00:40:55 +0000 (16:40 -0800)]
s3: smbd: Remove 'const char *src_original_lcomp' from reply_mv().

No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Remove 'const char *src_original_lcomp' parameter from rename_internals().
Jeremy Allison [Thu, 2 Dec 2021 00:39:42 +0000 (16:39 -0800)]
s3: smbd: Remove 'const char *src_original_lcomp' parameter from rename_internals().

No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Inside rename_internals() remove '{ ... }' block around singleton rename...
Jeremy Allison [Thu, 2 Dec 2021 00:35:54 +0000 (16:35 -0800)]
s3: smbd: Inside rename_internals() remove '{ ... }' block around singleton rename code.

Best viewed with 'git show -b'

As we're touching the DEBUG() code, change it to modern DBG_NOTICE().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Remove the commented out resolve_wildcards().
Jeremy Allison [Thu, 2 Dec 2021 00:31:36 +0000 (16:31 -0800)]
s3: smbd: Remove the commented out resolve_wildcards().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Remove all wildcard code from rename_internals().
Jeremy Allison [Thu, 2 Dec 2021 00:29:43 +0000 (16:29 -0800)]
s3: smbd: Remove all wildcard code from rename_internals().

We no longer use resolve_wildcards() so comment it out
for later removal. Keep the '{ ... }' block around the
singleton rename for now, to keep the diff small.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Remove dest_has_wild and all associated code from rename_internals()
Jeremy Allison [Thu, 2 Dec 2021 00:26:28 +0000 (16:26 -0800)]
s3: smbd: Remove dest_has_wild and all associated code from rename_internals()

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Prepare to remove wildcard matching from rename_internals().
Jeremy Allison [Thu, 2 Dec 2021 00:25:03 +0000 (16:25 -0800)]
s3: smbd: Prepare to remove wildcard matching from rename_internals().

src_has_wild and dest_has_wild can never be true.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: In reply_ntrename() remove 'bool dest_has_wcard' and all uses.
Jeremy Allison [Thu, 2 Dec 2021 00:17:51 +0000 (16:17 -0800)]
s3: smbd: In reply_ntrename() remove 'bool dest_has_wcard' and all uses.

It's always false now.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: In reply_ntrename(), never set dest_has_wcard.
Jeremy Allison [Thu, 2 Dec 2021 00:14:57 +0000 (16:14 -0800)]
s3: smbd: In reply_ntrename(), never set dest_has_wcard.

It can never be true.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: In reply_ntrename() remove the UCF_ALWAYS_ALLOW_WCARD_LCOMP flag for destin...
Jeremy Allison [Thu, 2 Dec 2021 00:12:46 +0000 (16:12 -0800)]
s3: smbd: In reply_ntrename() remove the UCF_ALWAYS_ALLOW_WCARD_LCOMP flag for destination lookups.

We know the destination will never be a wildcard.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: In SMBntrename (0xa5) prevent wildcards in destination name.
Jeremy Allison [Thu, 2 Dec 2021 00:08:13 +0000 (16:08 -0800)]
s3: smbd: In SMBntrename (0xa5) prevent wildcards in destination name.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: In smb_file_rename_information() (SMB_FILE_RENAME_INFORMATION info level...
Jeremy Allison [Thu, 2 Dec 2021 00:07:07 +0000 (16:07 -0800)]
s3: smbd: In smb_file_rename_information() (SMB_FILE_RENAME_INFORMATION info level) prevent destination wildcards.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Remove UCF_ALWAYS_ALLOW_WCARD_LCOMP flag from pathname processing in reply_...
Jeremy Allison [Wed, 1 Dec 2021 21:56:31 +0000 (13:56 -0800)]
s3: smbd: Remove UCF_ALWAYS_ALLOW_WCARD_LCOMP flag from pathname processing in reply_mv().

We are no longer supporting wildcard rename via SMBmv (0x7)
as WindowsXP SMB1 and above do not use it.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Remove 'bool has_wild' parameter from unlink_internals().
Jeremy Allison [Wed, 1 Dec 2021 21:03:03 +0000 (13:03 -0800)]
s3: smbd: Remove 'bool has_wild' parameter from unlink_internals().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Change unlink_internals() to ignore has_wild parameter.
Jeremy Allison [Wed, 1 Dec 2021 20:53:29 +0000 (12:53 -0800)]
s3: smbd: Change unlink_internals() to ignore has_wild parameter.

It's always passed as false now so we can remove the (horrible)
enumeration code for unlink.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: In reply_unlink() remove the possibility of receiving a wildcard name.
Jeremy Allison [Wed, 1 Dec 2021 20:31:44 +0000 (12:31 -0800)]
s3: smbd: In reply_unlink() remove the possibility of receiving a wildcard name.

This was the only user of "has_wild=true" passed to
unlink_internals().

Next commit will remove this functionality from unlink_internals().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Remove support for SMBcopy SMB_COM_COPY (0x29)
Jeremy Allison [Wed, 1 Dec 2021 20:24:07 +0000 (12:24 -0800)]
s3: smbd: Remove support for SMBcopy SMB_COM_COPY (0x29)

It's not used in our client code or tested.

From MS-CIFS.

This command was introduced in the LAN Manager 1.0 dialect
It was rendered obsolete in the NT LAN Manager dialect.
This command was used to perform server-side file copies, but
is no longer used. Clients SHOULD
NOT send requests using this command code.
Servers receiving requests with this command code
SHOULD return STATUS_NOT_IMPLEMENTED (ERRDOS/ERRbadfunc).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: torture: Remove the wildcard unlink test code.
Jeremy Allison [Wed, 1 Dec 2021 20:18:35 +0000 (12:18 -0800)]
s3: torture: Remove the wildcard unlink test code.

This is pre WindowXP SMB1 functionality, and we
need to remove this from the server in order to
move towards SMB2-only, so the test must go.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos4: torture: Remove the wildcard rename test code.
Jeremy Allison [Wed, 1 Dec 2021 21:22:39 +0000 (13:22 -0800)]
s4: torture: Remove the wildcard rename test code.

This is pre WindowXP SMB1 functionality, and we
need to remove this from the server in order to
move towards SMB2-only, so the test must go.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos4: torture: Remove the wildcard unlink test code.
Jeremy Allison [Wed, 1 Dec 2021 20:05:20 +0000 (12:05 -0800)]
s4: torture: Remove the wildcard unlink test code.

This is pre WindowXP SMB1 functionality, and we
need to remove this from the server in order to
move towards SMB2-only, so the test must go.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: torture: In run_smb1_wild_mangle_unlink_test() use a valid pathname for rename...
Jeremy Allison [Thu, 2 Dec 2021 22:10:41 +0000 (14:10 -0800)]
s3: torture: In run_smb1_wild_mangle_unlink_test() use a valid pathname for rename target.

The server will not be supporting wildcard rename soon.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: torture: In torture_mangle(), use torture_deltree() for setup and cleanup.
Jeremy Allison [Thu, 2 Dec 2021 22:21:47 +0000 (14:21 -0800)]
s3: torture: In torture_mangle(), use torture_deltree() for setup and cleanup.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>