summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/client/client.c4
-rw-r--r--source3/include/proto.h9
-rw-r--r--source3/libsmb/clifile.c117
-rw-r--r--source3/libsmb/libsmb_dir.c4
-rw-r--r--source3/torture/denytest.c8
-rw-r--r--source3/torture/locktest.c2
-rw-r--r--source3/torture/locktest2.c2
-rw-r--r--source3/torture/mangle_test.c10
-rw-r--r--source3/torture/masktest.c4
-rw-r--r--source3/torture/nbio.c2
-rw-r--r--source3/torture/scanner.c4
-rw-r--r--source3/torture/torture.c176
-rw-r--r--source3/torture/utable.c8
13 files changed, 210 insertions, 140 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 0271b456c3..7dda981800 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -2115,7 +2115,7 @@ static void do_del(file_info *finfo, const char *dir)
return;
}
- if (!cli_unlink(finfo->cli, mask)) {
+ if (!NT_STATUS_IS_OK(cli_unlink(finfo->cli, mask, aSYSTEM | aHIDDEN))) {
d_printf("%s deleting remote file %s\n",
cli_errstr(finfo->cli),mask);
}
@@ -2191,7 +2191,7 @@ static int cmd_wdel(void)
return 1;
}
- if (!cli_unlink_full(targetcli, targetname, attribute)) {
+ if (!NT_STATUS_IS_OK(cli_unlink(targetcli, targetname, attribute))) {
d_printf("%s deleting remote files %s\n",cli_errstr(targetcli),targetname);
}
return 0;
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 962215b79f..11fd45ed5e 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2355,8 +2355,13 @@ struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
-bool cli_unlink_full(struct cli_state *cli, const char *fname, uint16_t attrs);
-bool cli_unlink(struct cli_state *cli, const char *fname);
+struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
+ struct cli_state *cli,
+ const char *fname,
+ uint16_t mayhave_attrs);
+NTSTATUS cli_unlink_recv(struct tevent_req *req);
+NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
struct event_context *ev,
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index e055a88000..54c59473e6 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -756,46 +756,111 @@ NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const cha
Delete a file.
****************************************************************************/
-bool cli_unlink_full(struct cli_state *cli, const char *fname, uint16_t attrs)
-{
- char *p;
+static void cli_unlink_done(struct tevent_req *subreq);
- memset(cli->outbuf,'\0',smb_size);
- memset(cli->inbuf,'\0',smb_size);
+struct cli_unlink_state {
+ uint16_t vwv[1];
+};
- cli_set_message(cli->outbuf,1, 0, true);
+struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
+ struct cli_state *cli,
+ const char *fname,
+ uint16_t mayhave_attrs)
+{
+ struct tevent_req *req = NULL, *subreq = NULL;
+ struct cli_unlink_state *state = NULL;
+ uint8_t additional_flags = 0;
+ uint8_t *bytes = NULL;
- SCVAL(cli->outbuf,smb_com,SMBunlink);
- SSVAL(cli->outbuf,smb_tid,cli->cnum);
- cli_setup_packet(cli);
+ req = tevent_req_create(mem_ctx, &state, struct cli_unlink_state);
+ if (req == NULL) {
+ return NULL;
+ }
- SSVAL(cli->outbuf,smb_vwv0, attrs);
+ SSVAL(state->vwv+0, 0, mayhave_attrs);
- p = smb_buf(cli->outbuf);
- *p++ = 4;
- p += clistr_push(cli, p, fname,
- cli->bufsize - PTR_DIFF(p,cli->outbuf), STR_TERMINATE);
+ bytes = talloc_array(state, uint8_t, 1);
+ if (tevent_req_nomem(bytes, req)) {
+ return tevent_req_post(req, ev);
+ }
+ bytes[0] = 4;
+ bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), fname,
+ strlen(fname)+1, NULL);
- cli_setup_bcc(cli, p);
- cli_send_smb(cli);
- if (!cli_receive_smb(cli)) {
- return false;
+ if (tevent_req_nomem(bytes, req)) {
+ return tevent_req_post(req, ev);
}
- if (cli_is_error(cli)) {
- return false;
+ subreq = cli_smb_send(state, ev, cli, SMBunlink, additional_flags,
+ 1, state->vwv, talloc_get_size(bytes), bytes);
+ if (tevent_req_nomem(subreq, req)) {
+ return tevent_req_post(req, ev);
}
+ tevent_req_set_callback(subreq, cli_unlink_done, req);
+ return req;
+}
- return true;
+static void cli_unlink_done(struct tevent_req *subreq)
+{
+ struct tevent_req *req = tevent_req_callback_data(
+ subreq, struct tevent_req);
+ NTSTATUS status;
+
+ status = cli_smb_recv(subreq, 0, NULL, NULL, NULL, NULL);
+ TALLOC_FREE(subreq);
+ if (!NT_STATUS_IS_OK(status)) {
+ tevent_req_nterror(req, status);
+ return;
+ }
+ tevent_req_done(req);
}
-/****************************************************************************
- Delete a file.
-****************************************************************************/
+NTSTATUS cli_unlink_recv(struct tevent_req *req)
+{
+ return tevent_req_simple_recv_ntstatus(req);
+}
-bool cli_unlink(struct cli_state *cli, const char *fname)
+NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs)
{
- return cli_unlink_full(cli, fname, aSYSTEM | aHIDDEN);
+ TALLOC_CTX *frame = talloc_stackframe();
+ struct event_context *ev;
+ struct tevent_req *req;
+ NTSTATUS status = NT_STATUS_OK;
+
+ if (cli_has_async_calls(cli)) {
+ /*
+ * Can't use sync call while an async call is in flight
+ */
+ status = NT_STATUS_INVALID_PARAMETER;
+ goto fail;
+ }
+
+ ev = event_context_init(frame);
+ if (ev == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto fail;
+ }
+
+ req = cli_unlink_send(frame, ev, cli, fname, mayhave_attrs);
+ if (req == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto fail;
+ }
+
+ if (!tevent_req_poll(req, ev)) {
+ status = map_nt_error_from_unix(errno);
+ goto fail;
+ }
+
+ status = cli_unlink_recv(req);
+
+ fail:
+ TALLOC_FREE(frame);
+ if (!NT_STATUS_IS_OK(status)) {
+ cli_set_error(cli, status);
+ }
+ return status;
}
/****************************************************************************
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index bc5e35f79b..d230275685 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -1760,7 +1760,7 @@ SMBC_unlink_ctx(SMBCCTX *context,
}
/*d_printf(">>>unlink: resolved path as %s\n", targetpath);*/
- if (!cli_unlink(targetcli, targetpath)) {
+ if (!NT_STATUS_IS_OK(cli_unlink(targetcli, targetpath, aSYSTEM | aHIDDEN))) {
errno = SMBC_errno(context, targetcli);
@@ -1966,7 +1966,7 @@ SMBC_rename_ctx(SMBCCTX *ocontext,
int eno = SMBC_errno(ocontext, targetcli1);
if (eno != EEXIST ||
- !cli_unlink(targetcli1, targetpath2) ||
+ !NT_STATUS_IS_OK(cli_unlink(targetcli1, targetpath2, aSYSTEM | aHIDDEN)) ||
!NT_STATUS_IS_OK(cli_rename(targetcli1, targetpath1, targetpath2))) {
errno = eno;
diff --git a/source3/torture/denytest.c b/source3/torture/denytest.c
index 9b08552df7..cbcbf320f8 100644
--- a/source3/torture/denytest.c
+++ b/source3/torture/denytest.c
@@ -1418,7 +1418,7 @@ bool torture_denytest1(int dummy)
printf("starting denytest1\n");
for (i=0;i<2;i++) {
- cli_unlink(cli1, fnames[i]);
+ cli_unlink(cli1, fnames[i], aSYSTEM | aHIDDEN);
fnum1 = cli_open(cli1, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
cli_write(cli1, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
cli_close(cli1, fnum1);
@@ -1474,7 +1474,7 @@ bool torture_denytest1(int dummy)
}
for (i=0;i<2;i++) {
- cli_unlink(cli1, fnames[i]);
+ cli_unlink(cli1, fnames[i], aSYSTEM | aHIDDEN);
}
if (!torture_close_connection(cli1)) {
@@ -1504,7 +1504,7 @@ bool torture_denytest2(int dummy)
printf("starting denytest2\n");
for (i=0;i<2;i++) {
- cli_unlink(cli1, fnames[i]);
+ cli_unlink(cli1, fnames[i], aSYSTEM | aHIDDEN);
fnum1 = cli_open(cli1, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
cli_write(cli1, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
cli_close(cli1, fnum1);
@@ -1558,7 +1558,7 @@ bool torture_denytest2(int dummy)
}
for (i=0;i<2;i++) {
- cli_unlink(cli1, fnames[i]);
+ cli_unlink(cli1, fnames[i], aSYSTEM | aHIDDEN);
}
if (!torture_close_connection(cli1)) {
diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c
index 4e8dcdd09a..67c9516fb0 100644
--- a/source3/torture/locktest.c
+++ b/source3/torture/locktest.c
@@ -398,7 +398,7 @@ static void close_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
}
}
for (server=0;server<NSERVERS;server++) {
- cli_unlink(cli[server][0], FILENAME);
+ cli_unlink(cli[server][0], FILENAME, aSYSTEM | aHIDDEN);
}
}
diff --git a/source3/torture/locktest2.c b/source3/torture/locktest2.c
index 68e18439e8..10e2cbe772 100644
--- a/source3/torture/locktest2.c
+++ b/source3/torture/locktest2.c
@@ -317,7 +317,7 @@ static void close_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
}
}
for (server=0;server<NSERVERS;server++) {
- cli_unlink(cli[server][0], FILENAME);
+ cli_unlink(cli[server][0], FILENAME, aSYSTEM | aHIDDEN);
}
}
diff --git a/source3/torture/mangle_test.c b/source3/torture/mangle_test.c
index 81bdbce04d..e4468945c1 100644
--- a/source3/torture/mangle_test.c
+++ b/source3/torture/mangle_test.c
@@ -56,7 +56,7 @@ static bool test_one(struct cli_state *cli, const char *name)
}
fstr_sprintf(name2, "\\mangle_test\\%s", shortname);
- if (!cli_unlink(cli, name2)) {
+ if (!NT_STATUS_IS_OK(cli_unlink(cli, name2, aSYSTEM | aHIDDEN))) {
printf("unlink of %s (%s) failed (%s)\n",
name2, name, cli_errstr(cli));
return False;
@@ -74,11 +74,11 @@ static bool test_one(struct cli_state *cli, const char *name)
}
/* and unlink by long name */
- if (!cli_unlink(cli, name)) {
+ if (!NT_STATUS_IS_OK(cli_unlink(cli, name, aSYSTEM | aHIDDEN))) {
printf("unlink2 of %s (%s) failed (%s)\n",
name, name2, cli_errstr(cli));
failures++;
- cli_unlink(cli, name2);
+ cli_unlink(cli, name2, aSYSTEM | aHIDDEN);
return True;
}
@@ -177,7 +177,7 @@ bool torture_mangle(int dummy)
return False;
}
- cli_unlink(cli, "\\mangle_test\\*");
+ cli_unlink(cli, "\\mangle_test\\*", aSYSTEM | aHIDDEN);
cli_rmdir(cli, "\\mangle_test");
if (!NT_STATUS_IS_OK(cli_mkdir(cli, "\\mangle_test"))) {
@@ -201,7 +201,7 @@ bool torture_mangle(int dummy)
}
}
- cli_unlink(cli, "\\mangle_test\\*");
+ cli_unlink(cli, "\\mangle_test\\*", aSYSTEM | aHIDDEN);
if (!NT_STATUS_IS_OK(cli_rmdir(cli, "\\mangle_test"))) {
printf("ERROR: Failed to remove directory\n");
return False;
diff --git a/source3/torture/masktest.c b/source3/torture/masktest.c
index fb562c8075..e80f9cd665 100644
--- a/source3/torture/masktest.c
+++ b/source3/torture/masktest.c
@@ -350,7 +350,7 @@ static void testpair(struct cli_state *cli, const char *mask, const char *file)
if (die_on_error) exit(1);
}
- cli_unlink(cli, file);
+ cli_unlink(cli, file, aSYSTEM | aHIDDEN);
if (count % 100 == 0) DEBUG(0,("%d\n", count));
SAFE_FREE(long_name);
@@ -367,7 +367,7 @@ static void test_mask(int argc, char *argv[],
cli_mkdir(cli, "\\masktest");
- cli_unlink(cli, "\\masktest\\*");
+ cli_unlink(cli, "\\masktest\\*", aSYSTEM | aHIDDEN);
if (argc >= 2) {
while (argc >= 2) {
diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c
index 7503e59357..1542a8ffb4 100644
--- a/source3/torture/nbio.c
+++ b/source3/torture/nbio.c
@@ -128,7 +128,7 @@ void nb_setup(struct cli_state *cli)
void nb_unlink(const char *fname)
{
- if (!cli_unlink(c, fname)) {
+ if (!NT_STATUS_IS_OK(cli_unlink(c, fname, aSYSTEM | aHIDDEN))) {
#if NBDEBUG
printf("(%d) unlink %s failed (%s)\n",
line_count, fname, cli_errstr(c));
diff --git a/source3/torture/scanner.c b/source3/torture/scanner.c
index 21b32dcf23..3e9a24f121 100644
--- a/source3/torture/scanner.c
+++ b/source3/torture/scanner.c
@@ -170,7 +170,7 @@ static bool scan_trans2(struct cli_state *cli, int op, int level,
status = try_trans2_len(cli, "newfile", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
- cli_unlink(cli, "\\newfile.dat");
+ cli_unlink(cli, "\\newfile.dat", aSYSTEM | aHIDDEN);
cli_rmdir(cli, "\\newfile.dat");
if (NT_STATUS_IS_OK(status)) return True;
@@ -372,7 +372,7 @@ static bool scan_nttrans(struct cli_state *cli, int op, int level,
status = try_nttrans_len(cli, "newfile", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
- cli_unlink(cli, "\\newfile.dat");
+ cli_unlink(cli, "\\newfile.dat", aSYSTEM | aHIDDEN);
cli_rmdir(cli, "\\newfile.dat");
if (NT_STATUS_IS_OK(status)) return True;
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 238a2f3c83..1f9d5dbb02 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -487,7 +487,7 @@ static bool rw_torture(struct cli_state *c)
correct = False;
}
- if (!cli_unlink(c, fname)) {
+ if (!NT_STATUS_IS_OK(cli_unlink(c, fname, aSYSTEM | aHIDDEN))) {
printf("unlink failed (%s)\n", cli_errstr(c));
correct = False;
}
@@ -499,7 +499,7 @@ static bool rw_torture(struct cli_state *c)
}
cli_close(c, fnum2);
- cli_unlink(c, lockfname);
+ cli_unlink(c, lockfname, aSYSTEM | aHIDDEN);
printf("%d\n", i);
@@ -634,7 +634,7 @@ static bool rw_torture2(struct cli_state *c1, struct cli_state *c2)
bool correct = True;
ssize_t bytes_read;
- if (!cli_unlink(c1, lockfname)) {
+ if (!NT_STATUS_IS_OK(cli_unlink(c1, lockfname, aSYSTEM | aHIDDEN))) {
printf("unlink failed (%s) (normal, this file should not exist)\n", cli_errstr(c1));
}
@@ -694,7 +694,7 @@ static bool rw_torture2(struct cli_state *c1, struct cli_state *c2)
correct = False;
}
- if (!cli_unlink(c1, lockfname)) {
+ if (!NT_STATUS_IS_OK(cli_unlink(c1, lockfname, aSYSTEM | aHIDDEN))) {
printf("unlink failed (%s)\n", cli_errstr(c1));
correct = False;
}
@@ -772,7 +772,7 @@ static bool run_readwritelarge(int dummy)
printf("starting readwritelarge\n");
- cli_unlink(cli1, lockfname);
+ cli_unlink(cli1, lockfname, aSYSTEM | aHIDDEN);
fnum1 = cli_open(cli1, lockfname, O_RDWR | O_CREAT | O_EXCL, DENY_NONE);
if (fnum1 == -1) {
@@ -801,7 +801,7 @@ static bool run_readwritelarge(int dummy)
correct = False;
}
- if (!cli_unlink(cli1, lockfname)) {
+ if (!NT_STATUS_IS_OK(cli_unlink(cli1, lockfname, aSYSTEM | aHIDDEN))) {
printf("unlink failed (%s)\n", cli_errstr(cli1));
correct = False;
}
@@ -1002,7 +1002,7 @@ static bool run_locktest1(int dummy)
printf("starting locktest1\n");
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
fnum1 = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum1 == -1) {
@@ -1077,7 +1077,7 @@ static bool run_locktest1(int dummy)
return False;
}
- if (!cli_unlink(cli1, fname)) {
+ if (!NT_STATUS_IS_OK(cli_unlink(cli1, fname, aSYSTEM | aHIDDEN))) {
printf("unlink failed (%s)\n", cli_errstr(cli1));
return False;
}
@@ -1119,7 +1119,7 @@ static bool run_tcon_test(int dummy)
printf("starting tcontest\n");
- cli_unlink(cli, fname);
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
fnum1 = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum1 == -1) {
@@ -1378,7 +1378,7 @@ static bool run_locktest2(int dummy)
printf("starting locktest2\n");
- cli_unlink(cli, fname);
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
cli_setpid(cli, 1);
@@ -1517,7 +1517,7 @@ static bool run_locktest3(int dummy)
printf("starting locktest3\n");
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
fnum1 = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum1 == -1) {
@@ -1599,7 +1599,7 @@ static bool run_locktest3(int dummy)
return False;
}
- if (!cli_unlink(cli1, fname)) {
+ if (!NT_STATUS_IS_OK(cli_unlink(cli1, fname, aSYSTEM | aHIDDEN))) {
printf("unlink failed (%s)\n", cli_errstr(cli1));
return False;
}
@@ -1642,7 +1642,7 @@ static bool run_locktest4(int dummy)
printf("starting locktest4\n");
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
fnum1 = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
fnum2 = cli_open(cli2, fname, O_RDWR, DENY_NONE);
@@ -1784,7 +1784,7 @@ static bool run_locktest4(int dummy)
fail:
cli_close(cli1, fnum1);
cli_close(cli2, fnum2);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
torture_close_connection(cli1);
torture_close_connection(cli2);
@@ -1813,7 +1813,7 @@ static bool run_locktest5(int dummy)
printf("starting locktest5\n");
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
fnum1 = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
fnum2 = cli_open(cli2, fname, O_RDWR, DENY_NONE);
@@ -1903,7 +1903,7 @@ static bool run_locktest5(int dummy)
fail:
cli_close(cli1, fnum1);
cli_close(cli2, fnum2);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
if (!torture_close_connection(cli1)) {
correct = False;
}
@@ -1938,7 +1938,7 @@ static bool run_locktest6(int dummy)
for (i=0;i<1;i++) {
printf("Testing %s\n", fname[i]);
- cli_unlink(cli, fname[i]);
+ cli_unlink(cli, fname[i], aSYSTEM | aHIDDEN);
fnum = cli_open(cli, fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
status = cli_locktype(cli, fnum, 0, 8, 0, LOCKING_ANDX_CHANGE_LOCKTYPE);
@@ -1950,7 +1950,7 @@ static bool run_locktest6(int dummy)
cli_close(cli, fnum);
printf("CANCEL_LOCK gave %s\n", nt_errstr(status));
- cli_unlink(cli, fname[i]);
+ cli_unlink(cli, fname[i], aSYSTEM | aHIDDEN);
}
torture_close_connection(cli);
@@ -1975,7 +1975,7 @@ static bool run_locktest7(int dummy)
printf("starting locktest7\n");
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
fnum1 = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
@@ -2085,7 +2085,7 @@ static bool run_locktest7(int dummy)
fail:
cli_close(cli1, fnum1);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
torture_close_connection(cli1);
printf("finished locktest7\n");
@@ -2111,7 +2111,7 @@ static bool run_fdpasstest(int dummy)
printf("starting fdpasstest\n");
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
fnum1 = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum1 == -1) {
@@ -2135,7 +2135,7 @@ static bool run_fdpasstest(int dummy)
}
cli_close(cli1, fnum1);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
torture_close_connection(cli1);
torture_close_connection(cli2);
@@ -2173,8 +2173,8 @@ static bool run_fdsesstest(int dummy)
printf("starting fdsesstest\n");
- cli_unlink(cli, fname);
- cli_unlink(cli, fname1);
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
+ cli_unlink(cli, fname1, aSYSTEM | aHIDDEN);
fnum1 = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum1 == -1) {
@@ -2200,7 +2200,7 @@ static bool run_fdsesstest(int dummy)
if (fnum2 != -1) {
printf("create with different vuid, same cnum succeeded.\n");
cli_close(cli, fnum2);
- cli_unlink(cli, fname1);
+ cli_unlink(cli, fname1, aSYSTEM | aHIDDEN);
} else {
printf("create with different vuid, same cnum failed.\n");
printf("This will cause problems with service clients.\n");
@@ -2220,7 +2220,7 @@ static bool run_fdsesstest(int dummy)
cli->cnum = saved_cnum;
cli_close(cli, fnum1);
- cli_unlink(cli, fname);
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
torture_close_connection(cli);
@@ -2248,7 +2248,7 @@ static bool run_unlinktest(int dummy)
printf("starting unlink test\n");
- cli_unlink(cli, fname);
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
cli_setpid(cli, 1);
@@ -2258,7 +2258,7 @@ static bool run_unlinktest(int dummy)
return False;
}
- if (cli_unlink(cli, fname)) {
+ if (NT_STATUS_IS_OK(cli_unlink(cli, fname, aSYSTEM | aHIDDEN))) {
printf("error: server allowed unlink on an open file\n");
correct = False;
} else {
@@ -2267,7 +2267,7 @@ static bool run_unlinktest(int dummy)
}
cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
if (!torture_close_connection(cli)) {
correct = False;
@@ -2319,7 +2319,7 @@ static bool run_maxfidtest(int dummy)
for (;i>=0;i--) {
slprintf(fname,sizeof(fname)-1,ftemplate, i,(int)getpid());
cli_close(cli, fnums[i]);
- if (!cli_unlink(cli, fname)) {
+ if (!NT_STATUS_IS_OK(cli_unlink(cli, fname, aSYSTEM | aHIDDEN))) {
printf("unlink of %s failed (%s)\n",
fname, cli_errstr(cli));
correct = False;
@@ -2480,7 +2480,7 @@ static bool run_attrtest(int dummy)
return False;
}
- cli_unlink(cli, fname);
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
fnum = cli_open(cli, fname,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
cli_close(cli, fnum);
@@ -2515,7 +2515,7 @@ static bool run_attrtest(int dummy)
correct = True;
}
- cli_unlink(cli, fname);
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
if (!torture_close_connection(cli)) {
correct = False;
@@ -2549,7 +2549,7 @@ static bool run_trans2test(int dummy)
return False;
}
- cli_unlink(cli, fname);
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
fnum = cli_open(cli, fname,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
if (!cli_qfileinfo(cli, fnum, NULL, &size, &c_time_ts, &a_time_ts, &w_time_ts,
@@ -2573,7 +2573,7 @@ static bool run_trans2test(int dummy)
sleep(2);
- cli_unlink(cli, fname);
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
fnum = cli_open(cli, fname,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
if (fnum == -1) {
@@ -2604,7 +2604,7 @@ static bool run_trans2test(int dummy)
}
- cli_unlink(cli, fname);
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
fnum = cli_open(cli, fname,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
cli_close(cli, fnum);
@@ -2620,7 +2620,7 @@ static bool run_trans2test(int dummy)
}
}
- cli_unlink(cli, fname);
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
/* check if the server updates the directory modification time
@@ -2651,7 +2651,7 @@ static bool run_trans2test(int dummy)
correct = False;
}
}
- cli_unlink(cli, fname2);
+ cli_unlink(cli, fname2, aSYSTEM | aHIDDEN);
cli_rmdir(cli, dname);
if (!torture_close_connection(cli)) {
@@ -2734,7 +2734,7 @@ static bool run_oplock1(int dummy)
return False;
}
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
cli_sockopt(cli1, sockops);
@@ -2748,15 +2748,15 @@ static bool run_oplock1(int dummy)
cli1->use_oplocks = False;
- cli_unlink(cli1, fname);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
if (!cli_close(cli1, fnum1)) {
printf("close2 failed (%s)\n", cli_errstr(cli1));
return False;
}
- if (!cli_unlink(cli1, fname)) {
+ if (!NT_STATUS_IS_OK(cli_unlink(cli1, fname, aSYSTEM | aHIDDEN))) {
printf("unlink failed (%s)\n", cli_errstr(cli1));
return False;
}
@@ -2806,7 +2806,7 @@ static bool run_oplock2(int dummy)
cli2->use_oplocks = True;
cli2->use_level_II_oplocks = True;
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
cli_sockopt(cli1, sockops);
cli_sockopt(cli2, sockops);
@@ -2887,7 +2887,7 @@ static bool run_oplock2(int dummy)
sleep(4);
- if (!cli_unlink(cli1, fname)) {
+ if (!NT_STATUS_IS_OK(cli_unlink(cli1, fname, aSYSTEM | aHIDDEN))) {
printf("unlink failed (%s)\n", cli_errstr(cli1));
correct = False;
}
@@ -2987,7 +2987,7 @@ static bool run_deletetest(int dummy)
/* Test 1 - this should delete the file on close. */
cli_setatr(cli1, fname, 0, 0);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
fnum1 = cli_nt_create_full(cli1, fname, 0, GENERIC_ALL_ACCESS|DELETE_ACCESS, FILE_ATTRIBUTE_NORMAL,
0, FILE_OVERWRITE_IF,
@@ -3028,7 +3028,7 @@ static bool run_deletetest(int dummy)
/* Test 2 - this should delete the file on close. */
cli_setatr(cli1, fname, 0, 0);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
fnum1 = cli_nt_create_full(cli1, fname, 0, GENERIC_ALL_ACCESS,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
@@ -3060,13 +3060,13 @@ static bool run_deletetest(int dummy)
correct = False;
goto fail;
}
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
} else
printf("second delete on close test succeeded.\n");
/* Test 3 - ... */
cli_setatr(cli1, fname, 0, 0);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
fnum1 = cli_nt_create_full(cli1, fname, 0, GENERIC_ALL_ACCESS, FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OVERWRITE_IF, 0, 0);
@@ -3126,7 +3126,7 @@ static bool run_deletetest(int dummy)
if (!cli_close(cli1, fnum1)) {
printf("[3] close failed (%s)\n", cli_errstr(cli1));
}
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
correct = False;
goto fail;
} else
@@ -3134,7 +3134,7 @@ static bool run_deletetest(int dummy)
/* Test 4 ... */
cli_setatr(cli1, fname, 0, 0);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
fnum1 = cli_nt_create_full(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OVERWRITE_IF, 0, 0);
@@ -3185,7 +3185,7 @@ static bool run_deletetest(int dummy)
/* Test 5 ... */
cli_setatr(cli1, fname, 0, 0);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
fnum1 = cli_open(cli1, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum1 == -1) {
@@ -3212,7 +3212,7 @@ static bool run_deletetest(int dummy)
/* Test 6 ... */
cli_setatr(cli1, fname, 0, 0);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
fnum1 = cli_nt_create_full(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
@@ -3242,7 +3242,7 @@ static bool run_deletetest(int dummy)
/* Test 7 ... */
cli_setatr(cli1, fname, 0, 0);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
fnum1 = cli_nt_create_full(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF, 0, 0);
@@ -3290,7 +3290,7 @@ static bool run_deletetest(int dummy)
/* Test 7 ... */
cli_setatr(cli1, fname, 0, 0);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
if (!torture_open_connection(&cli2, 1)) {
printf("[8] failed to open second connection.\n");
@@ -3384,7 +3384,7 @@ static bool run_deletetest(int dummy)
printf("tenth delete on close test succeeded.\n");
cli_setatr(cli1, fname, 0, 0);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
/* What error do we get when attempting to open a read-only file with
delete access ? */
@@ -3435,7 +3435,7 @@ static bool run_deletetest(int dummy)
if (fnum1 != -1) cli_close(cli1, fnum1);
if (fnum2 != -1) cli_close(cli1, fnum2);
cli_setatr(cli1, fname, 0, 0);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
if (cli1 && !torture_close_connection(cli1)) {
correct = False;
@@ -3554,8 +3554,8 @@ static bool run_rename(int dummy)
return False;
}
- cli_unlink(cli1, fname);
- cli_unlink(cli1, fname1);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
+ cli_unlink(cli1, fname1, aSYSTEM | aHIDDEN);
fnum1 = cli_nt_create_full(cli1, fname, 0, GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ, FILE_OVERWRITE_IF, 0, 0);
@@ -3576,8 +3576,8 @@ static bool run_rename(int dummy)
return False;
}
- cli_unlink(cli1, fname);
- cli_unlink(cli1, fname1);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
+ cli_unlink(cli1, fname1, aSYSTEM | aHIDDEN);
fnum1 = cli_nt_create_full(cli1, fname, 0, GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL,
#if 0
FILE_SHARE_DELETE|FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0);
@@ -3602,8 +3602,8 @@ static bool run_rename(int dummy)
return False;
}
- cli_unlink(cli1, fname);
- cli_unlink(cli1, fname1);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
+ cli_unlink(cli1, fname1, aSYSTEM | aHIDDEN);
fnum1 = cli_nt_create_full(cli1, fname, 0, READ_CONTROL_ACCESS, FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0);
@@ -3649,8 +3649,8 @@ static bool run_rename(int dummy)
return False;
}
- cli_unlink(cli1, fname);
- cli_unlink(cli1, fname1);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
+ cli_unlink(cli1, fname1, aSYSTEM | aHIDDEN);
/*----*/
@@ -3674,8 +3674,8 @@ static bool run_rename(int dummy)
return False;
}
- cli_unlink(cli1, fname);
- cli_unlink(cli1, fname1);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
+ cli_unlink(cli1, fname1, aSYSTEM | aHIDDEN);
/*--*/
@@ -3719,8 +3719,8 @@ static bool run_rename(int dummy)
return False;
}
- cli_unlink(cli1, fname);
- cli_unlink(cli1, fname1);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
+ cli_unlink(cli1, fname1, aSYSTEM | aHIDDEN);
if (!torture_close_connection(cli1)) {
correct = False;
@@ -3780,7 +3780,7 @@ static bool run_opentest(int dummy)
}
cli_setatr(cli1, fname, 0, 0);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
cli_sockopt(cli1, sockops);
@@ -3841,7 +3841,7 @@ static bool run_opentest(int dummy)
return False;
}
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
printf("finished open test 2\n");
@@ -3903,7 +3903,7 @@ static bool run_opentest(int dummy)
}
printf("finished open test 3\n");
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
printf("testing ctemp\n");
@@ -3916,7 +3916,7 @@ static bool run_opentest(int dummy)
if (!cli_close(cli1, fnum1)) {
printf("close of temp failed (%s)\n", cli_errstr(cli1));
}
- if (!cli_unlink(cli1, tmp_path)) {
+ if (!NT_STATUS_IS_OK(cli_unlink(cli1, tmp_path, aSYSTEM | aHIDDEN))) {
printf("unlink of temp failed (%s)\n", cli_errstr(cli1));
}
@@ -3927,7 +3927,7 @@ static bool run_opentest(int dummy)
}
cli_setatr(cli2, fname, 0, 0);
- cli_unlink(cli2, fname);
+ cli_unlink(cli2, fname, aSYSTEM | aHIDDEN);
cli_sockopt(cli2, sockops);
@@ -3960,7 +3960,7 @@ static bool run_opentest(int dummy)
printf("non-io open test #1 passed.\n");
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
printf("TEST #2 testing 2 non-io opens (first with delete)\n");
@@ -3991,7 +3991,7 @@ static bool run_opentest(int dummy)
printf("non-io open test #2 passed.\n");
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
printf("TEST #3 testing 2 non-io opens (second with delete)\n");
@@ -4022,7 +4022,7 @@ static bool run_opentest(int dummy)
printf("non-io open test #3 passed.\n");
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
printf("TEST #4 testing 2 non-io opens (both with delete)\n");
@@ -4051,7 +4051,7 @@ static bool run_opentest(int dummy)
printf("non-io open test #4 passed.\n");
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
printf("TEST #5 testing 2 non-io opens (both with delete - both with file share delete)\n");
@@ -4085,7 +4085,7 @@ static bool run_opentest(int dummy)
printf("TEST #6 testing 1 non-io open, one io open\n");
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
fnum1 = cli_nt_create_full(cli1, fname, 0, FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0);
@@ -4117,7 +4117,7 @@ static bool run_opentest(int dummy)
printf("TEST #7 testing 1 non-io open, one io open with delete\n");
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
fnum1 = cli_nt_create_full(cli1, fname, 0, FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0);
@@ -4144,7 +4144,7 @@ static bool run_opentest(int dummy)
printf("non-io open test #7 passed.\n");
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
if (!torture_close_connection(cli1)) {
correct = False;
@@ -4344,7 +4344,7 @@ static bool run_openattrtest(int dummy)
for (k = 0, i = 0; i < sizeof(open_attrs_table)/sizeof(uint32); i++) {
cli_setatr(cli1, fname, 0, 0);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
fnum1 = cli_nt_create_full(cli1, fname, 0, FILE_WRITE_DATA, open_attrs_table[i],
FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0);
@@ -4420,7 +4420,7 @@ static bool run_openattrtest(int dummy)
}
cli_setatr(cli1, fname, 0, 0);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
printf("open attr test %s.\n", correct ? "passed" : "failed");
@@ -4478,7 +4478,7 @@ static bool run_dirtest(int dummy)
for (i=0;i<torture_numops;i++) {
fstring fname;
slprintf(fname, sizeof(fname), "\\%x", (int)random());
- cli_unlink(cli, fname);
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
}
if (!torture_close_connection(cli)) {
@@ -4503,7 +4503,7 @@ static void del_fn(const char *mnt, file_info *finfo, const char *mask, void *st
if (!NT_STATUS_IS_OK(cli_rmdir(pcli, fname)))
printf("del_fn: failed to rmdir %s\n,", fname );
} else {
- if (!cli_unlink(pcli, fname))
+ if (!NT_STATUS_IS_OK(cli_unlink(pcli, fname, aSYSTEM | aHIDDEN)))
printf("del_fn: failed to unlink %s\n,", fname );
}
}
@@ -4527,7 +4527,7 @@ bool torture_ioctl_test(int dummy)
printf("starting ioctl test\n");
- cli_unlink(cli, fname);
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
fnum = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum == -1) {
@@ -4581,7 +4581,7 @@ bool torture_chkpath_test(int dummy)
/* cleanup from an old run */
cli_rmdir(cli, "\\chkpath.dir\\dir2");
- cli_unlink(cli, "\\chkpath.dir\\*");
+ cli_unlink(cli, "\\chkpath.dir\\*", aSYSTEM | aHIDDEN);
cli_rmdir(cli, "\\chkpath.dir");
if (!NT_STATUS_IS_OK(cli_mkdir(cli, "\\chkpath.dir"))) {
@@ -4636,7 +4636,7 @@ bool torture_chkpath_test(int dummy)
}
cli_rmdir(cli, "\\chkpath.dir\\dir2");
- cli_unlink(cli, "\\chkpath.dir\\*");
+ cli_unlink(cli, "\\chkpath.dir\\*", aSYSTEM | aHIDDEN);
cli_rmdir(cli, "\\chkpath.dir");
if (!torture_close_connection(cli)) {
@@ -4663,7 +4663,7 @@ static bool run_eatest(int dummy)
return False;
}
- cli_unlink(cli, fname);
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
fnum = cli_nt_create_full(cli, fname, 0,
FIRST_DESIRED_ACCESS, FILE_ATTRIBUTE_ARCHIVE,
FILE_SHARE_NONE, FILE_OVERWRITE_IF,
@@ -5228,7 +5228,7 @@ static bool run_windows_write(int dummy)
ret = true;
fail:
cli_close(cli1, fnum);
- cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
torture_close_connection(cli1);
return ret;
}
diff --git a/source3/torture/utable.c b/source3/torture/utable.c
index aaa763a2a3..3b7523a85a 100644
--- a/source3/torture/utable.c
+++ b/source3/torture/utable.c
@@ -38,7 +38,7 @@ bool torture_utable(int dummy)
memset(valid, 0, sizeof(valid));
cli_mkdir(cli, "\\utable");
- cli_unlink(cli, "\\utable\\*");
+ cli_unlink(cli, "\\utable\\*", aSYSTEM | aHIDDEN);
for (c=1; c < 0x10000; c++) {
char *p;
@@ -67,7 +67,7 @@ bool torture_utable(int dummy)
}
cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
if (c % 100 == 0) {
printf("%d (%d/%d)\r", c, chars_allowed, alt_allowed);
@@ -130,7 +130,7 @@ bool torture_casetable(int dummy)
memset(equiv, 0, sizeof(equiv));
- cli_unlink(cli, "\\utable\\*");
+ cli_unlink(cli, "\\utable\\*", aSYSTEM | aHIDDEN);
cli_rmdir(cli, "\\utable");
if (!NT_STATUS_IS_OK(cli_mkdir(cli, "\\utable"))) {
printf("Failed to create utable directory!\n");
@@ -187,7 +187,7 @@ bool torture_casetable(int dummy)
cli_close(cli, fnum);
}
- cli_unlink(cli, "\\utable\\*");
+ cli_unlink(cli, "\\utable\\*", aSYSTEM | aHIDDEN);
cli_rmdir(cli, "\\utable");
return True;