#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_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;
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) {
static bool run_readwritelarge_signtest(int dummy)
{
bool ret;
- signing_state = Required;
+ signing_state = SMB_SIGNING_REQUIRED;
ret = run_readwritelarge_internal();
- signing_state = Undefined;
+ signing_state = SMB_SIGNING_DEFAULT;
return ret;
}
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) {
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;
}
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;
}
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 = (uint32_t *)value.dptr;
*val += 1;
- status = rec->store(rec, make_tdb_data((uint8_t *)val,
+ status = dbwrap_record_store(rec, make_tdb_data((uint8_t *)val,
sizeof(uint32_t)),
0);
if (!NT_STATUS_IS_OK(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);
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;
{ "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},
{NULL, NULL, 0}};