1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

r8176: Exploring the share mode database...

A delete-on-close deleted file is still around while open on another fd. But
only for findfirst, not for qpathinfo :-)

Volker
This commit is contained in:
Volker Lendecke 2005-07-06 07:45:22 +00:00 committed by Gerald (Jerry) Carter
parent ff58ecad04
commit dbc7a1a978
2 changed files with 50 additions and 9 deletions

View File

@ -463,6 +463,45 @@ BOOL torture_test_delete(void)
goto fail;
}
{
TALLOC_CTX *mem_ctx = talloc_init("single_search");
union smb_search_data data;
status = torture_single_search(cli1, mem_ctx,
fname, RAW_SEARCH_FULL_DIRECTORY_INFO,
&data);
if (!NT_STATUS_IS_OK(status)) {
printf("(%s) single_search failed (%s)\n",
__location__, nt_errstr(status));
correct = False;
}
talloc_free(mem_ctx);
}
{
time_t c_time, a_time, m_time, w_time;
size_t size;
uint16_t mode;
ino_t ino;
status = smbcli_qpathinfo(cli1->tree, fname,
&c_time, &a_time, &m_time,
&size, &mode);
if (!NT_STATUS_EQUAL(status, NT_STATUS_DELETE_PENDING)) {
printf("(%s) qpathinfo did not give correct error "
"code (%s) -- NT_STATUS_DELETE_PENDING "
"expected\n", __location__,
nt_errstr(status));
correct = False;
}
status = smbcli_qfileinfo(cli2->tree, fnum2, &mode, &size,
&c_time, &a_time, &m_time,
&w_time, &ino);
if (!NT_STATUS_IS_OK(status)) {
printf("(%s) qfileinfo failed (%s)\n",
__location__, smbcli_errstr(cli1->tree));
correct = False;
}
}
if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {
printf("(%s) close - 2 failed (%s)\n",
__location__, smbcli_errstr(cli2->tree));

View File

@ -40,11 +40,11 @@ static BOOL single_search_callback(void *private, union smb_search_data *file)
/*
do a single file (non-wildcard) search
*/
static NTSTATUS single_search(struct smbcli_state *cli,
TALLOC_CTX *mem_ctx,
const char *pattern,
enum smb_search_level level,
union smb_search_data *data)
NTSTATUS torture_single_search(struct smbcli_state *cli,
TALLOC_CTX *mem_ctx,
const char *pattern,
enum smb_search_level level,
union smb_search_data *data)
{
union smb_search_first io;
union smb_search_close c;
@ -144,8 +144,9 @@ static BOOL test_one_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing %s\n", levels[i].name);
levels[i].status = single_search(cli, mem_ctx, fname,
levels[i].level, &levels[i].data);
levels[i].status = torture_single_search(cli, mem_ctx, fname,
levels[i].level,
&levels[i].data);
/* see if this server claims to support this level */
if ((cap & levels[i].capability_mask) != levels[i].capability_mask) {
@ -162,8 +163,9 @@ static BOOL test_one_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
continue;
}
status = single_search(cli, mem_ctx, fname2,
levels[i].level, &levels[i].data);
status = torture_single_search(cli, mem_ctx, fname2,
levels[i].level,
&levels[i].data);
expected_status = NT_STATUS_NO_SUCH_FILE;
if (levels[i].level == RAW_SEARCH_SEARCH ||