diff options
author | Anubhav Rakshit <anubhav.rakshit@gmail.com> | 2020-06-08 00:39:59 +0530 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2020-07-07 23:03:00 +0000 |
commit | cd5a2d015bfe62b2ff334c1ebf34e371e7cf1238 (patch) | |
tree | c4c661f981d4610319b2104da598be806fa19c38 | |
parent | 449259f6e1fbfb41a03d502a277b5f1fccd2182b (diff) | |
download | samba-cd5a2d015bfe62b2ff334c1ebf34e371e7cf1238.tar.gz |
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 <anubhav.rakshit@gmail.com>
Reviewed-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jul 7 23:03:00 UTC 2020 on sn-devel-184
-rw-r--r-- | selftest/knownfail.d/smbcacls | 1 | ||||
-rw-r--r-- | source3/utils/smbcacls.c | 23 |
2 files changed, 19 insertions, 5 deletions
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(); |