cli_open(cli, fname,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE, &fnum);
cli_close(cli, fnum);
- if (!cli_getatr(cli, fname, NULL, NULL, &t)) {
+ if (!NT_STATUS_IS_OK(cli_getatr(cli, fname, NULL, NULL, &t))) {
printf("getatr failed (%s)\n", cli_errstr(cli));
correct = False;
}
t2 = t-60*60*24; /* 1 day ago */
- if (!cli_setatr(cli, fname, 0, t2)) {
+ if (!NT_STATUS_IS_OK(cli_setatr(cli, fname, 0, t2))) {
printf("setatr failed (%s)\n", cli_errstr(cli));
correct = True;
}
- if (!cli_getatr(cli, fname, NULL, NULL, &t)) {
+ if (!NT_STATUS_IS_OK(cli_getatr(cli, fname, NULL, NULL, &t))) {
printf("getatr failed (%s)\n", cli_errstr(cli));
correct = True;
}
return False;
}
- if (!cli_setatr(cli1, fname, aRONLY, 0)) {
+ if (!NT_STATUS_IS_OK(cli_setatr(cli1, fname, aRONLY, 0))) {
printf("cli_setatr failed (%s)\n", cli_errstr(cli1));
return False;
}
}
/* Ensure size == 20. */
- if (!cli_getatr(cli1, fname, NULL, &fsize, NULL)) {
+ if (!NT_STATUS_IS_OK(cli_getatr(cli1, fname, NULL, &fsize, NULL))) {
printf("(3) getatr failed (%s)\n", cli_errstr(cli1));
return False;
}
}
/* Ensure size == 0. */
- if (!cli_getatr(cli1, fname, NULL, &fsize, NULL)) {
+ if (!NT_STATUS_IS_OK(cli_getatr(cli1, fname, NULL, &fsize, NULL))) {
printf("(3) getatr failed (%s)\n", cli_errstr(cli1));
return False;
}
/* Create a directory. */
if (cli_posix_mkdir(cli1, dname, 0777) == -1) {
- printf("Server doesn't support setting UNIX CIFS extensions.\n");
+ printf("POSIX mkdir of %s failed (%s)\n", dname, cli_errstr(cli1));
goto out;
}
return False;
}
- if (!cli_getatr(cli1, fname, &attr, NULL, NULL)) {
+ if (!NT_STATUS_IS_OK(cli_getatr(cli1, fname, &attr, NULL, NULL))) {
printf("getatr(2) failed (%s)\n", cli_errstr(cli1));
return False;
}
return True;
}
+static void chain2_sesssetup_completion(struct tevent_req *req)
+{
+ NTSTATUS status;
+ status = cli_session_setup_guest_recv(req);
+ d_printf("sesssetup returned %s\n", nt_errstr(status));
+}
+
+static void chain2_tcon_completion(struct tevent_req *req)
+{
+ bool *done = (bool *)tevent_req_callback_data_void(req);
+ NTSTATUS status;
+ status = cli_tcon_andx_recv(req);
+ d_printf("tcon_and_x returned %s\n", nt_errstr(status));
+ *done = true;
+}
+
+static bool run_chain2(int dummy)
+{
+ struct cli_state *cli1;
+ struct event_context *evt = event_context_init(NULL);
+ struct tevent_req *reqs[2], *smbreqs[2];
+ bool done = false;
+
+ printf("starting chain2 test\n");
+ if (!torture_open_connection(&cli1, 0)) {
+ return False;
+ }
+
+ cli_sockopt(cli1, sockops);
+
+ reqs[0] = cli_session_setup_guest_create(talloc_tos(), evt, cli1,
+ &smbreqs[0]);
+ if (reqs[0] == NULL) return false;
+ tevent_req_set_callback(reqs[0], chain2_sesssetup_completion, NULL);
+
+ reqs[1] = cli_tcon_andx_create(talloc_tos(), evt, cli1, "IPC$",
+ "?????", NULL, 0, &smbreqs[1]);
+ if (reqs[1] == NULL) return false;
+ tevent_req_set_callback(reqs[1], chain2_tcon_completion, &done);
+
+ if (!cli_smb_chain_send(smbreqs, ARRAY_SIZE(smbreqs))) {
+ return false;
+ }
+
+ while (!done) {
+ event_loop_once(evt);
+ }
+
+ torture_close_connection(cli1);
+ return True;
+}
+
static bool run_mangle1(int dummy)
{
struct cli_state *cli;
{
static struct cli_state *cli;
int16_t old_vuid;
+ int16_t old_cnum;
bool correct = True;
printf("starting uid regression test\n");
NT_STATUS_NO_SUCH_USER)) {
return False;
}
- goto out;
+ }
+
+ old_cnum = cli->cnum;
+
+ /* Now try a SMBtdis with the invald vuid set to zero. */
+ cli->vuid = 0;
+
+ /* This should succeed. */
+ if (cli_tdis(cli)) {
+ printf("First tdis with invalid vuid should succeed.\n");
+ } else {
+ printf("First tdis failed (%s)\n", cli_errstr(cli));
+ }
+
+ cli->vuid = old_vuid;
+ cli->cnum = old_cnum;
+
+ /* This should fail. */
+ if (cli_tdis(cli)) {
+ printf("Second tdis with invalid vuid should fail - succeeded instead !.\n");
+ } else {
+ /* Should be bad tid. */
+ if (!check_error(__LINE__, cli, ERRSRV, ERRinvnid,
+ NT_STATUS_NETWORK_NAME_DELETED)) {
+ return False;
+ }
}
cli_rmdir(cli, "\\uid_reg_test");
out:
- torture_close_connection(cli);
+ cli_shutdown(cli);
return correct;
}
{ "EATEST", run_eatest, 0},
{ "SESSSETUP_BENCH", run_sesssetup_bench, 0},
{ "CHAIN1", run_chain1, 0},
+ { "CHAIN2", run_chain2, 0},
{ "WINDOWS-WRITE", run_windows_write, 0},
{ "CLI_ECHO", run_cli_echo, 0},
{ "GETADDRINFO", run_getaddrinfo_send, 0},