diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/basic/base.c | 14 | ||||
-rw-r--r-- | source4/torture/basic/delete.c | 72 |
2 files changed, 43 insertions, 43 deletions
diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index ddcbcba2e6..70dab96dfa 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -1619,7 +1619,7 @@ static BOOL torture_samba3_errorpaths(struct torture_context *torture) BOOL result = False; int fnum; const char *os2_fname = ".+,;=[]."; - const char *dirname = "samba3_errordir"; + const char *dname = "samba3_errordir"; union smb_open io; TALLOC_CTX *mem_ctx = talloc_init(NULL); NTSTATUS status; @@ -1656,10 +1656,10 @@ static BOOL torture_samba3_errorpaths(struct torture_context *torture) } smbcli_unlink(cli_nt->tree, os2_fname); - smbcli_rmdir(cli_nt->tree, dirname); + smbcli_rmdir(cli_nt->tree, dname); - if (!NT_STATUS_IS_OK(smbcli_mkdir(cli_nt->tree, dirname))) { - printf("smbcli_mkdir(%s) failed: %s\n", dirname, + if (!NT_STATUS_IS_OK(smbcli_mkdir(cli_nt->tree, dname))) { + printf("smbcli_mkdir(%s) failed: %s\n", dname, smbcli_errstr(cli_nt->tree)); goto fail; } @@ -1675,7 +1675,7 @@ static BOOL torture_samba3_errorpaths(struct torture_context *torture) io.ntcreatex.in.create_options = 0; io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; - io.ntcreatex.in.fname = dirname; + io.ntcreatex.in.fname = dname; status = smb_raw_open(cli_nt->tree, mem_ctx, &io); if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) { @@ -1692,14 +1692,14 @@ static BOOL torture_samba3_errorpaths(struct torture_context *torture) goto fail; } - status = smbcli_mkdir(cli_nt->tree, dirname); + status = smbcli_mkdir(cli_nt->tree, dname); if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) { printf("(%s) incorrect status %s should be %s\n", __location__, nt_errstr(status), nt_errstr(NT_STATUS_OBJECT_NAME_COLLISION)); goto fail; } - status = smbcli_mkdir(cli_dos->tree, dirname); + status = smbcli_mkdir(cli_dos->tree, dname); if (!NT_STATUS_EQUAL(status, NT_STATUS_DOS(ERRDOS, ERRnoaccess))) { printf("(%s) incorrect status %s should be %s\n", __location__, nt_errstr(status), diff --git a/source4/torture/basic/delete.c b/source4/torture/basic/delete.c index 6e1c34612f..faefd48b74 100644 --- a/source4/torture/basic/delete.c +++ b/source4/torture/basic/delete.c @@ -145,13 +145,13 @@ static BOOL check_delete_on_close(struct smbcli_state *cli, int fnum, goto fail; \ }} while (0) -const char *fname = "\\delete.file"; -const char *fname_new = "\\delete.new"; -const char *dirname = "\\delete.dir"; +static const char *fname = "\\delete.file"; +static const char *fname_new = "\\delete.new"; +static const char *dname = "\\delete.dir"; static void del_clean_area(struct smbcli_state *cli1, struct smbcli_state *cli2) { - smbcli_deltree(cli1->tree, dirname); + smbcli_deltree(cli1->tree, dname); smbcli_setatr(cli1->tree, fname, 0, 0); smbcli_unlink(cli1->tree, fname); smbcli_setatr(cli1->tree, fname_new, 0, 0); @@ -886,7 +886,7 @@ static BOOL deltest14(struct smbcli_state *cli1, struct smbcli_state *cli2) /* Test 14 -- directory */ - dnum1 = smbcli_nt_create_full(cli1->tree, dirname, 0, + dnum1 = smbcli_nt_create_full(cli1->tree, dname, 0, SEC_FILE_READ_DATA| SEC_FILE_WRITE_DATA| SEC_STD_DELETE, @@ -897,24 +897,24 @@ static BOOL deltest14(struct smbcli_state *cli1, struct smbcli_state *cli2) NTCREATEX_DISP_CREATE, 0, 0); if (dnum1 == -1) { printf("(%s) open of %s failed: %s!\n", - __location__, dirname, smbcli_errstr(cli1->tree)); + __location__, dname, smbcli_errstr(cli1->tree)); correct = False; goto fail; } - correct &= check_delete_on_close(cli1, dnum1, dirname, False, __location__); + correct &= check_delete_on_close(cli1, dnum1, dname, False, __location__); if (NT_STATUS_IS_ERR(smbcli_nt_delete_on_close(cli1->tree, dnum1, True))) { printf("(%s) setting delete_on_close on file failed !\n", __location__); correct = False; goto fail; } - correct &= check_delete_on_close(cli1, dnum1, dirname, True, __location__); + correct &= check_delete_on_close(cli1, dnum1, dname, True, __location__); smbcli_close(cli1->tree, dnum1); /* Now it should be gone... */ - dnum1 = smbcli_nt_create_full(cli1->tree, dirname, 0, + dnum1 = smbcli_nt_create_full(cli1->tree, dname, 0, SEC_FILE_READ_DATA| SEC_FILE_WRITE_DATA| SEC_STD_DELETE, @@ -1277,10 +1277,10 @@ static BOOL deltest18(struct smbcli_state *cli1, struct smbcli_state *cli2) smbcli_close(cli1->tree, fnum1); smbcli_close(cli1->tree, fnum2); - smbcli_deltree(cli1->tree, dirname); + smbcli_deltree(cli1->tree, dname); /* Firstly create with all access, but delete on close. */ - fnum1 = smbcli_nt_create_full(cli1->tree, dirname, 0, + fnum1 = smbcli_nt_create_full(cli1->tree, dname, 0, SEC_FILE_READ_DATA| SEC_FILE_WRITE_DATA| SEC_STD_DELETE, @@ -1293,16 +1293,16 @@ static BOOL deltest18(struct smbcli_state *cli1, struct smbcli_state *cli2) if (fnum1 == -1) { printf("(%s) open - 1 of %s failed (%s)\n", - __location__, dirname, smbcli_errstr(cli1->tree)); + __location__, dname, smbcli_errstr(cli1->tree)); correct = False; goto fail; } /* The delete on close bit is *not* reported as being set. */ - correct &= check_delete_on_close(cli1, fnum1, dirname, False, __location__); + correct &= check_delete_on_close(cli1, fnum1, dname, False, __location__); /* Now try opening again for read-only. */ - fnum2 = smbcli_nt_create_full(cli1->tree, dirname, 0, + fnum2 = smbcli_nt_create_full(cli1->tree, dname, 0, SEC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_DIRECTORY, NTCREATEX_SHARE_ACCESS_READ| @@ -1315,22 +1315,22 @@ static BOOL deltest18(struct smbcli_state *cli1, struct smbcli_state *cli2) /* Should work. */ if (fnum2 == -1) { printf("(%s) open - 1 of %s failed (%s)\n", - __location__, dirname, smbcli_errstr(cli1->tree)); + __location__, dname, smbcli_errstr(cli1->tree)); correct = False; goto fail; } - correct &= check_delete_on_close(cli1, fnum1, dirname, False, __location__); - correct &= check_delete_on_close(cli1, fnum2, dirname, False, __location__); + correct &= check_delete_on_close(cli1, fnum1, dname, False, __location__); + correct &= check_delete_on_close(cli1, fnum2, dname, False, __location__); smbcli_close(cli1->tree, fnum1); - correct &= check_delete_on_close(cli1, fnum2, dirname, True, __location__); + correct &= check_delete_on_close(cli1, fnum2, dname, True, __location__); smbcli_close(cli1->tree, fnum2); /* And the directory should be deleted ! */ - fnum1 = smbcli_nt_create_full(cli1->tree, dirname, 0, + fnum1 = smbcli_nt_create_full(cli1->tree, dname, 0, SEC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_DIRECTORY, NTCREATEX_SHARE_ACCESS_READ| @@ -1340,7 +1340,7 @@ static BOOL deltest18(struct smbcli_state *cli1, struct smbcli_state *cli2) NTCREATEX_OPTIONS_DIRECTORY, 0); if (fnum1 != -1) { printf("(%s) open of %s succeeded (should fail)\n", - __location__, dirname); + __location__, dname); correct = False; goto fail; } @@ -1363,10 +1363,10 @@ static BOOL deltest19(struct smbcli_state *cli1, struct smbcli_state *cli2) /* Test 19. */ - smbcli_deltree(cli1->tree, dirname); + smbcli_deltree(cli1->tree, dname); /* Firstly open and create with all access */ - fnum1 = smbcli_nt_create_full(cli1->tree, dirname, 0, + fnum1 = smbcli_nt_create_full(cli1->tree, dname, 0, SEC_FILE_READ_DATA| SEC_FILE_WRITE_DATA| SEC_STD_DELETE, @@ -1379,7 +1379,7 @@ static BOOL deltest19(struct smbcli_state *cli1, struct smbcli_state *cli2) if (fnum1 == -1) { printf("(%s) open - 1 of %s failed (%s)\n", - __location__, dirname, smbcli_errstr(cli1->tree)); + __location__, dname, smbcli_errstr(cli1->tree)); correct = False; goto fail; } @@ -1388,7 +1388,7 @@ static BOOL deltest19(struct smbcli_state *cli1, struct smbcli_state *cli2) smbcli_close(cli1->tree, fnum1); /* Next open with all access, but add delete on close. */ - fnum1 = smbcli_nt_create_full(cli1->tree, dirname, 0, + fnum1 = smbcli_nt_create_full(cli1->tree, dname, 0, SEC_FILE_READ_DATA| SEC_FILE_WRITE_DATA| SEC_STD_DELETE, @@ -1407,10 +1407,10 @@ static BOOL deltest19(struct smbcli_state *cli1, struct smbcli_state *cli2) } /* The delete on close bit is *not* reported as being set. */ - correct &= check_delete_on_close(cli1, fnum1, dirname, False, __location__); + correct &= check_delete_on_close(cli1, fnum1, dname, False, __location__); /* Now try opening again for read-only. */ - fnum2 = smbcli_nt_create_full(cli1->tree, dirname, 0, + fnum2 = smbcli_nt_create_full(cli1->tree, dname, 0, SEC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_DIRECTORY, NTCREATEX_SHARE_ACCESS_READ| @@ -1422,19 +1422,19 @@ static BOOL deltest19(struct smbcli_state *cli1, struct smbcli_state *cli2) /* Should work. */ if (fnum2 == -1) { printf("(%s) open - 1 of %s failed (%s)\n", - __location__, dirname, smbcli_errstr(cli1->tree)); + __location__, dname, smbcli_errstr(cli1->tree)); correct = False; goto fail; } smbcli_close(cli1->tree, fnum1); - correct &= check_delete_on_close(cli1, fnum2, dirname, True, __location__); + correct &= check_delete_on_close(cli1, fnum2, dname, True, __location__); smbcli_close(cli1->tree, fnum2); /* See if the file is deleted - for a directory this seems to be true ! */ - fnum1 = smbcli_nt_create_full(cli1->tree, dirname, 0, + fnum1 = smbcli_nt_create_full(cli1->tree, dname, 0, SEC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_DIRECTORY, NTCREATEX_SHARE_ACCESS_READ| @@ -1447,7 +1447,7 @@ static BOOL deltest19(struct smbcli_state *cli1, struct smbcli_state *cli2) if (fnum1 != -1) { printf("(%s) open of %s succeeded (should fail)\n", - __location__, dirname); + __location__, dname); correct = False; goto fail; } @@ -1471,9 +1471,9 @@ static BOOL deltest20(struct smbcli_state *cli1, struct smbcli_state *cli2) /* Test 20 -- non-empty directory hardest to get right... */ - smbcli_deltree(cli1->tree, dirname); + smbcli_deltree(cli1->tree, dname); - dnum1 = smbcli_nt_create_full(cli1->tree, dirname, 0, + dnum1 = smbcli_nt_create_full(cli1->tree, dname, 0, SEC_FILE_READ_DATA| SEC_FILE_WRITE_DATA| SEC_STD_DELETE, @@ -1485,17 +1485,17 @@ static BOOL deltest20(struct smbcli_state *cli1, struct smbcli_state *cli2) NTCREATEX_OPTIONS_DIRECTORY, 0); if (dnum1 == -1) { printf("(%s) open of %s failed: %s!\n", - __location__, dirname, smbcli_errstr(cli1->tree)); + __location__, dname, smbcli_errstr(cli1->tree)); correct = False; goto fail; } - correct &= check_delete_on_close(cli1, dnum1, dirname, False, __location__); + correct &= check_delete_on_close(cli1, dnum1, dname, False, __location__); status = smbcli_nt_delete_on_close(cli1->tree, dnum1, True); { char *fullname; - asprintf(&fullname, "\\%s%s", dirname, fname); + asprintf(&fullname, "\\%s%s", dname, fname); fnum1 = smbcli_open(cli1->tree, fullname, O_CREAT|O_RDWR, DENY_NONE); if (fnum1 != -1) { @@ -1526,7 +1526,7 @@ static BOOL deltest20(struct smbcli_state *cli1, struct smbcli_state *cli2) { char *fullname; - asprintf(&fullname, "\\%s%s", dirname, fname); + asprintf(&fullname, "\\%s%s", dname, fname); fnum1 = smbcli_open(cli1->tree, fullname, O_CREAT|O_RDWR, DENY_NONE); if (fnum1 == -1) { |