From: Anubhav Rakshit Date: Sun, 7 Jun 2020 19:09:59 +0000 (+0530) Subject: s3:smbcacls: Add support for DFS path X-Git-Tag: samba-4.13.0rc1~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd5a2d015bfe62b2ff334c1ebf34e371e7cf1238;p=thirdparty%2Fsamba.git s3:smbcacls: Add support for DFS path smbcacls does not handle DFS paths correctly. This is beacuse once the command encounters a path which returns STATUS_PATH_NOT_COVERED, it does not attempt a GET REFERRAL. We use cli_resolve_path API to perform a DFS path resolution to solve the above problem. Additionally this removes the known fail against smbcacls tests Signed-off-by: Anubhav Rakshit Reviewed-by: Noel Power Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Tue Jul 7 23:03:00 UTC 2020 on sn-devel-184 --- diff --git a/selftest/knownfail.d/smbcacls b/selftest/knownfail.d/smbcacls index bcd78ce7b33..e69de29bb2d 100644 --- a/selftest/knownfail.d/smbcacls +++ b/selftest/knownfail.d/smbcacls @@ -1 +0,0 @@ -^samba.tests.blackbox.smbcacls_basic\(DFS\) diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index ecd2aa0e824..f3209c31877 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -816,6 +816,9 @@ int main(int argc, char *argv[]) /* numeric is set when the user wants numeric SIDs and ACEs rather than going via LSA calls to resolve them */ int numeric = 0; + struct cli_state *targetcli = NULL; + char *targetfile = NULL; + NTSTATUS status; struct poptOption long_options[] = { POPT_AUTOHELP @@ -1077,16 +1080,28 @@ int main(int argc, char *argv[]) } } + status = cli_resolve_path(frame, + "", + popt_get_cmdline_auth_info(), + cli, + filename, + &targetcli, + &targetfile); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("cli_resolve_path failed for %s! (%s)\n", filename, nt_errstr(status))); + return -1; + } + /* Perform requested action */ if (change_mode == REQUEST_INHERIT) { - result = inherit(cli, filename, owner_username); + result = inherit(targetcli, targetfile, owner_username); } else if (change_mode != REQUEST_NONE) { - result = owner_set(cli, change_mode, filename, owner_username); + result = owner_set(targetcli, change_mode, targetfile, owner_username); } else if (the_acl) { - result = cacl_set(cli, filename, the_acl, mode, numeric); + result = cacl_set(targetcli, targetfile, the_acl, mode, numeric); } else { - result = cacl_dump(cli, filename, numeric); + result = cacl_dump(targetcli, targetfile, numeric); } popt_free_cmdline_auth_info();