#include "nsswitch/winbind_client.h"
#include "dbwrap/dbwrap.h"
#include "dbwrap/dbwrap_open.h"
+#include "dbwrap/dbwrap_rbt.h"
#include "talloc_dict.h"
#include "async_smb.h"
#include "libsmb/libsmb.h"
#include "libsmb/nmblib.h"
#include "../lib/util/tevent_ntstatus.h"
#include "util_tdb.h"
-#include "libsmb/read_smb.h"
+#include "../libcli/smb/read_smb.h"
extern char *optarg;
extern int optind;
static bool use_oplocks;
static bool use_level_II_oplocks;
static const char *client_txt = "client_oplocks.txt";
+static bool disable_spnego;
static bool use_kerberos;
+static bool force_dos_errors;
static fstring multishare_conn_fname;
static bool use_multishare_conn = False;
static bool do_encrypt;
static const char *local_path = NULL;
-static int signing_state = Undefined;
+static int signing_state = SMB_SIGNING_DEFAULT;
char *test_filename;
bool torture_showall = False;
{
struct cli_state *c;
NTSTATUS status;
+ int flags = 0;
+
+ if (disable_spnego) {
+ flags |= CLI_FULL_CONNECTION_DONT_SPNEGO;
+ }
+
+ if (use_oplocks) {
+ flags |= CLI_FULL_CONNECTION_OPLOCKS;
+ }
+
+ if (use_level_II_oplocks) {
+ flags |= CLI_FULL_CONNECTION_LEVEL_II_OPLOCKS;
+ }
+
+ if (use_kerberos) {
+ flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
+ }
+
+ if (force_dos_errors) {
+ flags |= CLI_FULL_CONNECTION_FORCE_DOS_ERRORS;
+ }
status = cli_connect_nb(host, NULL, port_to_use, 0x20, myname,
- signing_state, &c);
+ signing_state, flags, &c);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect with %s. Error %s\n", host, nt_errstr(status) );
return NULL;
}
- c->use_kerberos = use_kerberos;
-
- c->timeout = 120000; /* set a really long timeout (2 minutes) */
- if (use_oplocks) c->use_oplocks = True;
- if (use_level_II_oplocks) c->use_level_II_oplocks = True;
+ cli_set_timeout(c, 120000); /* set a really long timeout (2 minutes) */
return c;
}
bool ret = false;
uint8_t message_type;
uint8_t error;
+ struct event_context *ev;
+ struct tevent_req *req;
frame = talloc_stackframe();
if (len == -1) {
goto fail;
}
- len = read_smb(fd, talloc_tos(), &inbuf, &err);
+
+ ev = event_context_init(frame);
+ if (ev == NULL) {
+ goto fail;
+ }
+ req = read_smb_send(frame, ev, fd);
+ if (req == NULL) {
+ goto fail;
+ }
+ if (!tevent_req_poll(req, ev)) {
+ goto fail;
+ }
+ len = read_smb_recv(req, talloc_tos(), &inbuf, &err);
if (len == -1) {
errno = err;
goto fail;
}
+ TALLOC_FREE(ev);
message_type = CVAL(inbuf, 0);
if (message_type != 0x83) {
return False;
}
- (*c)->timeout = 120000; /* set a really long timeout (2 minutes) */
+ cli_set_timeout(*c, 120000); /* set a really long timeout (2 minutes) */
if (do_encrypt) {
return force_cli_encryption(*c,
memset(buf, '\0', sizeof(buf));
- status = cli_open(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_open(c, lockfname, O_RDWR, DENY_NONE, &fnum2);
+ status = cli_openx(c, lockfname, O_RDWR, DENY_NONE, &fnum2);
}
if (!NT_STATUS_IS_OK(status)) {
printf("open of %s failed (%s)\n",
return False;
}
- status = cli_open(c, fname, O_RDWR | O_CREAT | O_TRUNC,
+ status = cli_openx(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));
"not exist)\n", nt_errstr(status));
}
- status = cli_open(c, lockfname, O_RDWR | O_CREAT | O_EXCL,
+ status = cli_openx(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",
{
for (i = 0; i < 500 && fnum == (uint16_t)-1; i++)
{
- status = cli_open(c, lockfname, O_RDONLY,
+ status = cli_openx(c, lockfname, O_RDONLY,
DENY_NONE, &fnum);
if (!NT_STATUS_IS_OK(status)) {
break;
printf("unlink failed (%s) (normal, this file should not exist)\n", nt_errstr(status));
}
- status = cli_open(c1, lockfname, O_RDWR | O_CREAT | O_EXCL,
+ status = cli_openx(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",
return False;
}
- status = cli_open(c2, lockfname, O_RDONLY, DENY_NONE, &fnum2);
+ status = cli_openx(c2, lockfname, O_RDONLY, DENY_NONE, &fnum2);
if (!NT_STATUS_IS_OK(status)) {
printf("second open read-only of %s failed (%s)\n",
lockfname, nt_errstr(status));
return test;
}
-static bool run_readwritelarge_internal(int max_xmit_k)
+static bool run_readwritelarge_internal(void)
{
static struct cli_state *cli1;
uint16_t fnum1;
cli_sockopt(cli1, sockops);
memset(buf,'\0',sizeof(buf));
- cli1->max_xmit = max_xmit_k*1024;
-
- if (signing_state == Required) {
- /* Horrible cheat to force
- multiple signed outstanding
- packets against a Samba server.
- */
- cli1->is_samba = false;
- }
-
printf("starting readwritelarge_internal\n");
cli_unlink(cli1, lockfname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- status = cli_open(cli1, lockfname, O_RDWR | O_CREAT | O_EXCL,
+ status = cli_openx(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));
correct = False;
}
- status = cli_open(cli1, lockfname, O_RDWR | O_CREAT | O_EXCL,
+ status = cli_openx(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;
}
- cli1->max_xmit = 4*1024;
-
cli_smbwrite(cli1, fnum1, buf, 0, sizeof(buf), NULL);
status = cli_qfileinfo_basic(cli1, fnum1, NULL, &fsize, NULL, NULL,
static bool run_readwritelarge(int dummy)
{
- return run_readwritelarge_internal(128);
+ return run_readwritelarge_internal();
}
static bool run_readwritelarge_signtest(int dummy)
{
bool ret;
- signing_state = Required;
- ret = run_readwritelarge_internal(2);
- signing_state = Undefined;
+ signing_state = SMB_SIGNING_REQUIRED;
+ ret = run_readwritelarge_internal();
+ signing_state = SMB_SIGNING_DEFAULT;
return ret;
}
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE,
+ status = cli_openx(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;
}
- status = cli_open(cli1, fname, O_RDWR, DENY_NONE, &fnum2);
+ status = cli_openx(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;
}
- status = cli_open(cli2, fname, O_RDWR, DENY_NONE, &fnum3);
+ status = cli_openx(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;
cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- status = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
+ status = cli_openx(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;
return False;
}
- status = cli_tcon_andx(cli, share, "?????",
- password, strlen(password)+1);
+ status = cli_tree_connect(cli, share, "?????",
+ password, strlen(password)+1);
if (!NT_STATUS_IS_OK(status)) {
printf("%s refused 2nd tree connect (%s)\n", host,
nt_errstr(status));
NTSTATUS status;
bool ret;
- status = cli_tcon_andx(cli, myshare, devtype,
- password, strlen(password)+1);
+ status = cli_tree_connect(cli, myshare, devtype,
+ password, strlen(password)+1);
if (NT_STATUS_IS_OK(expected_error)) {
if (NT_STATUS_IS_OK(status)) {
myshare, devtype);
ret = False;
} else {
- if (NT_STATUS_EQUAL(cli_nt_error(cli),
- expected_error)) {
+ if (NT_STATUS_EQUAL(status, expected_error)) {
ret = True;
} else {
printf("Returned unexpected error\n");
cli_setpid(cli, 1);
- status = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
+ status = cli_openx(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;
}
- status = cli_open(cli, fname, O_RDWR, DENY_NONE, &fnum2);
+ status = cli_openx(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);
- status = cli_open(cli, fname, O_RDWR, DENY_NONE, &fnum3);
+ status = cli_openx(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_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE,
+ status = cli_openx(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;
}
- status = cli_open(cli2, fname, O_RDWR, DENY_NONE, &fnum2);
+ status = cli_openx(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;
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
- cli_open(cli2, fname, O_RDWR, DENY_NONE, &fnum2);
+ cli_openx(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
+ cli_openx(cli2, fname, O_RDWR, DENY_NONE, &fnum2);
memset(buf, 0, sizeof(buf));
cli_close(cli1, fnum1);
cli_close(cli2, fnum2);
- cli_open(cli1, fname, O_RDWR, DENY_NONE, &fnum1);
- cli_open(cli1, fname, O_RDWR, DENY_NONE, &f);
+ cli_openx(cli1, fname, O_RDWR, DENY_NONE, &fnum1);
+ cli_openx(cli1, fname, O_RDWR, DENY_NONE, &f);
ret = NT_STATUS_IS_OK(cli_lock32(cli1, fnum1, 0, 8, 0, READ_LOCK)) &&
NT_STATUS_IS_OK(cli_lock32(cli1, f, 0, 1, 0, READ_LOCK)) &&
NT_STATUS_IS_OK(cli_close(cli1, fnum1)) &&
- NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDWR, DENY_NONE, &fnum1)) &&
+ NT_STATUS_IS_OK(cli_openx(cli1, fname, O_RDWR, DENY_NONE, &fnum1)) &&
NT_STATUS_IS_OK(cli_lock32(cli1, fnum1, 7, 1, 0, WRITE_LOCK));
cli_close(cli1, f);
cli_close(cli1, fnum1);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
- cli_open(cli2, fname, O_RDWR, DENY_NONE, &fnum2);
- cli_open(cli1, fname, O_RDWR, DENY_NONE, &fnum3);
+ cli_openx(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
+ cli_openx(cli2, fname, O_RDWR, DENY_NONE, &fnum2);
+ cli_openx(cli1, fname, O_RDWR, DENY_NONE, &fnum3);
memset(buf, 0, sizeof(buf));
ret = NT_STATUS_IS_OK(cli_lock32(cli1, fnum1, 0, 8, 0, READ_LOCK)) &&
NT_STATUS_IS_OK(cli_lock32(cli1, fnum3, 0, 1, 0, READ_LOCK));
cli_close(cli1, fnum1);
- cli_open(cli1, fname, O_RDWR, DENY_NONE, &fnum1);
+ cli_openx(cli1, fname, O_RDWR, DENY_NONE, &fnum1);
status = cli_lock32(cli1, fnum1, 7, 1, 0, WRITE_LOCK);
ret = NT_STATUS_IS_OK(status);
EXPECTED(ret, True);
printf("this server %s the NT locking bug\n", ret ? "doesn't have" : "has");
cli_close(cli1, fnum1);
- cli_open(cli1, fname, O_RDWR, DENY_NONE, &fnum1);
+ cli_openx(cli1, fname, O_RDWR, DENY_NONE, &fnum1);
cli_unlock(cli1, fnum3, 0, 1);
ret = NT_STATUS_IS_OK(cli_lock32(cli1, fnum1, 0, 4, 0, WRITE_LOCK)) &&
cli_unlink(cli, fname[i], FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- cli_open(cli, fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum);
+ cli_openx(cli, fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum);
status = cli_locktype(cli, fnum, 0, 8, 0, LOCKING_ANDX_CHANGE_LOCKTYPE);
cli_close(cli, fnum);
printf("CHANGE_LOCKTYPE gave %s\n", nt_errstr(status));
- cli_open(cli, fname[i], O_RDWR, DENY_NONE, &fnum);
+ cli_openx(cli, fname[i], O_RDWR, DENY_NONE, &fnum);
status = cli_locktype(cli, fnum, 0, 8, 0, LOCKING_ANDX_CANCEL_LOCK);
cli_close(cli, fnum);
printf("CANCEL_LOCK gave %s\n", nt_errstr(status));
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
+ cli_openx(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
memset(buf, 0, sizeof(buf));
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_WRITE,
+ status = cli_openx(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", nt_errstr(status));
+ d_fprintf(stderr, "cli_openx returned %s\n", nt_errstr(status));
return false;
}
memset(buf, 0, sizeof(buf));
- status = cli_open(cli1, fname, O_RDONLY, DENY_NONE, &fnum2);
+ status = cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum2);
if (!NT_STATUS_IS_OK(status)) {
- d_fprintf(stderr, "cli_open second time returned %s\n",
+ d_fprintf(stderr, "cli_openx second time returned %s\n",
nt_errstr(status));
goto fail;
}
goto fail;
}
- status = cli_open(cli1, fname, O_RDWR, DENY_NONE, &fnum1);
+ status = cli_openx(cli1, fname, O_RDWR, DENY_NONE, &fnum1);
if (!NT_STATUS_IS_OK(status)) {
- d_fprintf(stderr, "cli_open third time returned %s\n",
+ d_fprintf(stderr, "cli_openx third time returned %s\n",
nt_errstr(status));
goto fail;
}
cli_sockopt(cli1, sockops);
- status = cli_open(cli1, fname, O_RDWR, DENY_NONE,
+ status = cli_openx(cli1, fname, O_RDWR, DENY_NONE,
&fnum);
if (!NT_STATUS_IS_OK(status)) {
- d_fprintf(stderr, "cli_open returned %s\n", nt_errstr(status));
+ d_fprintf(stderr, "cli_openx returned %s\n", nt_errstr(status));
return false;
}
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE,
+ status = cli_openx(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;
saved_cnum = cli_state_get_tid(cli);
- if (!NT_STATUS_IS_OK(cli_tcon_andx(cli, share, "?????", "", 1)))
+ if (!NT_STATUS_IS_OK(cli_tree_connect(cli, share, "?????", "", 1)))
return False;
new_cnum = cli_state_get_tid(cli);
cli_state_set_tid(cli, saved_cnum);
cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
cli_unlink(cli, fname1, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- status = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
+ status = cli_openx(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;
ret = false;
}
/* Try to open a file with different vuid, samba cnum. */
- if (NT_STATUS_IS_OK(cli_open(cli, fname1, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum2))) {
+ if (NT_STATUS_IS_OK(cli_openx(cli, fname1, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum2))) {
printf("create with different vuid, same cnum succeeded.\n");
cli_close(cli, fnum2);
cli_unlink(cli, fname1, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
cli_setpid(cli, 1);
- status = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum);
+ status = cli_openx(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;
for (i=0; i<0x11000; i++) {
slprintf(fname,sizeof(fname)-1,"\\maxfid.%d.%d", i,(int)getpid());
- status = cli_open(cli, fname, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE,
+ 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",
for (i=0;i<50000;i++) {
struct tevent_req *req;
- req = cli_negprot_send(ev, ev, cli);
+ req = cli_negprot_send(ev, ev, cli, PROTOCOL_NT1);
if (req == NULL) {
TALLOC_FREE(ev);
return false;
}
cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- cli_open(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_open(cli, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE, &fnum);
+ cli_openx(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)) {
sleep(2);
cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- status = cli_open(cli, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE,
+ status = cli_openx(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));
printf("ERROR: qpathinfo failed (%s)\n", nt_errstr(status));
correct = False;
} else {
+ time_t t = time(NULL);
+
if (c_time != m_time) {
printf("create time=%s", ctime(&c_time));
printf("modify time=%s", ctime(&m_time));
printf("This system appears to have sticky create times\n");
}
- if (a_time % (60*60) == 0) {
+ if ((abs(a_time - t) > 60) && (a_time % (60*60) == 0)) {
printf("access time=%s", ctime(&a_time));
printf("This system appears to set a midnight access time\n");
correct = False;
}
- if (abs(m_time - time(NULL)) > 60*60*24*7) {
+ if (abs(m_time - t) > 60*60*24*7) {
printf("ERROR: totally incorrect times - maybe word reversed? mtime=%s", ctime(&m_time));
correct = False;
}
cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- cli_open(cli, fname,
+ cli_openx(cli, fname,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE, &fnum);
cli_close(cli, fnum);
status = cli_qpathinfo2(cli, fname, &c_time_ts, &a_time_ts, &w_time_ts,
correct = False;
}
- cli_open(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);
NTSTATUS status;
status = cli_qfileinfo(talloc_tos(), pcli, fnum, level, 0,
- pcli->max_xmit, NULL, &buf, &len);
+ CLI_BUFFER_SIZE, NULL, &buf, &len);
if (!NT_STATUS_IS_OK(status)) {
printf("ERROR: qfileinfo (%d) failed (%s)\n", level,
nt_errstr(status));
return False;
}
- cli_open(cli, fname,
+ cli_openx(cli, fname,
O_RDWR | O_CREAT , DENY_NONE, &fnum);
for (level = 1004; level < 1040; level++) {
cli1->use_oplocks = True;
- status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE,
+ status = cli_openx(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;
}
- cli1->use_oplocks = True;
- cli1->use_level_II_oplocks = True;
-
if (!torture_open_connection(&cli2, 1)) {
use_level_II_oplocks = False;
use_oplocks = saved_use_oplocks;
return False;
}
- cli2->use_oplocks = True;
- cli2->use_level_II_oplocks = True;
-
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
cli_sockopt(cli1, sockops);
cli_sockopt(cli2, sockops);
- status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE,
+ status = cli_openx(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));
if (fork() == 0) {
/* Child code */
- status = cli_open(cli2, fname, O_RDWR, DENY_NONE, &fnum2);
+ status = cli_openx(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;
cli_sockopt(cli2, sockops);
/* Create the file. */
- status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE,
+ status = cli_openx(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));
}
/* Prove that opening hardlinks cause deny modes to conflict. */
- status = cli_open(cli1, fname, O_RDWR, DENY_ALL, &fnum1);
+ status = cli_openx(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;
}
- status = cli_open(cli1, fname_ln, O_RDWR, DENY_NONE, &fnum2);
+ status = cli_openx(cli1, fname_ln, O_RDWR, DENY_NONE, &fnum2);
if (NT_STATUS_IS_OK(status)) {
printf("open of %s succeeded - should fail with sharing violation.\n",
fname_ln);
}
cli1->use_oplocks = true;
- cli1->use_level_II_oplocks = true;
-
cli2->use_oplocks = true;
- cli2->use_level_II_oplocks = true;
- status = cli_open(cli1, fname, O_RDWR, DENY_NONE, &fnum1);
+ status = cli_openx(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;
ev = tevent_context_init(talloc_tos());
if (ev == NULL) {
- printf("tevent_req_create failed\n");
+ printf("tevent_context_init failed\n");
return false;
}
}
tevent_req_set_callback(oplock_req, oplock4_got_break, state);
- open_req = cli_open_send(
+ open_req = cli_openx_send(
talloc_tos(), ev, cli2, fname_ln, O_RDWR, DENY_NONE);
- if (oplock_req == NULL) {
- printf("cli_open_send failed\n");
+ if (open_req == NULL) {
+ printf("cli_openx_send failed\n");
return false;
}
tevent_req_set_callback(open_req, oplock4_got_open, state);
req, struct oplock4_state);
NTSTATUS status;
- status = cli_open_recv(req, state->fnum2);
+ status = cli_openx_recv(req, state->fnum2);
if (!NT_STATUS_IS_OK(status)) {
- printf("cli_open_recv returned %s\n", nt_errstr(status));
+ printf("cli_openx_recv returned %s\n", nt_errstr(status));
*state->fnum2 = 0xffff;
}
}
goto fail;
}
- if (NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDWR, DENY_NONE, &fnum1))) {
+ if (NT_STATUS_IS_OK(cli_openx(cli1, fname, O_RDWR, DENY_NONE, &fnum1))) {
printf("[1] open of %s succeeded (should fail)\n", fname);
correct = False;
goto fail;
goto fail;
}
- if (NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
+ if (NT_STATUS_IS_OK(cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
printf("[2] open of %s succeeded should have been deleted on close !\n", fname);
status = cli_close(cli1, fnum1);
if (!NT_STATUS_IS_OK(status)) {
/* This should fail - file should no longer be there. */
- if (NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
+ if (NT_STATUS_IS_OK(cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
printf("[3] open of %s succeeded should have been deleted on close !\n", fname);
status = cli_close(cli1, fnum1);
if (!NT_STATUS_IS_OK(status)) {
cli_setatr(cli1, fname, 0, 0);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- status = cli_open(cli1, fname, O_RDWR|O_CREAT, DENY_NONE, &fnum1);
+ status = cli_openx(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;
}
/* This next open should succeed - we reset the flag. */
- status = cli_open(cli1, fname, O_RDONLY, DENY_NONE, &fnum1);
+ status = cli_openx(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;
}
/* This should fail.. */
- status = cli_open(cli1, fname, O_RDONLY, DENY_NONE, &fnum1);
+ status = cli_openx(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;
}
/* This should fail.. */
- if (NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
+ if (NT_STATUS_IS_OK(cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
printf("[10] open of %s succeeded should have been deleted on close !\n", fname);
goto fail;
correct = False;
}
/* Now try open for delete access. */
- if (NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, FILE_READ_ATTRIBUTES|DELETE_ACCESS,
- 0, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1))) {
+ status = cli_ntcreate(cli1, fname, 0,
+ FILE_READ_ATTRIBUTES|DELETE_ACCESS,
+ 0,
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ if (NT_STATUS_IS_OK(status)) {
printf("[11] open of %s succeeded should have been denied with ACCESS_DENIED!\n", fname);
cli_close(cli1, fnum1);
goto fail;
correct = False;
} else {
- NTSTATUS nterr = cli_nt_error(cli1);
- if (!NT_STATUS_EQUAL(nterr,NT_STATUS_ACCESS_DENIED)) {
- printf("[11] open of %s should have been denied with ACCESS_DENIED! Got error %s\n", fname, nt_errstr(nterr));
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
+ printf("[11] open of %s should have been denied with ACCESS_DENIED! Got error %s\n", fname, nt_errstr(status));
goto fail;
correct = False;
} else {
cli_sockopt(cli, sockops);
/* Create the file. */
- status = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum);
+ status = cli_openx(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;
cli_sockopt(cli1, sockops);
- status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
+ status = cli_openx(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;
return False;
}
- status = cli_open(cli1, fname, O_RDONLY, DENY_WRITE, &fnum1);
+ status = cli_openx(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;
}
/* This will fail - but the error should be ERRnoaccess, not ERRbadshare. */
- status = cli_open(cli1, fname, O_RDWR, DENY_ALL, &fnum2);
+ status = cli_openx(cli1, fname, O_RDWR, DENY_ALL, &fnum2);
if (check_error(__LINE__, status, ERRDOS, ERRnoaccess,
NT_STATUS_ACCESS_DENIED)) {
cli_setatr(cli1, fname, 0, 0);
- status = cli_open(cli1, fname, O_RDONLY, DENY_WRITE, &fnum1);
+ status = cli_openx(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;
}
/* This will fail - but the error should be ERRshare. */
- status = cli_open(cli1, fname, O_RDWR, DENY_ALL, &fnum2);
+ status = cli_openx(cli1, fname, O_RDWR, DENY_ALL, &fnum2);
if (check_error(__LINE__, status, ERRDOS, ERRbadshare,
NT_STATUS_SHARING_VIOLATION)) {
printf("finished open test 2\n");
/* Test truncate open disposition on file opened for read. */
- status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
+ status = cli_openx(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;
}
/* Now test if we can truncate a file opened for readonly. */
- status = cli_open(cli1, fname, O_RDONLY|O_TRUNC, DENY_NONE, &fnum1);
+ status = cli_openx(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;
for (i=0;i<torture_numops;i++) {
fstring fname;
slprintf(fname, sizeof(fname), "\\%x", (int)random());
- if (!NT_STATUS_IS_OK(cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE, &fnum))) {
+ if (!NT_STATUS_IS_OK(cli_openx(cli, fname, O_RDWR|O_CREAT, DENY_NONE, &fnum))) {
fprintf(stderr,"Failed to open %s\n", fname);
return False;
}
cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- status = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum);
+ status = cli_openx(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;
return False;
}
- status = cli_open(cli, "\\chkpath.dir\\foo.txt", O_RDWR|O_CREAT|O_EXCL,
+ status = cli_openx(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));
/* NT-Error connection */
+ disable_spnego = true;
if (!(c_nt = open_nbt_connection())) {
+ disable_spnego = false;
return False;
}
+ disable_spnego = false;
- c_nt->use_spnego = False;
-
- status = cli_negprot(c_nt);
+ status = cli_negprot(c_nt, PROTOCOL_NT1);
if (!NT_STATUS_IS_OK(status)) {
printf("%s rejected the NT-error negprot (%s)\n", host,
/* DOS-Error connection */
+ disable_spnego = true;
+ force_dos_errors = true;
if (!(c_dos = open_nbt_connection())) {
+ disable_spnego = false;
+ force_dos_errors = false;
return False;
}
+ disable_spnego = false;
+ force_dos_errors = false;
- c_dos->use_spnego = False;
- c_dos->force_dos_errors = True;
-
- status = cli_negprot(c_dos);
+ status = cli_negprot(c_dos, PROTOCOL_NT1);
if (!NT_STATUS_IS_OK(status)) {
printf("%s rejected the DOS-error negprot (%s)\n", host,
nt_errstr(status));
return False;
}
+ c_nt->map_dos_errors = false;
+ c_dos->map_dos_errors = false;
+
for (error=(0xc0000000 | 0x1); error < (0xc0000000| 0xFFF); error++) {
fstr_sprintf(user, "%X", error);
}
/* Case #1: 32-bit NT errors */
- if (cli_is_nt_error(c_nt)) {
- nt_status = cli_nt_error(c_nt);
+ if (!NT_STATUS_IS_DOS(status)) {
+ nt_status = status;
} else {
printf("/** Dos error on NT connection! (%s) */\n",
- cli_errstr(c_nt));
+ nt_errstr(status));
nt_status = NT_STATUS(0xc0000000);
}
}
/* Case #1: 32-bit NT errors */
- if (!cli_is_dos_error(c_dos)) {
+ if (NT_STATUS_IS_DOS(status)) {
printf("/** NT error on DOS connection! (%s) */\n",
- cli_errstr(c_dos));
+ nt_errstr(status));
errnum = errclass = 0;
} else {
- cli_dos_error(c_dos, &errclass, &errnum);
+ errclass = NT_STATUS_DOS_CLASS(status);
+ errnum = NT_STATUS_DOS_CODE(status);
}
if (NT_STATUS_V(nt_status) != error) {
{
uint16_t fnum;
NTSTATUS status;
- status = cli_open_recv(req, &fnum);
+ status = cli_openx_recv(req, &fnum);
TALLOC_FREE(req);
- d_printf("cli_open_recv returned %s: %d\n",
+ d_printf("cli_openx_recv returned %s: %d\n",
nt_errstr(status),
NT_STATUS_IS_OK(status) ? fnum : -1);
}
cli_sockopt(cli1, sockops);
- reqs[0] = cli_open_create(talloc_tos(), evt, cli1, "\\test",
+ reqs[0] = cli_openx_create(talloc_tos(), evt, cli1, "\\test",
O_CREAT|O_RDWR, 0, &smbreqs[0]);
if (reqs[0] == NULL) return false;
tevent_req_set_callback(reqs[0], chain1_open_completion, NULL);
}
while (!done) {
- event_loop_once(evt);
+ tevent_loop_once(evt);
}
torture_close_connection(cli1);
printf("starting chain2 test\n");
status = cli_start_connection(&cli1, lp_netbios_name(), host, NULL,
- port_to_use, Undefined, 0);
+ port_to_use, SMB_SIGNING_DEFAULT, 0);
if (!NT_STATUS_IS_OK(status)) {
return False;
}
}
while (!done) {
- event_loop_once(evt);
+ tevent_loop_once(evt);
}
torture_close_connection(cli1);
}
d_printf("alt_name: %s\n", alt_name);
- status = cli_open(cli, alt_name, O_RDONLY, DENY_NONE, &fnum);
+ status = cli_openx(cli, alt_name, O_RDONLY, DENY_NONE, &fnum);
if (!NT_STATUS_IS_OK(status)) {
- d_printf("cli_open(%s) failed: %s\n", alt_name,
+ d_printf("cli_openx(%s) failed: %s\n", alt_name,
nt_errstr(status));
return false;
}
return False;
}
- status = cli_open(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum);
+ status = cli_openx(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;
/* Sleep 3 seconds, then create a file. */
sleep(3);
- status = cli_open(cli, fname, O_RDWR | O_CREAT | O_EXCL,
+ status = cli_openx(cli, fname, O_RDWR | O_CREAT | O_EXCL,
DENY_NONE, &fnum);
if (!NT_STATUS_IS_OK(status)) {
- printf("cli_open failed: %s\n", nt_errstr(status));
+ printf("cli_openx failed: %s\n", nt_errstr(status));
goto out;
}
return false;
}
- cli_qpathinfo1(cli, streamname, &change_time, &access_time, &write_time,
- &size, &mode);
- status = cli_nt_error(cli);
-
+ status = cli_qpathinfo1(cli, streamname, &change_time, &access_time,
+ &write_time, &size, &mode);
if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
printf("pathinfo returned %s, expected "
"NT_STATUS_OBJECT_NAME_NOT_FOUND\n",
TDB_DATA data = string_tdb_data(value);
bool ret = false;
NTSTATUS status;
+ TDB_DATA dbvalue;
- rec = db->fetch_locked(db, db, string_tdb_data(key));
+ rec = dbwrap_fetch_locked(db, db, string_tdb_data(key));
if (rec == NULL) {
d_fprintf(stderr, "fetch_locked failed\n");
goto done;
}
- status = rec->store(rec, data, 0);
+ status = dbwrap_record_store(rec, data, 0);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr, "store failed: %s\n", nt_errstr(status));
goto done;
}
TALLOC_FREE(rec);
- rec = db->fetch_locked(db, db, string_tdb_data(key));
+ rec = dbwrap_fetch_locked(db, db, string_tdb_data(key));
if (rec == NULL) {
d_fprintf(stderr, "second fetch_locked failed\n");
goto done;
}
- if ((rec->value.dsize != data.dsize)
- || (memcmp(rec->value.dptr, data.dptr, data.dsize) != 0)) {
+
+ dbvalue = dbwrap_record_get_value(rec);
+ if ((dbvalue.dsize != data.dsize)
+ || (memcmp(dbvalue.dptr, data.dptr, data.dsize) != 0)) {
d_fprintf(stderr, "Got wrong data back\n");
goto done;
}
size_t size1, size2;
bool ret = false;
- cache = memcache_init(NULL, 100);
+ cache = memcache_init(NULL, sizeof(void *) == 8 ? 200 : 100);
if (cache == NULL) {
printf("memcache_init failed\n");
i = 0;
while (i < nprocs * torture_numops) {
- event_loop_once(ev);
+ tevent_loop_once(ev);
}
result = true;
static bool dbtrans_inc(struct db_context *db)
{
struct db_record *rec;
- uint32_t *val;
+ uint32_t val;
bool ret = false;
NTSTATUS status;
+ TDB_DATA value;
- rec = db->fetch_locked(db, db, string_term_tdb_data("transtest"));
+ rec = dbwrap_fetch_locked(db, db, string_term_tdb_data("transtest"));
if (rec == NULL) {
printf(__location__ "fetch_lock failed\n");
return false;
}
- if (rec->value.dsize != sizeof(uint32_t)) {
+ value = dbwrap_record_get_value(rec);
+
+ if (value.dsize != sizeof(uint32_t)) {
printf(__location__ "value.dsize = %d\n",
- (int)rec->value.dsize);
+ (int)value.dsize);
goto fail;
}
- val = (uint32_t *)rec->value.dptr;
- *val += 1;
+ memcpy(&val, value.dptr, sizeof(val));
+ val += 1;
- status = rec->store(rec, make_tdb_data((uint8_t *)val,
- sizeof(uint32_t)),
- 0);
+ status = dbwrap_record_store(
+ rec, make_tdb_data((uint8_t *)&val, sizeof(val)), 0);
if (!NT_STATUS_IS_OK(status)) {
printf(__location__ "store failed: %s\n",
nt_errstr(status));
NTSTATUS status;
uint32_t initial;
int res;
+ TDB_DATA value;
db = db_open(talloc_tos(), "transtest.tdb", 0, TDB_DEFAULT,
- O_RDWR|O_CREAT, 0600);
+ O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_1);
if (db == NULL) {
printf("Could not open transtest.db\n");
return false;
}
- res = db->transaction_start(db);
+ res = dbwrap_transaction_start(db);
if (res != 0) {
printf(__location__ "transaction_start failed\n");
return false;
}
- rec = db->fetch_locked(db, db, string_term_tdb_data("transtest"));
+ rec = dbwrap_fetch_locked(db, db, string_term_tdb_data("transtest"));
if (rec == NULL) {
printf(__location__ "fetch_lock failed\n");
return false;
}
- if (rec->value.dptr == NULL) {
+ value = dbwrap_record_get_value(rec);
+
+ if (value.dptr == NULL) {
initial = 0;
- status = rec->store(
+ status = dbwrap_record_store(
rec, make_tdb_data((uint8_t *)&initial,
sizeof(initial)),
0);
TALLOC_FREE(rec);
- res = db->transaction_commit(db);
+ res = dbwrap_transaction_commit(db);
if (res != 0) {
printf(__location__ "transaction_commit failed\n");
return false;
uint32_t val, val2;
int i;
- res = db->transaction_start(db);
+ res = dbwrap_transaction_start(db);
if (res != 0) {
printf(__location__ "transaction_start failed\n");
break;
}
- if (!dbwrap_fetch_uint32(db, "transtest", &val)) {
- printf(__location__ "dbwrap_fetch_uint32 failed\n");
+ status = dbwrap_fetch_uint32(db, "transtest", &val);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf(__location__ "dbwrap_fetch_uint32 failed: %s\n",
+ nt_errstr(status));
break;
}
}
}
- if (!dbwrap_fetch_uint32(db, "transtest", &val2)) {
- printf(__location__ "dbwrap_fetch_uint32 failed\n");
+ status = dbwrap_fetch_uint32(db, "transtest", &val2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf(__location__ "dbwrap_fetch_uint32 failed: %s\n",
+ nt_errstr(status));
break;
}
printf("val2=%d\r", val2);
- res = db->transaction_commit(db);
+ res = dbwrap_transaction_commit(db);
if (res != 0) {
printf(__location__ "transaction_commit failed\n");
break;
return result;
}
+static bool run_local_hex_encode_buf(int dummy)
+{
+ char buf[17];
+ uint8_t src[8];
+ int i;
+
+ for (i=0; i<sizeof(src); i++) {
+ src[i] = i;
+ }
+ hex_encode_buf(buf, src, sizeof(src));
+ if (strcmp(buf, "0001020304050607") != 0) {
+ return false;
+ }
+ hex_encode_buf(buf, NULL, 0);
+ if (buf[0] != '\0') {
+ return false;
+ }
+ return true;
+}
+
static double create_procs(bool (*fn)(int), bool *result)
{
int i, status;
{ "CHAIN2", run_chain2, 0},
{ "WINDOWS-WRITE", run_windows_write, 0},
{ "NTTRANS-CREATE", run_nttrans_create, 0},
+ { "NTTRANS-FSCTL", run_nttrans_fsctl, 0},
{ "CLI_ECHO", run_cli_echo, 0},
{ "GETADDRINFO", run_getaddrinfo_send, 0},
{ "TLDAP", run_tldap },
{ "SMB-ANY-CONNECT", run_smb_any_connect },
{ "NOTIFY-ONLINE", run_notify_online },
{ "SMB2-BASIC", run_smb2_basic },
+ { "SMB2-NEGPROT", run_smb2_negprot },
+ { "SMB2-SESSION-RECONNECT", run_smb2_session_reconnect },
+ { "SMB2-TCON-DEPENDENCE", run_smb2_tcon_dependence },
+ { "SMB2-MULTI-CHANNEL", run_smb2_multi_channel },
+ { "SMB2-SESSION-REAUTH", run_smb2_session_reauth },
+ { "CLEANUP1", run_cleanup1 },
+ { "CLEANUP2", run_cleanup2 },
{ "LOCAL-SUBSTITUTE", run_local_substitute, 0},
{ "LOCAL-GENCACHE", run_local_gencache, 0},
{ "LOCAL-TALLOC-DICT", run_local_talloc_dict, 0},
{ "LOCAL-DBTRANS", run_local_dbtrans, 0},
{ "LOCAL-TEVENT-SELECT", run_local_tevent_select, 0},
{ "LOCAL-CONVERT-STRING", run_local_convert_string, 0},
+ { "LOCAL-CONV-AUTH-INFO", run_local_conv_auth_info, 0},
+ { "LOCAL-sprintf_append", run_local_sprintf_append, 0},
+ { "LOCAL-hex_encode_buf", run_local_hex_encode_buf, 0},
{NULL, NULL, 0}};