status = cli_open(c, lockfname, O_RDWR, DENY_NONE, &fnum2);
}
if (!NT_STATUS_IS_OK(status)) {
- printf("open of %s failed (%s)\n", lockfname, cli_errstr(c));
+ printf("open of %s failed (%s)\n",
+ lockfname, nt_errstr(status));
return False;
}
return False;
}
- if (!NT_STATUS_IS_OK(cli_open(c, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_ALL, &fnum))) {
- printf("open failed (%s)\n", cli_errstr(c));
+ status = cli_open(c, fname, O_RDWR | O_CREAT | O_TRUNC,
+ DENY_ALL, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open failed (%s)\n", nt_errstr(status));
correct = False;
break;
}
correct = False;
}
- if (!NT_STATUS_IS_OK(cli_close(c, fnum))) {
- printf("close failed (%s)\n", cli_errstr(c));
+ status = cli_close(c, fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close failed (%s)\n", nt_errstr(status));
correct = False;
}
- if (!NT_STATUS_IS_OK(cli_unlink(c, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) {
- printf("unlink failed (%s)\n", cli_errstr(c));
+ status = cli_unlink(c, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("unlink failed (%s)\n", nt_errstr(status));
correct = False;
}
- if (!NT_STATUS_IS_OK(cli_unlock(c, fnum2, n*sizeof(int), sizeof(int)))) {
- printf("unlock failed (%s)\n", cli_errstr(c));
+ status = cli_unlock(c, fnum2, n*sizeof(int), sizeof(int));
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("unlock failed (%s)\n", nt_errstr(status));
correct = False;
}
}
printf("unlink failed (%s) (normal, this file should not exist)\n", cli_errstr(c));
}
- if (!NT_STATUS_IS_OK(cli_open(c, lockfname, O_RDWR | O_CREAT | O_EXCL,
- DENY_NONE, &fnum))) {
+ status = cli_open(c, lockfname, O_RDWR | O_CREAT | O_EXCL,
+ DENY_NONE, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
printf("first open read/write of %s failed (%s)\n",
- lockfname, cli_errstr(c));
+ lockfname, nt_errstr(status));
return False;
}
}
}
if (!NT_STATUS_IS_OK(status)) {
printf("second open read-only of %s failed (%s)\n",
- lockfname, cli_errstr(c));
+ lockfname, nt_errstr(status));
return False;
}
}
}
- if (!NT_STATUS_IS_OK(cli_close(c, fnum))) {
- printf("close failed (%s)\n", cli_errstr(c));
+ status = cli_close(c, fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close failed (%s)\n", nt_errstr(status));
correct = False;
}
char buf_rd[131072];
bool correct = True;
ssize_t bytes_read;
+ NTSTATUS status;
- if (!NT_STATUS_IS_OK(cli_unlink(c1, lockfname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) {
- printf("unlink failed (%s) (normal, this file should not exist)\n", cli_errstr(c1));
+ status = cli_unlink(c1, lockfname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("unlink failed (%s) (normal, this file should not exist)\n", nt_errstr(status));
}
- if (!NT_STATUS_IS_OK(cli_open(c1, lockfname, O_RDWR | O_CREAT | O_EXCL,
- DENY_NONE, &fnum1))) {
+ status = cli_open(c1, lockfname, O_RDWR | O_CREAT | O_EXCL,
+ DENY_NONE, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
printf("first open read/write of %s failed (%s)\n",
- lockfname, cli_errstr(c1));
+ lockfname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_open(c2, lockfname, O_RDONLY,
- DENY_NONE, &fnum2))) {
+
+ status = cli_open(c2, lockfname, O_RDONLY, DENY_NONE, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
printf("second open read-only of %s failed (%s)\n",
- lockfname, cli_errstr(c2));
+ lockfname, nt_errstr(status));
cli_close(c1, fnum1);
return False;
}
- for (i=0;i<torture_numops;i++)
+ for (i = 0; i < torture_numops; i++)
{
NTSTATUS status;
size_t buf_size = ((unsigned)sys_random()%(sizeof(buf)-1))+ 1;
}
}
- if (!NT_STATUS_IS_OK(cli_close(c2, fnum2))) {
- printf("close failed (%s)\n", cli_errstr(c2));
+ status = cli_close(c2, fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close failed (%s)\n", nt_errstr(status));
correct = False;
}
- if (!NT_STATUS_IS_OK(cli_close(c1, fnum1))) {
- printf("close failed (%s)\n", cli_errstr(c1));
+
+ status = cli_close(c1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close failed (%s)\n", nt_errstr(status));
correct = False;
}
- if (!NT_STATUS_IS_OK(cli_unlink(c1, lockfname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) {
- printf("unlink failed (%s)\n", cli_errstr(c1));
+ status = cli_unlink(c1, lockfname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("unlink failed (%s)\n", nt_errstr(status));
correct = False;
}
SMB_OFF_T fsize;
char buf[126*1024];
bool correct = True;
+ NTSTATUS status;
if (!torture_open_connection(&cli1, 0)) {
return False;
cli_unlink(cli1, lockfname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_open(cli1, lockfname, O_RDWR | O_CREAT | O_EXCL, DENY_NONE, &fnum1))) {
- printf("open read/write of %s failed (%s)\n", lockfname, cli_errstr(cli1));
+ status = cli_open(cli1, lockfname, O_RDWR | O_CREAT | O_EXCL,
+ DENY_NONE, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open read/write of %s failed (%s)\n", lockfname, nt_errstr(status));
return False;
}
cli_writeall(cli1, fnum1, 0, (uint8_t *)buf, 0, sizeof(buf), NULL);
- if (!NT_STATUS_IS_OK(cli_qfileinfo_basic(
- cli1, fnum1, NULL, &fsize, NULL, NULL,
- NULL, NULL, NULL))) {
- printf("qfileinfo failed (%s)\n", cli_errstr(cli1));
+ status = cli_qfileinfo_basic(cli1, fnum1, NULL, &fsize, NULL, NULL,
+ NULL, NULL, NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("qfileinfo failed (%s)\n", nt_errstr(status));
correct = False;
}
correct = False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close failed (%s)\n", nt_errstr(status));
correct = False;
}
- if (!NT_STATUS_IS_OK(cli_unlink(cli1, lockfname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) {
- printf("unlink failed (%s)\n", cli_errstr(cli1));
+ status = cli_unlink(cli1, lockfname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("unlink failed (%s)\n", nt_errstr(status));
correct = False;
}
- if (!NT_STATUS_IS_OK(cli_open(cli1, lockfname, O_RDWR | O_CREAT | O_EXCL, DENY_NONE, &fnum1))) {
- printf("open read/write of %s failed (%s)\n", lockfname, cli_errstr(cli1));
+ status = cli_open(cli1, lockfname, O_RDWR | O_CREAT | O_EXCL,
+ DENY_NONE, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open read/write of %s failed (%s)\n", lockfname, nt_errstr(status));
return False;
}
cli_smbwrite(cli1, fnum1, buf, 0, sizeof(buf), NULL);
- if (!NT_STATUS_IS_OK(cli_qfileinfo_basic(
- cli1, fnum1, NULL, &fsize, NULL, NULL,
- NULL, NULL, NULL))) {
- printf("qfileinfo failed (%s)\n", cli_errstr(cli1));
+ status = cli_qfileinfo_basic(cli1, fnum1, NULL, &fsize, NULL, NULL,
+ NULL, NULL, NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("qfileinfo failed (%s)\n", nt_errstr(status));
correct = False;
}
printf("readwritelarge test 3 (truncate test) succeeded (size = %x)\n", fsize);
#endif
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close failed (%s)\n", nt_errstr(status));
correct = False;
}
uint16_t fnum1, fnum2, fnum3;
time_t t1, t2;
unsigned lock_timeout;
+ NTSTATUS status;
if (!torture_open_connection(&cli1, 0) || !torture_open_connection(&cli2, 1)) {
return False;
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE,
+ &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDWR, DENY_NONE, &fnum2))) {
- printf("open2 of %s failed (%s)\n", fname, cli_errstr(cli1));
+
+ status = cli_open(cli1, fname, O_RDWR, DENY_NONE, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_open(cli2, fname, O_RDWR, DENY_NONE, &fnum3))) {
- printf("open3 of %s failed (%s)\n", fname, cli_errstr(cli2));
+
+ status = cli_open(cli2, fname, O_RDWR, DENY_NONE, &fnum3);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open3 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
printf("server slept for %u seconds for a %u second timeout\n",
(unsigned int)(t2-t1), lock_timeout);
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum2))) {
- printf("close1 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close1 failed (%s)\n", nt_errstr(status));
return False;
}
NT_STATUS_FILE_LOCK_CONFLICT)) return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close2 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close2 failed (%s)\n", nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli2, fnum3))) {
- printf("close3 failed (%s)\n", cli_errstr(cli2));
+ status = cli_close(cli2, fnum3);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close3 failed (%s)\n", nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) {
- printf("unlink failed (%s)\n", cli_errstr(cli1));
+ status = cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("unlink failed (%s)\n", nt_errstr(status));
return False;
}
cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli));
+ status = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
cli->cnum = cnum1;
cli->vuid = vuid1;
- if (!NT_STATUS_IS_OK(cli_close(cli, fnum1))) {
- printf("close failed (%s)\n", cli_errstr(cli));
+ status = cli_close(cli, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close failed (%s)\n", nt_errstr(status));
return False;
}
const char *fname = "\\lockt2.lck";
uint16_t fnum1, fnum2, fnum3;
bool correct = True;
+ NTSTATUS status;
if (!torture_open_connection(&cli, 0)) {
return False;
cli_setpid(cli, 1);
- if (!NT_STATUS_IS_OK(cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli));
+ status = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_open(cli, fname, O_RDWR, DENY_NONE, &fnum2))) {
- printf("open2 of %s failed (%s)\n", fname, cli_errstr(cli));
+ status = cli_open(cli, fname, O_RDWR, DENY_NONE, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
cli_setpid(cli, 2);
- if (!NT_STATUS_IS_OK(cli_open(cli, fname, O_RDWR, DENY_NONE, &fnum3))) {
- printf("open3 of %s failed (%s)\n", fname, cli_errstr(cli));
+ status = cli_open(cli, fname, O_RDWR, DENY_NONE, &fnum3);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open3 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
cli_setpid(cli, 1);
- if (!NT_STATUS_IS_OK(cli_close(cli, fnum1))) {
- printf("close1 failed (%s)\n", cli_errstr(cli));
+ status = cli_close(cli, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close1 failed (%s)\n", nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli, fnum2))) {
- printf("close2 failed (%s)\n", cli_errstr(cli));
+ status = cli_close(cli, fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close2 failed (%s)\n", nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli, fnum3))) {
- printf("close3 failed (%s)\n", cli_errstr(cli));
+ status = cli_close(cli, fnum3);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close3 failed (%s)\n", nt_errstr(status));
return False;
}
int i;
uint32 offset;
bool correct = True;
+ NTSTATUS status;
#define NEXT_OFFSET offset += (~(uint32)0) / torture_numops
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE,
+ &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_open(cli2, fname, O_RDWR, DENY_NONE, &fnum2))) {
- printf("open2 of %s failed (%s)\n", fname, cli_errstr(cli2));
+
+ status = cli_open(cli2, fname, O_RDWR, DENY_NONE, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
for (offset=i=0;i<torture_numops;i++) {
NEXT_OFFSET;
- if (!NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, offset-1, 1))) {
+ status = cli_unlock(cli1, fnum1, offset-1, 1);
+ if (!NT_STATUS_IS_OK(status)) {
printf("unlock1 %d failed (%s)\n",
i,
- cli_errstr(cli1));
+ nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_unlock(cli2, fnum2, offset-2, 1))) {
+ status = cli_unlock(cli2, fnum2, offset-2, 1);
+ if (!NT_STATUS_IS_OK(status)) {
printf("unlock2 %d failed (%s)\n",
i,
- cli_errstr(cli1));
+ nt_errstr(status));
return False;
}
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close1 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close1 failed (%s)\n", nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli2, fnum2))) {
- printf("close2 failed (%s)\n", cli_errstr(cli2));
+ status = cli_close(cli2, fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close2 failed (%s)\n", nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) {
- printf("unlink failed (%s)\n", cli_errstr(cli1));
+ status = cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("unlink failed (%s)\n", nt_errstr(status));
return False;
}
status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_WRITE,
&fnum1);
if (!NT_STATUS_IS_OK(status)) {
- d_fprintf(stderr, "cli_open returned %s\n", cli_errstr(cli1));
+ d_fprintf(stderr, "cli_open returned %s\n", nt_errstr(status));
return false;
}
status = cli_open(cli1, fname, O_RDONLY, DENY_NONE, &fnum2);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr, "cli_open second time returned %s\n",
- cli_errstr(cli1));
+ nt_errstr(status));
goto fail;
}
status = cli_close(cli1, fnum1);
if (!NT_STATUS_IS_OK(status)) {
- d_fprintf(stderr, "cli_close(fnum1) %s\n", cli_errstr(cli1));
+ d_fprintf(stderr, "cli_close(fnum1) %s\n", nt_errstr(status));
goto fail;
}
status = cli_open(cli1, fname, O_RDWR, DENY_NONE, &fnum1);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr, "cli_open third time returned %s\n",
- cli_errstr(cli1));
+ nt_errstr(status));
goto fail;
}
status = cli_open(cli1, fname, O_RDWR, DENY_NONE,
&fnum);
if (!NT_STATUS_IS_OK(status)) {
- d_fprintf(stderr, "cli_open returned %s\n", cli_errstr(cli1));
+ d_fprintf(stderr, "cli_open returned %s\n", nt_errstr(status));
return false;
}
status = cli_close(cli1, fnum);
if (!NT_STATUS_IS_OK(status)) {
- d_fprintf(stderr, "cli_close(fnum1) %s\n", cli_errstr(cli1));
+ d_fprintf(stderr, "cli_close(fnum1) %s\n", nt_errstr(status));
goto fail;
}
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE,
+ &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
cli_unlink(cli, fname1, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli));
+ status = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
const char *fname = "\\unlink.tst";
uint16_t fnum;
bool correct = True;
+ NTSTATUS status;
if (!torture_open_connection(&cli, 0)) {
return False;
cli_setpid(cli, 1);
- if (!NT_STATUS_IS_OK(cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli));
+ status = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
int i;
int retries=4;
bool correct = True;
+ NTSTATUS status;
cli = current_cli;
for (i=0; i<0x11000; i++) {
slprintf(fname,sizeof(fname)-1,"\\maxfid.%d.%d", i,(int)getpid());
- if (!NT_STATUS_IS_OK(cli_open(cli, fname,
- O_RDWR|O_CREAT|O_TRUNC, DENY_NONE, &fnums[i]))) {
+ status = cli_open(cli, fname, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE,
+ &fnums[i]);
+ if (!NT_STATUS_IS_OK(status)) {
printf("open of %s failed (%s)\n",
- fname, cli_errstr(cli));
+ fname, nt_errstr(status));
printf("maximum fnum is %d\n", i);
break;
}
for (;i>=0;i--) {
slprintf(fname,sizeof(fname)-1,"\\maxfid.%d.%d", i,(int)getpid());
cli_close(cli, fnums[i]);
- if (!NT_STATUS_IS_OK(cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) {
+
+ status = cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+ if (!NT_STATUS_IS_OK(status)) {
printf("unlink of %s failed (%s)\n",
- fname, cli_errstr(cli));
+ fname, nt_errstr(status));
correct = False;
}
printf("%6d\r", i);
time_t t, t2;
const char *fname = "\\attrib123456789.tst";
bool correct = True;
+ NTSTATUS status;
printf("starting attrib test\n");
cli_open(cli, fname,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE, &fnum);
cli_close(cli, fnum);
- if (!NT_STATUS_IS_OK(cli_getatr(cli, fname, NULL, NULL, &t))) {
- printf("getatr failed (%s)\n", cli_errstr(cli));
+
+ status = cli_getatr(cli, fname, NULL, NULL, &t);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("getatr failed (%s)\n", nt_errstr(status));
correct = False;
}
t2 = t-60*60*24; /* 1 day ago */
- if (!NT_STATUS_IS_OK(cli_setatr(cli, fname, 0, t2))) {
- printf("setatr failed (%s)\n", cli_errstr(cli));
+ status = cli_setatr(cli, fname, 0, t2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("setatr failed (%s)\n", nt_errstr(status));
correct = True;
}
- if (!NT_STATUS_IS_OK(cli_getatr(cli, fname, NULL, NULL, &t))) {
- printf("getatr failed (%s)\n", cli_errstr(cli));
+ status = cli_getatr(cli, fname, NULL, NULL, &t);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("getatr failed (%s)\n", nt_errstr(status));
correct = True;
}
}
cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- cli_open(cli, fname,
- O_RDWR | O_CREAT | O_TRUNC, DENY_NONE, &fnum);
- if (!NT_STATUS_IS_OK(cli_qfileinfo_basic(
- cli, fnum, NULL, &size, &c_time_ts,
- &a_time_ts, &w_time_ts,
- &m_time_ts, NULL))) {
- printf("ERROR: qfileinfo failed (%s)\n", cli_errstr(cli));
+ cli_open(cli, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE, &fnum);
+ status = cli_qfileinfo_basic(cli, fnum, NULL, &size, &c_time_ts,
+ &a_time_ts, &w_time_ts, &m_time_ts, NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("ERROR: qfileinfo failed (%s)\n", nt_errstr(status));
correct = False;
}
- if (!NT_STATUS_IS_OK(cli_qfilename(cli, fnum, pname, sizeof(pname)))) {
- printf("ERROR: qfilename failed (%s)\n", cli_errstr(cli));
+ status = cli_qfilename(cli, fnum, pname, sizeof(pname));
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("ERROR: qfilename failed (%s)\n", nt_errstr(status));
correct = False;
}
sleep(2);
cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_open(cli, fname,
- O_RDWR | O_CREAT | O_TRUNC, DENY_NONE, &fnum))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli));
+ status = cli_open(cli, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE,
+ &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
cli_close(cli, fnum);
/* check if the server updates the directory modification time
when creating a new file */
- if (!NT_STATUS_IS_OK(cli_mkdir(cli, dname))) {
- printf("ERROR: mkdir failed (%s)\n", cli_errstr(cli));
+ status = cli_mkdir(cli, dname);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("ERROR: mkdir failed (%s)\n", nt_errstr(status));
correct = False;
}
sleep(3);
const char *fname = "\\lockt1.lck";
uint16_t fnum1;
bool correct = True;
+ NTSTATUS status;
printf("starting oplock test 1\n");
cli1->use_oplocks = True;
- if (!NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE,
+ &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close2 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close2 failed (%s)\n", nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) {
- printf("unlink failed (%s)\n", cli_errstr(cli1));
+ status = cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("unlink failed (%s)\n", nt_errstr(status));
return False;
}
char buf[4];
bool correct = True;
volatile bool *shared_correct;
+ NTSTATUS status;
shared_correct = (volatile bool *)shm_setup(sizeof(bool));
*shared_correct = True;
cli_sockopt(cli1, sockops);
cli_sockopt(cli2, sockops);
- if (!NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE,
+ &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
if (fork() == 0) {
/* Child code */
- if (!NT_STATUS_IS_OK(cli_open(cli2, fname, O_RDWR, DENY_NONE, &fnum2))) {
- printf("second open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_open(cli2, fname, O_RDWR, DENY_NONE, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("second open of %s failed (%s)\n", fname, nt_errstr(status));
*shared_correct = False;
exit(0);
}
sleep(2);
- if (!NT_STATUS_IS_OK(cli_close(cli2, fnum2))) {
- printf("close2 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli2, fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close2 failed (%s)\n", nt_errstr(status));
*shared_correct = False;
}
cli_read(cli1, fnum1, buf, 0, 4);
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close1 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close1 failed (%s)\n", nt_errstr(status));
correct = False;
}
sleep(4);
- if (!NT_STATUS_IS_OK(cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) {
- printf("unlink failed (%s)\n", cli_errstr(cli1));
+ status = cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("unlink failed (%s)\n", nt_errstr(status));
correct = False;
}
cli_sockopt(cli2, sockops);
/* Create the file. */
- if (!NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE,
+ &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return false;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close1 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close1 failed (%s)\n", nt_errstr(status));
return false;
}
/* Now create a hardlink. */
- if (!NT_STATUS_IS_OK(cli_nt_hardlink(cli1, fname, fname_ln))) {
- printf("nt hardlink failed (%s)\n", cli_errstr(cli1));
+ status = cli_nt_hardlink(cli1, fname, fname_ln);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("nt hardlink failed (%s)\n", nt_errstr(status));
return false;
}
/* Prove that opening hardlinks cause deny modes to conflict. */
- if (!NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDWR, DENY_ALL, &fnum1))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_open(cli1, fname, O_RDWR, DENY_ALL, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return false;
}
return false;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close1 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close1 failed (%s)\n", nt_errstr(status));
return false;
}
cli2->use_level_II_oplocks = true;
cli_oplock_handler(cli1, oplock4_handler);
- if (!NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDWR, DENY_NONE, &fnum1))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli1));
+
+ status = cli_open(cli1, fname, O_RDWR, DENY_NONE, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return false;
}
if (fork() == 0) {
/* Child code */
- if (!NT_STATUS_IS_OK(cli_open(cli2, fname_ln, O_RDWR, DENY_NONE, &fnum2))) {
- printf("open of %s failed (%s)\n", fname_ln, cli_errstr(cli1));
+ status = cli_open(cli2, fname_ln, O_RDWR, DENY_NONE, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname_ln, nt_errstr(status));
*oplock4_shared_correct = false;
exit(0);
}
- if (!NT_STATUS_IS_OK(cli_close(cli2, fnum2))) {
- printf("close2 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli2, fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close2 failed (%s)\n", nt_errstr(status));
*oplock4_shared_correct = false;
}
/* Process the oplock break. */
cli_receive_smb(cli1);
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close1 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close1 failed (%s)\n", nt_errstr(status));
correct = false;
}
- if (!NT_STATUS_IS_OK(cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) {
- printf("unlink failed (%s)\n", cli_errstr(cli1));
+ status = cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("unlink failed (%s)\n", nt_errstr(status));
correct = false;
}
- if (!NT_STATUS_IS_OK(cli_unlink(cli1, fname_ln, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) {
- printf("unlink failed (%s)\n", cli_errstr(cli1));
+
+ status = cli_unlink(cli1, fname_ln, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("unlink failed (%s)\n", nt_errstr(status));
correct = false;
}
uint16_t fnum1 = (uint16_t)-1;
uint16_t fnum2 = (uint16_t)-1;
bool correct = True;
+ NTSTATUS status;
printf("starting delete test\n");
cli_setatr(cli1, fname, 0, 0);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, GENERIC_ALL_ACCESS|DELETE_ACCESS, FILE_ATTRIBUTE_NORMAL,
- 0, FILE_OVERWRITE_IF,
- FILE_DELETE_ON_CLOSE, 0, &fnum1))) {
- printf("[1] open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0, GENERIC_ALL_ACCESS|DELETE_ACCESS,
+ FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
+ FILE_DELETE_ON_CLOSE, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[1] open of %s failed (%s)\n", fname, nt_errstr(status));
correct = False;
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("[1] close failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[1] close failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
cli_setatr(cli1, fname, 0, 0);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, GENERIC_ALL_ACCESS,
- FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("[2] open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0, GENERIC_ALL_ACCESS,
+ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[2] open of %s failed (%s)\n", fname, nt_errstr(status));
correct = False;
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1, fnum1, true))) {
- printf("[2] setting delete_on_close failed (%s)\n", cli_errstr(cli1));
+ status = cli_nt_delete_on_close(cli1, fnum1, true);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[2] setting delete_on_close failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("[2] close failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[2] close failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
if (NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
printf("[2] open of %s succeeded should have been deleted on close !\n", fname);
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("[2] close failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[2] close failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
cli_setatr(cli1, fname, 0, 0);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, GENERIC_ALL_ACCESS, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("[3] open - 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0, GENERIC_ALL_ACCESS,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ|FILE_SHARE_WRITE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[3] open - 1 of %s failed (%s)\n", fname, nt_errstr(status));
correct = False;
goto fail;
}
}
/* This should succeed. */
-
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN, 0, 0, &fnum2))) {
- printf("[3] open - 2 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ FILE_OPEN, 0, 0, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[3] open - 2 of %s failed (%s)\n", fname, nt_errstr(status));
correct = False;
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1, fnum1, true))) {
- printf("[3] setting delete_on_close failed (%s)\n", cli_errstr(cli1));
+ status = cli_nt_delete_on_close(cli1, fnum1, true);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[3] setting delete_on_close failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("[3] close 1 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[3] close 1 failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum2))) {
- printf("[3] close 2 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[3] close 2 failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
if (NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
printf("[3] open of %s succeeded should have been deleted on close !\n", fname);
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("[3] close failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[3] close failed (%s)\n", nt_errstr(status));
}
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
correct = False;
cli_setatr(cli1, fname, 0, 0);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_ntcreate(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, &fnum1))) {
- printf("[4] open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(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, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[4] open of %s failed (%s)\n", fname, nt_errstr(status));
correct = False;
goto fail;
}
/* This should succeed. */
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
- FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN, 0, 0, &fnum2))) {
- printf("[4] open - 2 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ FILE_OPEN, 0, 0, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[4] open - 2 of %s failed (%s)\n", fname, nt_errstr(status));
correct = False;
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum2))) {
- printf("[4] close - 1 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[4] close - 1 failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1, fnum1, true))) {
- printf("[4] setting delete_on_close failed (%s)\n", cli_errstr(cli1));
+ status = cli_nt_delete_on_close(cli1, fnum1, true);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[4] setting delete_on_close failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
} else
printf("fourth delete on close test succeeded.\n");
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("[4] close - 2 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[4] close - 2 failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
cli_setatr(cli1, fname, 0, 0);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDWR|O_CREAT, DENY_NONE, &fnum1))) {
- printf("[5] open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_open(cli1, fname, O_RDWR|O_CREAT, DENY_NONE, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[5] open of %s failed (%s)\n", fname, nt_errstr(status));
correct = False;
goto fail;
}
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("[5] close - 2 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[5] close - 2 failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
cli_setatr(cli1, fname, 0, 0);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA,
- FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("[6] open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[6] open of %s failed (%s)\n", fname,
+ nt_errstr(status));
correct = False;
goto fail;
}
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("[6] close - 2 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[6] close - 2 failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
cli_setatr(cli1, fname, 0, 0);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
- FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("[7] open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0,
+ FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
+ FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
+ 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[7] open of %s failed (%s)\n", fname, nt_errstr(status));
correct = False;
goto fail;
}
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("[7] close - 2 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[7] close - 2 failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
/* This next open should succeed - we reset the flag. */
-
- if (!NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
- printf("[5] open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_open(cli1, fname, O_RDONLY, DENY_NONE, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[5] open of %s failed (%s)\n", fname, nt_errstr(status));
correct = False;
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("[7] close - 2 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[7] close - 2 failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
cli_sockopt(cli1, sockops);
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
- FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("[8] open 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0,
+ FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[8] open 1 of %s failed (%s)\n", fname, nt_errstr(status));
correct = False;
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli2, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
- FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN, 0, 0, &fnum2))) {
- printf("[8] open 2 of %s failed (%s)\n", fname, cli_errstr(cli2));
+ status = cli_ntcreate(cli2, fname, 0,
+ FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ FILE_OPEN, 0, 0, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[8] open 2 of %s failed (%s)\n", fname, nt_errstr(status));
correct = False;
goto fail;
}
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("[8] close - 1 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[8] close - 1 failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_close(cli2, fnum2))) {
- printf("[8] close - 2 failed (%s)\n", cli_errstr(cli2));
+ status = cli_close(cli2, fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[8] close - 2 failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
/* This should fail.. */
- if (NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
+ status = cli_open(cli1, fname, O_RDONLY, DENY_NONE, &fnum1);
+ if (NT_STATUS_IS_OK(status)) {
printf("[8] open of %s succeeded should have been deleted on close !\n", fname);
goto fail;
correct = False;
printf("ninth delete on close test succeeded.\n");
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
- FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE, FILE_OVERWRITE_IF, FILE_DELETE_ON_CLOSE, 0, &fnum1))) {
- printf("[10] open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0,
+ FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
+ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
+ FILE_OVERWRITE_IF, FILE_DELETE_ON_CLOSE,
+ 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[10] open of %s failed (%s)\n", fname, nt_errstr(status));
correct = False;
goto fail;
}
/* This should delete the file. */
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("[10] close failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[10] close failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
delete access ? */
/* Create a readonly file. */
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA,
- FILE_ATTRIBUTE_READONLY, FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("[11] open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA,
+ FILE_ATTRIBUTE_READONLY, FILE_SHARE_NONE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[11] open of %s failed (%s)\n", fname, nt_errstr(status));
correct = False;
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("[11] close failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[11] close failed (%s)\n", nt_errstr(status));
correct = False;
goto fail;
}
cli_sockopt(cli, sockops);
/* Create the file. */
- if (!NT_STATUS_IS_OK(cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli));
+ status = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return false;
}
- if (!NT_STATUS_IS_OK(cli_close(cli, fnum))) {
- printf("close1 failed (%s)\n", cli_errstr(cli));
+ status = cli_close(cli, fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close1 failed (%s)\n", nt_errstr(status));
return false;
}
/* Now create a hardlink. */
- if (!NT_STATUS_IS_OK(cli_nt_hardlink(cli, fname, fname_ln))) {
- printf("nt hardlink failed (%s)\n", cli_errstr(cli));
+ status = cli_nt_hardlink(cli, fname, fname_ln);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("nt hardlink failed (%s)\n", nt_errstr(status));
return false;
}
const char *fname = "\\test.txt";
bool correct = True;
uint16_t fnum1, fnum2;
+ NTSTATUS status;
printf("starting xcopy test\n");
return False;
}
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0,
- FIRST_DESIRED_ACCESS, FILE_ATTRIBUTE_ARCHIVE,
- FILE_SHARE_NONE, FILE_OVERWRITE_IF,
- 0x4044, 0, &fnum1))) {
- printf("First open failed - %s\n", cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0, FIRST_DESIRED_ACCESS,
+ FILE_ATTRIBUTE_ARCHIVE, FILE_SHARE_NONE,
+ FILE_OVERWRITE_IF, 0x4044, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("First open failed - %s\n", nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0,
- SECOND_DESIRED_ACCESS, 0,
- FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN,
- 0x200000, 0, &fnum2))) {
- printf("second open failed - %s\n", cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0, SECOND_DESIRED_ACCESS, 0,
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ FILE_OPEN, 0x200000, 0, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("second open failed - %s\n", nt_errstr(status));
return False;
}
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
cli_unlink(cli1, fname1, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_READ, FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("First open failed - %s\n", cli_errstr(cli1));
+
+ status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
+ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("First open failed - %s\n", nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_rename(cli1, fname, fname1))) {
- printf("First rename failed (SHARE_READ) (this is correct) - %s\n", cli_errstr(cli1));
+ status = cli_rename(cli1, fname, fname1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("First rename failed (SHARE_READ) (this is correct) - %s\n", nt_errstr(status));
} else {
printf("First rename succeeded (SHARE_READ) - this should have failed !\n");
correct = False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close - 1 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close - 1 failed (%s)\n", nt_errstr(status));
return False;
}
#endif
FILE_OVERWRITE_IF, 0, 0, &fnum1);
if (!NT_STATUS_IS_OK(status)) {
- printf("Second open failed - %s\n", cli_errstr(cli1));
+ printf("Second open failed - %s\n", nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_rename(cli1, fname, fname1))) {
- printf("Second rename failed (SHARE_DELETE | SHARE_READ) - this should have succeeded - %s\n", cli_errstr(cli1));
+ status = cli_rename(cli1, fname, fname1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Second rename failed (SHARE_DELETE | SHARE_READ) - this should have succeeded - %s\n", nt_errstr(status));
correct = False;
} else {
printf("Second rename succeeded (SHARE_DELETE | SHARE_READ)\n");
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close - 2 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close - 2 failed (%s)\n", nt_errstr(status));
return False;
}
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
cli_unlink(cli1, fname1, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, READ_CONTROL_ACCESS, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("Third open failed - %s\n", cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0, READ_CONTROL_ACCESS,
+ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Third open failed - %s\n", nt_errstr(status));
return False;
}
}
#endif
- if (!NT_STATUS_IS_OK(cli_rename(cli1, fname, fname1))) {
- printf("Third rename failed (SHARE_NONE) - this should have succeeded - %s\n", cli_errstr(cli1));
+ status = cli_rename(cli1, fname, fname1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Third rename failed (SHARE_NONE) - this should have succeeded - %s\n", nt_errstr(status));
correct = False;
} else {
printf("Third rename succeeded (SHARE_NONE)\n");
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close - 3 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close - 3 failed (%s)\n", nt_errstr(status));
return False;
}
/*----*/
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("Fourth open failed - %s\n", cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Fourth open failed - %s\n", nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_rename(cli1, fname, fname1))) {
- printf("Fourth rename failed (SHARE_READ | SHARE_WRITE) (this is correct) - %s\n", cli_errstr(cli1));
+ status = cli_rename(cli1, fname, fname1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Fourth rename failed (SHARE_READ | SHARE_WRITE) (this is correct) - %s\n", nt_errstr(status));
} else {
printf("Fourth rename succeeded (SHARE_READ | SHARE_WRITE) - this should have failed !\n");
correct = False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close - 4 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close - 4 failed (%s)\n", nt_errstr(status));
return False;
}
/*--*/
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("Fifth open failed - %s\n", cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Fifth open failed - %s\n", nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_rename(cli1, fname, fname1))) {
- printf("Fifth rename failed (SHARE_READ | SHARE_WRITE | SHARE_DELETE) - this should have succeeded - %s ! \n",
- cli_errstr(cli1));
+ status = cli_rename(cli1, fname, fname1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Fifth rename failed (SHARE_READ | SHARE_WRITE | SHARE_DELETE) - this should have succeeded - %s ! \n", nt_errstr(status));
correct = False;
} else {
- printf("Fifth rename succeeded (SHARE_READ | SHARE_WRITE | SHARE_DELETE) (this is correct) - %s\n", cli_errstr(cli1));
+ printf("Fifth rename succeeded (SHARE_READ | SHARE_WRITE | SHARE_DELETE) (this is correct) - %s\n", nt_errstr(status));
}
/*
} */
/*--*/
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close - 5 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close - 5 failed (%s)\n", nt_errstr(status));
return False;
}
/* Check that the renamed file has FILE_ATTRIBUTE_ARCHIVE. */
- if (!NT_STATUS_IS_OK(cli_getatr(cli1, fname1, &attr, NULL, NULL))) {
+ status = cli_getatr(cli1, fname1, &attr, NULL, NULL);
+ if (!NT_STATUS_IS_OK(status)) {
printf("getatr on file %s failed - %s ! \n",
- fname1,
- cli_errstr(cli1));
+ fname1, nt_errstr(status));
correct = False;
} else {
if (attr != FILE_ATTRIBUTE_ARCHIVE) {
const char *pipe_name = "\\SPOOLSS";
uint16_t fnum;
int num_pipes = 0;
+ NTSTATUS status;
printf("starting pipenumber test\n");
if (!torture_open_connection(&cli1, 0)) {
cli_sockopt(cli1, sockops);
while(1) {
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, pipe_name, 0, FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN_IF, 0, 0, &fnum))) {
- printf("Open of pipe %s failed with error (%s)\n", pipe_name, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, pipe_name, 0, FILE_READ_DATA,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ|FILE_SHARE_WRITE,
+ FILE_OPEN_IF, 0, 0, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Open of pipe %s failed with error (%s)\n", pipe_name, nt_errstr(status));
break;
}
num_pipes++;
cli_sockopt(cli1, sockops);
- if (!NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close2 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close2 failed (%s)\n", nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_setatr(cli1, fname, FILE_ATTRIBUTE_READONLY, 0))) {
- printf("cli_setatr failed (%s)\n", cli_errstr(cli1));
+ status = cli_setatr(cli1, fname, FILE_ATTRIBUTE_READONLY, 0);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_setatr failed (%s)\n", nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDONLY, DENY_WRITE, &fnum1))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_open(cli1, fname, O_RDONLY, DENY_WRITE, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
cli_setatr(cli1, fname, 0, 0);
- if (!NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDONLY, DENY_WRITE, &fnum1))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_open(cli1, fname, O_RDONLY, DENY_WRITE, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
printf("correct error code ERRDOS/ERRbadshare returned\n");
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close2 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close2 failed (%s)\n", nt_errstr(status));
return False;
}
printf("finished open test 2\n");
/* Test truncate open disposition on file opened for read. */
-
- if (!NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1))) {
- printf("(3) open (1) of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("(3) open (1) of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
correct = False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("(3) close1 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("(3) close1 failed (%s)\n", nt_errstr(status));
return False;
}
/* Ensure size == 20. */
- if (!NT_STATUS_IS_OK(cli_getatr(cli1, fname, NULL, &fsize, NULL))) {
- printf("(3) getatr failed (%s)\n", cli_errstr(cli1));
+ status = cli_getatr(cli1, fname, NULL, &fsize, NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("(3) getatr failed (%s)\n", nt_errstr(status));
return False;
}
}
/* Now test if we can truncate a file opened for readonly. */
-
- if (!NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDONLY|O_TRUNC, DENY_NONE, &fnum1))) {
- printf("(3) open (2) of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_open(cli1, fname, O_RDONLY|O_TRUNC, DENY_NONE, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("(3) open (2) of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close2 failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close2 failed (%s)\n", nt_errstr(status));
return False;
}
/* Ensure size == 0. */
- if (!NT_STATUS_IS_OK(cli_getatr(cli1, fname, NULL, &fsize, NULL))) {
- printf("(3) getatr failed (%s)\n", cli_errstr(cli1));
+ status = cli_getatr(cli1, fname, NULL, &fsize, NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("(3) getatr failed (%s)\n", nt_errstr(status));
return False;
}
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
printf("Do ctemp tests\n");
- if (!NT_STATUS_IS_OK(cli_ctemp(cli1, talloc_tos(), "\\", &fnum1, &tmp_path))) {
- printf("ctemp failed (%s)\n", cli_errstr(cli1));
+ status = cli_ctemp(cli1, talloc_tos(), "\\", &fnum1, &tmp_path);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("ctemp failed (%s)\n", nt_errstr(status));
return False;
}
+
printf("ctemp gave path %s\n", tmp_path);
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close of temp failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close of temp failed (%s)\n", nt_errstr(status));
}
- if (!NT_STATUS_IS_OK(cli_unlink(cli1, tmp_path, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) {
- printf("unlink of temp failed (%s)\n", cli_errstr(cli1));
+
+ status = cli_unlink(cli1, tmp_path, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("unlink of temp failed (%s)\n", nt_errstr(status));
}
/* Test the non-io opens... */
cli_sockopt(cli2, sockops);
printf("TEST #1 testing 2 non-io opens (no delete)\n");
-
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("TEST #1 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0, FILE_READ_ATTRIBUTES,
+ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #1 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli2, fname, 0, FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_NONE, FILE_OPEN_IF, 0, 0, &fnum2))) {
- printf("TEST #1 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2));
+ status = cli_ntcreate(cli2, fname, 0, FILE_READ_ATTRIBUTES,
+ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
+ FILE_OPEN_IF, 0, 0, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #1 open 2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("TEST #1 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #1 close 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli2, fnum2))) {
- printf("TEST #1 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2));
+
+ status = cli_close(cli2, fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #1 close 2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
printf("TEST #2 testing 2 non-io opens (first with delete)\n");
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, DELETE_ACCESS|FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("TEST #2 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0,
+ DELETE_ACCESS|FILE_READ_ATTRIBUTES,
+ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #2 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli2, fname, 0, FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_NONE, FILE_OPEN_IF, 0, 0, &fnum2))) {
- printf("TEST #2 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2));
+ status = cli_ntcreate(cli2, fname, 0, FILE_READ_ATTRIBUTES,
+ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
+ FILE_OPEN_IF, 0, 0, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #2 open 2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("TEST #2 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #2 close 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli2, fnum2))) {
- printf("TEST #2 close 2 of %s failed (%s)\n", fname, cli_errstr(cli1));
+
+ status = cli_close(cli2, fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #2 close 2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
printf("TEST #3 testing 2 non-io opens (second with delete)\n");
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("TEST #3 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0, FILE_READ_ATTRIBUTES,
+ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #3 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli2, fname, 0, DELETE_ACCESS|FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_NONE, FILE_OPEN_IF, 0, 0, &fnum2))) {
- printf("TEST #3 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2));
+ status = cli_ntcreate(cli2, fname, 0,
+ DELETE_ACCESS|FILE_READ_ATTRIBUTES,
+ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
+ FILE_OPEN_IF, 0, 0, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #3 open 2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("TEST #3 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #3 close 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli2, fnum2))) {
- printf("TEST #3 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2));
+
+ status = cli_close(cli2, fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #3 close 2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
printf("TEST #4 testing 2 non-io opens (both with delete)\n");
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, DELETE_ACCESS|FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("TEST #4 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0,
+ DELETE_ACCESS|FILE_READ_ATTRIBUTES,
+ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #4 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (NT_STATUS_IS_OK(cli_ntcreate(cli2, fname, 0, DELETE_ACCESS|FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_NONE, FILE_OPEN_IF, 0, 0, &fnum2))) {
- printf("TEST #4 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, cli_errstr(cli2));
+ status = cli_ntcreate(cli2, fname, 0,
+ DELETE_ACCESS|FILE_READ_ATTRIBUTES,
+ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
+ FILE_OPEN_IF, 0, 0, &fnum2);
+ if (NT_STATUS_IS_OK(status)) {
+ printf("TEST #4 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, nt_errstr(status));
return False;
}
- printf("TEST #4 open 2 of %s gave %s (correct error should be %s)\n", fname, cli_errstr(cli2), "sharing violation");
+ printf("TEST #4 open 2 of %s gave %s (correct error should be %s)\n", fname, nt_errstr(status), "sharing violation");
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("TEST #4 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #4 close 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
printf("TEST #5 testing 2 non-io opens (both with delete - both with file share delete)\n");
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, DELETE_ACCESS|FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_DELETE, FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("TEST #5 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0,
+ DELETE_ACCESS|FILE_READ_ATTRIBUTES,
+ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_DELETE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #5 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli2, fname, 0, DELETE_ACCESS|FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_DELETE, FILE_OPEN_IF, 0, 0, &fnum2))) {
- printf("TEST #5 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2));
+ status = cli_ntcreate(cli2, fname, 0,
+ DELETE_ACCESS|FILE_READ_ATTRIBUTES,
+ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_DELETE,
+ FILE_OPEN_IF, 0, 0, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #5 open 2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("TEST #5 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #5 close 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli2, fnum2))) {
- printf("TEST #5 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2));
+ status = cli_close(cli2, fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #5 close 2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("TEST #6 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0, FILE_READ_DATA,
+ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #6 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli2, fname, 0, FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_READ, FILE_OPEN_IF, 0, 0, &fnum2))) {
- printf("TEST #6 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2));
+ status = cli_ntcreate(cli2, fname, 0, FILE_READ_ATTRIBUTES,
+ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ,
+ FILE_OPEN_IF, 0, 0, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #6 open 2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("TEST #6 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #6 close 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli2, fnum2))) {
- printf("TEST #6 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2));
+ status = cli_close(cli2, fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #6 close 2 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("TEST #7 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_ntcreate(cli1, fname, 0, FILE_READ_DATA,
+ FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #7 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
- if (NT_STATUS_IS_OK(cli_ntcreate(cli2, fname, 0, DELETE_ACCESS|FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_READ|FILE_SHARE_DELETE, FILE_OPEN_IF, 0, 0, &fnum2))) {
- printf("TEST #7 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, cli_errstr(cli2));
+ status = cli_ntcreate(cli2, fname, 0,
+ DELETE_ACCESS|FILE_READ_ATTRIBUTES,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ|FILE_SHARE_DELETE,
+ FILE_OPEN_IF, 0, 0, &fnum2);
+ if (NT_STATUS_IS_OK(status)) {
+ printf("TEST #7 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, nt_errstr(status));
return False;
}
- printf("TEST #7 open 2 of %s gave %s (correct error should be %s)\n", fname, cli_errstr(cli2), "sharing violation");
+ printf("TEST #7 open 2 of %s gave %s (correct error should be %s)\n", fname, nt_errstr(status), "sharing violation");
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("TEST #7 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TEST #7 close 1 of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
cli_posix_unlink(cli1, sname);
/* Create a directory. */
- if (!NT_STATUS_IS_OK(cli_posix_mkdir(cli1, dname, 0777))) {
- printf("POSIX mkdir of %s failed (%s)\n", dname, cli_errstr(cli1));
+ status = cli_posix_mkdir(cli1, dname, 0777);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("POSIX mkdir of %s failed (%s)\n", dname, nt_errstr(status));
goto out;
}
- if (!NT_STATUS_IS_OK(cli_posix_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, 0600, &fnum1))) {
- printf("POSIX create of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_posix_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL,
+ 0600, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("POSIX create of %s failed (%s)\n", fname, nt_errstr(status));
goto out;
}
/* Test ftruncate - set file size. */
- if (!NT_STATUS_IS_OK(cli_ftruncate(cli1, fnum1, 1000))) {
- printf("ftruncate failed (%s)\n", cli_errstr(cli1));
+ status = cli_ftruncate(cli1, fnum1, 1000);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("ftruncate failed (%s)\n", nt_errstr(status));
goto out;
}
/* Ensure st_size == 1000 */
- if (!NT_STATUS_IS_OK(cli_posix_stat(cli1, fname, &sbuf))) {
- printf("stat failed (%s)\n", cli_errstr(cli1));
+ status = cli_posix_stat(cli1, fname, &sbuf);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("stat failed (%s)\n", nt_errstr(status));
goto out;
}
}
/* Test ftruncate - set file size back to zero. */
- if (!NT_STATUS_IS_OK(cli_ftruncate(cli1, fnum1, 0))) {
- printf("ftruncate failed (%s)\n", cli_errstr(cli1));
+ status = cli_ftruncate(cli1, fnum1, 0);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("ftruncate failed (%s)\n", nt_errstr(status));
goto out;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close failed (%s)\n", nt_errstr(status));
goto out;
}
/* Now open the file again for read only. */
- if (!NT_STATUS_IS_OK(cli_posix_open(cli1, fname, O_RDONLY, 0, &fnum1))) {
- printf("POSIX open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_posix_open(cli1, fname, O_RDONLY, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("POSIX open of %s failed (%s)\n", fname, nt_errstr(status));
goto out;
}
/* Now unlink while open. */
- if (!NT_STATUS_IS_OK(cli_posix_unlink(cli1, fname))) {
- printf("POSIX unlink of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_posix_unlink(cli1, fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("POSIX unlink of %s failed (%s)\n", fname, nt_errstr(status));
goto out;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close(2) failed (%s)\n", cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close(2) failed (%s)\n", nt_errstr(status));
goto out;
}
/* Ensure the file has gone. */
- if (NT_STATUS_IS_OK(cli_posix_open(cli1, fname, O_RDONLY, 0, &fnum1))) {
+ status = cli_posix_open(cli1, fname, O_RDONLY, 0, &fnum1);
+ if (NT_STATUS_IS_OK(status)) {
printf("POSIX open of %s succeeded, should have been deleted.\n", fname);
goto out;
}
}
/* Create the file. */
- if (!NT_STATUS_IS_OK(cli_posix_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, 0600, &fnum1))) {
- printf("POSIX create of %s failed (%s)\n", fname, cli_errstr(cli1));
+ status = cli_posix_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL,
+ 0600, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("POSIX create of %s failed (%s)\n", fname, nt_errstr(status));
goto out;
}
cli_close(cli1, fnum1);
/* Now create a hardlink. */
- if (!NT_STATUS_IS_OK(cli_posix_hardlink(cli1, fname, hname))) {
- printf("POSIX hardlink of %s failed (%s)\n", hname, cli_errstr(cli1));
+ status = cli_posix_hardlink(cli1, fname, hname);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("POSIX hardlink of %s failed (%s)\n", hname, nt_errstr(status));
goto out;
}
/* Now create a symlink. */
- if (!NT_STATUS_IS_OK(cli_posix_symlink(cli1, fname, sname))) {
- printf("POSIX symlink of %s failed (%s)\n", sname, cli_errstr(cli1));
+ status = cli_posix_symlink(cli1, fname, sname);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("POSIX symlink of %s failed (%s)\n", sname, nt_errstr(status));
goto out;
}
/* Open the hardlink for read. */
- if (!NT_STATUS_IS_OK(cli_posix_open(cli1, hname, O_RDONLY, 0, &fnum1))) {
- printf("POSIX open of %s failed (%s)\n", hname, cli_errstr(cli1));
+ status = cli_posix_open(cli1, hname, O_RDONLY, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("POSIX open of %s failed (%s)\n", hname, nt_errstr(status));
goto out;
}
}
/* Do a POSIX lock/unlock. */
- if (!NT_STATUS_IS_OK(cli_posix_lock(cli1, fnum1, 0, 100, true, READ_LOCK))) {
- printf("POSIX lock failed %s\n", cli_errstr(cli1));
+ status = cli_posix_lock(cli1, fnum1, 0, 100, true, READ_LOCK);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("POSIX lock failed %s\n", nt_errstr(status));
goto out;
}
/* Punch a hole in the locked area. */
- if (!NT_STATUS_IS_OK(cli_posix_unlock(cli1, fnum1, 10, 80))) {
- printf("POSIX unlock failed %s\n", cli_errstr(cli1));
+ status = cli_posix_unlock(cli1, fnum1, 10, 80);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("POSIX unlock failed %s\n", nt_errstr(status));
goto out;
}
/* Open the symlink for read - this should fail. A POSIX
client should not be doing opens on a symlink. */
- if (NT_STATUS_IS_OK(cli_posix_open(cli1, sname, O_RDONLY, 0, &fnum1))) {
+ status = cli_posix_open(cli1, sname, O_RDONLY, 0, &fnum1);
+ if (NT_STATUS_IS_OK(status)) {
printf("POSIX open of %s succeeded (should have failed)\n", sname);
goto out;
} else {
printf("POSIX open of %s should have failed "
"with NT_STATUS_OBJECT_PATH_NOT_FOUND, "
"failed with %s instead.\n",
- sname, cli_errstr(cli1));
+ sname, nt_errstr(status));
goto out;
}
}
- if (!NT_STATUS_IS_OK(cli_posix_readlink(cli1, sname, namebuf, sizeof(namebuf)))) {
- printf("POSIX readlink on %s failed (%s)\n", sname, cli_errstr(cli1));
+ status = cli_posix_readlink(cli1, sname, namebuf, sizeof(namebuf));
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("POSIX readlink on %s failed (%s)\n", sname, nt_errstr(status));
goto out;
}
goto out;
}
- if (!NT_STATUS_IS_OK(cli_posix_rmdir(cli1, dname))) {
- printf("POSIX rmdir failed (%s)\n", cli_errstr(cli1));
+ status = cli_posix_rmdir(cli1, dname);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("POSIX rmdir failed (%s)\n", nt_errstr(status));
goto out;
}
bool correct = True;
uint16 attr;
unsigned int i, j, k, l;
+ NTSTATUS status;
printf("starting open attr test\n");
for (k = 0, i = 0; i < sizeof(open_attrs_table)/sizeof(uint32); i++) {
cli_setatr(cli1, fname, 0, 0);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, FILE_WRITE_DATA, open_attrs_table[i],
- FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
- printf("open %d (1) of %s failed (%s)\n", i, fname, cli_errstr(cli1));
+
+ status = cli_ntcreate(cli1, fname, 0, FILE_WRITE_DATA,
+ open_attrs_table[i], FILE_SHARE_NONE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open %d (1) of %s failed (%s)\n", i, fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close %d (1) of %s failed (%s)\n", i, fname, cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close %d (1) of %s failed (%s)\n", i, fname, nt_errstr(status));
return False;
}
for (j = 0; j < sizeof(open_attrs_table)/sizeof(uint32); j++) {
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA, open_attrs_table[j],
- FILE_SHARE_NONE, FILE_OVERWRITE, 0, 0, &fnum1))) {
+ status = cli_ntcreate(cli1, fname, 0,
+ FILE_READ_DATA|FILE_WRITE_DATA,
+ open_attrs_table[j],
+ FILE_SHARE_NONE, FILE_OVERWRITE,
+ 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
for (l = 0; l < sizeof(attr_results)/sizeof(struct trunc_open_results); l++) {
if (attr_results[l].num == k) {
printf("[%d] trunc open 0x%x -> 0x%x of %s failed - should have succeeded !(0x%x:%s)\n",
k, open_attrs_table[i],
open_attrs_table[j],
- fname, NT_STATUS_V(cli_nt_error(cli1)), cli_errstr(cli1));
+ fname, NT_STATUS_V(status), nt_errstr(status));
correct = False;
}
}
- if (NT_STATUS_V(cli_nt_error(cli1)) != NT_STATUS_V(NT_STATUS_ACCESS_DENIED)) {
+
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
printf("[%d] trunc open 0x%x -> 0x%x failed with wrong error code %s\n",
k, open_attrs_table[i], open_attrs_table[j],
- cli_errstr(cli1));
+ nt_errstr(status));
correct = False;
}
#if 0
continue;
}
- if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
- printf("close %d (2) of %s failed (%s)\n", j, fname, cli_errstr(cli1));
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("close %d (2) of %s failed (%s)\n", j, fname, nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_getatr(cli1, fname, &attr, NULL, NULL))) {
- printf("getatr(2) failed (%s)\n", cli_errstr(cli1));
+ status = cli_getatr(cli1, fname, &attr, NULL, NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("getatr(2) failed (%s)\n", nt_errstr(status));
return False;
}
cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum))) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli));
+ status = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open of %s failed (%s)\n", fname, nt_errstr(status));
return False;
}
static struct cli_state *cli;
uint16_t fnum;
bool ret;
+ NTSTATUS status;
if (!torture_open_connection(&cli, 0)) {
return False;
cli_unlink(cli, "\\chkpath.dir\\*", FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
cli_rmdir(cli, "\\chkpath.dir");
- if (!NT_STATUS_IS_OK(cli_mkdir(cli, "\\chkpath.dir"))) {
- printf("mkdir1 failed : %s\n", cli_errstr(cli));
+ status = cli_mkdir(cli, "\\chkpath.dir");
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("mkdir1 failed : %s\n", nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_mkdir(cli, "\\chkpath.dir\\dir2"))) {
- printf("mkdir2 failed : %s\n", cli_errstr(cli));
+ status = cli_mkdir(cli, "\\chkpath.dir\\dir2");
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("mkdir2 failed : %s\n", nt_errstr(status));
return False;
}
- if (!NT_STATUS_IS_OK(cli_open(cli, "\\chkpath.dir\\foo.txt", O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum))) {
- printf("open1 failed (%s)\n", cli_errstr(cli));
+ status = cli_open(cli, "\\chkpath.dir\\foo.txt", O_RDWR|O_CREAT|O_EXCL,
+ DENY_NONE, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open1 failed (%s)\n", nt_errstr(status));
return False;
}
cli_close(cli, fnum);
- if (!NT_STATUS_IS_OK(cli_chkpath(cli, "\\chkpath.dir"))) {
- printf("chkpath1 failed: %s\n", cli_errstr(cli));
+ status = cli_chkpath(cli, "\\chkpath.dir");
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("chkpath1 failed: %s\n", nt_errstr(status));
ret = False;
}
- if (!NT_STATUS_IS_OK(cli_chkpath(cli, "\\chkpath.dir\\dir2"))) {
- printf("chkpath2 failed: %s\n", cli_errstr(cli));
+ status = cli_chkpath(cli, "\\chkpath.dir\\dir2");
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("chkpath2 failed: %s\n", nt_errstr(status));
ret = False;
}
- if (!NT_STATUS_IS_OK(cli_chkpath(cli, "\\chkpath.dir\\foo.txt"))) {
+ status = cli_chkpath(cli, "\\chkpath.dir\\foo.txt");
+ if (!NT_STATUS_IS_OK(status)) {
ret = check_error(__LINE__, cli, ERRDOS, ERRbadpath,
NT_STATUS_NOT_A_DIRECTORY);
} else {
}
cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli, fname, 0,
- FIRST_DESIRED_ACCESS, FILE_ATTRIBUTE_ARCHIVE,
- FILE_SHARE_NONE, FILE_OVERWRITE_IF,
- 0x4044, 0, &fnum))) {
- printf("open failed - %s\n", cli_errstr(cli));
+
+ status = cli_ntcreate(cli, fname, 0,
+ FIRST_DESIRED_ACCESS, FILE_ATTRIBUTE_ARCHIVE,
+ FILE_SHARE_NONE, FILE_OVERWRITE_IF,
+ 0x4044, 0, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open failed - %s\n", nt_errstr(status));
talloc_destroy(mem_ctx);
return False;
}
return False;
}
- if (!NT_STATUS_IS_OK(cli_session_setup(c_nt, "", "", 0, "", 0,
- workgroup))) {
- printf("%s rejected the NT-error initial session setup (%s)\n",host, cli_errstr(c_nt));
+ status = cli_session_setup(c_nt, "", "", 0, "", 0, workgroup);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("%s rejected the NT-error initial session setup (%s)\n",host, nt_errstr(status));
return False;
}
return False;
}
- if (!NT_STATUS_IS_OK(cli_session_setup(c_dos, "", "", 0, "", 0,
- workgroup))) {
- printf("%s rejected the DOS-error initial session setup (%s)\n",host, cli_errstr(c_dos));
+ status = cli_session_setup(c_dos, "", "", 0, "", 0, workgroup);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("%s rejected the DOS-error initial session setup (%s)\n",
+ host, nt_errstr(status));
return False;
}
for (error=(0xc0000000 | 0x1); error < (0xc0000000| 0xFFF); error++) {
fstr_sprintf(user, "%X", error);
- if (NT_STATUS_IS_OK(cli_session_setup(c_nt, user,
- password, strlen(password),
- password, strlen(password),
- workgroup))) {
+ status = cli_session_setup(c_nt, user,
+ password, strlen(password),
+ password, strlen(password),
+ workgroup);
+ if (NT_STATUS_IS_OK(status)) {
printf("/** Session setup succeeded. This shouldn't happen...*/\n");
}
return false;
}
- if (!NT_STATUS_IS_OK(cli_ntcreate(
- c, fname, 0, GENERIC_ALL_ACCESS|DELETE_ACCESS,
- FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
- FILE_DELETE_ON_CLOSE, 0, &fnum))) {
- d_printf("open %s failed: %s\n", fname, cli_errstr(c));
+ status = cli_ntcreate(c, fname, 0, GENERIC_ALL_ACCESS|DELETE_ACCESS,
+ FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
+ FILE_DELETE_ON_CLOSE, 0, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ d_printf("open %s failed: %s\n", fname, nt_errstr(status));
return false;
}
cli_sockopt(cli, sockops);
- if (!NT_STATUS_IS_OK(cli_ntcreate(
- cli, fname, 0, GENERIC_ALL_ACCESS|DELETE_ACCESS,
- FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF, 0, 0, &fnum))) {
- d_printf("open %s failed: %s\n", fname, cli_errstr(cli));
+ status = cli_ntcreate(cli, fname, 0, GENERIC_ALL_ACCESS|DELETE_ACCESS,
+ FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
+ 0, 0, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ d_printf("open %s failed: %s\n", fname, nt_errstr(status));
return false;
}
cli_close(cli, fnum);
}
d_printf("alt_name: %s\n", alt_name);
- if (!NT_STATUS_IS_OK(cli_open(cli, alt_name, O_RDONLY, DENY_NONE, &fnum))) {
+ status = cli_open(cli, alt_name, O_RDONLY, DENY_NONE, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
d_printf("cli_open(%s) failed: %s\n", alt_name,
- cli_errstr(cli));
+ nt_errstr(status));
return false;
}
cli_close(cli, fnum);
struct timeval start_time;
double seconds;
double kbytes;
+ NTSTATUS status;
printf("starting windows_write test\n");
if (!torture_open_connection(&cli1, 0)) {
return False;
}
- if (!NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum))) {
- printf("open failed (%s)\n", cli_errstr(cli1));
+ status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("open failed (%s)\n", nt_errstr(status));
return False;
}
for (i=0; i<torture_numops; i++) {
uint8_t c = 0;
off_t start = i * torture_blocksize;
- NTSTATUS status;
size_t to_pull = torture_blocksize - 1;
status = cli_writeall(cli1, fnum, 0, &c,
int i;
struct sn_state s;
char fname[20];
+ NTSTATUS status;
printf("starting shortname test\n");
cli_list(cli, "\\shortname\\*", FILE_ATTRIBUTE_DIRECTORY, shortname_del_fn, cli);
cli_rmdir(cli, "\\shortname");
- if (!NT_STATUS_IS_OK(cli_mkdir(cli, "\\shortname"))) {
+ status = cli_mkdir(cli, "\\shortname");
+ if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) cli_mkdir of \\shortname failed: %s\n",
- __location__, cli_errstr(cli));
+ __location__, nt_errstr(status));
correct = false;
goto out;
}
s.val = false;
for (i = 32; i < 128; i++) {
- NTSTATUS status;
uint16_t fnum = (uint16_t)-1;
s.i = i;
FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OVERWRITE_IF, 0, 0, &fnum);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) cli_nt_create of %s failed: %s\n",
- __location__, fname, cli_errstr(cli));
+ __location__, fname, nt_errstr(status));
correct = false;
goto out;
}
correct = false;
goto out;
}
- if (!NT_STATUS_IS_OK(cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) {
+
+ status = cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+ if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) failed to delete %s: %s\n",
- __location__, fname, cli_errstr(cli));
+ __location__, fname, nt_errstr(status));
correct = false;
goto out;
}