The branch, master has been updated via b4455f04879 s3: libsmb: In cli_posix_open_internal_send() (SMBtrans2:TRANSACT2_SETPATHINFO) check for DFS pathname. via fa7e6899b3b s3: libsmb: In cli_qpathinfo_send() (SMBtrans2:TRANSACT2_QPATHINFO) check for DFS pathname. via adc4a1b290a s3: libsmb: In cli_set_ea_path() (SMBtrans2:TRANSACT2_SETPATHINFO) check for DFS pathname. via 5c083e8bc3a s3: libsmb: In cli_ctemp_send() (SMBctemp) check for DFS pathname. via 6a82167f11f s3: libsmb: In cli_chkpath_send() (SMBcheckpath) check for DFS pathname. via a53c049c4de s3: libsmb: In cli_setatr_send() (SMBsetatr) check for DFS pathname. via 75339aec0ee s3: libsmb: In cli_getatr_send() (SMBgetatr) check for DFS pathname. via b58cee42512 s3: libsmb: In cli_openx_create() (SMBopenX) check for DFS pathname. via ab125722642 s3: libsmb: In cli_nttrans_create_send() (SMBnttrans:NT_TRANSACT_CREATE) check for DFS pathname. via 198869afecd s3: libsmb: In cli_ntcreate1_send() (SMBntcreateX) check for DFS pathname. via 8561eaa02d9 s3: libsmb: In cli_rmdir_send() (SMBrmdir) check for DFS pathname. via 47cf519e98f s3: libsmb: In cli_mkdir_send() (SMBmkdir) check for DFS pathname. via e2efea7d1f2 s3: libsmb: In cli_unlink_send() (SMBunlink) check for DFS pathname. via 73a6e2b14a1 s3: libsmb: In cli_ntrename_internal_send() (SMBntrename) check for DFS dst pathname. via f1765c9c7be s3: libsmb: In cli_ntrename_internal_send() (SMBntrename) check for DFS source pathname. via 44bf2bc89a4 s3: libsmb: In cli_cifs_rename_send() (SMBmv) check for DFS dst pathname. via 4da3c724d5b s3: libsmb: In cli_cifs_rename_send() (SMBmv) check for DFS source pathname. via 2d28696efe6 s3: libsmb: Make cli_setpathinfo_send() (SMBtrans2: TRANSACT2_SETPATHINFO) DFS path aware. via f34fad61fdc s3: smbcacls: Now cli_resolve_path() and cli_list() can handle DFS names we no longer need local_cli_resolve_path(). via 3c2a31b4384 s3: libsmb: Fix cli_resolve_path() to cope with DFS paths passed in as well as local paths. via d9f0d924795 s3: libsmb: Fix SMB1 cli_list_old_send() to cope with DFS paths. via 4a9458d03dd s3: libsmb: Fix SMB1 cli_list_trans_send() (SMBtrans2:TRANSACT2_FINDFIRST) to cope with DFS paths. via c98d165e517 s3: libsmb: Add smb1_dfs_share_path() to convert a name into a DFS path if needed. via dd9cdfb3b14 s3: libsmb: For SMB2 opens on a DFS share, convert to a DFS path if not already done. via 26b4a6951b6 s3: libsmb: Add cli_dfs_is_already_full_path() function. via 070b73e3f96 s3: libsmb: In cli_list_old_send(), push state->mask into the packet, not just mask. via ad97a97bd80 s3: libsmb: Make cli_state_save_tcon()/cli_state_restore_tcon() static. via 4e3ea1b2e72 s3: smbcacls: In cli_lsa_lookup_domain_sid(), replace cli_state_save_tcon()/cli_state_restore_tcon() with cli_state_save_tcon_share()/cli_state_restore_tcon_share(). via fddade459f2 s3: utils: In show_userlist() replace cli_state_save_tcon()/cli_state_restore_tcon() with cli_state_save_tcon_share()/cli_state_restore_tcon_share(). via d116a079e99 s3: torture: In run_tcon_test() replace cli_state_save_tcon()/cli_state_restore_tcon() with cli_state_save_tcon_share()/cli_state_restore_tcon_share(). via cf02ed2f605 s3: torture: In run_smb2_basic(), replace cli_state_save_tcon()/cli_state_restore_tcon() with cli_state_save_tcon_share()/cli_state_restore_tcon_share(). via fcf090279e2 s3: libsmb: In cli_check_msdfs_proxy() replace cli_state_save_tcon()/cli_state_restore_tcon() with cli_state_save_tcon_share()/cli_state_restore_tcon_share(). via 83dab4238cd s3: libsmb: In cli_lsa_lookup_name() replace cli_state_save_tcon()/cli_state_restore_tcon() with cli_state_save_tcon_share()/cli_state_restore_tcon_share(). via 73fde1fbbf0 s3: libsmb: In cli_lsa_lookup_sid() replace cli_state_save_tcon()/cli_state_restore_tcon() with cli_state_save_tcon_share()/cli_state_restore_tcon_share(). via c3c71649850 s3: libsmb: Add pair cli_state_save_tcon_share()/cli_state_restore_tcon_share(). via dfd7c6ca784 s3: libsmb: Cleanup - remove unused fname_src parameter from cli_dfs_target_check(). via c7749103b22 s3: libsmb: Add missing memory allocation fail check in cli_openx_create(). via a213a371aeb s3: libsmb: Add missing memory allocation fail checks in cli_ntcreate1_send(). from 95bd776d2a3 s3: smbtorture3: Add test_smb1_qpathinfo() DFS test to run_smb1_dfs_operations().
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit b4455f04879d39aefc4d4e39e6611c54be00e62d Author: Jeremy Allison <j...@samba.org> Date: Fri Sep 9 10:29:30 2022 -0700 s3: libsmb: In cli_posix_open_internal_send() (SMBtrans2:TRANSACT2_SETPATHINFO) check for DFS pathname. See smbtorture3: SMB1-DFS-PATHS: test_smb1_setpathinfo_XXXX() Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Thu Sep 15 19:44:00 UTC 2022 on sn-devel-184 commit fa7e6899b3ba5d672a805220021268e1d3165015 Author: Jeremy Allison <j...@samba.org> Date: Fri Sep 9 09:40:12 2022 -0700 s3: libsmb: In cli_qpathinfo_send() (SMBtrans2:TRANSACT2_QPATHINFO) check for DFS pathname. See smbtorture3: SMB1-DFS-PATHS: test_smb1_qpathinfo() Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit adc4a1b290a96221b8198a030977760d21aebae0 Author: Jeremy Allison <j...@samba.org> Date: Thu Sep 8 16:21:20 2022 -0700 s3: libsmb: In cli_set_ea_path() (SMBtrans2:TRANSACT2_SETPATHINFO) check for DFS pathname. See smbtorture3: SMB1-DFS-PATHS: test_smb1_setpathinfo_XXXX() Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit 5c083e8bc3a15b6cdab906dfbaefe9fa2a3692fe Author: Jeremy Allison <j...@samba.org> Date: Thu Sep 8 14:28:41 2022 -0700 s3: libsmb: In cli_ctemp_send() (SMBctemp) check for DFS pathname. smbtorture3: SMB1-DFS-OPERATIONS: test_smb1_ctemp() shows SMBctemp uses DFS paths. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit 6a82167f11fa499bac6176a5dfd2f9a423721058 Author: Jeremy Allison <j...@samba.org> Date: Thu Sep 8 12:25:49 2022 -0700 s3: libsmb: In cli_chkpath_send() (SMBcheckpath) check for DFS pathname. smbtorture3: SMB1-DFS-OPERATIONS: test_smb1_chkpath() shows SMBcheckpath uses DFS paths. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit a53c049c4de8f737e55f021b84060f2ed5fc57ed Author: Jeremy Allison <j...@samba.org> Date: Thu Sep 8 11:53:33 2022 -0700 s3: libsmb: In cli_setatr_send() (SMBsetatr) check for DFS pathname. smbtorture3: SMB1-DFS-OPERATIONS: test_smb1_setatr() shows SMBsetatr uses DFS paths. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit 75339aec0ee963c8f7605aaf5016bacdcaa23b99 Author: Jeremy Allison <j...@samba.org> Date: Thu Sep 8 09:50:56 2022 -0700 s3: libsmb: In cli_getatr_send() (SMBgetatr) check for DFS pathname. smbtorture3: SMB1-DFS-OPERATIONS: test_smb1_getatr() shows SMBgetatr uses DFS paths. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit b58cee42512320f3b5ee1b6f4ae41eaf597690ef Author: Jeremy Allison <j...@samba.org> Date: Wed Sep 7 12:52:42 2022 -0700 s3: libsmb: In cli_openx_create() (SMBopenX) check for DFS pathname. smbtorture3: SMB1-DFS-OPERATIONS: test_smb1_openx() shows SMBopenX uses DFS paths. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit ab1257226420c98621aec4fa0737882ae0291c94 Author: Jeremy Allison <j...@samba.org> Date: Wed Sep 7 12:05:53 2022 -0700 s3: libsmb: In cli_nttrans_create_send() (SMBnttrans:NT_TRANSACT_CREATE) check for DFS pathname. smbtorture3: SMB1-DFS-OPERATIONS: test_smb1_nttrans_create() shows SMBnttrans:NT_TRANSACT_CREATE uses DFS paths. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit 198869afecd4c5bd87e8325ba5530736a39c41ab Author: Jeremy Allison <j...@samba.org> Date: Wed Sep 7 11:26:46 2022 -0700 s3: libsmb: In cli_ntcreate1_send() (SMBntcreateX) check for DFS pathname. smbtorture3: SMB1-DFS-OPERATIONS: test_smb1_ntcreatex() shows SMBntcreateX uses DFS paths. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit 8561eaa02d9810b337378ee3ed448570d20496b8 Author: Jeremy Allison <j...@samba.org> Date: Wed Sep 7 10:47:37 2022 -0700 s3: libsmb: In cli_rmdir_send() (SMBrmdir) check for DFS pathname. smbtorture3: SMB1-DFS-OPERATIONS: test_smb1_rmdir() shows SMBrmdir uses DFS paths. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit 47cf519e98f937cf21cc3c8c62e38efa7010f091 Author: Jeremy Allison <j...@samba.org> Date: Wed Sep 7 10:45:01 2022 -0700 s3: libsmb: In cli_mkdir_send() (SMBmkdir) check for DFS pathname. smbtorture3: SMB1-DFS-OPERATIONS: test_smb1_mkdir() shows SMBmkdir uses DFS paths. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit e2efea7d1f2b635057b6a25b1e086645eb2f38be Author: Jeremy Allison <j...@samba.org> Date: Tue Sep 6 17:26:58 2022 -0700 s3: libsmb: In cli_unlink_send() (SMBunlink) check for DFS pathname. smbtorture3: SMB1-DFS-OPERATIONS: test_smb1_unlink() shows SMBunlink uses DFS paths. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit 73a6e2b14a1cfbfd7f3572eddaf4d037bee5b3f3 Author: Jeremy Allison <j...@samba.org> Date: Fri Sep 2 13:18:06 2022 -0700 s3: libsmb: In cli_ntrename_internal_send() (SMBntrename) check for DFS dst pathname. See smbtorture3: SMB1-DFS-PATHS: test_smb1_ntrename_rename(). and smbtorture3: SMB1-DFS-PATHS: test_smb1_ntrename_hardlink(). Remove the old code that stripped a DFS name from the destination filename, and go through smb1_dfs_share_path() as we did for fname_src in the last commit. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit f1765c9c7be95b8aacd5275a0c502be8c1afcd58 Author: Jeremy Allison <j...@samba.org> Date: Fri Sep 2 13:12:51 2022 -0700 s3: libsmb: In cli_ntrename_internal_send() (SMBntrename) check for DFS source pathname. smbtorture3: SMB1-DFS-PATHS: test_smb1_ntrename_rename() shows SMBntrename uses DFS for src and dst. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit 44bf2bc89a47ead4c7efb77ffa34017dfb9220dc Author: Jeremy Allison <j...@samba.org> Date: Fri Sep 2 12:40:19 2022 -0700 s3: libsmb: In cli_cifs_rename_send() (SMBmv) check for DFS dst pathname. See smbtorture3: SMB1-DFS-PATHS: test_smb1_mv(). Remove the old code that stripped a DFS name from the destination filename, and go through smb1_dfs_share_path() as we did for fname_src in the last commit. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit 4da3c724d5b3a60cd4af83b0a301b96a0d2ee945 Author: Jeremy Allison <j...@samba.org> Date: Fri Sep 2 12:33:48 2022 -0700 s3: libsmb: In cli_cifs_rename_send() (SMBmv) check for DFS source pathname. smbtorture3: SMB1-DFS-PATHS: test_smb1_mv() shows SMBmv uses DFS for src and dst. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit 2d28696efe66c49a969b9de12e2f1a143e1a6d8e Author: Jeremy Allison <j...@samba.org> Date: Fri Sep 2 12:27:36 2022 -0700 s3: libsmb: Make cli_setpathinfo_send() (SMBtrans2: TRANSACT2_SETPATHINFO) DFS path aware. See smbtorture3: SMB1-DFS-PATHS: test_smb1_setpathinfo_XXXX() Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit f34fad61fdc28bf9d35a8d5d426b48d5f0c083b0 Author: Jeremy Allison <j...@samba.org> Date: Fri Sep 2 11:46:08 2022 -0700 s3: smbcacls: Now cli_resolve_path() and cli_list() can handle DFS names we no longer need local_cli_resolve_path(). Remove local_cli_resolve_path(). No more special treatment for DFS names in smbcacls. Signed-off-by: Jeremy Allison <j...@samba.org> Signed-off-by: Noel Power <noel.po...@suse.com> commit 3c2a31b43843a31da727b7d4350a8d969a1c4edd Author: Jeremy Allison <j...@samba.org> Date: Fri Sep 2 11:44:47 2022 -0700 s3: libsmb: Fix cli_resolve_path() to cope with DFS paths passed in as well as local paths. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit d9f0d924795b199c416f72cc1e844e987efed8dd Author: Jeremy Allison <j...@samba.org> Date: Thu Sep 1 16:12:35 2022 -0700 s3: libsmb: Fix SMB1 cli_list_old_send() to cope with DFS paths. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit 4a9458d03dd1559c67f3ad9210bfce7af6192c61 Author: Jeremy Allison <j...@samba.org> Date: Thu Sep 1 16:10:49 2022 -0700 s3: libsmb: Fix SMB1 cli_list_trans_send() (SMBtrans2:TRANSACT2_FINDFIRST) to cope with DFS paths. See smbtorture3: SMB1-DFS-SEARCH-PATHS: test_smb1_findfirst_path Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit c98d165e517c9bccb056d22b82ed5a2d591e0483 Author: Jeremy Allison <j...@samba.org> Date: Thu Sep 1 16:07:10 2022 -0700 s3: libsmb: Add smb1_dfs_share_path() to convert a name into a DFS path if needed. Not yet used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit dd9cdfb3b1488a5f262767089d456ae9269f72f0 Author: Jeremy Allison <j...@samba.org> Date: Thu Sep 1 15:32:40 2022 -0700 s3: libsmb: For SMB2 opens on a DFS share, convert to a DFS path if not already done. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit 26b4a6951b6ae2a8ba2341d64fa888fe52f6463a Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 19 14:59:04 2022 -0700 s3: libsmb: Add cli_dfs_is_already_full_path() function. Returns true if it's already a fully qualified DFS path. Not yet used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit 070b73e3f96c46bb4a96a8149c4c77ab3080a946 Author: Jeremy Allison <j...@samba.org> Date: Thu Sep 1 16:07:34 2022 -0700 s3: libsmb: In cli_list_old_send(), push state->mask into the packet, not just mask. This doesn't matter right now, but it will when I add DFS path awareness to cli_list(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit ad97a97bd80f22350e7a5014a0a5d251c5e2e57a Author: Jeremy Allison <j...@samba.org> Date: Tue Aug 23 17:40:55 2022 -0700 s3: libsmb: Make cli_state_save_tcon()/cli_state_restore_tcon() static. There are no external callers. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit 4e3ea1b2e723f1de3225112311e5fe38fa69683f Author: Jeremy Allison <j...@samba.org> Date: Tue Aug 23 17:37:48 2022 -0700 s3: smbcacls: In cli_lsa_lookup_domain_sid(), replace cli_state_save_tcon()/cli_state_restore_tcon() with cli_state_save_tcon_share()/cli_state_restore_tcon_share(). There are now no more external users of cli_state_save_tcon()/cli_state_restore_tcon() so we can make them static. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit fddade459f2512709cf0e2e4b9b45de540f4e29f Author: Jeremy Allison <j...@samba.org> Date: Tue Aug 23 17:34:43 2022 -0700 s3: utils: In show_userlist() replace cli_state_save_tcon()/cli_state_restore_tcon() with cli_state_save_tcon_share()/cli_state_restore_tcon_share(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit d116a079e99227140292d020318d381985c350b0 Author: Jeremy Allison <j...@samba.org> Date: Tue Aug 23 17:32:46 2022 -0700 s3: torture: In run_tcon_test() replace cli_state_save_tcon()/cli_state_restore_tcon() with cli_state_save_tcon_share()/cli_state_restore_tcon_share(). Also fix a comment in run_uid_regression_test(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit cf02ed2f6054325dfbcf3d98ba1b9f5d454b100e Author: Jeremy Allison <j...@samba.org> Date: Tue Aug 23 17:30:14 2022 -0700 s3: torture: In run_smb2_basic(), replace cli_state_save_tcon()/cli_state_restore_tcon() with cli_state_save_tcon_share()/cli_state_restore_tcon_share(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit fcf090279e29ce72a6aee2b6059b168f7a479d91 Author: Jeremy Allison <j...@samba.org> Date: Tue Aug 23 17:28:21 2022 -0700 s3: libsmb: In cli_check_msdfs_proxy() replace cli_state_save_tcon()/cli_state_restore_tcon() with cli_state_save_tcon_share()/cli_state_restore_tcon_share(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit 83dab4238cd12592d84dd5898b25463d58fb546f Author: Jeremy Allison <j...@samba.org> Date: Tue Aug 23 17:25:40 2022 -0700 s3: libsmb: In cli_lsa_lookup_name() replace cli_state_save_tcon()/cli_state_restore_tcon() with cli_state_save_tcon_share()/cli_state_restore_tcon_share(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit 73fde1fbbf0fe569c49bfdcd49bc5efe31c7d891 Author: Jeremy Allison <j...@samba.org> Date: Tue Aug 23 17:18:16 2022 -0700 s3: libsmb: In cli_lsa_lookup_sid() replace cli_state_save_tcon()/cli_state_restore_tcon() with cli_state_save_tcon_share()/cli_state_restore_tcon_share(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit c3c716498502e5f1a833a469e0a4936a9668338e Author: Jeremy Allison <j...@samba.org> Date: Tue Aug 23 17:13:58 2022 -0700 s3: libsmb: Add pair cli_state_save_tcon_share()/cli_state_restore_tcon_share(). Wraps cli_state_save_tcon()//cli_state_restore_tcon() but also returns cli->sharename. We are going to replace all uses of cli_state_save_tcon()/cli_state_restore_tcon() so we also save/restore the cli->share for DFS purposes. Signed-off-by: Jeremy Allison <j...@samba.org> Reviwed-by: Noel Power <npo...@samba.org> commit dfd7c6ca784d3bfd79aa1c238b22e3e9a778334c Author: Jeremy Allison <j...@samba.org> Date: Fri Sep 2 11:00:09 2022 -0700 s3: libsmb: Cleanup - remove unused fname_src parameter from cli_dfs_target_check(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit c7749103b22f83f7193267e9593ae6610c04dedf Author: Jeremy Allison <j...@samba.org> Date: Wed Sep 7 12:50:25 2022 -0700 s3: libsmb: Add missing memory allocation fail check in cli_openx_create(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> commit a213a371aeb2fae4df0f41e85faca2cfd38f6447 Author: Jeremy Allison <j...@samba.org> Date: Wed Sep 7 11:12:08 2022 -0700 s3: libsmb: Add missing memory allocation fail checks in cli_ntcreate1_send(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Noel Power <npo...@samba.org> ----------------------------------------------------------------------- Summary of changes: source3/lib/util_sd.c | 18 +-- source3/libsmb/cli_smb2_fnum.c | 42 +++++- source3/libsmb/clidfs.c | 124 +++++++++++++++-- source3/libsmb/clientgen.c | 28 +++- source3/libsmb/clifile.c | 308 ++++++++++++++++++++++++++++++++--------- source3/libsmb/clilist.c | 15 +- source3/libsmb/proto.h | 13 +- source3/torture/test_smb2.c | 8 +- source3/torture/torture.c | 16 +-- source3/utils/net_rpc.c | 10 +- source3/utils/smbcacls.c | 82 +---------- 11 files changed, 475 insertions(+), 189 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/lib/util_sd.c b/source3/lib/util_sd.c index 2141eaf49ac..a4288a46f3d 100644 --- a/source3/lib/util_sd.c +++ b/source3/lib/util_sd.c @@ -87,6 +87,7 @@ static NTSTATUS cli_lsa_lookup_sid(struct cli_state *cli, char **domain, char **name) { struct smbXcli_tcon *orig_tcon = NULL; + char *orig_share = NULL; struct rpc_pipe_client *p = NULL; struct policy_handle handle; NTSTATUS status; @@ -96,11 +97,7 @@ static NTSTATUS cli_lsa_lookup_sid(struct cli_state *cli, char **names; if (cli_state_has_tcon(cli)) { - orig_tcon = cli_state_save_tcon(cli); - if (orig_tcon == NULL) { - status = NT_STATUS_NO_MEMORY; - goto tcon_fail; - } + cli_state_save_tcon_share(cli, &orig_tcon, &orig_share); } status = cli_tree_connect(cli, "IPC$", "?????", NULL); @@ -135,7 +132,7 @@ static NTSTATUS cli_lsa_lookup_sid(struct cli_state *cli, TALLOC_FREE(p); cli_tdis(cli); tcon_fail: - cli_state_restore_tcon(cli, orig_tcon); + cli_state_restore_tcon_share(cli, orig_tcon, orig_share); TALLOC_FREE(frame); return status; } @@ -176,6 +173,7 @@ static NTSTATUS cli_lsa_lookup_name(struct cli_state *cli, struct dom_sid *sid) { struct smbXcli_tcon *orig_tcon = NULL; + char *orig_share = NULL; struct rpc_pipe_client *p = NULL; struct policy_handle handle; NTSTATUS status; @@ -184,11 +182,7 @@ static NTSTATUS cli_lsa_lookup_name(struct cli_state *cli, enum lsa_SidType *types; if (cli_state_has_tcon(cli)) { - orig_tcon = cli_state_save_tcon(cli); - if (orig_tcon == NULL) { - status = NT_STATUS_NO_MEMORY; - goto tcon_fail; - } + cli_state_save_tcon_share(cli, &orig_tcon, &orig_share); } status = cli_tree_connect(cli, "IPC$", "?????", NULL); @@ -222,7 +216,7 @@ static NTSTATUS cli_lsa_lookup_name(struct cli_state *cli, TALLOC_FREE(p); cli_tdis(cli); tcon_fail: - cli_state_restore_tcon(cli, orig_tcon); + cli_state_restore_tcon_share(cli, orig_tcon, orig_share); TALLOC_FREE(frame); return status; } diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c index 1b8819cc6f2..bd3d705a641 100644 --- a/source3/libsmb/cli_smb2_fnum.c +++ b/source3/libsmb/cli_smb2_fnum.c @@ -153,6 +153,42 @@ static uint8_t flags_to_smb2_oplock(uint32_t create_flags) return SMB2_OPLOCK_LEVEL_NONE; } +/*************************************************************** + If we're on a DFS share, ensure we convert to a full DFS path + if this hasn't already been done. +***************************************************************/ + +static const char *smb2_dfs_share_path(TALLOC_CTX *ctx, + struct cli_state *cli, + const char *path) +{ + bool is_dfs = smbXcli_conn_dfs_supported(cli->conn) && + smbXcli_tcon_is_dfs_share(cli->smb2.tcon); + bool is_already_dfs_path = false; + + if (!is_dfs) { + return path; + } + is_already_dfs_path = cli_dfs_is_already_full_path(cli, path); + if (is_already_dfs_path) { + return path; + } + if (path[0] == '\0') { + return talloc_asprintf(ctx, + "%s\\%s", + smbXcli_conn_remote_name(cli->conn), + cli->share); + } + while (*path == '\\') { + path++; + } + return talloc_asprintf(ctx, + "%s\\%s\\%s", + smbXcli_conn_remote_name(cli->conn), + cli->share, + path); +} + /*************************************************************** Small wrapper that allows SMB2 create to return a uint16_t fnum. ***************************************************************/ @@ -254,6 +290,11 @@ struct tevent_req *cli_smb2_create_fnum_send( } } + fname = smb2_dfs_share_path(state, cli, fname); + if (tevent_req_nomem(fname, req)) { + return tevent_req_post(req, ev); + } + /* SMB2 is pickier about pathnames. Ensure it doesn't start in a '\' */ if (*fname == '\\') { @@ -3213,7 +3254,6 @@ struct tevent_req *cli_smb2_rename_send( */ status = cli_dfs_target_check(state, cli, - fname_src, fname_dst, &fname_dst); if (tevent_req_nterror(req, status)) { diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c index 1e73aa221dc..9982f97d43a 100644 --- a/source3/libsmb/clidfs.c +++ b/source3/libsmb/clidfs.c @@ -588,6 +588,46 @@ static char *cli_dfs_make_full_path(TALLOC_CTX *ctx, dir); } +/******************************************************************** + Check if a path has already been converted to DFS. +********************************************************************/ + +bool cli_dfs_is_already_full_path(struct cli_state *cli, const char *path) +{ + const char *server = smbXcli_conn_remote_name(cli->conn); + size_t server_len = strlen(server); + bool found_server = false; + const char *share = cli->share; + size_t share_len = strlen(share); + bool found_share = false; + + if (!IS_DIRECTORY_SEP(path[0])) { + return false; + } + path++; + found_server = (strncasecmp_m(path, server, server_len) == 0); + if (!found_server) { + return false; + } + path += server_len; + if (!IS_DIRECTORY_SEP(path[0])) { + return false; + } + path++; + found_share = (strncasecmp_m(path, share, share_len) == 0); + if (!found_share) { + return false; + } + path += share_len; + if (path[0] == '\0') { + return true; + } + if (IS_DIRECTORY_SEP(path[0])) { + return true; + } + return false; +} + /******************************************************************** Get the dfs referral link. ********************************************************************/ @@ -865,6 +905,7 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx, struct smbXcli_tcon *target_tcon = NULL; struct cli_dfs_path_split *dfs_refs = NULL; bool ok; + bool is_already_dfs = false; if ( !rootcli || !path || !targetcli ) { return NT_STATUS_INVALID_PARAMETER; @@ -889,6 +930,24 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx, *targetcli = NULL; + is_already_dfs = cli_dfs_is_already_full_path(rootcli, path); + if (is_already_dfs) { + const char *localpath = NULL; + /* + * Given path is already converted to DFS. + * Convert to a local path so clean_path() + * can correctly strip any wildcards. + */ + status = cli_dfs_target_check(ctx, + rootcli, + path, + &localpath); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + path = localpath; + } + /* Send a trans2_query_path_info to check for a referral. */ cleanpath = clean_path(ctx, path); @@ -1156,6 +1215,7 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx, char *fullpath = NULL; bool res; struct smbXcli_tcon *orig_tcon = NULL; + char *orig_share = NULL; char *newextrapath = NULL; NTSTATUS status; const char *remote_name; @@ -1183,16 +1243,13 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx, /* Store tcon state. */ if (cli_state_has_tcon(cli)) { - orig_tcon = cli_state_save_tcon(cli); - if (orig_tcon == NULL) { - return false; - } + cli_state_save_tcon_share(cli, &orig_tcon, &orig_share); } /* check for the referral */ if (!NT_STATUS_IS_OK(cli_tree_connect(cli, "IPC$", "IPC", NULL))) { - cli_state_restore_tcon(cli, orig_tcon); + cli_state_restore_tcon_share(cli, orig_tcon, orig_share); return false; } @@ -1211,7 +1268,9 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx, * tcon so we don't leak it. */ cli_tdis(cli); - cli_state_restore_tcon(cli, orig_tcon); + cli_state_restore_tcon_share(cli, + orig_tcon, + orig_share); return false; } } @@ -1223,7 +1282,7 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx, status = cli_tdis(cli); - cli_state_restore_tcon(cli, orig_tcon); + cli_state_restore_tcon_share(cli, orig_tcon, orig_share); if (!NT_STATUS_IS_OK(status)) { return false; @@ -1261,7 +1320,6 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx, NTSTATUS cli_dfs_target_check(TALLOC_CTX *mem_ctx, struct cli_state *cli, - const char *fname_src, const char *fname_dst, const char **fname_dst_out) { @@ -1308,3 +1366,53 @@ NTSTATUS cli_dfs_target_check(TALLOC_CTX *mem_ctx, TALLOC_FREE(dfs_prefix); return NT_STATUS_OK; } + +/******************************************************************** + Convert a pathname into a DFS path if it hasn't already been converted. + Always returns a talloc'ed path, makes it easy to pass const paths in. +********************************************************************/ + +char *smb1_dfs_share_path(TALLOC_CTX *ctx, + struct cli_state *cli, + const char *path) +{ + bool is_dfs = smbXcli_conn_dfs_supported(cli->conn) && + smbXcli_tcon_is_dfs_share(cli->smb1.tcon); + bool is_already_dfs_path = false; + bool posix = (cli->requested_posix_capabilities & + CIFS_UNIX_POSIX_PATHNAMES_CAP); + char sepchar = (posix ? '/' : '\\'); + + if (!is_dfs) { + return talloc_strdup(ctx, path); + } + is_already_dfs_path = cli_dfs_is_already_full_path(cli, path); + if (is_already_dfs_path) { + return talloc_strdup(ctx, path); + } + /* + * We don't use cli_dfs_make_full_path() as, + * when given a null path, cli_dfs_make_full_path + * deliberately adds a trailing '\\' (this is by + * design to check for an existing DFS prefix match). + */ + if (path[0] == '\0') { + return talloc_asprintf(ctx, + "%c%s%c%s", + sepchar, + smbXcli_conn_remote_name(cli->conn), + sepchar, + cli->share); + } + while (*path == sepchar) { + path++; + } + return talloc_asprintf(ctx, + "%c%s%c%s%c%s", + sepchar, + smbXcli_conn_remote_name(cli->conn), + sepchar, + cli->share, + sepchar, + path); +} diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 5f0b9daf333..b34d9fec705 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -359,7 +359,7 @@ uint32_t cli_state_set_tid(struct cli_state *cli, uint32_t tid) return ret; } -struct smbXcli_tcon *cli_state_save_tcon(struct cli_state *cli) +static struct smbXcli_tcon *cli_state_save_tcon(struct cli_state *cli) { /* * Note. This used to make a deep copy of either @@ -394,7 +394,21 @@ struct smbXcli_tcon *cli_state_save_tcon(struct cli_state *cli) return tcon_ret; } -void cli_state_restore_tcon(struct cli_state *cli, struct smbXcli_tcon *tcon) +void cli_state_save_tcon_share(struct cli_state *cli, + struct smbXcli_tcon **_tcon_ret, + char **_sharename_ret) +{ + *_tcon_ret = cli_state_save_tcon(cli); + /* + * No talloc_copy as cli->share is already + * allocated off cli. + */ + *_sharename_ret = cli->share; + cli->share = NULL; +} + +static void cli_state_restore_tcon(struct cli_state *cli, + struct smbXcli_tcon *tcon) { if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) { TALLOC_FREE(cli->smb2.tcon); @@ -405,6 +419,16 @@ void cli_state_restore_tcon(struct cli_state *cli, struct smbXcli_tcon *tcon) } } +void cli_state_restore_tcon_share(struct cli_state *cli, + struct smbXcli_tcon *tcon, + char *share) +{ + /* cli->share will have been replaced by a cli_tree_connect() call. */ + TALLOC_FREE(cli->share); + cli->share = share; + cli_state_restore_tcon(cli, tcon); +} + uint16_t cli_state_get_uid(struct cli_state *cli) { return smb1cli_session_current_id(cli->smb1.session); diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 4cc9f231c37..1d1e6f03337 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -47,6 +47,7 @@ struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx, struct tevent_req *req, *subreq; struct cli_setpathinfo_state *state; uint16_t additional_flags2 = 0; + char *path_cp = NULL; req = tevent_req_create(mem_ctx, &state, struct cli_setpathinfo_state); @@ -64,8 +65,16 @@ struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx, } SSVAL(state->param, 0, level); - state->param = trans2_bytes_push_str( - state->param, smbXcli_conn_use_unicode(cli->conn), path, strlen(path)+1, NULL); + /* Check for DFS. */ + path_cp = smb1_dfs_share_path(state, cli, path); + if (tevent_req_nomem(path_cp, req)) { + return tevent_req_post(req, ev); + } + state->param = trans2_bytes_push_str(state->param, + smbXcli_conn_use_unicode(cli->conn), + path_cp, + strlen(path_cp)+1, + NULL); if (tevent_req_nomem(state->param, req)) { return tevent_req_post(req, ev); } @@ -1240,7 +1249,6 @@ static struct tevent_req *cli_smb1_rename_send(TALLOC_CTX *mem_ctx, */ status = cli_dfs_target_check(state, cli, - fname_src, fname_dst, &fname_dst); if (!NT_STATUS_IS_OK(status)) { @@ -1324,7 +1332,8 @@ static struct tevent_req *cli_cifs_rename_send(TALLOC_CTX *mem_ctx, uint8_t additional_flags = 0; uint16_t additional_flags2 = 0; uint8_t *bytes = NULL; - NTSTATUS status; + char *fname_src_cp = NULL; + char *fname_dst_cp = NULL; req = tevent_req_create(mem_ctx, &state, struct cli_cifs_rename_state); if (req == NULL) { @@ -1339,27 +1348,28 @@ static struct tevent_req *cli_cifs_rename_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - /* - * Strip a MSDFS path from fname_dst if we were given one. - */ - status = cli_dfs_target_check(state, - cli, - fname_src, - fname_dst, - &fname_dst); - if (tevent_req_nterror(req, status)) { - return tevent_req_post(req, ev); - } - SSVAL(state->vwv+0, 0, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY); bytes = talloc_array(state, uint8_t, 1); if (tevent_req_nomem(bytes, req)) { return tevent_req_post(req, ev); } + + /* + * SMBmv on a DFS share uses DFS names for src and dst. + * See smbtorture3: SMB1-DFS-PATHS: test_smb1_mv(). + */ + + fname_src_cp = smb1_dfs_share_path(state, cli, fname_src); + if (tevent_req_nomem(fname_src_cp, req)) { + return tevent_req_post(req, ev); + } bytes[0] = 4; - bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), fname_src, - strlen(fname_src)+1, NULL); + bytes = smb_bytes_push_str(bytes, + smbXcli_conn_use_unicode(cli->conn), + fname_src_cp, + strlen(fname_src_cp)+1, + NULL); if (tevent_req_nomem(bytes, req)) { return tevent_req_post(req, ev); } @@ -1374,9 +1384,21 @@ static struct tevent_req *cli_cifs_rename_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } + /* + * SMBmv on a DFS share uses DFS names for src and dst. + * See smbtorture3: SMB1-DFS-PATHS: test_smb1_mv(). + */ + + fname_dst_cp = smb1_dfs_share_path(state, cli, fname_dst); + if (tevent_req_nomem(fname_dst_cp, req)) { + return tevent_req_post(req, ev); + } bytes[talloc_get_size(bytes)-1] = 4; - bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), fname_dst, - strlen(fname_dst)+1, NULL); + bytes = smb_bytes_push_str(bytes, + smbXcli_conn_use_unicode(cli->conn), + fname_dst_cp, + strlen(fname_dst_cp)+1, + NULL); if (tevent_req_nomem(bytes, req)) { return tevent_req_post(req, ev); } @@ -1544,7 +1566,8 @@ static struct tevent_req *cli_ntrename_internal_send(TALLOC_CTX *mem_ctx, uint8_t additional_flags = 0; uint16_t additional_flags2 = 0; uint8_t *bytes = NULL; - NTSTATUS status; + char *fname_src_cp = NULL; + char *fname_dst_cp = NULL; -- Samba Shared Repository