def tearDown(self):
super(DfsInheritanceSmbCaclsTests, self).tearDown()
- # for dfs tests inevitably we fallback to remove the local files in
- # the base class, the base class however doesn't know about the
- # target dfs share (or its contents) so we have to assume we need to
- # remove the file on the dfs share
- smbclient_args = self.build_test_cmd("smbclient", ["//%s/%s" % (self.server, self.dfs_target_share), "-c", "rm file-3"])
- self.check_output(smbclient_args)
-
-
{
NTSTATUS status = NT_STATUS_OK;
struct file_list *deltree_list_iter = NULL;
+ char *targetname = NULL;
+ struct cli_state *targetcli = NULL;
+ struct cli_credentials *creds = samba_cmdline_get_creds();
+ TALLOC_CTX *ctx = talloc_tos();
for (deltree_list_iter = flist;
deltree_list_iter != NULL;
deltree_list_iter = deltree_list_iter->next) {
+ status = cli_resolve_path(ctx,
+ "",
+ creds,
+ cli_state,
+ deltree_list_iter->file_path,
+ &targetcli,
+ &targetname);
+ if (!NT_STATUS_IS_OK(status)) {
+ d_printf("delete_remote_files %s: %s\n",
+ deltree_list_iter->file_path,
+ nt_errstr(status));
+ return status;
+ }
if (CLI_DIRSEP_CHAR == '/') {
/* POSIX. */
- status = cli_posix_unlink(cli_state,
- deltree_list_iter->file_path);
+ status = cli_posix_unlink(targetcli,
+ targetname);
} else if (deltree_list_iter->isdir) {
- status = cli_rmdir(cli_state,
- deltree_list_iter->file_path);
+ status = cli_rmdir(targetcli,
+ targetname);
} else {
- status = cli_unlink(cli_state,
- deltree_list_iter->file_path,
+ status = cli_unlink(targetcli,
+ targetname,
FILE_ATTRIBUTE_SYSTEM |
FILE_ATTRIBUTE_HIDDEN);
}
deltree_list_iter = deltree_list_iter->next) {
if (deltree_list_iter->isdir == false) {
+ char *targetname = NULL;
+ struct cli_state *targetcli = NULL;
+ struct cli_credentials *creds = samba_cmdline_get_creds();
+ status = cli_resolve_path(ctx,
+ "",
+ creds,
+ cli,
+ deltree_list_iter->file_path,
+ &targetcli,
+ &targetname);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto err;
+ }
/* Just a regular file. */
if (CLI_DIRSEP_CHAR == '/') {
/* POSIX. */
- status = cli_posix_unlink(cli,
- deltree_list_iter->file_path);
+ status = cli_posix_unlink(targetcli,
+ targetname);
} else {
- status = cli_unlink(cli,
- deltree_list_iter->file_path,
+ status = cli_unlink(targetcli,
+ targetname,
FILE_ATTRIBUTE_SYSTEM |
FILE_ATTRIBUTE_HIDDEN);
}