-/*
+/*
Unix SMB/CIFS implementation.
SMB torture tester
Copyright (C) Andrew Tridgell 1997-1998
}
static bool torture_open_connection_share(struct cli_state **c,
- const char *hostname,
+ const char *hostname,
const char *sharename,
int flags)
{
num = NT_STATUS_DOS_CODE(status);
if (eclass != cclass || ecode != num) {
- printf("unexpected error code class=%d code=%d\n",
+ printf("unexpected error code class=%d code=%d\n",
(int)cclass, (int)num);
- printf(" expected %d/%d %s (line=%d)\n",
+ printf(" expected %d/%d %s (line=%d)\n",
(int)eclass, (int)ecode, nt_errstr(nterr),
line);
return False;
memset(buf, '\0', sizeof(buf));
- status = cli_openx(c, lockfname, O_RDWR | O_CREAT | O_EXCL,
+ status = cli_openx(c, lockfname, O_RDWR | O_CREAT | O_EXCL,
DENY_NONE, &fnum2);
if (!NT_STATUS_IS_OK(status)) {
status = cli_openx(c, lockfname, O_RDWR, DENY_NONE, &fnum2);
{
for (i = 0; i < 500 && fnum == (uint16_t)-1; i++)
{
- status = cli_openx(c, lockfname, O_RDONLY,
+ status = cli_openx(c, lockfname, O_RDONLY,
DENY_NONE, &fnum);
if (NT_STATUS_IS_OK(status)) {
break;
printf("read failed\n");
printf("read %ld, expected %ld\n",
(unsigned long)bytes_read,
- (unsigned long)buf_size);
+ (unsigned long)buf_size);
correct = False;
break;
}
}
if (!strcmp(params[0],"NTCreateX")) {
- nb_createx(params[1], ival(params[2]), ival(params[3]),
+ nb_createx(params[1], ival(params[2]), ival(params[3]),
ival(params[4]));
} else if (!strcmp(params[0],"Close")) {
nb_close(ival(params[1]));
} else if (!strcmp(params[0],"FIND_FIRST")) {
nb_findfirst(params[1]);
} else if (!strcmp(params[0],"WriteX")) {
- nb_writex(ival(params[1]),
+ nb_writex(ival(params[1]),
ival(params[2]), ival(params[3]), ival(params[4]));
} else if (!strcmp(params[0],"ReadX")) {
- nb_readx(ival(params[1]),
+ nb_readx(ival(params[1]),
ival(params[2]), ival(params[3]), ival(params[4]));
} else if (!strcmp(params[0],"Flush")) {
nb_flush(ival(params[1]));
t = create_procs(run_netbench, &correct);
alarm(0);
- printf("\nThroughput %g MB/sec\n",
+ printf("\nThroughput %g MB/sec\n",
1.0e-6 * nbio_total() / t);
return correct;
}
if (return_devtype != NULL &&
strequal(cli->dev, return_devtype)) {
ret = True;
- } else {
+ } else {
printf("tconX to share %s with type %s "
"succeeded but returned the wrong "
"device type (got [%s] but should have got [%s])\n",
/*
- This test checks that
+ This test checks that
1) the server supports multiple locking contexts on the one SMB
- connection, distinguished by PID.
+ connection, distinguished by PID.
2) the server correctly fails overlapping locks made by the same PID (this
goes against POSIX behaviour, which is why it is tricky to implement)
/*
- This test checks that
+ This test checks that
1) the server supports the full offset range in lock requests
*/
status = cli_lock32(cli1, fnum1, offset-1, 1, 0, WRITE_LOCK);
if (!NT_STATUS_IS_OK(status)) {
- printf("lock1 %d failed (%s)\n",
+ printf("lock1 %d failed (%s)\n",
i,
nt_errstr(status));
return False;
status = cli_lock32(cli2, fnum2, offset-2, 1, 0, WRITE_LOCK);
if (!NT_STATUS_IS_OK(status)) {
- printf("lock2 %d failed (%s)\n",
+ printf("lock2 %d failed (%s)\n",
i,
nt_errstr(status));
return False;
status = cli_unlock(cli1, fnum1, offset-1, 1);
if (!NT_STATUS_IS_OK(status)) {
- printf("unlock1 %d failed (%s)\n",
+ printf("unlock1 %d failed (%s)\n",
i,
nt_errstr(status));
return False;
status = cli_unlock(cli2, fnum2, offset-2, 1);
if (!NT_STATUS_IS_OK(status)) {
- printf("unlock2 %d failed (%s)\n",
+ printf("unlock2 %d failed (%s)\n",
i,
nt_errstr(status));
return False;
NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 0, 4));
EXPECTED(ret, True);
- printf("the same process %s unlock the stack of 4 locks\n", ret?"can":"cannot");
+ printf("the same process %s unlock the stack of 4 locks\n", ret?"can":"cannot");
/* Ensure the next unlock fails. */
ret = NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 0, 4));
EXPECTED(ret, False);
- printf("the same process %s count the lock stack\n", !ret?"can":"cannot");
+ printf("the same process %s count the lock stack\n", !ret?"can":"cannot");
/* Ensure connection 2 can get a write lock. */
status = cli_lock32(cli2, fnum2, 0, 4, 0, WRITE_LOCK);
}
/*
- This test checks that
+ This test checks that
1) the server does not allow an unlink on a file that is open
*/
status = cli_openx(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",
+ printf("open of %s failed (%s)\n",
fname, nt_errstr(status));
printf("maximum fnum is %d\n", i);
break;
status = cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
if (!NT_STATUS_IS_OK(status)) {
- printf("unlink of %s failed (%s)\n",
+ printf("unlink of %s failed (%s)\n",
fname, nt_errstr(status));
correct = False;
}
rand_buf(param, param_len);
- SSVAL(param,0,api);
+ SSVAL(param,0,api);
- cli_api(cli,
- param, param_len, 8,
+ cli_api(cli,
+ param, param_len, 8,
NULL, 0, CLI_BUFFER_SIZE,
- &rparam, &rprcnt,
+ &rparam, &rprcnt,
&rdata, &rdrcnt);
if (i % 100 == 0) {
printf("%d/%d\r", i,count);
}
printf("domain list:\n");
- cli_NetServerEnum(cli, cli->server_domain,
+ cli_NetServerEnum(cli, cli->server_domain,
SV_TYPE_DOMAIN_ENUM,
browse_callback, NULL);
printf("machine list:\n");
- cli_NetServerEnum(cli, cli->server_domain,
+ cli_NetServerEnum(cli, cli->server_domain,
SV_TYPE_ALL,
browse_callback, NULL);
}
cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- cli_openx(cli, fname,
+ cli_openx(cli, fname,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE, &fnum);
cli_close(cli, fnum);
cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- cli_openx(cli, fname,
+ cli_openx(cli, fname,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE, &fnum);
cli_close(cli, fnum);
status = cli_qpathinfo2(cli,
correct = False;
}
- cli_openx(cli, fname2,
+ cli_openx(cli, fname2,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE, &fnum);
cli_writeall(cli, fnum, 0, (uint8_t *)&fnum, 0, sizeof(fnum), NULL);
cli_close(cli, fnum);
return False;
}
- cli_openx(cli, fname,
+ cli_openx(cli, fname,
O_RDWR | O_CREAT , DENY_NONE, &fnum);
for (level = 1004; level < 1040; level++) {
if (!NT_STATUS_IS_DOS(status)) {
nt_status = status;
} else {
- printf("/** Dos error on NT connection! (%s) */\n",
+ printf("/** Dos error on NT connection! (%s) */\n",
nt_errstr(status));
nt_status = NT_STATUS(0xc0000000);
}
/* Case #1: 32-bit NT errors */
if (NT_STATUS_IS_DOS(status)) {
- printf("/** NT error on DOS connection! (%s) */\n",
+ printf("/** NT error on DOS connection! (%s) */\n",
nt_errstr(status));
errnum = errclass = 0;
} else {
errnum = NT_STATUS_DOS_CODE(status);
}
- if (NT_STATUS_V(nt_status) != error) {
- printf("/*\t{ This NT error code was 'sqashed'\n\t from %s to %s \n\t during the session setup }\n*/\n",
- get_nt_error_c_code(talloc_tos(), NT_STATUS(error)),
+ if (NT_STATUS_V(nt_status) != error) {
+ printf("/*\t{ This NT error code was 'sqashed'\n\t from %s to %s \n\t during the session setup }\n*/\n",
+ get_nt_error_c_code(talloc_tos(), NT_STATUS(error)),
get_nt_error_c_code(talloc_tos(), nt_status));
}
- printf("\t{%s,\t%s,\t%s},\n",
- smb_dos_err_class(errclass),
- smb_dos_err_name(errclass, errnum),
+ printf("\t{%s,\t%s,\t%s},\n",
+ smb_dos_err_class(errclass),
+ smb_dos_err_name(errclass, errnum),
get_nt_error_c_code(talloc_tos(), NT_STATUS(error)));
TALLOC_FREE(user_creds);
printf("pid %d failed to start\n", (int)getpid());
_exit(1);
}
- smb_msleep(10);
+ smb_msleep(10);
}
child_status[i] = getpid();
}
for (i=0;torture_ops[i].name;i++) {
- fstr_sprintf(randomfname, "\\XX%x",
+ fstr_sprintf(randomfname, "\\XX%x",
(unsigned)random());
if (strequal(name, torture_ops[i].name)) {
printf("Running %s\n", name);
if (torture_ops[i].flags & FLAG_MULTIPROC) {
t = create_procs(torture_ops[i].fn, &result);
- if (!result) {
+ if (!result) {
ret = False;
printf("TEST %s FAILED!\n", name);
}
}
}
- printf("host=%s share=%s user=%s myname=%s\n",
+ printf("host=%s share=%s user=%s myname=%s\n",
host, share, username, myname);
torture_creds = cli_session_creds_init(frame,