[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Fri Mar 31 06:08:01 UTC 2023


The branch, master has been updated
       via  360b7394644 s3: smbd: Fix dumb typos that meant smb1.SMB1-DFS-* tests were running against an SMB2-only fileserver.
       via  c3f48b0581e s3: smbd: Remove now unused dfs_filename_convert().
       via  e0ac0a2562c smbd: RIP DFS pathname processing in filename_convert_dirfsp_nosymlink()
       via  777e324efbb s3: smbd: In smb_file_link_information() and smb_file_rename_information() the target path is never DFS.
       via  f32215dbac2 smbd: use smb1_strip_dfs_path() in call_trans2findfirst()
       via  f539e632bb6 smbd: use smb1_strip_dfs_path() in reply_search()
       via  fc3df8f5968 smbd: use smb1_strip_dfs_path() in call_trans2mkdir()
       via  6187aaaa381 smbd: use smb1_strip_dfs_path() in call_trans2setpathinfo()
       via  32a1f381137 smbd: use smb1_strip_dfs_path() in smb_set_file_unix_hlink()
       via  adb34770fc2 smbd: use smb1_strip_dfs_path() in call_trans2qpathinfo()
       via  96765e535d7 smbd: use smb1_strip_dfs_path() in call_trans2open()
       via  2c4e4c22eac smbd: use smb1_strip_dfs_path() in reply_mv()
       via  c3a87ffb632 smbd: use smb1_strip_dfs_path() in reply_mv()
       via  c44491676ea smbd: use smb1_strip_dfs_path() in reply_rmdir()
       via  9c151af3135 smbd: use smb1_strip_dfs_path() in reply_mkdir()
       via  7ff2473bedc smbd: use smb1_strip_dfs_path() in reply_unlink()
       via  0d298ff757e smbd: use smb1_strip_dfs_path() in reply_ctemp()
       via  574b1369b7a smbd: use smb1_strip_dfs_path() in reply_mknew()
       via  e4fbaae22bf smbd: use smb1_strip_dfs_path() in reply_open_and_X()
       via  ba325ca2d26 smbd: use smb1_strip_dfs_path() in reply_open()
       via  0cb37f78c1c smbd: use smb1_strip_dfs_path() in reply_setatr()
       via  00c836436e0 smbd: use smb1_strip_dfs_path() in reply_getatr
       via  004d14a0244 smbd: use smb1_strip_dfs_path() in reply_checkpath()
       via  d5b5589d012 smbd: use smb1_strip_dfs_path() in reply_ntrename()
       via  0089ea2a31e smbd: use smb1_strip_dfs_path() in reply_ntrename()
       via  666e42ef5b3 smbd: use smb1_strip_dfs_path() in call_nt_transact_create()
       via  8ad023c1990 smbd: use smb1_strip_dfs_path() in reply_ntcreate_and_X()
       via  66d7996dbcf s3: smbd: Add utility function smb1_strip_dfs_path().
       via  06c738738ea s3: smbd: Remove unused and commented out check_path_syntax_smb2_msdfs().
       via  34fabc26f1d s3: smbd: Remove 'is_dfs' parameter to check_path_syntax_smb2().
       via  31f5c714c60 s3: smbd: Add assertion to filename_convert_dirfsp_nosymlink() that shows SMB2 is *never* dealing with a DFS path here.
       via  2c40e28908e s3: smbd: Remove all DFS path prefixes before passing to check_path_syntax_smb2().
       via  39ad689eeac s3: smbd: Add utility function smb2_strip_dfs_path().
       via  1b510ca2d98 s3: smbd: Change smb2_file_link_information() to use srvstr_pull_talloc()/check_path_syntax_smb2().
       via  b3fdc892b4f s3: smbd: In smb2_file_link_information(), don't ever expect @GMT tokens in the pathname.
       via  377c50abe91 s3: smbd: Duplicate smb_file_link_information() hardlink handling as smb2_file_link_information().
       via  4c5a07ed4e0 s3: smbd: Cleanup. smb2_file_rename_information() can never have a @GMT path in the destination.
       via  bb92df7c9e5 s3: smbd: Cleanup - don't set the FLAGS2_DFS_PATHNAMES in flags2 in the glue struct if it's not a DFS server or share.
      from  ea4be00361e selftest: Add test parsing krb5 PAC claims via ndrdump

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 360b739464461acece91c04b8a29da30a022ac23
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 30 13:19:22 2023 -0700

    s3: smbd: Fix dumb typos that meant smb1.SMB1-DFS-* tests were running against an SMB2-only fileserver.
    
    Remove knownfail on SMB1-DFS-SEARCH-PATHS, as we now
    pass it with the new SMB1 remove DFS paths before pathname processing
    changes.
    
    Note, we still fail:
    
    smb1.SMB1-DFS-PATHS.smbtorture\(fileserver_smb1\)
    smb1.SMB1-DFS-OPERATIONS.smbtorture\(fileserver_smb1\)
    
    even with the new SMB1 remove DFS paths before pathname
    processing as those tests test *very* specific Windows behaviors. We now
    pass many more of the individual internal tests, but
    in order to pass them all completely I need to add
    specific --with-sambaserver checks to avoid some
    of the Windows DFS SMB1 insanity (error messages).
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Fri Mar 31 06:07:01 UTC 2023 on atb-devel-224

commit c3f48b0581e5a948d1f31c8a65e8294aa6c92591
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 30 13:01:08 2023 -0700

    s3: smbd: Remove now unused dfs_filename_convert().
    
    And all the static functions it called.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit e0ac0a2562ccf8863224ca6ffb3a8e76febe19e0
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:22:31 2023 +0200

    smbd: RIP DFS pathname processing in filename_convert_dirfsp_nosymlink()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 777e324efbbfadf7e1afdabf2c465102f07c9301
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 30 13:02:01 2023 -0700

    s3: smbd: In smb_file_link_information() and smb_file_rename_information() the target path is never DFS.
    
    Ensure we strip from ucs_flags before calling filename_convert_dirfsp().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit f32215dbac26db796905ddd4863f1df22a964cd6
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:44:07 2023 +0200

    smbd: use smb1_strip_dfs_path() in call_trans2findfirst()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f539e632bb65b1583ce93804e9012ed3089c03ba
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:43:58 2023 +0200

    smbd: use smb1_strip_dfs_path() in reply_search()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit fc3df8f5968b0cdb46e0d6275267130d9b4578fc
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:10:31 2023 +0200

    smbd: use smb1_strip_dfs_path() in call_trans2mkdir()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 6187aaaa3811b1877737e161f272699d94e81dc2
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:09:48 2023 +0200

    smbd: use smb1_strip_dfs_path() in call_trans2setpathinfo()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 32a1f381137719e52f83e35321292cc7d3f25521
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:08:53 2023 +0200

    smbd: use smb1_strip_dfs_path() in smb_set_file_unix_hlink()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit adb34770fc2185fefcece9e9abba016bd6f34096
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:08:11 2023 +0200

    smbd: use smb1_strip_dfs_path() in call_trans2qpathinfo()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 96765e535d70f683599c57c0334075a70b9200b3
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:07:05 2023 +0200

    smbd: use smb1_strip_dfs_path() in call_trans2open()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2c4e4c22eacd89bdd61e4fd3d690769bde044151
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:06:44 2023 +0200

    smbd: use smb1_strip_dfs_path() in reply_mv()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c3a87ffb632fd8e42605e9eede6a69efa18f82e5
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:06:04 2023 +0200

    smbd: use smb1_strip_dfs_path() in reply_mv()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c44491676ea6ac288b901983923b0ed6e8712eda
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:05:04 2023 +0200

    smbd: use smb1_strip_dfs_path() in reply_rmdir()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9c151af3135b60360bd2de0f6df6a7ec9ad35cb7
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:04:31 2023 +0200

    smbd: use smb1_strip_dfs_path() in reply_mkdir()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 7ff2473bedceed7e406cf059736149bccb1e78d6
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:04:02 2023 +0200

    smbd: use smb1_strip_dfs_path() in reply_unlink()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 0d298ff757e1cb123a539765b998408cabe394d8
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:03:30 2023 +0200

    smbd: use smb1_strip_dfs_path() in reply_ctemp()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 574b1369b7aafd864231e1c45e348c089ebd6b0c
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:02:55 2023 +0200

    smbd: use smb1_strip_dfs_path() in reply_mknew()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e4fbaae22bf40897c24b82804fa662ae2ed5dd3b
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:02:32 2023 +0200

    smbd: use smb1_strip_dfs_path() in reply_open_and_X()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ba325ca2d267e818048b76ad2e262bd9fa8e3136
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:02:08 2023 +0200

    smbd: use smb1_strip_dfs_path() in reply_open()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 0cb37f78c1c7d381c7b271ec2147094182c9aa03
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:01:42 2023 +0200

    smbd: use smb1_strip_dfs_path() in reply_setatr()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 00c836436e03e23383b9b48c81f8e8b41283e2a9
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 16:01:17 2023 +0200

    smbd: use smb1_strip_dfs_path() in reply_getatr
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 004d14a0244f9cbd469f4aee850610250400775f
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 15:45:55 2023 +0200

    smbd: use smb1_strip_dfs_path() in reply_checkpath()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d5b5589d0120e1271dd0aad037bfa7d9c4f4e1ac
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 15:44:59 2023 +0200

    smbd: use smb1_strip_dfs_path() in reply_ntrename()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 0089ea2a31e4115e7cb9a04dac5b6b2bed7cc3a4
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 15:43:24 2023 +0200

    smbd: use smb1_strip_dfs_path() in reply_ntrename()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 666e42ef5b315c2f84e7b82c77d14e17d2102636
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 15:42:24 2023 +0200

    smbd: use smb1_strip_dfs_path() in call_nt_transact_create()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8ad023c199032c652e5d323c850af9eb57f3bd3b
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 15:41:43 2023 +0200

    smbd: use smb1_strip_dfs_path() in reply_ntcreate_and_X()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 66d7996dbcf84ded93d480eee7832543ca28580f
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 30 15:55:53 2023 +0200

    s3: smbd: Add utility function smb1_strip_dfs_path().
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Signed-off-by: Jeremy Allison <jra at samba.org>

commit 06c738738eae6e0e958f479291f2b51d543e9724
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 27 12:24:57 2023 -0700

    s3: smbd: Remove unused and commented out check_path_syntax_smb2_msdfs().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 34fabc26f1da160eba13e1af9c9eac9ae1373fd6
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 27 12:23:44 2023 -0700

    s3: smbd: Remove 'is_dfs' parameter to check_path_syntax_smb2().
    
    check_path_syntax_smb2() is now a simple wrapper around check_path_syntax().
    Leave it alone for now to keep things separate when we add SMB3+POSIX parsing.
    
    check_path_syntax_smb2_msdfs() is now no longer used.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 31f5c714c609cd91fb87058673c02e24f0dea42e
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 27 12:16:32 2023 -0700

    s3: smbd: Add assertion to filename_convert_dirfsp_nosymlink() that shows SMB2 is *never* dealing with a DFS path here.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 2c40e28908e9fab8dce7e50d3357b513d9af78c4
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 27 12:01:56 2023 -0700

    s3: smbd: Remove all DFS path prefixes before passing to check_path_syntax_smb2().
    
    In smb2, smb1req->flags2 now never uses FLAGS2_DFS_PATHNAMES,
    ucf_flags never has UCF_DFS_PATHNAME, and all calls to check_path_syntax_smb2()
    pass "false" in this is_dfs parameter.
    
    Remove all knownfails for smb2.SMB2-DFS* tests.
    
    Now I can clean up check_path_syntax_smb2() and add
    an assertion into filename_convert_dirfsp_nosymlink() that
    UCF_DFS_PATHNAME is *NEVER* set in the ucf_flags for an
    SMB2 connection.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 39ad689eeacd6a3dcaf24a9bd64d59295f00ddba
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 27 10:06:03 2023 -0700

    s3: smbd: Add utility function smb2_strip_dfs_path().
    
    Removes any DFS prefix from an SMB2 name. This will
    enable me to clean up the mess around SMB2 DFS path
    processing, remove some knownfails and eventually
    make it much easier to add SMB3+POSIX path processing
    now it can ignore DFS prefixes. Original idea from
    Volker.
    
    Not yet used.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 1b510ca2d98e8597ef1b186a5dac7482ca70c4cf
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 27 11:25:59 2023 -0700

    s3: smbd: Change smb2_file_link_information() to use srvstr_pull_talloc()/check_path_syntax_smb2().
    
    It now looks like all other SMB2 path processing and
    we can proceed to strip the DFS prefixes from SMB2 pathnames
    before further processing.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit b3fdc892b4fe2fa5e57a5acae32ae87174212edd
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 27 11:14:59 2023 -0700

    s3: smbd: In smb2_file_link_information(), don't ever expect @GMT tokens in the pathname.
    
    They're an SMB1 thing, not an SMB2 thing. It will always be (and always was) zero.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 377c50abe91d05908d37ba81bdbeece37c45ca6c
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 27 11:07:07 2023 -0700

    s3: smbd: Duplicate smb_file_link_information() hardlink handling as smb2_file_link_information().
    
    We're going to change the SMB2 path handling for DFS and I
    really don't want to try and mix these changes into the
    existing smb_file_link_information() code.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 4c5a07ed4e04b2c52de84dee1083705714fa45a5
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 27 10:43:55 2023 -0700

    s3: smbd: Cleanup. smb2_file_rename_information() can never have a @GMT path in the destination.
    
    That's an SMB1 thing. It will always be (and always was) zero.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit bb92df7c9e541073e69c6185111d330fa90c98a4
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 27 09:48:26 2023 -0700

    s3: smbd: Cleanup - don't set the FLAGS2_DFS_PATHNAMES in flags2 in the glue struct if it's not a DFS server or share.
    
    Even if the client claims it's a DFS pathname. Matches what Windows does if it gets
    a DFS pathname on a non-DFS share.
    
    Remove samba3.smbtorture_s3.smb2.SMB2-NON-DFS-SHARE.smbtorture\(fileserver\)
    test knownfail.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 selftest/knownfail.d/dfs_paths |   8 +-
 source3/selftest/tests.py      |   6 +-
 source3/smbd/filename.c        |  25 +---
 source3/smbd/msdfs.c           | 295 -----------------------------------------
 source3/smbd/proto.h           |  11 +-
 source3/smbd/smb1_nttrans.c    |  23 ++++
 source3/smbd/smb1_reply.c      | 142 ++++++++++++++++++++
 source3/smbd/smb1_trans2.c     |  30 +++++
 source3/smbd/smb2_create.c     |  61 ++++++++-
 source3/smbd/smb2_glue.c       |   9 +-
 source3/smbd/smb2_reply.c      |  91 ++++++++-----
 source3/smbd/smb2_trans2.c     | 127 ++++++++++++++++--
 12 files changed, 441 insertions(+), 387 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/knownfail.d/dfs_paths b/selftest/knownfail.d/dfs_paths
index 127c0492f51..fb7b832d157 100644
--- a/selftest/knownfail.d/dfs_paths
+++ b/selftest/knownfail.d/dfs_paths
@@ -1,6 +1,2 @@
-^samba3.smbtorture_s3.smb2.SMB2-DFS-PATHS.smbtorture\(fileserver\)
-^samba3.smbtorture_s3.smb2.SMB2-NON-DFS-SHARE.smbtorture\(fileserver\)
-^samba3.smbtorture_s3.smb2.SMB2-DFS-SHARE-NON-DFS-PATH.smbtorture\(fileserver\)
-^samba3.smbtorture_s3.smb1.SMB1-DFS-PATHS.smbtorture\(fileserver\)
-^samba3.smbtorture_s3.smb1.SMB1-DFS-SEARCH-PATHS.smbtorture\(fileserver\)
-^samba3.smbtorture_s3.smb1.SMB1-DFS-OPERATIONS.smbtorture\(fileserver\)
+^samba3.smbtorture_s3.smb1.SMB1-DFS-PATHS.smbtorture\(fileserver_smb1\)
+^samba3.smbtorture_s3.smb1.SMB1-DFS-OPERATIONS.smbtorture\(fileserver_smb1\)
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 98b4eb361c3..31112d4be9f 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -313,7 +313,7 @@ plantestsuite("samba3.smbtorture_s3.smb2.SMB2-DFS-SHARE-NON-DFS-PATH",
 # incoming DFS pathnames and how they map to local paths.
 #
 plantestsuite("samba3.smbtorture_s3.smb1.SMB1-DFS-PATHS",
-                "fileserver",
+                "fileserver_smb1",
                 [os.path.join(samba3srcdir,
                               "script/tests/test_smbtorture_s3.sh"),
                 'SMB1-DFS-PATHS',
@@ -329,7 +329,7 @@ plantestsuite("samba3.smbtorture_s3.smb1.SMB1-DFS-PATHS",
 # incoming DFS pathnames and how they map to local paths.
 #
 plantestsuite("samba3.smbtorture_s3.smb1.SMB1-DFS-SEARCH-PATHS",
-                "fileserver",
+                "fileserver_smb1",
                 [os.path.join(samba3srcdir,
                               "script/tests/test_smbtorture_s3.sh"),
                 'SMB1-DFS-SEARCH-PATHS',
@@ -345,7 +345,7 @@ plantestsuite("samba3.smbtorture_s3.smb1.SMB1-DFS-SEARCH-PATHS",
 # incoming DFS pathnames and how they map to local paths.
 #
 plantestsuite("samba3.smbtorture_s3.smb1.SMB1-DFS-OPERATIONS",
-                "fileserver",
+                "fileserver_smb1",
                 [os.path.join(samba3srcdir,
                               "script/tests/test_smbtorture_s3.sh"),
                 'SMB1-DFS-OPERATIONS',
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 78f552de9b2..e5cb3c867cd 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -1024,30 +1024,7 @@ static NTSTATUS filename_convert_dirfsp_nosymlink(
 	bool ok;
 	NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
 
-	if (ucf_flags & UCF_DFS_PATHNAME) {
-		/*
-		 * We've been given a raw DFS pathname.
-		 */
-		char *pathname = NULL;
-		DBG_DEBUG("Before dfs_filename_convert name_in: %s\n",
-			  name_in);
-		status = dfs_filename_convert(mem_ctx,
-					      conn,
-					      ucf_flags,
-					      name_in,
-					      &pathname);
-		if (!NT_STATUS_IS_OK(status)) {
-			DBG_DEBUG("dfs_filename_convert "
-				"failed for name %s with %s\n",
-				name_in,
-				nt_errstr(status));
-			return status;
-		}
-		ucf_flags &= ~UCF_DFS_PATHNAME;
-		name_in = pathname;
-		DBG_DEBUG("After dfs_filename_convert name_in: %s\n",
-			  name_in);
-	}
+	SMB_ASSERT(!(ucf_flags & UCF_DFS_PATHNAME));
 
 	if (is_fake_file_path(name_in)) {
 		smb_fname = synthetic_smb_fname_split(mem_ctx, name_in, posix);
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index 6b99f3c1eb1..a0b59da1fcf 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -36,45 +36,6 @@
 #include "lib/global_contexts.h"
 #include "source3/lib/substitute.h"
 
-/**********************************************************************
- Function to determine if a given sharename matches a connection.
-**********************************************************************/
-
-static bool msdfs_servicename_matches_connection(struct connection_struct *conn,
-						 const char *servicename,
-						 const char *vfs_user)
-{
-	const struct loadparm_substitution *lp_sub =
-		loadparm_s3_global_substitution();
-	char *conn_servicename = NULL;
-	int snum;
-	bool match = false;
-
-	snum = SNUM(conn);
-
-	conn_servicename = lp_servicename(talloc_tos(), lp_sub, snum);
-	if (conn_servicename == NULL) {
-		DBG_ERR("lp_servicename() failed, OOM!\n");
-		return false;
-	}
-
-	if (strequal(servicename, conn_servicename)) {
-		match = true;
-		goto done;
-	}
-	if (strequal(servicename, HOMES_NAME)) {
-		match = true;
-		goto done;
-	}
-	if (strequal(vfs_user, conn_servicename)) {
-		match = true;
-		goto done;
-	}
-done:
-	TALLOC_FREE(conn_servicename);
-	return match;
-}
-
 /**********************************************************************
  Parse a DFS pathname of the form(s)
 
@@ -216,200 +177,6 @@ out:
 	return status;
 }
 
-/**********************************************************************
- Parse a DFS pathname of the form /hostname/service/reqpath
- into the dfs_path structure.
-
- NB. srvstr_get_path_internal() now *always* calls
- check_path_syntax_XXX() on an incoming name, so
- the path separator is now always '/', even from
- Windows clients.
-
- Unfortunately, due to broken clients who might set the
- SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES bit and then
- send a local path, we have to cope with that too....
-
- If conn != NULL then ensure the provided service is
- the one pointed to by the connection.
-
- This version does everything using pointers within one copy of the
- pathname string, talloced on the struct dfs_path pointer (which
- must be talloced). This may be too clever to live....
- JRA.
-**********************************************************************/
-
-static NTSTATUS parse_dfs_path(TALLOC_CTX *ctx,
-				connection_struct *conn,
-				const char *pathname,
-				char **_hostname,
-				char **_servicename,
-				char **_remaining_path)
-{
-	char *hostname = NULL;
-	char *pathname_local = NULL;
-	char *p = NULL;
-	char *servicename = NULL;
-	char *reqpath = NULL;
-	char *eos_ptr = NULL;
-	bool servicename_matches = false;
-	bool using_smb1 = !conn->sconn->using_smb2;
-
-	pathname_local = talloc_strdup(ctx, pathname);
-	if (pathname_local == NULL) {
-		return NT_STATUS_NO_MEMORY;
-	}
-	/*
-	 * parse_dfs_path() is only called from
-	 * dfs_filename_convert() with SMB1/2/3 DFS
-	 * names. Ensure we only have to cope with
-	 * '/' separators.
-	 */
-	string_replace(pathname_local, '\\', '/');
-
-	/* Get a pointer to the terminating '\0' */
-	eos_ptr = &pathname_local[strlen(pathname_local)];
-	p = pathname_local;
-
-	/*
-	 * SMB1 DFS paths sent to the fileserver should start with
-	 * the path separator '/'. However, libsmbclient libraries
-	 * will set the DFS bit on SMB1 calls and then send non-DFS
-	 * paths. We must cope with this.
-	 *
-	 * Note SMB2 paths sent to the fileserver never start with
-	 * the path separator '/'.
-	 */
-
-	if (using_smb1 && (*p != '/')) {
-		DBG_ERR("path %s doesn't start with /\n", p);
-		/*
-		 * Possibly client sent a local path by mistake.
-		 * Try and convert to a local path.
-		 * Note that this is an SMB1-only fallback
-		 * to cope with known broken SMB1 clients.
-		 */
-
-		hostname = eos_ptr; /* "" */
-		servicename = eos_ptr; /* "" */
-
-		DBG_ERR("trying to convert %s to a local path\n", p);
-		goto local_path;
-	}
-
-	/*
-	 * Safe to use on talloc'ed string as it only shrinks.
-	 * It also doesn't affect the eos_ptr.
-	 */
-	trim_char(p, '/', '/');
-
-	DBG_DEBUG("p = |%s| after trimming /'s\n", p);
-
-	/* Now tokenize. */
-	/* Parse out hostname. */
-	p = strchr(p,'/');
-	if(p == NULL) {
-		DBG_ERR("can't parse hostname from path %s\n", pathname_local);
-		/*
-		 * Possibly client sent a local path by mistake.
-		 * Try and convert to a local path.
-		 */
-
-		hostname = eos_ptr; /* "" */
-		servicename = eos_ptr; /* "" */
-
-		p = pathname_local;
-		DBG_ERR("trying to convert %s to a local path\n", p);
-		goto local_path;
-	}
-	*p = '\0';
-	hostname = pathname_local;
-
-	DBG_DEBUG("hostname: %s\n", hostname);
-
-	/* Parse out servicename. */
-	servicename = p+1;
-	p = strchr(servicename, '/');
-	if (p) {
-		*p = '\0';
-	}
-
-	/* Is this really our servicename ? */
-	servicename_matches = msdfs_servicename_matches_connection(
-					conn,
-					servicename,
-					get_current_username());
-
-	if (!servicename_matches) {
-		DBG_ERR("%s is not our servicename\n", servicename);
-
-		/*
-		 * Possibly client sent a local path by mistake.
-		 * Try and convert to a local path.
-		 */
-
-		/* Repair the path - replace the sepchar's
-		   we nulled out */
-		servicename--;
-		*servicename = '/';
-		if (p) {
-			*p = '/';
-		}
-
-		hostname = eos_ptr; /* "" */
-		servicename = eos_ptr; /* "" */
-
-		p = pathname_local;
-		DBG_ERR("trying to convert %s to a local path\n",
-			pathname_local);
-		goto local_path;
-	}
-
-	DBG_DEBUG("servicename: %s\n", servicename);
-
-	if(p == NULL) {
-		/* Client sent self referral \server\share. */
-		reqpath = eos_ptr; /* "" */
-		goto out;
-	}
-
-	p++;
-
-  local_path:
-
-	/*
-	 * As check_path_syntax_XXX() has already been
-	 * called we know this is a normal path containing
-	 * '/' separators.
-	 */
-
-	reqpath = p;
-
-  out:
-
-	DBG_DEBUG("rest of the path: %s\n", reqpath);
-
-	if (_hostname != NULL) {
-		*_hostname = talloc_strdup(ctx, hostname);
-		if (*_hostname == NULL) {
-			return NT_STATUS_NO_MEMORY;
-		}
-	}
-	if (_servicename != NULL) {
-		*_servicename = talloc_strdup(ctx, servicename);
-		if (*_servicename == NULL) {
-			return NT_STATUS_NO_MEMORY;
-		}
-	}
-	if (_remaining_path != NULL) {
-		*_remaining_path = talloc_strdup(ctx, reqpath);
-		if (*_remaining_path == NULL) {
-			return NT_STATUS_NO_MEMORY;
-		}
-	}
-	TALLOC_FREE(pathname_local);
-	return NT_STATUS_OK;
-}
-
 /********************************************************
  Fake up a connection struct for the VFS layer, for use in
  applications (such as the python bindings), that do not want the
@@ -1111,68 +878,6 @@ static NTSTATUS dfs_path_lookup(TALLOC_CTX *ctx,
 	return status;
 }
 
-/*****************************************************************
- Decides if a dfs pathname should be redirected or not.
- If not, the pathname is converted to a tcon-relative local unix path
- This is now a simple wrapper around parse_dfs_path()
- as it does all the required checks.
-*****************************************************************/
-
-NTSTATUS dfs_filename_convert(TALLOC_CTX *ctx,
-			      connection_struct *conn,
-			      uint32_t ucf_flags,
-			      const char *dfs_path_in,
-			      char **pp_path_out)
-{
-	char *reqpath = NULL;
-	NTSTATUS status;
-
-	/*
-	 * We must use the non-strict version of parse_dfs_path for
-	 * pathnames sent to the fileserver over SMB1/2/3.
-	 * libsmbclient callers always set the FLAGS2_DFS_PATHNAMES
-	 * but then don't send a DFS path in (for example) FindFirst
-	 * or other calls. This is a problem with our client libraries
-	 * for both SMB1 and SMB2+ and will remain so whilst broken
-	 * versions of libsmbclient are being used.
-	 */
-
-	status = parse_dfs_path(ctx,
-				conn,
-				dfs_path_in,
-				NULL, /* hostname */
-				NULL, /* servicename */
-				&reqpath);
-	if (!NT_STATUS_IS_OK(status)) {
-		return status;
-	}
-
-	/*
-	 * If parse_dfs_path fell back to a local path
-	 * after skipping hostname or servicename, ensure
-	 * we still have called check_path_syntax()
-	 * on the full returned local path. check_path_syntax()
-	 * is idempotent so this is safe.
-	 */
-	if (ucf_flags & UCF_POSIX_PATHNAMES) {
-		status = check_path_syntax_posix(reqpath);
-	} else {
-		status = check_path_syntax(reqpath);
-	}
-	if (!NT_STATUS_IS_OK(status)) {
-		return status;
-	}
-	/*
-	 * Previous (and current logic) just ignores
-	 * the server, share components if a DFS
-	 * path is sent on a non-DFS share except to
-	 * check that they match an existing share. Should
-	 * we tighten this up to return an error here ?
-	 */
-	*pp_path_out = reqpath;
-	return NT_STATUS_OK;
-}
-
 /**********************************************************************
  Return a self referral.
 **********************************************************************/
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 486d136bfbb..e8b3034970e 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -554,11 +554,6 @@ bool remove_msdfs_link(const struct junction_map *jucn,
 struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx,
 				      struct auth_session_info *session_info,
 				      size_t *p_num_jn);
-NTSTATUS dfs_filename_convert(TALLOC_CTX *ctx,
-			      connection_struct *conn,
-			      uint32_t ucf_flags,
-			      const char *dfs_path_in,
-			      char **pp_path_out);
 struct connection_struct;
 struct smb_filename;
 
@@ -935,7 +930,11 @@ bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
 
 NTSTATUS check_path_syntax(char *path);
 NTSTATUS check_path_syntax_posix(char *path);
-NTSTATUS check_path_syntax_smb2(char *path, bool dfs_path);
+NTSTATUS check_path_syntax_smb2(char *path);
+NTSTATUS smb1_strip_dfs_path(TALLOC_CTX *mem_ctx,
+			     uint32_t *ucf_flags,
+			     char **in_path);
+NTSTATUS smb2_strip_dfs_path(const char *in_path, const char **out_path);
 size_t srvstr_get_path(TALLOC_CTX *ctx,
 			const char *inbuf,
 			uint16_t smb_flags2,
diff --git a/source3/smbd/smb1_nttrans.c b/source3/smbd/smb1_nttrans.c
index 4a0cfcc1133..3cd8e416107 100644
--- a/source3/smbd/smb1_nttrans.c
+++ b/source3/smbd/smb1_nttrans.c
@@ -628,6 +628,12 @@ void reply_ntcreate_and_X(struct smb_request *req)
 	if (ucf_flags & UCF_GMT_PATHNAME) {
 		extract_snapshot_token(fname, &twrp);
 	}
+	status = smb1_strip_dfs_path(ctx, &ucf_flags, &fname);
+	if (!NT_STATUS_IS_OK(status)) {
+		reply_nterror(req, status);
+		goto out;
+	}
+
 	status = filename_convert_dirfsp(
 		ctx, conn, fname, ucf_flags, twrp, &dirfsp, &smb_fname);
 
@@ -1083,6 +1089,12 @@ static void call_nt_transact_create(connection_struct *conn,
 	if (ucf_flags & UCF_GMT_PATHNAME) {
 		extract_snapshot_token(fname, &twrp);
 	}
+	status = smb1_strip_dfs_path(ctx, &ucf_flags, &fname);
+	if (!NT_STATUS_IS_OK(status)) {
+		reply_nterror(req, status);
+		goto out;
+	}
+
 	status = filename_convert_dirfsp(ctx,
 					 conn,
 					 fname,
@@ -1470,6 +1482,12 @@ void reply_ntrename(struct smb_request *req)
 	if (ucf_flags_src & UCF_GMT_PATHNAME) {
 		extract_snapshot_token(oldname, &src_twrp);
 	}
+	status = smb1_strip_dfs_path(ctx, &ucf_flags_src, &oldname);
+	if (!NT_STATUS_IS_OK(status)) {
+		reply_nterror(req, status);
+		goto out;
+	}
+
 	status = filename_convert_dirfsp(ctx,
 					 conn,
 					 oldname,
@@ -1512,6 +1530,11 @@ void reply_ntrename(struct smb_request *req)
 			extract_snapshot_token(newname,
 					       &dst_twrp);
 		}
+		status = smb1_strip_dfs_path(ctx, &ucf_flags_dst, &newname);
+		if (!NT_STATUS_IS_OK(status)) {
+			reply_nterror(req, status);
+			goto out;
+		}
 		status = filename_convert_dirfsp(ctx,
 						 conn,
 						 newname,
diff --git a/source3/smbd/smb1_reply.c b/source3/smbd/smb1_reply.c
index 1041e4f843b..3fc2cc8e793 100644
--- a/source3/smbd/smb1_reply.c
+++ b/source3/smbd/smb1_reply.c
@@ -70,6 +70,78 @@ bool check_fsp_open(connection_struct *conn, struct smb_request *req,
 	return true;
 }
 
+/****************************************************************************
+ SMB1 version of smb2_strip_dfs_path()
+ Differs from SMB2 in that all Windows path separator '\' characters
+ have already been converted to '/' by check_path_syntax_internal().
+****************************************************************************/
+
+NTSTATUS smb1_strip_dfs_path(TALLOC_CTX *mem_ctx,
+			     uint32_t *_ucf_flags,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list